History

avcodec/mpegvideo_enc: Remove redundant pixel format checks

All encoders using ff_mpv_encode_init() already have pix_fmts set so that the pixel format is already checked in ff_encode_preinit(). The one exception to this is MJPEG whose check remains. (Btw: The AVCodec.pix_fmts check for AMV is stricter than the check in ff_mpv_encode_init().)

Andreas Rheinhardt committed 5 years ago

Commit 159bcb11 parent d0dcfae1 file · +0 −23Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/mpegvideo_enc.c+0−23
@@ -302,16 +302,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 301 unmodified lines
302302 mpv_encode_defaults(s);
303303
304304 switch (avctx->codec_id) {
305− case AV_CODEC_ID_MPEG2VIDEO:
306− if (avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
307− avctx->pix_fmt != AV_PIX_FMT_YUV422P) {
308− av_log(avctx, AV_LOG_ERROR,
309− "only YUV420 and YUV422 are supported\n");
310− return AVERROR(EINVAL);
311− }
312− break;
313305 case AV_CODEC_ID_MJPEG:
314− case AV_CODEC_ID_AMV:
315306 format_supported = 0;
316307 /* JPEG color space */
317308 if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
@@ -334,20 +325,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 16 unmodified lines
334325 return AVERROR(EINVAL);
335326 }
336327 break;
337− case AV_CODEC_ID_SPEEDHQ:
338− if (avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
339− avctx->pix_fmt != AV_PIX_FMT_YUV422P &&
340− avctx->pix_fmt != AV_PIX_FMT_YUV444P) {
341− av_log(avctx, AV_LOG_ERROR,
342− "only YUV420/YUV422/YUV444 are supported (no alpha support yet)\n");
343− return AVERROR(EINVAL);
344− }
345− break;
346− default:
347− if (avctx->pix_fmt != AV_PIX_FMT_YUV420P) {
348− av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n");
349− return AVERROR(EINVAL);
350− }
351328 }
352329
353330 switch (avctx->pix_fmt) {

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