From d7e8490d04e6c8fe69f10f2e7d862f7b094ebae3 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Thu, 26 Jun 2014 12:08:41 -0700 Subject: [PATCH] Add optional mode_info printout function for debug purpose This commit adds an optional function to print out the mode_info loaded from external file for debug purpose. It can be turned on by setting PRINT_MODE_INFO_LOAD 1. Change-Id: I8612801cbf2eb38213105afb7434da2584b3ff2c --- vp9/encoder/vp9_encodeframe.c | 21 +++++++++++++++++++-- vp9/encoder/vp9_encoder.c | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 8c1f63000..9d0fcf7be 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2315,6 +2315,16 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, } } +#if CONFIG_TRANSCODE +#define PRINT_MODE_INFO_LOAD 0 +void print_mode_info(MODE_INFO *mi, int mi_row, int mi_col) { + MB_MODE_INFO *mbmi = &mi->mbmi; + fprintf(stderr, "pos (%d, %d) mode info: bsize %d, mode %d, tx size %d, ref_frame %d\n", + mi_row, mi_col, mbmi->sb_type, mbmi->mode, mbmi->tx_size, + mbmi->ref_frame[0]); +} +#endif + static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, int mi_row, TOKENEXTRA **tp) { VP9_COMMON *const cm = &cpi->common; @@ -2337,10 +2347,17 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, if (pf) { int offset = mi_row * cm->mi_stride + mi_col; int i, j; - for (j = 0; j < MI_BLOCK_SIZE; ++j) - for (i = 0; i < MI_BLOCK_SIZE; ++i) + for (j = 0; j < MI_BLOCK_SIZE; ++j) { + for (i = 0; i < MI_BLOCK_SIZE; ++i) { fread(&cm->mi[offset + j * cm->mi_stride + i], 1, sizeof(MODE_INFO), pf); +#if PRINT_MODE_INFO_LOAD + // print out the mode_info loaded in from external file + print_mode_info(&cm->mi[offset + j * cm->mi_stride + i], + mi_row + j, mi_col + i); +#endif + } + } } encode_sb_mi(cpi, tile, tp, mi_row, mi_col, 1, BLOCK_64X64, diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 2f587da2f..abdb24b02 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -1018,7 +1018,7 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf) { cm->error.setjmp = 0; #if CONFIG_TRANSCODE - cm->mi_array_pf = fopen("/usr/local/google/home/jingning/explibvpx-pub/libvpx/build/linuxbuild/mode_info_array_2.bin", "rb"); + cm->mi_array_pf = fopen("/usr/local/google/home/jingning/explibvpx-pub/libvpx/build/linuxbuild/mode_info_array.bin", "rb"); #endif return cpi; }