Fix a bug in block mismatch debugging
Fix a bug in checking the block mode context.
Change-Id: Ia585f30e370f80a6e42bf5a2eb7ace0cf2d1f337
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 1f4f547..7139887 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -2024,12 +2024,12 @@
#if DEC_MISMATCH_DEBUG
static void dec_dump_logs(AV1_COMMON *cm, MODE_INFO *const mi,
- MACROBLOCKD *const xd, int mi_row, int mi_col) {
+ MACROBLOCKD *const xd, int mi_row, int mi_col,
+ int16_t inter_mode_ctx[MODE_CTX_REF_FRAMES],
+ int16_t mode_ctx) {
int_mv mv[2] = { { 0 } };
int ref;
MB_MODE_INFO *const mbmi = &mi->mbmi;
- int16_t inter_mode_ctx[MODE_CTX_REF_FRAMES];
- int16_t mode_ctx = 0;
for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref)
mv[ref].as_mv = mbmi->mv[ref].as_mv;
@@ -2064,19 +2064,24 @@
}
int8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
- printf(
- "=== DECODER ===: "
- "Frame=%d, (mi_row,mi_col)=(%d,%d), mode=%d, bsize=%d, "
- "show_frame=%d, mv[0]=(%d,%d), mv[1]=(%d,%d), ref[0]=%d, "
- "ref[1]=%d, motion_mode=%d, inter_mode_ctx=%d, mode_ctx=%d, "
- "interp_ctx=(%d,%d), interp_filter=(%d,%d), newmv_ctx=%d, "
- "zeromv_ctx=%d, refmv_ctx=%d\n",
- cm->current_video_frame, mi_row, mi_col, mbmi->mode, mbmi->sb_type,
- cm->show_frame, mv[0].as_mv.row, mv[0].as_mv.col, mv[1].as_mv.row,
- mv[1].as_mv.col, mbmi->ref_frame[0], mbmi->ref_frame[1],
- mbmi->motion_mode, inter_mode_ctx[ref_frame_type], mode_ctx,
- interp_ctx[0], interp_ctx[1], interp_filter[0], interp_filter[1],
- newmv_ctx, zeromv_ctx, refmv_ctx);
+#define FRAME_TO_CHECK 1
+ if (cm->current_video_frame == FRAME_TO_CHECK
+ // && cm->show_frame == 0
+ ) {
+ printf(
+ "=== DECODER ===: "
+ "Frame=%d, (mi_row,mi_col)=(%d,%d), mode=%d, bsize=%d, "
+ "show_frame=%d, mv[0]=(%d,%d), mv[1]=(%d,%d), ref[0]=%d, "
+ "ref[1]=%d, motion_mode=%d, inter_mode_ctx=%d, mode_ctx=%d, "
+ "interp_ctx=(%d,%d), interp_filter=(%d,%d), newmv_ctx=%d, "
+ "zeromv_ctx=%d, refmv_ctx=%d\n",
+ cm->current_video_frame, mi_row, mi_col, mbmi->mode, mbmi->sb_type,
+ cm->show_frame, mv[0].as_mv.row, mv[0].as_mv.col, mv[1].as_mv.row,
+ mv[1].as_mv.col, mbmi->ref_frame[0], mbmi->ref_frame[1],
+ mbmi->motion_mode, inter_mode_ctx[ref_frame_type], mode_ctx,
+ interp_ctx[0], interp_ctx[1], interp_filter[0], interp_filter[1],
+ newmv_ctx, zeromv_ctx, refmv_ctx);
+ }
}
#endif // DEC_MISMATCH_DEBUG
@@ -2640,7 +2645,7 @@
#if DEC_MISMATCH_DEBUG
// NOTE(zoeliu): For debug
- dec_dump_logs(cm, mi, xd, mi_row, mi_col);
+ dec_dump_logs(cm, mi, xd, mi_row, mi_col, inter_mode_ctx, mode_ctx);
#endif // DEC_MISMATCH_DEBUG
}