summaryrefslogtreecommitdiff
path: root/libavcodec/mjpegenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-21 23:14:29 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-04 16:28:54 +0100
commit4d39a4db68b564c359c0c561e456b75f755b901f (patch)
tree42ed39dda8cf2efc38cf819d5b572eefc261414b /libavcodec/mjpegenc.c
parent26e117a14dca123e00237e471abf9aa3e5eea812 (diff)
avcodec/mpegvideo_enc: Move MJPEG init checks to mjpegenc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mjpegenc.c')
-rw-r--r--libavcodec/mjpegenc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index c4c45c885b..57f249f56e 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -276,6 +276,16 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
av_assert0(s->slice_context_count == 1);
+ if (s->codec_id == AV_CODEC_ID_AMV || (s->avctx->active_thread_type & FF_THREAD_SLICE))
+ s->huffman = 0;
+
+ if (s->mpv_flags & FF_MPV_FLAG_QP_RD) {
+ // Used to produce garbage with MJPEG.
+ av_log(s->avctx, AV_LOG_ERROR,
+ "QP RD is no longer compatible with MJPEG or AMV\n");
+ return AVERROR(EINVAL);
+ }
+
/* The following check is automatically true for AMV,
* but it doesn't hurt either. */
ret = ff_mjpeg_encode_check_pix_fmt(s->avctx);