Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_variance.h

Issue 1162573005: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_tokenize.c ('k') | source/libvpx/vp9/encoder/vp9_variance.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef VP9_ENCODER_VP9_VARIANCE_H_ 11 #ifndef VP9_ENCODER_VP9_VARIANCE_H_
12 #define VP9_ENCODER_VP9_VARIANCE_H_ 12 #define VP9_ENCODER_VP9_VARIANCE_H_
13 13
14 #include "vpx/vpx_integer.h" 14 #include "vpx/vpx_integer.h"
15 #include "vpx_ports/mem.h"
15 16
16 #ifdef __cplusplus 17 #ifdef __cplusplus
17 extern "C" { 18 extern "C" {
18 #endif 19 #endif
19 20
20 void variance(const uint8_t *a, int a_stride, 21 // TODO(johannkoenig): All functions which depend on
21 const uint8_t *b, int b_stride, 22 // [highbd_][8|10|12_]variance should be refactored or moved to vpx_dsp.
22 int w, int h, 23 static void variance(const uint8_t *a, int a_stride,
23 unsigned int *sse, int *sum); 24 const uint8_t *b, int b_stride,
25 int w, int h, unsigned int *sse, int *sum) {
26 int i, j;
27
28 *sum = 0;
29 *sse = 0;
30
31 for (i = 0; i < h; i++) {
32 for (j = 0; j < w; j++) {
33 const int diff = a[j] - b[j];
34 *sum += diff;
35 *sse += diff * diff;
36 }
37
38 a += a_stride;
39 b += b_stride;
40 }
41 }
24 42
25 #if CONFIG_VP9_HIGHBITDEPTH 43 #if CONFIG_VP9_HIGHBITDEPTH
26 void highbd_variance(const uint8_t *a8, int a_stride, 44 static void highbd_variance64(const uint8_t *a8, int a_stride,
27 const uint8_t *b8, int b_stride, 45 const uint8_t *b8, int b_stride,
28 int w, int h, 46 int w, int h, uint64_t *sse, uint64_t *sum) {
29 unsigned int *sse, int *sum); 47 int i, j;
30 48
31 void highbd_10_variance(const uint8_t *a8, int a_stride, 49 uint16_t *a = CONVERT_TO_SHORTPTR(a8);
32 const uint8_t *b8, int b_stride, 50 uint16_t *b = CONVERT_TO_SHORTPTR(b8);
33 int w, int h, 51 *sum = 0;
34 unsigned int *sse, int *sum); 52 *sse = 0;
35 53
36 void highbd_12_variance(const uint8_t *a8, int a_stride, 54 for (i = 0; i < h; i++) {
37 const uint8_t *b8, int b_stride, 55 for (j = 0; j < w; j++) {
38 int w, int h, 56 const int diff = a[j] - b[j];
39 unsigned int *sse, int *sum); 57 *sum += diff;
58 *sse += diff * diff;
59 }
60 a += a_stride;
61 b += b_stride;
62 }
63 }
64 static void highbd_8_variance(const uint8_t *a8, int a_stride,
65 const uint8_t *b8, int b_stride,
66 int w, int h, unsigned int *sse, int *sum) {
67 uint64_t sse_long = 0;
68 uint64_t sum_long = 0;
69 highbd_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long);
70 *sse = (unsigned int)sse_long;
71 *sum = (int)sum_long;
72 }
40 #endif 73 #endif
41 74
42 typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr, 75 typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr,
43 int source_stride, 76 int source_stride,
44 const uint8_t *ref_ptr, 77 const uint8_t *ref_ptr,
45 int ref_stride); 78 int ref_stride);
46 79
47 typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr, 80 typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr,
48 int source_stride, 81 int source_stride,
49 const uint8_t *ref_ptr, 82 const uint8_t *ref_ptr,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 vp9_sad_fn_t sdf; 121 vp9_sad_fn_t sdf;
89 vp9_sad_avg_fn_t sdaf; 122 vp9_sad_avg_fn_t sdaf;
90 vp9_variance_fn_t vf; 123 vp9_variance_fn_t vf;
91 vp9_subpixvariance_fn_t svf; 124 vp9_subpixvariance_fn_t svf;
92 vp9_subp_avg_variance_fn_t svaf; 125 vp9_subp_avg_variance_fn_t svaf;
93 vp9_sad_multi_fn_t sdx3f; 126 vp9_sad_multi_fn_t sdx3f;
94 vp9_sad_multi_fn_t sdx8f; 127 vp9_sad_multi_fn_t sdx8f;
95 vp9_sad_multi_d_fn_t sdx4df; 128 vp9_sad_multi_d_fn_t sdx4df;
96 } vp9_variance_fn_ptr_t; 129 } vp9_variance_fn_ptr_t;
97 130
98 void vp9_comp_avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width,
99 int height, const uint8_t *ref, int ref_stride);
100
101 #if CONFIG_VP9_HIGHBITDEPTH
102 void vp9_highbd_comp_avg_pred(uint16_t *comp_pred, const uint8_t *pred,
103 int width, int height,
104 const uint8_t *ref, int ref_stride);
105 #endif
106
107 #ifdef __cplusplus 131 #ifdef __cplusplus
108 } // extern "C" 132 } // extern "C"
109 #endif 133 #endif
110 134
111 #endif // VP9_ENCODER_VP9_VARIANCE_H_ 135 #endif // VP9_ENCODER_VP9_VARIANCE_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_tokenize.c ('k') | source/libvpx/vp9/encoder/vp9_variance.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698