Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th December 2004, 11:06   #1  |  Link
Antitorgo
Registered User
 
Join Date: Dec 2004
Posts: 32
AviShader Released!

Since not everyone reads the Avisynth dev forum... From http://forum.doom9.org/showthread.php?s=&threadid=86793
(if cross-posting this one time for release issues is "bad", then mods please slap my wrist) Please keep dev issues on the dev forum thread, and usage issues in this one.

Merry X-Mas everyone:

http://www.blosser.org/d9/dlAviShader01.rar

version 0.1 Alpha

Usage:
clip.ConvertToRGB32().AviShader("effect filename", "technique to use")
Ex:
clip.ConvertToRGB32().AviShader("c:\effect.fx", "Default")

Some limitations are:
- Multipass isn't working yet (It wasn't in CShader either, but I'm 99.9% sure I know the reason)
- You need to convert to RGB32. I'm working on YV12 support, because I don't want to hurt performance. If you leave it in YV12 colorspace, it'll look really funky.
- No temporal support yet, I know how I want to do it though.
- No width/height constant support in the FX files yet, I want to add this so that the filter kernels are more accurate. (Ex: The sharpen kernel is just a guess)
- 900 million other things.

Please, please leave feedback on speeds etc. Plus, I need more ideas on cool filters to write!
Antitorgo is offline   Reply With Quote
Old 31st December 2004, 01:54   #2  |  Link
State of Mind
Registered User
 
Join Date: Apr 2004
Posts: 105
I get the impression no one seems interested in this filter, but I admire you for your hard work. What does this filter actually do?
State of Mind is offline   Reply With Quote
Old 31st December 2004, 02:12   #3  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
... but the development thread has lots of development-related posts that most people won't be interested in.

I agree with State of Mind: you should describe your filter here too.
stickboy is offline   Reply With Quote
Old 31st December 2004, 02:50   #4  |  Link
Antitorgo
Registered User
 
Join Date: Dec 2004
Posts: 32
Ah, yes... it would make sense if I described it some here. I'm used to people knowing what it is in the dev forum I forgot...

Avisynth is a generic plugin that uses your 3D card's hardware to assist with rendering. Currently, I only have a few generic techniques, and the plugin needs a lot of work, but it should give some people the idea that yes, hardware assisted rendering is possible.

Examples:
clip.Undot().ConvertToRGB32().AviShader("c:\effect.fx", "BlackAndWhite")
clip.Undot().ConvertToRGB32().AviShader("c:\effect.fx", "Funky")
clip.Undot().ConvertToRGB32().AviShader("c:\effect.fx", "Wavy")

I'm currently working on the resizing code, and have supersampling code in the works. My current tests are doing a 4x SSXSharpen at ~12fps but it is using a linear resize. I'm putting in a bilinear resize right at this moment.

I'll post more on a new version when I get the resizing code fixed up.
Antitorgo is offline   Reply With Quote
Old 31st December 2004, 17:51   #5  |  Link
State of Mind
Registered User
 
Join Date: Apr 2004
Posts: 105
So, this filter's purpose is...?
To allow hardware such as my video card to assist in the encoding of my videos?
State of Mind is offline   Reply With Quote
Old 31st December 2004, 19:06   #6  |  Link
Socio
Registered User
 
Join Date: May 2004
Posts: 291
Anyone else have a problem downloading it?
Socio is offline   Reply With Quote
Old 31st December 2004, 19:20   #7  |  Link
ObiKenobi
Guest
 
Posts: n/a
Quote:
Originally posted by Socio
Anyone else have a problem downloading it?
Nope, just downloaded it right now.
  Reply With Quote
Old 31st December 2004, 19:20   #8  |  Link
ObiKenobi
Guest
 
Posts: n/a
Quote:
Originally posted by State of Mind
So, this filter's purpose is...?
To allow hardware such as my video card to assist in the encoding of my videos?
It uses your video card to assist in rendering effects. Has nothing to do with encoding the video. Download and read the help file and it will tell you the effects it can currently do.
  Reply With Quote
Old 31st December 2004, 20:58   #9  |  Link
Socio
Registered User
 
Join Date: May 2004
Posts: 291
I finally downloaded it,

I have tested it out and like what I see so far! I am using a ATI card I do not see and differences if I enable AA or AF even to full, does AA or AF have any affect on the process?

Socio is offline   Reply With Quote
Old 1st January 2005, 01:08   #10  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Quote:
Originally posted by Socio

...does AA or AF have any affect on the process?
Nope, afaik this shouldnt affect process...


Bye
__________________

