Bug 1210357 - Handle VP9 colorspace BT.709 r=mattwoodrow,bas.schouten

This commit is contained in:
Sotaro Ikeda 2016-10-18 10:09:00 -07:00
Родитель 1989821a93
Коммит 5a134d6b42
23 изменённых файлов: 9930 добавлений и 9810 удалений

Просмотреть файл

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxUtils.h"
#include "GLBlitHelper.h"
#include "GLContext.h"
#include "GLScreenBuffer.h"
@ -59,6 +60,7 @@ GLBlitHelper::GLBlitHelper(GLContext* gl)
, mSrcTexEGL(0)
, mYTexScaleLoc(-1)
, mCbCrTexScaleLoc(-1)
, mYuvColorMatrixLoc(-1)
, mTexWidth(0)
, mTexHeight(0)
, mCurYScale(1.0f)
@ -171,14 +173,24 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
";
#endif
/* From Rec601:
[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16]
[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128]
[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128]
[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16]
[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128]
[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275]
[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275]
[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196]
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
From Rec709:
[R] [1.1643835616438356, 4.2781193979771426e-17, 1.7927410714285714] [ Y - 16]
[G] = [1.1643835616438358, -0.21324861427372963, -0.532909328559444] x [Cb - 128]
[B] [1.1643835616438356, 2.1124017857142854, 0.0] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.79274] [ Y - 0.06275]
[G] = [1.16438, -0.21325, -0.53291] x [Cb - 0.50196]
[B] [1.16438, 2.11240, 0.00000] [Cr - 0.50196]
*/
const char kTexYUVPlanarBlit_FragShaderSource[] = "\
#version 100 \n\
@ -191,17 +203,17 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
uniform sampler2D uCrTexture; \n\
uniform vec2 uYTexScale; \n\
uniform vec2 uCbCrTexScale; \n\
uniform mat3 uYuvColorMatrix; \n\
void main() \n\
{ \n\
float y = texture2D(uYTexture, vTexCoord * uYTexScale).r; \n\
float cb = texture2D(uCbTexture, vTexCoord * uCbCrTexScale).r; \n\
float cr = texture2D(uCrTexture, vTexCoord * uCbCrTexScale).r; \n\
y = (y - 0.06275) * 1.16438; \n\
y = y - 0.06275; \n\
cb = cb - 0.50196; \n\
cr = cr - 0.50196; \n\
gl_FragColor.r = y + cr * 1.59603; \n\
gl_FragColor.g = y - 0.81297 * cr - 0.39176 * cb; \n\
gl_FragColor.b = y + cb * 2.01723; \n\
vec3 yuv = vec3(y, cb, cr); \n\
gl_FragColor.rgb = uYuvColorMatrix * yuv; \n\
gl_FragColor.a = 1.0; \n\
} \n\
";
@ -409,13 +421,15 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
GLint texCb = mGL->fGetUniformLocation(program, "uCbTexture");
GLint texCr = mGL->fGetUniformLocation(program, "uCrTexture");
mYTexScaleLoc = mGL->fGetUniformLocation(program, "uYTexScale");
mCbCrTexScaleLoc= mGL->fGetUniformLocation(program, "uCbCrTexScale");
mCbCrTexScaleLoc = mGL->fGetUniformLocation(program, "uCbCrTexScale");
mYuvColorMatrixLoc = mGL->fGetUniformLocation(program, "uYuvColorMatrix");
DebugOnly<bool> hasUniformLocations = texY != -1 &&
texCb != -1 &&
texCr != -1 &&
mYTexScaleLoc != -1 &&
mCbCrTexScaleLoc != -1;
mCbCrTexScaleLoc != -1 &&
mYuvColorMatrixLoc != -1;
MOZ_ASSERT(hasUniformLocations, "uniforms not found");
mGL->fUniform1i(texY, Channel_Y);
@ -790,6 +804,9 @@ GLBlitHelper::BlitPlanarYCbCrImage(layers::PlanarYCbCrImage* yuvImage)
mGL->fUniform2f(mCbCrTexScaleLoc, (float)yuvData->mCbCrSize.width/yuvData->mCbCrStride, 1.0f);
}
float* yuvToRgb = gfxUtils::Get3x3YuvColorMatrix(yuvData->mYUVColorSpace);
mGL->fUniformMatrix3fv(mYuvColorMatrixLoc, 1, 0, yuvToRgb);
mGL->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4);
for (int i = 0; i < 3; i++) {
mGL->fActiveTexture(LOCAL_GL_TEXTURE0 + i);

Просмотреть файл

@ -90,6 +90,7 @@ class GLBlitHelper final
GLuint mSrcTexEGL;
GLint mYTexScaleLoc;
GLint mCbCrTexScaleLoc;
GLint mYuvColorMatrixLoc;
int mTexWidth;
int mTexHeight;

Просмотреть файл

@ -158,11 +158,14 @@ struct EffectRGB : public TexturedEffect
struct EffectYCbCr : public TexturedEffect
{
EffectYCbCr(TextureSource *aSource, gfx::SamplingFilter aSamplingFilter)
EffectYCbCr(TextureSource *aSource, YUVColorSpace aYUVColorSpace, gfx::SamplingFilter aSamplingFilter)
: TexturedEffect(EffectTypes::YCBCR, aSource, false, aSamplingFilter)
, mYUVColorSpace(aYUVColorSpace)
{}
virtual const char* Name() { return "EffectYCbCr"; }
YUVColorSpace mYUVColorSpace;
};
struct EffectNV12 : public TexturedEffect
@ -239,12 +242,12 @@ CreateTexturedEffect(gfx::SurfaceFormat aFormat,
case gfx::SurfaceFormat::R8G8B8A8:
result = new EffectRGB(aSource, isAlphaPremultiplied, aSamplingFilter);
break;
case gfx::SurfaceFormat::YUV:
result = new EffectYCbCr(aSource, aSamplingFilter);
break;
case gfx::SurfaceFormat::NV12:
result = new EffectNV12(aSource, aSamplingFilter);
break;
case gfx::SurfaceFormat::YUV:
MOZ_ASSERT_UNREACHABLE("gfx::SurfaceFormat::YUV is invalid");
break;
default:
NS_WARNING("unhandled program type");
break;
@ -255,6 +258,30 @@ CreateTexturedEffect(gfx::SurfaceFormat aFormat,
return result.forget();
}
inline already_AddRefed<TexturedEffect>
CreateTexturedEffect(TextureHost* aHost,
TextureSource* aSource,
const gfx::SamplingFilter aSamplingFilter,
bool isAlphaPremultiplied,
const LayerRenderState &state = LayerRenderState())
{
MOZ_ASSERT(aHost);
MOZ_ASSERT(aSource);
RefPtr<TexturedEffect> result;
if (aHost->GetReadFormat() == gfx::SurfaceFormat::YUV) {
MOZ_ASSERT(aHost->GetYUVColorSpace() != YUVColorSpace::UNKNOWN);
result = new EffectYCbCr(aSource, aHost->GetYUVColorSpace(), aSamplingFilter);
} else {
result = CreateTexturedEffect(aHost->GetReadFormat(),
aSource,
aSamplingFilter,
isAlphaPremultiplied,
state);
}
return result.forget();
}
/**
* Create a textured effect based on aSource format and the presence of
* aSourceOnWhite.

Просмотреть файл

@ -351,7 +351,7 @@ ImageHost::Composite(LayerComposite* aLayer,
bool isAlphaPremultiplied =
!(mCurrentTextureHost->GetFlags() & TextureFlags::NON_PREMULTIPLIED);
RefPtr<TexturedEffect> effect =
CreateTexturedEffect(mCurrentTextureHost->GetReadFormat(),
CreateTexturedEffect(mCurrentTextureHost,
mCurrentTextureSource.get(), aSamplingFilter, isAlphaPremultiplied,
GetRenderState());
if (!effect) {
@ -611,7 +611,7 @@ ImageHost::GenEffect(const gfx::SamplingFilter aSamplingFilter)
isAlphaPremultiplied = false;
}
return CreateTexturedEffect(mCurrentTextureHost->GetReadFormat(),
return CreateTexturedEffect(mCurrentTextureHost,
mCurrentTextureSource,
aSamplingFilter,
isAlphaPremultiplied,

Просмотреть файл

@ -807,6 +807,16 @@ BufferTextureHost::GetFormat() const
return mFormat;
}
YUVColorSpace
BufferTextureHost::GetYUVColorSpace() const
{
if (mFormat == gfx::SurfaceFormat::YUV) {
const YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
return desc.yUVColorSpace();
}
return YUVColorSpace::UNKNOWN;
}
bool
BufferTextureHost::MaybeUpload(nsIntRegion *aRegion)
{

Просмотреть файл

@ -421,6 +421,8 @@ public:
*/
virtual gfx::SurfaceFormat GetReadFormat() const { return GetFormat(); }
virtual YUVColorSpace GetYUVColorSpace() const { return YUVColorSpace::UNKNOWN; }
/**
* Called during the transaction. The TextureSource may or may not be composited.
*
@ -701,6 +703,8 @@ public:
*/
virtual gfx::SurfaceFormat GetFormat() const override;
virtual YUVColorSpace GetYUVColorSpace() const override;
virtual gfx::IntSize GetSize() const override { return mSize; }
virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;

Просмотреть файл

@ -19,6 +19,7 @@
#include "gfxPrefs.h"
#include "gfxConfig.h"
#include "gfxCrashReporterUtils.h"
#include "gfxUtils.h"
#include "mozilla/gfx/StackArray.h"
#include "mozilla/Services.h"
#include "mozilla/widget/WinCompositorWidget.h"
@ -888,6 +889,9 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
return;
}
float* yuvToRgb = gfxUtils::Get4x3YuvColorMatrix(ycbcrEffect->mYUVColorSpace);
memcpy(&mPSConstants.yuvColorMatrix, yuvToRgb, sizeof(mPSConstants.yuvColorMatrix));
TextureSourceD3D11* sourceY = source->GetSubSource(Y)->AsSourceD3D11();
TextureSourceD3D11* sourceCb = source->GetSubSource(Cb)->AsSourceD3D11();
TextureSourceD3D11* sourceCr = source->GetSubSource(Cr)->AsSourceD3D11();

Просмотреть файл

@ -35,6 +35,7 @@ struct PixelShaderConstants
float layerColor[4];
float layerOpacity[4];
int blendConfig[4];
float yuvColorMatrix[3][4];
};
struct DeviceAttachmentsD3D11;

Просмотреть файл

@ -25,6 +25,8 @@ float fLayerOpacity : register(ps, c1);
// w = is premultiplied
uint4 iBlendConfig : register(ps, c2);
row_major float3x3 mYuvColorMatrix : register(ps, c3);
sampler sSampler : register(ps, s0);
// The mix-blend mega shader uses all variables, so we have to make sure they
@ -190,19 +192,27 @@ For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275]
[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196]
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
From Rec709:
[R] [1.1643835616438356, 4.2781193979771426e-17, 1.7927410714285714] [ Y - 16]
[G] = [1.1643835616438358, -0.21324861427372963, -0.532909328559444] x [Cb - 128]
[B] [1.1643835616438356, 2.1124017857142854, 0.0] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.79274] [ Y - 0.06275]
[G] = [1.16438, -0.21325, -0.53291] x [Cb - 0.50196]
[B] [1.16438, 2.11240, 0.00000] [Cr - 0.50196]
*/
float4 CalculateYCbCrColor(const float2 aTexCoords)
{
float4 yuv;
float3 yuv;
float4 color;
yuv.r = tCr.Sample(sSampler, aTexCoords).r - 0.50196;
yuv.g = tY.Sample(sSampler, aTexCoords).r - 0.06275;
yuv.b = tCb.Sample(sSampler, aTexCoords).r - 0.50196;
yuv.x = tY.Sample(sSampler, aTexCoords).r - 0.06275;
yuv.y = tCb.Sample(sSampler, aTexCoords).r - 0.50196;
yuv.z = tCr.Sample(sSampler, aTexCoords).r - 0.50196;
color.r = yuv.g * 1.16438 + yuv.r * 1.59603;
color.g = yuv.g * 1.16438 - 0.81297 * yuv.r - 0.39176 * yuv.b;
color.b = yuv.g * 1.16438 + yuv.b * 2.01723;
color.rgb = mul(mYuvColorMatrix, yuv);
color.a = 1.0f;
return color;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -16,6 +16,7 @@
#include "mozilla/layers/LayerManagerComposite.h"
#include "gfxPrefs.h"
#include "gfxCrashReporterUtils.h"
#include "gfxUtils.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/widget/WinCompositorWidget.h"
#include "D3D9SurfaceImage.h"
@ -415,6 +416,10 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
return;
}
float* yuvToRgb = gfxUtils::Get4x3YuvColorMatrix(ycbcrEffect->mYUVColorSpace);
d3d9Device->SetPixelShaderConstantF(CBmYuvColorMatrix, yuvToRgb, 3);
TextureSourceD3D9* sourceY = source->GetSubSource(Y)->AsSourceD3D9();
TextureSourceD3D9* sourceCb = source->GetSubSource(Cb)->AsSourceD3D9();
TextureSourceD3D9* sourceCr = source->GetSubSource(Cr)->AsSourceD3D9();

Просмотреть файл

@ -31,6 +31,7 @@ const int CBvLayerQuad = 10;
// we don't use opacity with solid color shaders
const int CBfLayerOpacity = 0;
const int CBvColor = 0;
const int CBmYuvColorMatrix = 1;
enum DeviceManagerState {
// The device and swap chain are OK.

Просмотреть файл

@ -1,6 +1,6 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -47,7 +47,7 @@
const BYTE LayerQuadVS[] =
{
0, 2, 254, 255, 254, 255,
79, 0, 67, 84, 65, 66,
76, 0, 67, 84, 65, 66,
28, 0, 0, 0, 2, 1,
0, 0, 0, 2, 254, 255,
5, 0, 0, 0, 28, 0,
@ -97,9 +97,7 @@ const BYTE LayerQuadVS[] =
32, 83, 104, 97, 100, 101,
114, 32, 67, 111, 109, 112,
105, 108, 101, 114, 32, 49,
48, 46, 48, 46, 49, 48,
48, 49, 49, 46, 49, 54,
51, 56, 52, 0, 171, 171,
48, 46, 49, 0, 171, 171,
81, 0, 0, 5, 11, 0,
15, 160, 0, 0, 0, 191,
0, 0, 0, 0, 0, 0,
@ -155,7 +153,7 @@ const BYTE LayerQuadVS[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -184,7 +182,7 @@ const BYTE LayerQuadVS[] =
const BYTE RGBAShaderPS[] =
{
0, 2, 255, 255, 254, 255,
46, 0, 67, 84, 65, 66,
43, 0, 67, 84, 65, 66,
28, 0, 0, 0, 127, 0,
0, 0, 0, 2, 255, 255,
2, 0, 0, 0, 28, 0,
@ -212,9 +210,7 @@ const BYTE RGBAShaderPS[] =
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
49, 48, 46, 48, 46, 49,
48, 48, 49, 49, 46, 49,
54, 51, 56, 52, 0, 171,
49, 48, 46, 49, 0, 171,
31, 0, 0, 2, 0, 0,
0, 128, 0, 0, 3, 176,
31, 0, 0, 2, 0, 0,
@ -230,7 +226,7 @@ const BYTE RGBAShaderPS[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -267,7 +263,7 @@ const BYTE RGBAShaderPS[] =
const BYTE ComponentPass1ShaderPS[] =
{
0, 2, 255, 255, 254, 255,
58, 0, 67, 84, 65, 66,
55, 0, 67, 84, 65, 66,
28, 0, 0, 0, 175, 0,
0, 0, 0, 2, 255, 255,
3, 0, 0, 0, 28, 0,
@ -303,9 +299,7 @@ const BYTE ComponentPass1ShaderPS[] =
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
49, 48, 46, 48, 46, 49,
48, 48, 49, 49, 46, 49,
54, 51, 56, 52, 0, 171,
49, 48, 46, 49, 0, 171,
81, 0, 0, 5, 1, 0,
15, 160, 0, 0, 128, 63,
0, 0, 0, 0, 0, 0,
@ -337,7 +331,7 @@ const BYTE ComponentPass1ShaderPS[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -373,7 +367,7 @@ const BYTE ComponentPass1ShaderPS[] =
const BYTE ComponentPass2ShaderPS[] =
{
0, 2, 255, 255, 254, 255,
58, 0, 67, 84, 65, 66,
55, 0, 67, 84, 65, 66,
28, 0, 0, 0, 175, 0,
0, 0, 0, 2, 255, 255,
3, 0, 0, 0, 28, 0,
@ -409,9 +403,7 @@ const BYTE ComponentPass2ShaderPS[] =
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
49, 48, 46, 48, 46, 49,
48, 48, 49, 49, 46, 49,
54, 51, 56, 52, 0, 171,
49, 48, 46, 49, 0, 171,
81, 0, 0, 5, 1, 0,
15, 160, 0, 0, 128, 63,
0, 0, 0, 0, 0, 0,
@ -441,7 +433,7 @@ const BYTE ComponentPass2ShaderPS[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -472,7 +464,7 @@ const BYTE ComponentPass2ShaderPS[] =
const BYTE RGBShaderPS[] =
{
0, 2, 255, 255, 254, 255,
46, 0, 67, 84, 65, 66,
43, 0, 67, 84, 65, 66,
28, 0, 0, 0, 127, 0,
0, 0, 0, 2, 255, 255,
2, 0, 0, 0, 28, 0,
@ -500,9 +492,7 @@ const BYTE RGBShaderPS[] =
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
49, 48, 46, 48, 46, 49,
48, 48, 49, 49, 46, 49,
54, 51, 56, 52, 0, 171,
49, 48, 46, 49, 0, 171,
81, 0, 0, 5, 1, 0,
15, 160, 0, 0, 128, 63,
0, 0, 0, 0, 0, 0,
@ -524,11 +514,12 @@ const BYTE RGBShaderPS[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
// float fLayerOpacity;
// row_major float3x3 mYuvColorMatrix;
// sampler2D s2DCb;
// sampler2D s2DCr;
// sampler2D s2DY;
@ -536,148 +527,141 @@ const BYTE RGBShaderPS[] =
//
// Registers:
//
// Name Reg Size
// ------------- ----- ----
// fLayerOpacity c0 1
// s2DY s0 1
// s2DCb s1 1
// s2DCr s2 1
// Name Reg Size
// --------------- ----- ----
// fLayerOpacity c0 1
// mYuvColorMatrix c1 3
// s2DY s0 1
// s2DCb s1 1
// s2DCr s2 1
//
ps_2_0
def c1, -0.5, -0.0625, 1.16400003, 1.59599996
def c2, 0.813000023, 0.391000003, 2.01799989, 1
def c4, -0.0627499968, -0.50195998, 1, 0
dcl t0.xy
dcl_2d s0
dcl_2d s1
dcl_2d s2
texld r0, t0, s2
texld r1, t0, s0
texld r2, t0, s1
add r0.x, r0.w, c1.x
add r0.y, r1.w, c1.y
mul r0.y, r0.y, c1.z
mad r0.z, r0.x, -c2.x, r0.y
mad r1.x, r0.x, c1.w, r0.y
add r0.x, r2.w, c1.x
mad r1.y, r0.x, -c2.y, r0.z
mad r1.z, r0.x, c2.z, r0.y
mov r1.w, c2.w
mul r0, r1, c0.x
texld r0, t0, s0
texld r1, t0, s1
texld r2, t0, s2
mov r3.w, c4.z
add r0.x, r0.w, c4.x
add r0.y, r1.w, c4.y
add r0.z, r2.w, c4.y
dp3 r3.x, c1, r0
dp3 r3.y, c2, r0
dp3 r3.z, c3, r0
mul r0, r3, c0.x
mov oC0, r0
// approximately 14 instruction slots used (3 texture, 11 arithmetic)
// approximately 12 instruction slots used (3 texture, 9 arithmetic)
#endif
const BYTE YCbCrShaderPS[] =
{
0, 2, 255, 255, 254, 255,
69, 0, 67, 84, 65, 66,
28, 0, 0, 0, 219, 0,
79, 0, 67, 84, 65, 66,
28, 0, 0, 0, 15, 1,
0, 0, 0, 2, 255, 255,
4, 0, 0, 0, 28, 0,
5, 0, 0, 0, 28, 0,
0, 0, 0, 1, 0, 0,
212, 0, 0, 0, 108, 0,
8, 1, 0, 0, 128, 0,
0, 0, 2, 0, 0, 0,
1, 0, 0, 0, 124, 0,
1, 0, 0, 0, 144, 0,
0, 0, 0, 0, 0, 0,
140, 0, 0, 0, 3, 0,
1, 0, 1, 0, 0, 0,
148, 0, 0, 0, 0, 0,
0, 0, 164, 0, 0, 0,
3, 0, 2, 0, 1, 0,
0, 0, 172, 0, 0, 0,
0, 0, 0, 0, 188, 0,
0, 0, 3, 0, 0, 0,
1, 0, 0, 0, 196, 0,
0, 0, 0, 0, 0, 0,
102, 76, 97, 121, 101, 114,
79, 112, 97, 99, 105, 116,
121, 0, 171, 171, 0, 0,
160, 0, 0, 0, 2, 0,
1, 0, 3, 0, 6, 0,
176, 0, 0, 0, 0, 0,
0, 0, 192, 0, 0, 0,
3, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 115, 50, 68, 67,
98, 0, 171, 171, 4, 0,
12, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 115, 50, 68, 67,
114, 0, 171, 171, 4, 0,
12, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 115, 50, 68, 89,
0, 171, 171, 171, 4, 0,
12, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 112, 115, 95, 50,
95, 48, 0, 77, 105, 99,
114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 48,
46, 49, 48, 48, 49, 49,
46, 49, 54, 51, 56, 52,
0, 171, 81, 0, 0, 5,
1, 0, 15, 160, 0, 0,
0, 191, 0, 0, 128, 189,
244, 253, 148, 63, 186, 73,
204, 63, 81, 0, 0, 5,
2, 0, 15, 160, 197, 32,
80, 63, 39, 49, 200, 62,
233, 38, 1, 64, 0, 0,
128, 63, 31, 0, 0, 2,
0, 0, 0, 128, 0, 0,
3, 176, 31, 0, 0, 2,
0, 0, 0, 144, 0, 8,
15, 160, 31, 0, 0, 2,
0, 0, 0, 144, 1, 8,
15, 160, 31, 0, 0, 2,
0, 0, 0, 144, 2, 8,
15, 160, 66, 0, 0, 3,
0, 0, 15, 128, 0, 0,
228, 176, 2, 8, 228, 160,
66, 0, 0, 3, 1, 0,
0, 0, 200, 0, 0, 0,
0, 0, 0, 0, 216, 0,
0, 0, 3, 0, 2, 0,
1, 0, 0, 0, 224, 0,
0, 0, 0, 0, 0, 0,
240, 0, 0, 0, 3, 0,
0, 0, 1, 0, 0, 0,
248, 0, 0, 0, 0, 0,
0, 0, 102, 76, 97, 121,
101, 114, 79, 112, 97, 99,
105, 116, 121, 0, 171, 171,
0, 0, 3, 0, 1, 0,
1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 109, 89,
117, 118, 67, 111, 108, 111,
114, 77, 97, 116, 114, 105,
120, 0, 2, 0, 3, 0,
3, 0, 3, 0, 1, 0,
0, 0, 0, 0, 0, 0,
115, 50, 68, 67, 98, 0,
171, 171, 4, 0, 12, 0,
1, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0,
115, 50, 68, 67, 114, 0,
171, 171, 4, 0, 12, 0,
1, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0,
115, 50, 68, 89, 0, 171,
171, 171, 4, 0, 12, 0,
1, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0,
112, 115, 95, 50, 95, 48,
0, 77, 105, 99, 114, 111,
115, 111, 102, 116, 32, 40,
82, 41, 32, 72, 76, 83,
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
49, 48, 46, 49, 0, 171,
81, 0, 0, 5, 4, 0,
15, 160, 18, 131, 128, 189,
115, 128, 0, 191, 0, 0,
128, 63, 0, 0, 0, 0,
31, 0, 0, 2, 0, 0,
0, 128, 0, 0, 3, 176,
31, 0, 0, 2, 0, 0,
0, 144, 0, 8, 15, 160,
31, 0, 0, 2, 0, 0,
0, 144, 1, 8, 15, 160,
31, 0, 0, 2, 0, 0,
0, 144, 2, 8, 15, 160,
66, 0, 0, 3, 0, 0,
15, 128, 0, 0, 228, 176,
0, 8, 228, 160, 66, 0,
0, 3, 2, 0, 15, 128,
0, 3, 1, 0, 15, 128,
0, 0, 228, 176, 1, 8,
228, 160, 2, 0, 0, 3,
0, 0, 1, 128, 0, 0,
255, 128, 1, 0, 0, 160,
228, 160, 66, 0, 0, 3,
2, 0, 15, 128, 0, 0,
228, 176, 2, 8, 228, 160,
1, 0, 0, 2, 3, 0,
8, 128, 4, 0, 170, 160,
2, 0, 0, 3, 0, 0,
2, 128, 1, 0, 255, 128,
1, 0, 85, 160, 5, 0,
1, 128, 0, 0, 255, 128,
4, 0, 0, 160, 2, 0,
0, 3, 0, 0, 2, 128,
0, 0, 85, 128, 1, 0,
170, 160, 4, 0, 0, 4,
0, 0, 4, 128, 0, 0,
0, 128, 2, 0, 0, 161,
0, 0, 85, 128, 4, 0,
0, 4, 1, 0, 1, 128,
0, 0, 0, 128, 1, 0,
255, 160, 0, 0, 85, 128,
2, 0, 0, 3, 0, 0,
1, 128, 2, 0, 255, 128,
1, 0, 0, 160, 4, 0,
0, 4, 1, 0, 2, 128,
0, 0, 0, 128, 2, 0,
85, 161, 0, 0, 170, 128,
4, 0, 0, 4, 1, 0,
4, 128, 0, 0, 0, 128,
2, 0, 170, 160, 0, 0,
85, 128, 1, 0, 0, 2,
1, 0, 8, 128, 2, 0,
255, 160, 5, 0, 0, 3,
0, 0, 15, 128, 1, 0,
228, 128, 0, 0, 0, 160,
1, 0, 0, 2, 0, 8,
15, 128, 0, 0, 228, 128,
255, 255, 0, 0
1, 0, 255, 128, 4, 0,
85, 160, 2, 0, 0, 3,
0, 0, 4, 128, 2, 0,
255, 128, 4, 0, 85, 160,
8, 0, 0, 3, 3, 0,
1, 128, 1, 0, 228, 160,
0, 0, 228, 128, 8, 0,
0, 3, 3, 0, 2, 128,
2, 0, 228, 160, 0, 0,
228, 128, 8, 0, 0, 3,
3, 0, 4, 128, 3, 0,
228, 160, 0, 0, 228, 128,
5, 0, 0, 3, 0, 0,
15, 128, 3, 0, 228, 128,
0, 0, 0, 160, 1, 0,
0, 2, 0, 8, 15, 128,
0, 0, 228, 128, 255, 255,
0, 0
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -700,7 +684,7 @@ const BYTE YCbCrShaderPS[] =
const BYTE SolidColorShaderPS[] =
{
0, 2, 255, 255, 254, 255,
35, 0, 67, 84, 65, 66,
32, 0, 67, 84, 65, 66,
28, 0, 0, 0, 83, 0,
0, 0, 0, 2, 255, 255,
1, 0, 0, 0, 28, 0,
@ -721,16 +705,14 @@ const BYTE SolidColorShaderPS[] =
83, 104, 97, 100, 101, 114,
32, 67, 111, 109, 112, 105,
108, 101, 114, 32, 49, 48,
46, 48, 46, 49, 48, 48,
49, 49, 46, 49, 54, 51,
56, 52, 0, 171, 1, 0,
46, 49, 0, 171, 1, 0,
0, 2, 0, 8, 15, 128,
0, 0, 228, 160, 255, 255,
0, 0
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -786,7 +768,7 @@ const BYTE SolidColorShaderPS[] =
const BYTE LayerQuadVSMask[] =
{
0, 2, 254, 255, 254, 255,
87, 0, 67, 84, 65, 66,
84, 0, 67, 84, 65, 66,
28, 0, 0, 0, 34, 1,
0, 0, 0, 2, 254, 255,
6, 0, 0, 0, 28, 0,
@ -841,9 +823,7 @@ const BYTE LayerQuadVSMask[] =
83, 76, 32, 83, 104, 97,
100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114,
32, 49, 48, 46, 48, 46,
49, 48, 48, 49, 49, 46,
49, 54, 51, 56, 52, 0,
32, 49, 48, 46, 49, 0,
171, 171, 81, 0, 0, 5,
12, 0, 15, 160, 0, 0,
0, 191, 0, 0, 128, 63,
@ -914,7 +894,7 @@ const BYTE LayerQuadVSMask[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -951,7 +931,7 @@ const BYTE LayerQuadVSMask[] =
const BYTE RGBAShaderPSMask[] =
{
0, 2, 255, 255, 254, 255,
57, 0, 67, 84, 65, 66,
54, 0, 67, 84, 65, 66,
28, 0, 0, 0, 171, 0,
0, 0, 0, 2, 255, 255,
3, 0, 0, 0, 28, 0,
@ -986,9 +966,7 @@ const BYTE RGBAShaderPSMask[] =
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 48,
46, 49, 48, 48, 49, 49,
46, 49, 54, 51, 56, 52,
114, 32, 49, 48, 46, 49,
0, 171, 31, 0, 0, 2,
0, 0, 0, 128, 0, 0,
3, 176, 31, 0, 0, 2,
@ -1019,7 +997,7 @@ const BYTE RGBAShaderPSMask[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -1064,7 +1042,7 @@ const BYTE RGBAShaderPSMask[] =
const BYTE ComponentPass1ShaderPSMask[] =
{
0, 2, 255, 255, 254, 255,
69, 0, 67, 84, 65, 66,
66, 0, 67, 84, 65, 66,
28, 0, 0, 0, 219, 0,
0, 0, 0, 2, 255, 255,
4, 0, 0, 0, 28, 0,
@ -1107,9 +1085,7 @@ const BYTE ComponentPass1ShaderPSMask[] =
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 48,
46, 49, 48, 48, 49, 49,
46, 49, 54, 51, 56, 52,
114, 32, 49, 48, 46, 49,
0, 171, 81, 0, 0, 5,
1, 0, 15, 160, 0, 0,
128, 63, 0, 0, 0, 0,
@ -1156,7 +1132,7 @@ const BYTE ComponentPass1ShaderPSMask[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -1200,7 +1176,7 @@ const BYTE ComponentPass1ShaderPSMask[] =
const BYTE ComponentPass2ShaderPSMask[] =
{
0, 2, 255, 255, 254, 255,
69, 0, 67, 84, 65, 66,
66, 0, 67, 84, 65, 66,
28, 0, 0, 0, 219, 0,
0, 0, 0, 2, 255, 255,
4, 0, 0, 0, 28, 0,
@ -1243,9 +1219,7 @@ const BYTE ComponentPass2ShaderPSMask[] =
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 48,
46, 49, 48, 48, 49, 49,
46, 49, 54, 51, 56, 52,
114, 32, 49, 48, 46, 49,
0, 171, 81, 0, 0, 5,
1, 0, 15, 160, 0, 0,
128, 63, 0, 0, 0, 0,
@ -1290,7 +1264,7 @@ const BYTE ComponentPass2ShaderPSMask[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -1329,7 +1303,7 @@ const BYTE ComponentPass2ShaderPSMask[] =
const BYTE RGBShaderPSMask[] =
{
0, 2, 255, 255, 254, 255,
57, 0, 67, 84, 65, 66,
54, 0, 67, 84, 65, 66,
28, 0, 0, 0, 171, 0,
0, 0, 0, 2, 255, 255,
3, 0, 0, 0, 28, 0,
@ -1364,9 +1338,7 @@ const BYTE RGBShaderPSMask[] =
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 48,
46, 49, 48, 48, 49, 49,
46, 49, 54, 51, 56, 52,
114, 32, 49, 48, 46, 49,
0, 171, 81, 0, 0, 5,
1, 0, 15, 160, 0, 0,
128, 63, 0, 0, 0, 0,
@ -1403,11 +1375,12 @@ const BYTE RGBShaderPSMask[] =
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
// float fLayerOpacity;
// row_major float3x3 mYuvColorMatrix;
// sampler2D s2DCb;
// sampler2D s2DCr;
// sampler2D s2DMask;
@ -1416,18 +1389,18 @@ const BYTE RGBShaderPSMask[] =
//
// Registers:
//
// Name Reg Size
// ------------- ----- ----
// fLayerOpacity c0 1
// s2DY s0 1
// s2DCb s1 1
// s2DCr s2 1
// s2DMask s3 1
// Name Reg Size
// --------------- ----- ----
// fLayerOpacity c0 1
// mYuvColorMatrix c1 3
// s2DY s0 1
// s2DCb s1 1
// s2DCr s2 1
// s2DMask s3 1
//
ps_2_0
def c1, -0.50195998, -0.0627499968, 1.16437995, 1.59603
def c2, 0.812969983, 0.391759992, 2.01723003, 1
def c4, -0.0627499968, -0.50195998, 1, 0
dcl t0.xy
dcl t1.xyz
dcl_2d s0
@ -1436,156 +1409,149 @@ const BYTE RGBShaderPSMask[] =
dcl_2d s3
rcp r0.w, t1.z
mul r0.xy, r0.w, t1
texld r1, t0, s2
texld r2, t0, s0
texld r3, t0, s1
texld r1, t0, s0
texld r2, t0, s1
texld r3, t0, s2
texld r0, r0, s3
add r0.x, r1.w, c1.x
add r0.y, r2.w, c1.y
mul r0.y, r0.y, c1.z
mad r0.z, r0.x, -c2.x, r0.y
mad r1.x, r0.x, c1.w, r0.y
add r0.x, r3.w, c1.x
mad r1.y, r0.x, -c2.y, r0.z
mad r1.z, r0.x, c2.z, r0.y
mov r1.w, c2.w
mul r1, r1, c0.x
mov r4.w, c4.z
add r0.x, r1.w, c4.x
add r0.y, r2.w, c4.y
add r0.z, r3.w, c4.y
dp3 r4.x, c1, r0
dp3 r4.y, c2, r0
dp3 r4.z, c3, r0
mul r1, r4, c0.x
mul r0, r0.w, r1
mov oC0, r0
// approximately 18 instruction slots used (4 texture, 14 arithmetic)
// approximately 16 instruction slots used (4 texture, 12 arithmetic)
#endif
const BYTE YCbCrShaderPSMask[] =
{
0, 2, 255, 255, 254, 255,
80, 0, 67, 84, 65, 66,
28, 0, 0, 0, 7, 1,
90, 0, 67, 84, 65, 66,
28, 0, 0, 0, 59, 1,
0, 0, 0, 2, 255, 255,
5, 0, 0, 0, 28, 0,
6, 0, 0, 0, 28, 0,
0, 0, 0, 1, 0, 0,
0, 1, 0, 0, 128, 0,
52, 1, 0, 0, 148, 0,
0, 0, 2, 0, 0, 0,
1, 0, 0, 0, 144, 0,
1, 0, 0, 0, 164, 0,
0, 0, 0, 0, 0, 0,
160, 0, 0, 0, 3, 0,
1, 0, 1, 0, 0, 0,
168, 0, 0, 0, 0, 0,
0, 0, 184, 0, 0, 0,
3, 0, 2, 0, 1, 0,
0, 0, 192, 0, 0, 0,
0, 0, 0, 0, 208, 0,
0, 0, 3, 0, 3, 0,
1, 0, 0, 0, 216, 0,
180, 0, 0, 0, 2, 0,
1, 0, 3, 0, 6, 0,
196, 0, 0, 0, 0, 0,
0, 0, 212, 0, 0, 0,
3, 0, 1, 0, 1, 0,
0, 0, 220, 0, 0, 0,
0, 0, 0, 0, 236, 0,
0, 0, 3, 0, 2, 0,
1, 0, 0, 0, 244, 0,
0, 0, 0, 0, 0, 0,
232, 0, 0, 0, 3, 0,
0, 0, 1, 0, 0, 0,
240, 0, 0, 0, 0, 0,
0, 0, 102, 76, 97, 121,
101, 114, 79, 112, 97, 99,
105, 116, 121, 0, 171, 171,
0, 0, 3, 0, 1, 0,
1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 115, 50,
68, 67, 98, 0, 171, 171,
4, 0, 12, 0, 1, 0,
1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 115, 50,
68, 67, 114, 0, 171, 171,
4, 0, 12, 0, 1, 0,
1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 115, 50,
68, 77, 97, 115, 107, 0,
4, 0, 12, 0, 1, 0,
1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 115, 50,
68, 89, 0, 171, 171, 171,
4, 0, 12, 0, 1, 0,
1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 112, 115,
95, 50, 95, 48, 0, 77,
105, 99, 114, 111, 115, 111,
102, 116, 32, 40, 82, 41,
32, 72, 76, 83, 76, 32,
83, 104, 97, 100, 101, 114,
32, 67, 111, 109, 112, 105,
108, 101, 114, 32, 49, 48,
46, 48, 46, 49, 48, 48,
49, 49, 46, 49, 54, 51,
56, 52, 0, 171, 81, 0,
0, 5, 1, 0, 15, 160,
115, 128, 0, 191, 18, 131,
128, 189, 103, 10, 149, 63,
182, 74, 204, 63, 81, 0,
0, 5, 2, 0, 15, 160,
205, 30, 80, 63, 196, 148,
200, 62, 76, 26, 1, 64,
0, 0, 128, 63, 31, 0,
0, 2, 0, 0, 0, 128,
0, 0, 3, 176, 31, 0,
0, 2, 0, 0, 0, 128,
1, 0, 7, 176, 31, 0,
0, 2, 0, 0, 0, 144,
0, 8, 15, 160, 31, 0,
0, 2, 0, 0, 0, 144,
1, 8, 15, 160, 31, 0,
0, 2, 0, 0, 0, 144,
2, 8, 15, 160, 31, 0,
0, 2, 0, 0, 0, 144,
3, 8, 15, 160, 6, 0,
0, 2, 0, 0, 8, 128,
1, 0, 170, 176, 5, 0,
0, 3, 0, 0, 3, 128,
0, 0, 255, 128, 1, 0,
228, 176, 66, 0, 0, 3,
1, 0, 15, 128, 0, 0,
228, 176, 2, 8, 228, 160,
66, 0, 0, 3, 2, 0,
4, 1, 0, 0, 3, 0,
3, 0, 1, 0, 0, 0,
12, 1, 0, 0, 0, 0,
0, 0, 28, 1, 0, 0,
3, 0, 0, 0, 1, 0,
0, 0, 36, 1, 0, 0,
0, 0, 0, 0, 102, 76,
97, 121, 101, 114, 79, 112,
97, 99, 105, 116, 121, 0,
171, 171, 0, 0, 3, 0,
1, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0,
109, 89, 117, 118, 67, 111,
108, 111, 114, 77, 97, 116,
114, 105, 120, 0, 2, 0,
3, 0, 3, 0, 3, 0,
1, 0, 0, 0, 0, 0,
0, 0, 115, 50, 68, 67,
98, 0, 171, 171, 4, 0,
12, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 115, 50, 68, 67,
114, 0, 171, 171, 4, 0,
12, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 115, 50, 68, 77,
97, 115, 107, 0, 4, 0,
12, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 115, 50, 68, 89,
0, 171, 171, 171, 4, 0,
12, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 112, 115, 95, 50,
95, 48, 0, 77, 105, 99,
114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 49,
0, 171, 81, 0, 0, 5,
4, 0, 15, 160, 18, 131,
128, 189, 115, 128, 0, 191,
0, 0, 128, 63, 0, 0,
0, 0, 31, 0, 0, 2,
0, 0, 0, 128, 0, 0,
3, 176, 31, 0, 0, 2,
0, 0, 0, 128, 1, 0,
7, 176, 31, 0, 0, 2,
0, 0, 0, 144, 0, 8,
15, 160, 31, 0, 0, 2,
0, 0, 0, 144, 1, 8,
15, 160, 31, 0, 0, 2,
0, 0, 0, 144, 2, 8,
15, 160, 31, 0, 0, 2,
0, 0, 0, 144, 3, 8,
15, 160, 6, 0, 0, 2,
0, 0, 8, 128, 1, 0,
170, 176, 5, 0, 0, 3,
0, 0, 3, 128, 0, 0,
255, 128, 1, 0, 228, 176,
66, 0, 0, 3, 1, 0,
15, 128, 0, 0, 228, 176,
0, 8, 228, 160, 66, 0,
0, 3, 3, 0, 15, 128,
0, 3, 2, 0, 15, 128,
0, 0, 228, 176, 1, 8,
228, 160, 66, 0, 0, 3,
0, 0, 15, 128, 0, 0,
228, 128, 3, 8, 228, 160,
2, 0, 0, 3, 0, 0,
1, 128, 1, 0, 255, 128,
1, 0, 0, 160, 2, 0,
0, 3, 0, 0, 2, 128,
2, 0, 255, 128, 1, 0,
85, 160, 5, 0, 0, 3,
0, 0, 2, 128, 0, 0,
85, 128, 1, 0, 170, 160,
4, 0, 0, 4, 0, 0,
4, 128, 0, 0, 0, 128,
2, 0, 0, 161, 0, 0,
85, 128, 4, 0, 0, 4,
1, 0, 1, 128, 0, 0,
0, 128, 1, 0, 255, 160,
0, 0, 85, 128, 2, 0,
3, 0, 15, 128, 0, 0,
228, 176, 2, 8, 228, 160,
66, 0, 0, 3, 0, 0,
15, 128, 0, 0, 228, 128,
3, 8, 228, 160, 1, 0,
0, 2, 4, 0, 8, 128,
4, 0, 170, 160, 2, 0,
0, 3, 0, 0, 1, 128,
3, 0, 255, 128, 1, 0,
0, 160, 4, 0, 0, 4,
1, 0, 2, 128, 0, 0,
0, 128, 2, 0, 85, 161,
0, 0, 170, 128, 4, 0,
0, 4, 1, 0, 4, 128,
0, 0, 0, 128, 2, 0,
170, 160, 0, 0, 85, 128,
1, 0, 0, 2, 1, 0,
8, 128, 2, 0, 255, 160,
5, 0, 0, 3, 1, 0,
15, 128, 1, 0, 228, 128,
0, 0, 0, 160, 5, 0,
0, 3, 0, 0, 15, 128,
0, 0, 255, 128, 1, 0,
228, 128, 1, 0, 0, 2,
0, 8, 15, 128, 0, 0,
228, 128, 255, 255, 0, 0
1, 0, 255, 128, 4, 0,
0, 160, 2, 0, 0, 3,
0, 0, 2, 128, 2, 0,
255, 128, 4, 0, 85, 160,
2, 0, 0, 3, 0, 0,
4, 128, 3, 0, 255, 128,
4, 0, 85, 160, 8, 0,
0, 3, 4, 0, 1, 128,
1, 0, 228, 160, 0, 0,
228, 128, 8, 0, 0, 3,
4, 0, 2, 128, 2, 0,
228, 160, 0, 0, 228, 128,
8, 0, 0, 3, 4, 0,
4, 128, 3, 0, 228, 160,
0, 0, 228, 128, 5, 0,
0, 3, 1, 0, 15, 128,
4, 0, 228, 128, 0, 0,
0, 160, 5, 0, 0, 3,
0, 0, 15, 128, 0, 0,
255, 128, 1, 0, 228, 128,
1, 0, 0, 2, 0, 8,
15, 128, 0, 0, 228, 128,
255, 255, 0, 0
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
// Parameters:
//
@ -1616,7 +1582,7 @@ const BYTE YCbCrShaderPSMask[] =
const BYTE SolidColorShaderPSMask[] =
{
0, 2, 255, 255, 254, 255,
46, 0, 67, 84, 65, 66,
43, 0, 67, 84, 65, 66,
28, 0, 0, 0, 127, 0,
0, 0, 0, 2, 255, 255,
2, 0, 0, 0, 28, 0,
@ -1644,9 +1610,7 @@ const BYTE SolidColorShaderPSMask[] =
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
49, 48, 46, 48, 46, 49,
48, 48, 49, 49, 46, 49,
54, 51, 56, 52, 0, 171,
49, 48, 46, 49, 0, 171,
31, 0, 0, 2, 0, 0,
0, 128, 1, 0, 7, 176,
31, 0, 0, 2, 0, 0,

Просмотреть файл

@ -18,6 +18,7 @@ sampler s2DMask;
float fLayerOpacity;
float4 fLayerColor;
row_major float3x3 mYuvColorMatrix : register(ps, c1);
struct VS_INPUT {
float4 vPosition : POSITION;
@ -139,18 +140,36 @@ float4 RGBShader(const VS_OUTPUT aVertex) : COLOR
return result * fLayerOpacity;
}
/* From Rec601:
[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16]
[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128]
[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275]
[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196]
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
From Rec709:
[R] [1.1643835616438356, 4.2781193979771426e-17, 1.7927410714285714] [ Y - 16]
[G] = [1.1643835616438358, -0.21324861427372963, -0.532909328559444] x [Cb - 128]
[B] [1.1643835616438356, 2.1124017857142854, 0.0] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.79274] [ Y - 0.06275]
[G] = [1.16438, -0.21325, -0.53291] x [Cb - 0.50196]
[B] [1.16438, 2.11240, 0.00000] [Cr - 0.50196]
*/
float4 YCbCrShader(const VS_OUTPUT aVertex) : COLOR
{
float4 yuv;
float3 yuv;
float4 color;
yuv.r = tex2D(s2DCr, aVertex.vTexCoords).a - 0.5;
yuv.g = tex2D(s2DY, aVertex.vTexCoords).a - 0.0625;
yuv.b = tex2D(s2DCb, aVertex.vTexCoords).a - 0.5;
yuv.x = tex2D(s2DY, aVertex.vTexCoords).a - 0.06275;
yuv.y = tex2D(s2DCb, aVertex.vTexCoords).a - 0.50196;
yuv.z = tex2D(s2DCr, aVertex.vTexCoords).a - 0.50196;
color.r = yuv.g * 1.164 + yuv.r * 1.596;
color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;
color.b = yuv.g * 1.164 + yuv.b * 2.018;
color.rgb = mul(mYuvColorMatrix, yuv);
color.a = 1.0f;
return color * fLayerOpacity;
@ -198,28 +217,16 @@ float4 RGBShaderMask(const VS_OUTPUT_MASK aVertex) : COLOR
return result * fLayerOpacity * mask;
}
/* From Rec601:
[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16]
[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128]
[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275]
[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196]
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
*/
float4 YCbCrShaderMask(const VS_OUTPUT_MASK aVertex) : COLOR
{
float4 yuv;
float3 yuv;
float4 color;
yuv.r = tex2D(s2DCr, aVertex.vTexCoords).a - 0.50196;
yuv.g = tex2D(s2DY, aVertex.vTexCoords).a - 0.06275;
yuv.b = tex2D(s2DCb, aVertex.vTexCoords).a - 0.50196;
yuv.x = tex2D(s2DY, aVertex.vTexCoords).a - 0.06275;
yuv.y = tex2D(s2DCb, aVertex.vTexCoords).a - 0.50196;
yuv.z = tex2D(s2DCr, aVertex.vTexCoords).a - 0.50196;
color.r = yuv.g * 1.16438 + yuv.r * 1.59603;
color.g = yuv.g * 1.16438 - 0.81297 * yuv.r - 0.39176 * yuv.b;
color.b = yuv.g * 1.16438 + yuv.b * 2.01723;
color.rgb = mul((float3x3)mYuvColorMatrix, yuv);
color.a = 1.0f;
float2 maskCoords = aVertex.vMaskCoords.xy / aVertex.vMaskCoords.z;

Просмотреть файл

@ -1319,6 +1319,7 @@ CompositorOGL::DrawGeometry(const Geometry& aGeometry,
program->SetYCbCrTextureUnits(Y, Cb, Cr);
program->SetTextureTransform(Matrix4x4());
program->SetYUVColorSpace(effectYCbCr->mYUVColorSpace);
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE3, maskQuadTransform);

Просмотреть файл

@ -7,6 +7,7 @@
#include <sstream> // for ostringstream
#include "gfxEnv.h"
#include "gfxRect.h" // for gfxRect
#include "gfxUtils.h"
#include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/layers/Compositor.h" // for BlendOpIsMixBlendMode
#include "nsAString.h"
@ -58,6 +59,7 @@ AddUniforms(ProgramProfileOGL& aProfile)
"uSSEdges",
"uViewportSize",
"uVisibleCenter",
"uYuvColorMatrix",
nullptr
};
@ -375,6 +377,7 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
fs << "uniform sampler2D uYTexture;" << endl;
fs << "uniform sampler2D uCbTexture;" << endl;
fs << "uniform sampler2D uCrTexture;" << endl;
fs << "uniform mat3 uYuvColorMatrix;" << endl;
} else if (aConfig.mFeatures & ENABLE_TEXTURE_NV12) {
fs << "uniform " << sampler2D << " uYTexture;" << endl;
fs << "uniform " << sampler2D << " uCbTexture;" << endl;
@ -433,22 +436,11 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
}
}
/* From Rec601:
[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16]
[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128]
[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275]
[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196]
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
*/
fs << " y = (y - 0.06275) * 1.16438;" << endl;
fs << " y = y - 0.06275;" << endl;
fs << " cb = cb - 0.50196;" << endl;
fs << " cr = cr - 0.50196;" << endl;
fs << " color.r = y + 1.59603*cr;" << endl;
fs << " color.g = y - 0.39176*cb - 0.81297*cr;" << endl;
fs << " color.b = y + 2.01723*cb;" << endl;
fs << " vec3 yuv = vec3(y, cb, cr);" << endl;
fs << " color.rgb = uYuvColorMatrix * yuv;" << endl;
fs << " color.a = 1.0;" << endl;
} else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {
if (aConfig.mFeatures & ENABLE_TEXTURE_RECT) {
@ -971,5 +963,12 @@ ShaderProgramOGL::SetBlurRadius(float aRX, float aRY)
SetArrayUniform(KnownUniform::BlurGaussianKernel, GAUSSIAN_KERNEL_HALF_WIDTH, gaussianKernel);
}
void
ShaderProgramOGL::SetYUVColorSpace(YUVColorSpace aYUVColorSpace)
{
float* yuvToRgb = gfxUtils::Get3x3YuvColorMatrix(aYUVColorSpace);
SetMatrix3fvUniform(KnownUniform::YuvColorMatrix, yuvToRgb);
}
} // namespace layers
} // namespace mozilla

Просмотреть файл

@ -8,6 +8,7 @@
#include "GLContext.h" // for fast inlines of glUniform*
#include "gfxTypes.h"
#include "ImageTypes.h"
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Pair.h" // for Pair
#include "mozilla/RefPtr.h" // for RefPtr
@ -81,6 +82,7 @@ public:
SSEdges,
ViewportSize,
VisibleCenter,
YuvColorMatrix,
KnownUniformCount
};
@ -146,6 +148,7 @@ public:
case 2:
case 3:
case 4:
case 9:
case 16:
if (memcmp(mValue.f16v, fp, sizeof(float) * cnt) != 0) {
memcpy(mValue.f16v, fp, sizeof(float) * cnt);
@ -154,7 +157,7 @@ public:
return false;
}
NS_NOTREACHED("cnt must be 1 2 3 4 or 16");
NS_NOTREACHED("cnt must be 1 2 3 4 9 or 16");
return false;
}
@ -476,6 +479,8 @@ public:
SetUniform(KnownUniform::CbCrTexCoordMultiplier, 2, f);
}
void SetYUVColorSpace(YUVColorSpace aYUVColorSpace);
// Set whether we want the component alpha shader to return the color
// vector (pass 1, false) or the alpha vector (pass2, true). With support
// for multiple render targets we wouldn't need two passes here.
@ -595,6 +600,16 @@ protected:
}
}
void SetMatrix3fvUniform(KnownUniform::KnownUniformName aKnownUniform, const float *aFloatValues) {
ASSERT_THIS_PROGRAM;
NS_ASSERTION(aKnownUniform >= 0 && aKnownUniform < KnownUniform::KnownUniformCount, "Invalid known uniform");
KnownUniform& ku(mProfile.mUniforms[aKnownUniform]);
if (ku.UpdateUniform(9, aFloatValues)) {
mGL->fUniformMatrix3fv(ku.mLocation, 1, false, ku.mValue.f16v);
}
}
void SetMatrixUniform(KnownUniform::KnownUniformName aKnownUniform, const gfx::Matrix4x4& aMatrix) {
SetMatrixUniform(aKnownUniform, &aMatrix._11);
}

Просмотреть файл

@ -1148,6 +1148,64 @@ gfxUtils::EncodeSourceSurface(SourceSurface* aSurface,
aBinaryOrData, aFile, nullptr);
}
/* From Rec601:
[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16]
[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128]
[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275]
[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196]
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
From Rec709:
[R] [1.1643835616438356, 4.2781193979771426e-17, 1.7927410714285714] [ Y - 16]
[G] = [1.1643835616438358, -0.21324861427372963, -0.532909328559444] x [Cb - 128]
[B] [1.1643835616438356, 2.1124017857142854, 0.0] [Cr - 128]
For [0,1] instead of [0,255], and to 5 places:
[R] [1.16438, 0.00000, 1.79274] [ Y - 0.06275]
[G] = [1.16438, -0.21325, -0.53291] x [Cb - 0.50196]
[B] [1.16438, 2.11240, 0.00000] [Cr - 0.50196]
*/
/* static */ float*
gfxUtils::Get4x3YuvColorMatrix(YUVColorSpace aYUVColorSpace)
{
static const float yuv_to_rgb_rec601[12] = { 1.16438f, 0.0f, 1.59603f, 0.0f,
1.16438f, -0.39176f, -0.81297f, 0.0f,
1.16438f, 2.01723f, 0.0f, 0.0f,
};
static const float yuv_to_rgb_rec709[12] = { 1.16438f, 0.0f, 1.79274f, 0.0f,
1.16438f, -0.21325f, -0.53291f, 0.0f,
1.16438f, 2.11240f, 0.0f, 0.0f,
};
if (aYUVColorSpace == YUVColorSpace::BT709) {
return const_cast<float*>(yuv_to_rgb_rec709);
} else {
return const_cast<float*>(yuv_to_rgb_rec601);
}
}
/* static */ float*
gfxUtils::Get3x3YuvColorMatrix(YUVColorSpace aYUVColorSpace)
{
static const float yuv_to_rgb_rec601[9] = {
1.16438f, 1.16438f, 1.16438f, 0.0f, -0.39176f, 2.01723f, 1.59603f, -0.81297f, 0.0f,
};
static const float yuv_to_rgb_rec709[9] = {
1.16438f, 1.16438f, 1.16438f, 0.0f, -0.21325f, 2.11240f, 1.79274f, -0.53291f, 0.0f,
};
if (aYUVColorSpace == YUVColorSpace::BT709) {
return const_cast<float*>(yuv_to_rgb_rec709);
} else {
return const_cast<float*>(yuv_to_rgb_rec601);
}
}
/* static */ void
gfxUtils::WriteAsPNG(SourceSurface* aSurface, const nsAString& aFile)
{

Просмотреть файл

@ -7,6 +7,7 @@
#define GFX_UTILS_H
#include "gfxTypes.h"
#include "ImageTypes.h"
#include "imgIContainer.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
@ -41,6 +42,7 @@ public:
typedef mozilla::gfx::SourceSurface SourceSurface;
typedef mozilla::gfx::SurfaceFormat SurfaceFormat;
typedef mozilla::image::ImageRegion ImageRegion;
typedef mozilla::YUVColorSpace YUVColorSpace;
/*
* Premultiply or Unpremultiply aSourceSurface, writing the result
@ -134,6 +136,13 @@ public:
*/
static void ClearThebesSurface(gfxASurface* aSurface);
/**
* Get array of yuv to rgb conversion matrix.
*/
static float* Get4x3YuvColorMatrix(YUVColorSpace aYUVColorSpace);
static float* Get3x3YuvColorMatrix(YUVColorSpace aYUVColorSpace);
/**
* Creates a copy of aSurface, but having the SurfaceFormat aFormat.
*

Просмотреть файл

@ -11,7 +11,7 @@ fails-if(Android||B2G||Mulet) skip-if(gtkWidget) HTTP(..) == aspect-ratio-2b.xht
# Initial mulet triage: parity with B2G/B2G Desktop
HTTP(..) == aspect-ratio-3a.xhtml aspect-ratio-3a.xhtml
HTTP(..) == aspect-ratio-3b.xhtml aspect-ratio-3b.xhtml
fails-if(Android||B2G||Mulet) random-if(layersGPUAccelerated) fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == encoded-aspect-ratio-1.html encoded-aspect-ratio-1.html
fails-if(Android||B2G||Mulet) random-if(layersGPUAccelerated) == encoded-aspect-ratio-1.html encoded-aspect-ratio-1.html
# bug 623460 for WinXP
# Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G||Mulet) HTTP(..) == basic-1.xhtml basic-1.xhtml

Просмотреть файл

@ -6,7 +6,7 @@ fails-if(Android) skip-if(gtkWidget) HTTP(..) == aspect-ratio-2a.xhtml aspect-ra
fails-if(Android) skip-if(gtkWidget) HTTP(..) == aspect-ratio-2b.xhtml aspect-ratio-2-ref.html
HTTP(..) == aspect-ratio-3a.xhtml aspect-ratio-3-ref.xhtml
HTTP(..) == aspect-ratio-3b.xhtml aspect-ratio-3-ref.xhtml
fails-if(Android) random-if(layersGPUAccelerated) fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == encoded-aspect-ratio-1.html encoded-aspect-ratio-1-ref.html # bug 623460 for WinXP
fails-if(Android) random-if(layersGPUAccelerated) == encoded-aspect-ratio-1.html encoded-aspect-ratio-1-ref.html # bug 623460 for WinXP
fails-if(Android) HTTP(..) == basic-1.xhtml basic-1-ref.html
skip-if(Android) HTTP(..) == canvas-1a.xhtml basic-1-ref.html
fails-if(Android) HTTP(..) == canvas-1b.xhtml basic-1-ref.html

Просмотреть файл

@ -10,7 +10,7 @@ fails-if(Android||B2G||Mulet) skip-if(gtkWidget) HTTP(..) == aspect-ratio-2b.xht
# Initial mulet triage: parity with B2G/B2G Desktop
HTTP(..) == aspect-ratio-3a.xhtml aspect-ratio-3a.xhtml
HTTP(..) == aspect-ratio-3b.xhtml aspect-ratio-3b.xhtml
fails-if(Android||B2G||Mulet) random-if(layersGPUAccelerated) fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == encoded-aspect-ratio-1.html encoded-aspect-ratio-1.html
fails-if(Android||B2G||Mulet) random-if(layersGPUAccelerated) == encoded-aspect-ratio-1.html encoded-aspect-ratio-1.html
# bug 623460 for WinXP
# Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G||Mulet) HTTP(..) == basic-1.xhtml basic-1.xhtml

Просмотреть файл

@ -5,7 +5,7 @@ fails-if(Android) skip-if(gtkWidget) HTTP(..) == aspect-ratio-2a.xhtml aspect-ra
fails-if(Android) skip-if(gtkWidget) HTTP(..) == aspect-ratio-2b.xhtml aspect-ratio-2-ref.html
HTTP(..) == aspect-ratio-3a.xhtml aspect-ratio-3-ref.xhtml
HTTP(..) == aspect-ratio-3b.xhtml aspect-ratio-3-ref.xhtml
fails-if(Android) random-if(layersGPUAccelerated) fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == encoded-aspect-ratio-1.html encoded-aspect-ratio-1-ref.html # bug 623460 for WinXP
fails-if(Android) random-if(layersGPUAccelerated) == encoded-aspect-ratio-1.html encoded-aspect-ratio-1-ref.html # bug 623460 for WinXP
fails-if(Android) HTTP(..) == basic-1.xhtml basic-1-ref.html
skip-if(Android) HTTP(..) == canvas-1a.xhtml basic-1-ref.html
fails-if(Android) HTTP(..) == canvas-1b.xhtml basic-1-ref.html