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
199 celp_math.o acelp_filters.o \199 celp_math.o acelp_filters.o \
200 acelp_vectors.o \200 acelp_vectors.o \
201 acelp_pitch_delay.o201 acelp_pitch_delay.o
202OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o \202OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o
203 mjpegenc_huffman.o
204OBJS-$(CONFIG_ANM_DECODER) += anm.o203OBJS-$(CONFIG_ANM_DECODER) += anm.o
205OBJS-$(CONFIG_ANSI_DECODER) += ansi.o cga_data.o204OBJS-$(CONFIG_ANSI_DECODER) += ansi.o cga_data.o
206OBJS-$(CONFIG_APE_DECODER) += apedec.o205OBJS-$(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
65 }65 }
66}66}
67 67
68#if CONFIG_MJPEG_ENCODER
68/**69/**
69 * Encodes and outputs the entire frame in the JPEG format.70 * Encodes and outputs the entire frame in the JPEG format.
70 *71 *
@@ -171,6 +172,7 @@ static void mjpeg_build_optimal_huffman(MJpegContext *m) · 100 unmodified lines
171 m->bits_ac_chrominance,172 m->bits_ac_chrominance,
172 m->val_ac_chrominance);173 m->val_ac_chrominance);
173}174}
175#endif
174 176
175/**177/**
176 * Writes the complete JPEG frame when optimal huffman tables are enabled,178 * 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
186 PutBitContext *pbc = &s->pb;188 PutBitContext *pbc = &s->pb;
187 int mb_y = s->mb_y - !s->mb_x;189 int mb_y = s->mb_y - !s->mb_x;
188 int ret;190 int ret;
189 MJpegContext *m;
190
191 m = s->mjpeg_ctx;
192 191
192#if CONFIG_MJPEG_ENCODER
193 if (s->huffman == HUFFMAN_TABLE_OPTIMAL) {193 if (s->huffman == HUFFMAN_TABLE_OPTIMAL) {
194 MJpegContext *m = s->mjpeg_ctx;
195
194 mjpeg_build_optimal_huffman(m);196 mjpeg_build_optimal_huffman(m);
195 197
196 // Replace the VLCs with the optimal ones.198 // Replace the VLCs with the optimal ones.
@@ -206,6 +208,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s) · 9 unmodified lines
206 s->pred, s->intra_matrix, s->chroma_intra_matrix);208 s->pred, s->intra_matrix, s->chroma_intra_matrix);
207 mjpeg_encode_picture_frame(s);209 mjpeg_encode_picture_frame(s);
208 }210 }
211#endif
209 212
210 ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100,213 ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100,
211 put_bits_count(&s->pb) / 4 + 1000);214 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