Visit my IRC channel

Last edited by Soulhunter; 1st January 2005 at 01:20.
Soulhunter is offline   Reply With Quote
Old 1st January 2005, 02:43   #11  |  Link
Antitorgo
Registered User
 
Join Date: Dec 2004
Posts: 32
Turning on AF will probably do nothing, since it is "looking" at a flat plane striaght on. AF should only come into play when looking at a plane at an angle...

Forcing AA depends on what the graphics vendor considers AA... If I recall correctly, ATI doesn't AA the textures (which this is), just the vertices. This way, they get fullscreen AA cheaper. I think they called it multi-sampling or something like that... Anyway, there was a little hullaballoo in the gaming community, and some folks figured out how to get it turned back on in the drivers... maybe do a search for it? I think maybe nVidia does AA the textures if you force it, but since I only have ATI cards, I don't know...

I'm still working on the supersampling stuff, it slows down things a lot when you are dealing with 4x, because it is 16x the data. The biggest issue however, is that for speed purposes, I am trying to get it to supersample on the card, that way, d/ling back from the card isn't super slow, just semi-slow. Anyway, the graphics cards only support point and bilinear resizing, so I'm working on a shader to take a point re-sized texture, and do some sort of interpolation like bicubic or lanczos on it. (I think I might have bicubic down now actually). Plus, I'm seeing if I can't utilize the vector shader to calculate some of the math instead of doing it all in the pixel shader. (Right now, everything is a pixel shader). Plus, I've added some speed improvements, where I'm re-using some COM objects more often and some other odd tricks that makes things faster. This has brought CPU utilization down to 70% on my box no matter what my framerate seems to be (30fps for simple stuff, 4fps for complex supersampled stuff, it is still 70-80%).
Antitorgo is offline   Reply With Quote
Old 10th January 2005, 04:58   #12  |  Link
dbzgundam
Hates all his encodes
 
dbzgundam's Avatar
 
Join Date: Sep 2003
Posts: 166
It no workie for me. ^^;;

I get what would seem to be a memory error on the bottom of VdubMod:

"AviSynth caught an access violation at blah blah blah, attempting to read from blah blah blah."

Isn't this typically a memory issue, that I've noticed is often solved simply by SetMemoryMax? I have nothing but Telecide and crop running after MPEG2Source, and then AVIShader...

