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 12th September 2005, 20:12   #81  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
I will but I think it will be best to fix the WMP classic and add a better working version of SetMTMode(5) also I need to add support for the ConditionalFilter/FrameEvaluate/ScriptClip/WriteFile filters.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 12th September 2005, 23:08   #82  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,543
Cool. You can PM me if you need somebody to test it once it's done.
Revgen is offline   Reply With Quote
Old 13th September 2005, 00:03   #83  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
@tsp,

I haven't tried this filter because I only have a single-threaded single processor... but where possible I would like to be building filters in a way that is amenable to parallel execution. I can guess at the basics -- no global variables (or equivalent inside the filter), bear in mind that two frames could be requested simultaneously from the same filter, etc. ... but from the number of modes present, it seems that there are subtler issues.

If you ever have a moment, could you briefly document e.g. what a filter needs to do in order to be compatible with a particular mode?

Thanks,
@mg262
mg262 is offline   Reply With Quote
Old 13th September 2005, 01:18   #84  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,543
@mg262

tsp gave a more technical explanation of how it works in this thread.

Lots of programming blabla that I can't understand, but you might be able to.
Revgen is offline   Reply With Quote
Old 14th September 2005, 07:42   #85  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
revgen: I can't reproduce the problem with windows mediaplayer classic on my dual celeron 400 MHz. Maybe it's to slow? It is the mplayer2.exe that are windows mediaplayer classic right?

mg262: sure. The reason there are so many modes is to allow as many as posible of the existing filters to work. But here are the requerement:

Mode 1: all access to class variables, global variables and static variables most be threadsafe by using appropriate locking(Enter/LeaveCriticalSection etc, no locking need for readonly variables) because more than 1 thread may access a class instance at a time.

Mode 2: access to class variable doesn't have to be threadsafe because there is only 1 instance of the class per thread. All global/static variable access must be threadsafe. Because each class instance only process every other frame internal caches(that is a cache inside the filter) wouldn't work well. I still need to figure out a solution to this.

Mode 3: Only 1 thread is allowed to execute code from the filter at the same time. When child->GetFrame is called another thread can enter the filter and execute code. That means that class variables/global variables/static variables shouldn't be assigned to any values before after the last child->GetFrame has been called. Instead local function variables should be used like this:
Code:
PVideoFrame __stdcall AdjustFocusV::GetFrame(int n, IScriptEnvironment* env) 
{
	PVideoFrame frame = child->GetFrame(n, env);//Assigned to a local variable so this will work in mode 3
	env->MakeWritable(&frame);
	if (!line)
		line = new uc[frame->GetRowSize()+32];
	uc* linea = (uc*)(((int)line+15) & -16); // Align 16
	uc* buf      = frame->GetWritePtr();
	int pitch    = frame->GetPitch();
	int row_size = vi.RowSize();
	int height   = vi.height;
	memcpy(linea, buf, row_size); // First row - map centre as upper
	if ((pitch >= ((row_size+7) & -8)) && (env->GetCPUFlags() & CPUF_MMX)) {
		AFV_MMX(linea, buf, height, pitch, row_size, amount);
	} else {
		AFV_C(linea, buf, height, pitch, row_size, amount);
	}
	return frame;
}
But not like this:
Code:
PVideoFrame TemporalSoften::GetFrame(int n, IScriptEnvironment* env) 
{
  __int64 i64_thresholds = 0x1000010000100001i64;
  int radius = (kernel-1) / 2 ;
  int c=0;
  
  // Just skip if silly settings

  if ((!luma_threshold) && (!chroma_threshold) || (!radius))
    return child->GetFrame(n,env);
    

  for (int p=0;p<16;p++)
    planeDisabled[p]=false;

  
  for (p=n-radius;p<=n+radius;p++) {
    frames[p+radius-n] = child->GetFrame(min(vi.num_frames-1,max(p,0)), env);
//GetFrame assigned to class variable frames. This wouldn't work with Mode 3
//because the next thread that enters this getframe will overwrite the result
// from the last thread
  }

//do stuff
}
but when using mode 3 there is no need for threadsafe access to class variables. And because there is only 1 instance of the class that process all frames Internal caches will work much better. The bad thing is only 1 thread can execute the filter at a time so if it's the only slow filter in the script the speed increase wouldn't be that big.

Mode 4: a combination of mode 2 and 3 so it's okay to assign class variables before the last child->getframe has been called because there is a class instance per thread but the problem with internal cache is the same as mode 2

Mode 5: No restrictions.

Mode 6: A slightly modified version of mode 5 that might be a little faster.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/

Last edited by tsp; 9th November 2005 at 21:47.
tsp is offline   Reply With Quote
Old 14th September 2005, 15:30   #86  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
Thank you very much!
mg262 is offline   Reply With Quote
Old 14th September 2005, 17:25   #87  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,543
I did a little more testing on the WMP bug.

It seems like the bug only appears under these circumstances:

A) It only happens when using MT with either LimitedSharpen or the RemoveGrain.RemoveDirt filter. FFT3DFilter doesn't cause these problems with MT.

