179f15823c34ae1e423108295e416213200bb280fAndreas Huber/* 279f15823c34ae1e423108295e416213200bb280fAndreas Huber * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 379f15823c34ae1e423108295e416213200bb280fAndreas Huber * 479f15823c34ae1e423108295e416213200bb280fAndreas Huber * Use of this source code is governed by a BSD-style license 579f15823c34ae1e423108295e416213200bb280fAndreas Huber * that can be found in the LICENSE file in the root of the source 679f15823c34ae1e423108295e416213200bb280fAndreas Huber * tree. An additional intellectual property rights grant can be found 779f15823c34ae1e423108295e416213200bb280fAndreas Huber * in the file PATENTS. All contributing project authors may 879f15823c34ae1e423108295e416213200bb280fAndreas Huber * be found in the AUTHORS file in the root of the source tree. 979f15823c34ae1e423108295e416213200bb280fAndreas Huber */ 1079f15823c34ae1e423108295e416213200bb280fAndreas Huber 1179f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vpx_config.h" 12ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#include "vp8_rtcd.h" 131b362b15af34006e6a11974088a46d42b903418eJohann#include "vp8/common/variance.h" 1479f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vp8/common/filter.h" 1579f15823c34ae1e423108295e416213200bb280fAndreas Huber 161b362b15af34006e6a11974088a46d42b903418eJohann#if HAVE_MEDIA 171b362b15af34006e6a11974088a46d42b903418eJohann#include "vp8/common/arm/bilinearfilter_arm.h" 1879f15823c34ae1e423108295e416213200bb280fAndreas Huber 1979f15823c34ae1e423108295e416213200bb280fAndreas Huberunsigned int vp8_sub_pixel_variance8x8_armv6 2079f15823c34ae1e423108295e416213200bb280fAndreas Huber( 2179f15823c34ae1e423108295e416213200bb280fAndreas Huber const unsigned char *src_ptr, 2279f15823c34ae1e423108295e416213200bb280fAndreas Huber int src_pixels_per_line, 2379f15823c34ae1e423108295e416213200bb280fAndreas Huber int xoffset, 2479f15823c34ae1e423108295e416213200bb280fAndreas Huber int yoffset, 2579f15823c34ae1e423108295e416213200bb280fAndreas Huber const unsigned char *dst_ptr, 2679f15823c34ae1e423108295e416213200bb280fAndreas Huber int dst_pixels_per_line, 2779f15823c34ae1e423108295e416213200bb280fAndreas Huber unsigned int *sse 2879f15823c34ae1e423108295e416213200bb280fAndreas Huber) 2979f15823c34ae1e423108295e416213200bb280fAndreas Huber{ 3079f15823c34ae1e423108295e416213200bb280fAndreas Huber unsigned short first_pass[10*8]; 3179f15823c34ae1e423108295e416213200bb280fAndreas Huber unsigned char second_pass[8*8]; 3279f15823c34ae1e423108295e416213200bb280fAndreas Huber const short *HFilter, *VFilter; 3379f15823c34ae1e423108295e416213200bb280fAndreas Huber 3479f15823c34ae1e423108295e416213200bb280fAndreas Huber HFilter = vp8_bilinear_filters[xoffset]; 3579f15823c34ae1e423108295e416213200bb280fAndreas Huber VFilter = vp8_bilinear_filters[yoffset]; 3679f15823c34ae1e423108295e416213200bb280fAndreas Huber 3779f15823c34ae1e423108295e416213200bb280fAndreas Huber vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass, 3879f15823c34ae1e423108295e416213200bb280fAndreas Huber src_pixels_per_line, 3979f15823c34ae1e423108295e416213200bb280fAndreas Huber 9, 8, HFilter); 4079f15823c34ae1e423108295e416213200bb280fAndreas Huber vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass, 4179f15823c34ae1e423108295e416213200bb280fAndreas Huber 8, 8, 8, VFilter); 4279f15823c34ae1e423108295e416213200bb280fAndreas Huber 4379f15823c34ae1e423108295e416213200bb280fAndreas Huber return vp8_variance8x8_armv6(second_pass, 8, dst_ptr, 4479f15823c34ae1e423108295e416213200bb280fAndreas Huber dst_pixels_per_line, sse); 4579f15823c34ae1e423108295e416213200bb280fAndreas Huber} 4679f15823c34ae1e423108295e416213200bb280fAndreas Huber 4779f15823c34ae1e423108295e416213200bb280fAndreas Huberunsigned int vp8_sub_pixel_variance16x16_armv6 4879f15823c34ae1e423108295e416213200bb280fAndreas Huber( 4979f15823c34ae1e423108295e416213200bb280fAndreas Huber const unsigned char *src_ptr, 5079f15823c34ae1e423108295e416213200bb280fAndreas Huber int src_pixels_per_line, 5179f15823c34ae1e423108295e416213200bb280fAndreas Huber int xoffset, 5279f15823c34ae1e423108295e416213200bb280fAndreas Huber int yoffset, 5379f15823c34ae1e423108295e416213200bb280fAndreas Huber const unsigned char *dst_ptr, 5479f15823c34ae1e423108295e416213200bb280fAndreas Huber int dst_pixels_per_line, 5579f15823c34ae1e423108295e416213200bb280fAndreas Huber unsigned int *sse 5679f15823c34ae1e423108295e416213200bb280fAndreas Huber) 5779f15823c34ae1e423108295e416213200bb280fAndreas Huber{ 5879f15823c34ae1e423108295e416213200bb280fAndreas Huber unsigned short first_pass[36*16]; 5979f15823c34ae1e423108295e416213200bb280fAndreas Huber unsigned char second_pass[20*16]; 6079f15823c34ae1e423108295e416213200bb280fAndreas Huber const short *HFilter, *VFilter; 6179f15823c34ae1e423108295e416213200bb280fAndreas Huber unsigned int var; 6279f15823c34ae1e423108295e416213200bb280fAndreas Huber 6379f15823c34ae1e423108295e416213200bb280fAndreas Huber if (xoffset == 4 && yoffset == 0) 6479f15823c34ae1e423108295e416213200bb280fAndreas Huber { 6579f15823c34ae1e423108295e416213200bb280fAndreas Huber var = vp8_variance_halfpixvar16x16_h_armv6(src_ptr, src_pixels_per_line, 6679f15823c34ae1e423108295e416213200bb280fAndreas Huber dst_ptr, dst_pixels_per_line, sse); 6779f15823c34ae1e423108295e416213200bb280fAndreas Huber } 6879f15823c34ae1e423108295e416213200bb280fAndreas Huber else if (xoffset == 0 && yoffset == 4) 6979f15823c34ae1e423108295e416213200bb280fAndreas Huber { 7079f15823c34ae1e423108295e416213200bb280fAndreas Huber var = vp8_variance_halfpixvar16x16_v_armv6(src_ptr, src_pixels_per_line, 7179f15823c34ae1e423108295e416213200bb280fAndreas Huber dst_ptr, dst_pixels_per_line, sse); 7279f15823c34ae1e423108295e416213200bb280fAndreas Huber } 7379f15823c34ae1e423108295e416213200bb280fAndreas Huber else if (xoffset == 4 && yoffset == 4) 7479f15823c34ae1e423108295e416213200bb280fAndreas Huber { 7579f15823c34ae1e423108295e416213200bb280fAndreas Huber var = vp8_variance_halfpixvar16x16_hv_armv6(src_ptr, src_pixels_per_line, 7679f15823c34ae1e423108295e416213200bb280fAndreas Huber dst_ptr, dst_pixels_per_line, sse); 7779f15823c34ae1e423108295e416213200bb280fAndreas Huber } 7879f15823c34ae1e423108295e416213200bb280fAndreas Huber else 7979f15823c34ae1e423108295e416213200bb280fAndreas Huber { 8079f15823c34ae1e423108295e416213200bb280fAndreas Huber HFilter = vp8_bilinear_filters[xoffset]; 8179f15823c34ae1e423108295e416213200bb280fAndreas Huber VFilter = vp8_bilinear_filters[yoffset]; 8279f15823c34ae1e423108295e416213200bb280fAndreas Huber 8379f15823c34ae1e423108295e416213200bb280fAndreas Huber vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass, 8479f15823c34ae1e423108295e416213200bb280fAndreas Huber src_pixels_per_line, 8579f15823c34ae1e423108295e416213200bb280fAndreas Huber 17, 16, HFilter); 8679f15823c34ae1e423108295e416213200bb280fAndreas Huber vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass, 8779f15823c34ae1e423108295e416213200bb280fAndreas Huber 16, 16, 16, VFilter); 8879f15823c34ae1e423108295e416213200bb280fAndreas Huber 8979f15823c34ae1e423108295e416213200bb280fAndreas Huber var = vp8_variance16x16_armv6(second_pass, 16, dst_ptr, 9079f15823c34ae1e423108295e416213200bb280fAndreas Huber dst_pixels_per_line, sse); 9179f15823c34ae1e423108295e416213200bb280fAndreas Huber } 9279f15823c34ae1e423108295e416213200bb280fAndreas Huber return var; 9379f15823c34ae1e423108295e416213200bb280fAndreas Huber} 9479f15823c34ae1e423108295e416213200bb280fAndreas Huber 951b362b15af34006e6a11974088a46d42b903418eJohann#endif /* HAVE_MEDIA */ 961b362b15af34006e6a11974088a46d42b903418eJohann 9779f15823c34ae1e423108295e416213200bb280fAndreas Huber 981b362b15af34006e6a11974088a46d42b903418eJohann#if HAVE_NEON 9979f15823c34ae1e423108295e416213200bb280fAndreas Huber 1001b362b15af34006e6a11974088a46d42b903418eJohannextern unsigned int vp8_sub_pixel_variance16x16_neon_func 1011b362b15af34006e6a11974088a46d42b903418eJohann( 1021b362b15af34006e6a11974088a46d42b903418eJohann const unsigned char *src_ptr, 1031b362b15af34006e6a11974088a46d42b903418eJohann int src_pixels_per_line, 1041b362b15af34006e6a11974088a46d42b903418eJohann int xoffset, 1051b362b15af34006e6a11974088a46d42b903418eJohann int yoffset, 1061b362b15af34006e6a11974088a46d42b903418eJohann const unsigned char *dst_ptr, 1071b362b15af34006e6a11974088a46d42b903418eJohann int dst_pixels_per_line, 1081b362b15af34006e6a11974088a46d42b903418eJohann unsigned int *sse 1091b362b15af34006e6a11974088a46d42b903418eJohann); 11079f15823c34ae1e423108295e416213200bb280fAndreas Huber 11179f15823c34ae1e423108295e416213200bb280fAndreas Huberunsigned int vp8_sub_pixel_variance16x16_neon 11279f15823c34ae1e423108295e416213200bb280fAndreas Huber( 11379f15823c34ae1e423108295e416213200bb280fAndreas Huber const unsigned char *src_ptr, 11479f15823c34ae1e423108295e416213200bb280fAndreas Huber int src_pixels_per_line, 11579f15823c34ae1e423108295e416213200bb280fAndreas Huber int xoffset, 11679f15823c34ae1e423108295e416213200bb280fAndreas Huber int yoffset, 11779f15823c34ae1e423108295e416213200bb280fAndreas Huber const unsigned char *dst_ptr, 11879f15823c34ae1e423108295e416213200bb280fAndreas Huber int dst_pixels_per_line, 11979f15823c34ae1e423108295e416213200bb280fAndreas Huber unsigned int *sse 12079f15823c34ae1e423108295e416213200bb280fAndreas Huber) 12179f15823c34ae1e423108295e416213200bb280fAndreas Huber{ 12279f15823c34ae1e423108295e416213200bb280fAndreas Huber if (xoffset == 4 && yoffset == 0) 12379f15823c34ae1e423108295e416213200bb280fAndreas Huber return vp8_variance_halfpixvar16x16_h_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse); 12479f15823c34ae1e423108295e416213200bb280fAndreas Huber else if (xoffset == 0 && yoffset == 4) 12579f15823c34ae1e423108295e416213200bb280fAndreas Huber return vp8_variance_halfpixvar16x16_v_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse); 12679f15823c34ae1e423108295e416213200bb280fAndreas Huber else if (xoffset == 4 && yoffset == 4) 12779f15823c34ae1e423108295e416213200bb280fAndreas Huber return vp8_variance_halfpixvar16x16_hv_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse); 12879f15823c34ae1e423108295e416213200bb280fAndreas Huber else 12979f15823c34ae1e423108295e416213200bb280fAndreas Huber return vp8_sub_pixel_variance16x16_neon_func(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse); 13079f15823c34ae1e423108295e416213200bb280fAndreas Huber} 13179f15823c34ae1e423108295e416213200bb280fAndreas Huber 13279f15823c34ae1e423108295e416213200bb280fAndreas Huber#endif 133