[Libav-user] Retrieve 10bit video frames

Dnegel X. dnegel666 at gmail.com
Thu May 17 13:43:00 CEST 2012


> > However, the decoded frameYUV->data is of type uint8_t, and I would
> > expect
> > to get something able to store 10bit values like a uint16_t. So, what is
> > returned in this 8bit array in this case? How can I proceed to get the
> > 10bit
> > values?
>
> Just cast the buffer.
>
> uint16_t* planes[3] = {(uint16_t*)frameYUV->data[0],
> (uint16_t*)frameYUV->data[1], (uint16_t*)frameYUV->data[2]};
>
> --Michael

Alright. I'm wondering if the part allocating space needs to be changed:
numBytes = avpicture_get_size(out, width, height);
buffer = (uint8_t *)av_malloc(numBytes*sizeof(uint8_t));

Is numBytes the number of uint8_t that can be cast to uint16_t, or
should I allocate numBytes*sizeof(uint16_t)?

--Nigel


More information about the Libav-user mailing list