diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-06 03:01:14 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-10 03:48:41 +0200 |
commit | 059fc2d9da5364627613fb3e6424079e14dbdfd3 (patch) | |
tree | ed91afb8711dd2a9f62327cdad8deda50b07f2f7 /libavcodec/mjpegenc.c | |
parent | 48cda7d02b768d965db6582271a2f8591f2a3a10 (diff) | |
download | ffmpeg-059fc2d9da5364627613fb3e6424079e14dbdfd3.tar.gz |
avcodec/mjpegenc: Include all supported pix_fmts in mpegenc pix_fmts
Currently said list contains only the pixel formats that are always
supported irrespective of the range and the value of
strict_std_compliance. This makes the MJPEG encoder an outlier as all
other codecs put all potentially supported pixel formats into said list
and error out if the chosen pixel format is unsupported. This commit
brings it therefore in line with the other encoders.
The behaviour of fftools/ffmpeg_filter.c has been preserved. A more
informed decision would be possible if colour range were available
at this point, but it isn't.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mjpegenc.c')
-rw-r--r-- | libavcodec/mjpegenc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index e5d2e24d66..3cff50abdb 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -261,9 +261,16 @@ static int alloc_huffman(MpegEncContext *s) av_cold int ff_mjpeg_encode_init(MpegEncContext *s) { MJpegContext *m; + int ret; av_assert0(s->slice_context_count == 1); + /* The following check is automatically true for AMV, + * but it doesn't hurt either. */ + ret = ff_mjpeg_encode_check_pix_fmt(s->avctx); + if (ret < 0) + return ret; + if (s->width > 65500 || s->height > 65500) { av_log(s, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n"); return AVERROR(EINVAL); @@ -609,7 +616,9 @@ AVCodec ff_mjpeg_encoder = { .capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE + AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, + AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_NONE }, .priv_class = &mjpeg_class, .profiles = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles), |