DShow: Allow changing of device color space/range

Allow the ability for a user to force a specific color space or set the
YUV -> RGB conversion to use full range instead of partial
master
jp9000 2015-01-23 13:28:56 -08:00
parent 1ad9a413f7
commit 581187130b
18 changed files with 123 additions and 88 deletions

View File

@ -1211,6 +1211,16 @@ INT_PTR CALLBACK ConfigureDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPA
SendMessage(hwndTemp, CB_SETCURSEL, deinterlacingConfig.type, 0);
bool fullrange = configData->data->GetInt(L"fullrange") != 0;
SendMessage(GetDlgItem(hwnd, IDC_FULLRANGE), BM_SETCHECK, fullrange ? BST_CHECKED : BST_UNCHECKED, 0);
int colorSpace = configData->data->GetInt(L"colorspace");
hwndTemp = GetDlgItem(hwnd, IDC_COLORSPACE);
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)PluginStr("DeviceSelection.ColorSpace.Auto"));
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)L"709");
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)L"601");
SendMessage(hwndTemp, CB_SETCURSEL, colorSpace, 0);
//------------------------------------------
BOOL bCustomResolution = configData->data->GetInt(TEXT("customResolution"));
@ -2108,6 +2118,8 @@ INT_PTR CALLBACK ConfigureDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPA
BOOL bCustomResolution = SendMessage(GetDlgItem(hwnd, IDC_CUSTOMRESOLUTION), BM_GETCHECK, 0, 0) == BST_CHECKED;
BOOL bUsePointFiltering = SendMessage(GetDlgItem(hwnd, IDC_POINTFILTERING), BM_GETCHECK, 0, 0) == BST_CHECKED;
BOOL bPreserveSourceSize = SendMessage(GetDlgItem(hwnd, IDC_PRESERVESIZE), BM_GETCHECK, 0, 0) == BST_CHECKED;
BOOL fullRange = SendMessage(GetDlgItem(hwnd, IDC_FULLRANGE), BM_GETCHECK, 0, 0) == BST_CHECKED;
int colorSpace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0);
int deintId = (int)SendMessage(GetDlgItem(hwnd, IDC_DEINTERLACELIST), CB_GETCURSEL, 0, 0);
deinterlacingConfig = deinterlacerConfigs[deintId];
@ -2140,6 +2152,9 @@ INT_PTR CALLBACK ConfigureDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPA
configData->data->SetInt(TEXT("deinterlacingProcessor"), deinterlacingConfig.processor);
configData->data->SetInt(TEXT("deinterlacingDoublesFramerate"), deinterlacingConfig.doublesFramerate);
configData->data->SetInt(TEXT("fullrange"), fullRange ? 1 : 0);
configData->data->SetInt(TEXT("colorspace"), colorSpace);
//------------------------------------------
BOOL bUDMError;

View File

