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

Side by Side Diff: source/libvpx/vp9/common/vp9_recon.c

Issue 11974002: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/common/vp9_quant_common.h ('k') | source/libvpx/vp9/common/vp9_reconinter.h » ('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 11
12 #include "vpx_ports/config.h" 12 #include "./vpx_config.h"
13 #include "vp9_rtcd.h" 13 #include "vp9_rtcd.h"
14 #include "vp9/common/vp9_blockd.h" 14 #include "vp9/common/vp9_blockd.h"
15 15
16 void vp9_recon_b_c 16 void vp9_recon_b_c(uint8_t *pred_ptr,
17 ( 17 int16_t *diff_ptr,
18 unsigned char *pred_ptr, 18 uint8_t *dst_ptr,
19 short *diff_ptr, 19 int stride) {
20 unsigned char *dst_ptr,
21 int stride
22 ) {
23 int r, c; 20 int r, c;
24 21
25 for (r = 0; r < 4; r++) { 22 for (r = 0; r < 4; r++) {
26 for (c = 0; c < 4; c++) { 23 for (c = 0; c < 4; c++) {
27 int a = diff_ptr[c] + pred_ptr[c]; 24 dst_ptr[c] = clip_pixel(diff_ptr[c] + pred_ptr[c]);
28
29 if (a < 0)
30 a = 0;
31
32 if (a > 255)
33 a = 255;
34
35 dst_ptr[c] = (unsigned char) a;
36 } 25 }
37 26
38 dst_ptr += stride; 27 dst_ptr += stride;
39 diff_ptr += 16; 28 diff_ptr += 16;
40 pred_ptr += 16; 29 pred_ptr += 16;
41 } 30 }
42 } 31 }
43 32
44 void vp9_recon_uv_b_c 33 void vp9_recon_uv_b_c(uint8_t *pred_ptr,
45 ( 34 int16_t *diff_ptr,
46 unsigned char *pred_ptr, 35 uint8_t *dst_ptr,
47 short *diff_ptr, 36 int stride) {
48 unsigned char *dst_ptr,
49 int stride
50 ) {
51 int r, c; 37 int r, c;
52 38
53 for (r = 0; r < 4; r++) { 39 for (r = 0; r < 4; r++) {
54 for (c = 0; c < 4; c++) { 40 for (c = 0; c < 4; c++) {
55 int a = diff_ptr[c] + pred_ptr[c]; 41 dst_ptr[c] = clip_pixel(diff_ptr[c] + pred_ptr[c]);
56
57 if (a < 0)
58 a = 0;
59
60 if (a > 255)
61 a = 255;
62
63 dst_ptr[c] = (unsigned char) a;
64 } 42 }
65 43
66 dst_ptr += stride; 44 dst_ptr += stride;
67 diff_ptr += 8; 45 diff_ptr += 8;
68 pred_ptr += 8; 46 pred_ptr += 8;
69 } 47 }
70 } 48 }
71 void vp9_recon4b_c 49
72 ( 50 void vp9_recon4b_c(uint8_t *pred_ptr,
73 unsigned char *pred_ptr, 51 int16_t *diff_ptr,
74 short *diff_ptr, 52 uint8_t *dst_ptr,
75 unsigned char *dst_ptr, 53 int stride) {
76 int stride
77 ) {
78 int r, c; 54 int r, c;
79 55
80 for (r = 0; r < 4; r++) { 56 for (r = 0; r < 4; r++) {
81 for (c = 0; c < 16; c++) { 57 for (c = 0; c < 16; c++) {
82 int a = diff_ptr[c] + pred_ptr[c]; 58 dst_ptr[c] = clip_pixel(diff_ptr[c] + pred_ptr[c]);
83
84 if (a < 0)
85 a = 0;
86
87 if (a > 255)
88 a = 255;
89
90 dst_ptr[c] = (unsigned char) a;
91 } 59 }
92 60
93 dst_ptr += stride; 61 dst_ptr += stride;
94 diff_ptr += 16; 62 diff_ptr += 16;
95 pred_ptr += 16; 63 pred_ptr += 16;
96 } 64 }
97 } 65 }
98 66
99 void vp9_recon2b_c 67 void vp9_recon2b_c(uint8_t *pred_ptr,
100 ( 68 int16_t *diff_ptr,
101 unsigned char *pred_ptr, 69 uint8_t *dst_ptr,
102 short *diff_ptr, 70 int stride) {
103 unsigned char *dst_ptr,
104 int stride
105 ) {
106 int r, c; 71 int r, c;
107 72
108 for (r = 0; r < 4; r++) { 73 for (r = 0; r < 4; r++) {
109 for (c = 0; c < 8; c++) { 74 for (c = 0; c < 8; c++) {
110 int a = diff_ptr[c] + pred_ptr[c]; 75 dst_ptr[c] = clip_pixel(diff_ptr[c] + pred_ptr[c]);
111
112 if (a < 0)
113 a = 0;
114
115 if (a > 255)
116 a = 255;
117
118 dst_ptr[c] = (unsigned char) a;
119 } 76 }
120 77
121 dst_ptr += stride; 78 dst_ptr += stride;
122 diff_ptr += 8; 79 diff_ptr += 8;
123 pred_ptr += 8; 80 pred_ptr += 8;
124 } 81 }
125 } 82 }
126 83
127 #if CONFIG_SUPERBLOCKS
128 void vp9_recon_mby_s_c(MACROBLOCKD *xd, uint8_t *dst) { 84 void vp9_recon_mby_s_c(MACROBLOCKD *xd, uint8_t *dst) {
129 int x, y; 85 int x, y;
130 BLOCKD *b = &xd->block[0]; 86 BLOCKD *b = &xd->block[0];
131 int stride = b->dst_stride; 87 int stride = b->dst_stride;
132 short *diff = b->diff; 88 int16_t *diff = b->diff;
133 89
134 for (y = 0; y < 16; y++) { 90 for (y = 0; y < 16; y++) {
135 for (x = 0; x < 16; x++) { 91 for (x = 0; x < 16; x++) {
136 int a = dst[x] + diff[x]; 92 dst[x] = clip_pixel(dst[x] + diff[x]);
137 if (a < 0)
138 a = 0;
139 else if (a > 255)
140 a = 255;
141 dst[x] = a;
142 } 93 }
143 dst += stride; 94 dst += stride;
144 diff += 16; 95 diff += 16;
145 } 96 }
146 } 97 }
147 98
148 void vp9_recon_mbuv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) { 99 void vp9_recon_mbuv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) {
149 int x, y, i; 100 int x, y, i;
150 uint8_t *dst = udst; 101 uint8_t *dst = udst;
151 102
152 for (i = 0; i < 2; i++, dst = vdst) { 103 for (i = 0; i < 2; i++, dst = vdst) {
153 BLOCKD *b = &xd->block[16 + 4 * i]; 104 BLOCKD *b = &xd->block[16 + 4 * i];
154 int stride = b->dst_stride; 105 int stride = b->dst_stride;
155 short *diff = b->diff; 106 int16_t *diff = b->diff;
156 107
157 for (y = 0; y < 8; y++) { 108 for (y = 0; y < 8; y++) {
158 for (x = 0; x < 8; x++) { 109 for (x = 0; x < 8; x++) {
159 int a = dst[x] + diff[x]; 110 dst[x] = clip_pixel(dst[x] + diff[x]);
160 if (a < 0)
161 a = 0;
162 else if (a > 255)
163 a = 255;
164 dst[x] = a;
165 } 111 }
166 dst += stride; 112 dst += stride;
167 diff += 8; 113 diff += 8;
168 } 114 }
169 } 115 }
170 } 116 }
171 #endif 117
118 void vp9_recon_sby_s_c(MACROBLOCKD *xd, uint8_t *dst) {
119 int x, y, stride = xd->block[0].dst_stride;
120 int16_t *diff = xd->sb_coeff_data.diff;
121
122 for (y = 0; y < 32; y++) {
123 for (x = 0; x < 32; x++) {
124 dst[x] = clip_pixel(dst[x] + diff[x]);
125 }
126 dst += stride;
127 diff += 32;
128 }
129 }
130
131 void vp9_recon_sbuv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) {
132 int x, y, stride = xd->block[16].dst_stride;
133 int16_t *udiff = xd->sb_coeff_data.diff + 1024;
134 int16_t *vdiff = xd->sb_coeff_data.diff + 1280;
135
136 for (y = 0; y < 16; y++) {
137 for (x = 0; x < 16; x++) {
138 udst[x] = clip_pixel(udst[x] + udiff[x]);
139 vdst[x] = clip_pixel(vdst[x] + vdiff[x]);
140 }
141 udst += stride;
142 vdst += stride;
143 udiff += 16;
144 vdiff += 16;
145 }
146 }
172 147
173 void vp9_recon_mby_c(MACROBLOCKD *xd) { 148 void vp9_recon_mby_c(MACROBLOCKD *xd) {
174 int i; 149 int i;
175 150
176 for (i = 0; i < 16; i += 4) { 151 for (i = 0; i < 16; i += 4) {
177 BLOCKD *b = &xd->block[i]; 152 BLOCKD *b = &xd->block[i];
178 153
179 vp9_recon4b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride); 154 vp9_recon4b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
180 } 155 }
181 } 156 }
182 157
183 void vp9_recon_mb_c(MACROBLOCKD *xd) { 158 void vp9_recon_mb_c(MACROBLOCKD *xd) {
184 int i; 159 int i;
185 160
186 for (i = 0; i < 16; i += 4) { 161 for (i = 0; i < 16; i += 4) {
187 BLOCKD *b = &xd->block[i]; 162 BLOCKD *b = &xd->block[i];
188 163
189 vp9_recon4b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride); 164 vp9_recon4b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
190 } 165 }
191 166
192 for (i = 16; i < 24; i += 2) { 167 for (i = 16; i < 24; i += 2) {
193 BLOCKD *b = &xd->block[i]; 168 BLOCKD *b = &xd->block[i];
194 169
195 vp9_recon2b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride); 170 vp9_recon2b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
196 } 171 }
197 } 172 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_quant_common.h ('k') | source/libvpx/vp9/common/vp9_reconinter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698