Bug 1215089 - P8: Add support for 10/12 bits YUV surface with OpenGL compositor. r=mattwoodrow

MozReview-Commit-ID: BR9G7cyopz0
This commit is contained in:
Jean-Yves Avenard
2017-09-29 21:51:29 +02:00
parent 88ae200cc6
commit eea6495d35
5 changed files with 49 additions and 13 deletions

View File

@@ -114,6 +114,13 @@ ShaderConfigOGL::SetYCbCr(bool aEnabled)
MOZ_ASSERT(!(mFeatures & ENABLE_TEXTURE_NV12));
}
void
ShaderConfigOGL::SetColorMultiplier(uint32_t aMultiplier)
{
MOZ_ASSERT(mFeatures & ENABLE_TEXTURE_YCBCR, "Multiplier only supported with YCbCr!");
mMultiplier = aMultiplier;
}
void
ShaderConfigOGL::SetNV12(bool aEnabled)
{
@@ -441,11 +448,12 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
fs << " COLOR_PRECISION float cr = " << texture2D << "(uCbTexture, coord).a;" << endl;
}
}
fs << " y = y - 0.06275;" << endl;
fs << " cb = cb - 0.50196;" << endl;
fs << " cr = cr - 0.50196;" << endl;
fs << " vec3 yuv = vec3(y, cb, cr);" << endl;
if (aConfig.mMultiplier != 1) {
fs << " yuv *= " << aConfig.mMultiplier << ".0;" << endl;
}
fs << " vec3 coeff = vec3(0.06275, 0.50196, 0.50196 );" << endl;
fs << " yuv -= coeff;" << endl;
fs << " color.rgb = uYuvColorMatrix * yuv;" << endl;
fs << " color.a = 1.0;" << endl;
} else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {