Re: [FFmpeg-devel] [PATCH 1/6] avcodec: Remove redundant pix_fmts from decoders
Andreas Rheinhardt: > AVCodec.pix_fmts is only intended for encoders (decoders use > the get_format callback to let the user choose a pix fmt). > So remove them for the decoders for which this is possible > without further complications; keep them for now in the codecs > that actually use them (by passing avctx->codec->pix_fmts to > ff_get_formatt()). > > Also notice that some of these lists were wrong; e.g. > 317b7b06fd97cd39feac7df57db22a30550351ff added support for YUV444P16 > for cuviddec, but forgot to add it to pix_fmts. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/crystalhd.c | 1 - > libavcodec/cuviddec.c | 5 - > libavcodec/flashsv.c | 2 -- > libavcodec/libdavs2.c | 2 -- > libavcodec/libuavs3d.c | 3 --- > libavcodec/qsvdec.c| 11 --- > libavcodec/rkmppdec.c | 2 -- > libavcodec/rv10.c | 8 > libavcodec/rv30.c | 4 > libavcodec/rv40.c | 4 > libavcodec/svq1dec.c | 2 -- > libavcodec/svq3.c | 2 -- > libavcodec/xfacedec.c | 1 - > 13 files changed, 47 deletions(-) > > diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c > index 86f6cfa6c1..fb190436f5 100644 > --- a/libavcodec/crystalhd.c > +++ b/libavcodec/crystalhd.c > @@ -797,7 +797,6 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, > AVFrame *frame) > .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | > AV_CODEC_CAP_HARDWARE, \ > .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \ >FF_CODEC_CAP_SETS_FRAME_PROPS, \ > -.p.pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, > AV_PIX_FMT_NONE}, \ > .p.wrapper_name = "crystalhd", \ > }; > > diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c > index da37207cf2..84edf5c209 100644 > --- a/libavcodec/cuviddec.c > +++ b/libavcodec/cuviddec.c > @@ -1174,11 +1174,6 @@ static const AVCodecHWConfigInternal *const > cuvid_hw_configs[] = { > .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | > AV_CODEC_CAP_HARDWARE, \ > .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \ >FF_CODEC_CAP_SETS_FRAME_PROPS, \ > -.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_CUDA, \ > -AV_PIX_FMT_NV12, \ > -AV_PIX_FMT_P010, \ > -AV_PIX_FMT_P016, \ > -AV_PIX_FMT_NONE }, \ > .hw_configs = cuvid_hw_configs, \ > .p.wrapper_name = "cuvid", \ > }; > diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c > index 8a01e3a4b6..fe00e529a5 100644 > --- a/libavcodec/flashsv.c > +++ b/libavcodec/flashsv.c > @@ -511,7 +511,6 @@ const FFCodec ff_flashsv_decoder = { > FF_CODEC_DECODE_CB(flashsv_decode_frame), > .p.capabilities = AV_CODEC_CAP_DR1, > .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, > -.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, > AV_PIX_FMT_NONE }, > }; > #endif /* CONFIG_FLASHSV_DECODER */ > > @@ -579,6 +578,5 @@ const FFCodec ff_flashsv2_decoder = { > FF_CODEC_DECODE_CB(flashsv_decode_frame), > .p.capabilities = AV_CODEC_CAP_DR1, > .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, > -.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, > AV_PIX_FMT_NONE }, > }; > #endif /* CONFIG_FLASHSV2_DECODER */ > diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c > index 179d2f4e4b..5a605c36f6 100644 > --- a/libavcodec/libdavs2.c > +++ b/libavcodec/libdavs2.c > @@ -234,7 +234,5 @@ const FFCodec ff_libdavs2_decoder = { > .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS, > .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | >FF_CODEC_CAP_AUTO_THREADS, > -.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, > - AV_PIX_FMT_NONE }, > .p.wrapper_name = "libdavs2", > }; > diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c > index 66e8d31001..f5d47f28ed 100644 > --- a/libavcodec/libuavs3d.c > +++ b/libavcodec/libuavs3d.c > @@ -274,8 +274,5 @@ const FFCodec ff_libuavs3d_decoder = { > .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | >FF_CODEC_CAP_AUTO_THREADS, > .flush = libuavs3d_flush, > -.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, > - AV_PIX_FMT_YUV420P10LE, > - AV_PIX_FMT_NONE }, > .p.wrapper_name = "libuavs3d", > }; > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c > index 559f63698a..812bfd8830 100644 > --- a/libavcodec/qsvdec.c > +++ b/libavcodec/qsvdec.c > @@ -1127,17 +1127,6 @@ co
[FFmpeg-devel] [PATCH 1/6] avcodec: Remove redundant pix_fmts from decoders
AVCodec.pix_fmts is only intended for encoders (decoders use the get_format callback to let the user choose a pix fmt). So remove them for the decoders for which this is possible without further complications; keep them for now in the codecs that actually use them (by passing avctx->codec->pix_fmts to ff_get_formatt()). Also notice that some of these lists were wrong; e.g. 317b7b06fd97cd39feac7df57db22a30550351ff added support for YUV444P16 for cuviddec, but forgot to add it to pix_fmts. Signed-off-by: Andreas Rheinhardt --- libavcodec/crystalhd.c | 1 - libavcodec/cuviddec.c | 5 - libavcodec/flashsv.c | 2 -- libavcodec/libdavs2.c | 2 -- libavcodec/libuavs3d.c | 3 --- libavcodec/qsvdec.c| 11 --- libavcodec/rkmppdec.c | 2 -- libavcodec/rv10.c | 8 libavcodec/rv30.c | 4 libavcodec/rv40.c | 4 libavcodec/svq1dec.c | 2 -- libavcodec/svq3.c | 2 -- libavcodec/xfacedec.c | 1 - 13 files changed, 47 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 86f6cfa6c1..fb190436f5 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -797,7 +797,6 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame) .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \ FF_CODEC_CAP_SETS_FRAME_PROPS, \ -.p.pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, \ .p.wrapper_name = "crystalhd", \ }; diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index da37207cf2..84edf5c209 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -1174,11 +1174,6 @@ static const AVCodecHWConfigInternal *const cuvid_hw_configs[] = { .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \ FF_CODEC_CAP_SETS_FRAME_PROPS, \ -.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_CUDA, \ -AV_PIX_FMT_NV12, \ -AV_PIX_FMT_P010, \ -AV_PIX_FMT_P016, \ -AV_PIX_FMT_NONE }, \ .hw_configs = cuvid_hw_configs, \ .p.wrapper_name = "cuvid", \ }; diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 8a01e3a4b6..fe00e529a5 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -511,7 +511,6 @@ const FFCodec ff_flashsv_decoder = { FF_CODEC_DECODE_CB(flashsv_decode_frame), .p.capabilities = AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, -.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }, }; #endif /* CONFIG_FLASHSV_DECODER */ @@ -579,6 +578,5 @@ const FFCodec ff_flashsv2_decoder = { FF_CODEC_DECODE_CB(flashsv_decode_frame), .p.capabilities = AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, -.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }, }; #endif /* CONFIG_FLASHSV2_DECODER */ diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index 179d2f4e4b..5a605c36f6 100644 --- a/libavcodec/libdavs2.c +++ b/libavcodec/libdavs2.c @@ -234,7 +234,5 @@ const FFCodec ff_libdavs2_decoder = { .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS, .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_AUTO_THREADS, -.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE }, .p.wrapper_name = "libdavs2", }; diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c index 66e8d31001..f5d47f28ed 100644 --- a/libavcodec/libuavs3d.c +++ b/libavcodec/libuavs3d.c @@ -274,8 +274,5 @@ const FFCodec ff_libuavs3d_decoder = { .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_AUTO_THREADS, .flush = libuavs3d_flush, -.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUV420P10LE, - AV_PIX_FMT_NONE }, .p.wrapper_name = "libuavs3d", }; diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 559f63698a..812bfd8830 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -1127,17 +1127,6 @@ const FFCodec ff_##x##_qsv_decoder = { \ .bsfs = bsf_name, \ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HYBRID, \ .p.priv_class = &x##_qsv_class, \ -.p.pix_f