Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PR] avcodec/mjpegdec: remove FF_DEBUG_QP from mjpegdec (PR #21441)
@ 2026-01-12 19:56 Ramiro Polla via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: Ramiro Polla via ffmpeg-devel @ 2026-01-12 19:56 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Ramiro Polla

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 <ramiro.polla@gmail.com>
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-12 19:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-12 19:56 [FFmpeg-devel] [PR] avcodec/mjpegdec: remove FF_DEBUG_QP from mjpegdec (PR #21441) Ramiro Polla via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git