Android: Fix chroma sampling bug when converting from texture to YUV

The xUnit for the UV channels in SurfaceTextureHelper.YuvConverter is
currently calculated from 1 / (2 * width). It should be 1 / (width / 2)
instead.

R=nisse@webrtc.org

Review URL: https://codereview.webrtc.org/1862003002 .

Cr-Commit-Position: refs/heads/master@{#12274}
This commit is contained in:
Magnus Jedvert
2016-04-07 09:26:41 +02:00
parent 95177d1e71
commit fae14804ee

View File

@ -251,10 +251,10 @@ class SurfaceTextureHelper {
// Draw U
GLES20.glViewport(0, height, uv_width, uv_height);
// Matrix * (1;0;0;0) / (2*width). Note that opengl uses column major order.
// Matrix * (1;0;0;0) / (width / 2). Note that opengl uses column major order.
GLES20.glUniform2f(xUnitLoc,
transformMatrix[0] / (2.0f*width),
transformMatrix[1] / (2.0f*width));
2.0f * transformMatrix[0] / width,
2.0f * transformMatrix[1] / width);
GLES20.glUniform4f(coeffsLoc, -0.169f, -0.331f, 0.499f, 0.5f);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);