Add Rec709 YUV color space support to GrYUVtoRGBEffect.
This change is motivated by a recent switch in how chromium handles <video> color spaces, making rec709 more commonly used. This will allow video -> canvas copies to take the fast GPU path when we're using 709, just as we do with 601 and jpeg. Chromium-side change: https://codereview.chromium.org/1236313002 Review URL: https://codereview.chromium.org/1241723005
This commit is contained in:
parent
6531c3619f
commit
134003902d
@ -39,7 +39,7 @@ protected:
|
||||
}
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(238, 84);
|
||||
return SkISize::Make(238, 120);
|
||||
}
|
||||
|
||||
void onOnceBeforeDraw() override {
|
||||
|
@ -142,8 +142,11 @@ enum SkYUVColorSpace {
|
||||
/** SDTV standard Rec. 601 color space. Uses "studio swing" [16, 235] color
|
||||
range. See http://en.wikipedia.org/wiki/Rec._601 for details. */
|
||||
kRec601_SkYUVColorSpace,
|
||||
/** HDTV standard Rec. 709 color space. Uses "studio swing" [16, 235] color
|
||||
range. See http://en.wikipedia.org/wiki/Rec._709 for details. */
|
||||
kRec709_SkYUVColorSpace,
|
||||
|
||||
kLastEnum_SkYUVColorSpace = kRec601_SkYUVColorSpace
|
||||
kLastEnum_SkYUVColorSpace = kRec709_SkYUVColorSpace
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
public:
|
||||
static const GrGLfloat kJPEGConversionMatrix[16];
|
||||
static const GrGLfloat kRec601ConversionMatrix[16];
|
||||
static const GrGLfloat kRec709ConversionMatrix[16];
|
||||
|
||||
// this class always generates the same code.
|
||||
static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*) {}
|
||||
@ -91,6 +92,9 @@ public:
|
||||
case kRec601_SkYUVColorSpace:
|
||||
pdman.setMatrix4f(fMatrixUni, kRec601ConversionMatrix);
|
||||
break;
|
||||
case kRec709_SkYUVColorSpace:
|
||||
pdman.setMatrix4f(fMatrixUni, kRec709ConversionMatrix);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,6 +165,11 @@ const GrGLfloat YUVtoRGBEffect::GLProcessor::kRec601ConversionMatrix[16] = {
|
||||
1.164f, -0.391f, -0.813f, 0.52925f,
|
||||
1.164f, 2.018f, 0.0f, -1.08175f,
|
||||
0.0f, 0.0f, 0.0f, 1.0};
|
||||
const GrGLfloat YUVtoRGBEffect::GLProcessor::kRec709ConversionMatrix[16] = {
|
||||
1.164f, 0.0f, 1.793f, -0.96925f,
|
||||
1.164f, -0.213f, -0.533f, 0.30025f,
|
||||
1.164f, 2.112f, 0.0f, -1.12875f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user