<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 9 avr. 2019 à 15:54, Simon Brown <<a href="mailto:simon.k.brown@gmail.com">simon.k.brown@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 9 Apr 2019 at 14:43, NDJORE BORIS <<a href="mailto:ndjoreboris@gmail.com" target="_blank">ndjoreboris@gmail.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><div>Thank you simon.</div><div><br></div><div>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.</div><div>But in what you gave if I do this for two different block, I think that I will obtain the same value for "y".</div><div>Can you explain me  how can I do to obtain different "y" value for each macroblock if I'm wrong , please?</div><div><br></div><div>Regards  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br></blockquote></div></div></blockquote><div>So the first loop needs to be:</div><div>for (int mby=0 ; mby< mb_height ; mby++) {</div><div><br></div><div>and similarly for mbx.</div><div>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!):</div><div>uint16_t yval[mb_height * mb_width][256];</div><div>and then set:</div><div>yval[mby*mb_width + mbx][y*16+x] = data[0][.....];</div><div>etc.</div><div>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 macroblock.</div><div>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.</div><div><br></div><div>Regards,</div><div>Simon</div></div></div></blockquote><div><br></div><div><br></div><div>Thanks,</div><div>If I understand what you said, I have to proccess like this :</div><div><br></div><div>//Declaration of yuv arrays</div><div>uint16_t yval[mb_height * mb_width][256]; </div><div>uint16_t uval[mb_height * mb_width][256];</div><div>uint16_t vval[mb_height * mb_width][256]; <br></div><div><br></div><div>for(int mby=0;  mby<mb_height; mby++)</div><div>{</div><div>         for(int mbx=0; mbx <mb_width ;mbx++)</div><div>         {</div><div>             //Now for this 16x16 macroblock</div><div>            for(int y=0; y<16;y++)</div><div>            {</div><div>               for(int x=0; x<16;x++)</div><div>               {</div><div>                 yval[mby*mb_width + mbx][y*16+x] = data[0][linesize[0]*y*16+x]; or yval[mby*mb_width + mbx][y*16+x] = data[0][y*16+x]???</div><div>                 uval[mby*mb_width + mbx][(y/2)*16+x/2] = data[1][linesize[1]*(y/2)*16+x/2];</div><div>                 uval[mby*mb_width + mbx][(y/2)*16+x/2] = data[2][linesize[2]*(y/2)*16+x/2];</div><div>               //Setting of Yuv arrays</div><div>           </div><div>             }</div><div>}</div><div>//Let's go to  an other macroblock</div><div>}</div><div>} </div><div><br></div><div>Regards</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div>