| 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 |
| 11 | 11 |
| 12 #include "./vp9_rtcd.h" | 12 #include "./vp9_rtcd.h" |
| 13 #include "./vpx_config.h" | 13 #include "./vpx_config.h" |
| 14 #include "./vpx_dsp_rtcd.h" | 14 #include "./vpx_dsp_rtcd.h" |
| 15 | 15 |
| 16 #include "vpx_dsp/quantize.h" | 16 #include "vpx_dsp/quantize.h" |
| 17 #include "vpx_mem/vpx_mem.h" | 17 #include "vpx_mem/vpx_mem.h" |
| 18 #include "vpx_ports/mem.h" | 18 #include "vpx_ports/mem.h" |
| 19 | 19 |
| 20 #include "vp9/common/vp9_idct.h" | 20 #include "vp9/common/vp9_idct.h" |
| 21 #include "vp9/common/vp9_reconinter.h" | 21 #include "vp9/common/vp9_reconinter.h" |
| 22 #include "vp9/common/vp9_reconintra.h" | 22 #include "vp9/common/vp9_reconintra.h" |
| 23 #include "vp9/common/vp9_scan.h" | 23 #include "vp9/common/vp9_scan.h" |
| 24 #include "vp9/common/vp9_systemdependent.h" | |
| 25 | 24 |
| 26 #include "vp9/encoder/vp9_encodemb.h" | 25 #include "vp9/encoder/vp9_encodemb.h" |
| 27 #include "vp9/encoder/vp9_rd.h" | 26 #include "vp9/encoder/vp9_rd.h" |
| 28 #include "vp9/encoder/vp9_tokenize.h" | 27 #include "vp9/encoder/vp9_tokenize.h" |
| 29 | 28 |
| 30 struct optimize_ctx { | 29 struct optimize_ctx { |
| 31 ENTROPY_CONTEXT ta[MAX_MB_PLANE][16]; | 30 ENTROPY_CONTEXT ta[MAX_MB_PLANE][16]; |
| 32 ENTROPY_CONTEXT tl[MAX_MB_PLANE][16]; | 31 ENTROPY_CONTEXT tl[MAX_MB_PLANE][16]; |
| 33 }; | 32 }; |
| 34 | 33 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 51 pd->dst.buf, pd->dst.stride); | 50 pd->dst.buf, pd->dst.stride); |
| 52 } | 51 } |
| 53 | 52 |
| 54 #define RDTRUNC(RM, DM, R, D) ((128 + (R) * (RM)) & 0xFF) | 53 #define RDTRUNC(RM, DM, R, D) ((128 + (R) * (RM)) & 0xFF) |
| 55 | 54 |
| 56 typedef struct vp9_token_state { | 55 typedef struct vp9_token_state { |
| 57 int rate; | 56 int rate; |
| 58 int error; | 57 int error; |
| 59 int next; | 58 int next; |
| 60 int16_t token; | 59 int16_t token; |
| 61 short qc; | 60 int16_t qc; |
| 62 } vp9_token_state; | 61 } vp9_token_state; |
| 63 | 62 |
| 64 // TODO(jimbankoski): experiment to find optimal RD numbers. | 63 // TODO(jimbankoski): experiment to find optimal RD numbers. |
| 65 static const int plane_rd_mult[PLANE_TYPES] = { 4, 2 }; | 64 static const int plane_rd_mult[PLANE_TYPES] = { 4, 2 }; |
| 66 | 65 |
| 67 #define UPDATE_RD_COST()\ | 66 #define UPDATE_RD_COST()\ |
| 68 {\ | 67 {\ |
| 69 rd_cost0 = RDCOST(rdmult, rddiv, rate0, error0);\ | 68 rd_cost0 = RDCOST(rdmult, rddiv, rate0, error0);\ |
| 70 rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);\ | 69 rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);\ |
| 71 if (rd_cost0 == rd_cost1) {\ | 70 if (rd_cost0 == rd_cost1) {\ |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 const int16_t *src_diff; | 426 const int16_t *src_diff; |
| 428 | 427 |
| 429 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j); | 428 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j); |
| 430 src_diff = &p->src_diff[4 * (j * diff_stride + i)]; | 429 src_diff = &p->src_diff[4 * (j * diff_stride + i)]; |
| 431 | 430 |
| 432 #if CONFIG_VP9_HIGHBITDEPTH | 431 #if CONFIG_VP9_HIGHBITDEPTH |
| 433 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { | 432 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { |
| 434 switch (tx_size) { | 433 switch (tx_size) { |
| 435 case TX_32X32: | 434 case TX_32X32: |
| 436 vpx_highbd_fdct32x32_1(src_diff, coeff, diff_stride); | 435 vpx_highbd_fdct32x32_1(src_diff, coeff, diff_stride); |
| 437 vp9_highbd_quantize_dc_32x32(coeff, x->skip_block, p->round, | 436 vpx_highbd_quantize_dc_32x32(coeff, x->skip_block, p->round, |
| 438 p->quant_fp[0], qcoeff, dqcoeff, | 437 p->quant_fp[0], qcoeff, dqcoeff, |
| 439 pd->dequant[0], eob); | 438 pd->dequant[0], eob); |
| 440 break; | 439 break; |
| 441 case TX_16X16: | 440 case TX_16X16: |
| 442 vpx_highbd_fdct16x16_1(src_diff, coeff, diff_stride); | 441 vpx_highbd_fdct16x16_1(src_diff, coeff, diff_stride); |
| 443 vp9_highbd_quantize_dc(coeff, 256, x->skip_block, p->round, | 442 vpx_highbd_quantize_dc(coeff, 256, x->skip_block, p->round, |
| 444 p->quant_fp[0], qcoeff, dqcoeff, | 443 p->quant_fp[0], qcoeff, dqcoeff, |
| 445 pd->dequant[0], eob); | 444 pd->dequant[0], eob); |
| 446 break; | 445 break; |
| 447 case TX_8X8: | 446 case TX_8X8: |
| 448 vpx_highbd_fdct8x8_1(src_diff, coeff, diff_stride); | 447 vpx_highbd_fdct8x8_1(src_diff, coeff, diff_stride); |
| 449 vp9_highbd_quantize_dc(coeff, 64, x->skip_block, p->round, | 448 vpx_highbd_quantize_dc(coeff, 64, x->skip_block, p->round, |
| 450 p->quant_fp[0], qcoeff, dqcoeff, | 449 p->quant_fp[0], qcoeff, dqcoeff, |
| 451 pd->dequant[0], eob); | 450 pd->dequant[0], eob); |
| 452 break; | 451 break; |
| 453 case TX_4X4: | 452 case TX_4X4: |
| 454 x->fwd_txm4x4(src_diff, coeff, diff_stride); | 453 x->fwd_txm4x4(src_diff, coeff, diff_stride); |
| 455 vp9_highbd_quantize_dc(coeff, 16, x->skip_block, p->round, | 454 vpx_highbd_quantize_dc(coeff, 16, x->skip_block, p->round, |
| 456 p->quant_fp[0], qcoeff, dqcoeff, | 455 p->quant_fp[0], qcoeff, dqcoeff, |
| 457 pd->dequant[0], eob); | 456 pd->dequant[0], eob); |
| 458 break; | 457 break; |
| 459 default: | 458 default: |
| 460 assert(0); | 459 assert(0); |
| 461 } | 460 } |
| 462 return; | 461 return; |
| 463 } | 462 } |
| 464 #endif // CONFIG_VP9_HIGHBITDEPTH | 463 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 465 | 464 |
| 466 switch (tx_size) { | 465 switch (tx_size) { |
| 467 case TX_32X32: | 466 case TX_32X32: |
| 468 vpx_fdct32x32_1(src_diff, coeff, diff_stride); | 467 vpx_fdct32x32_1(src_diff, coeff, diff_stride); |
| 469 vp9_quantize_dc_32x32(coeff, x->skip_block, p->round, | 468 vpx_quantize_dc_32x32(coeff, x->skip_block, p->round, |
| 470 p->quant_fp[0], qcoeff, dqcoeff, | 469 p->quant_fp[0], qcoeff, dqcoeff, |
| 471 pd->dequant[0], eob); | 470 pd->dequant[0], eob); |
| 472 break; | 471 break; |
| 473 case TX_16X16: | 472 case TX_16X16: |
| 474 vpx_fdct16x16_1(src_diff, coeff, diff_stride); | 473 vpx_fdct16x16_1(src_diff, coeff, diff_stride); |
| 475 vp9_quantize_dc(coeff, 256, x->skip_block, p->round, | 474 vpx_quantize_dc(coeff, 256, x->skip_block, p->round, |
| 476 p->quant_fp[0], qcoeff, dqcoeff, | 475 p->quant_fp[0], qcoeff, dqcoeff, |
| 477 pd->dequant[0], eob); | 476 pd->dequant[0], eob); |
| 478 break; | 477 break; |
| 479 case TX_8X8: | 478 case TX_8X8: |
| 480 vpx_fdct8x8_1(src_diff, coeff, diff_stride); | 479 vpx_fdct8x8_1(src_diff, coeff, diff_stride); |
| 481 vp9_quantize_dc(coeff, 64, x->skip_block, p->round, | 480 vpx_quantize_dc(coeff, 64, x->skip_block, p->round, |
| 482 p->quant_fp[0], qcoeff, dqcoeff, | 481 p->quant_fp[0], qcoeff, dqcoeff, |
| 483 pd->dequant[0], eob); | 482 pd->dequant[0], eob); |
| 484 break; | 483 break; |
| 485 case TX_4X4: | 484 case TX_4X4: |
| 486 x->fwd_txm4x4(src_diff, coeff, diff_stride); | 485 x->fwd_txm4x4(src_diff, coeff, diff_stride); |
| 487 vp9_quantize_dc(coeff, 16, x->skip_block, p->round, | 486 vpx_quantize_dc(coeff, 16, x->skip_block, p->round, |
| 488 p->quant_fp[0], qcoeff, dqcoeff, | 487 p->quant_fp[0], qcoeff, dqcoeff, |
| 489 pd->dequant[0], eob); | 488 pd->dequant[0], eob); |
| 490 break; | 489 break; |
| 491 default: | 490 default: |
| 492 assert(0); | 491 assert(0); |
| 493 break; | 492 break; |
| 494 } | 493 } |
| 495 } | 494 } |
| 496 | 495 |
| 497 void vp9_xform_quant(MACROBLOCK *x, int plane, int block, | 496 void vp9_xform_quant(MACROBLOCK *x, int plane, int block, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 508 int i, j; | 507 int i, j; |
| 509 const int16_t *src_diff; | 508 const int16_t *src_diff; |
| 510 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j); | 509 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j); |
| 511 src_diff = &p->src_diff[4 * (j * diff_stride + i)]; | 510 src_diff = &p->src_diff[4 * (j * diff_stride + i)]; |
| 512 | 511 |
| 513 #if CONFIG_VP9_HIGHBITDEPTH | 512 #if CONFIG_VP9_HIGHBITDEPTH |
| 514 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { | 513 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { |
| 515 switch (tx_size) { | 514 switch (tx_size) { |
| 516 case TX_32X32: | 515 case TX_32X32: |
| 517 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); | 516 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); |
| 518 vp9_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, | 517 vpx_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, |
| 519 p->round, p->quant, p->quant_shift, qcoeff, | 518 p->round, p->quant, p->quant_shift, qcoeff, |
| 520 dqcoeff, pd->dequant, eob, | 519 dqcoeff, pd->dequant, eob, |
| 521 scan_order->scan, scan_order->iscan); | 520 scan_order->scan, scan_order->iscan); |
| 522 break; | 521 break; |
| 523 case TX_16X16: | 522 case TX_16X16: |
| 524 vpx_highbd_fdct16x16(src_diff, coeff, diff_stride); | 523 vpx_highbd_fdct16x16(src_diff, coeff, diff_stride); |
| 525 vp9_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, | 524 vpx_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, |
| 526 p->quant, p->quant_shift, qcoeff, dqcoeff, | 525 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 527 pd->dequant, eob, | 526 pd->dequant, eob, |
| 528 scan_order->scan, scan_order->iscan); | 527 scan_order->scan, scan_order->iscan); |
| 529 break; | 528 break; |
| 530 case TX_8X8: | 529 case TX_8X8: |
| 531 vpx_highbd_fdct8x8(src_diff, coeff, diff_stride); | 530 vpx_highbd_fdct8x8(src_diff, coeff, diff_stride); |
| 532 vp9_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, | 531 vpx_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, |
| 533 p->quant, p->quant_shift, qcoeff, dqcoeff, | 532 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 534 pd->dequant, eob, | 533 pd->dequant, eob, |
| 535 scan_order->scan, scan_order->iscan); | 534 scan_order->scan, scan_order->iscan); |
| 536 break; | 535 break; |
| 537 case TX_4X4: | 536 case TX_4X4: |
| 538 x->fwd_txm4x4(src_diff, coeff, diff_stride); | 537 x->fwd_txm4x4(src_diff, coeff, diff_stride); |
| 539 vp9_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, | 538 vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, |
| 540 p->quant, p->quant_shift, qcoeff, dqcoeff, | 539 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 541 pd->dequant, eob, | 540 pd->dequant, eob, |
| 542 scan_order->scan, scan_order->iscan); | 541 scan_order->scan, scan_order->iscan); |
| 543 break; | 542 break; |
| 544 default: | 543 default: |
| 545 assert(0); | 544 assert(0); |
| 546 } | 545 } |
| 547 return; | 546 return; |
| 548 } | 547 } |
| 549 #endif // CONFIG_VP9_HIGHBITDEPTH | 548 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 550 | 549 |
| 551 switch (tx_size) { | 550 switch (tx_size) { |
| 552 case TX_32X32: | 551 case TX_32X32: |
| 553 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); | 552 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); |
| 554 vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round, | 553 vpx_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round, |
| 555 p->quant, p->quant_shift, qcoeff, dqcoeff, | 554 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 556 pd->dequant, eob, scan_order->scan, | 555 pd->dequant, eob, scan_order->scan, |
| 557 scan_order->iscan); | 556 scan_order->iscan); |
| 558 break; | 557 break; |
| 559 case TX_16X16: | 558 case TX_16X16: |
| 560 vpx_fdct16x16(src_diff, coeff, diff_stride); | 559 vpx_fdct16x16(src_diff, coeff, diff_stride); |
| 561 vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, | 560 vpx_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, |
| 562 p->quant, p->quant_shift, qcoeff, dqcoeff, | 561 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 563 pd->dequant, eob, | 562 pd->dequant, eob, |
| 564 scan_order->scan, scan_order->iscan); | 563 scan_order->scan, scan_order->iscan); |
| 565 break; | 564 break; |
| 566 case TX_8X8: | 565 case TX_8X8: |
| 567 vpx_fdct8x8(src_diff, coeff, diff_stride); | 566 vpx_fdct8x8(src_diff, coeff, diff_stride); |
| 568 vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, | 567 vpx_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, |
| 569 p->quant, p->quant_shift, qcoeff, dqcoeff, | 568 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 570 pd->dequant, eob, | 569 pd->dequant, eob, |
| 571 scan_order->scan, scan_order->iscan); | 570 scan_order->scan, scan_order->iscan); |
| 572 break; | 571 break; |
| 573 case TX_4X4: | 572 case TX_4X4: |
| 574 x->fwd_txm4x4(src_diff, coeff, diff_stride); | 573 x->fwd_txm4x4(src_diff, coeff, diff_stride); |
| 575 vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, | 574 vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, |
| 576 p->quant, p->quant_shift, qcoeff, dqcoeff, | 575 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 577 pd->dequant, eob, | 576 pd->dequant, eob, |
| 578 scan_order->scan, scan_order->iscan); | 577 scan_order->scan, scan_order->iscan); |
| 579 break; | 578 break; |
| 580 default: | 579 default: |
| 581 assert(0); | 580 assert(0); |
| 582 break; | 581 break; |
| 583 } | 582 } |
| 584 } | 583 } |
| 585 | 584 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 dst, dst_stride, i, j, plane); | 807 dst, dst_stride, i, j, plane); |
| 809 | 808 |
| 810 #if CONFIG_VP9_HIGHBITDEPTH | 809 #if CONFIG_VP9_HIGHBITDEPTH |
| 811 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { | 810 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { |
| 812 switch (tx_size) { | 811 switch (tx_size) { |
| 813 case TX_32X32: | 812 case TX_32X32: |
| 814 if (!x->skip_recode) { | 813 if (!x->skip_recode) { |
| 815 vpx_highbd_subtract_block(32, 32, src_diff, diff_stride, | 814 vpx_highbd_subtract_block(32, 32, src_diff, diff_stride, |
| 816 src, src_stride, dst, dst_stride, xd->bd); | 815 src, src_stride, dst, dst_stride, xd->bd); |
| 817 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); | 816 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); |
| 818 vp9_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, | 817 vpx_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, |
| 819 p->round, p->quant, p->quant_shift, | 818 p->round, p->quant, p->quant_shift, |
| 820 qcoeff, dqcoeff, pd->dequant, eob, | 819 qcoeff, dqcoeff, pd->dequant, eob, |
| 821 scan_order->scan, scan_order->iscan); | 820 scan_order->scan, scan_order->iscan); |
| 822 } | 821 } |
| 823 if (!x->skip_encode && *eob) { | 822 if (!x->skip_encode && *eob) { |
| 824 vp9_highbd_idct32x32_add(dqcoeff, dst, dst_stride, *eob, xd->bd); | 823 vp9_highbd_idct32x32_add(dqcoeff, dst, dst_stride, *eob, xd->bd); |
| 825 } | 824 } |
| 826 break; | 825 break; |
| 827 case TX_16X16: | 826 case TX_16X16: |
| 828 if (!x->skip_recode) { | 827 if (!x->skip_recode) { |
| 829 vpx_highbd_subtract_block(16, 16, src_diff, diff_stride, | 828 vpx_highbd_subtract_block(16, 16, src_diff, diff_stride, |
| 830 src, src_stride, dst, dst_stride, xd->bd); | 829 src, src_stride, dst, dst_stride, xd->bd); |
| 831 if (tx_type == DCT_DCT) | 830 if (tx_type == DCT_DCT) |
| 832 vpx_highbd_fdct16x16(src_diff, coeff, diff_stride); | 831 vpx_highbd_fdct16x16(src_diff, coeff, diff_stride); |
| 833 else | 832 else |
| 834 vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type); | 833 vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type); |
| 835 vp9_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, | 834 vpx_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, |
| 836 p->quant, p->quant_shift, qcoeff, dqcoeff, | 835 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 837 pd->dequant, eob, | 836 pd->dequant, eob, |
| 838 scan_order->scan, scan_order->iscan); | 837 scan_order->scan, scan_order->iscan); |
| 839 } | 838 } |
| 840 if (!x->skip_encode && *eob) { | 839 if (!x->skip_encode && *eob) { |
| 841 vp9_highbd_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, | 840 vp9_highbd_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, |
| 842 *eob, xd->bd); | 841 *eob, xd->bd); |
| 843 } | 842 } |
| 844 break; | 843 break; |
| 845 case TX_8X8: | 844 case TX_8X8: |
| 846 if (!x->skip_recode) { | 845 if (!x->skip_recode) { |
| 847 vpx_highbd_subtract_block(8, 8, src_diff, diff_stride, | 846 vpx_highbd_subtract_block(8, 8, src_diff, diff_stride, |
| 848 src, src_stride, dst, dst_stride, xd->bd); | 847 src, src_stride, dst, dst_stride, xd->bd); |
| 849 if (tx_type == DCT_DCT) | 848 if (tx_type == DCT_DCT) |
| 850 vpx_highbd_fdct8x8(src_diff, coeff, diff_stride); | 849 vpx_highbd_fdct8x8(src_diff, coeff, diff_stride); |
| 851 else | 850 else |
| 852 vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type); | 851 vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type); |
| 853 vp9_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, | 852 vpx_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, |
| 854 p->quant, p->quant_shift, qcoeff, dqcoeff, | 853 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 855 pd->dequant, eob, | 854 pd->dequant, eob, |
| 856 scan_order->scan, scan_order->iscan); | 855 scan_order->scan, scan_order->iscan); |
| 857 } | 856 } |
| 858 if (!x->skip_encode && *eob) { | 857 if (!x->skip_encode && *eob) { |
| 859 vp9_highbd_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob, | 858 vp9_highbd_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob, |
| 860 xd->bd); | 859 xd->bd); |
| 861 } | 860 } |
| 862 break; | 861 break; |
| 863 case TX_4X4: | 862 case TX_4X4: |
| 864 if (!x->skip_recode) { | 863 if (!x->skip_recode) { |
| 865 vpx_highbd_subtract_block(4, 4, src_diff, diff_stride, | 864 vpx_highbd_subtract_block(4, 4, src_diff, diff_stride, |
| 866 src, src_stride, dst, dst_stride, xd->bd); | 865 src, src_stride, dst, dst_stride, xd->bd); |
| 867 if (tx_type != DCT_DCT) | 866 if (tx_type != DCT_DCT) |
| 868 vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type); | 867 vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type); |
| 869 else | 868 else |
| 870 x->fwd_txm4x4(src_diff, coeff, diff_stride); | 869 x->fwd_txm4x4(src_diff, coeff, diff_stride); |
| 871 vp9_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, | 870 vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, |
| 872 p->quant, p->quant_shift, qcoeff, dqcoeff, | 871 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 873 pd->dequant, eob, | 872 pd->dequant, eob, |
| 874 scan_order->scan, scan_order->iscan); | 873 scan_order->scan, scan_order->iscan); |
| 875 } | 874 } |
| 876 | 875 |
| 877 if (!x->skip_encode && *eob) { | 876 if (!x->skip_encode && *eob) { |
| 878 if (tx_type == DCT_DCT) { | 877 if (tx_type == DCT_DCT) { |
| 879 // this is like vp9_short_idct4x4 but has a special case around | 878 // this is like vp9_short_idct4x4 but has a special case around |
| 880 // eob<=1 which is significant (not just an optimization) for the | 879 // eob<=1 which is significant (not just an optimization) for the |
| 881 // lossless case. | 880 // lossless case. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 894 return; | 893 return; |
| 895 } | 894 } |
| 896 #endif // CONFIG_VP9_HIGHBITDEPTH | 895 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 897 | 896 |
| 898 switch (tx_size) { | 897 switch (tx_size) { |
| 899 case TX_32X32: | 898 case TX_32X32: |
| 900 if (!x->skip_recode) { | 899 if (!x->skip_recode) { |
| 901 vpx_subtract_block(32, 32, src_diff, diff_stride, | 900 vpx_subtract_block(32, 32, src_diff, diff_stride, |
| 902 src, src_stride, dst, dst_stride); | 901 src, src_stride, dst, dst_stride); |
| 903 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); | 902 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); |
| 904 vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round, | 903 vpx_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round, |
| 905 p->quant, p->quant_shift, qcoeff, dqcoeff, | 904 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 906 pd->dequant, eob, scan_order->scan, | 905 pd->dequant, eob, scan_order->scan, |
| 907 scan_order->iscan); | 906 scan_order->iscan); |
| 908 } | 907 } |
| 909 if (!x->skip_encode && *eob) | 908 if (!x->skip_encode && *eob) |
| 910 vp9_idct32x32_add(dqcoeff, dst, dst_stride, *eob); | 909 vp9_idct32x32_add(dqcoeff, dst, dst_stride, *eob); |
| 911 break; | 910 break; |
| 912 case TX_16X16: | 911 case TX_16X16: |
| 913 if (!x->skip_recode) { | 912 if (!x->skip_recode) { |
| 914 vpx_subtract_block(16, 16, src_diff, diff_stride, | 913 vpx_subtract_block(16, 16, src_diff, diff_stride, |
| 915 src, src_stride, dst, dst_stride); | 914 src, src_stride, dst, dst_stride); |
| 916 vp9_fht16x16(src_diff, coeff, diff_stride, tx_type); | 915 vp9_fht16x16(src_diff, coeff, diff_stride, tx_type); |
| 917 vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, | 916 vpx_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, |
| 918 p->quant, p->quant_shift, qcoeff, dqcoeff, | 917 p->quant, p->quant_shift, qcoeff, dqcoeff, |
| 919 pd->dequant, eob, scan_order->scan, | 918 pd->dequant, eob, scan_order->scan, |
| 920 scan_order->iscan); | 919 scan_order->iscan); |
| 921 } | 920 } |
| 922 if (!x->skip_encode && *eob) | 921 if (!x->skip_encode && *eob) |
| 923 vp9_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, *eob); | 922 vp9_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, *eob); |
| 924 break; | 923 break; |
| 925 case TX_8X8: | 924 case TX_8X8: |
| 926 if (!x->skip_recode) { | 925 if (!x->skip_recode) { |
| 927 vpx_subtract_block(8, 8, src_diff, diff_stride, | 926 vpx_subtract_block(8, 8, src_diff, diff_stride, |
| 928 src, src_stride, dst, dst_stride); | 927 src, src_stride, dst, dst_stride); |
| 929 vp9_fht8x8(src_diff, coeff, diff_stride, tx_type); | 928 vp9_fht8x8(src_diff, coeff, diff_stride, tx_type); |
| 930 vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant, | 929 vpx_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant, |
| 931 p->quant_shift, qcoeff, dqcoeff, | 930 p->quant_shift, qcoeff, dqcoeff, |
| 932 pd->dequant, eob, scan_order->scan, | 931 pd->dequant, eob, scan_order->scan, |
| 933 scan_order->iscan); | 932 scan_order->iscan); |
| 934 } | 933 } |
| 935 if (!x->skip_encode && *eob) | 934 if (!x->skip_encode && *eob) |
| 936 vp9_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob); | 935 vp9_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob); |
| 937 break; | 936 break; |
| 938 case TX_4X4: | 937 case TX_4X4: |
| 939 if (!x->skip_recode) { | 938 if (!x->skip_recode) { |
| 940 vpx_subtract_block(4, 4, src_diff, diff_stride, | 939 vpx_subtract_block(4, 4, src_diff, diff_stride, |
| 941 src, src_stride, dst, dst_stride); | 940 src, src_stride, dst, dst_stride); |
| 942 if (tx_type != DCT_DCT) | 941 if (tx_type != DCT_DCT) |
| 943 vp9_fht4x4(src_diff, coeff, diff_stride, tx_type); | 942 vp9_fht4x4(src_diff, coeff, diff_stride, tx_type); |
| 944 else | 943 else |
| 945 x->fwd_txm4x4(src_diff, coeff, diff_stride); | 944 x->fwd_txm4x4(src_diff, coeff, diff_stride); |
| 946 vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant, | 945 vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant, |
| 947 p->quant_shift, qcoeff, dqcoeff, | 946 p->quant_shift, qcoeff, dqcoeff, |
| 948 pd->dequant, eob, scan_order->scan, | 947 pd->dequant, eob, scan_order->scan, |
| 949 scan_order->iscan); | 948 scan_order->iscan); |
| 950 } | 949 } |
| 951 | 950 |
| 952 if (!x->skip_encode && *eob) { | 951 if (!x->skip_encode && *eob) { |
| 953 if (tx_type == DCT_DCT) | 952 if (tx_type == DCT_DCT) |
| 954 // this is like vp9_short_idct4x4 but has a special case around eob<=1 | 953 // this is like vp9_short_idct4x4 but has a special case around eob<=1 |
| 955 // which is significant (not just an optimization) for the lossless | 954 // which is significant (not just an optimization) for the lossless |
| 956 // case. | 955 // case. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 967 *(args->skip) = 0; | 966 *(args->skip) = 0; |
| 968 } | 967 } |
| 969 | 968 |
| 970 void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { | 969 void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { |
| 971 const MACROBLOCKD *const xd = &x->e_mbd; | 970 const MACROBLOCKD *const xd = &x->e_mbd; |
| 972 struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip}; | 971 struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip}; |
| 973 | 972 |
| 974 vp9_foreach_transformed_block_in_plane(xd, bsize, plane, | 973 vp9_foreach_transformed_block_in_plane(xd, bsize, plane, |
| 975 vp9_encode_block_intra, &arg); | 974 vp9_encode_block_intra, &arg); |
| 976 } | 975 } |
| OLD | NEW |