[vlc-devel] [PATCH 1/2] nvdec: add chroma and depth fallback

Steve Lhomme robux4 at ycbcr.xyz
Tue Apr 7 08:32:15 CEST 2020


On 2020-04-07 8:16, Quentin Chateau wrote:
> Hi,
> 
> I agree, though I am trying to play 4K 12bits videos so the fallback to 
> CPU decoding does not help much.

libavcodec might also fallback to DXVA/VAAPI/VDPAU. They may support 12 
bits with the NVIDIA or other hardware when NVDEC doesn't.

> I'm fine with adding some sort of "if forced" condition to this commit 
> but I'm not sure how to detect it. Can you point me in the right direction ?

You can use the vlc_object_t.force value.

> On Apr 7, 2020, at 07:56, Steve Lhomme <robux4 at ycbcr.xyz 
> <mailto:robux4 at ycbcr.xyz>> wrote:
> 
>     On the other hand we may use this "delayed" behavior if nvdec is the
>     forced decoder. But that's not how most people are going to use it.
> 
>     On 2020-04-07 7:52, Steve Lhomme wrote:
> 
>         I don't think this is correct. If we can't tell the video format
>         during
>         Open, there is no way to tell if we will be able to decode the
>         stream or
>         not. So we may be selected as the decoder but in the end we
>         can't decode
>         the video. At this point it's too late to fallback to a more
>         suitable
>         decoder (libavcodec).
> 
>         That's a drawback of the nvdec decoder until we can restart
>         decoders
>         without losing data for the next decoder (if that ever happens).
>         That's
>         also a reason why nvdec can have a higher priority than libavcodec,
>         because it will fallback properly.
> 
>         On 2020-04-06 15:02, quentin.chateau at deepskycorp.com wrote:
> 
>             From: Quentin Chateau <quentin.chateau at deepskycorp.com>
> 
>             When the chroma and depth is unknown to the hxxx_helper,
>             fallback to the common 4:2:0 8bits format as initial value.
>             The decoder may change these values later on.
>             ---
>                modules/hw/nvdec/nvdec.c | 20 ++++++++++++--------
>                1 file changed, 12 insertions(+), 8 deletions(-)
> 
>             diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
>             index e3aeff2355..ca28522d32 100644
>             --- a/modules/hw/nvdec/nvdec.c
>             +++ b/modules/hw/nvdec/nvdec.c
>             @@ -923,15 +923,19 @@ static int OpenDecoder(vlc_object_t
>             *p_this)
>                    // try different output
>                    if (p_sys->b_is_hxxx)
>                    {
>             -        uint8_t i_chroma_idc, i_depth_chroma;
>             -        result = hxxx_helper_get_chroma_chroma(&p_sys->hh,
>             &i_chroma_idc,
>             -                                            &i_depth_luma,
>             &i_depth_chroma);
>             -        if (result != VLC_SUCCESS) {
>             -            if (p_sys->b_is_hxxx)
>             -                hxxx_helper_clean(&p_sys->hh);
>             -            return VLC_EGENERIC;
>             +        uint8_t hxxx_chroma_idc, hxxx_depth_chroma,
>             hxxx_depth_luma;
>             +        result = hxxx_helper_get_chroma_chroma(&p_sys->hh,
>             &hxxx_chroma_idc,
>             +                                            &hxxx_depth_luma,
>             &hxxx_depth_chroma);
>             +        if (result == VLC_SUCCESS)
>             +        {
>             +            i_depth_luma = hxxx_depth_luma;
>             +            cudaChroma = MapChomaIDC(hxxx_chroma_idc);
>             +        }
>             +        else
>             +        {
>             +            cudaChroma = cudaVideoChromaFormat_420;
>             +            i_depth_luma = 8;
>                        }
>             -        cudaChroma = MapChomaIDC(i_chroma_idc);
>                        unsigned i_w, i_h, i_vw, i_vh;
>                        result =
>             hxxx_helper_get_current_picture_size(&p_sys->hh,
>             &i_w, &i_h, &i_vw, &i_vh);
>             -- 
>             2.17.1
> 
>             ------------------------------------------------------------------------
> 
>             vlc-devel mailing list
>             To unsubscribe or modify your subscription options:
>             https://mailman.videolan.org/listinfo/vlc-devel
> 
> 
>         ------------------------------------------------------------------------
> 
>         vlc-devel mailing list
>         To unsubscribe or modify your subscription options:
>         https://mailman.videolan.org/listinfo/vlc-devel
> 
>     ------------------------------------------------------------------------
> 
>     vlc-devel mailing list
>     To unsubscribe or modify your subscription options:
>     https://mailman.videolan.org/listinfo/vlc-devel
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list