@ -105,7 +105,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
// Dialog
//
IDD_CONFIG DIALOGEX 0, 0, 429, 310
IDD_CONFIG DIALOGEX 0, 0, 429, 331
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "DeviceSelection"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@ -129,19 +129,22 @@ BEGIN
CONTROL "DeviceSelection.BottomFieldFirst",IDC_BFF,"Button",BS_AUTORADIOBUTTON | BS_RIGHT | WS_TABSTOP,154,68,119,10,WS_EX_RIGHT
CONTROL "DeviceSelection.PreserveSize",IDC_PRESERVESIZE,"Button",BS_AUTOCHECKBOX | BS_RIGHT | WS_TABSTOP,294,54,119,10,WS_EX_RIGHT
CONTROL "DeviceSelection.GPUDeinterlacing",IDC_GPUDEINT,"Button",BS_AUTOCHECKBOX | BS_RIGHT | WS_TABSTOP,294,68,119,10,WS_EX_RIGHT
GROUPBOX "DeviceSelection.Video",IDC_STATIC,6,79,216,101
GROUPBOX "DeviceSelection.Video",IDC_STATIC,6,79,216,121
CONTROL "DeviceSelection.CustomResolution",IDC_CUSTOMRESOLUTION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,91,130,10,WS_EX_RIGHT
RTEXT "DeviceSelection.Resolution",IDC_STATIC,17,108,117,8
COMBOBOX IDC_RESOLUTION,137,105,76,72,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
RTEXT "DeviceSelection.FPS",IDC_STATIC,17,125,117,8
COMBOBOX IDC_FPS,137,123,76,56,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,90,130,10,WS_EX_RIGHT
RTEXT "DeviceSelection.Resolution",IDC_STATIC,17,105,117,8
COMBOBOX IDC_RESOLUTION,137,102,76,72,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
RTEXT "DeviceSelection.FPS",IDC_STATIC,17,120,117,8
COMBOBOX IDC_FPS,137,118,76,56,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "DeviceSelection.PreferredType",IDC_USEPREFERREDOUTPUT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,144,117,10,WS_EX_RIGHT
COMBOBOX IDC_PREFERREDOUTPUT,137,142,76,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "DeviceSelection.UseBuffering",IDC_USEBUFFERING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,163,117,10,WS_EX_RIGHT
EDITTEXT IDC_DELAY_EDIT,137,160,40,14,ES_AUTOHSCROLL
CONTROL "",IDC_DELAY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,177,160,11,14
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,136,117,10,WS_EX_RIGHT
COMBOBOX IDC_PREFERREDOUTPUT,137,134,76,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "DeviceSelection.UseBuffering",IDC_USEBUFFERING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,154,117,10,WS_EX_RIGHT
EDITTEXT IDC_DELAY_EDIT,137,151,40,14,ES_AUTOHSCROLL
CONTROL "",IDC_DELAY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,177,151,11,14
RTEXT "DeviceSelection.ColorSpace",IDC_STATIC,17,171,117,8
COMBOBOX IDC_COLORSPACE,137,169,76,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "DeviceSelection.UseFullRange",IDC_FULLRANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,186,130,10,WS_EX_RIGHT
GROUPBOX "DeviceSelection.Sound",IDC_STATIC,233,79,187,136,WS_GROUP
LTEXT "DeviceSelection.AudioDevice",IDC_STATIC,242,96,117,8
COMBOBOX IDC_AUDIOLIST,242,108,169,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -153,26 +156,26 @@ BEGIN
CONTROL "",IDC_TIMEOFFSET,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,400,180,11,14
CONTROL "DeviceSelection.PlayToDesktop",IDC_PLAYDESKTOPSOUND,
"Button",BS_AUTORADIOBUTTON,242,198,163,10
GROUPBOX "DeviceSelection.ChromaKey",IDC_STATIC,6,186,216,99
CONTROL "DeviceSelection.UseChromaKey",IDC_USECHROMAKEY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,198,130,10,WS_EX_RIGHT
RTEXT "DeviceSelection.Color",IDC_STATIC,13,214,117,8
CONTROL "",IDC_COLOR,"OBSColorControl",WS_TABSTOP,132,211,28,14
PUSHBUTTON "DeviceSelection.Select",IDC_SELECTCOLOR,165,211,50,14
RTEXT "DeviceSelection.Similarity",IDC_STATIC,13,232,117,8
EDITTEXT IDC_BASETHRESHOLD_EDIT,131,230,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_BASETHRESHOLD,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,172,230,11,14
RTEXT "DeviceSelection.Blend",IDC_STATIC,11,248,117,8
EDITTEXT IDC_BLEND_EDIT,131,247,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_BLEND,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,171,247,11,14
RTEXT "DeviceSelection.SpillReduction",IDC_STATIC,11,264,117,8
EDITTEXT IDC_SPILLREDUCTION_EDIT,131,263,40,14,ES_AUTOHSCROLL
CONTROL "",IDC_SPILLREDUCTION,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,171,263,11,14
GROUPBOX "DeviceSelection.ChromaKey",IDC_STATIC,6,205,216,99
CONTROL "DeviceSelection.UseChromaKey",IDC_USECHROMAKEY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,217,130,10,WS_EX_RIGHT
RTEXT "DeviceSelection.Color",IDC_STATIC,13,233,117,8
CONTROL "",IDC_COLOR,"OBSColorControl",WS_TABSTOP,132,230,28,14
PUSHBUTTON "DeviceSelection.Select",IDC_SELECTCOLOR,165,230,50,14
RTEXT "DeviceSelection.Similarity",IDC_STATIC,13,251,117,8
EDITTEXT IDC_BASETHRESHOLD_EDIT,131,249,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_BASETHRESHOLD,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,172,249,11,14
RTEXT "DeviceSelection.Blend",IDC_STATIC,11,267,117,8
EDITTEXT IDC_BLEND_EDIT,131,266,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_BLEND,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,171,266,11,14
RTEXT "DeviceSelection.SpillReduction",IDC_STATIC,11,283,117,8
EDITTEXT IDC_SPILLREDUCTION_EDIT,131,282,40,14,ES_AUTOHSCROLL
CONTROL "",IDC_SPILLREDUCTION,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,171,282,11,14
CONTROL "DeviceSelection.UseAudioRender",IDC_USEAUDIORENDER,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,233,218,119,10
RTEXT "DeviceSelection.Gamma",IDC_STATIC,234,233,95,8
CONTROL "",IDC_GAMMA,"msctls_trackbar32",TBS_BOTH | WS_TABSTOP,229,242,191,26
LTEXT ".numbers!",IDC_GAMMAVAL,335,233,54,8
LTEXT "DeviceSelection.64BitWarning",IDC_64BIT_WARNING,7,287,300,16,NOT WS_VISIBLE
LTEXT "DeviceSelection.64BitWarning",IDC_64BIT_WARNING,7,306,300,16,NOT WS_VISIBLE
DEFPUSHBUTTON "OK",IDOK,314,289,50,14
PUSHBUTTON "Cancel",IDCANCEL,372,289,50,14
END
@ -191,7 +194,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 422
TOPMARGIN, 7
BOTTOMMARGIN, 295
BOTTOMMARGIN, 316
END
END
#endif // APSTUDIO_INVOKED

