1 /* 2 * Copyright (c) 2015 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 #ifndef VPX_VPX_DSP_VARIANCE_H_ 12 #define VPX_VPX_DSP_VARIANCE_H_ 13 14 #include "./vpx_config.h" 15 16 #include "vpx/vpx_integer.h" 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #define FILTER_BITS 7 23 #define FILTER_WEIGHT 128 24 25 typedef unsigned int (*vpx_sad_fn_t)(const uint8_t *src_ptr, int src_stride, 26 const uint8_t *ref_ptr, int ref_stride); 27 28 typedef unsigned int (*vpx_sad_avg_fn_t)(const uint8_t *src_ptr, int src_stride, 29 const uint8_t *ref_ptr, int ref_stride, 30 const uint8_t *second_pred); 31 32 typedef void (*vp8_copy32xn_fn_t)(const uint8_t *src_ptr, int src_stride, 33 uint8_t *ref_ptr, int ref_stride, int n); 34 35 typedef void (*vpx_sad_multi_fn_t)(const uint8_t *src_ptr, int src_stride, 36 const uint8_t *ref_ptr, int ref_stride, 37 unsigned int *sad_array); 38 39 typedef void (*vpx_sad_multi_d_fn_t)(const uint8_t *src_ptr, int src_stride, 40 const uint8_t *const b_array[], 41 int ref_stride, unsigned int *sad_array); 42 43 typedef unsigned int (*vpx_variance_fn_t)(const uint8_t *src_ptr, 44 int src_stride, 45 const uint8_t *ref_ptr, 46 int ref_stride, unsigned int *sse); 47 48 typedef unsigned int (*vpx_subpixvariance_fn_t)( 49 const uint8_t *src_ptr, int src_stride, int x_offset, int y_offset, 50 const uint8_t *ref_ptr, int ref_stride, unsigned int *sse); 51 52 typedef unsigned int (*vpx_subp_avg_variance_fn_t)( 53 const uint8_t *src_ptr, int src_stride, int x_offset, int y_offset, 54 const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, 55 const uint8_t *second_pred); 56 57 #if CONFIG_VP8 58 typedef struct variance_vtable { 59 vpx_sad_fn_t sdf; 60 vpx_variance_fn_t vf; 61 vpx_subpixvariance_fn_t svf; 62 vpx_sad_multi_fn_t sdx3f; 63 vpx_sad_multi_fn_t sdx8f; 64 vpx_sad_multi_d_fn_t sdx4df; 65 #if VPX_ARCH_X86 || VPX_ARCH_X86_64 66 vp8_copy32xn_fn_t copymem; 67 #endif 68 } vp8_variance_fn_ptr_t; 69 #endif // CONFIG_VP8 70 71 #if CONFIG_VP9 72 typedef struct vp9_variance_vtable { 73 vpx_sad_fn_t sdf; 74 vpx_sad_avg_fn_t sdaf; 75 vpx_variance_fn_t vf; 76 vpx_subpixvariance_fn_t svf; 77 vpx_subp_avg_variance_fn_t svaf; 78 vpx_sad_multi_d_fn_t sdx4df; 79 vpx_sad_multi_fn_t sdx8f; 80 } vp9_variance_fn_ptr_t; 81 #endif // CONFIG_VP9 82 83 #ifdef __cplusplus 84 } // extern "C" 85 #endif 86 87 #endif // VPX_VPX_DSP_VARIANCE_H_ 88