2018-04-23 8:16 GMT+03:00 Sampsa Riikonen <[email protected]>: > Dear List, > > I am decoding H264 into YUV and using the YUV bitmaps in a custom > application. > > For av pixel formats > > AV_PIX_FMT_YUV420P > > AV_PIX_FMT_YUVJ420P > > I calculate the number of bytes in each plane like this (av_frame is > AVFrame*): > > y_size =(GLsizei)( (av_frame->height)*(av_frame->linesize[0]) ); > u_size =(GLsizei)( (av_frame->height/2)*(av_frame->linesize[1]) ); > v_size =(GLsizei)( (av_frame->height/2)*(av_frame->linesize[2]) ); > > Question 1: Is there a more "standard" way of doing this? Here I am using > "outside" information by assuming that "height/2". Can I get the number of > bytes in each plane (safely) somewhere from the AVCodecContext or AVFrame > structures directly? > > Then, accessing the data itself: > > av_frame->data[0] has y_size bytes > > av_frame->data[1] has u_size bytes > > av_frame->data[2] has v_size bytes > > Question 2: Can I assume that data[0]..data[2] is a continuous block of > memory? > > Regards, > > Sampsa > > > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user >
Take a look at av_image_fill_arrays and other imgutils.h functions. Also av_pix_fmt_desc_get.
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
