MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / ShaderGetPixels

Function ShaderGetPixels

Source/Shaders.cpp:82–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81
82void ShaderGetPixels(
83 const bool bDX11,
84 const FmtConvParams_t& fmtParams,
85 const UINT chromaSubsampling,
86 const int chromaScaling,
87 const bool blendDeinterlace,
88 std::string& code)
89{
90 int planes = 1;
91 if (bDX11) {
92 if (fmtParams.pDX11Planes) {
93 if (fmtParams.pDX11Planes->FmtPlane3) {
94 planes = 3;
95 }
96 else if (fmtParams.pDX11Planes->FmtPlane2) {
97 planes = 2;
98 }
99 }
100 } else {
101 if (fmtParams.pDX9Planes) {
102 if (fmtParams.pDX9Planes->FmtPlane3) {
103 planes = 3;
104 }
105 else if (fmtParams.pDX9Planes->FmtPlane2) {
106 planes = 2;
107 }
108 }
109 }
110 DLog(L"ConvertColorShader: frame consists of {} planes", planes);
111
112 const bool packed422 = (fmtParams.cformat == CF_YUY2 || fmtParams.cformat == CF_UYVY
113 || fmtParams.cformat == CF_Y210
114 || fmtParams.cformat == CF_Y216
115 || fmtParams.cformat == CF_V210);
116 const bool blendDeint420 = (blendDeinterlace && fmtParams.Subsampling == 420);
117
118 const char* strChromaPos = "";
119 const char* strChromaPos2 = "";
120 if (fmtParams.Subsampling == 420) {
121 switch (chromaSubsampling) {
122 case DXVA2_VideoChromaSubsampling_Cosited:
123 strChromaPos = "+float2(dx*0.5,dy*0.5)";
124 strChromaPos2 = "+float2(-0.25,-0.25)";
125 DLog(L"ConvertColorShader: chroma location - Co-sited");
126 break;
127 case DXVA2_VideoChromaSubsampling_MPEG1:
128 //strChromaPos = "";
129 strChromaPos2 = "+float2(-0.5,-0.5)";
130 DLog(L"ConvertColorShader: chroma location - MPEG-1");
131 break;
132 case DXVA2_VideoChromaSubsampling_MPEG2:
133 default:
134 strChromaPos = "+float2(dx*0.5,0)";
135 strChromaPos2 = "+float2(-0.25,-0.5)";
136 DLog(L"ConvertColorShader: chroma location - MPEG-2");
137 }
138 }
139 else if (fmtParams.Subsampling == 422) {

Callers 1

GetShaderConvertColorFunction · 0.85

Calls 1

DLogFunction · 0.85

Tested by

no test coverage detected