Add frame_offset to mismatch debug tool Use frame_offset to locate the location of mismatch. Change-Id: I17ceb60febf5f30041a1d8e35556ae7034d095cd
diff --git a/aom_util/debug_util.c b/aom_util/debug_util.c index 27032fd..468c47e 100644 --- a/aom_util/debug_util.c +++ b/aom_util/debug_util.c
@@ -115,9 +115,9 @@ 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, - int pixel_c, int pixel_r, int blk_w, int blk_h, - int highbd) { +void mismatch_record_block_pre(const uint8_t *src, int src_stride, + int frame_offset, int plane, int pixel_c, + int pixel_r, int blk_w, int blk_h, int highbd) { if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) { printf("frame_buf undersized\n"); assert(0); @@ -133,22 +133,24 @@ } #if 0 int ref_frame_idx = 3; + int ref_frame_offset = 4; int ref_plane = 1; int ref_pixel_c = 162; int ref_pixel_r = 16; if (frame_idx_w == ref_frame_idx && plane == ref_plane && - ref_pixel_c >= pixel_c && ref_pixel_c < pixel_c + blk_w && - ref_pixel_r >= pixel_r && ref_pixel_r < pixel_r + blk_h) { + frame_offset == ref_frame_offset && ref_pixel_c >= pixel_c && + ref_pixel_c < pixel_c + blk_w && ref_pixel_r >= pixel_r && + ref_pixel_r < pixel_r + blk_h) { 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", - 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 } -void mismatch_record_block_tx(const uint8_t *src, int src_stride, int plane, - int pixel_c, int pixel_r, int blk_w, int blk_h, - int highbd) { +void mismatch_record_block_tx(const uint8_t *src, int src_stride, + int frame_offset, int plane, int pixel_c, + int pixel_r, int blk_w, int blk_h, int highbd) { if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) { printf("frame_buf undersized\n"); assert(0); @@ -164,22 +166,23 @@ } #if 0 int ref_frame_idx = 3; + int ref_frame_offset = 4; int ref_plane = 1; int ref_pixel_c = 162; 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_r >= pixel_r && ref_pixel_r < pixel_r + blk_h) { 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", - 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 } -void mismatch_check_block_pre(const uint8_t *src, int src_stride, int plane, - int pixel_c, int pixel_r, int blk_w, int blk_h, - int highbd) { +void mismatch_check_block_pre(const uint8_t *src, int src_stride, + int frame_offset, int plane, int pixel_c, + int pixel_r, int blk_w, int blk_h, int highbd) { if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) { printf("frame_buf undersized\n"); assert(0); @@ -199,9 +202,10 @@ } if (mismatch) { 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", - 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"); for (int rr = 0; rr < blk_h; ++rr) { for (int cc = 0; cc < blk_w; ++cc) { @@ -222,9 +226,9 @@ assert(0); } } -void mismatch_check_block_tx(const uint8_t *src, int src_stride, int plane, - int pixel_c, int pixel_r, int blk_w, int blk_h, - int highbd) { +void mismatch_check_block_tx(const uint8_t *src, int src_stride, + int frame_offset, int plane, int pixel_c, + int pixel_r, int blk_w, int blk_h, int highbd) { if (pixel_c + blk_w >= frame_stride || pixel_r + blk_h >= frame_height) { printf("frame_buf undersized\n"); assert(0); @@ -244,9 +248,10 @@ } if (mismatch) { 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", - 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"); for (int rr = 0; rr < blk_h; ++rr) { for (int cc = 0; cc < blk_w; ++cc) {
diff --git a/aom_util/debug_util.h b/aom_util/debug_util.h index 7169aad..bb37bc5 100644 --- a/aom_util/debug_util.h +++ b/aom_util/debug_util.h
@@ -47,18 +47,18 @@ void mismatch_move_frame_idx_w(); void mismatch_move_frame_idx_r(); void mismatch_reset_frame(int num_planes); -void mismatch_record_block_pre(const uint8_t *src, int src_stride, int plane, - int pixel_c, 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, - int pixel_c, 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, - int pixel_c, 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, - int pixel_c, int pixel_r, int blk_w, int blk_h, - int highbd); +void mismatch_record_block_pre(const uint8_t *src, int src_stride, + int frame_offset, int plane, int pixel_c, + int pixel_r, int blk_w, int blk_h, int highbd); +void mismatch_record_block_tx(const uint8_t *src, int src_stride, + int frame_offset, int plane, int pixel_c, + int pixel_r, int blk_w, int blk_h, int highbd); +void mismatch_check_block_pre(const uint8_t *src, int src_stride, + int frame_offset, int plane, int pixel_c, + int pixel_r, int blk_w, int blk_h, int highbd); +void mismatch_check_block_tx(const uint8_t *src, int src_stride, + int frame_offset, int plane, int pixel_c, + int pixel_r, int blk_w, int blk_h, int highbd); #endif // CONFIG_MISMATCH_DEBUG #ifdef __cplusplus
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 69d212d..da26d2b 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -229,8 +229,9 @@ int blk_h = block_size_high[bsize]; mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, blk_col, blk_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); + mismatch_check_block_tx(dst, pd->dst.stride, cm->frame_offset, plane, + pixel_c, pixel_r, blk_w, blk_h, + xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH); #endif *eob_total += eob; } else { @@ -462,8 +463,8 @@ if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x, pd->subsampling_y)) continue; - mismatch_check_block_pre(pd->dst.buf, pd->dst.stride, plane, pixel_c, - pixel_r, pd->width, pd->height, + mismatch_check_block_pre(pd->dst.buf, pd->dst.stride, cm->frame_offset, + plane, pixel_c, pixel_r, pd->width, pd->height, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH); } #endif
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index ff824a5..f08b781 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -4987,8 +4987,9 @@ if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x, pd->subsampling_y)) continue; - mismatch_record_block_pre(pd->dst.buf, pd->dst.stride, plane, pixel_c, - pixel_r, pd->width, pd->height, + mismatch_record_block_pre(pd->dst.buf, pd->dst.stride, cm->frame_offset, + plane, pixel_c, pixel_r, pd->width, + pd->height, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH); } }
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c index 5bd85f1..eb30a9f 100644 --- a/av1/encoder/encodemb.c +++ b/av1/encoder/encodemb.c
@@ -602,8 +602,8 @@ int blk_h = block_size_high[bsize]; mi_to_pixel_loc(&pixel_c, &pixel_r, mi_col, mi_row, blk_col, blk_row, pd->subsampling_x, pd->subsampling_y); - mismatch_record_block_tx(dst, pd->dst.stride, plane, pixel_c, pixel_r, - blk_w, blk_h, + mismatch_record_block_tx(dst, pd->dst.stride, cm->frame_offset, plane, + pixel_c, pixel_r, blk_w, blk_h, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH); } #endif