DctFilter

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (category)
(reformat)
Line 1: Line 1:
{{FilterCat4|External_filters|Plugins|Denoisers|Spatial_denoisers}}
+
{{FilterCat|External_filters|Plugins|Other_filters}}
<h1>DctFilter</h1>
+
{{Filter3
<h2>Abstract</h2>
+
| {{Author/Tom Barry}}
<b>author:</b> Tom Barry
+
| v0.0.1.4  
<br><b>version:</b> 0.0.1.4
+
|[http://web.archive.org/web/20130207143129/http://neuron2.net/trbarry/DctFilter.zip DctFilter.zip]
<br><b>download: </b>[http://www.avisynth.nl/users/warpenterprises/files/dctfilter_5F25_dll_20030221.zip V 0.0.1.4]<br>
+
|
<b>category:</b> Misc Plugins<br>
+
| [http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
<b>requirements:</b> &nbsp;
+
|6=[http://forum.doom9.org/showthread.php?t=168449 Doom9 Thread]}}
<ul>
+
== Description ==
  <li>YV12 &amp; YUY2 Colorspace and screen multiples of 16x16</li>
+
An experimental filter that, for each 8x8 block, will do a Discrete Cosine Transform (DCT), scale down the selected frequency values, and then reverse the process with an Inverse Discrete Cosine Transform (IDCT).
  <li>SSEMMX support</li>
+
<br>
</ul>
+
<br>
<hr>
+
== Requirements ==
<h2>Description</h2>
+
* AviSynth 2.5.8 or [http://forum.doom9.org/showthread.php?t=168764 greater]
DctFilter is an experimental filter that, for each 8x8 block, will do a Discrete Cosine Transform (DCT), scale down the selected frequency values,
+
* Supported color formats: [[YUY2]], [[YV12]]
and then reverse the process with an Inverse Discrete Cosine Transform (IDCT).<h3>Usage</h3>
+
* Width and height need to be a multiple of 16 (mod16)
<p> In your Avisynth file use commands similar to</p>
+
 
<pre>Avisource(&quot;D:\wherever\myfile.avi&quot;)
+
* [[MMX]] or [[SSE2]] capable CPU
DctFilter(1,1,1,1,1,1,.5,0)</pre>
+
<br>
<h3> Parameters</h3>
+
== Known Issues ==
<p>There are 8 positional floating point parameters, all of which must be specified as in the range (0.0 &lt;= x &lt;= 1.0). These correspond to scaling
+
* [http://forum.doom9.org/showthread.php?p=1191185#post1191185 Stripe bug] - both variants are buggy at calculating DC, additional information [http://forum.doom9.org/showthread.php?p=1346201#post1346201 here] and [http://forum.doom9.org/showthread.php?p=1051452#post1051452 here].
factors for the 8 rows and colums of the 8x8 DCT blocks. The leftmost parm corresponds to the top row, left column. This would be the DC component
+
<br>
of the transform and should always be left as 1.0. </p>
+
== [[Script variables|Syntax and Parameters]] ==
<p>In the above example the highest frequency components in each row and column  
+
<br>
  would be zeroed while the 2nd highest would be cut in half. </p>
+
=== DctFilter ===
<p>The row &amp; column parms are multiplied together to get the scale factor  
+
There are 8 positional floating point parameters, all of which must be specified as in the range (0.0 <= x <= 1.0). These correspond to scaling factors for the 8 rows and columns of the 8x8 DCT blocks.<br>
  for each of the 64 values in a block. So if the top left value was V[0,0] then in
+
The leftmost parameter corresponds to the top row, left column. This would be the DC component of the transform and should always be left as 1.0.
the example above the we would scale row 6, col 6 (V[6,6]) by .5 * .5 = .25.</p>
+
<br>
<p>Note that while they look like floating point parms above they really now only
+
<br>
have 3 bit accuracy so the only actual values used are 0, {{Frac|1|8}}, {{Frac|1|4}}, {{Frac|3|8}} ...  
+
:{{Template:FuncDef|DctFilter (clip, float, float, float, float, float, float, float, float)}}
  1.0. But you can specify any value and it will be rounded to the nearest one.</p>
+
<br>
<h3> DctFilterD - New with v 0.0.1.4</h3>
+
In the following example the highest frequency components in each row and column will be zeroed while the 2nd highest would be cut in half.
<p>You can instead use DctFilterD(DiagCt). This works similar to above but will  
+
[[AviSource]]("Blah.avi")
  zero out DiagCt number of the lower right diagonals of the DCT, leaving other values  
+
DctFilter(1,1,1,1,1,1,.5,0)
  unchanged. In an 8x8 DCT result matrix there are 15 possible diagonals. (visualize a chess
+
The row &amp; column parms are multiplied together to get the scale factor for each of the 64 values in a block. So if the top left value was V[0,0] then in the example above the we would scale row 6, col 6 (V[6,6]) by .5 * .5 = .25.<br/>
  board) The DiagCt parm must be an integer from 1-14 saying how many of these diagonals
+
Note that while they look like floating point parms above they really now only
  must be zeroed, starting from the lower right hand corner.</p>
+
have 3 bit accuracy so the only actual values used are 0, {{Frac|1|8}}, {{Frac|1|4}}, {{Frac|3|8}} ... 1.0. But you can specify any value and it will be rounded to the nearest one.
<h3>Comments</h3>
+
 
<p>This new function DctFilterD(DiagCt) works on diagonals. It is simpler and either zeroes diagonals or leaves them alone.</p>
+
<br>
<p>In a 8x8 DCT result there are 15 possible diagonals (visualize a chess board).
+
-------------
  So if you specify: </p>
+
<br>
<pre>DctFilterD(4)</pre>
+
=== DctFilterD ===
<p>then the 4 diagonals in the lower right corner of the DCT result will be set  
+
DctFilterD works similar to DctFilter but will zero out DiagCt number of the lower right diagonals of the DCT, leaving other values unchanged. <br/>
  to 0. The DiagCt parm may be any integer value from 1-14. </p>
+
In an 8x8 DCT result matrix there are 15 possible diagonals (visualize a chess board), so if you specify <code>DctFilterD(4)</code> then the 4 diagonals in the lower right corner of the DCT result will be set to 0. <br/>I haven't tested this much but, like my results with custom quant tables, it appears if you set DiagCt very large you will start to get edge noise, something like ringing.[http://forum.doom9.org/showpost.php?p=266216&postcount=145]
<p>I haven't tested this much but, like my results with custom quant tables, it  
+
<br>
  appears if you set DiagCt very large you will start to get edge noise, something like  
+
<br>
  ringing.</p>
+
:{{Template:FuncDef|DctFilterD (clip, int)}}
 +
<br>
 +
::{{Par2| |clip| }}
 +
:::Input clip.
 +
 
 +
::{{Par2| |int| }}
 +
:::"DiagCt" must be an integer from 1-14 saying how many of these diagonals must be zeroed, starting from the lower right hand corner.
 +
<br>
 +
-------------
 +
<br>
 +
=== DctAddConstant ===
 +
Not much is known about this filter...
 +
<br/>
 +
<br/>
 +
:{{Template:FuncDef|DctAddConstant (clip, float, float, float, float)}}
 +
<br>
 +
 
 +
== Examples ==
 +
Remove high frequency components.
 +
[[AviSource]]("blah.avi")
 +
DctFilter(1,1,1,.8,.4,0,0,0)
 +
<br>
 +
== Changelog ==
 +
Version      Date            Developer      Changes<br>
 +
v0.0.1.4    2003/02/21      Tom Barry      - Add DctFilterD, diagonal support
 +
v0.0.1.3    2003/01/30      Tom Barry      - Avisynth 2.5 beta, plugininit2, vs6
 +
v0.0.1.2    2002/11/2?      SansGrip        - YUY2 support
 +
v ?          2002/11/25      Tom Barry      - Initial test release for Avisynth 2.5 alpha only
 +
<br>
 +
 
 +
== Archived Downloads ==
 +
{| class="wikitable" border="1"; width="600px"
 +
|-
 +
!!width="100px"| Version
 +
!!width="150px"| Download
 +
!!width="150px"| Mirror
 +
!!width="150px"| Mirror 2
 +
|-
 +
!v0.0.1.4
 +
|[http://web.archive.org/web/20130207143129/http://neuron2.net/trbarry/DctFilter.zip DctFilter.zip]
 +
|
 +
|
 +
|}
 +
<br>
 +
 
 +
== External Links ==
 +
*[http://www.aquilinestudios.org/avsfilters/spatial.html#dct AquilineStudios] - Additional information on usage.
 +
<br>
 +
<br>
 +
-----------------------------------------------
 +
'''Back to [[External_filters#Edge_Detection|External Filters]] &larr;'''

Revision as of 20:16, 26 October 2014

Abstract
Author Tom Barry
Version v0.0.1.4
Download DctFilter.zip
Category
License GPLv2
Discussion Doom9 Thread

Contents

Description

An experimental filter that, for each 8x8 block, will do a Discrete Cosine Transform (DCT), scale down the selected frequency values, and then reverse the process with an Inverse Discrete Cosine Transform (IDCT).

Requirements

  • AviSynth 2.5.8 or greater
  • Supported color formats: YUY2, YV12
  • Width and height need to be a multiple of 16 (mod16)


Known Issues

  • Stripe bug - both variants are buggy at calculating DC, additional information here and here.


Syntax and Parameters


DctFilter

There are 8 positional floating point parameters, all of which must be specified as in the range (0.0 <= x <= 1.0). These correspond to scaling factors for the 8 rows and columns of the 8x8 DCT blocks.
The leftmost parameter corresponds to the top row, left column. This would be the DC component of the transform and should always be left as 1.0.

DctFilter (clip, float, float, float, float, float, float, float, float)


In the following example the highest frequency components in each row and column will be zeroed while the 2nd highest would be cut in half.

AviSource("Blah.avi")
DctFilter(1,1,1,1,1,1,.5,0)

The row & column parms are multiplied together to get the scale factor for each of the 64 values in a block. So if the top left value was V[0,0] then in the example above the we would scale row 6, col 6 (V[6,6]) by .5 * .5 = .25.
Note that while they look like floating point parms above they really now only have 3 bit accuracy so the only actual values used are 0, 1/8, 1/4, 3/8 ... 1.0. But you can specify any value and it will be rounded to the nearest one.




DctFilterD

DctFilterD works similar to DctFilter but will zero out DiagCt number of the lower right diagonals of the DCT, leaving other values unchanged.
In an 8x8 DCT result matrix there are 15 possible diagonals (visualize a chess board), so if you specify DctFilterD(4) then the 4 diagonals in the lower right corner of the DCT result will be set to 0.
I haven't tested this much but, like my results with custom quant tables, it appears if you set DiagCt very large you will start to get edge noise, something like ringing.[1]

DctFilterD (clip, int)


clip   =
Input clip.
int   =
"DiagCt" must be an integer from 1-14 saying how many of these diagonals must be zeroed, starting from the lower right hand corner.




DctAddConstant

Not much is known about this filter...

DctAddConstant (clip, float, float, float, float)


Examples

Remove high frequency components.

AviSource("blah.avi")
DctFilter(1,1,1,.8,.4,0,0,0)


Changelog

Version      Date            Developer       Changes
v0.0.1.4 2003/02/21 Tom Barry - Add DctFilterD, diagonal support v0.0.1.3 2003/01/30 Tom Barry - Avisynth 2.5 beta, plugininit2, vs6 v0.0.1.2 2002/11/2? SansGrip - YUY2 support v ? 2002/11/25 Tom Barry - Initial test release for Avisynth 2.5 alpha only


Archived Downloads

Version Download Mirror Mirror 2
v0.0.1.4 DctFilter.zip


External Links




Back to External Filters

Personal tools