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

Side by Side Diff: source/libvpx/vp9/decoder/vp9_idct_blk.c

Issue 11555023: libvpx: Add VP9 decoder. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 8 years 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
Property Changes:
Added: svn:eol-style
+ LF
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 #include "vp9_rtcd.h"
12 #include "vp9/common/vp9_blockd.h"
13 #if CONFIG_LOSSLESS
14 #include "vp9/decoder/vp9_dequantize.h"
15 #endif
16
17 void vp9_dequant_dc_idct_add_y_block_c(short *q, const short *dq,
18 unsigned char *pre,
19 unsigned char *dst,
20 int stride, unsigned short *eobs,
21 const short *dc) {
22 int i, j;
23
24 for (i = 0; i < 4; i++) {
25 for (j = 0; j < 4; j++) {
26 if (*eobs++ > 1)
27 vp9_dequant_dc_idct_add_c(q, dq, pre, dst, 16, stride, dc[0]);
28 else
29 vp9_dc_only_idct_add_c(dc[0], pre, dst, 16, stride);
30
31 q += 16;
32 pre += 4;
33 dst += 4;
34 dc++;
35 }
36
37 pre += 64 - 16;
38 dst += 4 * stride - 16;
39 }
40 }
41
42 #if CONFIG_SUPERBLOCKS
43 void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(short *q, const short *dq,
44 unsigned char *dst,
45 int stride,
46 unsigned short *eobs,
47 const short *dc,
48 MACROBLOCKD *xd) {
49 int i, j;
50
51 for (i = 0; i < 4; i++) {
52 for (j = 0; j < 4; j++) {
53 if (*eobs++ > 1)
54 vp9_dequant_dc_idct_add_c(q, dq, dst, dst, stride, stride, dc[0]);
55 else
56 vp9_dc_only_idct_add_c(dc[0], dst, dst, stride, stride);
57
58 q += 16;
59 dst += 4;
60 dc++;
61 }
62
63 dst += 4 * stride - 16;
64 }
65 }
66 #endif
67
68 void vp9_dequant_idct_add_y_block_c(short *q, const short *dq,
69 unsigned char *pre,
70 unsigned char *dst,
71 int stride, unsigned short *eobs) {
72 int i, j;
73
74 for (i = 0; i < 4; i++) {
75 for (j = 0; j < 4; j++) {
76 if (*eobs++ > 1)
77 vp9_dequant_idct_add_c(q, dq, pre, dst, 16, stride);
78 else {
79 vp9_dc_only_idct_add_c(q[0]*dq[0], pre, dst, 16, stride);
80 ((int *)q)[0] = 0;
81 }
82
83 q += 16;
84 pre += 4;
85 dst += 4;
86 }
87
88 pre += 64 - 16;
89 dst += 4 * stride - 16;
90 }
91 }
92
93 void vp9_dequant_idct_add_uv_block_c(short *q, const short *dq,
94 unsigned char *pre, unsigned char *dstu,
95 unsigned char *dstv, int stride,
96 unsigned short *eobs) {
97 int i, j;
98
99 for (i = 0; i < 2; i++) {
100 for (j = 0; j < 2; j++) {
101 if (*eobs++ > 1)
102 vp9_dequant_idct_add_c(q, dq, pre, dstu, 8, stride);
103 else {
104 vp9_dc_only_idct_add_c(q[0]*dq[0], pre, dstu, 8, stride);
105 ((int *)q)[0] = 0;
106 }
107
108 q += 16;
109 pre += 4;
110 dstu += 4;
111 }
112
113 pre += 32 - 8;
114 dstu += 4 * stride - 8;
115 }
116
117 for (i = 0; i < 2; i++) {
118 for (j = 0; j < 2; j++) {
119 if (*eobs++ > 1)
120 vp9_dequant_idct_add_c(q, dq, pre, dstv, 8, stride);
121 else {
122 vp9_dc_only_idct_add_c(q[0]*dq[0], pre, dstv, 8, stride);
123 ((int *)q)[0] = 0;
124 }
125
126 q += 16;
127 pre += 4;
128 dstv += 4;
129 }
130
131 pre += 32 - 8;
132 dstv += 4 * stride - 8;
133 }
134 }
135
136 #if CONFIG_SUPERBLOCKS
137 void vp9_dequant_idct_add_uv_block_4x4_inplace_c(short *q, const short *dq,
138 unsigned char *dstu,
139 unsigned char *dstv,
140 int stride,
141 unsigned short *eobs,
142 MACROBLOCKD *xd) {
143 int i, j;
144
145 for (i = 0; i < 2; i++) {
146 for (j = 0; j < 2; j++) {
147 if (*eobs++ > 1) {
148 vp9_dequant_idct_add_c(q, dq, dstu, dstu, stride, stride);
149 } else {
150 vp9_dc_only_idct_add_c(q[0]*dq[0], dstu, dstu, stride, stride);
151 ((int *)q)[0] = 0;
152 }
153
154 q += 16;
155 dstu += 4;
156 }
157
158 dstu += 4 * stride - 8;
159 }
160
161 for (i = 0; i < 2; i++) {
162 for (j = 0; j < 2; j++) {
163 if (*eobs++ > 1) {
164 vp9_dequant_idct_add_c(q, dq, dstv, dstv, stride, stride);
165 } else {
166 vp9_dc_only_idct_add_c(q[0]*dq[0], dstv, dstv, stride, stride);
167 ((int *)q)[0] = 0;
168 }
169
170 q += 16;
171 dstv += 4;
172 }
173
174 dstv += 4 * stride - 8;
175 }
176 }
177 #endif
178
179 void vp9_dequant_dc_idct_add_y_block_8x8_c(short *q, const short *dq,
180 unsigned char *pre,
181 unsigned char *dst,
182 int stride, unsigned short *eobs,
183 const short *dc,
184 MACROBLOCKD *xd) {
185 q[0] = dc[0];
186 vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, 1, xd->eobs[0]);
187
188 q[64] = dc[1];
189 vp9_dequant_idct_add_8x8_c(&q[64], dq, pre + 8, dst + 8, 16, stride, 1,
190 xd->eobs[4]);
191
192 q[128] = dc[4];
193 vp9_dequant_idct_add_8x8_c(&q[128], dq, pre + 8 * 16,
194 dst + 8 * stride, 16, stride, 1, xd->eobs[8]);
195
196 q[192] = dc[8];
197 vp9_dequant_idct_add_8x8_c(&q[192], dq, pre + 8 * 16 + 8,
198 dst + 8 * stride + 8, 16, stride, 1,
199 xd->eobs[12]);
200 }
201
202 #if CONFIG_SUPERBLOCKS
203 void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(short *q, const short *dq,
204 unsigned char *dst,
205 int stride,
206 unsigned short *eobs,
207 const short *dc,
208 MACROBLOCKD *xd) {
209 q[0] = dc[0];
210 vp9_dequant_idct_add_8x8_c(q, dq, dst, dst, stride, stride, 1, xd->eobs[0]);
211
212 q[64] = dc[1];
213 vp9_dequant_idct_add_8x8_c(&q[64], dq, dst + 8,
214 dst + 8, stride, stride, 1, xd->eobs[4]);
215
216 q[128] = dc[4];
217 vp9_dequant_idct_add_8x8_c(&q[128], dq, dst + 8 * stride,
218 dst + 8 * stride, stride, stride, 1,
219 xd->eobs[8]);
220
221 q[192] = dc[8];
222 vp9_dequant_idct_add_8x8_c(&q[192], dq, dst + 8 * stride + 8,
223 dst + 8 * stride + 8, stride, stride, 1,
224 xd->eobs[12]);
225 }
226 #endif
227
228 void vp9_dequant_idct_add_y_block_8x8_c(short *q, const short *dq,
229 unsigned char *pre,
230 unsigned char *dst,
231 int stride, unsigned short *eobs,
232 MACROBLOCKD *xd) {
233 unsigned char *origdest = dst;
234 unsigned char *origpred = pre;
235
236 vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, 0, xd->eobs[0]);
237 vp9_dequant_idct_add_8x8_c(&q[64], dq, origpred + 8,
238 origdest + 8, 16, stride, 0, xd->eobs[4]);
239 vp9_dequant_idct_add_8x8_c(&q[128], dq, origpred + 8 * 16,
240 origdest + 8 * stride, 16, stride, 0, xd->eobs[8]);
241 vp9_dequant_idct_add_8x8_c(&q[192], dq, origpred + 8 * 16 + 8,
242 origdest + 8 * stride + 8, 16, stride, 0,
243 xd->eobs[12]);
244 }
245
246 void vp9_dequant_idct_add_uv_block_8x8_c(short *q, const short *dq,
247 unsigned char *pre,
248 unsigned char *dstu,
249 unsigned char *dstv,
250 int stride, unsigned short *eobs,
251 MACROBLOCKD *xd) {
252 vp9_dequant_idct_add_8x8_c(q, dq, pre, dstu, 8, stride, 0, xd->eobs[16]);
253
254 q += 64;
255 pre += 64;
256
257 vp9_dequant_idct_add_8x8_c(q, dq, pre, dstv, 8, stride, 0, xd->eobs[20]);
258 }
259
260 #if CONFIG_SUPERBLOCKS
261 void vp9_dequant_idct_add_uv_block_8x8_inplace_c(short *q, const short *dq,
262 unsigned char *dstu,
263 unsigned char *dstv,
264 int stride,
265 unsigned short *eobs,
266 MACROBLOCKD *xd) {
267 vp9_dequant_idct_add_8x8_c(q, dq, dstu, dstu, stride, stride, 0,
268 xd->eobs[16]);
269
270 q += 64;
271 vp9_dequant_idct_add_8x8_c(q, dq, dstv, dstv, stride, stride, 0,
272 xd->eobs[20]);
273 }
274 #endif
275
276 #if CONFIG_LOSSLESS
277 void vp9_dequant_dc_idct_add_y_block_lossless_c(short *q, const short *dq,
278 unsigned char *pre,
279 unsigned char *dst,
280 int stride,
281 unsigned short *eobs,
282 const short *dc) {
283 int i, j;
284
285 for (i = 0; i < 4; i++) {
286 for (j = 0; j < 4; j++) {
287 if (*eobs++ > 1)
288 vp9_dequant_dc_idct_add_lossless_c(q, dq, pre, dst, 16, stride, dc[0]);
289 else
290 vp9_dc_only_inv_walsh_add_c(dc[0], pre, dst, 16, stride);
291
292 q += 16;
293 pre += 4;
294 dst += 4;
295 dc++;
296 }
297
298 pre += 64 - 16;
299 dst += 4 * stride - 16;
300 }
301 }
302
303 void vp9_dequant_idct_add_y_block_lossless_c(short *q, const short *dq,
304 unsigned char *pre,
305 unsigned char *dst,
306 int stride, unsigned short *eobs) {
307 int i, j;
308
309 for (i = 0; i < 4; i++) {
310 for (j = 0; j < 4; j++) {
311 if (*eobs++ > 1)
312 vp9_dequant_idct_add_lossless_c(q, dq, pre, dst, 16, stride);
313 else {
314 vp9_dc_only_inv_walsh_add_c(q[0]*dq[0], pre, dst, 16, stride);
315 ((int *)q)[0] = 0;
316 }
317
318 q += 16;
319 pre += 4;
320 dst += 4;
321 }
322
323 pre += 64 - 16;
324 dst += 4 * stride - 16;
325 }
326 }
327
328 void vp9_dequant_idct_add_uv_block_lossless_c(short *q, const short *dq,
329 unsigned char *pre,
330 unsigned char *dstu,
331 unsigned char *dstv,
332 int stride,
333 unsigned short *eobs) {
334 int i, j;
335
336 for (i = 0; i < 2; i++) {
337 for (j = 0; j < 2; j++) {
338 if (*eobs++ > 1)
339 vp9_dequant_idct_add_lossless_c(q, dq, pre, dstu, 8, stride);
340 else {
341 vp9_dc_only_inv_walsh_add_c(q[0]*dq[0], pre, dstu, 8, stride);
342 ((int *)q)[0] = 0;
343 }
344
345 q += 16;
346 pre += 4;
347 dstu += 4;
348 }
349
350 pre += 32 - 8;
351 dstu += 4 * stride - 8;
352 }
353
354 for (i = 0; i < 2; i++) {
355 for (j = 0; j < 2; j++) {
356 if (*eobs++ > 1)
357 vp9_dequant_idct_add_lossless_c(q, dq, pre, dstv, 8, stride);
358 else {
359 vp9_dc_only_inv_walsh_add_c(q[0]*dq[0], pre, dstv, 8, stride);
360 ((int *)q)[0] = 0;
361 }
362
363 q += 16;
364 pre += 4;
365 dstv += 4;
366 }
367
368 pre += 32 - 8;
369 dstv += 4 * stride - 8;
370 }
371 }
372 #endif
373
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698