Subtract
From Avisynth wiki
(Difference between revisions)
Raffriff42 (Talk | contribs) m (added category:Debugging/Diagnostic_filters) |
Raffriff42 (Talk | contribs) m (add link) |
||
| (3 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | Show the difference between two clips. Where the clips are equal, the output is 50% grey.<br> | |
| + | See [[filters with multiple input clips]] for the resulting [[Clip_properties|clip properties]]. | ||
| − | Subtract | + | ==== Syntax ==== |
| + | {{Template:FuncDef|Subtract(clip ''clip1'', clip ''clip2'')}} | ||
| − | + | ==== Examples ==== | |
| + | <div style="max-width:62em" > | ||
| + | Show the difference between two clips, and make the difference blatantly obvious: | ||
| + | <div {{BoxWidthIndent|46|2}} > | ||
| + | Subtract(A, B).[[Levels]](65, 1, 255-64, 0, 255, coring=false) | ||
| + | </div> | ||
| − | + | Show the difference between adjacent frames: | |
| − | Subtract( | + | <div {{BoxWidthIndent|46|2}} > |
| + | Subtract(A, A.[[Trim]](1, 0)) | ||
| + | </div> | ||
| − | + | ==== About offset of luma range ==== | |
| − | Subtract( | + | For YUV formats the valid ''Y'' range is 16-235, and '''Subtract''' takes this into account. This means that the following script |
| + | <div {{BoxWidthIndent|46|2}} > | ||
| + | Subtract(A, B) | ||
| + | </div> | ||
| + | ...will result in a "50% grey" clip with luma=126. | ||
| − | ''' | + | If you require a mathematically correct ''subtract'' function for 0-255 RGB or YUV data, use [[Overlay]]: |
| − | + | <div {{BoxWidthIndent|46|2}} > | |
| − | + | Overlay(A, B, mode="difference", pc_range=false) | |
| − | + | </div> | |
| − | + | ...which results in a "50% grey" clip with luma=128. | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
[[Category:Internal filters]] | [[Category:Internal filters]] | ||
[[Category:Debugging/Diagnostic_filters]] | [[Category:Debugging/Diagnostic_filters]] | ||
| + | [[Category:Layering]] | ||
Latest revision as of 15:33, 27 February 2016
Show the difference between two clips. Where the clips are equal, the output is 50% grey.
See filters with multiple input clips for the resulting clip properties.
[edit] Syntax
Subtract(clip clip1, clip clip2)
[edit] Examples
Show the difference between two clips, and make the difference blatantly obvious:
Subtract(A, B).Levels(65, 1, 255-64, 0, 255, coring=false)
Show the difference between adjacent frames:
Subtract(A, A.Trim(1, 0))
[edit] About offset of luma range
For YUV formats the valid Y range is 16-235, and Subtract takes this into account. This means that the following script
Subtract(A, B)
...will result in a "50% grey" clip with luma=126.
If you require a mathematically correct subtract function for 0-255 RGB or YUV data, use Overlay:
Overlay(A, B, mode="difference", pc_range=false)