Bug 940959 - Use alpha textures for YCbCr planes with D3D9. r=nrc

This commit is contained in:
Nicolas Silva 2013-11-21 17:40:55 +01:00
Родитель aff6efccdc
Коммит c2dbc23f36
3 изменённых файлов: 18 добавлений и 18 удалений

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

@ -184,31 +184,31 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
HRESULT hr;
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
1, 0, D3DFMT_A8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mYTexture), nullptr);
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
1, 0, D3DFMT_A8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mCbTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
1, 0, D3DFMT_A8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mCrTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpYTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpCbTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpCrTexture), nullptr);
}
@ -227,16 +227,16 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
} else {
HRESULT hr;
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
1, 0, D3DFMT_A8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mYTexture), nullptr);
if (!FAILED(hr)) {
aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
1, 0, D3DFMT_A8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mCbTexture), nullptr);
}
if (!FAILED(hr)) {
aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
1, 0, D3DFMT_A8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mCrTexture), nullptr);
}

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

@ -189,9 +189,9 @@ float4 YCbCrShader(const VS_OUTPUT aVertex) : COLOR
float4 yuv;
float4 color;
yuv.r = tex2D(s2DCr, aVertex.vTexCoords).r - 0.5;
yuv.g = tex2D(s2DY, aVertex.vTexCoords).r - 0.0625;
yuv.b = tex2D(s2DCb, aVertex.vTexCoords).r - 0.5;
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;
color.r = yuv.g * 1.164 + yuv.r * 1.596;
color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;
@ -255,9 +255,9 @@ float4 YCbCrShaderMask(const VS_OUTPUT_MASK aVertex) : COLOR
float4 yuv;
float4 color;
yuv.r = tex2D(s2DCr, aVertex.vTexCoords).r - 0.5;
yuv.g = tex2D(s2DY, aVertex.vTexCoords).r - 0.0625;
yuv.b = tex2D(s2DCb, aVertex.vTexCoords).r - 0.5;
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;
color.r = yuv.g * 1.164 + yuv.r * 1.596;
color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;

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

@ -358,17 +358,17 @@ DeprecatedTextureHostYCbCrD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
yuvDeserializer.GetYData(),
yuvDeserializer.GetYStride(),
size,
D3DFMT_L8, 1);
D3DFMT_A8, 1);
mTextures[1] = DataToTexture(mDevice,
yuvDeserializer.GetCbData(),
yuvDeserializer.GetCbCrStride(),
gfxCbCrSize,
D3DFMT_L8, 1);
D3DFMT_A8, 1);
mTextures[2] = DataToTexture(mDevice,
yuvDeserializer.GetCrData(),
yuvDeserializer.GetCbCrStride(),
gfxCbCrSize,
D3DFMT_L8, 1);
D3DFMT_A8, 1);
}
// aTexture should be in SYSTEMMEM, returns a texture in the default