1/* 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11#include "vpx_config.h" 12#include "vp8_rtcd.h" 13#include "vp8/common/variance.h" 14#include "vp8/common/filter.h" 15 16#if HAVE_MEDIA 17#include "vp8/common/arm/bilinearfilter_arm.h" 18 19unsigned int vp8_sub_pixel_variance8x8_armv6 20( 21 const unsigned char *src_ptr, 22 int src_pixels_per_line, 23 int xoffset, 24 int yoffset, 25 const unsigned char *dst_ptr, 26 int dst_pixels_per_line, 27 unsigned int *sse 28) 29{ 30 unsigned short first_pass[10*8]; 31 unsigned char second_pass[8*8]; 32 const short *HFilter, *VFilter; 33 34 HFilter = vp8_bilinear_filters[xoffset]; 35 VFilter = vp8_bilinear_filters[yoffset]; 36 37 vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass, 38 src_pixels_per_line, 39 9, 8, HFilter); 40 vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass, 41 8, 8, 8, VFilter); 42 43 return vp8_variance8x8_armv6(second_pass, 8, dst_ptr, 44 dst_pixels_per_line, sse); 45} 46 47unsigned int vp8_sub_pixel_variance16x16_armv6 48( 49 const unsigned char *src_ptr, 50 int src_pixels_per_line, 51 int xoffset, 52 int yoffset, 53 const unsigned char *dst_ptr, 54 int dst_pixels_per_line, 55 unsigned int *sse 56) 57{ 58 unsigned short first_pass[36*16]; 59 unsigned char second_pass[20*16]; 60 const short *HFilter, *VFilter; 61 unsigned int var; 62 63 if (xoffset == 4 && yoffset == 0) 64 { 65 var = vp8_variance_halfpixvar16x16_h_armv6(src_ptr, src_pixels_per_line, 66 dst_ptr, dst_pixels_per_line, sse); 67 } 68 else if (xoffset == 0 && yoffset == 4) 69 { 70 var = vp8_variance_halfpixvar16x16_v_armv6(src_ptr, src_pixels_per_line, 71 dst_ptr, dst_pixels_per_line, sse); 72 } 73 else if (xoffset == 4 && yoffset == 4) 74 { 75 var = vp8_variance_halfpixvar16x16_hv_armv6(src_ptr, src_pixels_per_line, 76 dst_ptr, dst_pixels_per_line, sse); 77 } 78 else 79 { 80 HFilter = vp8_bilinear_filters[xoffset]; 81 VFilter = vp8_bilinear_filters[yoffset]; 82 83 vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass, 84 src_pixels_per_line, 85 17, 16, HFilter); 86 vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass, 87 16, 16, 16, VFilter); 88 89 var = vp8_variance16x16_armv6(second_pass, 16, dst_ptr, 90 dst_pixels_per_line, sse); 91 } 92 return var; 93} 94 95#endif /* HAVE_MEDIA */ 96 97 98#if HAVE_NEON 99 100extern unsigned int vp8_sub_pixel_variance16x16_neon_func 101( 102 const unsigned char *src_ptr, 103 int src_pixels_per_line, 104 int xoffset, 105 int yoffset, 106 const unsigned char *dst_ptr, 107 int dst_pixels_per_line, 108 unsigned int *sse 109); 110 111unsigned int vp8_sub_pixel_variance16x16_neon 112( 113 const unsigned char *src_ptr, 114 int src_pixels_per_line, 115 int xoffset, 116 int yoffset, 117 const unsigned char *dst_ptr, 118 int dst_pixels_per_line, 119 unsigned int *sse 120) 121{ 122 if (xoffset == 4 && yoffset == 0) 123 return vp8_variance_halfpixvar16x16_h_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse); 124 else if (xoffset == 0 && yoffset == 4) 125 return vp8_variance_halfpixvar16x16_v_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse); 126 else if (xoffset == 4 && yoffset == 4) 127 return vp8_variance_halfpixvar16x16_hv_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse); 128 else 129 return vp8_sub_pixel_variance16x16_neon_func(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse); 130} 131 132#endif 133