]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mjpegenc: Remove dependency of AMV encoder on mjpegenc_huffman
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Tue, 30 Mar 2021 22:21:20 +0000 (00:21 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Sat, 10 Apr 2021 01:45:18 +0000 (03:45 +0200)
Using optimal Huffman tables is not supported for AMV and always
disabled by ff_mpv_encode_init(); therefore one can build
the AMV encoder without mjpegenc_huffman if one adds the necessary
compile-time checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/Makefile
libavcodec/mjpegenc.c

index 33a280cf6953c7504838ed45e30945932794049b..4a597f727a4c70ba159360b173dd015d37a5e9f0 100644 (file)
@@ -199,8 +199,7 @@ OBJS-$(CONFIG_AMRWB_DECODER)           += amrwbdec.o celp_filters.o   \
                                           celp_math.o acelp_filters.o \
                                           acelp_vectors.o             \
                                           acelp_pitch_delay.o
-OBJS-$(CONFIG_AMV_ENCODER)             += mjpegenc.o mjpegenc_common.o \
-                                          mjpegenc_huffman.o
+OBJS-$(CONFIG_AMV_ENCODER)             += mjpegenc.o mjpegenc_common.o
 OBJS-$(CONFIG_ANM_DECODER)             += anm.o
 OBJS-$(CONFIG_ANSI_DECODER)            += ansi.o cga_data.o
 OBJS-$(CONFIG_APE_DECODER)             += apedec.o
index 596b7544cafeb4d1df8364d46e968d4effb3eef5..e5d2e24d66c256ea4caac574d939f48077123962 100644 (file)
@@ -65,6 +65,7 @@ static av_cold void init_uni_ac_vlc(const uint8_t huff_size_ac[256],
     }
 }
 
+#if CONFIG_MJPEG_ENCODER
 /**
  * Encodes and outputs the entire frame in the JPEG format.
  *
@@ -171,6 +172,7 @@ static void mjpeg_build_optimal_huffman(MJpegContext *m)
                                  m->bits_ac_chrominance,
                                  m->val_ac_chrominance);
 }
+#endif
 
 /**
  * Writes the complete JPEG frame when optimal huffman tables are enabled,
@@ -186,11 +188,11 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s)
     PutBitContext *pbc = &s->pb;
     int mb_y = s->mb_y - !s->mb_x;
     int ret;
-    MJpegContext *m;
-
-    m = s->mjpeg_ctx;
 
+#if CONFIG_MJPEG_ENCODER
     if (s->huffman == HUFFMAN_TABLE_OPTIMAL) {
+        MJpegContext *m = s->mjpeg_ctx;
+
         mjpeg_build_optimal_huffman(m);
 
         // Replace the VLCs with the optimal ones.
@@ -206,6 +208,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s)
                                        s->pred, s->intra_matrix, s->chroma_intra_matrix);
         mjpeg_encode_picture_frame(s);
     }
+#endif
 
     ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100,
                                             put_bits_count(&s->pb) / 4 + 1000);