ReMatch
m (→Description) |
m (less spaces) |
||
(2 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{FilterCat4|External_filters|Plugins|Restoration_filters|IVTC}} |
− | {{ | + | {{Filter3 |
| Dan Donovan | | Dan Donovan | ||
| v0.91 | | v0.91 | ||
− | | [http://www.avisynth.nl/users/warpenterprises/files/rematch_5F25_dll_20050306.zip | + | | [http://www.avisynth.nl/users/warpenterprises/files/rematch_5F25_dll_20050306.zip rematch_dll_20050306.zip] |
| IVTC & Decimation | | IVTC & Decimation | ||
− | |||
− | |||
| Closed source | | Closed source | ||
|}} | |}} | ||
− | + | ||
== Description == | == Description == | ||
− | + | ReMatch is a field matching plugin, specifically for anime. ReMatch uses the odd field, and constructs 3 frames: One with the current even field, one with the previous even field, and one with the next even field. Combing artifacts are counted with a threshold and the picture with the least amount of detected combs is chosen. As of version 0.70, there is a pattern guidance system, which will try to determine a pattern to use when the comb counter is too close to call. | |
− | + | ||
− | + | ||
− | + | ||
<br> | <br> | ||
− | |||
− | |||
− | |||
− | |||
<br> | <br> | ||
+ | == Requirements == | ||
+ | * AviSynth 2.5.8 or later | ||
+ | * Supported color formats: [[YV12]] | ||
− | == Syntax and Parameters == | + | <span style="color:red">'''Note:'''</span> Mod-16 source material will yield the fastest results. Mod 8 still has plenty of [[MMX]]/[[SSE]] optimization. Below that, it's mostly straight C++, so try to stick with at least mod 8. This is true for all versions that have [[MMX]]/[[SSE]]. |
− | :{{Template:FuncDef|ReMatch(int "combthresh", int "c2thresh", float "scenethresh", int "orphanmode", int "orphanthresh", int "guidecycle", int "guidethresh", string "ovrfile", bool "mask", bool "debug", bool "mmx", bool "isse", bool "sse" | + | <br> |
+ | <br> | ||
+ | == [[Script variables|Syntax and Parameters]] == | ||
+ | :{{Template:FuncDef|ReMatch (clip, int "combthresh", int "c2thresh", float "scenethresh", int "orphanmode", int "orphanthresh", int "guidecycle", int "guidethresh", string "ovrfile", bool "mask", bool "debug", bool "mmx", bool "isse", bool "sse")}} | ||
+ | <br> | ||
+ | ::{{Par2| |clip| }} | ||
+ | :::Input clip. | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|combthresh|int|12}} |
:::The threshold for comparing a pixel to the 2 surrounding vertical pixels. A lower threshold will detect more combs. | :::The threshold for comparing a pixel to the 2 surrounding vertical pixels. A lower threshold will detect more combs. | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|c2thresh|int|6}} |
:::The threshold for comparing the pixels on top and bottom of a given pixel. The 2 pixels must be within this value of each other. | :::The threshold for comparing the pixels on top and bottom of a given pixel. The 2 pixels must be within this value of each other. | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|scenethresh|float|20.0}} |
:::Sets the threshold for scene changes. This is computing by taking the average of the differences of the each pixel between the previous and next frame. | :::Sets the threshold for scene changes. This is computing by taking the average of the differences of the each pixel between the previous and next frame. | ||
:::An orphan field (see below) can only be detected at a scene change. Set to 0 to disable, though I highly disrecommend doing so. | :::An orphan field (see below) can only be detected at a scene change. Set to 0 to disable, though I highly disrecommend doing so. | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|orphanmode|int|2}} |
:::Sets what to do with orphan fields. 0: nothing, 1: duplicate previous frame when possible, 2: duplicate next frame when possible, otherwise duplicate previous frame | :::Sets what to do with orphan fields. 0: nothing, 1: duplicate previous frame when possible, 2: duplicate next frame when possible, otherwise duplicate previous frame | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|orphanthresh|int|8000}} |
:::Sets the threshold for finding an orphan field. If all 3 frame variations have at least this amount of combed pixels, it is detected as an orphan. | :::Sets the threshold for finding an orphan field. If all 3 frame variations have at least this amount of combed pixels, it is detected as an orphan. | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|guidecycle|int|5}} |
:::IVTC guidance. This is how many frames a pattern has in it. 3:2 IVTC (30FPS to 24FPS) has a cycle of 5 frames. Use 0 to turn it off. Default: 5 | :::IVTC guidance. This is how many frames a pattern has in it. 3:2 IVTC (30FPS to 24FPS) has a cycle of 5 frames. Use 0 to turn it off. Default: 5 | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|guidethresh|int|10}} |
:::A percentage value. If all possible variations of the frame have within this amount (in %) combs of each other, the pattern will be tried. | :::A percentage value. If all possible variations of the frame have within this amount (in %) combs of each other, the pattern will be tried. | ||
:::Think of this as pattern aggression. The higher it is, the more likely the pattern is to be used. | :::Think of this as pattern aggression. The higher it is, the more likely the pattern is to be used. | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|ovrfile|string|""}} |
:::Path+filename for a Telecide-style override file. If the path specified does not exist, then no override will be used | :::Path+filename for a Telecide-style override file. If the path specified does not exist, then no override will be used | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|mask|bool|false}} |
:::Show a mask of the combing. | :::Show a mask of the combing. | ||
:::<span style="color:red">'''Note:'''</span> combing is only detected in luma. This mask does not touch chroma, but disregard its presence. If you don't like a mostly green frame, use [[GreyScale|Greyscale]] after this. | :::<span style="color:red">'''Note:'''</span> combing is only detected in luma. This mask does not touch chroma, but disregard its presence. If you don't like a mostly green frame, use [[GreyScale|Greyscale]] after this. | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|debug|bool|false}} |
:::Show some statistics at the upper left, including the amount of detected combs, the frame being used, whether the pattern is being used, and whether an orphan field was replaced. | :::Show some statistics at the upper left, including the amount of detected combs, the frame being used, whether the pattern is being used, and whether an orphan field was replaced. | ||
:::<span style="color:red">'''Note:'''</span> "Pattern Decision" will only appear when the pattern is used to decide. It will not show up just because a frame fits the pattern. | :::<span style="color:red">'''Note:'''</span> "Pattern Decision" will only appear when the pattern is used to decide. It will not show up just because a frame fits the pattern. | ||
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|mmx|bool|true}} |
− | :::Allow MMX code. | + | :::Allow [[MMX]] code. True will detect MMX; false will not allow it to be used. |
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|isse|bool|true}} |
− | ::: Allow iSSE code. | + | ::: Allow [[ISSE|iSSE]] code. True will detect iSSE; false will not allow it to be used. |
<br> | <br> | ||
− | ::{{ | + | ::{{Par2|sse|bool|true}} |
− | :::Allow SSE code. | + | :::Allow [[SSE]] code. True will detect SSE; false will not allow it to be used. |
<br> | <br> | ||
− | |||
== Examples == | == Examples == | ||
ReMatch with default values: | ReMatch with default values: | ||
[[DGDecode|MPEG2Source]]("IVTC source.d2v") | [[DGDecode|MPEG2Source]]("IVTC source.d2v") | ||
ReMatch(combthresh=12, c2thresh=6, scenethresh=20.0, orphanmode=2, orphanthresh=8000, guidecycle=5, guidethresh=10, ovrfile="", mask=false, debug=false, mmx=true, isse=true, sse=true) | ReMatch(combthresh=12, c2thresh=6, scenethresh=20.0, orphanmode=2, orphanthresh=8000, guidecycle=5, guidethresh=10, ovrfile="", mask=false, debug=false, mmx=true, isse=true, sse=true) | ||
− | |||
<br> | <br> | ||
== Changelog == | == Changelog == | ||
Line 159: | Line 157: | ||
v0.10: | v0.10: | ||
- Initial version.</pre> | - Initial version.</pre> | ||
− | |||
<br> | <br> | ||
<br> | <br> |
Latest revision as of 06:56, 22 February 2015
Abstract | |
---|---|
Author | Dan Donovan |
Version | v0.91 |
Download | rematch_dll_20050306.zip |
Category | IVTC & Decimation |
License | Closed source |
Discussion |
Contents |
[edit] Description
ReMatch is a field matching plugin, specifically for anime. ReMatch uses the odd field, and constructs 3 frames: One with the current even field, one with the previous even field, and one with the next even field. Combing artifacts are counted with a threshold and the picture with the least amount of detected combs is chosen. As of version 0.70, there is a pattern guidance system, which will try to determine a pattern to use when the comb counter is too close to call.
[edit] Requirements
- AviSynth 2.5.8 or later
- Supported color formats: YV12
Note: Mod-16 source material will yield the fastest results. Mod 8 still has plenty of MMX/SSE optimization. Below that, it's mostly straight C++, so try to stick with at least mod 8. This is true for all versions that have MMX/SSE.
[edit] Syntax and Parameters
- ReMatch (clip, int "combthresh", int "c2thresh", float "scenethresh", int "orphanmode", int "orphanthresh", int "guidecycle", int "guidethresh", string "ovrfile", bool "mask", bool "debug", bool "mmx", bool "isse", bool "sse")
- clip =
- Input clip.
- clip =
- int combthresh = 12
- The threshold for comparing a pixel to the 2 surrounding vertical pixels. A lower threshold will detect more combs.
- int combthresh = 12
- int c2thresh = 6
- The threshold for comparing the pixels on top and bottom of a given pixel. The 2 pixels must be within this value of each other.
- int c2thresh = 6
- float scenethresh = 20.0
- Sets the threshold for scene changes. This is computing by taking the average of the differences of the each pixel between the previous and next frame.
- An orphan field (see below) can only be detected at a scene change. Set to 0 to disable, though I highly disrecommend doing so.
- float scenethresh = 20.0
- int orphanmode = 2
- Sets what to do with orphan fields. 0: nothing, 1: duplicate previous frame when possible, 2: duplicate next frame when possible, otherwise duplicate previous frame
- int orphanmode = 2
- int orphanthresh = 8000
- Sets the threshold for finding an orphan field. If all 3 frame variations have at least this amount of combed pixels, it is detected as an orphan.
- int orphanthresh = 8000
- int guidecycle = 5
- IVTC guidance. This is how many frames a pattern has in it. 3:2 IVTC (30FPS to 24FPS) has a cycle of 5 frames. Use 0 to turn it off. Default: 5
- int guidecycle = 5
- int guidethresh = 10
- A percentage value. If all possible variations of the frame have within this amount (in %) combs of each other, the pattern will be tried.
- Think of this as pattern aggression. The higher it is, the more likely the pattern is to be used.
- int guidethresh = 10
- string ovrfile = ""
- Path+filename for a Telecide-style override file. If the path specified does not exist, then no override will be used
- string ovrfile = ""
- bool mask = false
- Show a mask of the combing.
- Note: combing is only detected in luma. This mask does not touch chroma, but disregard its presence. If you don't like a mostly green frame, use Greyscale after this.
- bool mask = false
- bool debug = false
- Show some statistics at the upper left, including the amount of detected combs, the frame being used, whether the pattern is being used, and whether an orphan field was replaced.
- Note: "Pattern Decision" will only appear when the pattern is used to decide. It will not show up just because a frame fits the pattern.
- bool debug = false
- bool mmx = true
- Allow MMX code. True will detect MMX; false will not allow it to be used.
- bool mmx = true
- bool isse = true
- Allow iSSE code. True will detect iSSE; false will not allow it to be used.
- bool isse = true
- bool sse = true
- Allow SSE code. True will detect SSE; false will not allow it to be used.
- bool sse = true
[edit] Examples
ReMatch with default values:
MPEG2Source("IVTC source.d2v") ReMatch(combthresh=12, c2thresh=6, scenethresh=20.0, orphanmode=2, orphanthresh=8000, guidecycle=5, guidethresh=10, ovrfile="", mask=false, debug=false, mmx=true, isse=true, sse=true)
[edit] Changelog
v0.91: - Major speedups when using an override file when debug and mask are disabled. Be careful when using this with Telecide overrides, as it seems that Telecide handles the 'previous' field different than ReMatch and often times, when previous is specified and works with Telecide, it will be different with ReMatch. v0.90: - Added basic, experimental Telecide override code. It does not support ranges, so each frame must be on a different line in the override (YATTA is fine to use, though Telecide would be faster). It does not work on the first frame of a video (frame 0) but seems to be good otherwise. I will add full override support later. v0.84: - Fixed an iSSE bug. v0.83: - Tweaking orphan detection. v0.82: - Fixed another bug with guidecycle at 0. Added c2thresh, which was previously a hardcoded value. v0.81: - Fixed a bug with setting guidecycle to 0. Changed default settings again. v0.80: - Disabled MMX/iSSE optimization for comb mask. Added some chroma consideration. Chroma combs are not counted, but chroma is considered when finding combs in the luma. Overall result should be slower but more accurate. Default combthresh is now 18. Default orphanthresh is now 6000, which should be okay due to scene detection, but may be increased as required. v0.78: - Added options to disable, MMX, iSSE and SSE. At the moment, SSE is not used. I don't know if I will ever have use for it in this plugin, but I will put it in anyway. If you disable MMX, iSSE and SSE are disabled as well. If you disable iSSE, SSE will also be disabled. Note that most of the MMX optimizations also use iSSE, so disabling iSSE will disable most optimizations. v0.77: - A little more optimization. Fix bug in assembly added in 0.84. v0.76: - When we drop to pattern detection and it can't figure it out, use the field with the least number of detected combs, not the current field. Also, some more tweaks to not allow pattern detection to pick a field that is obviously wrong. v0.75: - Speedups if you disable orphan detection (orphanmode = 0). I don't recommend you do this unless you are absolutely sure your source has no orphan fields. v0.74: - More MMX/iSSE optimization. Fixed a bug dealing with line pitch, though I never did see this bug do anything. Changed orphanthresh default to 50,000. When I added the scene change detection, it made orphan detection easy enough to not need such a high thresh. v0.73: - Removed some debug code I accidentally left in last time. v0.72: - Added scenethresh. At the moment, it's only used for detecting orphan fields. v0.71: - Some fixes in pattern guidance. It should no longer crash and it should be more accurate. Just set guidemode to 0 or lower the threshold if it's not accurate. v0.70: - Up to 8 pixels on the left and right of the picture are no longer used to count combs as misdetections seem to happen in those areas in the comb mask. This does NOT affect the output picture. Also, added pattern guidance. v0.60: - More rewrites and optimizations. Fixed a major bug with comb masks that made the current field preferred. Changed default settings. v0.50: - Major code optimizations, including my first time ever writing assembly, so please be patient if stuff is buggy! More optimization soon. v0.40 - Code rewrites, a lot added, will make it a LOT slower. Removed weighcombs. Does some filtering to try not to get false positives, which is what causes most of the slowdown. Changed default options. v0.30: - Code rewrites, should be faster. Removed ovrthresh. Added a comb mask. Added a weighted comb threshold. Changed default options. v0.20: - Implemented orphan handling. v0.16: - Fixed a comb counting bug. This should be fairly usable now, but it still isn't good at detecting jaggy lines. v0.15: - Added ovrthresh, corrected debug mode. v0.10: - Initial version.
Back to External Filters ←