You've already forked FFmpeg
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:
@ -907,10 +907,18 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
|
|||||||
// Pick pixel format based on bit depth and chroma sampling.
|
// Pick pixel format based on bit depth and chroma sampling.
|
||||||
switch (probed_bit_depth) {
|
switch (probed_bit_depth) {
|
||||||
case 10:
|
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);
|
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;
|
break;
|
||||||
case 12:
|
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);
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P : (is_yuv422 ? AV_PIX_FMT_NV16 : AV_PIX_FMT_NV12);
|
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P : (is_yuv422 ? AV_PIX_FMT_NV16 : AV_PIX_FMT_NV12);
|
||||||
|
@ -755,7 +755,11 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
if (chroma_444) {
|
if (chroma_444) {
|
||||||
|
#if FF_API_NVDEC_OLD_PIX_FMTS
|
||||||
frames_ctx->sw_format = AV_PIX_FMT_YUV444P16;
|
frames_ctx->sw_format = AV_PIX_FMT_YUV444P16;
|
||||||
|
#else
|
||||||
|
frames_ctx->sw_format = AV_PIX_FMT_YUV444P10MSB;
|
||||||
|
#endif
|
||||||
#ifdef NVDEC_HAVE_422_SUPPORT
|
#ifdef NVDEC_HAVE_422_SUPPORT
|
||||||
} else if (cuvid_chroma_format == cudaVideoChromaFormat_422) {
|
} else if (cuvid_chroma_format == cudaVideoChromaFormat_422) {
|
||||||
frames_ctx->sw_format = AV_PIX_FMT_P210;
|
frames_ctx->sw_format = AV_PIX_FMT_P210;
|
||||||
@ -766,13 +770,25 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
if (chroma_444) {
|
if (chroma_444) {
|
||||||
|
#if FF_API_NVDEC_OLD_PIX_FMTS
|
||||||
frames_ctx->sw_format = AV_PIX_FMT_YUV444P16;
|
frames_ctx->sw_format = AV_PIX_FMT_YUV444P16;
|
||||||
|
#else
|
||||||
|
frames_ctx->sw_format = AV_PIX_FMT_YUV444P12MSB;
|
||||||
|
#endif
|
||||||
#ifdef NVDEC_HAVE_422_SUPPORT
|
#ifdef NVDEC_HAVE_422_SUPPORT
|
||||||
} else if (cuvid_chroma_format == cudaVideoChromaFormat_422) {
|
} else if (cuvid_chroma_format == cudaVideoChromaFormat_422) {
|
||||||
|
#if FF_API_NVDEC_OLD_PIX_FMTS
|
||||||
frames_ctx->sw_format = AV_PIX_FMT_P216;
|
frames_ctx->sw_format = AV_PIX_FMT_P216;
|
||||||
|
#else
|
||||||
|
frames_ctx->sw_format = AV_PIX_FMT_P212;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#if FF_API_NVDEC_OLD_PIX_FMTS
|
||||||
frames_ctx->sw_format = AV_PIX_FMT_P016;
|
frames_ctx->sw_format = AV_PIX_FMT_P016;
|
||||||
|
#else
|
||||||
|
frames_ctx->sw_format = AV_PIX_FMT_P012;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
|
#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
|
||||||
#define FF_API_EXR_GAMMA (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
|
// reminder to remove the OMX encoder on next major bump
|
||||||
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
|
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
|
||||||
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
|
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
|
||||||
|
@ -50,6 +50,8 @@ static const enum AVPixelFormat supported_formats[] = {
|
|||||||
AV_PIX_FMT_P016,
|
AV_PIX_FMT_P016,
|
||||||
AV_PIX_FMT_P210,
|
AV_PIX_FMT_P210,
|
||||||
AV_PIX_FMT_P216,
|
AV_PIX_FMT_P216,
|
||||||
|
AV_PIX_FMT_YUV444P10MSB,
|
||||||
|
AV_PIX_FMT_YUV444P12MSB,
|
||||||
AV_PIX_FMT_YUV444P16,
|
AV_PIX_FMT_YUV444P16,
|
||||||
AV_PIX_FMT_0RGB32,
|
AV_PIX_FMT_0RGB32,
|
||||||
AV_PIX_FMT_0BGR32,
|
AV_PIX_FMT_0BGR32,
|
||||||
|
Reference in New Issue
Block a user