| @@ -745,8 +745,8 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, · 744 unmodified lines |
| 745 | 745 | MODE_INFO *const mi = xd->mi[0]; |
| 746 | 746 | int64_t rd1, rd2, rd; |
| 747 | 747 | int rate; |
| 748 | | − int64_t dist; |
| 749 | | − int64_t sse; |
| 748 | + int64_t dist = INT64_MAX; |
| 749 | + int64_t sse = INT64_MAX; |
| 750 | 750 | const int coeff_ctx = |
| 751 | 751 | combine_entropy_contexts(args->t_left[blk_row], args->t_above[blk_col]); |
| 752 | 752 | struct buf_2d *recon = args->this_recon; |
| @@ -799,6 +799,13 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, · 46 unmodified lines |
| 799 | 799 | if (max_txsize_lookup[plane_bsize] == tx_size) |
| 800 | 800 | skip_txfm_flag = x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))]; |
| 801 | 801 | |
| 802 | + // This reduces the risk of bad perceptual quality due to bad prediction. |
| 803 | + // We always force the encoder to perform transform and quantization. |
| 804 | + if (!args->cpi->sf.allow_skip_txfm_ac_dc && |
| 805 | + skip_txfm_flag == SKIP_TXFM_AC_DC) { |
| 806 | + skip_txfm_flag = SKIP_TXFM_NONE; |
| 807 | + } |
| 808 | + |
| 802 | 809 | if (skip_txfm_flag == SKIP_TXFM_NONE || |
| 803 | 810 | (recon && skip_txfm_flag == SKIP_TXFM_AC_ONLY)) { |
| 804 | 811 | // full forward transform and quantization |
| @@ -827,17 +834,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, · 22 unmodified lines |
| 827 | 834 | dist = VPXMAX(0, sse - dc_correct); |
| 828 | 835 | } |
| 829 | 836 | } else { |
| 830 | | − // SKIP_TXFM_AC_DC |
| 831 | | − // skip forward transform. Because this is handled here, the quantization |
| 832 | | − // does not need to do it. |
| 833 | | − x->plane[plane].eobs[block] = 0; |
| 834 | | − sse = x->bsse[(plane << 2) + (block >> (tx_size << 1))] << 4; |
| 835 | | − dist = sse; |
| 836 | | − if (recon) { |
| 837 | | − uint8_t *rec_ptr = &recon->buf[4 * (blk_row * recon->stride + blk_col)]; |
| 838 | | − copy_block_visible(xd, pd, dst, dst_stride, rec_ptr, recon->stride, |
| 839 | | − blk_row, blk_col, plane_bsize, tx_bsize); |
| 840 | | − } |
| 837 | + assert(0 && "allow_skip_txfm_ac_dc does not allow SKIP_TXFM_AC_DC."); |
| 841 | 838 | } |
| 842 | 839 | } |
| 843 | 840 | |