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_DSP_VARIANCE_H_ 12 #define 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 *a, int a_stride, 26 const uint8_t *b_ptr, int b_stride); 27 28 typedef unsigned int(*vpx_sad_avg_fn_t)(const uint8_t *a_ptr, int a_stride, 29 const uint8_t *b_ptr, int b_stride, 30 const uint8_t *second_pred); 31 32 typedef void (*vp8_copy32xn_fn_t)(const uint8_t *a, int a_stride, 33 uint8_t *b, int b_stride, int n); 34 35 typedef void (*vpx_sad_multi_fn_t)(const uint8_t *a, int a_stride, 36 const uint8_t *b, int b_stride, 37 unsigned int *sad_array); 38 39 typedef void (*vpx_sad_multi_d_fn_t)(const uint8_t *a, int a_stride, 40 const uint8_t *const b_array[], 41 int b_stride, 42 unsigned int *sad_array); 43 44 typedef unsigned int (*vpx_variance_fn_t)(const uint8_t *a, int a_stride, 45 const uint8_t *b, int b_stride, 46 unsigned int *sse); 47 48 typedef unsigned int (*vpx_subpixvariance_fn_t)(const uint8_t *a, int a_stride, 49 int xoffset, int yoffset, 50 const uint8_t *b, int b_stride, 51 unsigned int *sse); 52 53 typedef unsigned int (*vpx_subp_avg_variance_fn_t)(const uint8_t *a_ptr, 54 int a_stride, 55 int xoffset, int yoffset, 56 const uint8_t *b_ptr, 57 int b_stride, 58 unsigned int *sse, 59 const uint8_t *second_pred); 60 #if CONFIG_VP8 61 typedef struct variance_vtable { 62 vpx_sad_fn_t sdf; 63 vpx_variance_fn_t vf; 64 vpx_subpixvariance_fn_t svf; 65 vpx_variance_fn_t svf_halfpix_h; 66 vpx_variance_fn_t svf_halfpix_v; 67 vpx_variance_fn_t svf_halfpix_hv; 68 vpx_sad_multi_fn_t sdx3f; 69 vpx_sad_multi_fn_t sdx8f; 70 vpx_sad_multi_d_fn_t sdx4df; 71 #if ARCH_X86 || ARCH_X86_64 72 vp8_copy32xn_fn_t copymem; 73 #endif 74 } vp8_variance_fn_ptr_t; 75 #endif // CONFIG_VP8 76 77 #if CONFIG_VP9 || CONFIG_VP10 78 typedef struct vp9_variance_vtable { 79 vpx_sad_fn_t sdf; 80 vpx_sad_avg_fn_t sdaf; 81 vpx_variance_fn_t vf; 82 vpx_subpixvariance_fn_t svf; 83 vpx_subp_avg_variance_fn_t svaf; 84 vpx_sad_multi_fn_t sdx3f; 85 vpx_sad_multi_fn_t sdx8f; 86 vpx_sad_multi_d_fn_t sdx4df; 87 } vp9_variance_fn_ptr_t; 88 #endif // CONFIG_VP9 || CONFIG_VP10 89 90 #ifdef __cplusplus 91 } // extern "C" 92 #endif 93 94 #endif // VPX_DSP_VARIANCE_H_ 95