summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_blockd.h22
-rw-r--r--vp9/decoder/vp9_decodeframe.c55
-rw-r--r--vp9/encoder/vp9_encodeframe.c30
-rw-r--r--vp9/encoder/vp9_encodemb.c67
-rw-r--r--vp9/encoder/vp9_encodemb.h8
-rw-r--r--vp9/encoder/vp9_encoder.c9
-rw-r--r--vp9/encoder/vp9_firstpass.c11
-rw-r--r--vp9/encoder/vp9_pickmode.c57
-rw-r--r--vp9/encoder/vp9_rdopt.c6
9 files changed, 195 insertions, 70 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index 504342fdf..2ddc0f121 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -286,6 +286,28 @@ void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
int aoff, int loff);
+#if CONFIG_MISMATCH_DEBUG
+#define TX_UNIT_SIZE_LOG2 2
+static INLINE void mi_to_pixel_loc(int *pixel_c, int *pixel_r, int mi_col,
+ int mi_row, int tx_blk_col, int tx_blk_row,
+ int subsampling_x, int subsampling_y) {
+ *pixel_c = ((mi_col << MI_SIZE_LOG2) >> subsampling_x) +
+ (tx_blk_col << TX_UNIT_SIZE_LOG2);
+ *pixel_r = ((mi_row << MI_SIZE_LOG2) >> subsampling_y) +
+ (tx_blk_row << TX_UNIT_SIZE_LOG2);
+}
+
+static INLINE int get_block_width(BLOCK_SIZE bsize) {
+ const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
+ return 4 * num_4x4_w;
+}
+
+static INLINE int get_block_height(BLOCK_SIZE bsize) {
+ const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
+ return 4 * num_4x4_h;
+}
+#endif
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c
index 22ae0fac9..7d66cb2b2 100644
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -23,9 +23,9 @@
#include "vpx_ports/mem_ops.h"
#include "vpx_scale/vpx_scale.h"
#include "vpx_util/vpx_thread.h"
-#if CONFIG_BITSTREAM_DEBUG
+#if CONFIG_BITSTREAM_DEBUG || CONFIG_MISMATCH_DEBUG
#include "vpx_util/vpx_debug_util.h"
-#endif // CONFIG_BITSTREAM_DEBUG
+#endif // CONFIG_BITSTREAM_DEBUG || CONFIG_MISMATCH_DEBUG
#include "vp9/common/vp9_alloccommon.h"
#include "vp9/common/vp9_common.h"
@@ -389,19 +389,32 @@ static void predict_and_reconstruct_intra_block_row_mt(TileWorkerData *twd,
}
static int reconstruct_inter_block(TileWorkerData *twd, MODE_INFO *const mi,
- int plane, int row, int col,
- TX_SIZE tx_size) {
+ int plane, int row, int col, TX_SIZE tx_size,
+ int mi_row, int mi_col) {
MACROBLOCKD *const xd = &twd->xd;
struct macroblockd_plane *const pd = &xd->plane[plane];
const scan_order *sc = &vp9_default_scan_orders[tx_size];
const int eob = vp9_decode_block_tokens(twd, plane, sc, col, row, tx_size,
mi->segment_id);
+ uint8_t *dst = &pd->dst.buf[4 * row * pd->dst.stride + 4 * col];
if (eob > 0) {
- inverse_transform_block_inter(
- xd, plane, tx_size, &pd->dst.buf[4 * row * pd->dst.stride + 4 * col],
- pd->dst.stride, eob);
+ inverse_transform_block_inter(xd, plane, tx_size, dst, pd->dst.stride, eob);
}
+#if CONFIG_MISMATCH_DEBUG
+ {
+ int pixel_c, pixel_r;
+ int blk_w = 1 << (tx_size + TX_UNIT_SIZE_LOG2);
+ int blk_h = 1 << (tx_size + TX_UNIT_SIZE_LOG2);
+ mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, col, row,
+ pd->subsampling_x, pd->subsampling_y);
+ mismatch_check_block_tx(dst, pd->dst.stride, plane, pixel_c, pixel_r, blk_w,
+ blk_h, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
+ }
+#else
+ (void)mi_row;
+ (void)mi_col;
+#endif
return eob;
}
@@ -952,6 +965,24 @@ static void decode_block(TileWorkerData *twd, VP9Decoder *const pbi, int mi_row,
} else {
// Prediction
dec_build_inter_predictors_sb(pbi, xd, mi_row, mi_col);
+#if CONFIG_MISMATCH_DEBUG
+ {
+ int plane;
+ for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+ const struct macroblockd_plane *pd = &xd->plane[plane];
+ int pixel_c, pixel_r;
+ const BLOCK_SIZE plane_bsize =
+ get_plane_block_size(VPXMAX(bsize, BLOCK_8X8), &xd->plane[plane]);
+ const int bw = get_block_width(plane_bsize);
+ const int bh = get_block_height(plane_bsize);
+ mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, 0, 0,
+ pd->subsampling_x, pd->subsampling_y);
+ mismatch_check_block_pre(pd->dst.buf, pd->dst.stride, plane, pixel_c,
+ pixel_r, bw, bh,
+ xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
+ }
+ }
+#endif
// Reconstruction
if (!mi->skip) {
@@ -980,8 +1011,8 @@ static void decode_block(TileWorkerData *twd, VP9Decoder *const pbi, int mi_row,
for (row = 0; row < max_blocks_high; row += step)
for (col = 0; col < max_blocks_wide; col += step)
- eobtotal +=
- reconstruct_inter_block(twd, mi, plane, row, col, tx_size);
+ eobtotal += reconstruct_inter_block(twd, mi, plane, row, col,
+ tx_size, mi_row, mi_col);
}
if (!less8x8 && eobtotal == 0) mi->skip = 1; // skip loopfilter
@@ -2923,10 +2954,12 @@ void vp9_decode_frame(VP9Decoder *pbi, const uint8_t *data,
const int tile_rows = 1 << cm->log2_tile_rows;
const int tile_cols = 1 << cm->log2_tile_cols;
YV12_BUFFER_CONFIG *const new_fb = get_frame_new_buffer(cm);
-#if CONFIG_BITSTREAM_DEBUG
+#if CONFIG_BITSTREAM_DEBUG || CONFIG_MISMATCH_DEBUG
bitstream_queue_set_frame_read(cm->current_video_frame * 2 + cm->show_frame);
#endif
-
+#if CONFIG_MISMATCH_DEBUG
+ mismatch_move_frame_idx_r();
+#endif
xd->cur_buf = new_fb;
if (!first_partition_size) {
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 28a900514..e510ee1fd 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -22,6 +22,10 @@
#include "vpx_ports/vpx_timer.h"
#include "vpx_ports/system_state.h"
+#if CONFIG_MISMATCH_DEBUG
+#include "vpx_util/vpx_debug_util.h"
+#endif // CONFIG_MISMATCH_DEBUG
+
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_entropy.h"
#include "vp9/common/vp9_entropymode.h"
@@ -6105,6 +6109,10 @@ void vp9_encode_frame(VP9_COMP *cpi) {
restore_encode_params(cpi);
#endif
+#if CONFIG_MISMATCH_DEBUG
+ mismatch_reset_frame(MAX_MB_PLANE);
+#endif
+
// In the longer term the encoder should be generalized to match the
// decoder such that we allow compound where one of the 3 buffers has a
// different sign bias and that buffer is then the fixed ref. However, this
@@ -6348,7 +6356,27 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
vp9_build_inter_predictors_sbuv(xd, mi_row, mi_col,
VPXMAX(bsize, BLOCK_8X8));
- vp9_encode_sb(x, VPXMAX(bsize, BLOCK_8X8));
+#if CONFIG_MISMATCH_DEBUG
+ if (output_enabled) {
+ int plane;
+ for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+ const struct macroblockd_plane *pd = &xd->plane[plane];
+ int pixel_c, pixel_r;
+ const BLOCK_SIZE plane_bsize =
+ get_plane_block_size(VPXMAX(bsize, BLOCK_8X8), &xd->plane[plane]);
+ const int bw = get_block_width(plane_bsize);
+ const int bh = get_block_height(plane_bsize);
+ mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, 0, 0,
+ pd->subsampling_x, pd->subsampling_y);
+
+ mismatch_record_block_pre(pd->dst.buf, pd->dst.stride, plane, pixel_c,
+ pixel_r, bw, bh,
+ xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
+ }
+ }
+#endif
+
+ vp9_encode_sb(x, VPXMAX(bsize, BLOCK_8X8), mi_row, mi_col, output_enabled);
vp9_tokenize_sb(cpi, td, t, !output_enabled, seg_skip,
VPXMAX(bsize, BLOCK_8X8));
}
diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c
index 83cb37c2d..7630a8110 100644
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -16,6 +16,10 @@
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
+#if CONFIG_MISMATCH_DEBUG
+#include "vpx_util/vpx_debug_util.h"
+#endif
+
#include "vp9/common/vp9_idct.h"
#include "vp9/common/vp9_reconinter.h"
#include "vp9/common/vp9_reconintra.h"
@@ -579,6 +583,11 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block, int row, int col,
static void encode_block(int plane, int block, int row, int col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) {
struct encode_b_args *const args = arg;
+#if CONFIG_MISMATCH_DEBUG
+ int mi_row = args->mi_row;
+ int mi_col = args->mi_col;
+ int output_enabled = args->output_enabled;
+#endif
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
struct macroblock_plane *const p = &x->plane[plane];
@@ -595,7 +604,11 @@ static void encode_block(int plane, int block, int row, int col,
if (x->zcoeff_blk[tx_size][block] && plane == 0) {
p->eobs[block] = 0;
*a = *l = 0;
+#if CONFIG_MISMATCH_DEBUG
+ goto encode_block_end;
+#else
return;
+#endif
}
if (!x->skip_recode) {
@@ -605,7 +618,11 @@ static void encode_block(int plane, int block, int row, int col,
// skip forward transform
p->eobs[block] = 0;
*a = *l = 0;
+#if CONFIG_MISMATCH_DEBUG
+ goto encode_block_end;
+#else
return;
+#endif
} else {
vp9_xform_quant_fp(x, plane, block, row, col, plane_bsize, tx_size);
}
@@ -622,7 +639,11 @@ static void encode_block(int plane, int block, int row, int col,
// skip forward transform
p->eobs[block] = 0;
*a = *l = 0;
+#if CONFIG_MISMATCH_DEBUG
+ goto encode_block_end;
+#else
return;
+#endif
}
} else {
vp9_xform_quant(x, plane, block, row, col, plane_bsize, tx_size);
@@ -639,7 +660,13 @@ static void encode_block(int plane, int block, int row, int col,
if (p->eobs[block]) *(args->skip) = 0;
- if (x->skip_encode || p->eobs[block] == 0) return;
+ if (x->skip_encode || p->eobs[block] == 0) {
+#if CONFIG_MISMATCH_DEBUG
+ goto encode_block_end;
+#else
+ return;
+#endif
+ }
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
uint16_t *const dst16 = CONVERT_TO_SHORTPTR(dst);
@@ -665,7 +692,11 @@ static void encode_block(int plane, int block, int row, int col,
xd->bd);
break;
}
+#if CONFIG_MISMATCH_DEBUG
+ goto encode_block_end;
+#else
return;
+#endif
}
#endif // CONFIG_VP9_HIGHBITDEPTH
@@ -687,6 +718,19 @@ static void encode_block(int plane, int block, int row, int col,
x->inv_txfm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
break;
}
+#if CONFIG_MISMATCH_DEBUG
+encode_block_end:
+ if (output_enabled) {
+ int pixel_c, pixel_r;
+ int blk_w = 1 << (tx_size + TX_UNIT_SIZE_LOG2);
+ int blk_h = 1 << (tx_size + TX_UNIT_SIZE_LOG2);
+ mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, col, row,
+ pd->subsampling_x, pd->subsampling_y);
+ mismatch_record_block_tx(dst, pd->dst.stride, plane, pixel_c, pixel_r,
+ blk_w, blk_h,
+ xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
+ }
+#endif
}
static void encode_block_pass1(int plane, int block, int row, int col,
@@ -720,12 +764,21 @@ void vp9_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize) {
encode_block_pass1, x);
}
-void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
+void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, int mi_col,
+ int output_enabled) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
MODE_INFO *mi = xd->mi[0];
- struct encode_b_args arg = { x, 1, NULL, NULL, &mi->skip };
int plane;
+#if CONFIG_MISMATCH_DEBUG
+ struct encode_b_args arg = { x, 1, NULL, NULL,
+ &mi->skip, mi_row, mi_col, output_enabled };
+#else
+ struct encode_b_args arg = { x, 1, NULL, NULL, &mi->skip };
+ (void)mi_row;
+ (void)mi_col;
+ (void)output_enabled;
+#endif
mi->skip = 1;
@@ -986,8 +1039,16 @@ void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane,
int enable_optimize_b) {
const MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
+#if CONFIG_MISMATCH_DEBUG
+ // TODO(angiebird): make mismatch_debug support intra mode
+ struct encode_b_args arg = {
+ x, enable_optimize_b, ctx.ta[plane], ctx.tl[plane], &xd->mi[0]->skip, 0, 0,
+ 0
+ };
+#else
struct encode_b_args arg = { x, enable_optimize_b, ctx.ta[plane],
ctx.tl[plane], &xd->mi[0]->skip };
+#endif
if (enable_optimize_b && x->optimize &&
(!x->skip_recode || !x->skip_optimize)) {
diff --git a/vp9/encoder/vp9_encodemb.h b/vp9/encoder/vp9_encodemb.h
index fa41f70ef..1975ee73a 100644
--- a/vp9/encoder/vp9_encodemb.h
+++ b/vp9/encoder/vp9_encodemb.h
@@ -24,10 +24,16 @@ struct encode_b_args {
ENTROPY_CONTEXT *ta;
ENTROPY_CONTEXT *tl;
int8_t *skip;
+#if CONFIG_MISMATCH_DEBUG
+ int mi_row;
+ int mi_col;
+ int output_enabled;
+#endif
};
int vp9_optimize_b(MACROBLOCK *mb, int plane, int block, TX_SIZE tx_size,
int ctx);
-void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
+void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, int mi_col,
+ int output_enabled);
void vp9_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize);
void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block, int row, int col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index a5b89ee96..fde91fadc 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -26,9 +26,9 @@
#include "vpx_ports/mem.h"
#include "vpx_ports/system_state.h"
#include "vpx_ports/vpx_timer.h"
-#if CONFIG_BITSTREAM_DEBUG
+#if CONFIG_BITSTREAM_DEBUG || CONFIG_MISMATCH_DEBUG
#include "vpx_util/vpx_debug_util.h"
-#endif // CONFIG_BITSTREAM_DEBUG
+#endif // CONFIG_BITSTREAM_DEBUG || CONFIG_MISMATCH_DEBUG
#include "vp9/common/vp9_alloccommon.h"
#include "vp9/common/vp9_filter.h"
@@ -5255,6 +5255,9 @@ static void Pass0Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest,
static void Pass2Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest,
unsigned int *frame_flags) {
cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
+#if CONFIG_MISMATCH_DEBUG
+ mismatch_move_frame_idx_w();
+#endif
encode_frame_to_data_rate(cpi, size, dest, frame_flags);
vp9_twopass_postencode_update(cpi);
@@ -7374,6 +7377,8 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
assert(cpi->oxcf.max_threads == 0 &&
"bitstream debug tool does not support multithreading");
bitstream_queue_record_write();
+#endif
+#if CONFIG_BITSTREAM_DEBUG || CONFIG_MISMATCH_DEBUG
bitstream_queue_set_frame_write(cm->current_video_frame * 2 + cm->show_frame);
#endif
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 726724ec5..3c76858d2 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -45,7 +45,7 @@
#define FIRST_PASS_Q 10.0
#define NORMAL_BOOST 100
-#define MIN_ARF_GF_BOOST 240
+#define MIN_ARF_GF_BOOST 250
#define MIN_DECAY_FACTOR 0.01
#define NEW_MV_MODE_PENALTY 32
#define DARK_THRESH 64
@@ -2525,6 +2525,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
(active_max_gf_interval >= (rc->frames_to_key - rc->min_gf_interval)))
active_max_gf_interval = rc->frames_to_key / 2;
}
+ active_max_gf_interval =
+ VPXMAX(active_max_gf_interval, active_min_gf_interval);
if (cpi->multi_layer_arf) {
int layers = 0;
@@ -2647,6 +2649,13 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
rc->gfu_boost = VPXMIN((int)rc->gfu_boost, i * 200);
#endif
+ // Cap the ARF boost when perceptual quality AQ mode is enabled. This is
+ // designed to improve the perceptual quality of high value content and to
+ // make consistent quality across consecutive frames. It will hurt objective
+ // quality.
+ if (oxcf->aq_mode == PERCEPTUAL_AQ)
+ rc->gfu_boost = VPXMIN(rc->gfu_boost, MIN_ARF_GF_BOOST);
+
rc->baseline_gf_interval = i - rc->source_alt_ref_pending;
// Reset the file position.
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index b483489d3..a431e4ca6 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -376,50 +376,8 @@ static TX_SIZE calculate_tx_size(VP9_COMP *const cpi, BLOCK_SIZE bsize,
tx_size = VPXMIN(max_txsize_lookup[bsize],
tx_mode_to_biggest_tx_size[cpi->common.tx_mode]);
}
- return tx_size;
-}
-static void compute_intra_yprediction(PREDICTION_MODE mode, BLOCK_SIZE bsize,
- MACROBLOCK *x, MACROBLOCKD *xd) {
- struct macroblockd_plane *const pd = &xd->plane[0];
- struct macroblock_plane *const p = &x->plane[0];
- uint8_t *const src_buf_base = p->src.buf;
- uint8_t *const dst_buf_base = pd->dst.buf;
- const int src_stride = p->src.stride;
- const int dst_stride = pd->dst.stride;
- // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
- // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
- const TX_SIZE tx_size = max_txsize_lookup[bsize];
- const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
- int row, col;
- // If mb_to_right_edge is < 0 we are in a situation in which
- // the current block size extends into the UMV and we won't
- // visit the sub blocks that are wholly within the UMV.
- const int max_blocks_wide =
- num_4x4_w + (xd->mb_to_right_edge >= 0
- ? 0
- : xd->mb_to_right_edge >> (5 + pd->subsampling_x));
- const int max_blocks_high =
- num_4x4_h + (xd->mb_to_bottom_edge >= 0
- ? 0
- : xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
-
- // Keep track of the row and column of the blocks we use so that we know
- // if we are in the unrestricted motion border.
- for (row = 0; row < max_blocks_high; row += (1 << tx_size)) {
- // Skip visiting the sub blocks that are wholly within the UMV.
- for (col = 0; col < max_blocks_wide; col += (1 << tx_size)) {
- p->src.buf = &src_buf_base[4 * (row * src_stride + col)];
- pd->dst.buf = &dst_buf_base[4 * (row * dst_stride + col)];
- vp9_predict_intra_block(xd, b_width_log2_lookup[bsize], tx_size, mode,
- x->skip_encode ? p->src.buf : pd->dst.buf,
- x->skip_encode ? src_stride : dst_stride,
- pd->dst.buf, dst_stride, col, row, 0);
- }
- }
- p->src.buf = src_buf_base;
- pd->dst.buf = dst_buf_base;
+ return tx_size;
}
static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize,
@@ -1065,6 +1023,7 @@ static void estimate_block_intra(int plane, int block, int row, int col,
if (plane == 0) {
int64_t this_sse = INT64_MAX;
+ // TODO(jingning): This needs further refactoring.
block_yrd(cpi, x, &this_rdc, &args->skippable, &this_sse, bsize_tx,
VPXMIN(tx_size, TX_16X16), 0, 1);
} else {
@@ -2513,12 +2472,13 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
bsize <= cpi->sf.max_intra_bsize && !x->skip_low_source_sad &&
!x->lowvar_highsumdiff)) {
struct estimate_block_intra_args args = { cpi, x, DC_PRED, 1, 0 };
- int64_t this_sse = INT64_MAX;
int i;
PRED_BUFFER *const best_pred = best_pickmode.best_pred;
TX_SIZE intra_tx_size =
VPXMIN(max_txsize_lookup[bsize],
tx_mode_to_biggest_tx_size[cpi->common.tx_mode]);
+ if (cpi->oxcf.content != VP9E_CONTENT_SCREEN && intra_tx_size > TX_16X16)
+ intra_tx_size = TX_16X16;
if (reuse_inter_pred && best_pred != NULL) {
if (best_pred->data == orig_dst.buf) {
@@ -2579,13 +2539,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
args.skippable = 1;
args.rdc = &this_rdc;
mi->tx_size = intra_tx_size;
-
- compute_intra_yprediction(this_mode, bsize, x, xd);
- model_rd_for_sb_y(cpi, bsize, x, xd, &this_rdc.rate, &this_rdc.dist,
- &var_y, &sse_y, 1);
- block_yrd(cpi, x, &this_rdc, &args.skippable, &this_sse, bsize,
- VPXMIN(mi->tx_size, TX_16X16), 1, 1);
-
+ vp9_foreach_transformed_block_in_plane(xd, bsize, 0, estimate_block_intra,
+ &args);
// Check skip cost here since skippable is not set for for uv, this
// mirrors the behavior used by inter
if (args.skippable) {
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index ec7d2fac4..6c7c4e0f8 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -751,8 +751,14 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
if (args->exit_early) return;
if (!is_inter_block(mi)) {
+#if CONFIG_MISMATCH_DEBUG
+ struct encode_b_args intra_arg = {
+ x, x->block_qcoeff_opt, args->t_above, args->t_left, &mi->skip, 0, 0, 0
+ };
+#else
struct encode_b_args intra_arg = { x, x->block_qcoeff_opt, args->t_above,
args->t_left, &mi->skip };
+#endif
vp9_encode_block_intra(plane, block, blk_row, blk_col, plane_bsize, tx_size,
&intra_arg);
if (recon) {