ReMatch

From Avisynth wiki
Jump to: navigation, search
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.


int  combthresh = 12
The threshold for comparing a pixel to the 2 surrounding vertical pixels. A lower threshold will detect more combs.


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.


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.


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  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  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  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.


string  ovrfile = ""
Path+filename for a Telecide-style override file. If the path specified does not exist, then no override will be used


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  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  mmx = true
Allow MMX code. True will detect MMX; false will not allow it to be used.


bool  isse = true
Allow iSSE code. True will detect iSSE; false will not allow it to be used.


bool  sse = true
Allow SSE code. True will detect SSE; false will not allow it to be used.


[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


Personal tools