1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/nvdec: switch to proper pixfmts on next major bump

This commit is contained in:
Timo Rothenpieler
2025-07-04 18:51:59 +02:00
parent 8304a1abc7
commit 3ce348063c
4 changed files with 28 additions and 0 deletions

View File

@ -907,10 +907,18 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
// Pick pixel format based on bit depth and chroma sampling.
switch (probed_bit_depth) {
case 10:
#if FF_API_NVDEC_OLD_PIX_FMTS
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P16 : (is_yuv422 ? AV_PIX_FMT_P216 : AV_PIX_FMT_P010);
#else
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P10MSB : (is_yuv422 ? AV_PIX_FMT_P210 : AV_PIX_FMT_P010);
#endif
break;
case 12:
#if FF_API_NVDEC_OLD_PIX_FMTS
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P16 : (is_yuv422 ? AV_PIX_FMT_P216 : AV_PIX_FMT_P016);
#else
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P12MSB : (is_yuv422 ? AV_PIX_FMT_P212 : AV_PIX_FMT_P012);
#endif
break;
default:
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P : (is_yuv422 ? AV_PIX_FMT_NV16 : AV_PIX_FMT_NV12);

View File

@ -755,7 +755,11 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
break;
case 10:
if (chroma_444) {
#if FF_API_NVDEC_OLD_PIX_FMTS
frames_ctx->sw_format = AV_PIX_FMT_YUV444P16;
#else
frames_ctx->sw_format = AV_PIX_FMT_YUV444P10MSB;
#endif
#ifdef NVDEC_HAVE_422_SUPPORT
} else if (cuvid_chroma_format == cudaVideoChromaFormat_422) {
frames_ctx->sw_format = AV_PIX_FMT_P210;
@ -766,13 +770,25 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
break;
case 12:
if (chroma_444) {
#if FF_API_NVDEC_OLD_PIX_FMTS
frames_ctx->sw_format = AV_PIX_FMT_YUV444P16;
#else
frames_ctx->sw_format = AV_PIX_FMT_YUV444P12MSB;
#endif
#ifdef NVDEC_HAVE_422_SUPPORT
} else if (cuvid_chroma_format == cudaVideoChromaFormat_422) {
#if FF_API_NVDEC_OLD_PIX_FMTS
frames_ctx->sw_format = AV_PIX_FMT_P216;
#else
frames_ctx->sw_format = AV_PIX_FMT_P212;
#endif
#endif
} else {
#if FF_API_NVDEC_OLD_PIX_FMTS
frames_ctx->sw_format = AV_PIX_FMT_P016;
#else
frames_ctx->sw_format = AV_PIX_FMT_P012;
#endif
}
break;
default:

View File

@ -43,6 +43,8 @@
#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove the OMX encoder on next major bump
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump

View File

@ -50,6 +50,8 @@ static const enum AVPixelFormat supported_formats[] = {
AV_PIX_FMT_P016,
AV_PIX_FMT_P210,
AV_PIX_FMT_P216,
AV_PIX_FMT_YUV444P10MSB,
AV_PIX_FMT_YUV444P12MSB,
AV_PIX_FMT_YUV444P16,
AV_PIX_FMT_0RGB32,
AV_PIX_FMT_0BGR32,