Skip to content

Commit

Permalink
Added more yuvdenoise stuff
Browse files Browse the repository at this point in the history
git-svn-id: file:///media/trac/gputrans/trunk@60 9bcbe1e5-8bf3-0310-a9eb-bb9459eee777
  • Loading branch information
gjhurlbu committed Aug 17, 2006
1 parent 9b8d4db commit bede840
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/decimate.cg
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* This file is part of the gputrans package
* Copyright (C) 2006 Gavin Hurlbut
*
* gputrans is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

/*HEADER---------------------------------------------------
* $Id$
*
* Copyright 2006 Gavin Hurlbut
* All rights reserved
*
*/

struct deci {
float4 TEX0 : TEXCOORD0;
};

struct deciOut {
float4 TEX0 : TEXCOORD0;
float4 TEX1 : TEXCOORD1;
float4 TEX2 : TEXCOORD2;
float4 TEX3 : TEXCOORD3;
};

deciOut decimate_by_2( deci IN )
{
deciOut OUT;

OUT.TEX0 = ((IN.TEX0 - 0.5) * 2.0) + 0.5;
OUT.TEX1 = OUT.TEX0 + float4(1,0,0,0);
OUT.TEX2 = OUT.TEX0 + float4(1,1,0,0);
OUT.TEX3 = OUT.TEX0 + float4(0,1,0,0);

return OUT;
}

/*
* vim:ts=4:sw=4:ai:et:si:sts=4
*/

52 changes: 52 additions & 0 deletions src/yuvdenoise.cg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,58 @@ float3 contrast_frame( float2 coord : TEXCOORD0,
return value;
}

float3 diff_frame( float2 coord : TEXCOORD0,
uniform samplerRECT frameA : TEXUNIT0,
uniform samplerRECT frameB : TEXUNIT1) : COLOR
{
string id = "$Id$";

float3 value;

value = texRECT( frameA, coord ).xyz - texRECT( frameB, coord ).xyz;
value = abs(value);

return value;
}

float thresh_diff( float2 coord : TEXCOORD0,
uniform samplerRECT frame : TEXUNIT0,
uniform float threshold) : COLOR
{
string id = "$Id$";

float3 value;
float output;

value = texRECT( frame, coord ).xyz;
value -= threshold;
value.x = step( 0.0, value.x );
value.y = step( 0.0, value.y );
value.z = step( 0.0, value.z );

output = value.x + value.y + value.z;

return output;
}

float decimate_thresh_diff( float2 topleft : TEXCOORD0,
float2 topright : TEXCOORD1,
float2 bottomright : TEXCOORD2,
float2 bottomleft : TEXCOORD3,
uniform samplerRECT frame : TEXUNIT0 ) : COLOR
{
string id = "$Id$";

float value;

value = texRECT(frame, topleft).x;
value += texRECT(frame, topright).x;
value += texRECT(frame, bottomleft).x;
value += texRECT(frame, bottomright).x;

return value;
}


/*
* vim:ts=4:sw=4:ai:et:si:sts=4
Expand Down

0 comments on commit bede840

Please sign in to comment.