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

Side by Side Diff: source/libvpx/vp9/common/vp9_invtrans.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/common/vp9_invtrans.h"
12 #include "./vp9_rtcd.h"
13
14 static void recon_dcblock(MACROBLOCKD *xd) {
15 BLOCKD *b = &xd->block[24];
16 int i;
17
18 for (i = 0; i < 16; i++) {
19 xd->block[i].dqcoeff[0] = b->diff[i];
20 }
21 }
22
23 static void recon_dcblock_8x8(MACROBLOCKD *xd) {
24 BLOCKD *b = &xd->block[24]; // for coeff 0, 2, 8, 10
25
26 xd->block[0].dqcoeff[0] = b->diff[0];
27 xd->block[4].dqcoeff[0] = b->diff[1];
28 xd->block[8].dqcoeff[0] = b->diff[4];
29 xd->block[12].dqcoeff[0] = b->diff[8];
30 }
31
32 void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int block, int pitch) {
33 BLOCKD *b = &xd->block[block];
34 if (b->eob <= 1)
35 xd->inv_xform4x4_1_x8(b->dqcoeff, b->diff, pitch);
36 else
37 xd->inv_xform4x4_x8(b->dqcoeff, b->diff, pitch);
38 }
39
40 void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) {
41 int i;
42 BLOCKD *blockd = xd->block;
43 int has_2nd_order = get_2nd_order_usage(xd);
44
45 if (has_2nd_order) {
46 /* do 2nd order transform on the dc block */
47 vp9_short_inv_walsh4x4(blockd[24].dqcoeff, blockd[24].diff);
48 recon_dcblock(xd);
49 }
50
51 for (i = 0; i < 16; i++) {
52 TX_TYPE tx_type = get_tx_type_4x4(xd, &xd->block[i]);
53 if (tx_type != DCT_DCT) {
54 vp9_ihtllm(xd->block[i].dqcoeff, xd->block[i].diff, 32,
55 tx_type, 4);
56 } else {
57 vp9_inverse_transform_b_4x4(xd, i, 32);
58 }
59 }
60 }
61
62 void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd) {
63 int i;
64
65 for (i = 16; i < 24; i++) {
66 vp9_inverse_transform_b_4x4(xd, i, 16);
67 }
68 }
69
70 void vp9_inverse_transform_mb_4x4(MACROBLOCKD *xd) {
71 vp9_inverse_transform_mby_4x4(xd);
72 vp9_inverse_transform_mbuv_4x4(xd);
73 }
74
75 void vp9_inverse_transform_b_8x8(short *input_dqcoeff, short *output_coeff,
76 int pitch) {
77 vp9_short_idct8x8(input_dqcoeff, output_coeff, pitch);
78 }
79
80 void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) {
81 int i;
82 BLOCKD *blockd = xd->block;
83 int has_2nd_order = get_2nd_order_usage(xd);
84
85 if (has_2nd_order) {
86 // do 2nd order transform on the dc block
87 vp9_short_ihaar2x2(blockd[24].dqcoeff, blockd[24].diff, 8);
88 recon_dcblock_8x8(xd); // need to change for 8x8
89 }
90
91 for (i = 0; i < 9; i += 8) {
92 TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]);
93 if (tx_type != DCT_DCT) {
94 vp9_ihtllm(xd->block[i].dqcoeff, xd->block[i].diff, 32, tx_type, 8);
95 } else {
96 vp9_inverse_transform_b_8x8(&blockd[i].dqcoeff[0],
97 &blockd[i].diff[0], 32);
98 }
99 }
100 for (i = 2; i < 11; i += 8) {
101 TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]);
102 if (tx_type != DCT_DCT) {
103 vp9_ihtllm(xd->block[i + 2].dqcoeff, xd->block[i].diff, 32, tx_type, 8);
104 } else {
105 vp9_inverse_transform_b_8x8(&blockd[i + 2].dqcoeff[0],
106 &blockd[i].diff[0], 32);
107 }
108 }
109 }
110
111 void vp9_inverse_transform_mbuv_8x8(MACROBLOCKD *xd) {
112 int i;
113 BLOCKD *blockd = xd->block;
114
115 for (i = 16; i < 24; i += 4) {
116 vp9_inverse_transform_b_8x8(&blockd[i].dqcoeff[0],
117 &blockd[i].diff[0], 16);
118 }
119 }
120
121 void vp9_inverse_transform_mb_8x8(MACROBLOCKD *xd) {
122 vp9_inverse_transform_mby_8x8(xd);
123 vp9_inverse_transform_mbuv_8x8(xd);
124 }
125
126 void vp9_inverse_transform_b_16x16(short *input_dqcoeff,
127 short *output_coeff, int pitch) {
128 vp9_short_idct16x16(input_dqcoeff, output_coeff, pitch);
129 }
130
131 void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd) {
132 BLOCKD *bd = &xd->block[0];
133 TX_TYPE tx_type = get_tx_type_16x16(xd, bd);
134 if (tx_type != DCT_DCT) {
135 vp9_ihtllm(bd->dqcoeff, bd->diff, 32, tx_type, 16);
136 } else {
137 vp9_inverse_transform_b_16x16(&xd->block[0].dqcoeff[0],
138 &xd->block[0].diff[0], 32);
139 }
140 }
141
142 void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd) {
143 vp9_inverse_transform_mby_16x16(xd);
144 vp9_inverse_transform_mbuv_8x8(xd);
145 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698