[Libav-user] Help with unpacking PIX_FMT_YUV4* data types

Ricky Huang rhuang.work at gmail.com
Wed Mar 12 01:55:34 CET 2014


On Mar 11, 2014, at 5:03 PM, wm4 <nfxjfg at googlemail.com> wrote:

> On Mon, 10 Mar 2014 18:32:54 -0700
> Ricky Huang <rhuang.work at gmail.com> wrote:
> 
>>>>> AVFilterBufferRef *cur_pic = link->cur_buf;
>>>>> uint8_t *data = cur_pic->data[0];
>>> 
>>> I think this functionality was removed long ago. You're supposed to
>>> write/read AVFrames from the filters.
>> 
>> Due to internal reasons, we are running ffmpeg 0.7, so the primary arguments to draw_slice() is AVFilterLink*.  Sorry I should have specified that when asked the question.
> 
> Sure is ancient...
> 
>> Or maybe I am missing something obvious here?  Can you help me out with how to use AVFrame to extract the luminance component?
> 
> AVFrame works similar to AVFilterBufferRef. Assuming the data member
> contains the plane pointers, data[0] will contain the plane with the
> luminance data.

Thank you for responding, wm4.  Let's use this from pixfmt.h header file as an example:

    PIX_FMT_YUV420P,   ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)

Does that mean I should read in the luminance plane 2 bytes at a time and interpret it as a number together?  The reason I ask that is because the linesize of data[0] is twice as wide as data[1] or data[2] (720 vs 368 and 368, respectively).  Also the data point is declared as "uint8_t *", how does one determine how to interpret the type of the value - int, float, etc?

Thank you again!


> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140311/7c1fcfc3/attachment.html>


More information about the Libav-user mailing list