diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2025-07-04 18:51:59 +0200 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2025-07-11 17:49:58 +0200 |
commit | 3ce348063c9433e33a5cb1ac79ac1efa37c21621 (patch) | |
tree | 5e84dce2378daabe15bc9ea249a3a8a28a4618f3 | |
parent | 8304a1abc79a00b846be534bdc4056a11ded8e8e (diff) | |
download | ffmpeg-3ce348063c9433e33a5cb1ac79ac1efa37c21621.tar.gz |
avcodec/nvdec: switch to proper pixfmts on next major bump
-rw-r--r-- | libavcodec/cuviddec.c | 8 | ||||
-rw-r--r-- | libavcodec/nvdec.c | 16 | ||||
-rw-r--r-- | libavcodec/version_major.h | 2 | ||||
-rw-r--r-- | libavutil/hwcontext_cuda.c | 2 |
4 files changed, 28 insertions, 0 deletions
diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index 3437ee2109..9978642bf8 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -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); diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 3a71d9d97e..7c29f25718 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -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: diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h index 14e49f0e15..97e4e12065 100644 --- a/libavcodec/version_major.h +++ b/libavcodec/version_major.h @@ -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 diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c index ce2ded597f..10d3399537 100644 --- a/libavutil/hwcontext_cuda.c +++ b/libavutil/hwcontext_cuda.c @@ -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, |