B)It only occurs when using SetMTmode. Using the old MT.dll causes no issues with any of the 3 filters.

C) It only occurs when I exit WMP without pressing the "Stop" button.

As long as I press the "Stop" button then exit everything is fine.

I guess I'm just more impatient than most people .


This bug seems to be different than the FFT3DGPU one. But fortunately it can be avoided for now.

EDIT

Yes. Mplayer2.exe is the WMP program in the taskbar.

Last edited by Revgen; 15th September 2005 at 05:41.
Revgen is offline   Reply With Quote
Old 18th September 2005, 08:21   #88  |  Link
Aquilonious
Guest
 
Posts: n/a
Where can I find PixieDust and how would I use it in DVD-RB Pro?

I'm not at all good at script writing.
  Reply With Quote
Old 20th September 2005, 00:37   #89  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Aquilonious: dust

All: New version ready. No need for distibutor with SetMTMode(5) and although I couldn't reproduce the WMP bug it might have been fixed with this version. Get it here. If this version works well I will start integrating it in avisynth 2.60
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 20th September 2005, 18:13   #90  |  Link
Aquilonious
Guest
 
Posts: n/a
Quote:
Originally Posted by tsp
Aquilonious: dust

All: New version ready. No need for distibutor with SetMTMode(5) and although I couldn't reproduce the WMP bug it might have been fixed with this version. Get it here. If this version works well I will start integrating it in avisynth 2.60
Thanks for the links, tsp. jdobbs mentioned that Pixiedust is part of the dust collection. I'm using AviSynth 2.5 and DVD-RB Pro 1.00RC6 along with CCE SP. Since I have an Athlon XP 3200 I can't utilize multithreading.

For DVD-RB I typically use "Pixiedust(5)" in the AVS Filter Editor box. I range the value (3-8) according to the quality of the source. I first try small numbers then work my way up.

I backed up an old DVD I had, The Last House on the Left. It had a LOT of grain--more than I've ever seen in any DVD. I tried numerous filters on it but the combination that worked best for me was an initial application of Undot. Then using the output from that I applied RemoveGrain & Msharpen. There's still a bit of grain, but it's quite an improvement over the source.

I have a few questions:

1. I'm using DustV5.dll. This is the correct version for AviSynth 2.5, right?
2. FFT3D & Dust seem to do the same thing. What are the basic differences between these two filters?
3. What is your favorite filter for grain removal?

It took me 8 hours to find the right combination of filters. Yeah, I know it's a lot of time but I learned what works and what doesn't. Filtering seems to be a mass experiment.
  Reply With Quote
Old 20th September 2005, 18:21   #91  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,543
@Aquilonious

Also make sure to get the the LoadPluginEX.dll included in the warpsharp package. This .dll needs to be loaded before the Dust filter in order for Dust to work with the 2.5x versions of Avisynth.

Quote:
Originally Posted by tsp
New version ready. No need for distibutor with SetMTMode(5)...
It works. I used the script from the tests I did on 9-11-05 without the g=greysclae and g.Distributor lines and the performance was the same.

Quote:
Originally Posted by tsp
...and although I couldn't reproduce the WMP bug it might have been fixed with this version.
The WMP issue no longer appears with the RemoveGrain.RemoveDirt filter, but still appears with the Limited Sharpen filter.

Also, did you mention that you have a Dual CPU Celeron setup? I have an AMD X2 Dual-Core setup.

While the AVS file is playing task manager reports a 100% utilization.
Yet whenever I exit WMP and the issue arrises, task manager reports that 50% of my CPU is being utilized. This means that only one of my cores is being used while the other one isn't.

Could this be an issue with my AMD cores rather than MT?

The only other persons in these forums that I know who have dual cores and might be able to confirm my problem are Doom9 and Easy2BCheesy. Doom9 has the same 4600+ CPU as I have, but last I heard he was having issues with his MB. I'm not sure what CPU Easy2BCheesy has, he didn't mention if his was AMD or Intel.

Last edited by Revgen; 20th September 2005 at 18:25.
Revgen is offline   Reply With Quote
Old 20th September 2005, 18:42   #92  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Revgen: It's not the athlon X2's fault. Hartford has the same problem with a dual athlon MP (I think it was). I will create a special debug version that you can try that will create a log file.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 20th September 2005, 19:08   #93  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,543
I'll PM you my email.
Revgen is offline   Reply With Quote
Old 21st September 2005, 17:43   #94  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,543
@tsp

I just sent you the log. It should be in your inbox. Hopefully you got it, because sometimes my email doesn't work right.
Revgen is offline   Reply With Quote
Old 21st September 2005, 22:02   #95  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,543
Sent you an email. The fix you made works.
Revgen is offline   Reply With Quote
Old 21st September 2005, 22:34   #96  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
thanks. I added the multithtreading code to the avisynth 2.60 sourcecode so it should be in the next version (hopefull). A version of the avisynth 2.60 (beware that it's very very early version so don't blame me if your house burn down after you download it) binary is available here and the latest avisynth 256MT with the above bugfix is available here.
I also added a mode 6 that you can chose instead of mode 5 if the cpu utilization isn't 100%
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 22nd September 2005, 04:20   #97  |  Link
hartford
Registered User
 
