1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libvpx/vp9/encoder/vp9_variance.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,115 @@ 1.4 +/* 1.5 + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license 1.8 + * that can be found in the LICENSE file in the root of the source 1.9 + * tree. An additional intellectual property rights grant can be found 1.10 + * in the file PATENTS. All contributing project authors may 1.11 + * be found in the AUTHORS file in the root of the source tree. 1.12 + */ 1.13 + 1.14 +#ifndef VP9_ENCODER_VP9_VARIANCE_H_ 1.15 +#define VP9_ENCODER_VP9_VARIANCE_H_ 1.16 + 1.17 +#include "vpx/vpx_integer.h" 1.18 +// #include "./vpx_config.h" 1.19 + 1.20 +void variance(const uint8_t *src_ptr, 1.21 + int source_stride, 1.22 + const uint8_t *ref_ptr, 1.23 + int recon_stride, 1.24 + int w, 1.25 + int h, 1.26 + unsigned int *sse, 1.27 + int *sum); 1.28 + 1.29 +typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr, 1.30 + int source_stride, 1.31 + const uint8_t *ref_ptr, 1.32 + int ref_stride, 1.33 + unsigned int max_sad); 1.34 + 1.35 +typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr, 1.36 + int source_stride, 1.37 + const uint8_t *ref_ptr, 1.38 + int ref_stride, 1.39 + const uint8_t *second_pred, 1.40 + unsigned int max_sad); 1.41 + 1.42 +typedef void (*vp9_sad_multi_fn_t)(const uint8_t *src_ptr, 1.43 + int source_stride, 1.44 + const uint8_t *ref_ptr, 1.45 + int ref_stride, 1.46 + unsigned int *sad_array); 1.47 + 1.48 +typedef void (*vp9_sad_multi1_fn_t)(const uint8_t *src_ptr, 1.49 + int source_stride, 1.50 + const uint8_t *ref_ptr, 1.51 + int ref_stride, 1.52 + unsigned int *sad_array); 1.53 + 1.54 +typedef void (*vp9_sad_multi_d_fn_t)(const uint8_t *src_ptr, 1.55 + int source_stride, 1.56 + const uint8_t* const ref_ptr[], 1.57 + int ref_stride, unsigned int *sad_array); 1.58 + 1.59 +typedef unsigned int (*vp9_variance_fn_t)(const uint8_t *src_ptr, 1.60 + int source_stride, 1.61 + const uint8_t *ref_ptr, 1.62 + int ref_stride, 1.63 + unsigned int *sse); 1.64 + 1.65 +typedef unsigned int (*vp9_subpixvariance_fn_t)(const uint8_t *src_ptr, 1.66 + int source_stride, 1.67 + int xoffset, 1.68 + int yoffset, 1.69 + const uint8_t *ref_ptr, 1.70 + int Refstride, 1.71 + unsigned int *sse); 1.72 + 1.73 +typedef unsigned int (*vp9_subp_avg_variance_fn_t)(const uint8_t *src_ptr, 1.74 + int source_stride, 1.75 + int xoffset, 1.76 + int yoffset, 1.77 + const uint8_t *ref_ptr, 1.78 + int Refstride, 1.79 + unsigned int *sse, 1.80 + const uint8_t *second_pred); 1.81 + 1.82 +typedef unsigned int (*vp9_getmbss_fn_t)(const short *); 1.83 + 1.84 +typedef unsigned int (*vp9_get16x16prederror_fn_t)(const uint8_t *src_ptr, 1.85 + int source_stride, 1.86 + const uint8_t *ref_ptr, 1.87 + int ref_stride); 1.88 + 1.89 +typedef struct vp9_variance_vtable { 1.90 + vp9_sad_fn_t sdf; 1.91 + vp9_sad_avg_fn_t sdaf; 1.92 + vp9_variance_fn_t vf; 1.93 + vp9_subpixvariance_fn_t svf; 1.94 + vp9_subp_avg_variance_fn_t svaf; 1.95 + vp9_variance_fn_t svf_halfpix_h; 1.96 + vp9_variance_fn_t svf_halfpix_v; 1.97 + vp9_variance_fn_t svf_halfpix_hv; 1.98 + vp9_sad_multi_fn_t sdx3f; 1.99 + vp9_sad_multi1_fn_t sdx8f; 1.100 + vp9_sad_multi_d_fn_t sdx4df; 1.101 +} vp9_variance_fn_ptr_t; 1.102 + 1.103 +static void comp_avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width, 1.104 + int height, const uint8_t *ref, int ref_stride) { 1.105 + int i, j; 1.106 + 1.107 + for (i = 0; i < height; i++) { 1.108 + for (j = 0; j < width; j++) { 1.109 + int tmp; 1.110 + tmp = pred[j] + ref[j]; 1.111 + comp_pred[j] = (tmp + 1) >> 1; 1.112 + } 1.113 + comp_pred += width; 1.114 + pred += width; 1.115 + ref += ref_stride; 1.116 + } 1.117 +} 1.118 +#endif // VP9_ENCODER_VP9_VARIANCE_H_