summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-09 23:24:15 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-10 00:12:01 +0100
commit3e1507a9547ac09b6ff4372123cde09f19218f3d (patch)
tree80afbf6c25ff3d0f82e7c2a5216c2fca287959a5 /libavcodec/mpegvideo_enc.c
parentf57665b3181d5cbed680754983d9a6fdc1bfec5f (diff)
avcodec/mjpegenc: Bypass the 2 pass encoding when optimal tables are not requested
This limits the bugs, speedloss and extra memory allocation to the case when optimal tables are needed. Fixes regressions with slice multi-threading Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index b1d8dae4b2..0e4cbe8682 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3942,8 +3942,9 @@ static int encode_picture(MpegEncContext *s, int picture_number)
s->last_bits= put_bits_count(&s->pb);
switch(s->out_format) {
case FMT_MJPEG:
- /* The MJPEG headers are printed after the initial encoding so that the
- * optimal huffman encoding can be found. */
+ if (CONFIG_MJPEG_ENCODER && s->huffman != HUFFMAN_TABLE_OPTIMAL)
+ ff_mjpeg_encode_picture_header(s->avctx, &s->pb, &s->intra_scantable,
+ s->pred, s->intra_matrix, s->chroma_intra_matrix);
break;
case FMT_H261:
if (CONFIG_H261_ENCODER)