[Libav-user] getting CUdeviceptr formats and data
Mathieu Prevot
mathieu.prevot at gmail.com
Sun Nov 17 21:57:49 EET 2024
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") ?
Am I posting at the right place, or should I go on SO ?
Many thanks + regards
Soleil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20241117/3a4aee07/attachment.htm>
More information about the Libav-user
mailing list