View File

@ -25,6 +25,13 @@ struct ResSize
UINT cy;
};
enum
{
COLORSPACE_AUTO,
COLORSPACE_709,
COLORSPACE_601
};
#undef DEFINE_GUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID DECLSPEC_SELECTANY name \
@ -184,6 +191,37 @@ const float yuvMat[16] = {0.256788f, 0.504129f, 0.097906f, 0.062745f,
0.439216f, -0.367788f, -0.071427f, 0.501961f,
0.000000f, 0.000000f, 0.000000f, 1.000000f};
const float yuvToRGB601[2][16] =
{
{
1.164384f, 0.000000f, 1.596027f, -0.874202f,
1.164384f, -0.391762f, -0.812968f, 0.531668f,
1.164384f, 2.017232f, 0.000000f, -1.085631f,
0.000000f, 0.000000f, 0.000000f, 1.000000f
},
{
1.000000f, 0.000000f, 1.407520f, -0.706520f,
1.000000f, -0.345491f, -0.716948f, 0.533303f,
1.000000f, 1.778976f, 0.000000f, -0.892976f,
0.000000f, 0.000000f, 0.000000f, 1.000000f
}
};
const float yuvToRGB709[2][16] = {
{
1.164384f, 0.000000f, 1.792741f, -0.972945f,
1.164384f, -0.213249f, -0.532909f, 0.301483f,
1.164384f, 2.112402f, 0.000000f, -1.133402f,
0.000000f, 0.000000f, 0.000000f, 1.000000f
},
{
1.000000f, 0.000000f, 1.581000f, -0.793600f,
1.000000f, -0.188062f, -0.469967f, 0.330305f,
1.000000f, 1.862906f, 0.000000f, -0.935106f,
0.000000f, 0.000000f, 0.000000f, 1.000000f
}
};
void DeviceSource::SetAudioInfo(AM_MEDIA_TYPE *audioMediaType, GUID &expectedAudioType)
{
expectedAudioType = audioMediaType->subtype;
@ -268,6 +306,8 @@ bool DeviceSource::LoadFilters()
strAudioDevice = data->GetString(TEXT("audioDevice"));
strAudioName = data->GetString(TEXT("audioDeviceName"));
strAudioID = data->GetString(TEXT("audioDeviceID"));
fullRange = data->GetInt(TEXT("fullrange")) != 0;
use709 = false;
bFlipVertical = data->GetInt(TEXT("flipImage")) != 0;
bFlipHorizontal = data->GetInt(TEXT("flipImageHorizontal")) != 0;
@ -519,7 +559,10 @@ bool DeviceSource::LoadFilters()
else if(bestOutput->videoType == VideoOutputType_UYVY)
colorType = DeviceOutputType_UYVY;
else if(bestOutput->videoType == VideoOutputType_HDYC)
{
colorType = DeviceOutputType_HDYC;
use709 = true;
}
else
{
colorType = DeviceOutputType_RGB;
@ -1659,6 +1702,16 @@ void DeviceSource::Render(const Vect2 &pos, const Vect2 &size)
colorConvertShader->SetFloat (colorConvertShader->GetParameterByName(TEXT("keySpill")), fSpillVal);
}
colorConvertShader->SetFloat (colorConvertShader->GetParameterByName(TEXT("gamma")), fGamma);
float mat[16];
bool actuallyUse709 = (colorSpace == COLORSPACE_AUTO) ? !!use709 : (colorSpace == COLORSPACE_709);
if (actuallyUse709)
memcpy(mat, yuvToRGB709[fullRange ? 1 : 0], sizeof(float) * 16);
else
memcpy(mat, yuvToRGB601[fullRange ? 1 : 0], sizeof(float) * 16);
colorConvertShader->SetValue (colorConvertShader->GetParameterByName(TEXT("yuvMat")), mat, sizeof(float) * 16);
}
else {
if(fGamma != 1.0f && bFiltersLoaded) {
@ -1754,6 +1807,9 @@ void DeviceSource::UpdateSettings()
else
frameIntervalDiff = frameInterval - newFrameInterval;
fullRange = data->GetInt(TEXT("fullrange")) != 0;
colorSpace = data->GetInt(TEXT("colorspace"));
if(strNewAudioDevice == "Disable" && strAudioDevice == "Disable")
bCheckSoundOutput = false;

View File

@ -141,6 +141,9 @@ class DeviceSource : public ImageSource
UINT linePitch, lineShift, lineSize;
BOOL bUseCustomResolution;
UINT preferredOutputType;
BOOL fullRange;
int colorSpace;
BOOL use709;
struct {
int type; //DeinterlacingType

View File

@ -42,6 +42,7 @@
#define IDC_OPACITY 1028
#define IDC_OUTPUTSOUND 1029
#define IDC_PLAYDESKTOPSOUND 1030
#define IDC_FULLRANGE 1031
#define IDC_EDIT1 1032
#define IDC_TIMEOFFSET_EDIT 1032
#define IDC_TIMEOFFSET 1033
@ -59,6 +60,8 @@
#define IDC_PRESERVESIZE 1042
#define IDC_64BIT_WARNING 1043
#define IDC_USEAUDIORENDER 1044
#define IDC_PREFERREDOUTPUT2 1046
#define IDC_COLORSPACE 1046
#define IDC_GAMMAVAL 1151
// Next default values for new objects

View File

@ -58,6 +58,9 @@ DeviceSelection.UseBuffering="Use Buffering (milliseconds):"
DeviceSelection.UseChromaKey="Use Chroma Key"
DeviceSelection.UseDeviceAudio="(Use Device Audio)"
DeviceSelection.Video="Video"
DeviceSelection.ColorSpace="Color Space"
DeviceSelection.ColorSpace.Auto="Auto"
DeviceSelection.UseFullRange="Use Full Range"
Plugin.Description="This plugin allows you to add DirectShow video devices (webcams, capture cards, etc) to the scene"
Plugin.Name="DirectShow Video Device Plugin"

View File

@ -18,6 +18,7 @@
uniform Texture2D diffuseTexture;
uniform float4x4 yuvMat;
uniform float4 outputColor;
uniform float4 keyBaseColor;
uniform float4 chromaKey;
@ -73,11 +74,6 @@ float4 main(VertData input) : SV_Target
//-----------------------------
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.213249, 2.112402, 0.0,
1.792741, -0.532909, 0.000000, 0.0,
-0.972945, 0.301483, -1.133402, 1.0};
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);
rgbx = float4(saturate(rgbx.rgb), fullMask);

View File

@ -18,6 +18,7 @@
uniform Texture2D diffuseTexture;
uniform float4x4 yuvMat;
uniform float4 outputColor;
uniform float4 keyBaseColor;
uniform float4 chromaKey;
@ -73,11 +74,6 @@ float4 main(VertData input) : SV_Target
//-----------------------------
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);
rgbx = float4(saturate(rgbx.rgb), fullMask);

