PR #21441 opened by Ramiro Polla (ramiro) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21441 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21441.patch
The qscale calculation heuristic is very simplistic and doesn't even round-trip (re-encoding a file with the reported QP does not reproduce the same debug QP). Also, the qscale_table field from MJpegDecodeContext was unused since 759001c534. >From accb1095797f643044a5cabd78c58c6e7455a02c Mon Sep 17 00:00:00 2001 From: Ramiro Polla <[email protected]> Date: Sat, 10 Jan 2026 00:03:13 +0100 Subject: [PATCH] avcodec/mjpegdec: remove FF_DEBUG_QP from mjpegdec The qscale calculation heuristic is very simplistic and doesn't even round-trip (re-encoding a file with the reported QP does not reproduce the same debug QP). Also, the qscale_table field from MJpegDecodeContext was unused since 759001c534. --- libavcodec/mjpegbdec.c | 5 ----- libavcodec/mjpegdec.c | 14 -------------- libavcodec/mjpegdec.h | 2 -- 3 files changed, 21 deletions(-) diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c index 79eed6eaa6..94ca7f7f40 100644 --- a/libavcodec/mjpegbdec.c +++ b/libavcodec/mjpegbdec.c @@ -147,11 +147,6 @@ read_header: return buf_size; *got_frame = 1; - if (!s->lossless && avctx->debug & FF_DEBUG_QP) { - av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", - FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2])); - } - return buf_size; } diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 3af4b05551..225211a316 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -231,12 +231,6 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s) return AVERROR_INVALIDDATA; } } - - // XXX FIXME fine-tune, and perhaps add dc too - s->qscale[index] = FFMAX(s->quant_matrixes[index][1], - s->quant_matrixes[index][8]) >> 1; - av_log(s->avctx, AV_LOG_DEBUG, "qscale[%d]: %d\n", - index, s->qscale[index]); len -= 1 + 64 * (1+pr); } return 0; @@ -2561,14 +2555,6 @@ eoi_parser: *got_frame = 1; s->got_picture = 0; - if (!s->lossless && avctx->debug & FF_DEBUG_QP) { - int qp = FFMAX3(s->qscale[0], - s->qscale[1], - s->qscale[2]); - - av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", qp); - } - goto the_end; case SOS: s->raw_scan_buffer = buf_ptr; diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h index c2f83ac949..7ffade4808 100644 --- a/libavcodec/mjpegdec.h +++ b/libavcodec/mjpegdec.h @@ -66,7 +66,6 @@ typedef struct MJpegDecodeContext { uint16_t quant_matrixes[4][64]; VLC vlcs[3][4]; - int qscale[4]; ///< quantizer scale calculated from quant_matrixes int orig_height; /* size given at codec init */ int first_picture; /* true if decoding first picture */ @@ -112,7 +111,6 @@ typedef struct MJpegDecodeContext { AVFrame *picture_ptr; /* pointer to picture structure */ int got_picture; ///< we found a SOF and picture is valid, too. int linesize[MAX_COMPONENTS]; ///< linesize << interlaced - int8_t *qscale_table; DECLARE_ALIGNED(32, int16_t, block)[64]; int16_t (*blocks[MAX_COMPONENTS])[64]; ///< intermediate sums (progressive mode) uint8_t *last_nnz[MAX_COMPONENTS]; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
