Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In case the image is yuv420 planar, this is how the image data is encoded. Planar meaning the y section is first, followed by U section and then with V section.</p> <p>Considering the width of the image w, and height of the image h.</p> <ol> <li><p>The total size of the image is w*h*3/2</p></li> <li><p>The Y section also called luminescence occupies w*h.</p></li> <li><p>there is a U pixel and V pixel for every 2x2 block in Y section.</p></li> <li><p>the U section comes next, occupies (w/2)*(h/2) and is laid at an offset w*h from beginning of the image.</p></li> <li><p>the V section follows, occupies (w/2)*(h/2) and is laid at an offset of (w*h)+((w*h)/4).</p></li> </ol> <p>In order to rotate the image by 90 degrees, you essentially copy this w*h array to an array of h*w</p> <p>As mentioned in above post, you simply need to copy each of the 3 above Y, U, V blocks separately.</p> <ol> <li><p>Start with the Y section. The 1st pixel to be copied is at (h-1)*w in Source Array, copy this to (0,0) of destination array. The 2nd pixel is at (h-2)*w and so on...</p></li> <li><p>Remember that the U and V sections are only (w/2)*(h/2)</p></li> <li><p>Next copy the U section. The first pixel to be copied is at (w*h)+(((h/2)-1)*(w/2)) in Source Array, copy this to (h*w)+(0,0) in the Destination Array. The 2nd pixel is at (w*h)+(((h/2)-2)*(w/2)) and so on...</p></li> <li><p>Finally copy the V section. The first pixel to be copied is at ((w*h)+(w*h/4))+(((h/2)-1)*(w/2)) in Source Array, copy this to (h*w)+(w*h/4)+(0,0) in the Destination Array. The 2nd pixel is at ((w*h)+(w*h/4))+(((h/2)-2)*(w/2)) and so on...</p></li> </ol> <p>The Destination Array obtained in this way contains the 90 degree rotated image.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload