BiFrost

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Description)
Line 1: Line 1:
 
{{FilterCat|External_filters|Restoration_filters|Rainbow & Dot Crawl Removal}}
 
{{FilterCat|External_filters|Restoration_filters|Rainbow & Dot Crawl Removal}}
 
{{Filter
 
{{Filter
| {{Author/Myrsloik}}  
+
| {{Author/Myrsloik}}, dubhater [v2.0]
| v1.1
+
| v2.0
| [http://ivtc.org/avisynth/bifrost-1.1.zip Bifrost]
+
| [http://github.com/dubhater/vapoursynth-bifrost/releases/download/v2.0-avs/avisynth-bifrost-v2.0.7z Bifrost]
 
| Rainbow & Dot Crawl Removal
 
| Rainbow & Dot Crawl Removal
 
|
 
|
 
* YV12
 
* YV12
| Closed source
+
|
 
|}}
 
|}}
 
<br>
 
<br>
 
== Description ==
 
== Description ==
:Bifrost is a temporal derainbower for avisynth that works in the YV12 colorspace and is intended for region 1 anime DVDs (hasn't been tested with anything else).
+
:Bifrost is a temporal derainbowing filter created by Fredrik Mellbin. The original Bifrost v1.1 worked on the whole frame or not at all.
:The advantage of a temporal derainbower is that it can actually recover detail and doesn't just smooth the image and cause color bleeding.  
+
:This version now works on blocks, making it possible to process static rainbows even if there is lots of motion in other parts of the image.
:The bad part is that it's only possible to process static parts of the image which is why an alternative derainbowing method can be used with the altclip parameter.  
+
 
:The most similar filter is probably the temporal processing part of the [http://home.earthlink.net/~tacosalad/video/dotcrawl.html DotCrawl] VirtualDub filter but with considerably less checks for artifacts
+
 
==== Requirements: ====
 
==== Requirements: ====
 
:- AviSynth 2.5.8 or later
 
:- AviSynth 2.5.8 or later
Line 21: Line 20:
  
 
== Syntax and Parameters ==
 
== Syntax and Parameters ==
:{{Template:FuncDef|Bifrost(clip, clip "altclip", float "scenelumathresh", int "variation", bool "conservativemask", bool "interlaced")}}
+
:{{Template:FuncDef|Bifrost (clip, clip "altclip", float "luma_thresh", int "variation", bool "conservative_mask", bool "interlaced", int "blockx", int "blocky")}}
 
<br>
 
<br>
::{{Par|altclip|int|clip}}
+
::{{Par|altclip|clip|}}
:::Altclip is the clip to return frames from when scenelumathresh is passed. This allows rainbows to be removed even in high motion scenes with other processing.
+
:::Bifrost will copy from this clip the chroma of the blocks it can't process. This allows moving blocks to be processed with some other filter.  
:::Returns the first clip if none is specified.
+
::::altclip must have the same format, dimensions, and length as the input clip.
 
<br>
 
<br>
::{{Par|scenelumathresh|float|3.0}}
+
::{{Par|luma_thresh|float|10.0}}
:::Scenelumathresh is how much every pixel in the frame/field may change on average and still be processed.
+
:::Blocks where the luma changes less than this are considered static and may be processed.
 
<br>
 
<br>
 
::{{Par|variation|int|5}}
 
::{{Par|variation|int|5}}
:::Variation determines how much the chroma must change for it to be considered a rainbow. Increasing it decreases false detection in some cases.
+
:::Controls how big a chroma change must be in order to be considered a rainbow. Increasing this can reduce false positives.
 
<br>
 
<br>
::{{Par|conservativemask|bool|false}}
+
::{{Par|conservative_mask|bool|false}}
:::Conservativemask determines if the area around pixels that are considered rainbows also are processed. Can reduce miscoloring a little when there's both movement and rainbows.
+
:::If true, only pixels detected as rainbows will be processed. Otherwise, pixels that have rainbows above and below them will also be processed.
 
<br>
 
<br>
 
::{{Par|interlaced|bool|true}}
 
::{{Par|interlaced|bool|true}}
:::Interlaced changes between field based and frame based decisions for scenelumathresh and is equivalent to using [[SeparateFields]] and [[Weave]].
+
:::If true, [[SeparateFields]] and [[Weave]] will be invoked in order to process the top and bottom fields separately.
 +
<br>
 +
::{{Par|blockx|int|4}}
 +
::{{Par|blocky|int|4}}
 +
:::The dimensions of the blocks. Smaller is probably better. The default 4×4 should be good enough.
 +
::::'''Note:''' If the dimensions of the image aren't divisible by blockx and blocky, the right and/or bottom edges won't be processed. Pad or crop the input clip before using Bifrost.
 
<br>
 
<br>
  
== Rainbow Types ==
+
== Types of Rainbows ==
:When dealing with telecined material you first have to determine if the rainbows were added before or after it was telecined.
+
When dealing with telecined material you must determine if the rainbows were added before or after the telecine process. Find a scene with clearly visible rainbows and use the following:
:To do this use SeparateFields().SelectOdd() on the source. Find a frame with lots of rainbowing and see if they change every frame or if there's a duplicate every 5 frames.  
+
<br>
:If you find duplicates it's type 2 rainbows and you have to perform perfect IVTC in YATTA and force the right pattern over the entire source clip and then finally use "Decimation by pattern" in the project to finish it.
+
  MPEG2Source("YourSource.d2v")
:If you find no duplicates (type 1) the process is much simpler and you just put Bifrost() right after the source
+
  SeparateFields()
 +
  SelectEven()
 +
If the rainbows change every frame, they were added after telecine. If there is a duplicate every five frames, they were added before.
 +
<br>
 
<br>
 
<br>
====Type 1:====
+
====Rainbows added before telecine====
  Mpeg2source("fruits_basket_r1.d2v")
+
First you must fix the telecine, then use Bifrost in progressive mode:
  Bifrost()
+
  MPEG2Source("rainbows1.d2v")
Telecide(order=1)
+
  TFM(order=1)
  Decimate()
+
  TDecimate()
=====Type 1 using altclip and [[SSIQ]]:=====
+
  Bifrost(interlaced=false)
Mpeg2source("gsc_r1.d2v")
+
  Bifrost(scenelumathresh=1.5,altclip=SSIQ(11,100,true),interlaced=true)
+
Telecide(order=1)
+
Decimate()
+
 
<br>
 
<br>
====Type 2:====
+
====Rainbows added after telecine====
Using Bifrost multiple times on type 2 rainbows can improve the results.
+
In this case, Bifrost should be used in interlaced mode, right after the source filter:
  Mpeg2source("trigun_r1.d2v")
+
  MPEG2Source("rainbows2.d2v")
Telecide(order=1,ovr="trigun.tel.txt")
+
  Bifrost(interlaced=true)
Decimate(ovr="trigun.dec.txt")
+
  # IVTC here
  Bifrost(interlaced=false)  
+
=====Type 2 using altclip and [[SSIQ]]:=====
+
  Mpeg2source("bgc_r1.d2v")
+
Telecide(order=1,ovr="bgc.tel.txt")
+
Decimate(ovr="bgc.dec.txt")
+
Bifrost(scenelumathresh=2,altclip=SSIQ(11,300,false),interlaced=false)
+
 
<br>
 
<br>
 
== Changelog ==
 
== Changelog ==
 +
  Version 2.0
 +
      - This version now works by processing blocks rather than whole frames. Static rainbows can now be processed even if there is lots of motion in other parts of the image.
 +
      - The "scenelumathresh" parameter was renamed to "luma_thresh" and it's default value is now 10.0
 +
      - The "conservativemask" parameter was renamed to "conservative_mask".<br>
 
   Version 1.1
 
   Version 1.1
 
       - Corrected several bad assumptions about pitch and no longer requests frames out of range which makes it compatible with avisynth 2.5.7.
 
       - Corrected several bad assumptions about pitch and no longer requests frames out of range which makes it compatible with avisynth 2.5.7.
Line 80: Line 81:
  
 
== Links ==
 
== Links ==
:[http://forum.doom9.org/showthread.php?t=74364 Doom9 Forum] - Original post by Myrsloik.
+
:[http://forum.doom9.org/showthread.php?t=169758 Doom9 Forum] - Discussion about Bifrost v2.0
:[http://forum.doom9.org/showthread.php?t=74397 Doom9 Forum] - Discussion about Bifrost v0.9.
+
:[http://github.com/dubhater/vapoursynth-bifrost/releases GitHub] - Source code repository

Revision as of 05:56, 19 November 2013

Abstract
Author Myrsloik, dubhater [v2.0]
Version v2.0
Download Bifrost
Category Rainbow & Dot Crawl Removal
Requirements
  • YV12
License
Discussion


Contents

Description

Bifrost is a temporal derainbowing filter created by Fredrik Mellbin. The original Bifrost v1.1 worked on the whole frame or not at all.
This version now works on blocks, making it possible to process static rainbows even if there is lots of motion in other parts of the image.

Requirements:

- AviSynth 2.5.8 or later
- Supported color formats: YV12


Syntax and Parameters

Bifrost (clip, clip "altclip", float "luma_thresh", int "variation", bool "conservative_mask", bool "interlaced", int "blockx", int "blocky")


altclip clip =
Bifrost will copy from this clip the chroma of the blocks it can't process. This allows moving blocks to be processed with some other filter.
altclip must have the same format, dimensions, and length as the input clip.


luma_thresh float = 10.0
Blocks where the luma changes less than this are considered static and may be processed.


variation int = 5
Controls how big a chroma change must be in order to be considered a rainbow. Increasing this can reduce false positives.


conservative_mask bool = false
If true, only pixels detected as rainbows will be processed. Otherwise, pixels that have rainbows above and below them will also be processed.


interlaced bool = true
If true, SeparateFields and Weave will be invoked in order to process the top and bottom fields separately.


blockx int = 4
blocky int = 4
The dimensions of the blocks. Smaller is probably better. The default 4×4 should be good enough.
Note: If the dimensions of the image aren't divisible by blockx and blocky, the right and/or bottom edges won't be processed. Pad or crop the input clip before using Bifrost.


Types of Rainbows

When dealing with telecined material you must determine if the rainbows were added before or after the telecine process. Find a scene with clearly visible rainbows and use the following:

 MPEG2Source("YourSource.d2v")
 SeparateFields()
 SelectEven()

If the rainbows change every frame, they were added after telecine. If there is a duplicate every five frames, they were added before.

Rainbows added before telecine

First you must fix the telecine, then use Bifrost in progressive mode:

MPEG2Source("rainbows1.d2v")
TFM(order=1)
TDecimate()
Bifrost(interlaced=false)


Rainbows added after telecine

In this case, Bifrost should be used in interlaced mode, right after the source filter:

MPEG2Source("rainbows2.d2v")
Bifrost(interlaced=true)
# IVTC here


Changelog

  Version 2.0
     - This version now works by processing blocks rather than whole frames. Static rainbows can now be processed even if there is lots of motion in other parts of the image.
     - The "scenelumathresh" parameter was renamed to "luma_thresh" and it's default value is now 10.0
     - The "conservativemask" parameter was renamed to "conservative_mask".
Version 1.1 - Corrected several bad assumptions about pitch and no longer requests frames out of range which makes it compatible with avisynth 2.5.7. - Uses the whole image and not just the upper half to determine if there is too much motion, this reduces artifacts greatly in certain clips but the scenelumathresh argument now has to be twice as big as in previous versions for the same effect. - Processes the image borders properly instead of just ignoring them. - Can look two frames in either direction instead of just one frame in both. This makes it possible to remove rainbows in frames right before and after scenechanges.


Links

Doom9 Forum - Discussion about Bifrost v2.0
GitHub - Source code repository
Personal tools