Commit bb87c66d authored by Cheng Chen's avatar Cheng Chen

Add frame_offset to mismatch debug tool

Use frame_offset to locate the location of mismatch.

Change-Id: I17ceb60febf5f30041a1d8e35556ae7034d095cd
parent 18976fa5
...@@ -115,9 +115,9 @@ void mismatch_move_frame_idx_r() { ...@@ -115,9 +115,9 @@ void mismatch_move_frame_idx_r() {
frame_buf_idx_r = (frame_buf_idx_r + 1) % max_frame_buf_num; frame_buf_idx_r = (frame_buf_idx_r + 1) % max_frame_buf_num;
} }
void mismatch_record_block_pre(const uint8_t *src, int src_stride, int plane, void mismatch_record_block_pre(const uint8_t *src, int src_stride,
int pixel_c, int pixel_r, int blk_w, int blk_h, int frame_offset, int plane, int pixel_c,
int highbd) { int pixel_r, int blk_w, int blk_h, int highbd) {
if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) { if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) {
printf("frame_buf undersized\n"); printf("frame_buf undersized\n");
assert(0); assert(0);
...@@ -133,22 +133,24 @@ void mismatch_record_block_pre(const uint8_t *src, int src_stride, int plane, ...@@ -133,22 +133,24 @@ void mismatch_record_block_pre(const uint8_t *src, int src_stride, int plane,
} }
#if 0 #if 0
int ref_frame_idx = 3; int ref_frame_idx = 3;
int ref_frame_offset = 4;
int ref_plane = 1; int ref_plane = 1;
int ref_pixel_c = 162; int ref_pixel_c = 162;
int ref_pixel_r = 16; int ref_pixel_r = 16;
if (frame_idx_w == ref_frame_idx && plane == ref_plane && if (frame_idx_w == ref_frame_idx && plane == ref_plane &&
ref_pixel_c >= pixel_c && ref_pixel_c < pixel_c + blk_w && frame_offset == ref_frame_offset && ref_pixel_c >= pixel_c &&
ref_pixel_r >= pixel_r && ref_pixel_r < pixel_r + blk_h) { ref_pixel_c < pixel_c + blk_w && ref_pixel_r >= pixel_r &&
ref_pixel_r < pixel_r + blk_h) {
printf( printf(
"\nrecord_block_pre frame_idx %d plane %d pixel_c %d pixel_r %d blk_w " "\nrecord_block_pre frame_idx %d frame_offset %d plane %d pixel_c %d pixel_r %d blk_w "
"%d blk_h %d\n", "%d blk_h %d\n",
frame_idx_w, plane, pixel_c, pixel_r, blk_w, blk_h); frame_idx_w, frame_offset, plane, pixel_c, pixel_r, blk_w, blk_h);
} }
#endif #endif
} }
void mismatch_record_block_tx(const uint8_t *src, int src_stride, int plane, void mismatch_record_block_tx(const uint8_t *src, int src_stride,
int pixel_c, int pixel_r, int blk_w, int blk_h, int frame_offset, int plane, int pixel_c,
int highbd) { int pixel_r, int blk_w, int blk_h, int highbd) {
if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) { if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) {
printf("frame_buf undersized\n"); printf("frame_buf undersized\n");
assert(0); assert(0);
...@@ -164,22 +166,23 @@ void mismatch_record_block_tx(const uint8_t *src, int src_stride, int plane, ...@@ -164,22 +166,23 @@ void mismatch_record_block_tx(const uint8_t *src, int src_stride, int plane,
} }
#if 0 #if 0
int ref_frame_idx = 3; int ref_frame_idx = 3;
int ref_frame_offset = 4;
int ref_plane = 1; int ref_plane = 1;
int ref_pixel_c = 162; int ref_pixel_c = 162;
int ref_pixel_r = 16; int ref_pixel_r = 16;
if (frame_idx_w == ref_frame_idx && plane == ref_plane && if (frame_idx_w == ref_frame_idx && plane == ref_plane && frame_offset == ref_frame_offset &&
ref_pixel_c >= pixel_c && ref_pixel_c < pixel_c + blk_w && ref_pixel_c >= pixel_c && ref_pixel_c < pixel_c + blk_w &&
ref_pixel_r >= pixel_r && ref_pixel_r < pixel_r + blk_h) { ref_pixel_r >= pixel_r && ref_pixel_r < pixel_r + blk_h) {
printf( printf(
"\nrecord_block_tx frame_idx %d plane %d pixel_c %d pixel_r %d blk_w " "\nrecord_block_tx frame_idx %d frame_offset %d plane %d pixel_c %d pixel_r %d blk_w "
"%d blk_h %d\n", "%d blk_h %d\n",
frame_idx_w, plane, pixel_c, pixel_r, blk_w, blk_h); frame_idx_w, frame_offset, plane, pixel_c, pixel_r, blk_w, blk_h);
} }
#endif #endif
} }
void mismatch_check_block_pre(const uint8_t *src, int src_stride, int plane, void mismatch_check_block_pre(const uint8_t *src, int src_stride,
int pixel_c, int pixel_r, int blk_w, int blk_h, int frame_offset, int plane, int pixel_c,
int highbd) { int pixel_r, int blk_w, int blk_h, int highbd) {
if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) { if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) {
printf("frame_buf undersized\n"); printf("frame_buf undersized\n");
assert(0); assert(0);
...@@ -199,9 +202,10 @@ void mismatch_check_block_pre(const uint8_t *src, int src_stride, int plane, ...@@ -199,9 +202,10 @@ void mismatch_check_block_pre(const uint8_t *src, int src_stride, int plane,
} }
if (mismatch) { if (mismatch) {
printf( printf(
"\ncheck_block_pre failed frame_idx %d plane %d pixel_c %d pixel_r " "\ncheck_block_pre failed frame_idx %d frame_offset %d plane %d "
"pixel_c %d pixel_r "
"%d blk_w %d blk_h %d\n", "%d blk_w %d blk_h %d\n",
frame_idx_r, plane, pixel_c, pixel_r, blk_w, blk_h); frame_idx_r, frame_offset, plane, pixel_c, pixel_r, blk_w, blk_h);
printf("enc\n"); printf("enc\n");
for (int rr = 0; rr < blk_h; ++rr) { for (int rr = 0; rr < blk_h; ++rr) {
for (int cc = 0; cc < blk_w; ++cc) { for (int cc = 0; cc < blk_w; ++cc) {
...@@ -222,9 +226,9 @@ void mismatch_check_block_pre(const uint8_t *src, int src_stride, int plane, ...@@ -222,9 +226,9 @@ void mismatch_check_block_pre(const uint8_t *src, int src_stride, int plane,
assert(0); assert(0);
} }
} }
void mismatch_check_block_tx(const uint8_t *src, int src_stride, int plane, void mismatch_check_block_tx(const uint8_t *src, int src_stride,
int pixel_c, int pixel_r, int blk_w, int blk_h, int frame_offset, int plane, int pixel_c,
int highbd) { int pixel_r, int blk_w, int blk_h, int highbd) {
if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) { if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) {
printf("frame_buf undersized\n"); printf("frame_buf undersized\n");
assert(0); assert(0);
...@@ -244,9 +248,10 @@ void mismatch_check_block_tx(const uint8_t *src, int src_stride, int plane, ...@@ -244,9 +248,10 @@ void mismatch_check_block_tx(const uint8_t *src, int src_stride, int plane,
} }
if (mismatch) { if (mismatch) {
printf( printf(
"\ncheck_block_tx failed frame_idx %d plane %d pixel_c %d pixel_r " "\ncheck_block_tx failed frame_idx %d frame_offset %d plane %d pixel_c "
"%d pixel_r "
"%d blk_w %d blk_h %d\n", "%d blk_w %d blk_h %d\n",
frame_idx_r, plane, pixel_c, pixel_r, blk_w, blk_h); frame_idx_r, frame_offset, plane, pixel_c, pixel_r, blk_w, blk_h);
printf("enc\n"); printf("enc\n");
for (int rr = 0; rr < blk_h; ++rr) { for (int rr = 0; rr < blk_h; ++rr) {
for (int cc = 0; cc < blk_w; ++cc) { for (int cc = 0; cc < blk_w; ++cc) {
......
...@@ -47,18 +47,18 @@ void bitstream_queue_set_skip_read(int skip); ...@@ -47,18 +47,18 @@ void bitstream_queue_set_skip_read(int skip);
void mismatch_move_frame_idx_w(); void mismatch_move_frame_idx_w();
void mismatch_move_frame_idx_r(); void mismatch_move_frame_idx_r();
void mismatch_reset_frame(int num_planes); void mismatch_reset_frame(int num_planes);
void mismatch_record_block_pre(const uint8_t *src, int src_stride, int plane, void mismatch_record_block_pre(const uint8_t *src, int src_stride,
int pixel_c, int pixel_r, int blk_w, int blk_h, int frame_offset, int plane, int pixel_c,
int highbd); int pixel_r, int blk_w, int blk_h, int highbd);
void mismatch_record_block_tx(const uint8_t *src, int src_stride, int plane, void mismatch_record_block_tx(const uint8_t *src, int src_stride,
int pixel_c, int pixel_r, int blk_w, int blk_h, int frame_offset, int plane, int pixel_c,
int highbd); int pixel_r, int blk_w, int blk_h, int highbd);
void mismatch_check_block_pre(const uint8_t *src, int src_stride, int plane, void mismatch_check_block_pre(const uint8_t *src, int src_stride,
int pixel_c, int pixel_r, int blk_w, int blk_h, int frame_offset, int plane, int pixel_c,
int highbd); int pixel_r, int blk_w, int blk_h, int highbd);
void mismatch_check_block_tx(const uint8_t *src, int src_stride, int plane, void mismatch_check_block_tx(const uint8_t *src, int src_stride,
int pixel_c, int pixel_r, int blk_w, int blk_h, int frame_offset, int plane, int pixel_c,
int highbd); int pixel_r, int blk_w, int blk_h, int highbd);
#endif // CONFIG_MISMATCH_DEBUG #endif // CONFIG_MISMATCH_DEBUG
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -229,8 +229,9 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd, ...@@ -229,8 +229,9 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
int blk_h = block_size_high[bsize]; int blk_h = block_size_high[bsize];
mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, blk_col, blk_row, mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, blk_col, blk_row,
pd->subsampling_x, pd->subsampling_y); pd->subsampling_x, pd->subsampling_y);
mismatch_check_block_tx(dst, pd->dst.stride, plane, pixel_c, pixel_r, blk_w, mismatch_check_block_tx(dst, pd->dst.stride, cm->frame_offset, plane,
blk_h, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH); pixel_c, pixel_r, blk_w, blk_h,
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
#endif #endif
*eob_total += eob; *eob_total += eob;
} else { } else {
...@@ -462,8 +463,8 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, ...@@ -462,8 +463,8 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x, if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x,
pd->subsampling_y)) pd->subsampling_y))
continue; continue;
mismatch_check_block_pre(pd->dst.buf, pd->dst.stride, plane, pixel_c, mismatch_check_block_pre(pd->dst.buf, pd->dst.stride, cm->frame_offset,
pixel_r, pd->width, pd->height, plane, pixel_c, pixel_r, pd->width, pd->height,
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH); xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
} }
#endif #endif
......
...@@ -4987,8 +4987,9 @@ static void encode_superblock(const AV1_COMP *const cpi, TileDataEnc *tile_data, ...@@ -4987,8 +4987,9 @@ static void encode_superblock(const AV1_COMP *const cpi, TileDataEnc *tile_data,
if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x, if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x,
pd->subsampling_y)) pd->subsampling_y))
continue; continue;
mismatch_record_block_pre(pd->dst.buf, pd->dst.stride, plane, pixel_c, mismatch_record_block_pre(pd->dst.buf, pd->dst.stride, cm->frame_offset,
pixel_r, pd->width, pd->height, plane, pixel_c, pixel_r, pd->width,
pd->height,
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH); xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
} }
} }
......
...@@ -602,8 +602,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col, ...@@ -602,8 +602,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
int blk_h = block_size_high[bsize]; int blk_h = block_size_high[bsize];
mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, blk_col, blk_row, mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, blk_col, blk_row,
pd->subsampling_x, pd->subsampling_y); pd->subsampling_x, pd->subsampling_y);
mismatch_record_block_tx(dst, pd->dst.stride, plane, pixel_c, pixel_r, mismatch_record_block_tx(dst, pd->dst.stride, cm->frame_offset, plane,
blk_w, blk_h, pixel_c, pixel_r, blk_w, blk_h,
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH); xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment