title: the buffer size for callbackbuffer of Android Camera need to be 8 time as big as the image?
body: <p>As the <a href="http://developer.android.com/reference/android/hardware/Camera.html" rel="nofollow">Android document</a> said:</p>
  
  <p>For formats besides YV12, the size of the buffer is determined by multiplying the preview image width, height, and bytes per pixel. The width and height can be read from getPreviewSize(). Bytes per pixel can be computed from <strong><code>getBitsPerPixel(int) / 8</code></strong>, using the image format from getPreviewFormat(). </p>
  
  <p>But most of online code using <code>bitsperpixel</code> to create buffer instead of the <code>byteperpixel=bitsperpixel/8</code>. </p>
  
  <p>If I use following code with use the exact size in bytes of the image, will result in an error: E/Camera-JNI(3656): Callback buffer was too small! Expected 1336320 bytes, but got 890880 bytes! Why is that? Why the buffer need to be 8 time as big as the image size?</p>
  
  <pre><code>Camera.Parameters parameters=mCamera.getParameters();
  parameters.setPreviewSize(width,height);
  mCamera.setParameters(parameters);
  
  int previewFormat=parameters.getPreviewFormat();
  int bitsperpixel=ImageFormat.getBitsPerPixel(previewFormat);
  int byteperpixel=bitsperpixel/8;
  Camera.Size camerasize=parameters.getPreviewSize();
  int frame_bytesize=((camerasize.width*camerasize.height)*byteperpixel);
  
  //create buffer
  byte[]frameBuffer=new byte[frame_bytesize];
  
  //buffer registry 
  mCamera.addCallbackBuffer(frameBuffer);
  </code></pre>