[vlc-devel] [PATCH 1/6] nvdec: store pointer instead of index

Rémi Denis-Courmont remi at remlab.net
Thu Mar 26 13:25:40 CET 2020


Le keskiviikkona 25. maaliskuuta 2020, 19.57.37 EET 
quentin.chateau at deepskycorp.com a écrit :
> From: Quentin Chateau <quentin.chateau at deepskycorp.com>
> 
> ---
>  modules/hw/nvdec/nvdec.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
> index 76aec6a246..05a54c555d 100644
> --- a/modules/hw/nvdec/nvdec.c
> +++ b/modules/hw/nvdec/nvdec.c
> @@ -266,7 +266,7 @@ static int CUDAAPI HandleVideoSequence(void *p_opaque,
> CUVIDEOFORMAT *p_format) if (ret != VLC_SUCCESS ||
> p_sys->outputDevicePtr[i] == 0) goto clean_pics;
>              picture_resource_t res = {
> -                .p_sys = (void*)(uintptr_t)i,
> +                .p_sys = (void*)p_sys->outputDevicePtr[i],

It's always good to replace non portable int-to-pointer conversions, but why 
do you need the cast here then?

>              };
>              pics[i] = picture_NewFromResource( &p_dec->fmt_out.video, &res
> ); if (unlikely(pics[i] == NULL))
> @@ -391,8 +391,7 @@ static int CUDAAPI HandlePictureDisplay(void *p_opaque,
> CUVIDPARSERDISPINFO *p_d NVDecCtxDestroy, NVDecCtxClone,
>              p_sys->vctx_out,
>          };
> -        uintptr_t pool_idx = (uintptr_t)p_pic->p_sys;
> -        picctx->devicePtr = p_sys->outputDevicePtr[pool_idx];
> +        picctx->devicePtr = (CUdeviceptr)p_pic->p_sys;
>          picctx->bufferPitch = p_sys->outputPitch;
>          picctx->bufferHeight = p_sys->decoderHeight;


-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the vlc-devel mailing list