View File

@ -18,6 +18,7 @@
uniform Texture2D diffuseTexture;
uniform float4x4 yuvMat;
uniform float4 outputColor;
uniform float4 keyBaseColor;
uniform float4 chromaKey;
@ -73,11 +74,6 @@ float4 main(VertData input) : SV_Target
//-----------------------------
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);
rgbx = float4(saturate(rgbx.rgb), fullMask);

View File

@ -18,6 +18,7 @@
uniform Texture2D diffuseTexture;
uniform float4x4 yuvMat;
uniform float4 outputColor;
uniform float4 keyBaseColor;
uniform float4 chromaKey;
@ -73,11 +74,6 @@ float4 main(VertData input) : SV_Target
//-----------------------------
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);
rgbx = float4(saturate(rgbx.rgb), fullMask);

View File

@ -18,6 +18,7 @@
uniform Texture2D diffuseTexture;
uniform float4x4 yuvMat;
uniform float4 outputColor;
uniform float4 keyBaseColor;
uniform float4 chromaKey;
@ -73,11 +74,6 @@ float4 main(VertData input) : SV_Target
//-----------------------------
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);
rgbx = float4(saturate(rgbx.rgb), fullMask);

View File

@ -18,6 +18,7 @@
uniform Texture2D diffuseTexture;
uniform float4x4 yuvMat;
uniform float4 outputColor;
uniform float4 keyBaseColor;
uniform float4 chromaKey;
@ -73,11 +74,6 @@ float4 main(VertData input) : SV_Target
//-----------------------------
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);
rgbx = float4(saturate(rgbx.rgb), fullMask);

