History

avcodec/mjpegenc: Remove dependency of AMV encoder on mjpegenc_huffman

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.

Andreas Rheinhardt committed 5 years ago

Commit d0dcfae1 parent b3a38ea2 files · +7 −5Browse files

Unified · Split

2 files
  1. libavcodec/Makefile +1 −2
  2. libavcodec/mjpegenc.c +6 −3
libavcodec/Makefile+1−2
@@ -199,8 +199,7 @@ OBJS-$(CONFIG_AMRWB_DECODER) += amrwbdec.o celp_filters.o \ · 198 unmodified lines
199199 celp_math.o acelp_filters.o \
200200 acelp_vectors.o \
201201 acelp_pitch_delay.o
202−OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o \
203− mjpegenc_huffman.o
202+OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o
204203 OBJS-$(CONFIG_ANM_DECODER) += anm.o
205204 OBJS-$(CONFIG_ANSI_DECODER) += ansi.o cga_data.o
206205 OBJS-$(CONFIG_APE_DECODER) += apedec.o
libavcodec/mjpegenc.c+6−3
@@ -65,6 +65,7 @@ static av_cold void init_uni_ac_vlc(const uint8_t huff_size_ac[256], · 64 unmodified lines
6565 }
6666 }
6767
68+#if CONFIG_MJPEG_ENCODER
6869 /**
6970 * Encodes and outputs the entire frame in the JPEG format.
7071 *
@@ -171,6 +172,7 @@ static void mjpeg_build_optimal_huffman(MJpegContext *m) · 100 unmodified lines
171172 m->bits_ac_chrominance,
172173 m->val_ac_chrominance);
173174 }
175+#endif
174176
175177 /**
176178 * Writes the complete JPEG frame when optimal huffman tables are enabled,
@@ -186,11 +188,11 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s) · 9 unmodified lines
186188 PutBitContext *pbc = &s->pb;
187189 int mb_y = s->mb_y - !s->mb_x;
188190 int ret;
189− MJpegContext *m;
190−
191− m = s->mjpeg_ctx;
192191
192+#if CONFIG_MJPEG_ENCODER
193193 if (s->huffman == HUFFMAN_TABLE_OPTIMAL) {
194+ MJpegContext *m = s->mjpeg_ctx;
195+
194196 mjpeg_build_optimal_huffman(m);
195197
196198 // Replace the VLCs with the optimal ones.
@@ -206,6 +208,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s) · 9 unmodified lines
206208 s->pred, s->intra_matrix, s->chroma_intra_matrix);
207209 mjpeg_encode_picture_frame(s);
208210 }
211+#endif
209212
210213 ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100,
211214 put_bits_count(&s->pb) / 4 + 1000);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t