[FFmpeg-cvslog] avcodec/mjpegenc_common: Only pass what is used from ScanTable

Andreas Rheinhardt git at videolan.org
Mon Oct 24 02:41:39 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Oct 20 05:53:39 2022 +0200| [69f46ff586cfb42952f098a94b9bb34bdd706809] | committer: Andreas Rheinhardt

avcodec/mjpegenc_common: Only pass what is used from ScanTable

Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross at xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/mjpegenc.c        |  2 +-
 libavcodec/mjpegenc_common.c | 10 +++++-----
 libavcodec/mjpegenc_common.h |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index e56a466b36..eafe7130e2 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -81,7 +81,7 @@ static av_cold void init_uni_ac_vlc(const uint8_t huff_size_ac[256],
 static void mjpeg_encode_picture_header(MpegEncContext *s)
 {
     ff_mjpeg_encode_picture_header(s->avctx, &s->pb, s->picture->f, s->mjpeg_ctx,
-                                   &s->intra_scantable, 0,
+                                   s->intra_scantable.permutated, 0,
                                    s->intra_matrix, s->chroma_intra_matrix,
                                    s->slice_context_count > 1);
 
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index c37c964931..6dfc4469a5 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -58,7 +58,7 @@ static int put_huffman_table(PutBitContext *p, int table_class, int table_id,
 
 static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
                               MJpegContext *m,
-                              ScanTable *intra_scantable,
+                              const uint8_t intra_matrix_permutation[64],
                               uint16_t luma_intra_matrix[64],
                               uint16_t chroma_intra_matrix[64],
                               int hsample[3], int use_slices, int matrices_differ)
@@ -76,7 +76,7 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
         put_bits(p, 4, 0); /* 8 bit precision */
         put_bits(p, 4, 0); /* table 0 */
         for (int i = 0; i < 64; i++) {
-            uint8_t j = intra_scantable->permutated[i];
+            uint8_t j = intra_matrix_permutation[i];
             put_bits(p, 8, luma_intra_matrix[j]);
         }
 
@@ -84,7 +84,7 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
             put_bits(p, 4, 0); /* 8 bit precision */
             put_bits(p, 4, 1); /* table 1 */
             for(i=0;i<64;i++) {
-                j = intra_scantable->permutated[i];
+                j = intra_matrix_permutation[i];
                 put_bits(p, 8, chroma_intra_matrix[j]);
             }
         }
@@ -275,7 +275,7 @@ void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[4], int vsample[4
 
 void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
                                     const AVFrame *frame, struct MJpegContext *m,
-                                    ScanTable *intra_scantable, int pred,
+                                    const uint8_t intra_matrix_permutation[64], int pred,
                                     uint16_t luma_intra_matrix[64],
                                     uint16_t chroma_intra_matrix[64],
                                     int use_slices)
@@ -298,7 +298,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
     chroma_matrix = !lossless && !!memcmp(luma_intra_matrix,
                                           chroma_intra_matrix,
                                           sizeof(luma_intra_matrix[0]) * 64);
-    jpeg_table_header(avctx, pb, m, intra_scantable,
+    jpeg_table_header(avctx, pb, m, intra_matrix_permutation,
                       luma_intra_matrix, chroma_intra_matrix, hsample,
                       use_slices, chroma_matrix);
 
diff --git a/libavcodec/mjpegenc_common.h b/libavcodec/mjpegenc_common.h
index 5b13faae23..e9f0ea44a0 100644
--- a/libavcodec/mjpegenc_common.h
+++ b/libavcodec/mjpegenc_common.h
@@ -24,7 +24,6 @@
 #include <stdint.h>
 
 #include "avcodec.h"
-#include "idctdsp.h"
 #include "put_bits.h"
 
 struct MJpegContext;
@@ -33,7 +32,8 @@ int ff_mjpeg_add_icc_profile_size(AVCodecContext *avctx, const AVFrame *frame,
                                   size_t *max_pkt_size);
 void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
                                     const AVFrame *frame, struct MJpegContext *m,
-                                    ScanTable *intra_scantable, int pred,
+                                    const uint8_t intra_matrix_permutation[64],
+                                    int pred,
                                     uint16_t luma_intra_matrix[64],
                                     uint16_t chroma_intra_matrix[64],
                                     int use_slices);



More information about the ffmpeg-cvslog mailing list