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

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

Issue 111463005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 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
« no previous file with comments | « source/libvpx/vp9/common/vp9_idct.h ('k') | source/libvpx/vp9/common/vp9_loopfilter.c » ('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
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 outptr += 16; 828 outptr += 16;
829 } 829 }
830 830
831 // Columns 831 // Columns
832 for (i = 0; i < 16; ++i) { 832 for (i = 0; i < 16; ++i) {
833 for (j = 0; j < 16; ++j) 833 for (j = 0; j < 16; ++j)
834 temp_in[j] = out[j * 16 + i]; 834 temp_in[j] = out[j * 16 + i];
835 ht.cols(temp_in, temp_out); 835 ht.cols(temp_in, temp_out);
836 for (j = 0; j < 16; ++j) 836 for (j = 0; j < 16; ++j)
837 dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) 837 dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
838 + dest[j * stride + i]); } 838 + dest[j * stride + i]);
839 }
839 } 840 }
840 841
841 void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int stride) { 842 void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int stride) {
842 int16_t out[16 * 16] = { 0 }; 843 int16_t out[16 * 16] = { 0 };
843 int16_t *outptr = out; 844 int16_t *outptr = out;
844 int i, j; 845 int i, j;
845 int16_t temp_in[16], temp_out[16]; 846 int16_t temp_in[16], temp_out[16];
846 847
847 // First transform rows. Since all non-zero dct coefficients are in 848 // First transform rows. Since all non-zero dct coefficients are in
848 // upper-left 4x4 area, we only need to calculate first 4 rows here. 849 // upper-left 4x4 area, we only need to calculate first 4 rows here.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 outptr += 32; 1270 outptr += 32;
1270 } 1271 }
1271 1272
1272 // Columns 1273 // Columns
1273 for (i = 0; i < 32; ++i) { 1274 for (i = 0; i < 32; ++i) {
1274 for (j = 0; j < 32; ++j) 1275 for (j = 0; j < 32; ++j)
1275 temp_in[j] = out[j * 32 + i]; 1276 temp_in[j] = out[j * 32 + i];
1276 idct32_1d(temp_in, temp_out); 1277 idct32_1d(temp_in, temp_out);
1277 for (j = 0; j < 32; ++j) 1278 for (j = 0; j < 32; ++j)
1278 dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) 1279 dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
1279 + dest[j * stride + i]); 1280 + dest[j * stride + i]);
1280 } 1281 }
1281 } 1282 }
1282 1283
1283 void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int stride) { 1284 void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int stride) {
1284 int16_t out[32 * 32] = {0}; 1285 int16_t out[32 * 32] = {0};
1285 int16_t *outptr = out; 1286 int16_t *outptr = out;
1286 int i, j; 1287 int i, j;
1287 int16_t temp_in[32], temp_out[32]; 1288 int16_t temp_in[32], temp_out[32];
1288 1289
1289 // Rows 1290 // Rows
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 } 1338 }
1338 1339
1339 void vp9_idct8x8_add(const int16_t *input, uint8_t *dest, int stride, int eob) { 1340 void vp9_idct8x8_add(const int16_t *input, uint8_t *dest, int stride, int eob) {
1340 // If dc is 1, then input[0] is the reconstructed value, do not need 1341 // If dc is 1, then input[0] is the reconstructed value, do not need
1341 // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1. 1342 // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1.
1342 1343
1343 // The calculation can be simplified if there are not many non-zero dct 1344 // The calculation can be simplified if there are not many non-zero dct
1344 // coefficients. Use eobs to decide what to do. 1345 // coefficients. Use eobs to decide what to do.
1345 // TODO(yunqingwang): "eobs = 1" case is also handled in vp9_short_idct8x8_c. 1346 // TODO(yunqingwang): "eobs = 1" case is also handled in vp9_short_idct8x8_c.
1346 // Combine that with code here. 1347 // Combine that with code here.
1347 if (eob) { 1348 if (eob == 1)
1348 if (eob == 1) 1349 // DC only DCT coefficient
1349 // DC only DCT coefficient 1350 vp9_idct8x8_1_add(input, dest, stride);
1350 vp9_idct8x8_1_add(input, dest, stride); 1351 else if (eob <= 10)
1351 else if (eob <= 10) 1352 vp9_idct8x8_10_add(input, dest, stride);
1352 vp9_idct8x8_10_add(input, dest, stride); 1353 else
1353 else 1354 vp9_idct8x8_64_add(input, dest, stride);
1354 vp9_idct8x8_64_add(input, dest, stride);
1355 }
1356 } 1355 }
1357 1356
1358 void vp9_idct16x16_add(const int16_t *input, uint8_t *dest, int stride, 1357 void vp9_idct16x16_add(const int16_t *input, uint8_t *dest, int stride,
1359 int eob) { 1358 int eob) {
1360 /* The calculation can be simplified if there are not many non-zero dct 1359 /* The calculation can be simplified if there are not many non-zero dct
1361 * coefficients. Use eobs to separate different cases. */ 1360 * coefficients. Use eobs to separate different cases. */
1362 if (eob) { 1361 if (eob == 1)
1363 if (eob == 1) 1362 /* DC only DCT coefficient. */
1364 /* DC only DCT coefficient. */ 1363 vp9_idct16x16_1_add(input, dest, stride);
1365 vp9_idct16x16_1_add(input, dest, stride); 1364 else if (eob <= 10)
1366 else if (eob <= 10) 1365 vp9_idct16x16_10_add(input, dest, stride);
1367 vp9_idct16x16_10_add(input, dest, stride); 1366 else
1368 else 1367 vp9_idct16x16_256_add(input, dest, stride);
1369 vp9_idct16x16_256_add(input, dest, stride);
1370 }
1371 } 1368 }
1372 1369
1373 void vp9_idct32x32_add(const int16_t *input, uint8_t *dest, int stride, 1370 void vp9_idct32x32_add(const int16_t *input, uint8_t *dest, int stride,
1374 int eob) { 1371 int eob) {
1375 if (eob) { 1372 if (eob == 1)
1376 if (eob == 1) 1373 vp9_idct32x32_1_add(input, dest, stride);
1377 vp9_idct32x32_1_add(input, dest, stride); 1374 else if (eob <= 34)
1378 else if (eob <= 34) 1375 // non-zero coeff only in upper-left 8x8
1379 // non-zero coeff only in upper-left 8x8 1376 vp9_idct32x32_34_add(input, dest, stride);
1380 vp9_idct32x32_34_add(input, dest, stride); 1377 else
1381 else 1378 vp9_idct32x32_1024_add(input, dest, stride);
1382 vp9_idct32x32_1024_add(input, dest, stride);
1383 }
1384 } 1379 }
1385 1380
1386 // iht 1381 // iht
1387 void vp9_iht4x4_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest, 1382 void vp9_iht4x4_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
1388 int stride, int eob) { 1383 int stride, int eob) {
1389 if (tx_type == DCT_DCT) 1384 if (tx_type == DCT_DCT)
1390 vp9_idct4x4_add(input, dest, stride, eob); 1385 vp9_idct4x4_add(input, dest, stride, eob);
1391 else 1386 else
1392 vp9_iht4x4_16_add(input, dest, stride, tx_type); 1387 vp9_iht4x4_16_add(input, dest, stride, tx_type);
1393 } 1388 }
1394 1389
1395 void vp9_iht8x8_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest, 1390 void vp9_iht8x8_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
1396 int stride, int eob) { 1391 int stride, int eob) {
1397 if (tx_type == DCT_DCT) { 1392 if (tx_type == DCT_DCT) {
1398 vp9_idct8x8_add(input, dest, stride, eob); 1393 vp9_idct8x8_add(input, dest, stride, eob);
1399 } else { 1394 } else {
1400 if (eob > 0) { 1395 vp9_iht8x8_64_add(input, dest, stride, tx_type);
1401 vp9_iht8x8_64_add(input, dest, stride, tx_type);
1402 }
1403 } 1396 }
1404 } 1397 }
1405 1398
1406 void vp9_iht16x16_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest, 1399 void vp9_iht16x16_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
1407 int stride, int eob) { 1400 int stride, int eob) {
1408 if (tx_type == DCT_DCT) { 1401 if (tx_type == DCT_DCT) {
1409 vp9_idct16x16_add(input, dest, stride, eob); 1402 vp9_idct16x16_add(input, dest, stride, eob);
1410 } else { 1403 } else {
1411 if (eob > 0) { 1404 vp9_iht16x16_256_add(input, dest, stride, tx_type);
1412 vp9_iht16x16_256_add(input, dest, stride, tx_type);
1413 }
1414 } 1405 }
1415 } 1406 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_idct.h ('k') | source/libvpx/vp9/common/vp9_loopfilter.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698