title: How to swap bit U with bit V in YUV format
body: <p>I want to swap the U and V bit in YUV format, from NV12</p>
  
  <pre><code>YYYYYYYY UVUV // each letter presents a bit
  </code></pre>
  
  <p>to NV21</p>
  
  <pre><code>YYYYYYYY VUVU
  </code></pre>
  
  <p>I leave the Y planar alone, and handle the U and V planar by the function below</p>
  
  <pre><code>uchar swap(uchar in) {
      uchar out = ((in &gt;&gt; 1) &amp; 0x55) | ((in &lt;&lt; 1) &amp; 0xaa);
      return out;
  }
  </code></pre>
  
  <p>But I cannot get the desired result, the colour of the output image still not correct.</p>
  
  <p>How can I swap U and V planar correctly?</p>