media/libvpx/vp8/common/arm/variance_arm.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp8/common/arm/variance_arm.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,132 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +#include "vpx_config.h"
    1.15 +#include "vp8_rtcd.h"
    1.16 +#include "vp8/common/variance.h"
    1.17 +#include "vp8/common/filter.h"
    1.18 +
    1.19 +#if HAVE_MEDIA
    1.20 +#include "vp8/common/arm/bilinearfilter_arm.h"
    1.21 +
    1.22 +unsigned int vp8_sub_pixel_variance8x8_armv6
    1.23 +(
    1.24 +    const unsigned char  *src_ptr,
    1.25 +    int  src_pixels_per_line,
    1.26 +    int  xoffset,
    1.27 +    int  yoffset,
    1.28 +    const unsigned char *dst_ptr,
    1.29 +    int dst_pixels_per_line,
    1.30 +    unsigned int *sse
    1.31 +)
    1.32 +{
    1.33 +    unsigned short first_pass[10*8];
    1.34 +    unsigned char  second_pass[8*8];
    1.35 +    const short *HFilter, *VFilter;
    1.36 +
    1.37 +    HFilter = vp8_bilinear_filters[xoffset];
    1.38 +    VFilter = vp8_bilinear_filters[yoffset];
    1.39 +
    1.40 +    vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
    1.41 +                                            src_pixels_per_line,
    1.42 +                                            9, 8, HFilter);
    1.43 +    vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
    1.44 +                                             8, 8, 8, VFilter);
    1.45 +
    1.46 +    return vp8_variance8x8_armv6(second_pass, 8, dst_ptr,
    1.47 +                                   dst_pixels_per_line, sse);
    1.48 +}
    1.49 +
    1.50 +unsigned int vp8_sub_pixel_variance16x16_armv6
    1.51 +(
    1.52 +    const unsigned char  *src_ptr,
    1.53 +    int  src_pixels_per_line,
    1.54 +    int  xoffset,
    1.55 +    int  yoffset,
    1.56 +    const unsigned char *dst_ptr,
    1.57 +    int dst_pixels_per_line,
    1.58 +    unsigned int *sse
    1.59 +)
    1.60 +{
    1.61 +    unsigned short first_pass[36*16];
    1.62 +    unsigned char  second_pass[20*16];
    1.63 +    const short *HFilter, *VFilter;
    1.64 +    unsigned int var;
    1.65 +
    1.66 +    if (xoffset == 4 && yoffset == 0)
    1.67 +    {
    1.68 +        var = vp8_variance_halfpixvar16x16_h_armv6(src_ptr, src_pixels_per_line,
    1.69 +                                                   dst_ptr, dst_pixels_per_line, sse);
    1.70 +    }
    1.71 +    else if (xoffset == 0 && yoffset == 4)
    1.72 +    {
    1.73 +        var = vp8_variance_halfpixvar16x16_v_armv6(src_ptr, src_pixels_per_line,
    1.74 +                                                   dst_ptr, dst_pixels_per_line, sse);
    1.75 +    }
    1.76 +    else if (xoffset == 4 && yoffset == 4)
    1.77 +    {
    1.78 +        var = vp8_variance_halfpixvar16x16_hv_armv6(src_ptr, src_pixels_per_line,
    1.79 +                                                   dst_ptr, dst_pixels_per_line, sse);
    1.80 +    }
    1.81 +    else
    1.82 +    {
    1.83 +        HFilter = vp8_bilinear_filters[xoffset];
    1.84 +        VFilter = vp8_bilinear_filters[yoffset];
    1.85 +
    1.86 +        vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
    1.87 +                                                src_pixels_per_line,
    1.88 +                                                17, 16, HFilter);
    1.89 +        vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
    1.90 +                                                 16, 16, 16, VFilter);
    1.91 +
    1.92 +        var = vp8_variance16x16_armv6(second_pass, 16, dst_ptr,
    1.93 +                                       dst_pixels_per_line, sse);
    1.94 +    }
    1.95 +    return var;
    1.96 +}
    1.97 +
    1.98 +#endif /* HAVE_MEDIA */
    1.99 +
   1.100 +
   1.101 +#if HAVE_NEON
   1.102 +
   1.103 +extern unsigned int vp8_sub_pixel_variance16x16_neon_func
   1.104 +(
   1.105 +    const unsigned char  *src_ptr,
   1.106 +    int  src_pixels_per_line,
   1.107 +    int  xoffset,
   1.108 +    int  yoffset,
   1.109 +    const unsigned char *dst_ptr,
   1.110 +    int dst_pixels_per_line,
   1.111 +    unsigned int *sse
   1.112 +);
   1.113 +
   1.114 +unsigned int vp8_sub_pixel_variance16x16_neon
   1.115 +(
   1.116 +    const unsigned char  *src_ptr,
   1.117 +    int  src_pixels_per_line,
   1.118 +    int  xoffset,
   1.119 +    int  yoffset,
   1.120 +    const unsigned char *dst_ptr,
   1.121 +    int dst_pixels_per_line,
   1.122 +    unsigned int *sse
   1.123 +)
   1.124 +{
   1.125 +  if (xoffset == 4 && yoffset == 0)
   1.126 +    return vp8_variance_halfpixvar16x16_h_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
   1.127 +  else if (xoffset == 0 && yoffset == 4)
   1.128 +    return vp8_variance_halfpixvar16x16_v_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
   1.129 +  else if (xoffset == 4 && yoffset == 4)
   1.130 +    return vp8_variance_halfpixvar16x16_hv_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
   1.131 +  else
   1.132 +    return vp8_sub_pixel_variance16x16_neon_func(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse);
   1.133 +}
   1.134 +
   1.135 +#endif

mercurial