View File

@ -19,6 +19,7 @@
uniform Texture2D diffuseTexture;
uniform float4 outputColor;
uniform float4x4 yuvMat;
uniform float gamma;
SamplerState textureSampler
@ -36,11 +37,6 @@ struct VertData
float4 main(VertData input) : SV_Target
{
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.213249, 2.112402, 0.0,
1.792741, -0.532909, 0.000000, 0.0,
-0.972945, 0.301483, -1.133402, 1.0};
//a nice quick colorspace conversion
float4 yuvx = diffuseTexture.Sample(textureSampler, input.texCoord).grba;
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);

View File

@ -19,6 +19,7 @@
uniform Texture2D diffuseTexture;
uniform float4 outputColor;
uniform float4x4 yuvMat;
uniform float gamma;
SamplerState textureSampler
@ -36,11 +37,6 @@ struct VertData
float4 main(VertData input) : SV_Target
{
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
//a nice quick colorspace conversion
float4 yuvx = diffuseTexture.Sample(textureSampler, input.texCoord).grba;
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);

View File

@ -19,6 +19,7 @@
uniform Texture2D diffuseTexture;
uniform float4 outputColor;
uniform float4x4 yuvMat;
uniform float gamma;
SamplerState textureSampler
@ -36,11 +37,6 @@ struct VertData
float4 main(VertData input) : SV_Target
{
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
//a nice quick colorspace conversion
float4 yuvx = diffuseTexture.Sample(textureSampler, input.texCoord).rgba;
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);

View File

@ -19,6 +19,7 @@
uniform Texture2D diffuseTexture;
uniform float4 outputColor;
uniform float4x4 yuvMat;
uniform float gamma;
SamplerState textureSampler
@ -36,11 +37,6 @@ struct VertData
float4 main(VertData input) : SV_Target
{
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
//a nice quick colorspace conversion
float4 yuvx = diffuseTexture.Sample(textureSampler, input.texCoord).rgab;
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);

View File

@ -19,6 +19,7 @@
uniform Texture2D diffuseTexture;
uniform float4 outputColor;
uniform float4x4 yuvMat;
uniform float gamma;
SamplerState textureSampler
@ -36,11 +37,6 @@ struct VertData
float4 main(VertData input) : SV_Target
{
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
//a nice quick colorspace conversion
float4 yuvx = diffuseTexture.Sample(textureSampler, input.texCoord).rbga;
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);

View File

@ -19,6 +19,7 @@
uniform Texture2D diffuseTexture;
uniform float4 outputColor;
uniform float4x4 yuvMat;
uniform float gamma;
SamplerState textureSampler
@ -36,11 +37,6 @@ struct VertData
float4 main(VertData input) : SV_Target
{
const float4x4 yuvMat = {1.164384, 1.164384, 1.164384, 0.0,
0.000000, -0.391762, 2.017232, 0.0,
1.596027, -0.812968, 0.000000, 0.0,
-0.874202, 0.531668, -1.085631, 1.0};
//a nice quick colorspace conversion
float4 yuvx = diffuseTexture.Sample(textureSampler, input.texCoord).ragb;
float4 rgbx = mul(float4(yuvx.xyz, 1.0), yuvMat);