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. |
|
|
Thread Tools | Search this Thread | Display Modes |
26th January 2013, 05:20 | #1 | Link |
Beyond Kawaii
Join Date: Feb 2008
Location: Russia
Posts: 724
|
TempLinearApproximate. Filter for temporal linear approximation between pixels.
Takes several frames and for each pixel calculates linear approximation of its values through time, then returns its value in the middle (unless close to beginning or end of clip) of that line. Meant mainly for denoising aid in motion compensated clips. If you use it on plain video - you'll just get heavy ghosting.
Only works on planar formats. [USAGE] Code:
TempLinearApproximate(clip, int radius=5, int plane=7, bool inLsb=false, bool outLsb=false) plane: The sum of three flags of planes to process. 1=Y, 2=U, 4=V. inLsb: Set to true if input clip is in stacked 16 bit format. outLsb: Set to true if you want output to be in stacked 16 bit format, whether input clip is stacked 16 bit or not. Download TempLinearApproximate r6 Get the source code from Bitbucket repository. [CHANGELOG] Code:
r6: Full AviSynth 2.6 support. r5: Added support for stacked 16 bit format. r4: Fixed clamping issue changing white to black and black to white. r3: Optimization. r2: Fixed handling the frames pitch. r1: Initial release.
__________________
...desu! Last edited by Mystery Keeper; 27th March 2013 at 18:40. |
26th January 2013, 16:23 | #2 | Link |
Oz of the zOo
Join Date: May 2005
Posts: 208
|
There is a similar filter, TemporalSoften, so what are the advantages of TempLinearApproximate and in which cases will it do a better job?
Last edited by wOxxOm; 26th January 2013 at 16:25. |
26th January 2013, 20:48 | #3 | Link | |
Beyond Kawaii
Join Date: Feb 2008
Location: Russia
Posts: 724
|
Quote:
As I said, it will do a good job in well motion compensated clip.
__________________
...desu! |
|
26th January 2013, 23:33 | #4 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Pitch is a unique property of each PVideoFrame, your code uses the pitch of your output frame for everything and of course it does not work when the input frames do not have the same pitch value.
Use this as a pitch processing torture test for any plugins you develop. Code:
.... A=SelectEvery(3, 0).AddBorders(0,0, 16,0).Crop(0,0, -16,0) B=SelectEvery(3, 1).AddBorders(0,0, 32,0).Crop(0,0, -32,0) C=SelectEvery(3, 2).AddBorders(0,0, 64,0).Crop(0,0, -64,0) Interleave(A, B, C) .... |
27th January 2013, 04:24 | #7 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Width and Height are both properties of the PClip.
Hint:- You have structured your code with lots of work in the inner most loop. With some devious restructuring you might achieve a ten fold speed improvement. E.g. the if null test could be moved out entirely. The GetReadPtr and GetPitch values are constant for a given PVideoFrame, copy them out once to a local array. The index calculation H*pitch+W can be avoided by techniques like bumping the readptr's by their pitch's each time in the outer most loop. When using STL components always check in detail what you inherit under the covers, some are very good and expand to code equivalent to for(int i=0;i<K;i++), others are evil and resolve to a rats maze of deeply nested method calls. |
29th January 2013, 13:39 | #10 | Link |
Beyond Kawaii
Join Date: Feb 2008
Location: Russia
Posts: 724
|
How are you trying to load it, and what result do you get?
I scanned it with Dependency Walker, and it says you may need MSVCR110.dll and MSVCP110.dll - the MS Visual C Runtime.
__________________
...desu! Last edited by Mystery Keeper; 29th January 2013 at 13:42. |
30th January 2013, 03:57 | #11 | Link |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,664
|
I also couldn't load the plugin. When I tried, I got this error:
Code:
LoadPlugin: unable to load "TempLinearApproximate.dll", error=0x7e |
30th January 2013, 18:45 | #12 | Link | |
Beyond Kawaii
Join Date: Feb 2008
Location: Russia
Posts: 724
|
Quote:
__________________
...desu! |
|
31st January 2013, 01:29 | #14 | Link |
Beyond Kawaii
Join Date: Feb 2008
Location: Russia
Posts: 724
|
Tested my filter against TemporalSoften and TTempSmooth on BlankClip().AddGrain() with fixed seed for fair test. TemporalSoften just sucks. And judging by the resulting file size TempLinearApproximate did 8% better than TTempSmooth. For TTempSmooth I used the settings from MCTemporalDenoise function. On other hand, my filter gave some bright dots on the frames close to the beginning and the end. Quite possible with the pure noise oscillating between 0 and 255, but should never happen on real source.
Here goes proof.
__________________
...desu! |
31st January 2013, 01:43 | #15 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
But you still need a special option: The "Platform Toolset" needs to be set to "v110_xp" explicitly. It's that option that was added with Update-1.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
31st January 2013, 02:17 | #16 | Link | |
Registered User
Join Date: Feb 2010
Location: New York
Posts: 116
|
Quote:
I'm loading the file in single threaded Avisynth 2.6 (Alpha 4) with AVISource, through Cedocida 0.2.2 at its default settings, and calling TempLinearApproximate with no arguments. Some small sections of the clip that are black, or close to it, turn white, and vice versa. You can accentuate the effect by first loading the clip as RGB, then doing the planar conversion manually with PC levels before calling TLA: Code:
AVISource("TLAspots.avi", pixel_type="RGB32").ConvertToYV12(matrix="PC.601") If you need something longer to work on, the test clip is the first ten frames of this one, but that small snippet shows the black<->white issue fairly well. |
|
31st January 2013, 05:26 | #17 | Link |
Beyond Kawaii
Join Date: Feb 2008
Location: Russia
Posts: 724
|
Robert, when I first read your post, I thought: "I bet he just used the filter as is right after loading video." Please read the description in the first post more carefully. You should only use this filter on motion compensated clip. Otherwise, ghosts are to be expected. Still, I tried your video, was surprised, but the black<->white issue does present and looks like glitch. Thank you. I'll look into it. My first guess is me forgetting to clamp linear function to [0, 255].
__________________
...desu! Last edited by Mystery Keeper; 31st January 2013 at 05:28. |
31st January 2013, 05:50 | #18 | Link |
Registered User
Join Date: Feb 2010
Location: New York
Posts: 116
|
I did see that you mentioned a "likely undesired motion blur effect", but I thought that was in reference to the obvious blur seen over the entire image when the filter's applied to a clip that hasn't been prepared correctly; when I use the word "ghost" I'm referring in particular to the dark, negative image of the bright white truck seen only in the last few frames. If that's to be expected when this filter's applied incorrectly, my mistake, sorry I jumped the gun there.
|
31st January 2013, 06:00 | #20 | Link | |
Beyond Kawaii
Join Date: Feb 2008
Location: Russia
Posts: 724
|
Quote:
__________________
...desu! Last edited by Mystery Keeper; 31st January 2013 at 08:22. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|