Compare
From Avisynth wiki
(Difference between revisions)
Raffriff42 (Talk | contribs) m (add example image) |
(add link to avs+ documentation) |
||
(2 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | <div style="max-width: | + | __NOTOC__ |
+ | <div style="max-width:60em" > | ||
+ | |||
+ | <div {{BlueBox2|40|0|3px solid purple}} > | ||
+ | {{AvsPlusFullname}}<br> | ||
+ | Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/compare.html https://avisynthplus.readthedocs.io] | ||
+ | </div> | ||
+ | |||
+ | |||
+ | Compares two clips (the "filtered" clip and the "original" clip) and returns the following data for each frame: | ||
+ | :;Mean Absolute Deviation <sup>[[wikipedia:Statistical_dispersion|1]]</sup> | ||
+ | ::''(minimum, average, maximum)'' | ||
+ | :;Mean Deviation | ||
+ | ::''(minimum, average, maximum)'' | ||
+ | :;Max. Positive Deviation | ||
+ | :;Max. Negative Deviation | ||
+ | :;Peak Signal-to-Noise Ratio (PSNR) <sup>[[PSNR|2]]</sup> | ||
+ | ::''(minimum, average, maximum)'' | ||
+ | :;PSNR | ||
+ | ::''(minimum, average, maximum)'' | ||
+ | :;Overall PSNR | ||
+ | |||
+ | These data are displayed on screen by default (see [[#Examples|example image]]), or can optionally be written to a {{FuncArg|logfile}}. | ||
+ | |||
+ | By default a ''PSNR graph'' is displayed; this graph shows overall PSNR visually as a timeline that grows left-to-right along the bottom of the screen as the clip plays. | ||
+ | |||
+ | === Syntax and Parameters === | ||
{{FuncDef | {{FuncDef | ||
− | |Compare(clip ''clip_filtered'', clip ''clip_original'', string ''channels'', string ''logfile'', bool ''show_graph'')}} | + | |Compare(clip ''clip_filtered'', clip ''clip_original''<br> |
+ | [, string ''channels'', string ''logfile'', bool ''show_graph'' ] ) | ||
+ | }} | ||
{{Par2|clip_filtered, clip_original|clip|}} | {{Par2|clip_filtered, clip_original|clip|}} | ||
− | : | + | :The "filtered" clip and the "original" clip. Size and color formats must match. |
+ | :Color format may be [[RGB24]], [[RGB32]], [[YUY2]] or [[YV12]]. | ||
+ | :The "filtered" clip is returned. | ||
{{Par2|channels|string|""}} | {{Par2|channels|string|""}} | ||
− | :Set the color channels to be compared with a combination of ''R'',''G'',''B'' [,''A''] or ''Y'',''U'',''V'', depending on the source color format. | + | :Set the color channels to be compared with a combination of ''R'',''G'',''B'' [,''A''] or ''Y'',''U'',''V'', depending on the source color format. |
+ | :By default, all channels are compared. | ||
{{Par2|show_graph|bool|true}} | {{Par2|show_graph|bool|true}} | ||
− | :If true, (the default) | + | :If true, (the default) the PSNR graph is drawn on the screen. |
{{Par2|logfile|string|""}} | {{Par2|logfile|string|""}} | ||
− | :If specified, the results will be written to a file | + | :If specified, the results will be written to a file, and not drawn on the clip. |
+ | :Using a {{FuncArg|logfile}} is much faster if you need to compare a lot of frames. | ||
− | + | === Examples === | |
− | * | + | * Basic usage – display differences on screen: |
<div {{BoxWidthIndent|36|2}} > | <div {{BoxWidthIndent|36|2}} > | ||
[[FFmpegSource|FFmpegSource2]]("[http://www.sintel.org/ sintel].mp4") | [[FFmpegSource|FFmpegSource2]]("[http://www.sintel.org/ sintel].mp4") | ||
A=[[BicubicResize]](640, 272) | A=[[BicubicResize]](640, 272) | ||
− | B=A.[[Sharpen]](1.0) ## | + | B=A.[[Sharpen]](1.0) ## Sharpen is our ''filter under test'' |
− | return Compare(A | + | return Compare(B, A) |
</div> | </div> | ||
:[[File:Compare-Sintel-9507.png]] | :[[File:Compare-Sintel-9507.png]] | ||
− | * | + | * Create a log file: |
<div {{BoxWidthIndent|36|2}} > | <div {{BoxWidthIndent|36|2}} > | ||
Compare(clip1, clip2, "", "compare.log") | Compare(clip1, clip2, "", "compare.log") | ||
</div> | </div> | ||
− | * | + | * Compare chroma channels only: |
<div {{BoxWidthIndent|36|2}} > | <div {{BoxWidthIndent|36|2}} > | ||
Compare(clip1, clip2, "UV") | Compare(clip1, clip2, "UV") | ||
Line 36: | Line 68: | ||
</div> | </div> | ||
− | ===== | + | === External Links === |
+ | *[http://forum.doom9.org/showthread.php?t=29538 discussion] | ||
+ | |||
+ | === Changes === | ||
{| border="1" | {| border="1" | ||
|- | |- |
Latest revision as of 05:20, 18 September 2022
AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io
Compares two clips (the "filtered" clip and the "original" clip) and returns the following data for each frame:
These data are displayed on screen by default (see example image), or can optionally be written to a logfile.
By default a PSNR graph is displayed; this graph shows overall PSNR visually as a timeline that grows left-to-right along the bottom of the screen as the clip plays.
[edit] Syntax and Parameters
Compare(clip clip_filtered, clip clip_original
[, string channels, string logfile, bool show_graph ] )
clip clip_filtered, clip_original =
- The "filtered" clip and the "original" clip. Size and color formats must match.
- Color format may be RGB24, RGB32, YUY2 or YV12.
- The "filtered" clip is returned.
string channels = ""
- Set the color channels to be compared with a combination of R,G,B [,A] or Y,U,V, depending on the source color format.
- By default, all channels are compared.
bool show_graph = true
- If true, (the default) the PSNR graph is drawn on the screen.
string logfile = ""
- If specified, the results will be written to a file, and not drawn on the clip.
- Using a logfile is much faster if you need to compare a lot of frames.
[edit] Examples
- Basic usage – display differences on screen:
FFmpegSource2("sintel.mp4") A=BicubicResize(640, 272) B=A.Sharpen(1.0) ## Sharpen is our filter under test return Compare(B, A)
- Create a log file:
Compare(clip1, clip2, "", "compare.log")
- Compare chroma channels only:
Compare(clip1, clip2, "UV")
[edit] External Links
[edit] Changes
v2.58 | Added YV12 support. |