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.
Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -199,8 +199,7 @@ OBJS-$(CONFIG_AMRWB_DECODER) += amrwbdec.o celp_filters.o \ · 198 unmodified lines | ||
| 199 | 199 | celp_math.o acelp_filters.o \ |
| 200 | 200 | acelp_vectors.o \ |
| 201 | 201 | 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 | |
| 204 | 203 | OBJS-$(CONFIG_ANM_DECODER) += anm.o |
| 205 | 204 | OBJS-$(CONFIG_ANSI_DECODER) += ansi.o cga_data.o |
| 206 | 205 | OBJS-$(CONFIG_APE_DECODER) += apedec.o |
| @@ -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 | 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 | 172 | m->bits_ac_chrominance, |
| 172 | 173 | m->val_ac_chrominance); |
| 173 | 174 | } |
| 175 | +#endif | |
| 174 | 176 | |
| 175 | 177 | /** |
| 176 | 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 | 188 | PutBitContext *pbc = &s->pb; |
| 187 | 189 | int mb_y = s->mb_y - !s->mb_x; |
| 188 | 190 | int ret; |
| 189 | − MJpegContext *m; | |
| 190 | − | |
| 191 | − m = s->mjpeg_ctx; | |
| 192 | 191 | |
| 192 | +#if CONFIG_MJPEG_ENCODER | |
| 193 | 193 | if (s->huffman == HUFFMAN_TABLE_OPTIMAL) { |
| 194 | + MJpegContext *m = s->mjpeg_ctx; | |
| 195 | + | |
| 194 | 196 | mjpeg_build_optimal_huffman(m); |
| 195 | 197 | |
| 196 | 198 | // Replace the VLCs with the optimal ones. |
| @@ -206,6 +208,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s) · 9 unmodified lines | ||
| 206 | 208 | s->pred, s->intra_matrix, s->chroma_intra_matrix); |
| 207 | 209 | mjpeg_encode_picture_frame(s); |
| 208 | 210 | } |
| 211 | +#endif | |
| 209 | 212 | |
| 210 | 213 | ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100, |
| 211 | 214 | put_bits_count(&s->pb) / 4 + 1000); |