Decomb Plugin for Avisynth
IntroductionThis package of plugin functions for Avisynth provides the means for removing combing artifacts from telecined progressive streams, interlaced streams, and mixtures thereof. Functions can be combined to implement inverse telecine (IVTC) for both NTSC and PAL streams.
The term "combing" is used as a general term versus "interlacing" because interlacing is usually associated with nonprogressive streams. What look like interlacing artifacts can be seen on telecined progressive streams, so I use the term combing to refer to all such artifacts, regardless of the type of the stream.
The package automatically adapts to any telecine/capture patterns, e.g., 3:2 NTSC or 1:1 PAL, and mixtures thereof, although if you want to decimate the recovered progressive stream, you have to specify the desired decimation ratio. The recovery process is completely modeless (patternless) and does not rely on any fixed telecine patterns or phasing. None of the functions introduce a delay in the audio or video streams.
For most applications, there are no parameters to set. Some capture cards require a field swap after the recovery process and the Telecide function allows this to be specified.
The algorithm is an adaptive one that operates in three steps:
I'd like to thank Thomas Daniel for his valuable assistance during the development of this software. He made several valuable suggestions, pointed out useful resources, performed torture testing on very difficult streams, ran head-to-head tests against other available decombing software, and helped me to understand the world of anime.
Members of the forum at doom9.org provided much help and encouragment.
Usage guidelines and syntax descriptions are provided in the help file contained in the distribution ZIP file.
Note that this version of Decomb requires a version of Avisynth BEFORE 2.5! A new beta version of Decomb is available for Avisynth 2.5 and beyond.
Version 4.05 Legacy is the end of the line for this version of Decomb. This version fixes a bug in the y0/y1 exclusion band, greatly expands the manual override capability, and adds 3 new parameters: agg, nt, and mm (refer to the help file).
Version 4.01 adds a new Telecide() pattern guidance mode (guide=3) for processing 25fps to 30fps telecining, and fixes a bug in default parameter handling of the guide parameter.
Version 4.00 is a major upgrade. Warning: Check your scripts carefully against the new help file; not all parameters are backward compatible! Following are the changes:
Version 3.91 changes Decimate(mode=2) so that if a cycle of frames has no duplicates it reverts to mode=0 behavior. Previously it just chose the first frame in the cycle, causing possible jerkiness.
Version 3.9 adds a new decimation mode. This new mode greatly improves decimation in cases where there are repeated duplicates, such as you would encounter with clips that are derived from low frame rate animations, or clips where there is slow motion such that there is not movement in every frame. With Decimate(mode=0), it was likely that the wrong frames would be decimated. With Decimate(mode=2), the correct frames are decimated, preventing jerky output for these kinds of clips.
Version 3.8 adds pattern guidance for PAL. Note that the syntax for the guide options has changed; please refer to the help file.
Version 3.7 adds pattern guidance for NTSC 3:2 pulldown material. This feature can improve the field matching for some clips. Refer to the help file for details.
Version 3.6 exposes the deinterlacing threshold in the user interface. See the help file for details.
Version 3.5 fixes a bug that caused a spurious bottom line in Telecide's output when the height of the input clip is odd. This version also has a further improved field matching algorithm that now succeeds on several "torture" clips that it previously failed on.
Version 3.4 allows for specification of an exclusion band for the field matching. This is typically used to ignore subtitling that might otherwise interfere with proper field matching.
Version 3.3 enhances the Decimate(mode=1) functionality. You can now set a threshold such that instead of blending one frame in every cycle, it will either blend the frame if its difference from the previous frame is less than or equal to threshold, or it will pass through the chosen frame if its difference from the previous frame is greater than threshold. This enhancement allows you to have the nonfilm portions of a hybrid clip passed through untouched, while still blend-interpolating once per cycle in film portions.
Version 3.2 improves the field matching algorithm and adds a reverse parameter that allows the sense of the field matching to be reversed (see the help file for details).
Version 3.1 adds a new option to Decimate. This option allows you to invoke a mode whereby instead of discarding frames, Decimate replaces them with an interpolated frame. Using this mode, you can render your final output at 30fps without creating jerkiness due to duplicated frames. Also, this version improves the reliability of both Telecide and Decimate with noisy source clips.
Version 3.0 contains coding optimizations and new information (see help file) that lead to large speed gains. Also, a new parameter has been added to Telecide and FieldDeinterlace that optionally enables chroma comparisons in the deinterlacing step. To obtain the maximum speed gains possible with this version, be sure to read and apply the tips in the help file, especially the one about using null parentheses!
Note: Version 3.0 (and later) requires an MMX-capable processor.
Version 1.91 made the following fixes:
Version 1.9 combined FieldDeinterlace into Telecide to give a small speed inprovement and prepare the ground for optimization. Also, Decimate was revised to allow 1-in-N decimation where N can be any value in the range 2-25. IMPORTANT NOTE The syntax has changed so please read the revised help file thoroughly and revise your scripts accordingly. You will no longer follow Telecide with FieldDeinterlace, and you will say Decimate(5) instead of Decimate15.
Version 1.82 Fixed another bug that caused crashing with cropping up front. Also, added a decimate 1-in-25 function.
Version 1.81 fixes a bug that caused crashes when a Crop() call was placed ahead of Decomb. Also, this version is about 10% faster.
Version 1.8 added the option to force the interpolation of the first and last frames, and greatly improved deinterlacing of frames detected as combed.
Version 1.75 reduced the default threshold to 15, and throws an exception if the input is not YUY2. Note that YUV and YUY2 are not the same.
Version 1.7 fixed a major memory leak.
The field matching in 1.6 was made more accurate, and FieldDeinterlace faster when full=true.
Version 1.5 was a major improvement. FieldDeinterlace when used in cleanup mode after Telecide/Decimate now (when the full parameter is set to false) will not touch frames that are detected as progressive. The algorithm for detecting progressive versus combed frames is now very effective. The result is a big reduction in shimmer/flashing that you would otherwise get when progressive frames are erroneously deinterlaced. Telecide's field matching has also been improved. Please read the updated help file as there are several important usage changes to be aware of. This version now does a very good job on challenging anime sources, such as "Cowboy Bebop".
Version 1.4 made Decimate more reliable when navigating in VirtualDub. (Version 1.3 was not released.)
Version 1.2 fixed Decimate, which was seriously brain-dead.
Version 1.1 changed only the FieldDeinterlace function. The function is now much faster. It has also been corrected to interpolate the first frame in frame differencing mode. The default threshold was reduced to 12. The fast parameter was removed as it was ineffective and the filter is much faster now anyway. The frame-and-field differencing mode was removed as it didn't add much and just slowed down the filter a lot.
Version 1.0 was the first release version.
[up to home page]