@@ -260,7 +260,7 @@ String DeviceSource::ChooseShader()
260
260
strShader << TEXT (" YUVToRGB.pShader" );
261
261
else if (colorType == DeviceOutputType_YV12)
262
262
strShader << TEXT (" YVUToRGB.pShader" );
263
- else if (colorType == DeviceOutputType_YVYU || colorType == DeviceOutputType_YUY2 || colorType == DeviceOutputType_UYVY || colorType == DeviceOutputType_HDYC)
263
+ else if (colorType == DeviceOutputType_YVYU || colorType == DeviceOutputType_YUY2 || colorType == DeviceOutputType_UYVY || colorType == DeviceOutputType_HDYC || colorType == DeviceOutputType_v210 )
264
264
strShader << TEXT (" UYVToRGB.pShader" );
265
265
else if (colorType == DeviceOutputType_r210)
266
266
strShader << TEXT (" r210.pShader" );
@@ -691,6 +691,8 @@ bool DeviceSource::LoadFilters()
691
691
}
692
692
else if (bestOutput->videoType == VideoOutputType_r210)
693
693
colorType = DeviceOutputType_r210;
694
+ else if (bestOutput->videoType == VideoOutputType_v210)
695
+ colorType = DeviceOutputType_v210;
694
696
else
695
697
{
696
698
colorType = DeviceOutputType_RGB;
@@ -1404,8 +1406,13 @@ void DeviceSource::ChangeSize(bool bSucceeded, bool bForce)
1404
1406
1405
1407
switch (colorType) {
1406
1408
case DeviceOutputType_RGB:
1409
+ lineSize = (renderCX * 4 );
1410
+ break ;
1407
1411
case DeviceOutputType_r210:
1408
- lineSize = renderCX * 4 ;
1412
+ lineSize = ((renderCX + 63 ) / 64 ) * 256 ;
1413
+ break ;
1414
+ case DeviceOutputType_v210:
1415
+ lineSize = ((renderCX + 47 ) / 48 ) * 128 ;
1409
1416
break ;
1410
1417
case DeviceOutputType_I420:
1411
1418
case DeviceOutputType_YV12:
@@ -1523,10 +1530,10 @@ void DeviceSource::ChangeSize(bool bSucceeded, bool bForce)
1523
1530
else // if we're working with planar YUV, we can just use regular RGB textures instead
1524
1531
{
1525
1532
BOOL statictexture = false ;
1526
- if (colorType == DeviceOutputType_YVYU || colorType == DeviceOutputType_YUY2 || colorType == DeviceOutputType_UYVY || colorType == DeviceOutputType_HDYC || colorType == DeviceOutputType_r210)
1533
+ if (colorType == DeviceOutputType_YVYU || colorType == DeviceOutputType_YUY2 || colorType == DeviceOutputType_UYVY || colorType == DeviceOutputType_HDYC || colorType == DeviceOutputType_r210 || colorType == DeviceOutputType_v210 )
1527
1534
{
1528
1535
DXGI_FORMAT format;
1529
- if (colorType == DeviceOutputType_r210){
1536
+ if (colorType == DeviceOutputType_r210 || colorType == DeviceOutputType_v210 ){
1530
1537
msetd (textureData, 0x000000FF , renderCX*renderCY*4 );
1531
1538
statictexture = false ;
1532
1539
format = DXGI_FORMAT_R10G10B10A2_UNORM;
@@ -1778,6 +1785,7 @@ void DeviceSource::Preprocess()
1778
1785
ChangeSize ();
1779
1786
1780
1787
// // AMD Radeon HD 7350 have texture corruption problem with dynamic texture map/unmap DXGI_FORMAT_R8G8_B8G8_UNORM
1788
+ // for intel HD graphics 2000, UpdateSubresource runs faster then lock + memcpy + unlock?
1781
1789
// LPBYTE lpData;
1782
1790
// UINT pitch;
1783
1791
// if(texture->Map(lpData, pitch))
@@ -1789,7 +1797,7 @@ void DeviceSource::Preprocess()
1789
1797
// }
1790
1798
1791
1799
ID3D10Texture2D *texture1 = (ID3D10Texture2D*)((D3D10Texture*)texture)->GetD3DTexture ();
1792
- GetD3D ()->UpdateSubresource (texture1, 0 , NULL , lastSample->lpData , linePitch, linePitch);
1800
+ GetD3D ()->UpdateSubresource (texture1, 0 , NULL , lastSample->lpData , linePitch, linePitch); // needs statictexture = true to work
1793
1801
1794
1802
bReadyToDraw = true ;
1795
1803
}
@@ -1811,6 +1819,64 @@ void DeviceSource::Preprocess()
1811
1819
bReadyToDraw = true ;
1812
1820
}
1813
1821
}
1822
+ else if (colorType == DeviceOutputType_v210)
1823
+ {
1824
+ ChangeSize ();
1825
+ LPBYTE lpData;
1826
+ UINT pitch;
1827
+ if (texture->Map (lpData, pitch))
1828
+ {
1829
+ for (UINT y = 0 ; y < renderCY; y++)
1830
+ {
1831
+ UINT *out = (UINT*)(&lpData[y*pitch]);
1832
+ UINT *in = (UINT*)(&lastSample->lpData [y*linePitch]);
1833
+ UINT x = 0 ;
1834
+ while (x+5 < renderCX)
1835
+ {
1836
+ UINT in1 = in[0 ];
1837
+ UINT in2 = in[1 ];
1838
+ UINT in3 = in[2 ];
1839
+ UINT in4 = in[3 ];
1840
+ in += 4 ;
1841
+ out[x] = in1;
1842
+ out[x+1 ] = (in1 & 0xFFF003FF ) | ((in2 << 10 ) & 0x000FFC00 );
1843
+ out[x+2 ] = ((in2 >> 10 ) & 0x000FFFFF ) | (in3 << 20 );
1844
+ out[x+3 ] = ((in2 >> 10 ) & 0x000003FF ) | (in3 << 20 ) | (in3 & 0x000FFC00 );
1845
+ out[x+4 ] = (in3 >> 20 ) | (in4 << 10 );
1846
+ out[x+5 ] = (in3 >> 20 ) | ((in4 << 10 ) & 0x3FF00000 ) | ((in4 >> 10 ) & 0xFFC00 );
1847
+ x += 6 ;
1848
+ }
1849
+ if (x < renderCX)
1850
+ {
1851
+ UINT in1 = in[0 ];
1852
+ out[x] = in1;
1853
+ if (x+1 < renderCX)
1854
+ {
1855
+ UINT in2 = in[1 ];
1856
+ out[x+1 ] = (in1 & 0xFFF003FF ) | ((in2 << 10 ) & 0x000FFC00 );
1857
+ if (x+2 < renderCX)
1858
+ {
1859
+ UINT in3 = in[2 ];
1860
+ out[x+2 ] = ((in2 >> 10 ) & 0x000FFFFF ) | (in3 << 20 );
1861
+ if (x+3 < renderCX)
1862
+ {
1863
+ out[x+3 ] = ((in2 >> 10 ) & 0x000003FF ) | (in3 << 20 ) | (in3 & 0x000FFC00 );
1864
+ if (x+4 < renderCX)
1865
+ {
1866
+ UINT in4 = in[3 ];
1867
+ out[x+4 ] = (in3 >> 20 ) | (in4 << 10 );
1868
+ if (x+5 < renderCX)
1869
+ out[x+5 ] = (in3 >> 20 ) | ((in4 << 10 ) & 0x3FF00000 ) | ((in4 >> 10 ) & 0xFFC00 );
1870
+ }
1871
+ }
1872
+ }
1873
+ }
1874
+ }
1875
+ }
1876
+ texture->Unmap ();
1877
+ bReadyToDraw = true ;
1878
+ }
1879
+ }
1814
1880
1815
1881
lastSample->Release ();
1816
1882
@@ -2066,7 +2132,7 @@ void DeviceSource::SetInt(CTSTR lpName, int iVal)
2066
2132
keyColor = (DWORD)iVal;
2067
2133
2068
2134
keyBaseColor = Color4 ().MakeFromRGBA (keyColor);
2069
- Matrix4x4TransformVect (keyChroma, (colorType == DeviceOutputType_HDYC || colorType == DeviceOutputType_RGB) ? (float *)yuv709Mat : (float *)yuvMat, keyBaseColor);
2135
+ Matrix4x4TransformVect (keyChroma, (colorType == DeviceOutputType_HDYC || colorType == DeviceOutputType_RGB || colorType == DeviceOutputType_r210 ) ? (float *)yuv709Mat : (float *)yuvMat, keyBaseColor);
2070
2136
keyChroma *= 2 .0f ;
2071
2137
if (colorType == DeviceOutputType_YVYU)
2072
2138
{
0 commit comments