michael@0: /* michael@0: * Copyright (c) 2010 The WebM project authors. All Rights Reserved. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license michael@0: * that can be found in the LICENSE file in the root of the source michael@0: * tree. An additional intellectual property rights grant can be found michael@0: * in the file PATENTS. All contributing project authors may michael@0: * be found in the AUTHORS file in the root of the source tree. michael@0: */ michael@0: michael@0: #include "./vp9_rtcd.h" michael@0: michael@0: #include "vpx_ports/mem.h" michael@0: #include "vpx/vpx_integer.h" michael@0: michael@0: #include "vp9/common/vp9_common.h" michael@0: #include "vp9/common/vp9_filter.h" michael@0: michael@0: #include "vp9/encoder/vp9_variance.h" michael@0: michael@0: void variance(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: int w, michael@0: int h, michael@0: unsigned int *sse, michael@0: int *sum) { michael@0: int i, j; michael@0: int diff; michael@0: michael@0: *sum = 0; michael@0: *sse = 0; michael@0: michael@0: for (i = 0; i < h; i++) { michael@0: for (j = 0; j < w; j++) { michael@0: diff = src_ptr[j] - ref_ptr[j]; michael@0: *sum += diff; michael@0: *sse += diff * diff; michael@0: } michael@0: michael@0: src_ptr += source_stride; michael@0: ref_ptr += recon_stride; michael@0: } michael@0: } michael@0: michael@0: /**************************************************************************** michael@0: * michael@0: * ROUTINE : filter_block2d_bil_first_pass michael@0: * michael@0: * INPUTS : uint8_t *src_ptr : Pointer to source block. michael@0: * uint32_t src_pixels_per_line : Stride of input block. michael@0: * uint32_t pixel_step : Offset between filter input michael@0: * samples (see notes). michael@0: * uint32_t output_height : Input block height. michael@0: * uint32_t output_width : Input block width. michael@0: * int32_t *vp9_filter : Array of 2 bi-linear filter michael@0: * taps. michael@0: * michael@0: * OUTPUTS : int32_t *output_ptr : Pointer to filtered block. michael@0: * michael@0: * RETURNS : void michael@0: * michael@0: * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in michael@0: * either horizontal or vertical direction to produce the michael@0: * filtered output block. Used to implement first-pass michael@0: * of 2-D separable filter. michael@0: * michael@0: * SPECIAL NOTES : Produces int32_t output to retain precision for next pass. michael@0: * Two filter taps should sum to VP9_FILTER_WEIGHT. michael@0: * pixel_step defines whether the filter is applied michael@0: * horizontally (pixel_step=1) or vertically (pixel_step= michael@0: * stride). michael@0: * It defines the offset required to move from one input michael@0: * to the next. michael@0: * michael@0: ****************************************************************************/ michael@0: static void var_filter_block2d_bil_first_pass(const uint8_t *src_ptr, michael@0: uint16_t *output_ptr, michael@0: unsigned int src_pixels_per_line, michael@0: int pixel_step, michael@0: unsigned int output_height, michael@0: unsigned int output_width, michael@0: const int16_t *vp9_filter) { michael@0: unsigned int i, j; michael@0: michael@0: for (i = 0; i < output_height; i++) { michael@0: for (j = 0; j < output_width; j++) { michael@0: output_ptr[j] = ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] + michael@0: (int)src_ptr[pixel_step] * vp9_filter[1], michael@0: FILTER_BITS); michael@0: michael@0: src_ptr++; michael@0: } michael@0: michael@0: // Next row... michael@0: src_ptr += src_pixels_per_line - output_width; michael@0: output_ptr += output_width; michael@0: } michael@0: } michael@0: michael@0: /**************************************************************************** michael@0: * michael@0: * ROUTINE : filter_block2d_bil_second_pass michael@0: * michael@0: * INPUTS : int32_t *src_ptr : Pointer to source block. michael@0: * uint32_t src_pixels_per_line : Stride of input block. michael@0: * uint32_t pixel_step : Offset between filter input michael@0: * samples (see notes). michael@0: * uint32_t output_height : Input block height. michael@0: * uint32_t output_width : Input block width. michael@0: * int32_t *vp9_filter : Array of 2 bi-linear filter michael@0: * taps. michael@0: * michael@0: * OUTPUTS : uint16_t *output_ptr : Pointer to filtered block. michael@0: * michael@0: * RETURNS : void michael@0: * michael@0: * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in michael@0: * either horizontal or vertical direction to produce the michael@0: * filtered output block. Used to implement second-pass michael@0: * of 2-D separable filter. michael@0: * michael@0: * SPECIAL NOTES : Requires 32-bit input as produced by michael@0: * filter_block2d_bil_first_pass. michael@0: * Two filter taps should sum to VP9_FILTER_WEIGHT. michael@0: * pixel_step defines whether the filter is applied michael@0: * horizontally (pixel_step=1) or vertically (pixel_step= michael@0: * stride). michael@0: * It defines the offset required to move from one input michael@0: * to the next. michael@0: * michael@0: ****************************************************************************/ michael@0: static void var_filter_block2d_bil_second_pass(const uint16_t *src_ptr, michael@0: uint8_t *output_ptr, michael@0: unsigned int src_pixels_per_line, michael@0: unsigned int pixel_step, michael@0: unsigned int output_height, michael@0: unsigned int output_width, michael@0: const int16_t *vp9_filter) { michael@0: unsigned int i, j; michael@0: michael@0: for (i = 0; i < output_height; i++) { michael@0: for (j = 0; j < output_width; j++) { michael@0: output_ptr[j] = ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] + michael@0: (int)src_ptr[pixel_step] * vp9_filter[1], michael@0: FILTER_BITS); michael@0: src_ptr++; michael@0: } michael@0: michael@0: src_ptr += src_pixels_per_line - output_width; michael@0: output_ptr += output_width; michael@0: } michael@0: } michael@0: michael@0: unsigned int vp9_get_mb_ss_c(const int16_t *src_ptr) { michael@0: unsigned int i, sum = 0; michael@0: michael@0: for (i = 0; i < 256; i++) { michael@0: sum += (src_ptr[i] * src_ptr[i]); michael@0: } michael@0: michael@0: return sum; michael@0: } michael@0: michael@0: unsigned int vp9_variance64x32_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 64, 32, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((int64_t)avg * avg) >> 11)); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance64x32_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering michael@0: uint8_t temp2[68 * 64]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 33, 64, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 64, 64, 32, 64, vfilter); michael@0: michael@0: return vp9_variance64x32(temp2, 64, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance64x32_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering michael@0: uint8_t temp2[68 * 64]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 64 * 64); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 33, 64, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 64, 64, 32, 64, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 64, 32, temp2, 64); michael@0: return vp9_variance64x32(temp3, 64, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance32x64_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 64, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((int64_t)avg * avg) >> 11)); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance32x64_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering michael@0: uint8_t temp2[68 * 64]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 65, 32, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 64, 32, vfilter); michael@0: michael@0: return vp9_variance32x64(temp2, 32, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance32x64_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering michael@0: uint8_t temp2[68 * 64]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 64); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 65, 32, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 64, 32, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 32, 64, temp2, 32); michael@0: return vp9_variance32x64(temp3, 32, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance32x16_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 16, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((int64_t)avg * avg) >> 9)); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance32x16_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering michael@0: uint8_t temp2[36 * 32]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 17, 32, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 16, 32, vfilter); michael@0: michael@0: return vp9_variance32x16(temp2, 32, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance32x16_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering michael@0: uint8_t temp2[36 * 32]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 16); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 17, 32, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 16, 32, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 32, 16, temp2, 32); michael@0: return vp9_variance32x16(temp3, 32, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance16x32_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 32, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((int64_t)avg * avg) >> 9)); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance16x32_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering michael@0: uint8_t temp2[36 * 32]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 33, 16, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 32, 16, vfilter); michael@0: michael@0: return vp9_variance16x32(temp2, 16, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance16x32_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering michael@0: uint8_t temp2[36 * 32]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 16 * 32); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 33, 16, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 32, 16, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 16, 32, temp2, 16); michael@0: return vp9_variance16x32(temp3, 16, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance64x64_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 64, 64, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((int64_t)avg * avg) >> 12)); michael@0: } michael@0: michael@0: unsigned int vp9_variance32x32_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 32, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((int64_t)avg * avg) >> 10)); michael@0: } michael@0: michael@0: unsigned int vp9_variance16x16_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((unsigned int)avg * avg) >> 8)); michael@0: } michael@0: michael@0: unsigned int vp9_variance8x16_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((unsigned int)avg * avg) >> 7)); michael@0: } michael@0: michael@0: unsigned int vp9_variance16x8_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((unsigned int)avg * avg) >> 7)); michael@0: } michael@0: michael@0: void vp9_get_sse_sum_8x8_c(const uint8_t *src_ptr, int source_stride, michael@0: const uint8_t *ref_ptr, int ref_stride, michael@0: unsigned int *sse, int *sum) { michael@0: variance(src_ptr, source_stride, ref_ptr, ref_stride, 8, 8, sse, sum); michael@0: } michael@0: michael@0: unsigned int vp9_variance8x8_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((unsigned int)avg * avg) >> 6)); michael@0: } michael@0: michael@0: unsigned int vp9_variance8x4_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 4, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((unsigned int)avg * avg) >> 5)); michael@0: } michael@0: michael@0: unsigned int vp9_variance4x8_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 8, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((unsigned int)avg * avg) >> 5)); michael@0: } michael@0: michael@0: unsigned int vp9_variance4x4_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 4, &var, &avg); michael@0: *sse = var; michael@0: return (var - (((unsigned int)avg * avg) >> 4)); michael@0: } michael@0: michael@0: michael@0: unsigned int vp9_mse16x16_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg); michael@0: *sse = var; michael@0: return var; michael@0: } michael@0: michael@0: unsigned int vp9_mse16x8_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var, &avg); michael@0: *sse = var; michael@0: return var; michael@0: } michael@0: michael@0: unsigned int vp9_mse8x16_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16, &var, &avg); michael@0: *sse = var; michael@0: return var; michael@0: } michael@0: michael@0: unsigned int vp9_mse8x8_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: unsigned int var; michael@0: int avg; michael@0: michael@0: variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg); michael@0: *sse = var; michael@0: return var; michael@0: } michael@0: michael@0: michael@0: unsigned int vp9_sub_pixel_variance4x4_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint8_t temp2[20 * 16]; michael@0: const int16_t *hfilter, *vfilter; michael@0: uint16_t fdata3[5 * 4]; // Temp data buffer used in filtering michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: // First filter 1d Horizontal michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 5, 4, hfilter); michael@0: michael@0: // Now filter Verticaly michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 4, 4, 4, 4, vfilter); michael@0: michael@0: return vp9_variance4x4(temp2, 4, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance4x4_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint8_t temp2[20 * 16]; michael@0: const int16_t *hfilter, *vfilter; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 4 * 4); // compound pred buffer michael@0: uint16_t fdata3[5 * 4]; // Temp data buffer used in filtering michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: // First filter 1d Horizontal michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 5, 4, hfilter); michael@0: michael@0: // Now filter Verticaly michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 4, 4, 4, 4, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 4, 4, temp2, 4); michael@0: return vp9_variance4x4(temp3, 4, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance8x8_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[9 * 8]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 9, 8, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 8, 8, vfilter); michael@0: michael@0: return vp9_variance8x8(temp2, 8, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance8x8_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[9 * 8]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 8); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 9, 8, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 8, 8, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 8, 8, temp2, 8); michael@0: return vp9_variance8x8(temp3, 8, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance16x16_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[17 * 16]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 17, 16, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 16, 16, vfilter); michael@0: michael@0: return vp9_variance16x16(temp2, 16, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance16x16_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[17 * 16]; michael@0: uint8_t temp2[20 * 16]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 16 * 16); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 17, 16, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 16, 16, vfilter); michael@0: michael@0: comp_avg_pred(temp3, second_pred, 16, 16, temp2, 16); michael@0: return vp9_variance16x16(temp3, 16, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance64x64_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering michael@0: uint8_t temp2[68 * 64]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 65, 64, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 64, 64, 64, 64, vfilter); michael@0: michael@0: return vp9_variance64x64(temp2, 64, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance64x64_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering michael@0: uint8_t temp2[68 * 64]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 64 * 64); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 65, 64, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 64, 64, 64, 64, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 64, 64, temp2, 64); michael@0: return vp9_variance64x64(temp3, 64, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance32x32_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering michael@0: uint8_t temp2[36 * 32]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 33, 32, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 32, 32, vfilter); michael@0: michael@0: return vp9_variance32x32(temp2, 32, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance32x32_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering michael@0: uint8_t temp2[36 * 32]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 32); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 33, 32, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 32, 32, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 32, 32, temp2, 32); michael@0: return vp9_variance32x32(temp3, 32, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar16x16_h_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 8, 0, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar32x32_h_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 8, 0, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar64x64_h_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance64x64_c(src_ptr, source_stride, 8, 0, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar16x16_v_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 0, 8, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar32x32_v_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 0, 8, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar64x64_v_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance64x64_c(src_ptr, source_stride, 0, 8, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar16x16_hv_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 8, 8, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar32x32_hv_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 8, 8, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_variance_halfpixvar64x64_hv_c(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int recon_stride, michael@0: unsigned int *sse) { michael@0: return vp9_sub_pixel_variance64x64_c(src_ptr, source_stride, 8, 8, michael@0: ref_ptr, recon_stride, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_mse16x16_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: vp9_sub_pixel_variance16x16_c(src_ptr, src_pixels_per_line, michael@0: xoffset, yoffset, dst_ptr, michael@0: dst_pixels_per_line, sse); michael@0: return *sse; michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_mse32x32_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: vp9_sub_pixel_variance32x32_c(src_ptr, src_pixels_per_line, michael@0: xoffset, yoffset, dst_ptr, michael@0: dst_pixels_per_line, sse); michael@0: return *sse; michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_mse64x64_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: vp9_sub_pixel_variance64x64_c(src_ptr, src_pixels_per_line, michael@0: xoffset, yoffset, dst_ptr, michael@0: dst_pixels_per_line, sse); michael@0: return *sse; michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance16x8_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[16 * 9]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 9, 16, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 8, 16, vfilter); michael@0: michael@0: return vp9_variance16x8(temp2, 16, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance16x8_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[16 * 9]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 16 * 8); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 9, 16, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 8, 16, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 16, 8, temp2, 16); michael@0: return vp9_variance16x8(temp3, 16, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance8x16_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[9 * 16]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 17, 8, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 16, 8, vfilter); michael@0: michael@0: return vp9_variance8x16(temp2, 8, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance8x16_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[9 * 16]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 16); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 17, 8, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 16, 8, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 8, 16, temp2, 8); michael@0: return vp9_variance8x16(temp3, 8, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance8x4_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[8 * 5]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 5, 8, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 4, 8, vfilter); michael@0: michael@0: return vp9_variance8x4(temp2, 8, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance8x4_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[8 * 5]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 4); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 5, 8, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 4, 8, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 8, 4, temp2, 8); michael@0: return vp9_variance8x4(temp3, 8, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_variance4x8_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse) { michael@0: uint16_t fdata3[5 * 8]; // Temp data buffer used in filtering michael@0: // FIXME(jingning,rbultje): this temp2 buffer probably doesn't need to be michael@0: // of this big? same issue appears in all other block size settings. michael@0: uint8_t temp2[20 * 16]; michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 9, 4, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 4, 4, 8, 4, vfilter); michael@0: michael@0: return vp9_variance4x8(temp2, 4, dst_ptr, dst_pixels_per_line, sse); michael@0: } michael@0: michael@0: unsigned int vp9_sub_pixel_avg_variance4x8_c(const uint8_t *src_ptr, michael@0: int src_pixels_per_line, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *dst_ptr, michael@0: int dst_pixels_per_line, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred) { michael@0: uint16_t fdata3[5 * 8]; // Temp data buffer used in filtering michael@0: uint8_t temp2[20 * 16]; michael@0: DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 4 * 8); // compound pred buffer michael@0: const int16_t *hfilter, *vfilter; michael@0: michael@0: hfilter = BILINEAR_FILTERS_2TAP(xoffset); michael@0: vfilter = BILINEAR_FILTERS_2TAP(yoffset); michael@0: michael@0: var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line, michael@0: 1, 9, 4, hfilter); michael@0: var_filter_block2d_bil_second_pass(fdata3, temp2, 4, 4, 8, 4, vfilter); michael@0: comp_avg_pred(temp3, second_pred, 4, 8, temp2, 4); michael@0: return vp9_variance4x8(temp3, 4, dst_ptr, dst_pixels_per_line, sse); michael@0: }