Log in

View Full Version : DirectShow YUV to RGB conversion


easy2Bcheesy
10th June 2006, 09:16
Hi,

I'm looking to connect YUV sources to my RGB capture card, and then decode the YUV in software back to RGB. At the hardware side, this entails creating a cable to connect the Y pin to G, U to R and V to the B pin, if you see what I mean. I've made up the cables and here's a before/after frame to look at.

Raw Input:
http://img84.imageshack.us/img84/7012/untitled19ri.jpg

Converted Output:
http://img84.imageshack.us/img84/3470/untitled27cq.jpg

This pixel shader replicates the effect I require (save off as display.fx and you can load it up in VirtualDub):

texture vd_srctexture;

sampler src = sampler_state {
texture = <vd_srctexture>;
addressu = clamp;
addressv = clamp;
minfilter = linear;
magfilter = linear;
mipfilter = none;
};

float4 PS(float2 uv : TEXCOORD0) : COLOR0 {
float4 px = float4(tex2D(src, uv).xyz, 1);

return float4(
dot(float4( 1.402, 1, 0, -1.402*0.5), px),
dot(float4(-0.714, 1, -0.344, (0.714+0.344)*0.5), px),
dot(float4( 0, 1, 1.772, -1.772*0.5), px),
1
);
}

technique point {
pass p1 {
PixelShader = compile ps_2_0 PS();
}
}


I also have a VirtualDub filter that does the same thing, but the question is, would anyone out there be interested in converting this filter to DirectShow? Or is there a pre-existing DirectShow filter that does the same thing?

Of course I would be willing to pay a reasonable fee for any work undertaken.