If it matters (I wouldn't be surprised), my crappy graphics card is an old GeForce MX 440SE.
__________________
http://thevideophile.blogspot.com/ Watch and be amazed by my frustration over the video world!
dbzgundam is offline   Reply With Quote
Old 10th February 2005, 22:01   #13  |  Link
708145
Professional Lemming
 
708145's Avatar
 
Join Date: Dec 2003
Location: Stuttgart, Germany
Posts: 359
Wow awesome!

I have a Radeon8500 maybe that's why it doesn't work?

clip.ConvertToRGB32().AviShader("e:\effect.fx", "Default")
bailed out with an access violation!

I really like the idea to offload some filters (all?) to the GPU and I'll buy a faster one if neccessary! Since I don't play games there was no need to upgrade so far, but for encoding I'd do it

bis besser,
Tobias
__________________
projects page: ELDER, SmoothD, etc.
708145 is offline   Reply With Quote
Old 10th February 2005, 22:20   #14  |  Link
Antitorgo
Registered User
 
Join Date: Dec 2004
Posts: 32
Yeah, on a Radeon 8500 I wouldn't expect it to work (It only supports PS_1_1 I think).
[Edit]
It won't work on an old GeForceMX card either...
Basically, if you don't have a GeForceFX or a Radeon 9500+ this probably won't work for you.
[/Edit]

I'm still working on things, I just have been busy working out a lot of the kinks. I'd hold off on buying a newer card until there are some good filters out there for doing the processing... Plus by that time, maybe ATi will have released their newer cards... Oh, but when you do buy a new GPU, buy me one too

Last edited by Antitorgo; 10th February 2005 at 22:43.
Antitorgo is offline   Reply With Quote
Old 10th February 2005, 22:49   #15  |  Link
708145
Professional Lemming
 
708145's Avatar
 
Join Date: Dec 2003
Location: Stuttgart, Germany
Posts: 359
I looked up the specs: It supports up to PS1.4 No PS2.0

That makes 4 GPUs then since I'm sure you want SLI, too

bis besser,
Tobias
__________________
projects page: ELDER, SmoothD, etc.
708145 is offline   Reply With Quote
Old 7th March 2005, 14:35   #16  |  Link
yidaki
Registered User
 
yidaki's Avatar
 
Join Date: May 2003
Posts: 41
hmm, this could be very interesting in the future..
theoretically, you could the h/w deinterlacing from purevideo in your nvidia card
that's probably 15-30% of my cpu to the gpu
yidaki is offline   Reply With Quote
Old 12th March 2005, 07:30   #17  |  Link
Longinus
Registered User
 
Join Date: Apr 2003
Location: Brazil
Posts: 87
This plugins sounds really good (I always wanted to use the power of my GPU to video processing). Virtualdub 1.6 is using something like this for preview, right?

Anyway... I can't get this to work. It crashes my Virtualdub (or anything else).. Avisynth 2.55, WinXP, Geforce FX 5700.
Longinus is offline   Reply With Quote
Old 8th March 2008, 05:41   #18  |  Link
s.virojanadara
Registered User
 
Join Date: Mar 2008
Posts: 13
Bilateral filter for avishader 0.42

This is a quite useful plugin. I just wrote the bilateral filter to use with anime so your guys may try out.

Requirement
1. My filter design to use with Antitorgo's avishader 0.42 you can download here
http://www.blosser.org/d9/dlAviShader042.rar

2. Graphic card that support at least pixel shader 2.a

Code:
/*
HLSL Bilateral Filter for avishader version 0.42
Written by Sompon Virojanadara <s.virojanadara[]gmail.com>
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
SOMPON VIROJANADARA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Filters:
This file compose with 2 technique
1. BilateralFilter use a full kernel of bilateral filter technique time complexcity is O(n^2) where n is depend on geometric constant
2. Approx_BilateralFilter is a bilateral technique based on Pham and van Vliet [2005] time complexcity is O(2n) where n is depend on geometric constant

Constant Setting:
1. with - width of source video in pixel you want to sampling or downsampling into.
2. height - height of source video in pixel you want to sampling or downsampling into.
3. photometric - less: preserve more edge
                 more: more noise will be remove 
                 range: 0-1
4. geometric - size of kernel any odd number >= 3
(warning in BilateralFilter (fold_bilateral function) due to size restriction of Pixel shader 2.a you can't have size more than 5.)
Due to I cant make Pixel shader 3.0 work on avishader version 0.42 however it can work on avishader version 0.1. but that version doesn't support Approx_BilateralFilter -.-
However, if you want to have BilateralFilter with kernel size more than 5 don't hestitate to e-mail me (However, you need to have graphic card that support Pixel shader version 3.0))
*/


texture originalTexture;
texture frameTexture;

sampler2D frameSampler = sampler_state {
	Texture = <frameTexture>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;	
};
sampler2D originalSampler = sampler_state  {
	Texture = <originalTexture>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;	
};

sampler2D weightSampler;

float4x4 worldViewProj : WorldViewProjection;
float4 texelSize;
float4 imageSize;
int frameNum;


 float4 approx_bilateral_X( float2 Tex : TEXCOORD0 ) : COLOR0
 {
    const float width = 720;
    const float height = 480;
    const float photometric = 0.015;
    const float geometric = 17;
    const float midGeo = (geometric-1)/2 ; 
    const float midPoint = midGeo+1;
    const float stepX = 1.0/width;
    const float t = 1/(2*midGeo*midGeo);
    const float p = 1/(2*photometric*photometric);
    const float w2t = width * width * t;
    float4 Color;
    float tempG;
    float3 tempW;
    float3 tempC0;
    float3 tempC1;
    float3 tempC2;
    float3 normalizer;
    float2 position;
    float x;
    float optX;
    float2 tTex;
    tTex = Tex;
    tTex += texelSize.xy;
    normalizer = 1;
    x = stepX;
    tempC0 = tex2D( frameSampler, tTex.xy).xyz;
    Color.xyz = tempC0;
    for (int i = 0; i < midGeo; i++){
        optX = x * x * w2t;

            position = float2(tTex.x+x,tTex.y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);

            position = float2(tTex.x-x,tTex.y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);
 
        x += stepX;
    }

    Color.xyz = Color.xyz/normalizer.xyz;
    Color.w = 1;
    return Color;
 }
 float4 approx_bilateral_Y( float2 Tex : TEXCOORD0 ) : COLOR0
 {
    const float width = 720;
    const float height = 480;
    const float photometric = 0.015;
    const float geometric = 17;
    const float midGeo = (geometric-1)/2 ; 
    const float midPoint = midGeo+1;
    const float stepY = 1.0/height;
    const float t = 1/(2*midGeo*midGeo);
    const float p = 1/(2*photometric*photometric);
    const float h2t = height * height * t;
    float4 Color;
    float tempG;
    float3 tempW;
    float3 tempC0;
    float3 tempC1;
    float3 tempC2;
    float3 normalizer;
    float2 position;
    float2 tTex;
    tTex = Tex;
    tTex += texelSize.xy;
    float y;
    float optY;
    normalizer = 1;
    y = stepY;
    tempC0 = tex2D( frameSampler, tTex.xy).xyz;
    Color.xyz = tempC0;
    for (int i = 0; i < midGeo; i++){
        optY = y * y * h2t;
            position = float2(tTex.x,tTex.y+y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optY);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);

            position = float2(tTex.x,tTex.y-y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optY);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);
 
        y += stepY;
    }

    Color.xyz = Color.xyz/normalizer.xyz;
    Color.w = 1;
    return Color;
 }
 float4 fold_bilateral( float2 tTex : TEXCOORD0 ) : COLOR0
 {
    const float width = 280;
    const float height = 210;
    const float photometric = 0.025;
    const float geometric = 5;
    const float midGeo = (geometric-1)/2 ; 
    const float midPoint = midGeo+1;
    const float stepX = 1.0/width;
    const float stepY = 1.0/height;
    const float startX = -stepX * midGeo;
    const float startY = -stepY * midGeo;
    const float t = 1/(2*midGeo*midGeo);
    const float p = 1/(2*photometric*photometric);
    const float w2t = width * width * t;
    const float h2t = height * height * t;
    float4 Color;
    float tempG;
    float3 tempW;
    float3 tempC0;
    float3 tempC1;
    float3 tempC2;
    float3 normalizer;
    float2 position;
    float x;
    float y;
    float optX;
    float optY;
    normalizer = 1;
    x = stepX;
    tempC0 = tex2D( frameSampler, tTex.xy).xyz;
    Color.xyz = tempC0;
    for (int i = 0; i < midGeo; i++){
        y = stepY;
        optX = x * x * w2t;
            position = float2(tTex.x,tTex.y+y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);

            position = float2(tTex.x,tTex.y-y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);
       
            position = float2(tTex.x+x,tTex.y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);

            position = float2(tTex.x-x,tTex.y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);
        
        for (int j = 0; j < midGeo; j++){
            optX += y*y*h2t;

            position = float2(tTex.x+x,tTex.y+y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);

            position = float2(tTex.x-x,tTex.y+y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);

            position = float2(tTex.x+x,tTex.y-y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);

            position = float2(tTex.x-x,tTex.y-y);
            tempC1 = tex2D( frameSampler, position).xyz;
            tempC2 = tempC0-tempC1;
            tempW = exp(-(tempC2*tempC2*p)-optX);
            Color.xyz += (tempC1*tempW);
            normalizer += (tempW);

            y += stepY;

        } 

        x += stepX;
    }

    Color.xyz = Color.xyz/normalizer.xyz;
    Color.w = 1;
    return Color;
 }

