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: #ifndef VP9_ENCODER_VP9_VARIANCE_H_ michael@0: #define VP9_ENCODER_VP9_VARIANCE_H_ michael@0: michael@0: #include "vpx/vpx_integer.h" michael@0: // #include "./vpx_config.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: michael@0: typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int ref_stride, michael@0: unsigned int max_sad); michael@0: michael@0: typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int ref_stride, michael@0: const uint8_t *second_pred, michael@0: unsigned int max_sad); michael@0: michael@0: typedef void (*vp9_sad_multi_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int ref_stride, michael@0: unsigned int *sad_array); michael@0: michael@0: typedef void (*vp9_sad_multi1_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int ref_stride, michael@0: unsigned int *sad_array); michael@0: michael@0: typedef void (*vp9_sad_multi_d_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t* const ref_ptr[], michael@0: int ref_stride, unsigned int *sad_array); michael@0: michael@0: typedef unsigned int (*vp9_variance_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int ref_stride, michael@0: unsigned int *sse); michael@0: michael@0: typedef unsigned int (*vp9_subpixvariance_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *ref_ptr, michael@0: int Refstride, michael@0: unsigned int *sse); michael@0: michael@0: typedef unsigned int (*vp9_subp_avg_variance_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: int xoffset, michael@0: int yoffset, michael@0: const uint8_t *ref_ptr, michael@0: int Refstride, michael@0: unsigned int *sse, michael@0: const uint8_t *second_pred); michael@0: michael@0: typedef unsigned int (*vp9_getmbss_fn_t)(const short *); michael@0: michael@0: typedef unsigned int (*vp9_get16x16prederror_fn_t)(const uint8_t *src_ptr, michael@0: int source_stride, michael@0: const uint8_t *ref_ptr, michael@0: int ref_stride); michael@0: michael@0: typedef struct vp9_variance_vtable { michael@0: vp9_sad_fn_t sdf; michael@0: vp9_sad_avg_fn_t sdaf; michael@0: vp9_variance_fn_t vf; michael@0: vp9_subpixvariance_fn_t svf; michael@0: vp9_subp_avg_variance_fn_t svaf; michael@0: vp9_variance_fn_t svf_halfpix_h; michael@0: vp9_variance_fn_t svf_halfpix_v; michael@0: vp9_variance_fn_t svf_halfpix_hv; michael@0: vp9_sad_multi_fn_t sdx3f; michael@0: vp9_sad_multi1_fn_t sdx8f; michael@0: vp9_sad_multi_d_fn_t sdx4df; michael@0: } vp9_variance_fn_ptr_t; michael@0: michael@0: static void comp_avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width, michael@0: int height, const uint8_t *ref, int ref_stride) { michael@0: int i, j; michael@0: michael@0: for (i = 0; i < height; i++) { michael@0: for (j = 0; j < width; j++) { michael@0: int tmp; michael@0: tmp = pred[j] + ref[j]; michael@0: comp_pred[j] = (tmp + 1) >> 1; michael@0: } michael@0: comp_pred += width; michael@0: pred += width; michael@0: ref += ref_stride; michael@0: } michael@0: } michael@0: #endif // VP9_ENCODER_VP9_VARIANCE_H_