[FFmpeg-cvslog] libavcodec/ffv1enc: Add option to select the quantization table

Michael Niedermayer git at videolan.org
Wed Oct 16 22:42:20 EEST 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Oct 15 00:42:49 2024 +0200| [d0927ed0a802d91e60c2894a718b62859a859fe7] | committer: Michael Niedermayer

libavcodec/ffv1enc: Add option to select the quantization table

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d0927ed0a802d91e60c2894a718b62859a859fe7
---

 libavcodec/ffv1.h    | 1 +
 libavcodec/ffv1enc.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index da841cf655..4f5a8ab2be 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -138,6 +138,7 @@ typedef struct FFV1Context {
     int intra;
     int key_frame_ok;
     int context_model;
+    int qtable;
 
     int bits_per_raw_sample;
     int packed_at_lsb;
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 74d7e6c850..0dbfebc1a1 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -728,7 +728,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
 
     for (i = 0; i < MAX_QUANT_TABLE_SIZE; i++) {
         s->quant_table_count = 2;
-        if (s->bits_per_raw_sample <= 8) {
+        if ((s->qtable == -1 && s->bits_per_raw_sample <= 8) || s->qtable == 1) {
             s->quant_tables[0][0][i]=           quant11[i];
             s->quant_tables[0][1][i]=        11*quant11[i];
             s->quant_tables[0][2][i]=     11*11*quant11[i];
@@ -1289,6 +1289,8 @@ static const AVOption options[] = {
             { .i64 = 1 }, INT_MIN, INT_MAX, VE, .unit = "coder" },
     { "context", "Context model", OFFSET(context_model), AV_OPT_TYPE_INT,
             { .i64 = 0 }, 0, 1, VE },
+    { "qtable", "Quantization table", OFFSET(qtable), AV_OPT_TYPE_INT,
+            { .i64 = -1 }, -1, 2, VE },
 
     { NULL }
 };



More information about the ffmpeg-cvslog mailing list