AVFrame, height of picture in in planar pixel formats

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

AVFrame, height of picture in in planar pixel formats

Zdenek Travnicek
Hello,

I was wondering if there's a way to tell the height of picture in a plane in
arbitrary pixel format.

I need to convert data in arbitrary pixel format into continuous memory
area, transfer to other place in my application and recreate the original
planes.
I can 'planarize' the data using avpicture_layout, but I can't find a way,
how to tell the offsets of individual planes in the newly created memory
area. I can, of course, write big switch() to tell which format it is and
have it hardcoded in the code (ie. for YUV420P make the first plane at
picture's height and for 2 subsequent planes it's half of this value.) But I
would like to have more universal method, is there any? I noticed PixFmtInfo
in imgconvert.c, but it is not exported as part of API, AFAIK.
Information from PixFmtInfo would be enough. Or function like:
make_planes(uint8_t *, int width, int heigh, PixelFormat, AVPicture) that
just sets the appropriate pointers and values in AVPicture.

Thanks for any hints, I'm sure I just overlooked an obvious solution and
doing things in unnecessarily complicated way ;)

Sincerely
Zdenek Travnicek
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: AVFrame, height of picture in in planar pixel formats

Michel Bardiaux-2
Zdenek Travnicek wrote:

> Hello,
>
> I was wondering if there's a way to tell the height of picture in a plane in
> arbitrary pixel format.
>
> I need to convert data in arbitrary pixel format into continuous memory
> area, transfer to other place in my application and recreate the original
> planes.
> I can 'planarize' the data using avpicture_layout, but I can't find a way,
> how to tell the offsets of individual planes in the newly created memory
> area. I can, of course, write big switch() to tell which format it is and
> have it hardcoded in the code (ie. for YUV420P make the first plane at
> picture's height and for 2 subsequent planes it's half of this value.) But I
> would like to have more universal method, is there any? I noticed PixFmtInfo
> in imgconvert.c, but it is not exported as part of API, AFAIK.
> Information from PixFmtInfo would be enough. Or function like:
> make_planes(uint8_t *, int width, int heigh, PixelFormat, AVPicture) that
> just sets the appropriate pointers and values in AVPicture.
>
> Thanks for any hints, I'm sure I just overlooked an obvious solution and
> doing things in unnecessarily complicated way ;)
>
See avpicture_fill or avpicture_layout

_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: AVFrame, height of picture in in planar pixel formats

Zdenek Travnicek
2008/6/17 Michel Bardiaux <[hidden email]>:

>
> See avpicture_fill or avpicture_layout
>

Yep, I knew it's this simple ;)
Thanks a lot for pointing me to the right direction.

Sincerely
Zdenek Travnicek
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user