[Libav-user] getting CUdeviceptr formats and data
Mathieu Prevot
mathieu.prevot at gmail.com
Wed Nov 20 19:03:58 EET 2024
Le mar. 19 nov. 2024 à 00:39, Mathieu Prevot <mathieu.prevot at gmail.com> a
écrit :
>
>
> Le dim. 17 nov. 2024 à 20:57, Mathieu Prevot <mathieu.prevot at gmail.com> a
> écrit :
>
>> Hello,
>>
>> I am using code, based on
>> https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/hw_decode.c,
>> but I am not transferring the decoded data to the host, I keep it on the
>> device for later use with cuda code (my goal will be to use RGB 8-12 bits
>> per channel data).
>>
>> I could not find a way to get the data format
>> ((AVPixelFormat)frame->format translates to: "HW acceleration through CUDA.
>> data[i] contain CUdeviceptr pointers exactly as for system memory frames.")
>>
>> I understand that I have two arrays: frame->data[0] and frame->data[1].
>>
>> I would like to translate the data into a cuda native structure like:
>>
>> cudaPitchedPtr CUdeviceptr{};
>> CUdeviceptr.ptr = frame->data[0];
>> CUdeviceptr.ysize = frame->height;
>> CUdeviceptr.xsize = frame->width;
>>
>> Which is probably wrong, since width==1920 height==1080 and should have
>> colors or YUV data.
>>
>> How to get to know the data format (RGB, BGR, YUV, 8/10/12bits per
>> channel etc) and the size of the array ?
>> If it is not RGB8 (or 10-12), can I get that through some ffmpeg
>> implementation, maybe with an nvdec based function ?
>> What is the correct cuda-native data ? cudaPitchedPtr or something else ?
>> frame->data[0] is uint8_t, but the array is probably something else in
>> the general case; so what is it (as redundancy or extension of "what is the
>> data format") ?
>>
>
> It seems that frame->data[0] is the Y component of YUV, if not, one of
> RGB channels, but I could not figure out what frame->data[1] is.
> Can someone confirm ?
>
I got no answer from libav-user@, maybe is it a question for ffmpeg-devel@
(not subscribed, please cc) ?
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20241120/79e4e2a8/attachment.htm>
More information about the Libav-user
mailing list