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. |
12th April 2003, 05:04 | #61 | Link |
Registered User
Join Date: Apr 2002
Posts: 67
|
Code:
SimpleSample::SimpleSample(PClip _child, int _SquareSize, IScriptEnvironment* env) : GenericVideoFilter(_child), SquareSize(_SquareSize) { |
12th April 2003, 11:09 | #62 | Link |
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
Code:
class SimpleSample : public GenericVideoFilter { int SquareSize; string parameter2; public: SimpleSample(PClip _child, int _SquareSize, string _parameter2, IScriptEnvironment* env); SimpleSample::SimpleSample(PClip _child, int _SquareSize, IScriptEnvironment* env) : GenericVideoFilter(_child), SquareSize(_SquareSize), parameter2(_parameter2) { ... AVSValue __cdecl Create_SimpleSample(AVSValue args, void* user_data, IScriptEnvironment* env) { return new SimpleSample(args[0].AsClip(), args[1].AsInt(0), args[2].AsString(""), env); } extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) { env->AddFunction("SimpleSample", "c[SIZE]i[PARAM2]s", Create_SimpleSample, 0); return "`SimpleSample' SimpleSample plugin"; AFAIK the SquareSize(_SquareSize) is just one of the ways to intialise variables and isn't anything clever or complicated (or how else would I be able to use it ) regards Simon
__________________
http://www.geocities.com/siwalters_uk/fnews.html Last edited by Si; 12th April 2003 at 11:12. |
13th April 2003, 11:01 | #63 | Link |
Registered User
Join Date: Apr 2002
Posts: 67
|
Yep, I figured it out. I just moved the initializing into the constructor, since I have about 15 arguments the line was pretty ungodly.
I think the next logical step for the sample filter would be to modify the existing pixels rather than just overwrite them with a color. Something simple like add 10 to green, iirc the vdub sdk does something like that. |
13th April 2003, 13:24 | #64 | Link | |
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
Quote:
Code:
... if (vi.IsRGB24()) { ... //Now enhance the greeness of a square in the middle of the frame dstp = dst->GetWritePtr(); dstp = dstp + (dst_height/2 - SquareSize/2)*dst_pitch; for (h=0; h < SquareSize;h++) { for (w = dst_width/2 - SquareSize*3/2; w < dst_width/2 + SquareSize*3/2; w+=3) { *(dstp + w + 1) = max(255,*(dstp + w + 1) + 10); // Increase Green value by 10 limiting it to 255 (assumes src already copied to dst) } dstp = dstp + dst_pitch; srcp = srcp+ src_pitch; } } regards Simon
__________________
http://www.geocities.com/siwalters_uk/fnews.html Last edited by Si; 13th April 2003 at 13:27. |
|
18th April 2003, 00:22 | #65 | Link |
Avisynth 3.0 Developer
Join Date: Jan 2002
Location: France
Posts: 639
|
@Leuf
In the initialiser list (ie the list between : and { ) you must initialise superclasses (if there are any) and you can initialise members too. If you don't initialise members there, they are default initialised. For int and other primitives types, the default init is a no op so it's cost nothing more, but with classes it's generally better to use initialisers. And sometimes, you have to use them : when the variable is not assignable (ie cannot use = ) like const objects and some objects where copy has no meaning. |
1st May 2003, 21:42 | #67 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
The easiest way is to invoke the Subtitle filter.
IIRC the syntax is something like: PClip result = env->Invoke(child, "Subtitle", AVSValue(text)); return result.GetFrame(n,env); For more advanced output, have a look at Donalds fast and nice algorithm in Dup and Decomb.
__________________
Regards, sh0dan // VoxPod |
2nd May 2003, 14:45 | #69 | Link |
Avisynth 3.0 Developer
Join Date: Jan 2002
Location: France
Posts: 639
|
There are no such things in avisynth.
You can use boost/uBlas to provide matrix. Only sum and product I fear, you would have to make FFT and DCT yourself. I don't know of any library who provide those as well. |
2nd May 2003, 14:51 | #70 | Link | |
Registered User
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
|
Quote:
www.trbarry.com/DctFilter.zip (src & dll) - Tom |
|
2nd May 2003, 15:41 | #71 | Link |
Guest
Posts: n/a
|
@Bidoche
I wrote the FFT function. it works fine but too sloooowwwww !! (so i didn't start to code the iFFT). i heard that fftw is a higly optimized FFT library, but i don't undestand how to use it (i started c++ 2days ago... noob inside ^^) @trbarry thanks a million ^^ edit1: oops an error: identifier "_aligned_malloc" is undefined pWorkArea = (short * const) _aligned_malloc(8*8*2, 128); edit1b: _aligned_malloc isn't defined in my malloc.h (VCPP6.0 SP5) edit1c: replaced by malloc(8*8*2) and everythingrules ^^ edit2: oohhh your code is clean, nice to read ^^ edit3: i suppose sse2 optimization is disabled for the same reason than xvid. Last edited by Sigmatador; 3rd May 2003 at 15:05. |
3rd May 2003, 15:27 | #73 | Link | |
Registered User
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
|
Quote:
- Tom |
|
29th May 2003, 10:29 | #74 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
Have a look at audio.cpp instead.
To make an audio filter, remove the GetFrame part and put in a void __stdcall YourClass::GetAudio(void* buf, __int64 start, __int64 count, IScriptEnvironment* env) function.
__________________
Regards, sh0dan // VoxPod |
15th July 2003, 04:22 | #76 | Link |
Registered User
Join Date: Dec 2002
Posts: 6
|
Geocities appears to be hating me... I can't download the sample .zip file. * GOT IT - You might want to link it off your site since geocities won't allow direct inking from this site *
Thanks Last edited by snowmoon; 15th July 2003 at 04:25. |
16th July 2003, 18:29 | #77 | Link |
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
@Sigmatador (Sorry didn't realise thread had changed )
I was hoping someone else would do this @wer All the main source code is also available via Avisynth.org regards Simon
__________________
http://www.geocities.com/siwalters_uk/fnews.html |
9th August 2003, 22:04 | #78 | Link |
Registered User
Join Date: Aug 2003
Posts: 1
|
more than one clip in a filter ?
All the sample code is very helpful but I would like to write a filter that operates on more than one clip. Something like:
Dissolve(clip clip1, clip clip2 [,...], int overlap) Does anyone have a pointer to sample code for writing a filter to operate on multiple clips? I can't seem to be able to figure out how to access more than one clip in the GetFrame() method. All I can find are examples that operate on: PVideoFrame src = child->GetFrame(n, env); Where are the other clips when the filter takes multiple clips? Thanks Bob Cudmore |
29th August 2003, 00:43 | #79 | Link |
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
SimpleSample 1.7 (2 clips at once)
@cudmore
I've given it a go and it seems I can get it to work. So SimpleSample1.7 is available here (need to right-click and download as usual) I've only modded the YUY2 code (cause 1 - I'm too lazy to do the YV12 and Avisynth doesn't work anymore in RGB on my computer ) regards Simon
__________________
http://www.geocities.com/siwalters_uk/fnews.html |
18th November 2003, 18:55 | #80 | Link |
Registered User
Join Date: Nov 2002
Location: London
Posts: 115
|
I have been looking at this thread, and I am also interested in writing filters. I have very little coding knowledge, however, so little that I don't know how one would even go about compiling / what program to use etc. From what I gather this is C (that's right, I don't even know C, but I am determined). So if someone could tell the tools needed to get started with this (since this is a beginners sticky), it would be really cool, like what programs you are using to compile etc. I hope it doesn't seem pointless to explain if I have never coded anything really, but everyone starts somewhere right? And I have coded assembly language for TI calculators for fun a few years ago, this code looks much nicer than that . But still I am a coding n00b, so any help is appreciated! Thanks!
|
Thread Tools | Search this Thread |
Display Modes | |
|
|