hartford's Avatar
 
Join Date: Nov 2003
Posts: 324
@tsp

<quote>latest avisynth 256MT with the above bugfix is available here.</quote>

Thanks. (still following this thread).
hartford is offline   Reply With Quote
Old 23rd September 2005, 21:09   #98  |  Link
Aquilonious
Guest
 
Posts: n/a
[QUOTE=Revgen]@Aquilonious

Also make sure to get the the LoadPluginEX.dll included in the warpsharp package. This .dll needs to be loaded before the Dust filter in order for Dust to work with the 2.5x versions of Avisynth.

I downloaded the LoadPluginEx.dll file and it now resides in my AviSynth plugins folder.

How do I load this pluging in DVD-RB Pro? I'm very poor at scripting. Could you give me an example in what exactly I need to enter into the AVS Filter Editor box? I'm still relatively new using filters.
  Reply With Quote
Old 23rd September 2005, 23:22   #99  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,543
[QUOTE=Aquilonious]
Quote:
Originally Posted by Revgen
@Aquilonious

Also make sure to get the the LoadPluginEX.dll included in the warpsharp package. This .dll needs to be loaded before the Dust filter in order for Dust to work with the 2.5x versions of Avisynth.

I downloaded the LoadPluginEx.dll file and it now resides in my AviSynth plugins folder.

How do I load this pluging in DVD-RB Pro? I'm very poor at scripting. Could you give me an example in what exactly I need to enter into the AVS Filter Editor box? I'm still relatively new using filters.
Some people have reported that it's better to load LoadPluginEX.dll and DustV5.dll externaly. Try entering this if you want to use Dust:

LoadPlugin("MyDrive:\MyFolder\LoadPluginEX.dll")
LoadPlugin("MyDrive:\MyFolder\DustV5.dll")

mpeg2source("MyDrive:\MyFolder\YourMovie.d2v")

ConvertToYUY2() #PixieDust can only work in YUY2 and RGB colorspace.
PixieDust(5) #The default mode is mode 5. You can use higher modes for better compression, but with less preserved detail.
ConvertToYV12() #DVD's typically utilize YV12 colorspace and encode faster when it's used.

EDIT
It's best not to use SetMTmode with Dust since they both don't work well together.

Last edited by Revgen; 23rd September 2005 at 23:25.
Revgen is offline   Reply With Quote
Old 29th September 2005, 20:52   #100  |  Link
Aquilonious
Guest
 
Posts: n/a
[QUOTE=Revgen]
Quote:
Originally Posted by Aquilonious

Some people have reported that it's better to load LoadPluginEX.dll and DustV5.dll externaly. Try entering this if you want to use Dust:

LoadPlugin("MyDrive:\MyFolder\LoadPluginEX.dll")
LoadPlugin("MyDrive:\MyFolder\DustV5.dll")

mpeg2source("MyDrive:\MyFolder\YourMovie.d2v")

ConvertToYUY2() #PixieDust can only work in YUY2 and RGB colorspace.
PixieDust(5) #The default mode is mode 5. You can use higher modes for better compression, but with less preserved detail.
ConvertToYV12() #DVD's typically utilize YV12 colorspace and encode faster when it's used.

EDIT
It's best not to use SetMTmode with Dust since they both don't work well together.

My source is not an MPEG file but the Starship Troopers 2 DVD I own that I'm backing up. I have decrypted the DVD (using DVDFab Decrypter) and the files now reside on my drive. I'm using DVD-RB Pro 1.00 RC6, the latest version.

I have tried the script you provided and every several variations of it, but just can't get Pixiedust to run. I either get an error in Rebuilder's Preview/Edit mode (in red letters) or it crashes Rebuilder altogether.

So I looked for other alternatives. I tried STMedianFilter + MSharpen with the following script and it worked fine:

Loadplugin ("C:\Program Files\AviSynth 2.5\plugins\STMedianFilter.dll")
STMedianFilter(8,10,4,7)
Loadplugin ("C:\Program Files\AviSynth 2.5\plugins\MSharpen.dll")
MSharpen()

The results are ok but there's a bit too much blur for my taste. The settings for STMedian are lower than the default values. While MSharpen helps, using anything stronger than the default values begins to introduce artifacts into the video.

I really want to try PixieDust because I've seen the excellent results which it can produce. I want to backup my Aliens DVD, one of my fav movies, but I have to be quite careful as I don't want to alter the original detail, just degrain it a bit.

If memory serves me correctly, James Cameron mentioned that he wished he had utilized different film for some of the scenes which turned out particularly grainy, like when the marines had just entered the compound overrun by the aliens. (I think he used 16mm telcine for some of the anamorphic/wide-angle shooting because of the longer focal length of the lenses).
  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 20:41.


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