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. |
13th November 2010, 05:29 | #1 | Link |
Registered User
Join Date: May 2005
Posts: 1,462
|
DeHalo-ing only certain segments
Hello,
I'd like to dehalo parts of an Anime, but not the entire source. Let's say I have a total of 1,000 frames, and I want to add an additional dehalo_alpha and unfilter function to the section between, say, 400-500 frames. Is that possible with AviSynth? I found something called ConditionalFilter, which looks like it might work for me; but, frankly, I have no idea how it's done. It all looks incredibly complex. Has anyone ever done this before? If so, I wouldn't mind hearing how. :) Thanks.
__________________
Gorgeous, delicious, deculture! |
13th November 2010, 06:05 | #2 | Link |
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Part of stickboy's RemapFrames filter is ReplaceFramesSimple which I usually use for this sort of thing:
http://avisynth.org/stickboy/ Its use would be something like this: BaseClip=Last SourceClip=BaseClip.YourFilterHere ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[0 46] [58 98] [116 155] [169 209]") The number pairs are the first and last frame numbers where you want the filter used. |
13th November 2010, 06:54 | #4 | Link | |
Registered User
Join Date: May 2005
Posts: 1,462
|
Quote:
__________________
Gorgeous, delicious, deculture! Last edited by asarian; 13th November 2010 at 07:05. |
|
13th November 2010, 09:42 | #5 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
ApplyRange(400, 500, "YourFilterHere") |
|
15th November 2010, 18:14 | #6 | Link |
Registered User
Join Date: Aug 2010
Posts: 5
|
I've always wondered which method of those is the least memory consuming. I remember always ending up with encoding each part separately on more complex scripts, as even trying to fully load one of those to AvsP resulted with an error.
|
15th November 2010, 19:14 | #7 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
As far as memory use is concerned, they should all be more or less the same, and cannot really be bettered for the example cases given.
However, if you want to apply the filter to several different segments (with the same arguments each time), then ReplaceFramesSimple (manono's first suggestion) is more efficient than repeated calls to ApplyRange, because only one instance of the filter is created. |
15th November 2010, 23:46 | #8 | Link |
Registered User
Join Date: May 2005
Posts: 1,462
|
Thanks all for the help!
I can't get a decent dehalo-ing going, though; see this image of two stills. The one at the bottom is supposed to be dehalo-ed, but it appears to not have done anything at all. :( I used the following test script: FFVideoSource("F:\jobs\test.mkv") Crop(202, 2, -202, -2) BaseClip=Last SourceClip=BaseClip.DeHalo_alpha(rx=2.7, ry=2.7, brightstr=1.3) # SourceClip=BaseClip.YAHR() ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[0 107]") [0 107] in this case are all frames (this was just a test, after all). Maybe I'm not doing it right, but the result is a bit disappointing. The halo around Lain's chin is still as much present as before. Does anyone have any idea as to why dehalo-ing does not seem to occur? Maybe there's too much grain in the source? (Blu-Ray)
__________________
Gorgeous, delicious, deculture! |
16th November 2010, 00:06 | #9 | Link | |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Quote:
Oh, btw ... it is exactly the other way round. The top one is the one with dehalo_alpha applied, and the bottom one is the original. Edit: Nah, wait ... there must've been a mistake on your side. Dehalo_alpha is very effective on that picture. I'm preparing data, will come in a few minutes.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) Last edited by Didée; 16th November 2010 at 00:42. |
|
16th November 2010, 00:58 | #10 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Source: [the very image you posted]
Try #1: Plain dehalo_alpha, just with adjusted radii: dh_alpha(rx=1.75,ry=2.5) Result: All halos are gone. Primary goal achieved. Dehalo_alpha is effective. But the result is not "nice", there's too much flattening and loss of line darkness etc. Try #2: dehalo_alpha with contra-sharpening to restore the loss. Settings of dehalo_alpha a bit more tweaked. Code:
o = last DH = o.dehalo_alpha(rx=1.75,ry=2.8,darkstr=0.66) bb = DH.removegrain(11) xD = mt_makediff(bb,bb.repair(bb.repair(bb.medianblur(2,-333,-333),1),1)) \ .mt_lut("x 128 - 2.49 * 128 +") xDD = mt_lutxy(xD,mt_makediff(o,DH),"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?") DH.mt_adddiff(xDD,U=2,V=2) Result: All halos gone, with only very minor damage. G'nite.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
16th November 2010, 01:54 | #11 | Link |
Registered User
Join Date: May 2005
Posts: 1,462
|
Quote:
__________________
Gorgeous, delicious, deculture! |
16th November 2010, 17:32 | #12 | Link | |
Registered User
Join Date: May 2005
Posts: 1,462
|
Quote:
__________________
Gorgeous, delicious, deculture! |
|
16th November 2010, 18:44 | #13 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
It's true that in the script, "YourFilterHere" is called with the entire clip as its argument. However, because Avisynth filters only process individual frames on demand, it will only process those frames which are requested from it by ReplaceFramesSimple. So there is no unnecessary work done (unless it's a rare filter that has to partially process all frames of its input clip in advance, eg to compute a maximum of some kind).
|
16th November 2010, 18:54 | #14 | Link | |
Registered User
Join Date: May 2005
Posts: 1,462
|
Quote:
__________________
Gorgeous, delicious, deculture! |
|
16th November 2010, 19:30 | #15 | Link |
Registered User
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 805
|
Quote:
|
Thread Tools | Search this Thread |
Display Modes | |
|
|