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. |
10th January 2004, 13:25 | #21 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
(I also changed the subject to 1.4.5 if you don't mind).
This and msharpen are the only filters capable of producing non-greyscale masks for Overlay, btw.
__________________
Regards, sh0dan // VoxPod |
10th January 2004, 23:39 | #22 | Link |
Registered User
Join Date: Jan 2002
Location: France
Posts: 2,856
|
New version, with optimizations for the MotionDetection filter.
Changelog : 1.4.6 - Made the scenechange detection in MotionDetection iSSE optimized ( meaning you need an Athlon XP / Pentium IV ). It works with an Athlon XP, it is not tested with an Pentium IV, it is possible to disable it by using usemmx = false in the paremeters of the filter. - Optimized the calculation of the motion, without using MMX ( just by avoiding to do 3 times the same calculations... ). So the filter should be more or less three times faster. As usual, please report the bugs. |
11th January 2004, 16:36 | #23 | Link | |
Registered User
Join Date: Jul 2002
Posts: 63
|
heeeeeeeeeeeeeeeeeeeeeeeelp! *grin*
i tested motiondetection() with a high threshold 2d cleaner to see what it worked like during high motion scenes and that went well, then i realized that this would be perfect to use to replace my old YDifferenceFromPrevious() conditional filter for antiblink to cut it out in high motion scenes (in some scenes it still ghosted and made a mess, this in theory should fix it). the idea is once motion is beyond x to use the original instead of the antiblink'd clip but im clueless how to do that here Quote:
__________________
My xvid instabuild site: http://xvid.gamrdev.com/ |
|
11th January 2004, 18:59 | #24 | Link |
Registered User
Join Date: Jan 2002
Location: France
Posts: 2,856
|
Code:
motionmask = clip.motiondetection(thY1 = 30, thY2 = 30, thSD = 10,y=3,u=1,v=1) motionmask = motionmask.invert(y=3,u=1,v=1).fastfity2uv() derainbowedclip = clip.antiblink(1,35,true) return clip.maskedmerge(derainbowedclip, motionmask,y=2,u=3,v=3) If maskedmerge wasn't buggy, you wouldn't need the invert, and you would then invert clip and derainbowedclip in the last line, but it doesn't work on my computer ( I'll investigate ). Hope this'll help |
11th January 2004, 19:19 | #25 | Link | |
·
Join Date: Jan 2002
Posts: 1,729
|
Quote:
|
|
11th January 2004, 23:27 | #27 | Link |
Registered User
Join Date: Sep 2002
Location: France
Posts: 432
|
I'll try to summarize my comments:
1) maskedmerge bugged? To me: maskedmerge(clip1, clip2, mask1) is approximately equivalent to: maskedmerge(clip2, clip1, mask1.Invert()) Sure it isn't really, because I use the weight (255-x) instead of (256-x). But 256 doesn't fit into a byte. 2) antiblink Whatever version, it is my oldest filter. There is probably a lot to optimize. Here's how it works: - check for chroma oscillations (the oscillation is the rainbow) over 4 frames; mf, beware that those very oscillations can falsely be interpreted as motion on chroma - check for luma variation for the current chroma value: if under a threshold (ie, we consider the luma change not to be due to motion), don't filter (in fact some heavy smooth would be better, but the rainbow criterion based on chroma oscilation is insufficient). That's what do real 3D comb filter (see on some broadcast how the first frame after a scene change has rainbow and how it gets eliminated afterwards) besides temporal filtering. Using 2 masks, one for motion (taking the difference between the 3x3 average?) and one for edges together with maskedmerge is a possibility, but I never got something satisfying 3) MMX in motiondetection a) Manao, you declare it being iSSE - I only see MMX code b) usemmx: is the CPU check in the constructor insufficient? It sure lacks width checks 4) Some useless filter: - LUT - never finished it would require arrays to be passed, and functions to fill arrays - unsatisfying, I'm afraid - Logic: who has ever used it? me, but that doesn't count 5) binarize You should just make the threshold into a char by removing 127, and use pcmpgtb, bypassing the substraction 6) speed-up iSSE optimization would be mostly about adding prefetch around and unrolling loops. Cheap optimization, good performance gains for binarize for instance. nasm is sure a winner to help avoiding ugly VC++ macros. 7) Code size - Build target matters - VC7 is surely better at optimizing and unrolling loops - UPX is your friend 8) Suggested additions (I've added some myself, but the framework isn't compatable anymore and I have no time for commenting it): - generalconvolution (MMXing was a pain to cope with the signedness of most WORD operations) - Combmask (hint: Decomb provides a neat detector) - a real LUT filter, generalizing levels (for instance, sinus, exponential, square root, invert, ...) - add some real edge detectors. The ones in edgemask are really primitive, not enough the full ones. Laplacian/Derivative of Gaussian with a zero-cross detection gave me better results but are really the slower one can afford (except mf maybe). Thresholding here is as optimizable as in Binarize Note: always use coring=false with levels. We want our 0 ad 255 in our masks. Compatibility with standards and old materials is sure a good think, but such example shows the limit of it (who said NTSC?) [last EDIT]Tried to make sense[/EDIT] Last edited by Kurosu; 12th January 2004 at 10:04. |
12th January 2004, 00:14 | #28 | Link |
Registered User
Join Date: Jan 2002
Location: France
Posts: 2,856
|
Thanks a lot Kurosu for your comments !
When I said maskedmerge was buggy, I precised 'on my computer' later. When I tested it with the following script : Code:
source = MPEG2Source("R:\hours.d2v",cpu2="oooooo") motionmask = source.motiondetection(thY1 = 30, thY2 = 30, thSD = 10,y=3,u=1,v=1) motionmask2 = motionmask.fity2uv() derainbowedclip = source.blankclip(color = $FF00FF).mergeluma(source,1) return derainbowedclip.maskedmerge(source , motionmask2,y=2,u=3,v=3) For the MMX in MotionDetection, I use psadbw, which is reported as iSSE by the documentation I use ( Tommesani.com ). The usemmx parameters is very helpful when debugging, that's why I left it ( it is set to true by default anyway ). For binarize, I didn't thought of that, thank you very much , I'll try it ASAP. For the prefetch, I tried, but I never got any clear speed improvment ( 2-3 % at most ). I must have done something wrong, but I never found what. I'll see what I can do with your addition proposals ( as soon as I've the time ). And I'll use UPX for the next release ( I already use VC7, and compile with the 'release' target ). |
12th January 2004, 10:30 | #29 | Link | |
·
Join Date: Jan 2002
Posts: 1,729
|
Quote:
|
|
12th January 2004, 12:37 | #30 | Link | |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Though my "testing status" is still v1.4.4, I'd like to point out that inflate/deflate is still problematic for me: the plugin often returns _green_ masks after using in/deflate. From the "changelog" I suppose this is still present in 1.4.6. (?)
Quote:
Last time I tried to use Logic was in v1.4.0. There it was impossible to use any other function once Logic was called. Could be fixed in the meantime, I must check the new version for that. Logic also seems invaluable to me, for example for [**censored to keep the surprise**] - Didée
__________________
- 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!) |
|
12th January 2004, 13:00 | #31 | Link | |
·
Join Date: Jan 2002
Posts: 1,729
|
Quote:
|
|
12th January 2004, 13:05 | #32 | Link |
Registered User
Join Date: Jan 2002
Location: France
Posts: 2,856
|
1.4.0 had an issue with multiple instances of the same filter. Kurosu corrected it in the 1.4.1. I looked quickly the source code and didn't see anything wrong specific to Logic functions.
For the inflate / deflate, since mf didn't reported any issue, and since I found nothing wrong while testing, I think you did something wrong. However, I'll check when I'll come back home, because I didn't check these functions since 1.4.2. Meanwhile, could you give me description of the cases when you get green masks ? ( avs scripts mainly, and if there were a lot of program running on your computer ) Is it systematic ? Edit : seing the mf's post, I'll add that if U and V planes are null, the picture will be green ( from dark green to bright ). When both chroma planes are 255, picture is pink / violet. When you said green, I thought uniform dark green ( meaning all three planes null ). By default, U and V parameters are at 1, which means chroma plane isn't processed ( it is roughly the result of a malloc ) Last edited by Manao; 12th January 2004 at 13:15. |
12th January 2004, 14:35 | #33 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Well, the effect was often like that:
- script is set up to return the mask only: # something like this edgemask=[function_of_edge_detection] edgemask.inflate() return(last) - load script into VdMod - The clip is fine green (RGB 0,255,0) - When "playing" the script, the green turns to normal coloring after some number of frames, plays normal for some frames, goes green again ... But yes, simply converting the whole thing to greyscale explicitely would be an idea, indeed I only thought to mention my experience, while the topic is up ... if no-one else is experiencing this behaviour, then it must be a PEBKAC problem on my side - Didée
__________________
- 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!) |
12th January 2004, 15:51 | #34 | Link |
Registered User
Join Date: Sep 2002
Location: France
Posts: 432
|
It's all in the docs...
3 = do the work 2 = copy if can be copied 1 = leave as such What happens: - on first call, an empty frame is generated by malloc (or new, but in fact more low level functions you never access directly) and left to fill by whatever happends. Although it's not guaranted because of memory reuse, it is filled with 0, ie green - on next calls, avisynth reuses frames that are around and don't need to be conserved; you get what is left from say some of the previous frames (maybe from the ones given to the filter) - no more frames are made, the old ones (<=>their memory space) are conserved; go into a loop Why waste CPU cycles while you won't use that information? Consider what you are really using, and what really needs to be kept. mftoon only works on luma, so why even consider the chroma planes? I made the default in almost all filters to only use chroma. Sure, it looks weird, but that *shouldn't* matter. |
12th January 2004, 19:18 | #35 | Link | |
·
Join Date: Jan 2002
Posts: 1,729
|
Quote:
|
|
14th January 2004, 00:17 | #36 | Link |
Registered User
Join Date: Jan 2002
Location: France
Posts: 2,856
|
New version, with some corrections, and a new filter :
Changelog : 1.4.7 - Renamed MotionDetection to MotionMask. I know it's kind of silly, but it's a lot more coherent that way. - Added the check of the width for the use of iSSE in MotionMask - Slightly modifyed MMX optimizations in Binarize. - Added a new filter : YV12Convolution. It allows you to convole the picture by a matrix of (almost) any size. Documentation on the new filter : 12) YV12Convolution(clip clip, string horizontal, string vertical, int total, bool automatic ) - horizontal and vertical are lines of integer coefficients spaced by any number of space or characters (different from number : e.g : "1 5 9 g 5" and "1 5 9 5" are equivalent ( at least they should )). These lines represents vectors. Their length must be odd ( in order to be centred on a pixel ). The matrix of convolution will be equal to vertical' * horizontal / total ( matlab notation, for those who know matlab, else, the matrix' coefficient a(col,row) is equal to horizontal(col) * vertical(row) / total ) - If automatic is set to 'true', total is the sum of the coefficients of the matrix. It means that, that way, overall brightness of the picture isn't touched. - Negative coefficients aren't yet supported ( they'll come very soon, however ). - Default values are horizontal = "1 1 1", vertical = "1 1 1", total = 9, automatic = true A few remarks : - division by 'total' is made at the end of the calculation of the value of a pixel. - There are no MMX optimizations ( and I don't think they'll ever be some ), but it's not too slow ( ~12fps on an athlon XP with a 704x480 picture and a 9x9 picture ). - I don't allow the use of every possible matrices, but the available matrices are enough, imho. I choose them that way because it allowed me to optimized a lot the calculations. - In the next release, negative values will be supported ( thus allowing to calculate a gradient mask ). What prevents it for been activated in this release is the parser of string which doesn't take yet into account '-' ( it's a delimiter ). - Don't put 0 in 'total', or you'll have a division by zero ( corrected in the next release also ). - When processing U and V planes, the matrice have a larger influence, since pixels are bigger in these planes. As usual, any bug report is welcomed. Edit : The LUT filter will also come in the next release. I don't see a use for CombMask ( I'm not used to process interlaced sources ), so if somebody could enlight me on a use of such a mask. Finally, I intend also to implement other edge's detection ( to begin with the one in MSmooth, which I particulary appreciate ). Last edited by Manao; 14th January 2004 at 00:20. |
14th January 2004, 12:13 | #37 | Link | |
·
Join Date: Jan 2002
Posts: 1,729
|
Quote:
|
|
14th January 2004, 13:29 | #39 | Link | |
·
Join Date: Jan 2002
Posts: 1,729
|
Quote:
|
|
15th January 2004, 19:01 | #40 | Link |
Registered User
Join Date: Feb 2002
Posts: 285
|
Wrong Version #?
First I want to say, thanks for the awesome filter! But, I have a question regarding the ones on: http://www.geocities.com/manao47/Filters/
I download any of the versions on there and look at the file itself and they all say version 1,4,0,0 so I want to make sure that they are indeed the right ones, but the version label has simply been left off the filename. LB
__________________
1. CPUs:2x2.4_LV @ 3.6 (16x229) 1.5v MB:DH800 HS:E3W-NPTXS-04 CRT:FP2141SB HDs:8x147gbU320 1x36gbU320 2x250gbIDE GPU:X800XT DVDRW:PX-712A PSU:2xAntec 550w CASE:PC-78 2. CPUs:1x2.4A @ 3.0 MB:SFF SB61G2BV3 CRT:KVM(see above) HDs:2x120gb IDE GPU:Ti4600 DVDRW:A107 3. Notebook:T40p |
Thread Tools | Search this Thread |
Display Modes | |
|
|