[Libav-user] Help : YUV value for a macroblock in a yuv240p frame

Simon Brown simon.k.brown at gmail.com
Tue Apr 9 16:53:45 EEST 2019

On Tue, 9 Apr 2019 at 14:43, NDJORE BORIS <ndjoreboris at gmail.com> wrote:

> Thank you simon.
> You probably right. The first loop is to obten all macroblock in the frame
> and the second is to optain each pixel in the macroblock, I thinked.
> But in what you gave if I do this for two different block, I think that I
> will obtain the same value for "y".
> Can you explain me  how can I do to obtain different "y" value for each
> macroblock if I'm wrong , please?
> Regards
>> So the first loop needs to be:
for (int mby=0 ; mby< mb_height ; mby++) {

and similarly for mbx.
Then you can declare outside of the loop an array for yval, uval and vval
(I notice now that you also use variable y for the y pixel value, rather
than just the inner loop counter!):
uint16_t yval[mb_height * mb_width][256];
and then set:
yval[mby*mb_width + mbx][y*16+x] = data[0][.....];
Then yval[0] would have an array of 256 values for Y for the first
macroblock, and yval[1] would have 256 values for Y for the second
If you want an average Y, U and V value then you can always sum inside the
loop and divide by 256, and then just store one value for yval[0] rather
than 256.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190409/9ab9bc35/attachment.html>

More information about the Libav-user mailing list