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

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

Issue 1169543007: 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
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 #include "vpx_ports/mem.h"
16 16
17 #ifdef __cplusplus 17 #ifdef __cplusplus
18 extern "C" { 18 extern "C" {
19 #endif 19 #endif
20 20
21 // TODO(johannkoenig): All functions which depend on
22 // [highbd_][8|10|12_]variance should be refactored or moved to vpx_dsp.
23 static void variance(const uint8_t *a, int a_stride,
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 }
42
43 #if CONFIG_VP9_HIGHBITDEPTH
44 static void highbd_variance64(const uint8_t *a8, int a_stride,
45 const uint8_t *b8, int b_stride,
46 int w, int h, uint64_t *sse, uint64_t *sum) {
47 int i, j;
48
49 uint16_t *a = CONVERT_TO_SHORTPTR(a8);
50 uint16_t *b = CONVERT_TO_SHORTPTR(b8);
51 *sum = 0;
52 *sse = 0;
53
54 for (i = 0; i < h; i++) {
55 for (j = 0; j < w; j++) {
56 const int diff = a[j] - b[j];
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 }
73 #endif
74
75 typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr, 21 typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr,
76 int source_stride, 22 int source_stride,
77 const uint8_t *ref_ptr, 23 const uint8_t *ref_ptr,
78 int ref_stride); 24 int ref_stride);
79 25
80 typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr, 26 typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr,
81 int source_stride, 27 int source_stride,
82 const uint8_t *ref_ptr, 28 const uint8_t *ref_ptr,
83 int ref_stride, 29 int ref_stride,
84 const uint8_t *second_pred); 30 const uint8_t *second_pred);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 vp9_sad_multi_fn_t sdx3f; 72 vp9_sad_multi_fn_t sdx3f;
127 vp9_sad_multi_fn_t sdx8f; 73 vp9_sad_multi_fn_t sdx8f;
128 vp9_sad_multi_d_fn_t sdx4df; 74 vp9_sad_multi_d_fn_t sdx4df;
129 } vp9_variance_fn_ptr_t; 75 } vp9_variance_fn_ptr_t;
130 76
131 #ifdef __cplusplus 77 #ifdef __cplusplus
132 } // extern "C" 78 } // extern "C"
133 #endif 79 #endif
134 80
135 #endif // VP9_ENCODER_VP9_VARIANCE_H_ 81 #endif // VP9_ENCODER_VP9_VARIANCE_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_temporal_filter.c ('k') | source/libvpx/vp9/encoder/vp9_variance.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698