title: SDL_LockTexture() returning an unexpected pitch value
body: <p>I'm displaying the Android Camera preview on a native app, using SDL2.0.7 (Nexus 5, armeabi-v7a, ndk 16.1).</p>
  
  <p>I'm using the <strong>N21</strong> YUV image format and I was expecting that, creating an <code>SDL_Texture</code> of that format, the <em>pitch</em> value returned by <code>SDL_LockTexture()</code> would be greater than what I'm getting right now.</p>
  
  <p>Sample code:</p>
  
  <pre><code>SDL_Texture *texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_NV21, SDL_TEXTUREACCESS_STREAMING, 720, 480);
  int res = SDL_LockTexture(texture, nullptr, &amp;pixels, &amp;pitch);
  </code></pre>
  
  <p><strong>I was expecting to get a pitch value of <code>720 * 12 / 8</code>, i.e. <code>1080</code></strong>, where <code>720</code> is the width of one row, <code>12</code> is the number of bits for a single YUV N21 pixel and <code>8</code> is the number of bits in one byte, because <a href="https://wiki.libsdl.org/SDL_LockTexture" rel="nofollow noreferrer">the SDL2 documentation</a> states that:</p>
  
  <blockquote>
    <p>pitch: this is filled in with the pitch of the locked pixels; the pitch is the length of one row in bytes</p>
  </blockquote>
  
  <p>Now, <strong>the value of pitch actually returned by the function call is <code>720</code></strong>. The fact is that, if I use that <code>720</code> value, the camera preview will be displayed with an unnatural green predominance, while if I disregard the <code>720</code> pitch and use my expected <code>1080</code> pitch, the camera preview is good (and the app runs smoothly, too).</p>
  
  <p>Is there something wrong in my assumptions (e.g. that the number of bits for a N21 pixel is 12, as the Android's <code>ImageFormat.getBitsPerPixel()</code> suggests)? Am I using the SDL library in a wrong manner?</p>