mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-02 22:06:14 +00:00
@@ -786,41 +786,38 @@ void D3D11VARenderer::bindColorConversion(AVFrame* frame)
|
|||||||
switch (frame->chroma_location) {
|
switch (frame->chroma_location) {
|
||||||
default:
|
default:
|
||||||
case AVCHROMA_LOC_LEFT:
|
case AVCHROMA_LOC_LEFT:
|
||||||
constBuf.chromaOffset[0] = 0;
|
constBuf.chromaOffset[0] = 0.5;
|
||||||
constBuf.chromaOffset[1] = 0.5;
|
constBuf.chromaOffset[1] = 0;
|
||||||
break;
|
break;
|
||||||
case AVCHROMA_LOC_CENTER:
|
case AVCHROMA_LOC_CENTER:
|
||||||
|
constBuf.chromaOffset[0] = 0;
|
||||||
|
constBuf.chromaOffset[1] = 0;
|
||||||
|
break;
|
||||||
|
case AVCHROMA_LOC_TOPLEFT:
|
||||||
constBuf.chromaOffset[0] = 0.5;
|
constBuf.chromaOffset[0] = 0.5;
|
||||||
constBuf.chromaOffset[1] = 0.5;
|
constBuf.chromaOffset[1] = 0.5;
|
||||||
break;
|
break;
|
||||||
case AVCHROMA_LOC_TOPLEFT:
|
|
||||||
constBuf.chromaOffset[0] = 0;
|
|
||||||
constBuf.chromaOffset[1] = 0;
|
|
||||||
break;
|
|
||||||
case AVCHROMA_LOC_TOP:
|
case AVCHROMA_LOC_TOP:
|
||||||
constBuf.chromaOffset[0] = 0.5;
|
constBuf.chromaOffset[0] = 0;
|
||||||
constBuf.chromaOffset[1] = 0;
|
constBuf.chromaOffset[1] = 0.5;
|
||||||
break;
|
break;
|
||||||
case AVCHROMA_LOC_BOTTOMLEFT:
|
case AVCHROMA_LOC_BOTTOMLEFT:
|
||||||
constBuf.chromaOffset[0] = 0;
|
constBuf.chromaOffset[0] = 0.5;
|
||||||
constBuf.chromaOffset[1] = 1.0;
|
constBuf.chromaOffset[1] = -0.5;
|
||||||
break;
|
break;
|
||||||
case AVCHROMA_LOC_BOTTOM:
|
case AVCHROMA_LOC_BOTTOM:
|
||||||
constBuf.chromaOffset[0] = 0.5;
|
constBuf.chromaOffset[0] = 0;
|
||||||
constBuf.chromaOffset[1] = 1.0;
|
constBuf.chromaOffset[1] = -0.5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
constBuf.chromaOffset[0] /= m_TextureWidth;
|
||||||
|
constBuf.chromaOffset[1] /= m_TextureHeight;
|
||||||
|
|
||||||
if (yuv444) {
|
if (yuv444) {
|
||||||
// 4:4:4 has no subsampling
|
// 4:4:4 has no subsampling
|
||||||
constBuf.chromaOffset[0] = 0;
|
constBuf.chromaOffset[0] = 0;
|
||||||
constBuf.chromaOffset[1] = 0;
|
constBuf.chromaOffset[1] = 0;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// 4:2:0 has 2x2 subsampling
|
|
||||||
constBuf.chromaOffset[0] /= m_TextureWidth / 2;
|
|
||||||
constBuf.chromaOffset[1] /= m_TextureHeight / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D11_SUBRESOURCE_DATA constData = {};
|
D3D11_SUBRESOURCE_DATA constData = {};
|
||||||
constData.pSysMem = &constBuf;
|
constData.pSysMem = &constBuf;
|
||||||
|
|||||||
Reference in New Issue
Block a user