[FFmpeg-devel] [PATCH] avcodec/cuvidddec: Guess pixel format based on probed bit depth

Roman Arzumanyan r.arzumanyan at visionlabs.ai
Fri Aug 2 10:46:50 EEST 2024


Hi Timo,

> Why can't the application simply also look at the probed format?
It's certainly possible, but in my opinion it makes sense to improve the
codec behavior.
All required information is already there, why not return the correct value
?

> The 12 bit format should be AV_PIX_FMT_P016.
> Also, might as well take probe_desc->log2_chroma_w/log2_chroma_h into
account.
> If they're 0, it's 444, and the formats change to AV_PIX_FMT_YUV444P(16).
> Akin to the switch() on format->bit_depth_luma_minus8 in the probe
function.

Thanks, I'll fix and submit v.2 of the patch.


чт, 1 авг. 2024 г. в 21:14, Timo Rothenpieler <timo at rothenpieler.org>:

> On 01.08.2024 15:54, Roman Arzumanyan wrote:
> > Hello world,
> >
> > This patch adds a pixel format guess based on probed bit depth.
> > With current FFMpeg ToT, when the cuvid codec is opened, input sw_pix_fmt
> > is AV_PIX_FMT_NV12 until the first frame is decoded. Even if input has 10
> > or 12 bit depth, the format will be NV12 for some time.
> >
> > What's the need for this patch ?
> > Applications that rely on libavcodec will have a chance to calculate the
> > proper amount of vRAM required to store a reconstructed video frame
> before
> > decoding begins.
>
> The 12 bit format should be AV_PIX_FMT_P016.
> Also, might as well take probe_desc->log2_chroma_w/log2_chroma_h into
> account.
> If they're 0, it's 444, and the formats change to AV_PIX_FMT_YUV444P(16).
> Akin to the switch() on format->bit_depth_luma_minus8 in the probe
> function.
>
> Patch looks fine on first glance, though relying on a rather arbitrary
> second field there does not seem like a good idea to me.
> Why can't the application simply also look at the probed format?
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list