<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 10 avr. 2019 à 11:57, Paul B Mahol <<a href="mailto:onemda@gmail.com">onemda@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">On 4/10/19, Boris <<a href="mailto:ndjoreboris@gmail.com" target="_blank">ndjoreboris@gmail.com</a>> wrote:<br>
> Le mar. 9 avr. 2019 à 17:44, Simon Brown <<a href="mailto:simon.k.brown@gmail.com" target="_blank">simon.k.brown@gmail.com</a>> a écrit<br>
> :<br>
><br>
>><br>
>>> Thanks,<br>
>>> If I understand what you said, I have to proccess like this :<br>
>>><br>
>>> //Declaration of yuv arrays<br>
>>> uint16_t yval[mb_height * mb_width][256];<br>
>>> uint16_t uval[mb_height * mb_width][256];<br>
>>> uint16_t vval[mb_height * mb_width][256];<br>
>>><br>
>>> for(int mby=0;  mby<mb_height; mby++)<br>
>>> {<br>
>>>          for(int mbx=0; mbx <mb_width ;mbx++)<br>
>>>          {<br>
>>>              //Now for this 16x16 macroblock<br>
>>>             for(int y=0; y<16;y++)<br>
>>>             {<br>
>>>                for(int x=0; x<16;x++)<br>
>>>                {<br>
>>>                  yval[mby*mb_width + mbx][y*16+x] =<br>
>>> data[0][linesize[0]*y*16+x]; or yval[mby*mb_width + mbx][y*16+x] =<br>
>>> data[0][y*16+x]???<br>
>>>                  uval[mby*mb_width + mbx][(y/2)*16+x/2] =<br>
>>> data[1][linesize[1]*(y/2)*16+x/2];<br>
>>>                  uval[mby*mb_width + mbx][(y/2)*16+x/2] =<br>
>>> data[2][linesize[2]*(y/2)*16+x/2];<br>
>>>                //Setting of Yuv arrays<br>
>>><br>
>>>              }<br>
>>> }<br>
>>> //Let's go to  an other macroblock<br>
>>> }<br>
>>> }<br>
>>><br>
>>> Regards<br>
>>><br>
>>>><br>
>>>> Not quite - the data in data[0] is arranged by pixels, so your<br>
>> coordinate into that array must include all the pixels, not just the<br>
>> current macroblock.  So you need:<br>
>> yval[mby*mb_width + mbx][y*16+x] = data[0][ linesize[0]*(mby*16 + y) +<br>
>> (mbx*16 + x) ]<br>
>> so you skip all lines up to the one you're processing, including all<br>
>> previous macroblocks and all lines already processed in the current<br>
>> macroblock using "linesize[0]*(mby*16 + y)" and then all the pixels in<br>
>> the<br>
>> current line up to the macroblock you're interested in, and any pixels<br>
>> already processed in that macroblock with "mbx*16 + x".<br>
>><br>
>> I hope that makes sense.<br>
>><br>
>> Regards,<br>
>> Simon<br>
>><br>
><br>
> Hello Simon,<br>
><br>
> I do like you tell me but data[0][ linesize[0]*(mby*16 + y) + (mbx*16 + x)<br>
> ] gives me some negatives pixel's values.<br>
> Is it normal ?<br>
> For exemple data[0][ linesize[0]*(mby*16 + y) + (mbx*16 + x) ] =<br>
>  -62<br>
> -65<br>
> -72<br>
> My question is to know if it is normal to have negatives pixel's value ( y<br>
> = -a; u=-b; v=-c) where a, b and c are integers.<br>
<br>
Doesn't make sense, post full code.<br></blockquote><div><br></div><div>Hello Paul,</div><div>The code is the following :</div><div>mbx and mby are x,y coordinate (position) of the macroblock in the frame , data is AVFrame frame->data and linesize is AVFrame frame->linesize</div><div>Then : </div><div> for(int y=0; y<16;y++) //run through the length of the 16x16 macroblock<br></div><div>            {<br>               for(int x=0; x<16;x++) ////run through the width of the 16x16 macroblock</div><div>                {  <br></div><div><span style="color:rgb(80,0,80)"> cout<<data[0][ linesize[0]*(mby*16 + y) + (mbx*16 + x) ]</span> <<endl;</div><div><br></div><div>}</div><div>}</div><div><br></div><div>So I still getting some negatives values. My question is to know if it's normal.</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>