OLD | NEW |
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 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // If dc is 1, then input[0] is the reconstructed value, do not need | 86 // If dc is 1, then input[0] is the reconstructed value, do not need |
87 // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1. | 87 // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1. |
88 | 88 |
89 // The calculation can be simplified if there are not many non-zero dct | 89 // The calculation can be simplified if there are not many non-zero dct |
90 // coefficients. Use eobs to decide what to do. | 90 // coefficients. Use eobs to decide what to do. |
91 // TODO(yunqingwang): "eobs = 1" case is also handled in vp9_short_idct8x8_c. | 91 // TODO(yunqingwang): "eobs = 1" case is also handled in vp9_short_idct8x8_c. |
92 // Combine that with code here. | 92 // Combine that with code here. |
93 if (eob) { | 93 if (eob) { |
94 if (eob == 1) { | 94 if (eob == 1) { |
95 // DC only DCT coefficient | 95 // DC only DCT coefficient |
96 int16_t in = input[0]; | 96 vp9_short_idct8x8_1_add(input, dest, stride); |
97 int16_t out; | |
98 | |
99 // Note: the idct1 will need to be modified accordingly whenever | |
100 // vp9_short_idct8x8_c() is modified. | |
101 vp9_short_idct1_8x8_c(&in, &out); | |
102 input[0] = 0; | 97 input[0] = 0; |
103 | 98 } else if (eob <= 10) { |
104 vp9_add_constant_residual_8x8(out, dest, stride); | 99 vp9_short_idct10_8x8_add(input, dest, stride); |
| 100 vpx_memset(input, 0, 128); |
105 } else { | 101 } else { |
106 vp9_short_idct8x8_add(input, dest, stride); | 102 vp9_short_idct8x8_add(input, dest, stride); |
107 vpx_memset(input, 0, 128); | 103 vpx_memset(input, 0, 128); |
108 } | 104 } |
109 } | 105 } |
110 } | 106 } |
111 | 107 |
112 void vp9_iht_add_16x16_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest, | 108 void vp9_iht_add_16x16_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest, |
113 int stride, int eob) { | 109 int stride, int eob) { |
114 if (tx_type == DCT_DCT) { | 110 if (tx_type == DCT_DCT) { |
115 vp9_idct_add_16x16(input, dest, stride, eob); | 111 vp9_idct_add_16x16(input, dest, stride, eob); |
116 } else { | 112 } else { |
117 if (eob > 0) { | 113 if (eob > 0) { |
118 vp9_short_iht16x16_add(input, dest, stride, tx_type); | 114 vp9_short_iht16x16_add(input, dest, stride, tx_type); |
119 vpx_memset(input, 0, 512); | 115 vpx_memset(input, 0, 512); |
120 } | 116 } |
121 } | 117 } |
122 } | 118 } |
123 | 119 |
124 void vp9_idct_add_16x16_c(int16_t *input, uint8_t *dest, int stride, int eob) { | 120 void vp9_idct_add_16x16_c(int16_t *input, uint8_t *dest, int stride, int eob) { |
125 /* The calculation can be simplified if there are not many non-zero dct | 121 /* The calculation can be simplified if there are not many non-zero dct |
126 * coefficients. Use eobs to separate different cases. */ | 122 * coefficients. Use eobs to separate different cases. */ |
127 if (eob) { | 123 if (eob) { |
128 if (eob == 1) { | 124 if (eob == 1) { |
129 /* DC only DCT coefficient. */ | 125 /* DC only DCT coefficient. */ |
130 int16_t in = input[0]; | 126 vp9_short_idct16x16_1_add(input, dest, stride); |
131 int16_t out; | |
132 /* Note: the idct1 will need to be modified accordingly whenever | |
133 * vp9_short_idct16x16() is modified. */ | |
134 vp9_short_idct1_16x16_c(&in, &out); | |
135 input[0] = 0; | 127 input[0] = 0; |
136 | 128 } else if (eob <= 10) { |
137 vp9_add_constant_residual_16x16(out, dest, stride); | 129 vp9_short_idct10_16x16_add(input, dest, stride); |
| 130 vpx_memset(input, 0, 512); |
138 } else { | 131 } else { |
139 vp9_short_idct16x16_add(input, dest, stride); | 132 vp9_short_idct16x16_add(input, dest, stride); |
140 vpx_memset(input, 0, 512); | 133 vpx_memset(input, 0, 512); |
141 } | 134 } |
142 } | 135 } |
143 } | 136 } |
144 | 137 |
145 void vp9_idct_add_32x32_c(int16_t *input, uint8_t *dest, int stride, int eob) { | 138 void vp9_idct_add_32x32_c(int16_t *input, uint8_t *dest, int stride, int eob) { |
146 DECLARE_ALIGNED_ARRAY(16, int16_t, output, 1024); | 139 DECLARE_ALIGNED_ARRAY(16, int16_t, output, 1024); |
147 | 140 |
148 if (eob) { | 141 if (eob) { |
149 if (eob == 1) { | 142 if (eob == 1) { |
150 vp9_short_idct1_32x32(input, output); | 143 vp9_short_idct1_32x32(input, output); |
151 vp9_add_constant_residual_32x32(output[0], dest, stride); | 144 vp9_add_constant_residual_32x32(output[0], dest, stride); |
152 input[0] = 0; | 145 input[0] = 0; |
153 } else { | 146 } else { |
154 vp9_short_idct32x32_add(input, dest, stride); | 147 vp9_short_idct32x32_add(input, dest, stride); |
155 vpx_memset(input, 0, 2048); | 148 vpx_memset(input, 0, 2048); |
156 } | 149 } |
157 } | 150 } |
158 } | 151 } |
159 | 152 |
OLD | NEW |