technique Approx_BilateralFilter
{
    pass P1 { PixelShader = compile ps_2_a approx_bilateral_X(); }
    pass P2 { PixelShader = compile ps_2_a approx_bilateral_Y(); }
}
technique BilateralFilter
{
    pass P1 { PixelShader = compile ps_2_a fold_bilateral(); }
}
s.virojanadara is offline   Reply With Quote
Old 13th July 2008, 17:30   #19  |  Link
chriszxl
Little red-cap
 
chriszxl's Avatar
 
Join Date: Mar 2008
Location: wanna on moon
Posts: 42
cool stuff.....I would like put more work on gpu...bcos I really very little time to wacth HDTV and never play 3D games ,I thought I will before I buy my Geforce 9800GX2 videocard,I really dont know how to consume it ..
chriszxl is offline   Reply With Quote
Old 14th December 2011, 01:29   #20  |  Link
jclampy
Registered User
 
Join Date: Dec 2011
Posts: 40
No worries...

Quote:
Originally Posted by s.virojanadara View Post
Requirement
1. My filter design to use with Antitorgo's avishader 0.42 you can download here
http://www.blosser.org/d9/dlAviShader042.rar
Hi, would love to try this out but link is dead. Can anybody help?


Edit:
Hi guys a quick google found various plugins on this page: http://www.avisynth.info/?%A5%A2%A1%...AB%A5%A4%A5%D6

Mirror added for avishader 0.42 here: http://mediafire.com/?xkmatqlcvaoskv5

Last edited by jclampy; 14th December 2011 at 01:36. Reason: Mirror added
jclampy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:57.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.