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

Side by Side Diff: source/libvpx/vp9/common/vp9_subpelvar.h

Issue 54923004: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2010 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 VP9_COMMON_VP9_SUBPELVAR_H_
12 #define VP9_COMMON_VP9_SUBPELVAR_H_
13
14 #include "vp9/common/vp9_common.h"
15 #include "vp9/common/vp9_convolve.h"
16
17 static void variance(const uint8_t *src_ptr,
18 int source_stride,
19 const uint8_t *ref_ptr,
20 int recon_stride,
21 int w,
22 int h,
23 unsigned int *sse,
24 int *sum) {
25 int i, j;
26 int diff;
27
28 *sum = 0;
29 *sse = 0;
30
31 for (i = 0; i < h; i++) {
32 for (j = 0; j < w; j++) {
33 diff = src_ptr[j] - ref_ptr[j];
34 *sum += diff;
35 *sse += diff * diff;
36 }
37
38 src_ptr += source_stride;
39 ref_ptr += recon_stride;
40 }
41 }
42
43 /****************************************************************************
44 *
45 * ROUTINE : filter_block2d_bil_first_pass
46 *
47 * INPUTS : uint8_t *src_ptr : Pointer to source block.
48 * uint32_t src_pixels_per_line : Stride of input block.
49 * uint32_t pixel_step : Offset between filter input sam ples (see notes).
50 * uint32_t output_height : Input block height.
51 * uint32_t output_width : Input block width.
52 * int32_t *vp9_filter : Array of 2 bi-linear filter taps.
53 *
54 * OUTPUTS : int32_t *output_ptr : Pointer to filtered block.
55 *
56 * RETURNS : void
57 *
58 * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in
59 * either horizontal or vertical direction to produce the
60 * filtered output block. Used to implement first-pass
61 * of 2-D separable filter.
62 *
63 * SPECIAL NOTES : Produces int32_t output to retain precision for next pass.
64 * Two filter taps should sum to VP9_FILTER_WEIGHT.
65 * pixel_step defines whether the filter is applied
66 * horizontally (pixel_step=1) or vertically (pixel_step=stride ).
67 * It defines the offset required to move from one input
68 * to the next.
69 *
70 ****************************************************************************/
71 static void var_filter_block2d_bil_first_pass(const uint8_t *src_ptr,
72 uint16_t *output_ptr,
73 unsigned int src_pixels_per_line,
74 int pixel_step,
75 unsigned int output_height,
76 unsigned int output_width,
77 const int16_t *vp9_filter) {
78 unsigned int i, j;
79
80 for (i = 0; i < output_height; i++) {
81 for (j = 0; j < output_width; j++) {
82 output_ptr[j] = ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] +
83 (int)src_ptr[pixel_step] * vp9_filter[1],
84 FILTER_BITS);
85
86 src_ptr++;
87 }
88
89 // Next row...
90 src_ptr += src_pixels_per_line - output_width;
91 output_ptr += output_width;
92 }
93 }
94
95 /****************************************************************************
96 *
97 * ROUTINE : filter_block2d_bil_second_pass
98 *
99 * INPUTS : int32_t *src_ptr : Pointer to source block.
100 * uint32_t src_pixels_per_line : Stride of input block.
101 * uint32_t pixel_step : Offset between filter input sam ples (see notes).
102 * uint32_t output_height : Input block height.
103 * uint32_t output_width : Input block width.
104 * int32_t *vp9_filter : Array of 2 bi-linear filter taps.
105 *
106 * OUTPUTS : uint16_t *output_ptr : Pointer to filtered block.
107 *
108 * RETURNS : void
109 *
110 * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in
111 * either horizontal or vertical direction to produce the
112 * filtered output block. Used to implement second-pass
113 * of 2-D separable filter.
114 *
115 * SPECIAL NOTES : Requires 32-bit input as produced by filter_block2d_bil_firs t_pass.
116 * Two filter taps should sum to VP9_FILTER_WEIGHT.
117 * pixel_step defines whether the filter is applied
118 * horizontally (pixel_step=1) or vertically (pixel_step=stride ).
119 * It defines the offset required to move from one input
120 * to the next.
121 *
122 ****************************************************************************/
123 static void var_filter_block2d_bil_second_pass(const uint16_t *src_ptr,
124 uint8_t *output_ptr,
125 unsigned int src_pixels_per_line,
126 unsigned int pixel_step,
127 unsigned int output_height,
128 unsigned int output_width,
129 const int16_t *vp9_filter) {
130 unsigned int i, j;
131
132 for (i = 0; i < output_height; i++) {
133 for (j = 0; j < output_width; j++) {
134 output_ptr[j] = ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] +
135 (int)src_ptr[pixel_step] * vp9_filter[1],
136 FILTER_BITS);
137 src_ptr++;
138 }
139
140 src_ptr += src_pixels_per_line - output_width;
141 output_ptr += output_width;
142 }
143 }
144
145 #endif // VP9_COMMON_VP9_SUBPELVAR_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_seg_common.c ('k') | source/libvpx/vp9/common/vp9_systemdependent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698