[FFmpeg-devel] [PATCH 37/57] avcodec/mpegutils: Don't output wrong mb skip values
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Wed Jun 12 16:48:33 EEST 2024
The earlier code had two problems:
1. For reference frames that are not directly output (happens unless
low_delay is set), the mb skip values referred to the next reference
frame to be decoded.
2. For non-reference frames, every macroblock was always considered
skipped.
This makes the output (worse than) useless; that no one ever
complained about this shows that this feature is not really used.
It is therefore removed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/h264dec.c | 2 +-
libavcodec/mpegutils.c | 12 ++----------
libavcodec/mpegutils.h | 2 +-
libavcodec/mpegvideo_dec.c | 2 +-
4 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index fd23e367b4..c77d8f42db 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -979,7 +979,7 @@ static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *g
*got_frame = 1;
if (CONFIG_MPEGVIDEODEC) {
- ff_print_debug_info2(h->avctx, dst, NULL,
+ ff_print_debug_info2(h->avctx, dst,
out->mb_type,
out->qscale_table,
out->motion_val,
diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index a53996852f..73b6650b70 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -153,7 +153,7 @@ static char get_interlacement_char(int mb_type)
}
void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict,
- const uint8_t *mbskip_table, const uint32_t *mbtype_table,
+ const uint32_t *mbtype_table,
const int8_t *qscale_table, int16_t (*const motion_val[2])[2],
int mb_width, int mb_height, int mb_stride, int quarter_sample)
{
@@ -248,7 +248,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict,
return;
- if (avctx->debug & (FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)) {
+ if (avctx->debug & (FF_DEBUG_QP | FF_DEBUG_MB_TYPE)) {
int x,y;
AVBPrint buf;
int n;
@@ -267,8 +267,6 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict,
av_bprint_chars(&buf, ' ', margin_left);
n = 0;
- if (avctx->debug & FF_DEBUG_SKIP)
- n++;
if (avctx->debug & FF_DEBUG_QP)
n += 2;
if (avctx->debug & FF_DEBUG_MB_TYPE)
@@ -284,12 +282,6 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict,
for (x = 0; x < mb_width; x++) {
if (x == 0)
av_bprintf(&buf, "%*d ", margin_left - 1, y << 4);
- if (avctx->debug & FF_DEBUG_SKIP) {
- int count = mbskip_table ? mbskip_table[x + y * mb_stride] : 0;
- if (count > 9)
- count = 9;
- av_bprintf(&buf, "%1d", count);
- }
if (avctx->debug & FF_DEBUG_QP) {
av_bprintf(&buf, "%2d", qscale_table[x + y * mb_stride]);
}
diff --git a/libavcodec/mpegutils.h b/libavcodec/mpegutils.h
index 43075191c6..64e69c7746 100644
--- a/libavcodec/mpegutils.h
+++ b/libavcodec/mpegutils.h
@@ -106,7 +106,7 @@ void ff_draw_horiz_band(AVCodecContext *avctx, const AVFrame *cur, const AVFrame
* Print debugging info for the given picture.
*/
void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict,
- const uint8_t *mbskip_table, const uint32_t *mbtype_table,
+ const uint32_t *mbtype_table,
const int8_t *qscale_table, int16_t (*const motion_val[2])[2],
int mb_width, int mb_height, int mb_stride, int quarter_sample);
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index e95b5a0940..4e279d9fa8 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -408,7 +408,7 @@ void ff_mpv_frame_end(MpegEncContext *s)
void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict)
{
- ff_print_debug_info2(s->avctx, pict, s->mbskip_table, p->mb_type,
+ ff_print_debug_info2(s->avctx, pict, p->mb_type,
p->qscale_table, p->motion_val,
s->mb_width, s->mb_height, s->mb_stride, s->quarter_sample);
}
--
2.40.1
More information about the ffmpeg-devel
mailing list