<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://avisynth.nl/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://avisynth.nl/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kogarou</id>
		<title>Avisynth wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://avisynth.nl/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kogarou"/>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Special:Contributions/Kogarou"/>
		<updated>2026-04-22T03:17:47Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.19.24</generator>

	<entry>
		<id>http://avisynth.nl/index.php/MVTools</id>
		<title>MVTools</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/MVTools"/>
				<updated>2022-08-16T01:05:02Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: Changed the latest docs link to an online previewer of the git HTML file.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat5|External_filters|Plugins|Plugins_x64|Other_filters|Support_filters}}&lt;br /&gt;
[[Category:Deep_color_tools]]&lt;br /&gt;
{{Filter&lt;br /&gt;
|Manao, Fizick, Tsp, TSchniede, SEt, cretindesalpes, pinterf&lt;br /&gt;
|v2.7.39&lt;br /&gt;
|'''[https://github.com/pinterf/mvtools/releases mvtools-2.7.39-with-depans.7z]'''&lt;br /&gt;
(8-16(32) bits, 420,422,444 support, x86/x64)&lt;br /&gt;
|[[:Category:Support_filters|Support filters]], [[:Category:Deep_color_tools|Deep color tools]]&lt;br /&gt;
|&lt;br /&gt;
* [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0]&lt;br /&gt;
* AviSynth+ for x64 and native 10+ bits&lt;br /&gt;
* YV12&lt;br /&gt;
* YUY2&lt;br /&gt;
* YV16, YV24 (2.7.1-)&lt;br /&gt;
* YUV 4:2:0, 4:2:2, 4:4:4 10-16 bits (32 bits in selected filters)&lt;br /&gt;
|[https://www.gnu.org/licenses/gpl-2.0.txt GPLv2]&lt;br /&gt;
|7=[https://forum.doom9.org/showthread.php?t=84770 Doom9], [https://forum.doom9.org/showthread.php?t=131033 continued]&lt;br /&gt;
------&lt;br /&gt;
[https://forum.doom9.org/showthread.php?p=1386559#post1386559 Doom9 v2.6 mod], [https://forum.doom9.org/showthread.php?t=173356 v2.7mod]}}&lt;br /&gt;
&lt;br /&gt;
== About MVTools ==&lt;br /&gt;
MVTools plugin for AviSynth 2.6 is a collection of functions for estimation and compensation of objects motion in video clips. Motion compensation may be used for strong temporal denoising, advanced framerate conversions, image restoration and other tasks.&lt;br /&gt;
&lt;br /&gt;
The plugin contains the motion estimation server-function MAnalyse to find the motion vectors and several motion compensation client-functions (MCompensate, MMask and others) which use these vectors.&lt;br /&gt;
&lt;br /&gt;
Plugin uses block-matching method of motion estimation (similar methods are used in MPEG2, MPEG4, etc). At analysis stage plugin divides frames by small blocks and try to find for every block in current frame the most similar (matching) block in second frame (previous or next). The relative shift of these blocks is motion vector. The main measure of block similarity is sum of absolute differences (SAD) of all pixels of these two blocks compared. SAD is a value which says how good the motion estimation was.&lt;br /&gt;
&lt;br /&gt;
The output of MAnalyse (server) is special clip with motion vector information in some format.&lt;br /&gt;
&lt;br /&gt;
At compensation stage the plugin client functions read the motion vectors and use them to move blocks and form motion compensated frame (or realize some other full or partial motion compensation or interpolation function). Every object (block) in this (fully) compensated frame is placed in the same position as this object in current frame. So, we may (for example) use strong temporal denoising even for quite fast moving objects without producing annoying artifacts and ghosting (object's features and edges are coincide if compensation is perfect). Plugin can create compensated neighbor frames for every current frame, and denoise it by internal function. Alternatively, you can use compensated and original frames to create interleaved clip, denoise it by any external temporal filter, and select central cleaned original frames for output (see examples).&lt;br /&gt;
&lt;br /&gt;
Of course, the motion estimation and compensation is not ideal and precise. In some complex cases (video with fading, ultra-fast motion, or periodic structures) the motion estimation may be completely wrong, and compensated frame will be blocky and (or) ugly. Severe difficulty is also due to objects mutual screening (occlusion) or reverse opening. Complex Avisynth scripts with many motion compensation functions may eat huge amount of memory and result in very slow processing. It is not simple but quite advanced plugin. Use it for appropriate cases only, and try to tune its parameters. There are many discussions about motion compensation using at doom9 Avisynth forum. In particular see [https://forum.doom9.org/showthread.php?t=76041 old MVTools thread], [https://forum.doom9.org/showthread.php?t=102071 true motion thread], [https://forum.doom9.org/showthread.php?t=84770 new MVTools thread] and some other. Try to read the postings in addition to this documentation and ask for support there. If you really interested in motion estimation and compensation topics, you can easy find numerous scientific publications (use WWW search).&lt;br /&gt;
&lt;br /&gt;
Notes 1: Try to use a smart deinterlacer for interlaced video (SeparateFields may works too with or without SelectEven/SelectOdd). Some complex scripts (MVBOB, MCBOB, TempGaussMC) use MVTools for motion compensated deinterlacing.&lt;br /&gt;
Alternatively you can try to use Motion plugin by mg262.&lt;br /&gt;
&lt;br /&gt;
Notes 2:  Stacked 16 bit output for MDegrain1-6 and MDegrainN are also supported in general.&lt;br /&gt;
Native 10-16 bit colorspaces (and 32 bit float in MDegrain) are available when using MVTools with AviSynth+ r2294-.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Latest documentation:&amp;lt;/span&amp;gt; https://htmlpreview.github.io/?https://github.com/pinterf/mvtools/blob/mvtools-pfmod/Documentation/mvtools2.html'''&lt;br /&gt;
&lt;br /&gt;
== Common parameters ==&lt;br /&gt;
Filters that use motion vectors have common parameters. Those are the scene-change detection thresholds, and the isse MMX flag. They also use one or several vectors stream, which are produced by MAnalyse.&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|thSCD1}} (int, 400): threshold which decides whether a block has changed between the previous frame and the current one. When a block has changed, it means that motion estimation for it isn't relevant. It occurs for example at scene changes. So it is one of the thresholds used to tweak the scene changes detection engine. Raising it will lower the number of blocks detected as changed. It may be useful for noisy or flickered video. The threshold is compared to the SAD (Sum of Absolute Differences, a value which says how bad the motion estimation was ) value. For exactly identical blocks we have SAD=0. But real blocks are always different because of objects complex movement (zoom, rotation, deformation), discrete pixels sampling, and noise. Suppose we have two compared 8x8 blocks with every pixel different by 5. It this case SAD will be 8x8x5 = 320 (block will not detected as changed for thSCD1=400). If you use 4x4 blocks, SAD will be 320/4. If you use 16x16 blocks, SAD will be 320*4. Really this parameter is scaled internally in MVTools, and you must always use reduced to block size 8x8 value. Default is 400 (since v.1.4.1).&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|thSCD2}} (int, 130): Threshold which sets how many blocks have to change for the frame to be considered as a scene change. It is ranged from 0 to 255, 0 meaning 0 %, 255 meaning 100 %. Default is 130 (which means 51 %).&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|isse}} (bool, true): Flag which allows to enable (if set to true) or disable ISSE, MMX and other CPU optimizations (for debugging). If your processor doesn't support CPU optimizations, it will be disabled anyway (and you won't be able to activate them).&lt;br /&gt;
 &lt;br /&gt;
*{{Template:FuncDef2|planar}} (bool, false): Legacy flag to use a hack planar color format for YUY2 clips, both for input and output of functions. It uses a hack to store frames with planar data (separate Y, U, V planes in memory) in normal interleaved YUY2 frames format as a container. This way we can avoid numerous internal interleaved to planar conversions and increase speed. You can convert a normal interleaved YUY2 source clip to planar with Interleaved2planar from SSETools and convert back with Planar2interleaved. This special planar YUY2 format is also supported by Removegrain, MaskTools2 and some others. This trick is not needed in Avisynth 2.6 with native support of planar YV16 format. This parameter is ignored for YV12 clips. Note: super clip is always planar. &lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|mt}} (bool, true): When true, enables internal multi-threading via AVSTP. Only available in some functions, like [[MVTools2/MSuper]] and [[MVTools2/MSuper]].&amp;lt;br&amp;gt;'''Might''' be better to disable when using AVS+ 3.6 and leting the frameserver do its thing ([http://publishwith.me/ep/pad/view/ro.rDkwcdWn4k9/latest MTmodes.avsi], if loaded, sets the number of AVSTP threads to 1, which should give the same result as mt=false)&lt;br /&gt;
&lt;br /&gt;
== Filters ==&lt;br /&gt;
{{PluginFilterTable}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MSuper|&lt;br /&gt;
Get source clip and prepare special &amp;quot;super&amp;quot; clip with multilevel (hierarchical scaled) frames data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, Planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MAnalyse|&lt;br /&gt;
Get prepared multilevel super clip, estimate motion by block-matching method and produce special output clip with motion vectors data (used by other functions).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MCompensate|&lt;br /&gt;
Do a full motion compensation of the frame.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MMask|&lt;br /&gt;
Creates mask clip from source clip with motion vectors data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MSCDetection|&lt;br /&gt;
Creates scene detection mask clip from motion vectors data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MShow|&lt;br /&gt;
Shows the motion vectors on padded source by super clip opening.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDepan|&lt;br /&gt;
Get the motion vectors, estimate global motion and put data to output frame in special format for [[DePan]] plugin.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlow|&lt;br /&gt;
Do a motion compensation of the frame not by blocks (like MCompensate), but by pixels.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowInter|&lt;br /&gt;
Motion interpolation function. It is not the same (but similar) as MVInterpolate function of older MVTools version.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowFps|&lt;br /&gt;
Will change the frame rate (fps) of the clip. The function can be used for frame rate conversion, slow-motion effect, etc.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MBlockFps|&lt;br /&gt;
The function uses block-based partial motion compensation to change the framerate (fps) of the clip (and number of frames).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowBlur|&lt;br /&gt;
Experimental simple motion blur function. It may be used for FILM-effect (to simulate finite shutter time).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDegrain''X''|&lt;br /&gt;
Temporal denoising with motion compensation. MDeGrain''X'' has a temporal radius of ''X'', up to 6.&amp;lt;br&amp;gt;&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDegrainN|&lt;br /&gt;
Temporal denoising with motion compensation. MDeGrainN has a temporal radius given by the tr parameter, and uses a special motion vector clip.&amp;lt;br&amp;gt;&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MRecalculate|&lt;br /&gt;
Refines and recalculates motion data of previously estimated (by MAnalyse) motion vectors with different super clip or new parameters set (e.g. lesser block size), after divide, etc.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MScaleVect|&lt;br /&gt;
Rescales motion vectors / blocksize. Main purpose is to allows vectors to be used on a differently sized clip or on a clip having different bit depth than they were analyzed from. &lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MStoreVect|&lt;br /&gt;
Stores (multiple) motion vectors in a encodable clip. Allows you to encode vectors to a file (must use a lossless format). Convenient for splitting up very slow scripts. Can also use to process the same footage in multiple ways. Use MRestoreVect to get the motion vectors back out of the clip. &lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MRestoreVect|&lt;br /&gt;
Fetches a single motion vector clip from a special clip prepared earlier by MStoreVect. Call multiple times if there are several clips stored. The function returns a single motion vectors clip.&lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MShow|&lt;br /&gt;
Shows the motion vectors on padded source by super clip opening. &lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note1: native 10-16 bits and 4:2:0 and 8-16 bits 4:2:2, 4:4:4 color spaces are supported in 2.7.x branch&lt;br /&gt;
Note2: native 10+ bits only work with Avisynth+&lt;br /&gt;
Note3: MDegrain supports 32 bit float input clips (Super and Input) but motion vectors should be calculated from 8-16 bits&lt;br /&gt;
&lt;br /&gt;
== Changelog ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;border: 1px solid darkgray&amp;quot;&lt;br /&gt;
!Version&lt;br /&gt;
!Date&lt;br /&gt;
!Author&lt;br /&gt;
!Changes&lt;br /&gt;
|-&lt;br /&gt;
|2.7.30&lt;br /&gt;
|20180405&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: crash in MFlowInter (and possibly other MFlow...). v2.7.29 revealed this additional bug (which was not even 100% reproducible), this fix is basically the 2nd part of the solution.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.29&lt;br /&gt;
|20180403&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MFlowInter (and possibly other MFlow...) crash with specific combination of analyze parameters (e.g. blkSize=16,overlapv=4,divide=1). Bug existed since at least 2.5.11.22&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.28&lt;br /&gt;
|20180323&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: in MDegrain1-6/N allow Y8 input for out16 parameter&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.27&lt;br /&gt;
|20180318&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MDepan: use zerow parameter. The parameter had no effect probably since it had been introduced.&amp;lt;br&amp;gt;&lt;br /&gt;
MDepan: report MT mode for Avisynth+. MT_MULTI_INSTANCE, except for logfile writing output mode when it reports MT_SERIALIZED. (other filters already have proper registration, MDepan was missed)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.26&lt;br /&gt;
|20180314&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: MDegrain1-6 and N: new parameter bool &amp;quot;out16&amp;quot; = false. If set, 8 bit input results in native 16bit output (like lsb=true hack but this is native, faster).&amp;lt;br&amp;gt;&lt;br /&gt;
Faster: special 10 bit SAD functions instead of the generic 10-16bit one.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.25&lt;br /&gt;
|20180227&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: x64: not-cleared mmx state in MSuper assembly code would cause crash later, e.g. in x264 encoding, depending on following filters.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MSCDetection SC value parameter name to Ysc from Yth (must be an ancient typo), docs are OK, but the fix is mentioned in docs&amp;lt;br&amp;gt;&lt;br /&gt;
MSuper: import 8 bit sse2 interpolators from mvtools-vs. Extend them for 10-16bits (faster super clip). Some filters are still todo.&amp;lt;br&amp;gt;&lt;br /&gt;
MSuper: support 32bit float clips, which can be used later by MDegrains (but not for MAnalyse)&amp;lt;br&amp;gt;&lt;br /&gt;
MDegrains: allow degraining clip with different bit depth from vectors. Clip and Super must be the same bit depth&amp;lt;br&amp;gt;&lt;br /&gt;
MDegrains: consistently use limit and limitC, 255 do nothing, otherwise scale 0-254 value to the current bit-depth range&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: more correct internal rounding for 8 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: round for 16bits&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: 32bit float (but still use the original 11 bit window constants)&amp;lt;br&amp;gt;&lt;br /&gt;
Project: change from yasm to nasm.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.24&lt;br /&gt;
|20171205&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MFlowBlur: possible access violation crash when nPel&amp;gt;1&amp;lt;br&amp;gt;&lt;br /&gt;
New: MScaleVect parameter 'bits'. e.g. Analyze 8 bit clips, use their vectors for 16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Move project to VS2017&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.23&lt;br /&gt;
|20171012&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MScaleVect wrong rounding of scaled motion vectors with negative components. e.g. proper scaling (-1;-2) to (-2;-4) instead of (-1,-3)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.22&lt;br /&gt;
|20170830&lt;br /&gt;
|pinterf&lt;br /&gt;
|Misc: Stop using version suffix .22&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DCT 8x8@8bit] garbage on x64: internal assembly code did not save xmm6/xmm7&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DCT 8x8@8bit] safe multithreading for integer DCT (8x8 block size, 8 bit video): assembly had a single working buffer.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MDegrain] did not release input motion vector clips in destructor, possible hang at script closing. Bug since 2.7.1.22 (introducing MDegrain4/5)&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: fftw conversion constant of sqrt(2)/2 is more accurate (was:0.707), 16 bit formats may benefit (by feisty2)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: SSE4 assembly instructions in x64, broke on non-SSE4 processors&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.21.22&lt;br /&gt;
|20170629&lt;br /&gt;
|pinterf&lt;br /&gt;
|Mod: [MMask] Faster: request source frame only for kind=5.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.20.22&lt;br /&gt;
|2017.05.26&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: [MMask] greyscale input resulted in AV when filter exiting&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.19.22&lt;br /&gt;
|2017.05.25&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: [MMask] Support any planar input video formats e.g. greyscale, Planar RGB. Input clip can even be of different bit depth or format from vector's original format. For kind==5 where U and V is filled, the greyscale option is not allowed&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: [MMask] Faster: request source frame only for kind=5.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MxxxxFPS,MMask]: MakeVectorOcclusionMaskTime garbage in bottom blocks&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MMask] bottom padding garbage for padded frame dimension&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MMask] proper 10+ bits scene change values (for default: 1023, 4095, 16383, 65535. Was: 65535). Parameter is still in 8-bit range&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MRecalculate] prevent overflow during thSAD scaling in 16 bits or large block sizes (32, 48...)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DepanEstimate] Sometimes giving wrong motion instead of scene change detection. Bug only existed in previous pfmod builds.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MAnalyze] Possible overflow in MAnalyze 8 bit, block size 48x48 and above. Overflow-safe predictor recalc for big block sizes.&amp;lt;br&amp;gt;&lt;br /&gt;
New: [General] Add block size 12x3 for SAD, allow 6x24&amp;lt;br&amp;gt;&lt;br /&gt;
List of available block sizes&amp;lt;br&amp;gt;&lt;br /&gt;
- 64x64, 64x48, 64x32, 64x16&amp;lt;br&amp;gt;&lt;br /&gt;
- 48x64, 48x48, 48x24, 48x12&amp;lt;br&amp;gt;&lt;br /&gt;
- 32x64, 32x32, 32x24, 32x16, 32x8&amp;lt;br&amp;gt;&lt;br /&gt;
- 24x48, 24x24, 24x32, 24x12, 24x6&amp;lt;br&amp;gt;&lt;br /&gt;
- 16x64, 16x32, 16x16, 16x12, 16x8, 16x4, 16x2&amp;lt;br&amp;gt;&lt;br /&gt;
- 12x48, 12x24, 12x16, 12x12, 12x6, 12x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 8x32, 8x16, 8x8, 8x4, 8x2, 8x1&amp;lt;br&amp;gt;&lt;br /&gt;
- 6x24, 6x12, 6x6, 6x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 4x8, 4x4, 4x2&amp;lt;br&amp;gt;&lt;br /&gt;
- 3x6, 3x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 2x4, 2x2&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: [Internal] Reorganized 10-16 bit SAD simd intrinsics, faster 8-12% for BlkSize 12-32&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.18.22&lt;br /&gt;
|2017.05.12&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: 10-16 bit: DCT buffer possible overflow&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: DCT is fast again for non 8x8 blocksizes. Regression since 2.7.5.22.&amp;lt;br&amp;gt;&lt;br /&gt;
New: Chroma SAD is now always half of luma SAD, regardless of video format. Without this: YV24's luma:chroma SAD ratio is 4:8 instead of 4:2 (of YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
New: MAnalyze, MRecalculate new parameter: &amp;quot;scaleCSAD&amp;quot; integer, default 0.&amp;lt;br&amp;gt;&lt;br /&gt;
Fine tune chroma SAD weight relative to luma SAD.&amp;lt;br&amp;gt;&lt;br /&gt;
ScaleCSAD values for luma:chroma SAD ratio&amp;lt;br&amp;gt;&lt;br /&gt;
* -2: 4:0.5&amp;lt;br&amp;gt;&lt;br /&gt;
* -1: 4:1&amp;lt;br&amp;gt;&lt;br /&gt;
* 0: 4:2 (default, same as the native ratio for YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
* 1: 4:4&amp;lt;br&amp;gt;&lt;br /&gt;
* 2: 4:8&amp;lt;br&amp;gt;&lt;br /&gt;
New: Block sizes 64, 48, 24, 12, 6.&amp;lt;br&amp;gt;&lt;br /&gt;
MAnalyze/MRecalculate new block sizes (SATD support mod4 sizes)&amp;lt;br&amp;gt;&lt;br /&gt;
Note: some smaller block sizes can only be available in 4:4:4 formats, due to block size division (chroma subsampling)&amp;lt;br&amp;gt;&lt;br /&gt;
New: All block sizes are supported in MDegrain1-6, MDegrainN, and MScaleVect&amp;lt;br&amp;gt;&lt;br /&gt;
New: Changed to 2017 version of asm files for 8 bit SAD/SATD functions from x265 project. Added not implemented asm code for 12, 24, 48 sizes&amp;lt;br&amp;gt;&lt;br /&gt;
For some block sizes AVX2 and SSE4 is supported (AVX2 if reported under AviSynth+) e.g. BlkSize 32 is faster now.&amp;lt;br&amp;gt;&lt;br /&gt;
New: MMask SAD Mask to give identical weights for other-than-YV12 formats, e.g. for YV24&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.17.22&lt;br /&gt;
|2017.04.26&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: Regression in 2.7.16.22: MDegrain right pixel artifacts on non-modulo 16 widths&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MMask, mode SADMask output is normalized further by video subsampling (YV16/YV24 has larger SAD value due to bigger chroma part that classic YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.16.22&lt;br /&gt;
|2017.04.23&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MMask 10-16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MRecalculate 14-16 bits passed nSCD1=999999 internally which caused overflow (scene change problems later)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix is done by clamping SCD1 to 8*8*(255-0) (maximum value of sum of SADs on a 8x8 block)&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MDegrainX 8 bits: internal 16 bit buffer to 8 bits: SSE2&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MFlow access violation in internal mv resizer when resizing factor was big (MCaWarpSharp3 4x supersampling case) (bug possibly introduced in upstream 2.5.11.22)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.15.22&lt;br /&gt;
|2017.03.16&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: 16 bit SAD for non-AVX code path&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MDegrain1-6: add error on lsb_flag=true for non-8 bit sources&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.14.22&lt;br /&gt;
|2017.02.06&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MAnalyze divide=2 showed &amp;quot;vector clip is too small&amp;quot; (inherited from 2.6.0.5, sanity check was done but length was not filled for divideextra data)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MFlow access violation in internal mv resizer when resizing factor was big (MCaWarpSharp3 4x supersampling case) (bug possibly introduced in upstream 2.5.11.22)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.13.22&lt;br /&gt;
|2017.02.01&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MDegrain1-6,N 10-16 bit thSCD scaling&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MVShow: tolerance scaling for 10-16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.12.22&lt;br /&gt;
|2017.01.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: Faster SATD (dct=5..10) 8 bit: updated x264 function selectors, SSE2/4/AVX/AVX2; +10% speed for a whole typical MDegrain3 process on i7-3770&amp;lt;br&amp;gt;&lt;br /&gt;
New: Much Faster SATD (dct=5..10) 10-16 bit: SSE2/SSE4 instead of C +50% speed for a whole typical MDegrain3 process (which is approx half speed of 8 bit)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.11.22&lt;br /&gt;
|2017.01.16&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: MDegrain6&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: MDegrain1-6 SSE4 for 10-16 bit (was: C. 3-5% gain, wasn't bottleneck)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.10.22&lt;br /&gt;
|2016.12.28&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: for YV12 the debug info text chroma part was positioned at wrong place&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.9.22&lt;br /&gt;
|2016.12.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|Apply 2.5.11.9-svp analysis speedup, mainly when chroma is involved&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.8.22&lt;br /&gt;
|2016.12.18&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: YUY2 input access violation (regression after 2.7.0.22d) - Fixed also in Depan.dll&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MDegrain: free up YUY2 planes only if not planar input (bug inherited from 2.5.11.22 MDegrain3) resulting in freeze at script exit&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.7.22&lt;br /&gt;
|2016.12.14&lt;br /&gt;
|pinterf&lt;br /&gt;
|Optimizing 8 bits&amp;lt;br&amp;gt;&lt;br /&gt;
speed: change some 8 bit SAD functions for the better&amp;lt;br&amp;gt;&lt;br /&gt;
speed: separating bottleneck 8 bit/16 bit code paths in order not to use slower int64 calculations for 8 bit, where there are no integer overflow problems&amp;lt;br&amp;gt;&lt;br /&gt;
speed: more __forceinlines for helping the compiler&amp;lt;br&amp;gt;&lt;br /&gt;
info:  general speed gain of 5-15% compared to 2.7.6.22, much reduced speed gap compared to the &amp;quot;classic&amp;quot; YV12 8 bit mvtools2 versions&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.6.22&lt;br /&gt;
|2016.12.04&lt;br /&gt;
|pinterf&lt;br /&gt;
|fix: sumLumaChange underflow (used for dct=2,6,9) (regression during 16 bit support)&amp;lt;br&amp;gt;&lt;br /&gt;
fix: MeanLumaChange scale for 10-16 bits (used for dct=2,6,9)&amp;lt;br&amp;gt;&lt;br /&gt;
fix: Mask fix: 8 bit mask resizer bug in SIMD intrinsics (regression on inline asm -&amp;gt; SIMD transition)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: dctmode=1,2: pixel distance was not corrected for 16 bit pixel sizes&amp;lt;br&amp;gt;&lt;br /&gt;
speed: Let's help VS2015 with some __forceinline directives to recognize the truth.&amp;lt;br&amp;gt;&lt;br /&gt;
speed: Misc optimizations throughout the code (bit shifts instead of div or mul)&amp;lt;br&amp;gt;&lt;br /&gt;
speed: FFTW DCT: C code replaced with SIMD SSE2/SSE4 (FloatToBytes, BytesToFloat)&amp;lt;br&amp;gt;&lt;br /&gt;
speed: 16 bit SAD: a few optimizations in SSE2, AVX-coded SSE2 and AVX2 codepath&amp;lt;br&amp;gt;&lt;br /&gt;
VS2015 compiler: /MT -&amp;gt; /MD (from static to dynamic dlls - now it reallys need VS2015 redistributables)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.5.22&lt;br /&gt;
|2016.11.19&lt;br /&gt;
|pinterf&lt;br /&gt;
|Milestone release:&lt;br /&gt;
General support of 10-16 bit formats with Avisynth Plus (r2294 or newer recommended) with new MDegrain4 and MDegrain5 filters.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix for MSCDetection: scene change filler pixel default value was always 0 (2.7.1.22 regression)&amp;lt;br&amp;gt;&lt;br /&gt;
MCompensate: possible bugfix bottom padding UV&amp;lt;br&amp;gt;&lt;br /&gt;
Fix SAD for 10-16 bit depths for horizontal block sizes &amp;gt;= 16&amp;lt;br&amp;gt;&lt;br /&gt;
Fix nSCD2 (Scene change threshold block count %) (2.7.1.22 regression)&amp;lt;br&amp;gt;&lt;br /&gt;
MBlockFPS: overlap fixes (right columns and bottom lines)&amp;lt;br&amp;gt;&lt;br /&gt;
MBlockFPS: overlap fix: missing copy buffer to output&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.1.22&lt;br /&gt;
|2016.10.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|YV16 and YV24 avaliable&amp;lt;br&amp;gt;&lt;br /&gt;
dct modes &amp;gt;= 5 now use SATD again (so far it was in dead code, contrary to 2.5.13.1 remarks)&amp;lt;br&amp;gt;&lt;br /&gt;
New: MDegrain4, MDegrain5&amp;lt;br&amp;gt;&lt;br /&gt;
Experimental native 10-16 bit support (MSuper, MAnalyze, MDegrain1-5, MDegrainN) including 16 bit SATD (slow C) and SSE2 optimized regular SAD for 8+ (for 10+ bits you need at least Avisynth+ r2290)&amp;lt;br&amp;gt; &lt;br /&gt;
Inline assembly rewritten to intrinsics -&amp;gt; 64 bit build is possible in VS2015 (External assembly untouched)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.0.22&lt;br /&gt;
|2016.04.29&lt;br /&gt;
|pinterf&lt;br /&gt;
|Integrate Fizick's upstream changes of 2.5.11.22&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.0.1&lt;br /&gt;
|2016.03.31&lt;br /&gt;
|pinterf&lt;br /&gt;
|MVTools-pfmod&amp;lt;br&amp;gt;&lt;br /&gt;
2.6.0.5 x64 capable version ported under AviSynth 2.6 API&amp;lt;br&amp;gt;&lt;br /&gt;
Fixed access violation in MDepan&amp;lt;br&amp;gt;&lt;br /&gt;
Fixed access violation in x64 asm code&amp;lt;br&amp;gt;&lt;br /&gt;
Built with Visual Studio 2015 Community Edition, v140_xp toolset&amp;lt;br&amp;gt;&lt;br /&gt;
Compiler: Intel C++ 16 (because of inline 64 bit asm code)&amp;lt;br&amp;gt;&lt;br /&gt;
See [https://forum.doom9.org/showthread.php?t=173356 discussion] and [https://github.com/pinterf/mvtools/tree/mvtools-pfmod GitHub page] for more information.&amp;lt;br/&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.5&lt;br /&gt;
|2012.07.17&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MCompensate, MDegrainN: fixed a bug causing occasionally horizontal magenta stripes in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.4&lt;br /&gt;
|2012.06.14&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MCompensate: fixed artifacts related to overlap with tr &amp;gt; 3 in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.3&lt;br /&gt;
|2012.05.13&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MDegrainN: fixed artifacts related to overlap with tr &amp;gt; 3 in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.2&lt;br /&gt;
|2012.05.01&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MAnalyse: fixed a threading issue when using FFTW.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.1&lt;br /&gt;
|2012.03.12&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MAnalyse: fixed potential crash in multithreading mode.&amp;lt;br/&amp;gt;&lt;br /&gt;
MDegrainN: fixed systematic crash in multithreading mode.&amp;lt;br/&amp;gt;&lt;br /&gt;
All MDegrain functions: fixed potential crash when thSAD is set to 0.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.0&lt;br /&gt;
|2012.03.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MDegrainN: internally uses MDegrain1/2/3 when tr ≤ 3, for optimal speed.&amp;lt;br/&amp;gt;&lt;br /&gt;
MCompensate: added multi-compensation mode for easy use with temporal filters.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse, MSuper, MCompensate, MDegrainN: added multithreading (but partially, not for all code paths) using AVSTP.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: fixed a corruption of the global motion vector.&amp;lt;br/&amp;gt;&lt;br /&gt;
Improved page setting for this documentation.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.2&lt;br /&gt;
|2012.01.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed MScaleVect with multi-vector clips.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.1&lt;br /&gt;
|2011.12.13&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed crashes in the MDegrain functions when using both planar=true and lsb=true.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.0&lt;br /&gt;
|2011.11.28&lt;br /&gt;
|Firesledge and Vit&lt;br /&gt;
|Added MStoreVect, MRestoreVect and MScaleVect from the Vit's [https://forum.doom9.org/showthread.php?t=84770&amp;amp;page=76#post1538821 MVExtras plugin].&lt;br /&gt;
|-&lt;br /&gt;
|2.5.13.1&lt;br /&gt;
|2011.11.09&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MAnalyse, MRecalculate: added an SATD approximation for blksize &amp;gt; 16 and dct ≥ 5. Previously, the SATD calculation was silently bypassed and always returned a null SAD value.&amp;lt;br/&amp;gt;&lt;br /&gt;
Functions now check that the pel setting is the same in the superclip and the motion vectors, instead of crashing if not.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.13.0 beta&lt;br /&gt;
|2011.09.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MRecalculate: Can now process multi-vector clips.&amp;lt;br/&amp;gt;&lt;br /&gt;
All functions: Added the -Vit-'s fix that could improve the multithreading stability.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.12.1 beta&lt;br /&gt;
|2011.09.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MAnalyse: Fixed the ghosting bug introduced in the previous version.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.12.0 beta&lt;br /&gt;
|2011.09.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MDegrainN added.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: Added the &amp;quot;multi&amp;quot; mode for MDegrainN.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: Documented the negative delta values and fixed some functions accordingly.&amp;lt;br/&amp;gt;&lt;br /&gt;
MFlowInter: Fixed the YUY2 planar mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.11.2 beta mod16b&lt;br /&gt;
|2011.05.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed a regression in MDegrain1/2/3, related to the mod16 versions. thSADC is now taken into account correctly (instead of using thSAD).&lt;br /&gt;
|-&lt;br /&gt;
|2.5.11.2 beta mod16a&lt;br /&gt;
|2011.04.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Merged 2.5.11.2 and 2.5.11 mod16a versions.&lt;br /&gt;
|}&lt;br /&gt;
[http://www.avisynth.nl/users/fizick/mvtools/mvtools2.html#revisions Changelog up to v2.5.11.22]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Archived Downloads ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;; width=&amp;quot;500px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!!width=&amp;quot;100px&amp;quot;| Version&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Download&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Mirror&lt;br /&gt;
|-&lt;br /&gt;
!v2.6.0.5 (x64)&lt;br /&gt;
|[http://www.dropbox.com/s/swk97z4q834vugk/mvtools_2.6.0.5_x64.zip?dl=1 mvtools_2.6.0.5_x64.zip]&lt;br /&gt;
|[https://web.archive.org/web/20200608154645if_/https://files.videohelp.com/u/223002/mvtools_2.6.0.5_x64.zip mvtools_2.6.0.5_x64.zip]&lt;br /&gt;
|-&lt;br /&gt;
!v2.6.0.5&lt;br /&gt;
|[http://ldesoras.free.fr/src/avs/mvtools-2.6.0.5.zip mvtools-2.6.0.5.zip]&lt;br /&gt;
|[https://web.archive.org/web/20160604063048if_/http://ldesoras.free.fr/src/avs/mvtools-2.6.0.5.zip mvtools-2.6.0.5.zip]&lt;br /&gt;
|-&lt;br /&gt;
!v2.5.11.22&lt;br /&gt;
|[http://www.avisynth.nl/users/fizick/mvtools/mvtools-v2.5.11.22.zip mvtools-v2.5.11.22.zip]&lt;br /&gt;
|[https://web.archive.org/web/20170716135124if_/http://www.avisynth.nl/users/fizick/mvtools/mvtools-v2.5.11.22.zip mvtools-v2.5.11.22.zip]&lt;br /&gt;
|}&lt;br /&gt;
* Note: MVTools v2.6.0.5 (x64) was compiled with Intel Parallel Studio XE 2015 Composer Edition for C++.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==External Links ==&lt;br /&gt;
*[https://forum.doom9.org/showthread.php?t=84770 Doom9 Forum] - MVTools discussion.&lt;br /&gt;
*[http://www.nmm-hd.org/newbbs/viewtopic.php?f=7&amp;amp;t=1918 NMM-HD Forum] - MVTools documentation in Chinese.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-07-06T03:18:45Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: I keep forgetting to click the preview button&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r29&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases/ fmtconv-r29.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV, YCoCg, YDzDx and ICtCp in 4:4:4, 4:2:2, 4:2:0 and 4:1:1 chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focussed primarily on quality and exactness rather than execution speed. This does not mean it is slow or unoptimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
See [https://htmlpreview.github.io/?https://github.com/EleonoreMizo/fmtconv/blob/master/doc/fmtconv.html doc/fmtconv.html on github] for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|c|clip}}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|(undefined)}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip}}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|(undefined)}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|(undefined)}}&lt;br /&gt;
::{{Par2|matd|bool|(undefined)}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip}}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip}}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|0}}&lt;br /&gt;
::{{Par2|sy|arrayf|0}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|0}}&lt;br /&gt;
::{{Par2|sh|arrayf|0}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|0}}&lt;br /&gt;
::{{Par2|scaleh|float|0}}&lt;br /&gt;
::{{Par2|scalev|float|0}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|impulse|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|impulseh|arrayf|impulse}}&lt;br /&gt;
::{{Par2|impulsev|arrayf|impulse}}&lt;br /&gt;
:::Offers the possibility to create your own kernel (useful for convolutions). Add your coefficents in the array. The number of coefficients must be odd. The curve is linearly interpolated between the provided points. You can oversample the impulse by setting kovrspl to a value &amp;gt; 1. To activate the custom kernel, set kernel=&amp;quot;impulse&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|taps|arrayi|4}}&lt;br /&gt;
::{{Par2|tapsh|arrayi|taps}}&lt;br /&gt;
::{{Par2|tapsv|arrayi|taps}}&lt;br /&gt;
:::Some kernels have a variable number of sample points, given by this parameter. Actually this counts half the number of lobes (or equivalent); in case of downscaling, the actual number of sample points may be greater than the specified value. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a2|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a3|arrayf|(undefined)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1h|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2h|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3h|arrayf|a3}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1v|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2v|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3v|arrayf|a3}}&lt;br /&gt;
:::Specific parameters, depending on the selected kernel.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kovrspl|int|1}}&lt;br /&gt;
:::Specifies here how many times the kernel is oversampled when you provide a custom impluse response. ≥ 1.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fh|arrayf|1}}&lt;br /&gt;
::{{Par2|fv|arrayf|1}}&lt;br /&gt;
:::Horizontal and vertical frequency factors, also known as inverse kernel support. They are multipliers on the theoretical kernel cutoff frequency in both directions. Values below 1.0 spatially expand the kernel and blur the picture. Values over 1.0 shrink the kernel and let higher frequencies pass. The result will look sharper but more aliased. The multiplicator is applied after the kernel scaling in case of downsizing. Negative values force the processing, even if the horizontal size doesn’t change. The filter will use the absolute parameter value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cnorm|bool|true}}&lt;br /&gt;
:::If set to true, the impulse sum is normalised to 1 for each pixel. This is the normal behaviour when resizing, to make sure the energy is constant for all pixels. If you use the resizer as a convolution engine, it is advised to disable the normalisation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|total|arrayf|0}}&lt;br /&gt;
::{{Par2|totalh|arrayf|total}}&lt;br /&gt;
::{{Par2|totalv|arrayf|total}}&lt;br /&gt;
:::When cnorm is activated, these parameters specify the normalisation value for the corresponding kernel. 0 means that the normalisation value is the sum of the coefficients. The Masktools’mt_convolution function has a single parameter for this use: total = totalh × totalv. Because the convolution is computed with floating point data, there is no saturation of intermediate results, therefore the balance between totalh and totalv is not important, only their product will be taken into account. Note that because kernels are single-dimention, the “parent” total parameter here is the sum of the coefficients for each direction, not the product of totalh and totalv.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invks|arrayb|false}}&lt;br /&gt;
::{{Par2|invksh|arrayb|invks}}&lt;br /&gt;
::{{Par2|invksv|arrayb|invks}}&lt;br /&gt;
:::Set these parameter to True to activate the kernel inversion mode for the specified direction (use invks for both). Inverting the kernel allows to “undo” a previous upsizing by compensating the loss in high frequencies, giving a sharper and more accurate output than classic kernels, closer to the original. This is particularly useful for clips upscaled with a bilinear kernel. All the kernel-related parameters specify the kernel to undo. The target resolution must be as close as possible to the initial resolution. The kernel inversion is mainly intended to downsize an upscaled picture. Using it for upsizing will not restore details but will give a sligthly sharper look, at the cost of a bit of aliasing and ringing. This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invkstaps|arrayi|4}}&lt;br /&gt;
::{{Par2|invkstapsh|arrayi|invkstaps}}&lt;br /&gt;
::{{Par2|invkstapsv|arrayi|invkstaps}}&lt;br /&gt;
:::In kernel inversion mode (invks=True), this parameter sets the number of taps for the inverted kernel. Use it as a tradeof between softness and ringing. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::Can only change the bitdepth and the data type (integer or float). Only 16-bit integer (xxxP16) and 32-bit float data types are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from BuildPixelType or the pixel_type parameter from BlankClip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|css|string|(undefined)}}&lt;br /&gt;
:::Destination chroma subsampling, for YUV (and YCoCg) colorspaces. Supersedes the chroma subsampling from csp. You can also specify the subsampling with the predefined values or with a two-digit string. The first digit for the horizontal subsampling, and the second for the vertical subsampling. Only power-of-2 numbers are allowed. For example &amp;quot;41&amp;quot; is equivalent to 4:1:1 and &amp;quot;22&amp;quot; to 4:2:0.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::The predefined values are:&lt;br /&gt;
:::*&amp;quot;444&amp;quot; or &amp;quot;4:4:4&amp;quot;	4:4:4, no chroma subsampling.&lt;br /&gt;
:::*&amp;quot;422&amp;quot; or &amp;quot;4:2:2&amp;quot;	4:2:2, horizontal 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;420&amp;quot; or &amp;quot;4:2:0&amp;quot;	4:2:0, horizontal and vertical 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;411&amp;quot; or &amp;quot;4:1:1&amp;quot;	4:1:1, horizontal 4x chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|arrayf|all}}&lt;br /&gt;
:::This array decribes how each plane should be processed. It’s similar to the y, u and v parameters in Masktools 2.&lt;br /&gt;
:::*−65535 to +0.5	: All the pixels of the plane will be set to −x (the opposite of the specified value). The range depends on the output data type. Remember, in floating-point YUV, the chroma planes range from −0.5 to +0.5.&lt;br /&gt;
:::*1	: The plane will not be processed. This means that the content of the output plane is pure garbage.&lt;br /&gt;
:::*2	: The plane of the input clip will be copied and possibly cropped. Areas out of the input picture are left unprocessed (garbage). Range (full or TV) conversions are ignored.&lt;br /&gt;
:::*3	: The plane will be processed (default).&lt;br /&gt;
:::The parameter can also be specified as a string. See the planes parameter from the fmtc_bitdepth function for more details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|int|(depends)}}&lt;br /&gt;
::{{Par2|fulld|int|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the Y’Cb’Cr’ chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|center|arrayb|true}}&lt;br /&gt;
:::Like the Avisynth standard resizers, this resizer preserves the position of the picture center. Disable this parameter if you may want to resize by preserving the top-left corner position. Similarly, if you are convolving without resizing, setting it to false ensures you that the same kernel will be applied to all pixels.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cplace|arrayb|&amp;quot;mpeg2&amp;quot;}}&lt;br /&gt;
::{{Par2|cplaces|arrayb|cplace}}&lt;br /&gt;
::{{Par2|cplaced|arrayb|cplace}}&lt;br /&gt;
:::Placement of the chroma samples. cplaces specifies the source clip only, cplaced the destination clip. Can be one of these strings:&lt;br /&gt;
:::*&amp;quot;MPEG1&amp;quot;, &amp;quot;JPEG&amp;quot; &amp;quot;center&amp;quot;	: 4:2:0 subsampling used in MPEG-1 and JPEG. Chroma samples are located on the center of each group of 4 pixels.&lt;br /&gt;
:::*&amp;quot;MPEG2&amp;quot;, &amp;quot;left&amp;quot;		: Subsampling used in MPEG-2 4:2:x and most other formats. Chroma samples are located on the left pixel column of the group.&lt;br /&gt;
:::*&amp;quot;DV&amp;quot;			: For 4:2:0 modes, it’s like MPEG-2 but U and V channels are “co-sited” vertically: V on the top row, and U on the bottom row. For 4:1:1, chroma is located on the leftmost column.&lt;br /&gt;
:::*&amp;quot;top_left&amp;quot;, &amp;quot;tl&amp;quot;		: Chroma samples are located on the top-left luma sample of each pixel group.&lt;br /&gt;
:::The chroma placement is ignored when center is set to False or kernel to &amp;quot;point&amp;quot;. You’ll find below an overview of common chroma placement and subsampling combinations.&lt;br /&gt;
:::Graphical examples of chroma placements can be found [https://raw.githubusercontent.com/EleonoreMizo/fmtconv/master/doc/colorspace-subsampling.png in the github].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|interlaced|int|2}}&lt;br /&gt;
::{{Par2|interlacedd|int|(interlaced)}}&lt;br /&gt;
:::Specifies if the clip is made of frames or fields. interlacedd overrides interlaced for output.&lt;br /&gt;
:::*0	: Frames are progressive content.&lt;br /&gt;
:::*1	: Frames are actually the separated fields of an interlaced stream. Specify tff or provide the [[Internal_functions#Field|_Field]] property in all the frames.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#FieldBased|_FieldBased]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tff|int|2}}&lt;br /&gt;
::{{Par2|tffd|int|tff}}&lt;br /&gt;
:::When processing interlaced content, specifies the field parity. tffd overrides tff for output.&lt;br /&gt;
:::*0	: Bottom field first (BFF). This means all even fields are top, and all odd fields are bottom.&lt;br /&gt;
:::*1	: Top field first (TFF). This means all even fields are bottom, and all odd fields are top.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#Field|_Field]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|false}}&lt;br /&gt;
:::Flag to force floating point operations. When set to False, integer operations are used, but only if both input and output formats are integer. If it’s not the case, floating point operations are silently used as fallback.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set. −1: automatic (no limitation), 0: , 1: , .&lt;br /&gt;
:::*-1	: automatic (no limitation).&lt;br /&gt;
:::*0	: default instruction set only (depends on the compilation settings).&lt;br /&gt;
:::*1	: limit to SSE2.&lt;br /&gt;
:::*10	: limit to AVX2.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-07-06T03:14:19Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: Small update to the description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r29&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases/ fmtconv-r29.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
Fmtconv is a format-conversion plug-in for the Vapoursynth and Avisynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV, YCoCg, YDzDx and ICtCp in 4:4:4, 4:2:2, 4:2:0 and 4:1:1 chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focussed primarily on quality and exactness rather than execution speed. This does not mean it is slow or unoptimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
See [https://htmlpreview.github.io/?https://github.com/EleonoreMizo/fmtconv/blob/master/doc/fmtconv.html doc/fmtconv.html on github] for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|(undefined)}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|(undefined)}}&lt;br /&gt;
::{{Par2|matd|bool|(undefined)}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|0}}&lt;br /&gt;
::{{Par2|sy|arrayf|0}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|0}}&lt;br /&gt;
::{{Par2|sh|arrayf|0}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|0}}&lt;br /&gt;
::{{Par2|scaleh|float|0}}&lt;br /&gt;
::{{Par2|scalev|float|0}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|impulse|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|impulseh|arrayf|impulse}}&lt;br /&gt;
::{{Par2|impulsev|arrayf|impulse}}&lt;br /&gt;
:::Offers the possibility to create your own kernel (useful for convolutions). Add your coefficents in the array. The number of coefficients must be odd. The curve is linearly interpolated between the provided points. You can oversample the impulse by setting kovrspl to a value &amp;gt; 1. To activate the custom kernel, set kernel=&amp;quot;impulse&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|taps|arrayi|4}}&lt;br /&gt;
::{{Par2|tapsh|arrayi|taps}}&lt;br /&gt;
::{{Par2|tapsv|arrayi|taps}}&lt;br /&gt;
:::Some kernels have a variable number of sample points, given by this parameter. Actually this counts half the number of lobes (or equivalent); in case of downscaling, the actual number of sample points may be greater than the specified value. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a2|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a3|arrayf|(undefined)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1h|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2h|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3h|arrayf|a3}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1v|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2v|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3v|arrayf|a3}}&lt;br /&gt;
:::Specific parameters, depending on the selected kernel.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kovrspl|int|1}}&lt;br /&gt;
:::Specifies here how many times the kernel is oversampled when you provide a custom impluse response. ≥ 1.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fh|arrayf|1}}&lt;br /&gt;
::{{Par2|fv|arrayf|1}}&lt;br /&gt;
:::Horizontal and vertical frequency factors, also known as inverse kernel support. They are multipliers on the theoretical kernel cutoff frequency in both directions. Values below 1.0 spatially expand the kernel and blur the picture. Values over 1.0 shrink the kernel and let higher frequencies pass. The result will look sharper but more aliased. The multiplicator is applied after the kernel scaling in case of downsizing. Negative values force the processing, even if the horizontal size doesn’t change. The filter will use the absolute parameter value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cnorm|bool|true}}&lt;br /&gt;
:::If set to true, the impulse sum is normalised to 1 for each pixel. This is the normal behaviour when resizing, to make sure the energy is constant for all pixels. If you use the resizer as a convolution engine, it is advised to disable the normalisation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|total|arrayf|0}}&lt;br /&gt;
::{{Par2|totalh|arrayf|total}}&lt;br /&gt;
::{{Par2|totalv|arrayf|total}}&lt;br /&gt;
:::When cnorm is activated, these parameters specify the normalisation value for the corresponding kernel. 0 means that the normalisation value is the sum of the coefficients. The Masktools’mt_convolution function has a single parameter for this use: total = totalh × totalv. Because the convolution is computed with floating point data, there is no saturation of intermediate results, therefore the balance between totalh and totalv is not important, only their product will be taken into account. Note that because kernels are single-dimention, the “parent” total parameter here is the sum of the coefficients for each direction, not the product of totalh and totalv.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invks|arrayb|false}}&lt;br /&gt;
::{{Par2|invksh|arrayb|invks}}&lt;br /&gt;
::{{Par2|invksv|arrayb|invks}}&lt;br /&gt;
:::Set these parameter to True to activate the kernel inversion mode for the specified direction (use invks for both). Inverting the kernel allows to “undo” a previous upsizing by compensating the loss in high frequencies, giving a sharper and more accurate output than classic kernels, closer to the original. This is particularly useful for clips upscaled with a bilinear kernel. All the kernel-related parameters specify the kernel to undo. The target resolution must be as close as possible to the initial resolution. The kernel inversion is mainly intended to downsize an upscaled picture. Using it for upsizing will not restore details but will give a sligthly sharper look, at the cost of a bit of aliasing and ringing. This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invkstaps|arrayi|4}}&lt;br /&gt;
::{{Par2|invkstapsh|arrayi|invkstaps}}&lt;br /&gt;
::{{Par2|invkstapsv|arrayi|invkstaps}}&lt;br /&gt;
:::In kernel inversion mode (invks=True), this parameter sets the number of taps for the inverted kernel. Use it as a tradeof between softness and ringing. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::Can only change the bitdepth and the data type (integer or float). Only 16-bit integer (xxxP16) and 32-bit float data types are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from BuildPixelType or the pixel_type parameter from BlankClip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|css|string|(undefined)}}&lt;br /&gt;
:::Destination chroma subsampling, for YUV (and YCoCg) colorspaces. Supersedes the chroma subsampling from csp. You can also specify the subsampling with the predefined values or with a two-digit string. The first digit for the horizontal subsampling, and the second for the vertical subsampling. Only power-of-2 numbers are allowed. For example &amp;quot;41&amp;quot; is equivalent to 4:1:1 and &amp;quot;22&amp;quot; to 4:2:0.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::The predefined values are:&lt;br /&gt;
:::*&amp;quot;444&amp;quot; or &amp;quot;4:4:4&amp;quot;	4:4:4, no chroma subsampling.&lt;br /&gt;
:::*&amp;quot;422&amp;quot; or &amp;quot;4:2:2&amp;quot;	4:2:2, horizontal 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;420&amp;quot; or &amp;quot;4:2:0&amp;quot;	4:2:0, horizontal and vertical 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;411&amp;quot; or &amp;quot;4:1:1&amp;quot;	4:1:1, horizontal 4x chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|arrayf|all}}&lt;br /&gt;
:::This array decribes how each plane should be processed. It’s similar to the y, u and v parameters in Masktools 2.&lt;br /&gt;
:::*−65535 to +0.5	: All the pixels of the plane will be set to −x (the opposite of the specified value). The range depends on the output data type. Remember, in floating-point YUV, the chroma planes range from −0.5 to +0.5.&lt;br /&gt;
:::*1	: The plane will not be processed. This means that the content of the output plane is pure garbage.&lt;br /&gt;
:::*2	: The plane of the input clip will be copied and possibly cropped. Areas out of the input picture are left unprocessed (garbage). Range (full or TV) conversions are ignored.&lt;br /&gt;
:::*3	: The plane will be processed (default).&lt;br /&gt;
:::The parameter can also be specified as a string. See the planes parameter from the fmtc_bitdepth function for more details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|int|(depends)}}&lt;br /&gt;
::{{Par2|fulld|int|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the Y’Cb’Cr’ chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|center|arrayb|true}}&lt;br /&gt;
:::Like the Avisynth standard resizers, this resizer preserves the position of the picture center. Disable this parameter if you may want to resize by preserving the top-left corner position. Similarly, if you are convolving without resizing, setting it to false ensures you that the same kernel will be applied to all pixels.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cplace|arrayb|&amp;quot;mpeg2&amp;quot;}}&lt;br /&gt;
::{{Par2|cplaces|arrayb|cplace}}&lt;br /&gt;
::{{Par2|cplaced|arrayb|cplace}}&lt;br /&gt;
:::Placement of the chroma samples. cplaces specifies the source clip only, cplaced the destination clip. Can be one of these strings:&lt;br /&gt;
:::*&amp;quot;MPEG1&amp;quot;, &amp;quot;JPEG&amp;quot; &amp;quot;center&amp;quot;	: 4:2:0 subsampling used in MPEG-1 and JPEG. Chroma samples are located on the center of each group of 4 pixels.&lt;br /&gt;
:::*&amp;quot;MPEG2&amp;quot;, &amp;quot;left&amp;quot;		: Subsampling used in MPEG-2 4:2:x and most other formats. Chroma samples are located on the left pixel column of the group.&lt;br /&gt;
:::*&amp;quot;DV&amp;quot;			: For 4:2:0 modes, it’s like MPEG-2 but U and V channels are “co-sited” vertically: V on the top row, and U on the bottom row. For 4:1:1, chroma is located on the leftmost column.&lt;br /&gt;
:::*&amp;quot;top_left&amp;quot;, &amp;quot;tl&amp;quot;		: Chroma samples are located on the top-left luma sample of each pixel group.&lt;br /&gt;
:::The chroma placement is ignored when center is set to False or kernel to &amp;quot;point&amp;quot;. You’ll find below an overview of common chroma placement and subsampling combinations.&lt;br /&gt;
:::Graphical examples of chroma placements can be found [https://raw.githubusercontent.com/EleonoreMizo/fmtconv/master/doc/colorspace-subsampling.png in the github].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|interlaced|int|2}}&lt;br /&gt;
::{{Par2|interlacedd|int|(interlaced)}}&lt;br /&gt;
:::Specifies if the clip is made of frames or fields. interlacedd overrides interlaced for output.&lt;br /&gt;
:::*0	: Frames are progressive content.&lt;br /&gt;
:::*1	: Frames are actually the separated fields of an interlaced stream. Specify tff or provide the [[Internal_functions#Field|_Field]] property in all the frames.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#FieldBased|_FieldBased]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tff|int|2}}&lt;br /&gt;
::{{Par2|tffd|int|tff}}&lt;br /&gt;
:::When processing interlaced content, specifies the field parity. tffd overrides tff for output.&lt;br /&gt;
:::*0	: Bottom field first (BFF). This means all even fields are top, and all odd fields are bottom.&lt;br /&gt;
:::*1	: Top field first (TFF). This means all even fields are bottom, and all odd fields are top.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#Field|_Field]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|false}}&lt;br /&gt;
:::Flag to force floating point operations. When set to False, integer operations are used, but only if both input and output formats are integer. If it’s not the case, floating point operations are silently used as fallback.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set. −1: automatic (no limitation), 0: , 1: , .&lt;br /&gt;
:::*-1	: automatic (no limitation).&lt;br /&gt;
:::*0	: default instruction set only (depends on the compilation settings).&lt;br /&gt;
:::*1	: limit to SSE2.&lt;br /&gt;
:::*10	: limit to AVX2.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-07-06T01:45:33Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: fixing the book's link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r29&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases/ fmtconv-r29.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|(undefined)}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|(undefined)}}&lt;br /&gt;
::{{Par2|matd|bool|(undefined)}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|0}}&lt;br /&gt;
::{{Par2|sy|arrayf|0}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|0}}&lt;br /&gt;
::{{Par2|sh|arrayf|0}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|0}}&lt;br /&gt;
::{{Par2|scaleh|float|0}}&lt;br /&gt;
::{{Par2|scalev|float|0}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|impulse|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|impulseh|arrayf|impulse}}&lt;br /&gt;
::{{Par2|impulsev|arrayf|impulse}}&lt;br /&gt;
:::Offers the possibility to create your own kernel (useful for convolutions). Add your coefficents in the array. The number of coefficients must be odd. The curve is linearly interpolated between the provided points. You can oversample the impulse by setting kovrspl to a value &amp;gt; 1. To activate the custom kernel, set kernel=&amp;quot;impulse&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|taps|arrayi|4}}&lt;br /&gt;
::{{Par2|tapsh|arrayi|taps}}&lt;br /&gt;
::{{Par2|tapsv|arrayi|taps}}&lt;br /&gt;
:::Some kernels have a variable number of sample points, given by this parameter. Actually this counts half the number of lobes (or equivalent); in case of downscaling, the actual number of sample points may be greater than the specified value. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a2|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a3|arrayf|(undefined)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1h|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2h|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3h|arrayf|a3}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1v|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2v|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3v|arrayf|a3}}&lt;br /&gt;
:::Specific parameters, depending on the selected kernel.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kovrspl|int|1}}&lt;br /&gt;
:::Specifies here how many times the kernel is oversampled when you provide a custom impluse response. ≥ 1.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fh|arrayf|1}}&lt;br /&gt;
::{{Par2|fv|arrayf|1}}&lt;br /&gt;
:::Horizontal and vertical frequency factors, also known as inverse kernel support. They are multipliers on the theoretical kernel cutoff frequency in both directions. Values below 1.0 spatially expand the kernel and blur the picture. Values over 1.0 shrink the kernel and let higher frequencies pass. The result will look sharper but more aliased. The multiplicator is applied after the kernel scaling in case of downsizing. Negative values force the processing, even if the horizontal size doesn’t change. The filter will use the absolute parameter value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cnorm|bool|true}}&lt;br /&gt;
:::If set to true, the impulse sum is normalised to 1 for each pixel. This is the normal behaviour when resizing, to make sure the energy is constant for all pixels. If you use the resizer as a convolution engine, it is advised to disable the normalisation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|total|arrayf|0}}&lt;br /&gt;
::{{Par2|totalh|arrayf|total}}&lt;br /&gt;
::{{Par2|totalv|arrayf|total}}&lt;br /&gt;
:::When cnorm is activated, these parameters specify the normalisation value for the corresponding kernel. 0 means that the normalisation value is the sum of the coefficients. The Masktools’mt_convolution function has a single parameter for this use: total = totalh × totalv. Because the convolution is computed with floating point data, there is no saturation of intermediate results, therefore the balance between totalh and totalv is not important, only their product will be taken into account. Note that because kernels are single-dimention, the “parent” total parameter here is the sum of the coefficients for each direction, not the product of totalh and totalv.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invks|arrayb|false}}&lt;br /&gt;
::{{Par2|invksh|arrayb|invks}}&lt;br /&gt;
::{{Par2|invksv|arrayb|invks}}&lt;br /&gt;
:::Set these parameter to True to activate the kernel inversion mode for the specified direction (use invks for both). Inverting the kernel allows to “undo” a previous upsizing by compensating the loss in high frequencies, giving a sharper and more accurate output than classic kernels, closer to the original. This is particularly useful for clips upscaled with a bilinear kernel. All the kernel-related parameters specify the kernel to undo. The target resolution must be as close as possible to the initial resolution. The kernel inversion is mainly intended to downsize an upscaled picture. Using it for upsizing will not restore details but will give a sligthly sharper look, at the cost of a bit of aliasing and ringing. This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invkstaps|arrayi|4}}&lt;br /&gt;
::{{Par2|invkstapsh|arrayi|invkstaps}}&lt;br /&gt;
::{{Par2|invkstapsv|arrayi|invkstaps}}&lt;br /&gt;
:::In kernel inversion mode (invks=True), this parameter sets the number of taps for the inverted kernel. Use it as a tradeof between softness and ringing. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::Can only change the bitdepth and the data type (integer or float). Only 16-bit integer (xxxP16) and 32-bit float data types are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from BuildPixelType or the pixel_type parameter from BlankClip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|css|string|(undefined)}}&lt;br /&gt;
:::Destination chroma subsampling, for YUV (and YCoCg) colorspaces. Supersedes the chroma subsampling from csp. You can also specify the subsampling with the predefined values or with a two-digit string. The first digit for the horizontal subsampling, and the second for the vertical subsampling. Only power-of-2 numbers are allowed. For example &amp;quot;41&amp;quot; is equivalent to 4:1:1 and &amp;quot;22&amp;quot; to 4:2:0.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::The predefined values are:&lt;br /&gt;
:::*&amp;quot;444&amp;quot; or &amp;quot;4:4:4&amp;quot;	4:4:4, no chroma subsampling.&lt;br /&gt;
:::*&amp;quot;422&amp;quot; or &amp;quot;4:2:2&amp;quot;	4:2:2, horizontal 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;420&amp;quot; or &amp;quot;4:2:0&amp;quot;	4:2:0, horizontal and vertical 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;411&amp;quot; or &amp;quot;4:1:1&amp;quot;	4:1:1, horizontal 4x chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|arrayf|all}}&lt;br /&gt;
:::This array decribes how each plane should be processed. It’s similar to the y, u and v parameters in Masktools 2.&lt;br /&gt;
:::*−65535 to +0.5	: All the pixels of the plane will be set to −x (the opposite of the specified value). The range depends on the output data type. Remember, in floating-point YUV, the chroma planes range from −0.5 to +0.5.&lt;br /&gt;
:::*1	: The plane will not be processed. This means that the content of the output plane is pure garbage.&lt;br /&gt;
:::*2	: The plane of the input clip will be copied and possibly cropped. Areas out of the input picture are left unprocessed (garbage). Range (full or TV) conversions are ignored.&lt;br /&gt;
:::*3	: The plane will be processed (default).&lt;br /&gt;
:::The parameter can also be specified as a string. See the planes parameter from the fmtc_bitdepth function for more details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|int|(depends)}}&lt;br /&gt;
::{{Par2|fulld|int|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the Y’Cb’Cr’ chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|center|arrayb|true}}&lt;br /&gt;
:::Like the Avisynth standard resizers, this resizer preserves the position of the picture center. Disable this parameter if you may want to resize by preserving the top-left corner position. Similarly, if you are convolving without resizing, setting it to false ensures you that the same kernel will be applied to all pixels.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cplace|arrayb|&amp;quot;mpeg2&amp;quot;}}&lt;br /&gt;
::{{Par2|cplaces|arrayb|cplace}}&lt;br /&gt;
::{{Par2|cplaced|arrayb|cplace}}&lt;br /&gt;
:::Placement of the chroma samples. cplaces specifies the source clip only, cplaced the destination clip. Can be one of these strings:&lt;br /&gt;
:::*&amp;quot;MPEG1&amp;quot;, &amp;quot;JPEG&amp;quot; &amp;quot;center&amp;quot;	: 4:2:0 subsampling used in MPEG-1 and JPEG. Chroma samples are located on the center of each group of 4 pixels.&lt;br /&gt;
:::*&amp;quot;MPEG2&amp;quot;, &amp;quot;left&amp;quot;		: Subsampling used in MPEG-2 4:2:x and most other formats. Chroma samples are located on the left pixel column of the group.&lt;br /&gt;
:::*&amp;quot;DV&amp;quot;			: For 4:2:0 modes, it’s like MPEG-2 but U and V channels are “co-sited” vertically: V on the top row, and U on the bottom row. For 4:1:1, chroma is located on the leftmost column.&lt;br /&gt;
:::*&amp;quot;top_left&amp;quot;, &amp;quot;tl&amp;quot;		: Chroma samples are located on the top-left luma sample of each pixel group.&lt;br /&gt;
:::The chroma placement is ignored when center is set to False or kernel to &amp;quot;point&amp;quot;. You’ll find below an overview of common chroma placement and subsampling combinations.&lt;br /&gt;
:::Graphical examples of chroma placements can be found [https://raw.githubusercontent.com/EleonoreMizo/fmtconv/master/doc/colorspace-subsampling.png in the github].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|interlaced|int|2}}&lt;br /&gt;
::{{Par2|interlacedd|int|(interlaced)}}&lt;br /&gt;
:::Specifies if the clip is made of frames or fields. interlacedd overrides interlaced for output.&lt;br /&gt;
:::*0	: Frames are progressive content.&lt;br /&gt;
:::*1	: Frames are actually the separated fields of an interlaced stream. Specify tff or provide the [[Internal_functions#Field|_Field]] property in all the frames.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#FieldBased|_FieldBased]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tff|int|2}}&lt;br /&gt;
::{{Par2|tffd|int|tff}}&lt;br /&gt;
:::When processing interlaced content, specifies the field parity. tffd overrides tff for output.&lt;br /&gt;
:::*0	: Bottom field first (BFF). This means all even fields are top, and all odd fields are bottom.&lt;br /&gt;
:::*1	: Top field first (TFF). This means all even fields are bottom, and all odd fields are top.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#Field|_Field]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|false}}&lt;br /&gt;
:::Flag to force floating point operations. When set to False, integer operations are used, but only if both input and output formats are integer. If it’s not the case, floating point operations are silently used as fallback.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set. −1: automatic (no limitation), 0: , 1: , .&lt;br /&gt;
:::*-1	: automatic (no limitation).&lt;br /&gt;
:::*0	: default instruction set only (depends on the compilation settings).&lt;br /&gt;
:::*1	: limit to SSE2.&lt;br /&gt;
:::*10	: limit to AVX2.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-07-03T18:14:02Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: Another minor edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r29&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases/ fmtconv-r29.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|(undefined)}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|(undefined)}}&lt;br /&gt;
::{{Par2|matd|bool|(undefined)}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|0}}&lt;br /&gt;
::{{Par2|sy|arrayf|0}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|0}}&lt;br /&gt;
::{{Par2|sh|arrayf|0}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|0}}&lt;br /&gt;
::{{Par2|scaleh|float|0}}&lt;br /&gt;
::{{Par2|scalev|float|0}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|impulse|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|impulseh|arrayf|impulse}}&lt;br /&gt;
::{{Par2|impulsev|arrayf|impulse}}&lt;br /&gt;
:::Offers the possibility to create your own kernel (useful for convolutions). Add your coefficents in the array. The number of coefficients must be odd. The curve is linearly interpolated between the provided points. You can oversample the impulse by setting kovrspl to a value &amp;gt; 1. To activate the custom kernel, set kernel=&amp;quot;impulse&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|taps|arrayi|4}}&lt;br /&gt;
::{{Par2|tapsh|arrayi|taps}}&lt;br /&gt;
::{{Par2|tapsv|arrayi|taps}}&lt;br /&gt;
:::Some kernels have a variable number of sample points, given by this parameter. Actually this counts half the number of lobes (or equivalent); in case of downscaling, the actual number of sample points may be greater than the specified value. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a2|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a3|arrayf|(undefined)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1h|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2h|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3h|arrayf|a3}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1v|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2v|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3v|arrayf|a3}}&lt;br /&gt;
:::Specific parameters, depending on the selected kernel.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kovrspl|int|1}}&lt;br /&gt;
:::Specifies here how many times the kernel is oversampled when you provide a custom impluse response. ≥ 1.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fh|arrayf|1}}&lt;br /&gt;
::{{Par2|fv|arrayf|1}}&lt;br /&gt;
:::Horizontal and vertical frequency factors, also known as inverse kernel support. They are multipliers on the theoretical kernel cutoff frequency in both directions. Values below 1.0 spatially expand the kernel and blur the picture. Values over 1.0 shrink the kernel and let higher frequencies pass. The result will look sharper but more aliased. The multiplicator is applied after the kernel scaling in case of downsizing. Negative values force the processing, even if the horizontal size doesn’t change. The filter will use the absolute parameter value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cnorm|bool|true}}&lt;br /&gt;
:::If set to true, the impulse sum is normalised to 1 for each pixel. This is the normal behaviour when resizing, to make sure the energy is constant for all pixels. If you use the resizer as a convolution engine, it is advised to disable the normalisation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|total|arrayf|0}}&lt;br /&gt;
::{{Par2|totalh|arrayf|total}}&lt;br /&gt;
::{{Par2|totalv|arrayf|total}}&lt;br /&gt;
:::When cnorm is activated, these parameters specify the normalisation value for the corresponding kernel. 0 means that the normalisation value is the sum of the coefficients. The Masktools’mt_convolution function has a single parameter for this use: total = totalh × totalv. Because the convolution is computed with floating point data, there is no saturation of intermediate results, therefore the balance between totalh and totalv is not important, only their product will be taken into account. Note that because kernels are single-dimention, the “parent” total parameter here is the sum of the coefficients for each direction, not the product of totalh and totalv.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invks|arrayb|false}}&lt;br /&gt;
::{{Par2|invksh|arrayb|invks}}&lt;br /&gt;
::{{Par2|invksv|arrayb|invks}}&lt;br /&gt;
:::Set these parameter to True to activate the kernel inversion mode for the specified direction (use invks for both). Inverting the kernel allows to “undo” a previous upsizing by compensating the loss in high frequencies, giving a sharper and more accurate output than classic kernels, closer to the original. This is particularly useful for clips upscaled with a bilinear kernel. All the kernel-related parameters specify the kernel to undo. The target resolution must be as close as possible to the initial resolution. The kernel inversion is mainly intended to downsize an upscaled picture. Using it for upsizing will not restore details but will give a sligthly sharper look, at the cost of a bit of aliasing and ringing. This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invkstaps|arrayi|4}}&lt;br /&gt;
::{{Par2|invkstapsh|arrayi|invkstaps}}&lt;br /&gt;
::{{Par2|invkstapsv|arrayi|invkstaps}}&lt;br /&gt;
:::In kernel inversion mode (invks=True), this parameter sets the number of taps for the inverted kernel. Use it as a tradeof between softness and ringing. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::Can only change the bitdepth and the data type (integer or float). Only 16-bit integer (xxxP16) and 32-bit float data types are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from BuildPixelType or the pixel_type parameter from BlankClip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|css|string|(undefined)}}&lt;br /&gt;
:::Destination chroma subsampling, for YUV (and YCoCg) colorspaces. Supersedes the chroma subsampling from csp. You can also specify the subsampling with the predefined values or with a two-digit string. The first digit for the horizontal subsampling, and the second for the vertical subsampling. Only power-of-2 numbers are allowed. For example &amp;quot;41&amp;quot; is equivalent to 4:1:1 and &amp;quot;22&amp;quot; to 4:2:0.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::The predefined values are:&lt;br /&gt;
:::*&amp;quot;444&amp;quot; or &amp;quot;4:4:4&amp;quot;	4:4:4, no chroma subsampling.&lt;br /&gt;
:::*&amp;quot;422&amp;quot; or &amp;quot;4:2:2&amp;quot;	4:2:2, horizontal 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;420&amp;quot; or &amp;quot;4:2:0&amp;quot;	4:2:0, horizontal and vertical 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;411&amp;quot; or &amp;quot;4:1:1&amp;quot;	4:1:1, horizontal 4x chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|arrayf|all}}&lt;br /&gt;
:::This array decribes how each plane should be processed. It’s similar to the y, u and v parameters in Masktools 2.&lt;br /&gt;
:::*−65535 to +0.5	: All the pixels of the plane will be set to −x (the opposite of the specified value). The range depends on the output data type. Remember, in floating-point YUV, the chroma planes range from −0.5 to +0.5.&lt;br /&gt;
:::*1	: The plane will not be processed. This means that the content of the output plane is pure garbage.&lt;br /&gt;
:::*2	: The plane of the input clip will be copied and possibly cropped. Areas out of the input picture are left unprocessed (garbage). Range (full or TV) conversions are ignored.&lt;br /&gt;
:::*3	: The plane will be processed (default).&lt;br /&gt;
:::The parameter can also be specified as a string. See the planes parameter from the fmtc_bitdepth function for more details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|int|(depends)}}&lt;br /&gt;
::{{Par2|fulld|int|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the Y’Cb’Cr’ chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|center|arrayb|true}}&lt;br /&gt;
:::Like the Avisynth standard resizers, this resizer preserves the position of the picture center. Disable this parameter if you may want to resize by preserving the top-left corner position. Similarly, if you are convolving without resizing, setting it to false ensures you that the same kernel will be applied to all pixels.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cplace|arrayb|&amp;quot;mpeg2&amp;quot;}}&lt;br /&gt;
::{{Par2|cplaces|arrayb|cplace}}&lt;br /&gt;
::{{Par2|cplaced|arrayb|cplace}}&lt;br /&gt;
:::Placement of the chroma samples. cplaces specifies the source clip only, cplaced the destination clip. Can be one of these strings:&lt;br /&gt;
:::*&amp;quot;MPEG1&amp;quot;, &amp;quot;JPEG&amp;quot; &amp;quot;center&amp;quot;	: 4:2:0 subsampling used in MPEG-1 and JPEG. Chroma samples are located on the center of each group of 4 pixels.&lt;br /&gt;
:::*&amp;quot;MPEG2&amp;quot;, &amp;quot;left&amp;quot;		: Subsampling used in MPEG-2 4:2:x and most other formats. Chroma samples are located on the left pixel column of the group.&lt;br /&gt;
:::*&amp;quot;DV&amp;quot;			: For 4:2:0 modes, it’s like MPEG-2 but U and V channels are “co-sited” vertically: V on the top row, and U on the bottom row. For 4:1:1, chroma is located on the leftmost column.&lt;br /&gt;
:::*&amp;quot;top_left&amp;quot;, &amp;quot;tl&amp;quot;		: Chroma samples are located on the top-left luma sample of each pixel group.&lt;br /&gt;
:::The chroma placement is ignored when center is set to False or kernel to &amp;quot;point&amp;quot;. You’ll find below an overview of common chroma placement and subsampling combinations.&lt;br /&gt;
:::Graphical examples of chroma placements can be found [https://raw.githubusercontent.com/EleonoreMizo/fmtconv/master/doc/colorspace-subsampling.png in the github].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|interlaced|int|2}}&lt;br /&gt;
::{{Par2|interlacedd|int|(interlaced)}}&lt;br /&gt;
:::Specifies if the clip is made of frames or fields. interlacedd overrides interlaced for output.&lt;br /&gt;
:::*0	: Frames are progressive content.&lt;br /&gt;
:::*1	: Frames are actually the separated fields of an interlaced stream. Specify tff or provide the [[Internal_functions#Field|_Field]] property in all the frames.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#FieldBased|_FieldBased]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tff|int|2}}&lt;br /&gt;
::{{Par2|tffd|int|tff}}&lt;br /&gt;
:::When processing interlaced content, specifies the field parity. tffd overrides tff for output.&lt;br /&gt;
:::*0	: Bottom field first (BFF). This means all even fields are top, and all odd fields are bottom.&lt;br /&gt;
:::*1	: Top field first (TFF). This means all even fields are bottom, and all odd fields are top.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#Field|_Field]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|false}}&lt;br /&gt;
:::Flag to force floating point operations. When set to False, integer operations are used, but only if both input and output formats are integer. If it’s not the case, floating point operations are silently used as fallback.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set. −1: automatic (no limitation), 0: , 1: , .&lt;br /&gt;
:::*-1	: automatic (no limitation).&lt;br /&gt;
:::*0	: default instruction set only (depends on the compilation settings).&lt;br /&gt;
:::*1	: limit to SSE2.&lt;br /&gt;
:::*10	: limit to AVX2.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-07-03T18:09:17Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: Small edit to the colorspace subsampling example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r29&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases/ fmtconv-r29.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|(undefined)}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|(undefined)}}&lt;br /&gt;
::{{Par2|matd|bool|(undefined)}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|0}}&lt;br /&gt;
::{{Par2|sy|arrayf|0}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|0}}&lt;br /&gt;
::{{Par2|sh|arrayf|0}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|0}}&lt;br /&gt;
::{{Par2|scaleh|float|0}}&lt;br /&gt;
::{{Par2|scalev|float|0}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|impulse|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|impulseh|arrayf|impulse}}&lt;br /&gt;
::{{Par2|impulsev|arrayf|impulse}}&lt;br /&gt;
:::Offers the possibility to create your own kernel (useful for convolutions). Add your coefficents in the array. The number of coefficients must be odd. The curve is linearly interpolated between the provided points. You can oversample the impulse by setting kovrspl to a value &amp;gt; 1. To activate the custom kernel, set kernel=&amp;quot;impulse&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|taps|arrayi|4}}&lt;br /&gt;
::{{Par2|tapsh|arrayi|taps}}&lt;br /&gt;
::{{Par2|tapsv|arrayi|taps}}&lt;br /&gt;
:::Some kernels have a variable number of sample points, given by this parameter. Actually this counts half the number of lobes (or equivalent); in case of downscaling, the actual number of sample points may be greater than the specified value. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a2|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a3|arrayf|(undefined)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1h|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2h|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3h|arrayf|a3}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1v|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2v|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3v|arrayf|a3}}&lt;br /&gt;
:::Specific parameters, depending on the selected kernel.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kovrspl|int|1}}&lt;br /&gt;
:::Specifies here how many times the kernel is oversampled when you provide a custom impluse response. ≥ 1.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fh|arrayf|1}}&lt;br /&gt;
::{{Par2|fv|arrayf|1}}&lt;br /&gt;
:::Horizontal and vertical frequency factors, also known as inverse kernel support. They are multipliers on the theoretical kernel cutoff frequency in both directions. Values below 1.0 spatially expand the kernel and blur the picture. Values over 1.0 shrink the kernel and let higher frequencies pass. The result will look sharper but more aliased. The multiplicator is applied after the kernel scaling in case of downsizing. Negative values force the processing, even if the horizontal size doesn’t change. The filter will use the absolute parameter value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cnorm|bool|true}}&lt;br /&gt;
:::If set to true, the impulse sum is normalised to 1 for each pixel. This is the normal behaviour when resizing, to make sure the energy is constant for all pixels. If you use the resizer as a convolution engine, it is advised to disable the normalisation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|total|arrayf|0}}&lt;br /&gt;
::{{Par2|totalh|arrayf|total}}&lt;br /&gt;
::{{Par2|totalv|arrayf|total}}&lt;br /&gt;
:::When cnorm is activated, these parameters specify the normalisation value for the corresponding kernel. 0 means that the normalisation value is the sum of the coefficients. The Masktools’mt_convolution function has a single parameter for this use: total = totalh × totalv. Because the convolution is computed with floating point data, there is no saturation of intermediate results, therefore the balance between totalh and totalv is not important, only their product will be taken into account. Note that because kernels are single-dimention, the “parent” total parameter here is the sum of the coefficients for each direction, not the product of totalh and totalv.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invks|arrayb|false}}&lt;br /&gt;
::{{Par2|invksh|arrayb|invks}}&lt;br /&gt;
::{{Par2|invksv|arrayb|invks}}&lt;br /&gt;
:::Set these parameter to True to activate the kernel inversion mode for the specified direction (use invks for both). Inverting the kernel allows to “undo” a previous upsizing by compensating the loss in high frequencies, giving a sharper and more accurate output than classic kernels, closer to the original. This is particularly useful for clips upscaled with a bilinear kernel. All the kernel-related parameters specify the kernel to undo. The target resolution must be as close as possible to the initial resolution. The kernel inversion is mainly intended to downsize an upscaled picture. Using it for upsizing will not restore details but will give a sligthly sharper look, at the cost of a bit of aliasing and ringing. This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invkstaps|arrayi|4}}&lt;br /&gt;
::{{Par2|invkstapsh|arrayi|invkstaps}}&lt;br /&gt;
::{{Par2|invkstapsv|arrayi|invkstaps}}&lt;br /&gt;
:::In kernel inversion mode (invks=True), this parameter sets the number of taps for the inverted kernel. Use it as a tradeof between softness and ringing. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::Can only change the bitdepth and the data type (integer or float). Only 16-bit integer (xxxP16) and 32-bit float data types are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from BuildPixelType or the pixel_type parameter from BlankClip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|css|string|(undefined)}}&lt;br /&gt;
:::Destination chroma subsampling, for YUV (and YCoCg) colorspaces. Supersedes the chroma subsampling from csp. You can also specify the subsampling with the predefined values or with a two-digit string. The first digit for the horizontal subsampling, and the second for the vertical subsampling. Only power-of-2 numbers are allowed. For example &amp;quot;41&amp;quot; is equivalent to 4:1:1 and &amp;quot;22&amp;quot; to 4:2:0.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::The predefined values are:&lt;br /&gt;
:::*&amp;quot;444&amp;quot; or &amp;quot;4:4:4&amp;quot;	4:4:4, no chroma subsampling.&lt;br /&gt;
:::*&amp;quot;422&amp;quot; or &amp;quot;4:2:2&amp;quot;	4:2:2, horizontal 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;420&amp;quot; or &amp;quot;4:2:0&amp;quot;	4:2:0, horizontal and vertical 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;411&amp;quot; or &amp;quot;4:1:1&amp;quot;	4:1:1, horizontal 4x chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|arrayf|all}}&lt;br /&gt;
:::This array decribes how each plane should be processed. It’s similar to the y, u and v parameters in Masktools 2.&lt;br /&gt;
:::*−65535 to +0.5	: All the pixels of the plane will be set to −x (the opposite of the specified value). The range depends on the output data type. Remember, in floating-point YUV, the chroma planes range from −0.5 to +0.5.&lt;br /&gt;
:::*1	: The plane will not be processed. This means that the content of the output plane is pure garbage.&lt;br /&gt;
:::*2	: The plane of the input clip will be copied and possibly cropped. Areas out of the input picture are left unprocessed (garbage). Range (full or TV) conversions are ignored.&lt;br /&gt;
:::*3	: The plane will be processed (default).&lt;br /&gt;
:::The parameter can also be specified as a string. See the planes parameter from the fmtc_bitdepth function for more details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|int|(depends)}}&lt;br /&gt;
::{{Par2|fulld|int|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the Y’Cb’Cr’ chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|center|arrayb|true}}&lt;br /&gt;
:::Like the Avisynth standard resizers, this resizer preserves the position of the picture center. Disable this parameter if you may want to resize by preserving the top-left corner position. Similarly, if you are convolving without resizing, setting it to false ensures you that the same kernel will be applied to all pixels.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cplace|arrayb|&amp;quot;mpeg2&amp;quot;}}&lt;br /&gt;
::{{Par2|cplaces|arrayb|cplace}}&lt;br /&gt;
::{{Par2|cplaced|arrayb|cplace}}&lt;br /&gt;
:::Placement of the chroma samples. cplaces specifies the source clip only, cplaced the destination clip. Can be one of these strings:&lt;br /&gt;
:::*&amp;quot;MPEG1&amp;quot;, &amp;quot;JPEG&amp;quot; &amp;quot;center&amp;quot;	: 4:2:0 subsampling used in MPEG-1 and JPEG. Chroma samples are located on the center of each group of 4 pixels.&lt;br /&gt;
:::*&amp;quot;MPEG2&amp;quot;, &amp;quot;left&amp;quot;		: Subsampling used in MPEG-2 4:2:x and most other formats. Chroma samples are located on the left pixel column of the group.&lt;br /&gt;
:::*&amp;quot;DV&amp;quot;			: For 4:2:0 modes, it’s like MPEG-2 but U and V channels are “co-sited” vertically: V on the top row, and U on the bottom row. For 4:1:1, chroma is located on the leftmost column.&lt;br /&gt;
:::*&amp;quot;top_left&amp;quot;, &amp;quot;tl&amp;quot;		: Chroma samples are located on the top-left luma sample of each pixel group.&lt;br /&gt;
:::The chroma placement is ignored when center is set to False or kernel to &amp;quot;point&amp;quot;. You’ll find below an overview of common chroma placement and subsampling combinations:&lt;br /&gt;
:::Graphical examples of chroma placements can be found in the github: [https://raw.githubusercontent.com/EleonoreMizo/fmtconv/master/doc/colorspace-subsampling.png]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|interlaced|int|2}}&lt;br /&gt;
::{{Par2|interlacedd|int|(interlaced)}}&lt;br /&gt;
:::Specifies if the clip is made of frames or fields. interlacedd overrides interlaced for output.&lt;br /&gt;
:::*0	: Frames are progressive content.&lt;br /&gt;
:::*1	: Frames are actually the separated fields of an interlaced stream. Specify tff or provide the [[Internal_functions#Field|_Field]] property in all the frames.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#FieldBased|_FieldBased]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tff|int|2}}&lt;br /&gt;
::{{Par2|tffd|int|tff}}&lt;br /&gt;
:::When processing interlaced content, specifies the field parity. tffd overrides tff for output.&lt;br /&gt;
:::*0	: Bottom field first (BFF). This means all even fields are top, and all odd fields are bottom.&lt;br /&gt;
:::*1	: Top field first (TFF). This means all even fields are bottom, and all odd fields are top.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#Field|_Field]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|false}}&lt;br /&gt;
:::Flag to force floating point operations. When set to False, integer operations are used, but only if both input and output formats are integer. If it’s not the case, floating point operations are silently used as fallback.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set. −1: automatic (no limitation), 0: , 1: , .&lt;br /&gt;
:::*-1	: automatic (no limitation).&lt;br /&gt;
:::*0	: default instruction set only (depends on the compilation settings).&lt;br /&gt;
:::*1	: limit to SSE2.&lt;br /&gt;
:::*10	: limit to AVX2.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-06-27T21:53:00Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: DL link fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r29&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases/tag/r29 fmtconv-r29.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|(undefined)}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|(undefined)}}&lt;br /&gt;
::{{Par2|matd|bool|(undefined)}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|0}}&lt;br /&gt;
::{{Par2|sy|arrayf|0}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|0}}&lt;br /&gt;
::{{Par2|sh|arrayf|0}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|0}}&lt;br /&gt;
::{{Par2|scaleh|float|0}}&lt;br /&gt;
::{{Par2|scalev|float|0}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|impulse|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|impulseh|arrayf|impulse}}&lt;br /&gt;
::{{Par2|impulsev|arrayf|impulse}}&lt;br /&gt;
:::Offers the possibility to create your own kernel (useful for convolutions). Add your coefficents in the array. The number of coefficients must be odd. The curve is linearly interpolated between the provided points. You can oversample the impulse by setting kovrspl to a value &amp;gt; 1. To activate the custom kernel, set kernel=&amp;quot;impulse&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|taps|arrayi|4}}&lt;br /&gt;
::{{Par2|tapsh|arrayi|taps}}&lt;br /&gt;
::{{Par2|tapsv|arrayi|taps}}&lt;br /&gt;
:::Some kernels have a variable number of sample points, given by this parameter. Actually this counts half the number of lobes (or equivalent); in case of downscaling, the actual number of sample points may be greater than the specified value. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a2|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a3|arrayf|(undefined)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1h|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2h|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3h|arrayf|a3}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1v|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2v|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3v|arrayf|a3}}&lt;br /&gt;
:::Specific parameters, depending on the selected kernel.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kovrspl|int|1}}&lt;br /&gt;
:::Specifies here how many times the kernel is oversampled when you provide a custom impluse response. ≥ 1.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fh|arrayf|1}}&lt;br /&gt;
::{{Par2|fv|arrayf|1}}&lt;br /&gt;
:::Horizontal and vertical frequency factors, also known as inverse kernel support. They are multipliers on the theoretical kernel cutoff frequency in both directions. Values below 1.0 spatially expand the kernel and blur the picture. Values over 1.0 shrink the kernel and let higher frequencies pass. The result will look sharper but more aliased. The multiplicator is applied after the kernel scaling in case of downsizing. Negative values force the processing, even if the horizontal size doesn’t change. The filter will use the absolute parameter value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cnorm|bool|true}}&lt;br /&gt;
:::If set to true, the impulse sum is normalised to 1 for each pixel. This is the normal behaviour when resizing, to make sure the energy is constant for all pixels. If you use the resizer as a convolution engine, it is advised to disable the normalisation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|total|arrayf|0}}&lt;br /&gt;
::{{Par2|totalh|arrayf|total}}&lt;br /&gt;
::{{Par2|totalv|arrayf|total}}&lt;br /&gt;
:::When cnorm is activated, these parameters specify the normalisation value for the corresponding kernel. 0 means that the normalisation value is the sum of the coefficients. The Masktools’mt_convolution function has a single parameter for this use: total = totalh × totalv. Because the convolution is computed with floating point data, there is no saturation of intermediate results, therefore the balance between totalh and totalv is not important, only their product will be taken into account. Note that because kernels are single-dimention, the “parent” total parameter here is the sum of the coefficients for each direction, not the product of totalh and totalv.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invks|arrayb|false}}&lt;br /&gt;
::{{Par2|invksh|arrayb|invks}}&lt;br /&gt;
::{{Par2|invksv|arrayb|invks}}&lt;br /&gt;
:::Set these parameter to True to activate the kernel inversion mode for the specified direction (use invks for both). Inverting the kernel allows to “undo” a previous upsizing by compensating the loss in high frequencies, giving a sharper and more accurate output than classic kernels, closer to the original. This is particularly useful for clips upscaled with a bilinear kernel. All the kernel-related parameters specify the kernel to undo. The target resolution must be as close as possible to the initial resolution. The kernel inversion is mainly intended to downsize an upscaled picture. Using it for upsizing will not restore details but will give a sligthly sharper look, at the cost of a bit of aliasing and ringing. This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invkstaps|arrayi|4}}&lt;br /&gt;
::{{Par2|invkstapsh|arrayi|invkstaps}}&lt;br /&gt;
::{{Par2|invkstapsv|arrayi|invkstaps}}&lt;br /&gt;
:::In kernel inversion mode (invks=True), this parameter sets the number of taps for the inverted kernel. Use it as a tradeof between softness and ringing. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::Can only change the bitdepth and the data type (integer or float). Only 16-bit integer (xxxP16) and 32-bit float data types are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from BuildPixelType or the pixel_type parameter from BlankClip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|css|string|(undefined)}}&lt;br /&gt;
:::Destination chroma subsampling, for YUV (and YCoCg) colorspaces. Supersedes the chroma subsampling from csp. You can also specify the subsampling with the predefined values or with a two-digit string. The first digit for the horizontal subsampling, and the second for the vertical subsampling. Only power-of-2 numbers are allowed. For example &amp;quot;41&amp;quot; is equivalent to 4:1:1 and &amp;quot;22&amp;quot; to 4:2:0.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::The predefined values are:&lt;br /&gt;
:::*&amp;quot;444&amp;quot; or &amp;quot;4:4:4&amp;quot;	4:4:4, no chroma subsampling.&lt;br /&gt;
:::*&amp;quot;422&amp;quot; or &amp;quot;4:2:2&amp;quot;	4:2:2, horizontal 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;420&amp;quot; or &amp;quot;4:2:0&amp;quot;	4:2:0, horizontal and vertical 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;411&amp;quot; or &amp;quot;4:1:1&amp;quot;	4:1:1, horizontal 4x chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|arrayf|all}}&lt;br /&gt;
:::This array decribes how each plane should be processed. It’s similar to the y, u and v parameters in Masktools 2.&lt;br /&gt;
:::*−65535 to +0.5	: All the pixels of the plane will be set to −x (the opposite of the specified value). The range depends on the output data type. Remember, in floating-point YUV, the chroma planes range from −0.5 to +0.5.&lt;br /&gt;
:::*1	: The plane will not be processed. This means that the content of the output plane is pure garbage.&lt;br /&gt;
:::*2	: The plane of the input clip will be copied and possibly cropped. Areas out of the input picture are left unprocessed (garbage). Range (full or TV) conversions are ignored.&lt;br /&gt;
:::*3	: The plane will be processed (default).&lt;br /&gt;
:::The parameter can also be specified as a string. See the planes parameter from the fmtc_bitdepth function for more details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|int|(depends)}}&lt;br /&gt;
::{{Par2|fulld|int|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the Y’Cb’Cr’ chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|center|arrayb|true}}&lt;br /&gt;
:::Like the Avisynth standard resizers, this resizer preserves the position of the picture center. Disable this parameter if you may want to resize by preserving the top-left corner position. Similarly, if you are convolving without resizing, setting it to false ensures you that the same kernel will be applied to all pixels.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cplace|arrayb|&amp;quot;mpeg2&amp;quot;}}&lt;br /&gt;
::{{Par2|cplaces|arrayb|cplace}}&lt;br /&gt;
::{{Par2|cplaced|arrayb|cplace}}&lt;br /&gt;
:::Placement of the chroma samples. cplaces specifies the source clip only, cplaced the destination clip. Can be one of these strings:&lt;br /&gt;
:::*&amp;quot;MPEG1&amp;quot;, &amp;quot;JPEG&amp;quot; &amp;quot;center&amp;quot;	: 4:2:0 subsampling used in MPEG-1 and JPEG. Chroma samples are located on the center of each group of 4 pixels.&lt;br /&gt;
:::*&amp;quot;MPEG2&amp;quot;, &amp;quot;left&amp;quot;		: Subsampling used in MPEG-2 4:2:x and most other formats. Chroma samples are located on the left pixel column of the group.&lt;br /&gt;
:::*&amp;quot;DV&amp;quot;			: For 4:2:0 modes, it’s like MPEG-2 but U and V channels are “co-sited” vertically: V on the top row, and U on the bottom row. For 4:1:1, chroma is located on the leftmost column.&lt;br /&gt;
:::*&amp;quot;top_left&amp;quot;, &amp;quot;tl&amp;quot;		: Chroma samples are located on the top-left luma sample of each pixel group.&lt;br /&gt;
:::The chroma placement is ignored when center is set to False or kernel to &amp;quot;point&amp;quot;. You’ll find below an overview of common chroma placement and subsampling combinations:&lt;br /&gt;
Chroma placement&lt;br /&gt;
(image:https://raw.githubusercontent.com/EleonoreMizo/fmtconv/master/doc/colorspace-subsampling.png)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|interlaced|int|2}}&lt;br /&gt;
::{{Par2|interlacedd|int|(interlaced)}}&lt;br /&gt;
:::Specifies if the clip is made of frames or fields. interlacedd overrides interlaced for output.&lt;br /&gt;
:::*0	: Frames are progressive content.&lt;br /&gt;
:::*1	: Frames are actually the separated fields of an interlaced stream. Specify tff or provide the [[Internal_functions#Field|_Field]] property in all the frames.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#FieldBased|_FieldBased]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tff|int|2}}&lt;br /&gt;
::{{Par2|tffd|int|tff}}&lt;br /&gt;
:::When processing interlaced content, specifies the field parity. tffd overrides tff for output.&lt;br /&gt;
:::*0	: Bottom field first (BFF). This means all even fields are top, and all odd fields are bottom.&lt;br /&gt;
:::*1	: Top field first (TFF). This means all even fields are bottom, and all odd fields are top.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#Field|_Field]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|false}}&lt;br /&gt;
:::Flag to force floating point operations. When set to False, integer operations are used, but only if both input and output formats are integer. If it’s not the case, floating point operations are silently used as fallback.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set. −1: automatic (no limitation), 0: , 1: , .&lt;br /&gt;
:::*-1	: automatic (no limitation).&lt;br /&gt;
:::*0	: default instruction set only (depends on the compilation settings).&lt;br /&gt;
:::*1	: limit to SSE2.&lt;br /&gt;
:::*10	: limit to AVX2.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-06-27T21:50:29Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: plugin version update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r29&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases/download/r29/fmtconv-r29.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|(undefined)}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|(undefined)}}&lt;br /&gt;
::{{Par2|matd|bool|(undefined)}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|0}}&lt;br /&gt;
::{{Par2|sy|arrayf|0}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|0}}&lt;br /&gt;
::{{Par2|sh|arrayf|0}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|0}}&lt;br /&gt;
::{{Par2|scaleh|float|0}}&lt;br /&gt;
::{{Par2|scalev|float|0}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|impulse|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|impulseh|arrayf|impulse}}&lt;br /&gt;
::{{Par2|impulsev|arrayf|impulse}}&lt;br /&gt;
:::Offers the possibility to create your own kernel (useful for convolutions). Add your coefficents in the array. The number of coefficients must be odd. The curve is linearly interpolated between the provided points. You can oversample the impulse by setting kovrspl to a value &amp;gt; 1. To activate the custom kernel, set kernel=&amp;quot;impulse&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|taps|arrayi|4}}&lt;br /&gt;
::{{Par2|tapsh|arrayi|taps}}&lt;br /&gt;
::{{Par2|tapsv|arrayi|taps}}&lt;br /&gt;
:::Some kernels have a variable number of sample points, given by this parameter. Actually this counts half the number of lobes (or equivalent); in case of downscaling, the actual number of sample points may be greater than the specified value. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a2|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a3|arrayf|(undefined)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1h|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2h|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3h|arrayf|a3}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1v|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2v|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3v|arrayf|a3}}&lt;br /&gt;
:::Specific parameters, depending on the selected kernel.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kovrspl|int|1}}&lt;br /&gt;
:::Specifies here how many times the kernel is oversampled when you provide a custom impluse response. ≥ 1.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fh|arrayf|1}}&lt;br /&gt;
::{{Par2|fv|arrayf|1}}&lt;br /&gt;
:::Horizontal and vertical frequency factors, also known as inverse kernel support. They are multipliers on the theoretical kernel cutoff frequency in both directions. Values below 1.0 spatially expand the kernel and blur the picture. Values over 1.0 shrink the kernel and let higher frequencies pass. The result will look sharper but more aliased. The multiplicator is applied after the kernel scaling in case of downsizing. Negative values force the processing, even if the horizontal size doesn’t change. The filter will use the absolute parameter value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cnorm|bool|true}}&lt;br /&gt;
:::If set to true, the impulse sum is normalised to 1 for each pixel. This is the normal behaviour when resizing, to make sure the energy is constant for all pixels. If you use the resizer as a convolution engine, it is advised to disable the normalisation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|total|arrayf|0}}&lt;br /&gt;
::{{Par2|totalh|arrayf|total}}&lt;br /&gt;
::{{Par2|totalv|arrayf|total}}&lt;br /&gt;
:::When cnorm is activated, these parameters specify the normalisation value for the corresponding kernel. 0 means that the normalisation value is the sum of the coefficients. The Masktools’mt_convolution function has a single parameter for this use: total = totalh × totalv. Because the convolution is computed with floating point data, there is no saturation of intermediate results, therefore the balance between totalh and totalv is not important, only their product will be taken into account. Note that because kernels are single-dimention, the “parent” total parameter here is the sum of the coefficients for each direction, not the product of totalh and totalv.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invks|arrayb|false}}&lt;br /&gt;
::{{Par2|invksh|arrayb|invks}}&lt;br /&gt;
::{{Par2|invksv|arrayb|invks}}&lt;br /&gt;
:::Set these parameter to True to activate the kernel inversion mode for the specified direction (use invks for both). Inverting the kernel allows to “undo” a previous upsizing by compensating the loss in high frequencies, giving a sharper and more accurate output than classic kernels, closer to the original. This is particularly useful for clips upscaled with a bilinear kernel. All the kernel-related parameters specify the kernel to undo. The target resolution must be as close as possible to the initial resolution. The kernel inversion is mainly intended to downsize an upscaled picture. Using it for upsizing will not restore details but will give a sligthly sharper look, at the cost of a bit of aliasing and ringing. This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invkstaps|arrayi|4}}&lt;br /&gt;
::{{Par2|invkstapsh|arrayi|invkstaps}}&lt;br /&gt;
::{{Par2|invkstapsv|arrayi|invkstaps}}&lt;br /&gt;
:::In kernel inversion mode (invks=True), this parameter sets the number of taps for the inverted kernel. Use it as a tradeof between softness and ringing. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::Can only change the bitdepth and the data type (integer or float). Only 16-bit integer (xxxP16) and 32-bit float data types are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from BuildPixelType or the pixel_type parameter from BlankClip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|css|string|(undefined)}}&lt;br /&gt;
:::Destination chroma subsampling, for YUV (and YCoCg) colorspaces. Supersedes the chroma subsampling from csp. You can also specify the subsampling with the predefined values or with a two-digit string. The first digit for the horizontal subsampling, and the second for the vertical subsampling. Only power-of-2 numbers are allowed. For example &amp;quot;41&amp;quot; is equivalent to 4:1:1 and &amp;quot;22&amp;quot; to 4:2:0.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::The predefined values are:&lt;br /&gt;
:::*&amp;quot;444&amp;quot; or &amp;quot;4:4:4&amp;quot;	4:4:4, no chroma subsampling.&lt;br /&gt;
:::*&amp;quot;422&amp;quot; or &amp;quot;4:2:2&amp;quot;	4:2:2, horizontal 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;420&amp;quot; or &amp;quot;4:2:0&amp;quot;	4:2:0, horizontal and vertical 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;411&amp;quot; or &amp;quot;4:1:1&amp;quot;	4:1:1, horizontal 4x chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|arrayf|all}}&lt;br /&gt;
:::This array decribes how each plane should be processed. It’s similar to the y, u and v parameters in Masktools 2.&lt;br /&gt;
:::*−65535 to +0.5	: All the pixels of the plane will be set to −x (the opposite of the specified value). The range depends on the output data type. Remember, in floating-point YUV, the chroma planes range from −0.5 to +0.5.&lt;br /&gt;
:::*1	: The plane will not be processed. This means that the content of the output plane is pure garbage.&lt;br /&gt;
:::*2	: The plane of the input clip will be copied and possibly cropped. Areas out of the input picture are left unprocessed (garbage). Range (full or TV) conversions are ignored.&lt;br /&gt;
:::*3	: The plane will be processed (default).&lt;br /&gt;
:::The parameter can also be specified as a string. See the planes parameter from the fmtc_bitdepth function for more details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|int|(depends)}}&lt;br /&gt;
::{{Par2|fulld|int|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the Y’Cb’Cr’ chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|center|arrayb|true}}&lt;br /&gt;
:::Like the Avisynth standard resizers, this resizer preserves the position of the picture center. Disable this parameter if you may want to resize by preserving the top-left corner position. Similarly, if you are convolving without resizing, setting it to false ensures you that the same kernel will be applied to all pixels.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cplace|arrayb|&amp;quot;mpeg2&amp;quot;}}&lt;br /&gt;
::{{Par2|cplaces|arrayb|cplace}}&lt;br /&gt;
::{{Par2|cplaced|arrayb|cplace}}&lt;br /&gt;
:::Placement of the chroma samples. cplaces specifies the source clip only, cplaced the destination clip. Can be one of these strings:&lt;br /&gt;
:::*&amp;quot;MPEG1&amp;quot;, &amp;quot;JPEG&amp;quot; &amp;quot;center&amp;quot;	: 4:2:0 subsampling used in MPEG-1 and JPEG. Chroma samples are located on the center of each group of 4 pixels.&lt;br /&gt;
:::*&amp;quot;MPEG2&amp;quot;, &amp;quot;left&amp;quot;		: Subsampling used in MPEG-2 4:2:x and most other formats. Chroma samples are located on the left pixel column of the group.&lt;br /&gt;
:::*&amp;quot;DV&amp;quot;			: For 4:2:0 modes, it’s like MPEG-2 but U and V channels are “co-sited” vertically: V on the top row, and U on the bottom row. For 4:1:1, chroma is located on the leftmost column.&lt;br /&gt;
:::*&amp;quot;top_left&amp;quot;, &amp;quot;tl&amp;quot;		: Chroma samples are located on the top-left luma sample of each pixel group.&lt;br /&gt;
:::The chroma placement is ignored when center is set to False or kernel to &amp;quot;point&amp;quot;. You’ll find below an overview of common chroma placement and subsampling combinations:&lt;br /&gt;
Chroma placement&lt;br /&gt;
(image:https://raw.githubusercontent.com/EleonoreMizo/fmtconv/master/doc/colorspace-subsampling.png)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|interlaced|int|2}}&lt;br /&gt;
::{{Par2|interlacedd|int|(interlaced)}}&lt;br /&gt;
:::Specifies if the clip is made of frames or fields. interlacedd overrides interlaced for output.&lt;br /&gt;
:::*0	: Frames are progressive content.&lt;br /&gt;
:::*1	: Frames are actually the separated fields of an interlaced stream. Specify tff or provide the [[Internal_functions#Field|_Field]] property in all the frames.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#FieldBased|_FieldBased]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tff|int|2}}&lt;br /&gt;
::{{Par2|tffd|int|tff}}&lt;br /&gt;
:::When processing interlaced content, specifies the field parity. tffd overrides tff for output.&lt;br /&gt;
:::*0	: Bottom field first (BFF). This means all even fields are top, and all odd fields are bottom.&lt;br /&gt;
:::*1	: Top field first (TFF). This means all even fields are bottom, and all odd fields are top.&lt;br /&gt;
:::*2	: Automatic detection, depends on the [[Internal_functions#Field|_Field]] frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|false}}&lt;br /&gt;
:::Flag to force floating point operations. When set to False, integer operations are used, but only if both input and output formats are integer. If it’s not the case, floating point operations are silently used as fallback.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set. −1: automatic (no limitation), 0: , 1: , .&lt;br /&gt;
:::*-1	: automatic (no limitation).&lt;br /&gt;
:::*0	: default instruction set only (depends on the compilation settings).&lt;br /&gt;
:::*1	: limit to SSE2.&lt;br /&gt;
:::*10	: limit to AVX2.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-06-27T21:45:45Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: finished fmtc_resample (!!)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r24&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases fmtconv-r24.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|(undefined)}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|(undefined)}}&lt;br /&gt;
::{{Par2|matd|bool|(undefined)}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|0}}&lt;br /&gt;
::{{Par2|sy|arrayf|0}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|0}}&lt;br /&gt;
::{{Par2|sh|arrayf|0}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|0}}&lt;br /&gt;
::{{Par2|scaleh|float|0}}&lt;br /&gt;
::{{Par2|scalev|float|0}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|impulse|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|impulseh|arrayf|impulse}}&lt;br /&gt;
::{{Par2|impulsev|arrayf|impulse}}&lt;br /&gt;
:::Offers the possibility to create your own kernel (useful for convolutions). Add your coefficents in the array. The number of coefficients must be odd. The curve is linearly interpolated between the provided points. You can oversample the impulse by setting kovrspl to a value &amp;gt; 1. To activate the custom kernel, set kernel=&amp;quot;impulse&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|taps|arrayi|4}}&lt;br /&gt;
::{{Par2|tapsh|arrayi|taps}}&lt;br /&gt;
::{{Par2|tapsv|arrayi|taps}}&lt;br /&gt;
:::Some kernels have a variable number of sample points, given by this parameter. Actually this counts half the number of lobes (or equivalent); in case of downscaling, the actual number of sample points may be greater than the specified value. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a2|arrayf|(undefined)}}&lt;br /&gt;
::{{Par2|a3|arrayf|(undefined)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1h|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2h|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3h|arrayf|a3}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|a1v|arrayf|a1}}&lt;br /&gt;
::{{Par2|a2v|arrayf|a2}}&lt;br /&gt;
::{{Par2|a3v|arrayf|a3}}&lt;br /&gt;
:::Specific parameters, depending on the selected kernel.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kovrspl|int|1}}&lt;br /&gt;
:::Specifies here how many times the kernel is oversampled when you provide a custom impluse response. ≥ 1.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fh|arrayf|1}}&lt;br /&gt;
::{{Par2|fv|arrayf|1}}&lt;br /&gt;
:::Horizontal and vertical frequency factors, also known as inverse kernel support. They are multipliers on the theoretical kernel cutoff frequency in both directions. Values below 1.0 spatially expand the kernel and blur the picture. Values over 1.0 shrink the kernel and let higher frequencies pass. The result will look sharper but more aliased. The multiplicator is applied after the kernel scaling in case of downsizing. Negative values force the processing, even if the horizontal size doesn’t change. The filter will use the absolute parameter value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cnorm|bool|true}}&lt;br /&gt;
:::If set to true, the impulse sum is normalised to 1 for each pixel. This is the normal behaviour when resizing, to make sure the energy is constant for all pixels. If you use the resizer as a convolution engine, it is advised to disable the normalisation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|total|arrayf|0}}&lt;br /&gt;
::{{Par2|totalh|arrayf|total}}&lt;br /&gt;
::{{Par2|totalv|arrayf|total}}&lt;br /&gt;
:::When cnorm is activated, these parameters specify the normalisation value for the corresponding kernel. 0 means that the normalisation value is the sum of the coefficients. The Masktools’mt_convolution function has a single parameter for this use: total = totalh × totalv. Because the convolution is computed with floating point data, there is no saturation of intermediate results, therefore the balance between totalh and totalv is not important, only their product will be taken into account. Note that because kernels are single-dimention, the “parent” total parameter here is the sum of the coefficients for each direction, not the product of totalh and totalv.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invks|arrayb|false}}&lt;br /&gt;
::{{Par2|invksh|arrayb|invks}}&lt;br /&gt;
::{{Par2|invksv|arrayb|invks}}&lt;br /&gt;
:::Set these parameter to True to activate the kernel inversion mode for the specified direction (use invks for both). Inverting the kernel allows to “undo” a previous upsizing by compensating the loss in high frequencies, giving a sharper and more accurate output than classic kernels, closer to the original. This is particularly useful for clips upscaled with a bilinear kernel. All the kernel-related parameters specify the kernel to undo. The target resolution must be as close as possible to the initial resolution. The kernel inversion is mainly intended to downsize an upscaled picture. Using it for upsizing will not restore details but will give a sligthly sharper look, at the cost of a bit of aliasing and ringing. This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|invkstaps|arrayi|(4)}}&lt;br /&gt;
::{{Par2|invkstapsh|arrayi|invkstaps}}&lt;br /&gt;
::{{Par2|invkstapsv|arrayi|invkstaps}}&lt;br /&gt;
:::In kernel inversion mode (invks=True), this parameter sets the number of taps for the inverted kernel. Use it as a tradeof between softness and ringing. Range: 1–128&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::Can only change the bitdepth and the data type (integer or float). Only 16-bit integer (xxxP16) and 32-bit float data types are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from BuildPixelType or the pixel_type parameter from BlankClip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|css|string|(undefined)}}&lt;br /&gt;
:::Destination chroma subsampling, for YUV (and YCoCg) colorspaces. Supersedes the chroma subsampling from csp. You can also specify the subsampling with the predefined values or with a two-digit string. The first digit for the horizontal subsampling, and the second for the vertical subsampling. Only power-of-2 numbers are allowed. For example &amp;quot;41&amp;quot; is equivalent to 4:1:1 and &amp;quot;22&amp;quot; to 4:2:0.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::The predefined values are:&lt;br /&gt;
:::*&amp;quot;444&amp;quot; or &amp;quot;4:4:4&amp;quot;	4:4:4, no chroma subsampling.&lt;br /&gt;
:::*&amp;quot;422&amp;quot; or &amp;quot;4:2:2&amp;quot;	4:2:2, horizontal 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;420&amp;quot; or &amp;quot;4:2:0&amp;quot;	4:2:0, horizontal and vertical 2x chroma subsampling.&lt;br /&gt;
:::*&amp;quot;411&amp;quot; or &amp;quot;4:1:1&amp;quot;	4:1:1, horizontal 4x chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|arrayf|all}}&lt;br /&gt;
:::This array decribes how each plane should be processed. It’s similar to the y, u and v parameters in Masktools 2.&lt;br /&gt;
:::*−65535 to +0.5	: All the pixels of the plane will be set to −x (the opposite of the specified value). The range depends on the output data type. Remember, in floating-point YUV, the chroma planes range from −0.5 to +0.5.&lt;br /&gt;
:::*1	: The plane will not be processed. This means that the content of the output plane is pure garbage.&lt;br /&gt;
:::*2	: The plane of the input clip will be copied and possibly cropped. Areas out of the input picture are left unprocessed (garbage). Range (full or TV) conversions are ignored.&lt;br /&gt;
:::*3	: The plane will be processed (default).&lt;br /&gt;
:::The parameter can also be specified as a string. See the planes parameter from the fmtc_bitdepth function for more details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|int|(depends)}}&lt;br /&gt;
::{{Par2|fulld|int|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the Y’Cb’Cr’ chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|center|arrayb|true}}&lt;br /&gt;
:::Like the Avisynth standard resizers, this resizer preserves the position of the picture center. Disable this parameter if you may want to resize by preserving the top-left corner position. Similarly, if you are convolving without resizing, setting it to false ensures you that the same kernel will be applied to all pixels.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cplace|arrayb|&amp;quot;mpeg2&amp;quot;}}&lt;br /&gt;
::{{Par2|cplaces|arrayb|cplace}}&lt;br /&gt;
::{{Par2|cplaced|arrayb|cplace}}&lt;br /&gt;
:::Placement of the chroma samples. cplaces specifies the source clip only, cplaced the destination clip. Can be one of these strings:&lt;br /&gt;
:::*&amp;quot;MPEG1&amp;quot;, &amp;quot;JPEG&amp;quot; &amp;quot;center&amp;quot;	: 4:2:0 subsampling used in MPEG-1 and JPEG. Chroma samples are located on the center of each group of 4 pixels.&lt;br /&gt;
:::*&amp;quot;MPEG2&amp;quot;, &amp;quot;left&amp;quot;		: Subsampling used in MPEG-2 4:2:x and most other formats. Chroma samples are located on the left pixel column of the group.&lt;br /&gt;
:::*&amp;quot;DV&amp;quot;			: For 4:2:0 modes, it’s like MPEG-2 but U and V channels are “co-sited” vertically: V on the top row, and U on the bottom row. For 4:1:1, chroma is located on the leftmost column.&lt;br /&gt;
:::*&amp;quot;top_left&amp;quot;, &amp;quot;tl&amp;quot;		: Chroma samples are located on the top-left luma sample of each pixel group.&lt;br /&gt;
:::The chroma placement is ignored when center is set to False or kernel to &amp;quot;point&amp;quot;. You’ll find below an overview of common chroma placement and subsampling combinations:&lt;br /&gt;
Chroma placement&lt;br /&gt;
(image:https://raw.githubusercontent.com/EleonoreMizo/fmtconv/master/doc/colorspace-subsampling.png)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|interlaced|int|2}}&lt;br /&gt;
::{{Par2|interlacedd|int|(interlaced)}}&lt;br /&gt;
:::Specifies if the clip is made of frames or fields. interlacedd overrides interlaced for output.&lt;br /&gt;
:::*0	: Frames are progressive content.&lt;br /&gt;
:::*1	: Frames are actually the separated fields of an interlaced stream. Specify tff or provide the _Field property in all the frames.&lt;br /&gt;
:::*2	: Automatic detection, depends on the _FieldBased frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tff|int|2}}&lt;br /&gt;
::{{Par2|tffd|int|tff}}&lt;br /&gt;
:::When processing interlaced content, specifies the field parity. tffd overrides tff for output.&lt;br /&gt;
:::*0	: Bottom field first (BFF). This means all even fields are top, and all odd fields are bottom.&lt;br /&gt;
:::*1	: Top field first (TFF). This means all even fields are bottom, and all odd fields are top.&lt;br /&gt;
:::*2	: Automatic detection, depends on the _Field frame property. If not found, the frame is considered progressive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|false}}&lt;br /&gt;
:::Flag to force floating point operations. When set to False, integer operations are used, but only if both input and output formats are integer. If it’s not the case, floating point operations are silently used as fallback.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set. −1: automatic (no limitation), 0: , 1: , .&lt;br /&gt;
:::*-1	: automatic (no limitation).&lt;br /&gt;
:::*0	: default instruction set only (depends on the compilation settings).&lt;br /&gt;
:::*1	: limit to SSE2.&lt;br /&gt;
:::*10	: limit to AVX2.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-06-27T19:16:57Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: small additions to fmtc_resample&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r24&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases fmtconv-r24.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|undefined}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|undefined}}&lt;br /&gt;
::{{Par2|matd|bool|undefined}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sx|arrayf|(0)}}&lt;br /&gt;
::{{Par2|sy|arrayf|(0)}}&lt;br /&gt;
:::Coordinate of the top-left corner of the picture sub-area used as source for the resizing. They can be fractional. If negative, the picture is extended by replicating the left pixel column.&lt;br /&gt;
:::These parameters are arrays, so it’s possible to specify a different value for each plane. The last value is used for the unspecified planes. The coordinates are always related to the pixel dimensions, you don’t need to scale them with the chroma subsampling.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sw|arrayf|(0)}}&lt;br /&gt;
::{{Par2|sh|arrayf|(0)}}&lt;br /&gt;
:::Size in pixels of the sub-area to resize. They can be fractional. If 0, the area has the same size as the source clip. If negative, they define coordinates relative to the bottom-right corner, in a Crop-like manner. These parameters are arrays like sx and sy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|scale|float|(0)}}&lt;br /&gt;
::{{Par2|scaleh|float|(0)}}&lt;br /&gt;
::{{Par2|scalev|float|(0)}}&lt;br /&gt;
:::Use these parameters to set relative dimensions, &amp;gt; 0. For example scale=0.5 will halve the picture size. The computed dimensions will be compatible with the destination chroma subsampling. Zero is ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|kernel|string|&amp;quot;spline36&amp;quot;}}&lt;br /&gt;
:::Kernel used by the resizer. Possible values are:&lt;br /&gt;
:::*&amp;quot;point&amp;quot;		: Nearest neighbour interpolation. Same as [[Resize#PointResize|PointResize]].&lt;br /&gt;
:::*&amp;quot;rect&amp;quot;, &amp;quot;box&amp;quot;	: Box filter.&lt;br /&gt;
:::*&amp;quot;linear&amp;quot;, &amp;quot;bilinear&amp;quot;: Bilinear interpolation. Same as [[Resize#BilinearResize|BilinearResize]].&lt;br /&gt;
:::*&amp;quot;cubic&amp;quot;, &amp;quot;bicubic&amp;quot;	: Bicubic interpolation. Same as [[Resize#BicubicResize|BicubicResize]]. The b and c variables are mapped on a1 and a2 and are both set to 1/3 by default.&lt;br /&gt;
:::*&amp;quot;lanczos&amp;quot;		: Sinc function windowed by the central lobe of a sinc. Use taps to specify its impulse length. Same as [[Resize#LanczosResize|LanczosResize]].&lt;br /&gt;
:::*&amp;quot;blackman&amp;quot;		: Blackman-Harris windowed sinc. Use taps to control its length. Same as [[Resize#BlackmanResize|BlackmanResize]].&lt;br /&gt;
:::*&amp;quot;blackmanminlobe&amp;quot;	: Another kind of Blackman windowed sinc, with a bit less ringing. Use taps for you know what.&lt;br /&gt;
:::*&amp;quot;spline16&amp;quot;		: Standard cubic spline based kernel, 4 sample points. Same as [[Resize#Spline_based_resizers|Spline16Resize]].&lt;br /&gt;
:::*&amp;quot;spline36&amp;quot;		: Spline, 6 sample points. Same as [[Resize#Spline_based_resizers|Spline36Resize]].&lt;br /&gt;
:::*&amp;quot;spline64&amp;quot;		: Spline, 8 sample points. Same as [[Resize#Spline_based_resizers|Spline64Resize]].&lt;br /&gt;
:::*&amp;quot;spline&amp;quot;		: Generic natural cubic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a more or less Spline144Resize equivalent.&lt;br /&gt;
:::*&amp;quot;gauss&amp;quot;, &amp;quot;gaussian&amp;quot;	: Gaussian kernel. The p parameter is mapped on a1 and controls the curve width. The higher p, the sharper. It is set to 30 by default. This resizer is the same as [[Resize#GaussResize|GaussResize]], but taps offers a control on the filter impulse length. For low p values (soft and blurry), it’s better to increase the number of taps to avoid truncating the gaussian curve too early and creating artifacts.&lt;br /&gt;
:::*&amp;quot;sinc&amp;quot;		: Truncated sinc function. Use taps to control its length. Same as [[Resize#SincResize|SincResize]].&lt;br /&gt;
:::*&amp;quot;impulse&amp;quot;		: Custom kernel. See the impulse parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-05-13T20:30:51Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: smaller additions, need a break&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r24&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases fmtconv-r24.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|undefined}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|undefined}}&lt;br /&gt;
::{{Par2|matd|bool|undefined}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*7:	limit to AVX&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_resample ==&lt;br /&gt;
Resizes the planes of a clip. This function can change the chroma subsampling.&lt;br /&gt;
&lt;br /&gt;
Output is always 16-bit integer (default for integer input) or 32-bit float. Use fmtc.bitdepth to convert the result to a lower bitdepth. It is possible to select the internal precision: float, or 16-bit integers with a 32-bit accumulator for the convolution. Internal conversion from float or 32-bit integers to 16 bits is done by quick rounding (no dithering). The integer operation path is available only when input and output formats are integer too.&lt;br /&gt;
&lt;br /&gt;
The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the [[Internal_functions#Field|_Field]] and [[Internal_functions#FieldBased|_FieldBased]] frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.&lt;br /&gt;
&lt;br /&gt;
Excepted impulse*, array parameters allow to specify plane-specific values. When specifying less than 3 values, the last specified value will be reused for the next planes. However planes works slightly differently, check the related paragraph for details.&lt;br /&gt;
&lt;br /&gt;
Arrays can be specified as values printed in a string and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
*Note: field resizing is not always the best way to handle interlaced content, especially for upscales. You’ll probably have better results by using a “smart” deinterlacer (making use of temporal information and anti-aliasing), resizing the progressive content at double rate then reinterlacing. Simple field resampling is more or less equivalent to this method, using a naive bob.&lt;br /&gt;
&lt;br /&gt;
Interlacing parameters are automatically detected with global clip information which can be overriden by frame properties.&lt;br /&gt;
&lt;br /&gt;
The function can also be used to compute horizontal and vertical convolutions. If you do so, don’t forget to set:&lt;br /&gt;
&lt;br /&gt;
*fh or fv to −1 to make sure the clip is processed even if its size doesn’t change;&lt;br /&gt;
*cnorm to false to avoid automatic kernel normalisation if your impulse is already normalised, or specify total if the normalisation factor is not the sum of the impulse;&lt;br /&gt;
*and center to False to keep the desired spacing between the sampling points.&lt;br /&gt;
&lt;br /&gt;
The function handles the following frame properties:&lt;br /&gt;
 &lt;br /&gt;
 Property         |Read condition                 |Write condition&lt;br /&gt;
 -----------------+-------------------------------+----------------------------&lt;br /&gt;
 _FieldBased      |Automatic interlacing detection|Interlaced content&lt;br /&gt;
 _Field           |Interlaced content             |Interlaced content&lt;br /&gt;
 _ChromaLocation  |(none)                         |Depends on cplace parameters&lt;br /&gt;
 _ColorRange      |(none)                         |fulld is explicitly set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_resample (clip c, int w, int h, arrayf sx, arrayf sy, arrayf sw, arrayf sh, float scale, float scaleh, float scalev, string kernel, string kernelh, string kernelv, arrayf impulse, arrayf impulseh, arrayf impulsev, arrayi taps, arrayi tapsh, arrayi tapsv, arrayf a1, arrayf a2, arrayf a3, arrayf a1h, arrayf a2h, arrayf a3h, arrayf a1v, arrayf a2v, arrayf a3v, int kovrspl, arrayf fh, arrayf fv, bool cnorm, arrayf total, arrayf totalh, arrayf totalv, arrayb invks, arrayb invksh, arrayb invksv, arrayi invkstaps, arrayi invkstapsh, arrayi invkstapsv, string csp, string css, arrayf planes, int fulls, int fulld, arrayb center, string cplace, string cplaces, string cplaced, int interlaced, int interlacedd, int tff, int tffd, bool flt, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Clip to be resized&lt;br /&gt;
:::Supports all the mentioned input formats at the top + 9-bit YUV (YUV410).&lt;br /&gt;
::{{Par2|w|int|(undefined)}}&lt;br /&gt;
::{{Par2|h|int|(undefined)}}&lt;br /&gt;
:::New picture width and height in pixels, &amp;gt; 0. If not specified, it will keep the original dimensions. The dimensions must be compatible with the destination chroma subsampling. They take precedence over the scale, scaleh and scalev parameters.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-05-13T20:04:29Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: table completed!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r24&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases fmtconv-r24.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focused primarily on quality and exactness rather than execution speed. This does not mean it is slow or un-optimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|undefined}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|undefined}}&lt;br /&gt;
::{{Par2|matd|bool|undefined}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x        |y        |Description&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,    0.330    |ITU-R BT.709-5&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,    0.600    |ITU-R BT.1361&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,    0.060    |IEC 61966-2-1 (sRGB or sYCC)&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,   0.3290   |IEC 61966-2-4&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |                   |Annex B of SMPTE RP 177 (1993)&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,    0.330    |ITU-R BT.470-6 System M (historical)&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,    0.710    |NTSC (1953)&lt;br /&gt;
               |B             |0.140,    0.080    |FCC&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,    0.330    |ITU-R BT.470-6 System M — Japan (NTSC-J)&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.140,    0.080    |&lt;br /&gt;
               |W (9305K)     |0.2848,   0.2932   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,    0.330    |ITU-R BT.470-6 System B, G (historical)&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,    0.600    |ITU-R BT.601-6 625&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,    0.060    |ITU-R BT.1358 625&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1700 625 PAL and 625 SECAM&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |                   |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |                   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,    0.340    |SMPTE 170M (2004)&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,    0.595    |SMPTE 240M (1999)&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,    0.070    |ITU-R BT.601-6 525&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127,   0.3290   |ITU-R BT.1358 525&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |                   |ITU-R BT.1700 NTSC&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,    0.319    |Generic film (colour filters using Illuminant C)&lt;br /&gt;
               |G (Wratten 58)|0.243,    0.692    |&lt;br /&gt;
               |B (Wratten 47)|0.145,    0.049    |&lt;br /&gt;
               |W (C)         |0.3100,   0.3160   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,  0.29203  |ITU-R BT.2020&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,  0.79652  |ITU-R BT.2100&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,  0.04588  |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,    0.330    |IEC 61966-2-4 (scRGB)&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,    0.600    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271,  0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,    0.330    |Adobe RGB (1998)&lt;br /&gt;
               |G             |0.210,    0.710    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |                                                               &lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,  0.26531  |Adobe Wide Gamut RGB&lt;br /&gt;
               |G             |0.11416,  0.82621  |&lt;br /&gt;
               |B             |0.15664,  0.01770  |&lt;br /&gt;
               |W (50)        |0.34567,  0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,    0.265    |Apple RGB&lt;br /&gt;
               |G             |0.280,    0.826    |&lt;br /&gt;
               |B             |0.155,    0.018    |&lt;br /&gt;
               |W (65)        |0.31271   0.32902  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,   0.2653   |PhotoPro&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,   0.8404   |ROMM&lt;br /&gt;
               |B             |0.0366,   0.0001   |&lt;br /&gt;
               |W (50)        |0.34567   0.35850  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,   0.2653   |CIE RGB (1931)&lt;br /&gt;
               |G             |0.2738,   0.7174   |&lt;br /&gt;
               |B             |0.1666,   0.0089   |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,      0.0      |CIE XYZ (1931)&lt;br /&gt;
               |G             |0.0,      1.0      |&lt;br /&gt;
               |B             |0.0,      0.0      |&lt;br /&gt;
               |W (E)         |1 / 3,    1 / 3    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-DCI&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE RP 431-2&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W             |0.314,    0.351    |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,    0.320    |SMPTE ST 2113 P3-D65&lt;br /&gt;
               |G             |0.265,    0.690    |SMPTE EG 432-1&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,    0.320    |ACES P3-D60&lt;br /&gt;
               |G             |0.265,    0.690    |&lt;br /&gt;
               |B             |0.150,    0.060    |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,    0.340    |EBU Tech. 3213-E&lt;br /&gt;
               |G             |0.295,    0.605    |&lt;br /&gt;
               |B             |0.155,    0.077    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,   0.2653   |ACES&lt;br /&gt;
               |G             |0.0,      1.0      |SMPTE ST 2065-1&lt;br /&gt;
               |B             |0.0001,   -0.077   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,    0.293    |ACEScc/ACESproxy AP1&lt;br /&gt;
               |G             |0.165,    0.830    |&lt;br /&gt;
               |B             |0.128,    -0.044   |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,    0.280    |Sony S-Gamut&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,    0.855    |Sony S-Gamut3&lt;br /&gt;
               |B             |0.100,    -0.050   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,    0.275    |Sony S-Gamut3.Cine&lt;br /&gt;
               |G             |0.225,    0.800    |&lt;br /&gt;
               |B             |0.089,    -0.087   |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,   0.3130   |Arri ALEXA&lt;br /&gt;
               |G             |0.2210,   0.8480   |&lt;br /&gt;
               |B             |0.0861,   -0.1020  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,    0.280    |Panasonic V-Gamut&lt;br /&gt;
               |G             |0.165,    0.840    |&lt;br /&gt;
               |B             |0.100,    -0.03    |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,    0.340    |Sony P22&lt;br /&gt;
               |G             |0.280,    0.595    |&lt;br /&gt;
               |B             |0.280,    0.070    |&lt;br /&gt;
               |D(93)         |0.28315,  0.29711  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,   0.2653   |Free Scale-gamut&lt;br /&gt;
               |G             |0.140,    0.860    |&lt;br /&gt;
               |B             |0.100,    −0.02985 |&lt;br /&gt;
               |W (65)        |0.31272,  0.32903  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,   0.3130   |DaVinci wide gamut&lt;br /&gt;
               |G             |0.1682,   0.9877   |&lt;br /&gt;
               |B             |0.0790,   −0.1155  |&lt;br /&gt;
               |W (65)        |0.3127,   0.3290   |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,  0.32783  |DRAGONcolor&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.07964,  -0.05494 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,  0.32783  |DRAGONcolor2&lt;br /&gt;
               |G             |0.29957,  0.70070  |&lt;br /&gt;
               |B             |0.14501,  0.05110  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,  0.32905  |REDcolor&lt;br /&gt;
               |G             |0.30426,  0.62364  |&lt;br /&gt;
               |B             |0.13491,  0.03472  |&lt;br /&gt;
               |W (60)        |0.32168,  0.03472  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |0.87868,  0.32496  |REDcolor2&lt;br /&gt;
               |G             |0.30089,  0.67905  |&lt;br /&gt;
               |B             |0.09540,  −0.02939 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |0.70118,  0.32901  |REDcolor3&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.10815,  −0.00869 |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |0.70118,  0.32901  |REDcolor4&lt;br /&gt;
               |G             |0.30060,  0.68379  |&lt;br /&gt;
               |B             |0.14533,  0.05162  |&lt;br /&gt;
               |W (60)        |0.32168,  0.33767  |&lt;br /&gt;
 --------------+--------------+---------+---------+--------------&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |0.780308, 0.304253 |REDWideGamutRGB&lt;br /&gt;
               |G             |0.121595, 1.493994 |&lt;br /&gt;
               |B             |0.095612, −0.084589|&lt;br /&gt;
               |W (65)        |0.3217,   0.3290   |&lt;br /&gt;
:::Note: the values above were inserted in the wiki manually. In case of doubt, you should check the official docs first and foremost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-05-13T18:42:04Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: more additions, WIP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r24&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases fmtconv-r24.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focussed primarily on quality and exactness rather than execution speed. This does not mean it is slow or unoptimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|undefined}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|undefined}}&lt;br /&gt;
::{{Par2|matd|bool|undefined}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::The destination format. It cannot change the data type (integer or float) nor the chroma subsampling. If the colorspace family is set to Y, single-plane processing is enabled. The output plane is selected with singleout (0 if not specified). Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|col_fam|string|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination color family, as Vapoursynth constant. Supersedes the color family from csp. You can only specify colorspace with the same number of planes as the input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. However you cannot reduce the bitdepth, only keep it constant or increase it. Supersedes the bitdepth from csp.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|singleout|int|-1}}&lt;br /&gt;
:::Enable single-plane processing. This is useful to obtain only the luma from an R’G’B’ input, for example. The parameter is the plane index, ranging from 0 to 2. A negative value specifies that all planes should be processed. If singleout is ≥ 0, it supersedes the colorspace family specified in csp.&lt;br /&gt;
:::Note: when extracting a chroma plane, results between int with TV range and float data type may slightly differ. This is because in float, a neutral chroma (0%) is converted to the exact value of a medium gray (50%). In integer, the chroma output value is mapped 1–1 to the luma channel. However in TV-range, medium gray is not located exactly at the half of the data range, it lies slightly below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix2020cl ==&lt;br /&gt;
Colorspace conversion using the ITU-R BT.2020 constant luminance matrix.&lt;br /&gt;
&lt;br /&gt;
The function converts between linear RGB and Y’Cb’Cr’ colorspaces. This conversion cannot be achieve with a classic linear matrix. The output colorspace, hence the direction of the conversion, is automatically deduced from the input colorspace.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The RGB colorspace is always 16 bits when using integers, or 32 bits in float. The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
Please note that the RGB content is always assumed to be linear light. The BT.2020 gamma curve is used in both directions. When operating on floating point data, the function uses the 12-bit variant of the scaling coefficients.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Matrix|_Matrix]], [[Internal_functions#ColorSpace|_ColorSpace]] and [[Internal_functions#Transfer|_Transfer]] frame properties are set according to the transformation. The [[Internal_functions#ColorRange|_ColorRange]] property is set if the full parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix2020cl (clip c, bool full, string csp, int bits, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::For RGB, only 16-bit clips are supported&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|full|bool|false}}&lt;br /&gt;
:::Indicates if the Y’Cb’Cr’ clip is full-range (True) or TV-range (False). Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|csp|string|(undefined)}}&lt;br /&gt;
:::It must be compatible with what is logically expected as output (RGB or YUV). It cannot change the data type (integer or float) nor the chroma subsampling. If the output is integer RGB, the bitdepth must be 16. Only planar colorspaces are allowed.&lt;br /&gt;
:::The format is a string with the same kind of content as the result from [[Internal_functions#BuildPixelType | BuildPixelType]] or the pixel_type parameter from BlankClip. For example: &amp;quot;RGBP48&amp;quot;, &amp;quot;YV12&amp;quot;, &amp;quot;YUV444PS&amp;quot;…&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|(undefined)}}&lt;br /&gt;
:::Explicit specification of the destination bitdepth. The only allowed values are 8, 10, 12, 14, 16 and 32. They are restricted by the output data type and format (16 bits for integer RGB). Supersedes the bitdepth from csp.&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_primaries ==&lt;br /&gt;
Performs a gamut conversion given a set of three primary colors and a reference white to another set of primary colors and a target reference white. Illuminant conversions are done using the Bradford method.&lt;br /&gt;
&lt;br /&gt;
Pixel values are left intact after the transform, they are not bound to the target gamut and could be invalid colors. However, when using 16-bit unsigned integer they are clipped to representable data values.&lt;br /&gt;
&lt;br /&gt;
All colors are given in xyY colorspace, with their x and y coordinates.&lt;br /&gt;
&lt;br /&gt;
You must supply the full description of the original and target gamuts, with the built-in presets or by setting individual components.&lt;br /&gt;
&lt;br /&gt;
Please note that this function does not work at the same level as matrix. The latter converts between gamma-compressed RGB and YUV-like colorspaces, while primaries operates on linear RGB colorspaces exclusively, whose specifications are given by the primaries. For more details, see [https://web.archive.org/web/20220306120040/http://poynton.ca/PDFs/Guided_tour.pdf|Charles Poynton, A Guided Tour of Color Space, 1997].&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#Primaries|_Primaries]] frame property is set or deleted, depending on the target gamut.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|fmtc_primaries (clip c,	arrayf rs, arrayf gs, arrayf bs,arrayf ws, arrayf rd, arrayf gd, arrayf bd, arrayf wd, string prims, string primd, int cpuopt)}}&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
:::Supported colorspaces are 16- or 32-bit linear RGB. You should use the transfer function to convert between linear RGB and gamma-compressed R’G’B ’colorspaces.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rs|array|(undefined)}}&lt;br /&gt;
::{{Par2|gs|array|(undefined)}}&lt;br /&gt;
::{{Par2|bs|array|(undefined)}}&lt;br /&gt;
::{{Par2|ws|array|(undefined)}}&lt;br /&gt;
:::Primaries for the source colorspace as red, green, blue and reference white. Each variable contains two components, x and y, in this order. The y value cannot be null.&lt;br /&gt;
:::Parameters can be arrays of two float values if supported by the scripting language, or strings containing both values printed and separated with a space.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|rd|array|(undefined)}}&lt;br /&gt;
::{{Par2|gd|array|(undefined)}}&lt;br /&gt;
::{{Par2|bd|array|(undefined)}}&lt;br /&gt;
::{{Par2|wd|array|(undefined)}}&lt;br /&gt;
:::Primaries for the target colorspace. If not specified, the value is copied from the source colorspace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|prims|string|(undefined)}}&lt;br /&gt;
::{{Par2|primd|string|(undefined)}}&lt;br /&gt;
:::Primaries presets for the source and destination colorspaces. Superseded by individual r, g, b and w settings. Possible values are:&lt;br /&gt;
&lt;br /&gt;
 Value         |Primary       |x&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;709&amp;quot; or      |R             |0.640,&lt;br /&gt;
 &amp;quot;1361&amp;quot; or     |G             |0.300,&lt;br /&gt;
 &amp;quot;61966-2-1&amp;quot; or|B             |0.150,&lt;br /&gt;
 &amp;quot;61966-2-4&amp;quot; or|W(65)         |0.3127,&lt;br /&gt;
 &amp;quot;hdtv&amp;quot; or     |              |&lt;br /&gt;
 &amp;quot;srgb&amp;quot; or     |              |&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;470m&amp;quot; or     |R             |0.670,&lt;br /&gt;
 &amp;quot;ntsc&amp;quot;        |G             |0.210,&lt;br /&gt;
               |B             |0.140,&lt;br /&gt;
               |W (C)         |0.3100,&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;470m93&amp;quot; or   |R             |0.670,&lt;br /&gt;
 &amp;quot;ntscj&amp;quot;       |G             |0.210,&lt;br /&gt;
               |B             |0.140,&lt;br /&gt;
               |W (9305K)     |0.2848,&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;470bg&amp;quot; or    |R             |0.640,&lt;br /&gt;
 &amp;quot;601-625&amp;quot; or  |G             |0.290,&lt;br /&gt;
 &amp;quot;1358-625&amp;quot; or |B             |0.150,&lt;br /&gt;
 &amp;quot;1700-625&amp;quot; or |W (65)        |0.3127,&lt;br /&gt;
 &amp;quot;pal&amp;quot; or      |              |&lt;br /&gt;
 &amp;quot;secam&amp;quot;       |              |&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;170m&amp;quot; or     |R             |0.630,&lt;br /&gt;
 &amp;quot;240m&amp;quot; or     |G             |0.310,&lt;br /&gt;
 &amp;quot;601-525&amp;quot; or  |B             |0.155,&lt;br /&gt;
 &amp;quot;1358-525&amp;quot; or |W (65)        |0.3127&lt;br /&gt;
 &amp;quot;1700-525&amp;quot;    |              |&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;filmc&amp;quot;       |R (Wratten 25)|0.681,&lt;br /&gt;
               |G (Wratten 58)|0.243,&lt;br /&gt;
               |B (Wratten 47)|0.145,&lt;br /&gt;
               |W (C)         |3100&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;2020&amp;quot; or     |R             |0.70792,&lt;br /&gt;
 &amp;quot;2100&amp;quot; or     |G             |0.17024,&lt;br /&gt;
 &amp;quot;uhdtv&amp;quot;       |B             |0.13137,&lt;br /&gt;
               |W (65)        |0.31271&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;61966-2-2&amp;quot; or|R             |0.640,&lt;br /&gt;
 &amp;quot;scrgb&amp;quot;       |G             |0.300,&lt;br /&gt;
               |B             |0.150,&lt;br /&gt;
               |W (65)        |0.31271&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;adobe98&amp;quot;     |R             |0.640,&lt;br /&gt;
               |G             |0.210,&lt;br /&gt;
               |B             |0.150,&lt;br /&gt;
               |W (65)        |0.31271&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;adobewide&amp;quot;   |R             |0.73469,&lt;br /&gt;
               |G             |0.11416,&lt;br /&gt;
               |B             |0.15664,&lt;br /&gt;
               |W (50)        |0.34567&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;apple&amp;quot;       |R             |0.625,&lt;br /&gt;
               |G             |0.280,&lt;br /&gt;
               |B             |0.155,&lt;br /&gt;
               |W (65)        |0.31271&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;photopro&amp;quot; or |R             |0.7347,&lt;br /&gt;
 &amp;quot;romm&amp;quot;        |G             |0.1596,&lt;br /&gt;
               |B             |0.0366,&lt;br /&gt;
               |W (50)        |0.34567&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;ciergb&amp;quot;      |R             |0.7347,&lt;br /&gt;
               |G             |0.2738,&lt;br /&gt;
               |B             |0.1666,&lt;br /&gt;
               |W (E)         |1 / 3&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;ciexyz&amp;quot;      |R             |1.0,&lt;br /&gt;
               |G             |0.0,&lt;br /&gt;
               |B             |0.0,&lt;br /&gt;
               |W (E)         |1 / 3&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;p3dci&amp;quot;       |R             |0.680,&lt;br /&gt;
               |G             |0.265,&lt;br /&gt;
               |B             |0.150,&lt;br /&gt;
               |W             |0.314&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;p3d65&amp;quot;       |R             |0.680,&lt;br /&gt;
               |G             |0.265,&lt;br /&gt;
               |B             |0.150,&lt;br /&gt;
               |W (65)        |0.3127&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;p3d60&amp;quot;       |R             |0.680,&lt;br /&gt;
               |G             |0.265,&lt;br /&gt;
               |B             |0.150,&lt;br /&gt;
               |W (60)        |0.32168&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;3213&amp;quot;        |R             |0.630,&lt;br /&gt;
               |G             |0.295,&lt;br /&gt;
               |B             |0.155,&lt;br /&gt;
               |W (65)        |0.3127&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;aces&amp;quot;        |R             |0.7347,&lt;br /&gt;
               |G             |0.0,&lt;br /&gt;
               |B             |0.0001,&lt;br /&gt;
               |W (60)        |0.32168,&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;ap1&amp;quot;         |R             |0.713,&lt;br /&gt;
               |G             |0.165,&lt;br /&gt;
               |B             |0.128,&lt;br /&gt;
               |W (60)        |0.32168,&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;sgamut&amp;quot; or   |R             |0.730,&lt;br /&gt;
 &amp;quot;sgamut3&amp;quot;     |G             |0.140,&lt;br /&gt;
               |B             |0.100,&lt;br /&gt;
               |W (65)        |0.3127&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;sgamut3cine&amp;quot; |R             |0.766,&lt;br /&gt;
               |G             |0.225,&lt;br /&gt;
               |B             |0.089,&lt;br /&gt;
               |W (65)        |0.3127&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;alexa&amp;quot;       |R             |0.6840,&lt;br /&gt;
               |G             |0.2210,&lt;br /&gt;
               |B             |0.0861,&lt;br /&gt;
               |W (65)        |0.3127&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;vgamut&amp;quot;      |R             |0.730,&lt;br /&gt;
               |G             |0.165,&lt;br /&gt;
               |B             |0.100,&lt;br /&gt;
               |W (65)        |0.3127&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;p22&amp;quot;         |R             |0.625,&lt;br /&gt;
               |G             |0.280,&lt;br /&gt;
               |B             |0.280,&lt;br /&gt;
               |D(93)         |0.28315&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;fs&amp;quot;          |R             |0.7347,&lt;br /&gt;
               |G             |0.140,&lt;br /&gt;
               |B             |0.100,&lt;br /&gt;
               |W (65)        |0.31272&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;davinci&amp;quot;     |R             |0.8000,&lt;br /&gt;
               |G             |0.1682,&lt;br /&gt;
               |B             |0.0790,&lt;br /&gt;
               |W (65)        |0.3127&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;dragon&amp;quot;      |R             |0.75304,&lt;br /&gt;
               |G             |0.29957,&lt;br /&gt;
               |B             |0.07964,&lt;br /&gt;
               |W (60)        |0.32168,&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;dragon2&amp;quot;     |R             |0.75304,&lt;br /&gt;
               |G             |0.29957,&lt;br /&gt;
               |B             |0.14501,&lt;br /&gt;
               |W (60)        |0.32168,&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;red&amp;quot;         |R             |0.69975,&lt;br /&gt;
               |G             |0.30426,&lt;br /&gt;
               |B             |&lt;br /&gt;
               |W (60)        |&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;red2&amp;quot;        |R             |&lt;br /&gt;
               |G             |&lt;br /&gt;
               |B             |&lt;br /&gt;
               |W (60)        |&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;red3&amp;quot;        |R             |&lt;br /&gt;
               |G             |&lt;br /&gt;
               |B             |&lt;br /&gt;
               |W (60)        |&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;red4&amp;quot;        |R             |&lt;br /&gt;
               |G             |&lt;br /&gt;
               |B             |&lt;br /&gt;
               |W (60)        |&lt;br /&gt;
 --------------+--------------+&lt;br /&gt;
 &amp;quot;redwide&amp;quot;     |R             |&lt;br /&gt;
               |G             |&lt;br /&gt;
               |B             |&lt;br /&gt;
               |W (65)        |&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/Fmtconv</id>
		<title>Fmtconv</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Fmtconv"/>
				<updated>2022-05-13T16:02:20Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: filling the page with a load of stuff, saving WIP changes in case of dataloss&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Resizers|Deep_color_tools}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|1={{Author/cretindesalpes}}&lt;br /&gt;
|2=r24&lt;br /&gt;
|3=[https://github.com/EleonoreMizo/fmtconv/releases fmtconv-r24.zip]&lt;br /&gt;
|4=Resize &lt;br /&gt;
|5=Open source&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=183139 Doom9 Forum]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
[[fmtconv]] is a format-conversion plug-in for the VapourSynth and AviSynth+ video processing engines. It does:&lt;br /&gt;
&lt;br /&gt;
*Resizing.&lt;br /&gt;
*Bitdepth conversion with dithering.&lt;br /&gt;
*Colorspace conversion (matrix, transfer characteristics and chromatic adaptation).&lt;br /&gt;
&lt;br /&gt;
It supports:&lt;br /&gt;
&lt;br /&gt;
*Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float.&lt;br /&gt;
*Colorspaces: RGB, Y, YUV in 4:4:4, 4:2:2, 4:2:0, 4:1:1 and YCgCo with the same chroma subsampling factors.&lt;br /&gt;
*Progressive and interlaced content.&lt;br /&gt;
&lt;br /&gt;
Fmtconv is focussed primarily on quality and exactness rather than execution speed. This does not mean it is slow or unoptimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters.&lt;br /&gt;
&lt;br /&gt;
See doc/fmtconv.html for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* [[AviSynth+]] 3.7.0 x86/x64&lt;br /&gt;
* Supported color formats: all [[planar]] formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_bitdepth ==&lt;br /&gt;
Bitdepth conversion with optional dithering.&lt;br /&gt;
&lt;br /&gt;
Dithering is performed when meeting at least one of these conditions:&lt;br /&gt;
*Reducing the bitdepth of integer data, or converting from float to integer.&lt;br /&gt;
*Doing a full-range ↔ TV-range conversion between integer formats, because the resulting values haven’t an exact representation.&lt;br /&gt;
&lt;br /&gt;
Video compression seems to retrain better pure ordered (Bayer) dithering. Therefore this is the recommended method to avoid color banding in 8 bit signals, unless you encode at high bitrates. If you don’t care about video compression, error diffusion, void and cluster and quasirandom sequence methods give the most accurate results. To avoid discontinuities between purely flat areas and dithered areas (also called noise modulation), you can add a bit of noise, ideally in triangular distribution.&lt;br /&gt;
&lt;br /&gt;
The internal noise generator is deterministic and will give the same result each run.&lt;br /&gt;
&lt;br /&gt;
The internal processing is done in floating point as soon as the input is floating point or a range conversion is detected.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
:{{Template:FuncDef|fmtc_bitdepth (clip c, int &amp;quot;bits&amp;quot;, bool &amp;quot;flt&amp;quot;, string &amp;quot;planes&amp;quot;, bool &amp;quot;fulls&amp;quot;, bool &amp;quot;fulld&amp;quot;, int &amp;quot;dmode&amp;quot;, float &amp;quot;ampo&amp;quot;,float &amp;quot;ampn&amp;quot;,bool &amp;quot;dyn&amp;quot;, bool &amp;quot;staticnoise&amp;quot;, int &amp;quot;cpuopt&amp;quot;, int  &amp;quot;patsize&amp;quot;, bool &amp;quot;tpdfo&amp;quot;, bool &amp;quot;tpdfn&amp;quot;,bool &amp;quot;corplane&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|bits|int|-1}}&lt;br /&gt;
:::Destination bitdepth. A negative value means that the parameter is left undefined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|flt|bool|undefined}}&lt;br /&gt;
:::Set it to 1 to convert to float, and to 0 for integer data. As long as only 32-bit floating point data is supported, you don’t need to specify the bitdepth for a float conversion.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|planes|string|&amp;quot;all&amp;quot;}}&lt;br /&gt;
:::A list of planes to process. The content of an unprocessed plane should be considered as garbage.&lt;br /&gt;
:::This is a string made of concatenated substrings for each plane, in any order. The planes are identified by their index, as well as the following aliases:&lt;br /&gt;
:::*&amp;quot;0&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;r&amp;quot;	Y or red&lt;br /&gt;
:::*&amp;quot;1&amp;quot;, &amp;quot;u&amp;quot;, &amp;quot;g&amp;quot;	U or green&lt;br /&gt;
:::*&amp;quot;2&amp;quot;, &amp;quot;v&amp;quot;, &amp;quot;b&amp;quot;	V or blue&lt;br /&gt;
:::*&amp;quot;3&amp;quot;, &amp;quot;a&amp;quot;	Alpha channel&lt;br /&gt;
:::*&amp;quot;all&amp;quot;	All the planes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|fulls}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for RGB and YCoCg colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
:::Alpha planes are always processed as full-range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dmode|int|3}}&lt;br /&gt;
:::Dithering mode, when applicable.&lt;br /&gt;
&lt;br /&gt;
:::*0:	Ordered dithering (Bayer matrix).&lt;br /&gt;
:::*1:	No dither, round to the closest value.&lt;br /&gt;
:::*2:	Round, may be a bit faster but possibly less accurate.&lt;br /&gt;
:::*3:	Sierra-2-4A error diffusion, aka “Filter Lite”. Quick and excellent quality, similar to Floyd-Steinberg.&lt;br /&gt;
:::*4:	Stucki error diffusion. Preserves delicate edges better but distorts gradients.&lt;br /&gt;
:::*5:	Atkinson error diffusion. Generates distinct patterns but keeps clean the flat areas (noise modulation).&lt;br /&gt;
:::*6:	Classic Floyd-Steinberg error diffusion, modified for serpentine scan (avoids worm artefacts).&lt;br /&gt;
:::*7:	[https://web.archive.org/web/20180627075311/http://www.iro.umontreal.ca/~ostrom/publications/publications_abstracts.html#SIGGRAPH01_VarcoeffED Ostromoukhov error diffusion]. Slow, available only for integer input at the moment. Avoids usual F-S artefacts.&lt;br /&gt;
:::*8:	Void and cluster halftone dithering. This is a way to generate blue-noise dither and has a much better visual aspect than ordered dithering.&lt;br /&gt;
:::*9:	Dither using [https://web.archive.org/web/20211029094035/http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ quasirandom sequences]. Good intermediated between Void and cluster and error diffusion algorithms.&lt;br /&gt;
&lt;br /&gt;
:::When using error-diffusion dithering on interlaced content, you should separate the fields first before converting them.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampo|float|1.0}}&lt;br /&gt;
:::The ordered dither peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. On error diffusion algorithms, it increases the collected error amount, helping to extend the range of the dithering while preserving its natural pattern (especially Atkinson’s). This gives a better looking result than just adding noise.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|ampn|float|0.0}}&lt;br /&gt;
:::The noise peak-to-peak amplitude, depends on the target bitdepth. ≥ 0. Currently, the maximum value is 4. The noise is added before dithering. It reduces the SNR but a small amount may give a better, more uniform visual appearance.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|dyn|bool|false}}&lt;br /&gt;
:::Indicates if the ordered dither pattern is dynamic (True) or static (False). If dynamic, the pattern is changed or rotated each frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|staticnoise|bool|false}}&lt;br /&gt;
:::If set to true, the noise generated with ampn is static and remains the same every frame.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|cpuopt|int|-1}}&lt;br /&gt;
:::Limits the CPU instruction set.&lt;br /&gt;
:::*−1:	automatic (no limitation)&lt;br /&gt;
:::*0:	default instruction set only (depends on the compilation settings)&lt;br /&gt;
:::*1:	limit to SSE2&lt;br /&gt;
:::*10:	limit to AVX2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|patsize|int|32}}&lt;br /&gt;
:::Width of the pattern used in the Void and cluster algorithm.&lt;br /&gt;
:::*The only valid values are power of 2 ranging from 4 to 1024: 4, 8, 16, 32, 64, 128, 256, 512 and 1024.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfo|bool|false}}&lt;br /&gt;
:::Set it to true to enable the triangular probability distribution function (TPDF) for halftone-based dithering algorithms. It has no effect on error diffusion methods. 0 is the standard rectangular distribution (RPDF).&lt;br /&gt;
:::Note that when triangular distribution is enabled, the maximum halftone amplitude is multiplied by 1.414 at constant ampo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|tpdfn|bool|false}}&lt;br /&gt;
:::Same as tpdfo, but for the additive noise part. TPDF noise looks more natural than RPDF noise, and is a crude approximation of a gaussian noise, with a bounded amplitude. Maximum noise amplitude is multiplied by 1.414 at constant ampn, so the introduced noise power is kept approximately constant.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|corplane|bool|false}}&lt;br /&gt;
:::Set it to true to keep the dither and noise patterns correlated for all the planes. When processing a RGB picture, it helps to prevent colored noise on grey features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Information, [[Script variables|Syntax and Parameters]] for fmtc_matrix ==&lt;br /&gt;
Colorspace conversion or simple cross-plane matrix.&lt;br /&gt;
&lt;br /&gt;
For Y’Cb’Cr’ and Y’Co’Cg’ colorspaces, 4:4:4 is required (no chroma subsampling). To process a subsampled colorspace, you must convert it to 4:4:4 first.&lt;br /&gt;
&lt;br /&gt;
The output is not dithered, therefore you should output at a higher bitdepth than the input and dither afterward with bitdepth to avoid potential banding.&lt;br /&gt;
&lt;br /&gt;
When the destination color family (R’G’B’, Y’Cb’Cr’ or Y’Co’Cg’) is not specified (via col_fam or csp), the function tries to deduce it from the matrix settings and the source color family. If it cannot be deduced, the color family remains unchanged.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn’t do conversions based on the color primaries. The R’G’B’ data are always relative to their specified standard. For example, converting Y’Cb’Cr’ data straight from BT.2020 to BT.709 doesn’t make sense as these colorspaces are defined with different primaries. For meaningful results, convert to R’G’B’ then to linear RGB and use primaries to perform the intermediary conversion.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if the fulld parameter has been explicitely defined. If the destination colorspace is a standardized one (as deduced from the specified matrix), the [[Internal_functions#_Matrix|_Matrix]] and [[Internal_functions#_ColorRange|_ColorRange]] properties are set, otherwise they are deleted from the frame.&lt;br /&gt;
&lt;br /&gt;
If an alpha channel is present in both the source and destination colorspaces, it is copied and its bitdepth is possibly adapted to the destination format. If there is no alpha channel in the source, full opacity is assumed. If there is no alpha channel in the destination, the plane is lost.&lt;br /&gt;
&lt;br /&gt;
The [[Internal_functions#ColorRange|_ColorRange]] frame property is set if at least one of the fulls or fulld parameter has been explicitely defined.&lt;br /&gt;
&lt;br /&gt;
:{{Template:FuncDef|fmtc_matrix (clip c, string mat, string mats, string matd, bool fulls, bool fulld, arrayf coef, string csp, string col_fam, int bits, int singleout, int cpuopt)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|c|clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mat|string|-1}}&lt;br /&gt;
:::Predefined matrix for conversions to and from R’G’B’. The direction is deduced from the specified input and output colorspaces. Possible values are:&lt;br /&gt;
:::*&amp;quot;601&amp;quot;:	ITU-R BT.601 / ITU-R BT.470-2 / SMPTE 170M. For Standard Definition content.&lt;br /&gt;
:::*&amp;quot;709&amp;quot;:	ITU-R BT.709. For High Definition content.&lt;br /&gt;
:::*&amp;quot;2020&amp;quot;:	ITU-R BT.2020, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;2100&amp;quot;:	ITU-R BT.2100, non constant luminance mode. For UHDTV content.&lt;br /&gt;
:::*&amp;quot;240&amp;quot;:	SMPTE 240M&lt;br /&gt;
:::*&amp;quot;FCC&amp;quot;,&lt;br /&gt;
:::*&amp;quot;470-525&amp;quot;:	FCC Title 47&lt;br /&gt;
:::*&amp;quot;YCoCg&amp;quot;,&lt;br /&gt;
:::*&amp;quot;YCgCo&amp;quot;:	Y’Co’Cg’&lt;br /&gt;
:::*&amp;quot;YDzDx&amp;quot;:	Y’D’ZD’X, SMPTE ST 2085&lt;br /&gt;
:::*&amp;quot;RGB&amp;quot;:	R’G’B’. Identity, no cross-plane calculations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mats|bool|undefined}}&lt;br /&gt;
::{{Par2|matd|bool|undefined}}&lt;br /&gt;
:::Source and destinations matrices for YUV. Use both when you want to do a conversion between BT.601 and BT.709. Values are the same as mat, with the addition of:&lt;br /&gt;
:::*&amp;quot;LMS&amp;quot;:	Intermediate colorspace for ICTCP transforms. The LMS colorspace is conveyed on RGB planes.&lt;br /&gt;
:::*&amp;quot;ICtCp_PQ&amp;quot;:	ITU-R BT.2100-2 ICTCP with perceptual quantization (PQ).&lt;br /&gt;
:::*&amp;quot;ICtCp_HLG&amp;quot;:	ITU-R BT.2100-2 ICTCP with hybrid log-gamma transfer function (HLG).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:::When using one of these additional values, make sure to set the other mats or matd with &amp;quot;RGB&amp;quot; to clarify the conversion direction. ICTCP transforms from R’G’B’ require the following steps:&lt;br /&gt;
:::*Convert from R’G’B’ to linear BT.2100 RGB with transfer then possibly primaries.&lt;br /&gt;
:::*Convert from linear BT.2100 RGB to linear LMS using matrix with &amp;quot;LMS&amp;quot;.&lt;br /&gt;
:::*Convert from linear LMS to L’M’S’ using transfer with &amp;quot;2084&amp;quot; or &amp;quot;hlg&amp;quot;.&lt;br /&gt;
:::*Convert from L’M’S’ to ICTCP using matrix with &amp;quot;ICtCp_PQ&amp;quot; or &amp;quot;ICtCp_HLG&amp;quot;, respectively.&lt;br /&gt;
:::For the inverse conversion, reverse the steps. Beware, chromatic information for pixels of the highest luminance range cannot be represented in integer ICTCP and will be clipped because of the large matrix coefficients.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|fulls|bool|(depends)}}&lt;br /&gt;
::{{Par2|fulld|bool|(depends)}}&lt;br /&gt;
:::Indicates if the clip is full-range (True) or TV-range (False). fulls is for input, fulld for output. Reference black and white have different values depending on the range. In 8 bits, pixel values scale from 0 to 255 in full range, and 16 to 235 in TV-range (16 to 240 for the YUV chroma planes). This value has no meaning for float data.&lt;br /&gt;
:::The default value depends on the colorspace. For example, full-range is assumed for R’G’B’ and Y’Co’Cg’ colorspaces. Others are assumed TV-range. These parameters are mainly intended to guide conversions between integer and floating-point data. They can also be used for range conversions. Pixel values are not clipped during a conversion between two TV-range formats.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|coef|arrayf|(undefined)}}&lt;br /&gt;
:::A list of 12 coefficients for a custom matrix. The coefficients should be scaled assuming the input is floating point, even if the actual input is integer. This means luma and R’G’B’ signals range from 0 to 1, and chroma signals from −0.5 to +0.5. Coefficients are listed by rows. Each row is terminated with a fourth coefficient, the additive constant (still in floating-point range). This means the matrix is actually 4×3 and during the multiplication, the input column-vector has an implicit 1 appended to its end. For example, with an R’G’B’ input:&lt;br /&gt;
&lt;br /&gt;
 +- -+   +-               -+   +- -+&lt;br /&gt;
 | Y |	| c0  c1  c2  c3  |   | R | 	Y  = R × c0 + G × c1 + B × c2  + c3 &lt;br /&gt;
 | Cb| = | c4  c5  c6  c7  | × | G | 	Cb = R × c4 + G × c5 + B × c6  + c7 &lt;br /&gt;
 | Cr| 	| c8  c9  c10 c11 |   | B | 	Cr = R × c8 + G × c9 + B × c10 + c11 &lt;br /&gt;
 +- -+   +-               -+   | 1 |&lt;br /&gt;
                               +- -+&lt;br /&gt;
&lt;br /&gt;
::List can be an array of float values if supported by the scripting language, or a string containing the values printed and separated with spaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
See GitHub release page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/EleonoreMizo/fmtconv GitHub] - Source code repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[External_filters#Resizers|External Filters]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/MVTools2/MSuper</id>
		<title>MVTools2/MSuper</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/MVTools2/MSuper"/>
				<updated>2021-11-07T20:02:45Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: Fixing the Eedi3 link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Plugin_Filters]]&lt;br /&gt;
[[Category:Support_filters]]&lt;br /&gt;
'''Back to [[MVTools#Filters|MVTools2]] &amp;amp;larr;'''&lt;br /&gt;
-------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
Gets a source clip and prepares a special '''Super''' clip with multilevel (hierarchical scaled) frames data. The Super clip is used by both [[MAnalyse]] and motion compensation (client) functions.&amp;lt;br&amp;gt;&lt;br /&gt;
The audio properties of the Super clip are used to store and transfer its parameters (specifically ''num_audio_samples''), therefore any existing audio is killed in the Super clip. That is one of reasons why you can additionally use a source clip with client functions. You may have a look to the Super clip yourself (it has a normal format).&amp;lt;br&amp;gt;&lt;br /&gt;
Supported formats: Y, YUV and planar RGB (8-32) bits, and YUY2. You can use a different Super clip to generate vectors with MAnalyze and a different Super clip format for the actual action. This enables support for planar RGB with MFlowFPS, and lets MDegrain work with 32 bit float input clips. &lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
{{FuncDef|MSuper (clip, int &amp;quot;hpad&amp;quot;, int &amp;quot;vpad&amp;quot;, int &amp;quot;pel&amp;quot;, int &amp;quot;levels&amp;quot;, bool &amp;quot;chroma&amp;quot;, &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; int &amp;quot;sharp&amp;quot;, int &amp;quot;rfilter&amp;quot;, clip &amp;quot;pelclip&amp;quot;, bool &amp;quot;isse&amp;quot;, bool &amp;quot;planar&amp;quot;, bool &amp;quot;mt&amp;quot;) }}&lt;br /&gt;
&lt;br /&gt;
:{{Par2|hpad|int|8}}&lt;br /&gt;
::Horizontal padding added to source frame (both left and right). A small padding is added for more correct motion estimation near frame borders. &lt;br /&gt;
&lt;br /&gt;
:{{Par2|vpad|int|8}}&lt;br /&gt;
::Vertical padding added to source frame (both top and bottom), for the same reason as ''hpad''.&lt;br /&gt;
&lt;br /&gt;
:{{Par2|pel|int|2}}&lt;br /&gt;
::Motion estimation accuracy. Value can only be 1, 2 or 4. &lt;br /&gt;
:::*1 : means precision to the pixel. &lt;br /&gt;
:::*2 : means precision to half a pixel. &lt;br /&gt;
:::*4 : means precision to quarter of a pixel, produced by spatial interpolation (more accurate but slower and not always better due to big level scale step). &lt;br /&gt;
&lt;br /&gt;
:{{Par2|levels|int|0}}&lt;br /&gt;
::Number of hierarchical levels for super clip frames. [[MAnalyse]] needs all levels, but for other client functions a single, finest level is enough (coarser levels are not used). 0 is auto (all possible levels are produced). &lt;br /&gt;
&lt;br /&gt;
:{{Par2|chroma|bool|true}}&lt;br /&gt;
::When true, process chroma planes too. False for luma only.&lt;br /&gt;
&lt;br /&gt;
:{{Par2|sharp|int|2}}&lt;br /&gt;
::Sub-pixel interpolation method for when {{FuncArg|pel}} == 2 || 4.&lt;br /&gt;
:::*0 : soft interpolation (bilinear).&lt;br /&gt;
:::*1 : bicubic interpolation (4 tap Catmull-Rom)&lt;br /&gt;
:::*2 : sharper Wiener interpolation (6 tap, similar to Lanczos).&lt;br /&gt;
&lt;br /&gt;
:{{Par2|rfilter|int|2}}&lt;br /&gt;
::Hierarchical levels smoothing and reducing (halving) filter.&lt;br /&gt;
:::* 0 : simple 4 pixels averaging like unfiltered [[SimpleResize]] (old method)&lt;br /&gt;
:::* 1 : triangle (shifted) filter like [[ReduceBy2]] for more smoothing (decreased aliasing)&lt;br /&gt;
:::* 2 : triangle filter like [[BilinearResize]] for even more smoothing&lt;br /&gt;
:::* 3 : quadratic filter for even more smoothing&lt;br /&gt;
:::* 4 : cubic filter like [[BicubicResize]](b=1,c=0) for even more smoothing&lt;br /&gt;
&lt;br /&gt;
:: You may also try to apply some external filter to the''superclip'' or its coarse bottom part (by appropriate crop and overlay).&lt;br /&gt;
&lt;br /&gt;
:{{Par2|pelclip|clip| }}&lt;br /&gt;
::Optional upsampled source clip for using instead of internal sub-pixel interpolation (for {{FuncArg|pel}} &amp;gt; 1).&lt;br /&gt;
::Pixels at rows and columns positions multiple to {{FuncArg|pel}} (0,2,4,... for {{FuncArg|pel}}=2) (without padding) must be original source pixels; other pixels must be interpolated.&lt;br /&gt;
&lt;br /&gt;
::Example for {{Template:FuncDef|pel}}=2:&lt;br /&gt;
&amp;lt;div {{BoxWidthIndent|60|6}} &amp;gt;&lt;br /&gt;
 MSuper(..., pel=2, pelclip=LanczosResize(width*2,height*2,src_left=0.25, src_top=0.25))&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
::Another useful filter for {{FuncArg|pelclip}} is the [[Eedi3]] edge-directed resampler.&lt;br /&gt;
::Recent note: it is true for luma, but is not exactly corresponded to chroma pixels positions of internal '''MVTools''' interpolation. Nevertheless, vectors and motion compensation are quite similar for usual clips, same chroma would be with ''src_left=0.5'' for YUY2 and additionally ''src_top=0.5'' for YV12.{{Clarify}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------&lt;br /&gt;
'''Back to [[MVTools#Filters|MVTools2]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/MVTools2/MSuper</id>
		<title>MVTools2/MSuper</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/MVTools2/MSuper"/>
				<updated>2021-11-07T20:01:19Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: Update to the description and parameters&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Plugin_Filters]]&lt;br /&gt;
[[Category:Support_filters]]&lt;br /&gt;
'''Back to [[MVTools#Filters|MVTools2]] &amp;amp;larr;'''&lt;br /&gt;
-------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
Gets a source clip and prepares a special '''Super''' clip with multilevel (hierarchical scaled) frames data. The Super clip is used by both [[MAnalyse]] and motion compensation (client) functions.&amp;lt;br&amp;gt;&lt;br /&gt;
The audio properties of the Super clip are used to store and transfer its parameters (specifically ''num_audio_samples''), therefore any existing audio is killed in the Super clip. That is one of reasons why you can additionally use a source clip with client functions. You may have a look to the Super clip yourself (it has a normal format).&amp;lt;br&amp;gt;&lt;br /&gt;
Supported formats: Y, YUV and planar RGB (8-32) bits, and YUY2. You can use a different Super clip to generate vectors with MAnalyze and a different Super clip format for the actual action. This enables support for planar RGB with MFlowFPS, and lets MDegrain work with 32 bit float input clips. &lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
{{FuncDef|MSuper (clip, int &amp;quot;hpad&amp;quot;, int &amp;quot;vpad&amp;quot;, int &amp;quot;pel&amp;quot;, int &amp;quot;levels&amp;quot;, bool &amp;quot;chroma&amp;quot;, &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; int &amp;quot;sharp&amp;quot;, int &amp;quot;rfilter&amp;quot;, clip &amp;quot;pelclip&amp;quot;, bool &amp;quot;isse&amp;quot;, bool &amp;quot;planar&amp;quot;, bool &amp;quot;mt&amp;quot;) }}&lt;br /&gt;
&lt;br /&gt;
:{{Par2|hpad|int|8}}&lt;br /&gt;
::Horizontal padding added to source frame (both left and right). A small padding is added for more correct motion estimation near frame borders. &lt;br /&gt;
&lt;br /&gt;
:{{Par2|vpad|int|8}}&lt;br /&gt;
::Vertical padding added to source frame (both top and bottom), for the same reason as ''hpad''.&lt;br /&gt;
&lt;br /&gt;
:{{Par2|pel|int|2}}&lt;br /&gt;
::Motion estimation accuracy. Value can only be 1, 2 or 4. &lt;br /&gt;
:::*1 : means precision to the pixel. &lt;br /&gt;
:::*2 : means precision to half a pixel. &lt;br /&gt;
:::*4 : means precision to quarter of a pixel, produced by spatial interpolation (more accurate but slower and not always better due to big level scale step). &lt;br /&gt;
&lt;br /&gt;
:{{Par2|levels|int|0}}&lt;br /&gt;
::Number of hierarchical levels for super clip frames. [[MAnalyse]] needs all levels, but for other client functions a single, finest level is enough (coarser levels are not used). 0 is auto (all possible levels are produced). &lt;br /&gt;
&lt;br /&gt;
:{{Par2|chroma|bool|true}}&lt;br /&gt;
::When true, process chroma planes too. False for luma only.&lt;br /&gt;
&lt;br /&gt;
:{{Par2|sharp|int|2}}&lt;br /&gt;
::Sub-pixel interpolation method for when {{FuncArg|pel}} == 2 || 4.&lt;br /&gt;
:::*0 : soft interpolation (bilinear).&lt;br /&gt;
:::*1 : bicubic interpolation (4 tap Catmull-Rom)&lt;br /&gt;
:::*2 : sharper Wiener interpolation (6 tap, similar to Lanczos).&lt;br /&gt;
&lt;br /&gt;
:{{Par2|rfilter|int|2}}&lt;br /&gt;
::Hierarchical levels smoothing and reducing (halving) filter.&lt;br /&gt;
:::* 0 : simple 4 pixels averaging like unfiltered [[SimpleResize]] (old method)&lt;br /&gt;
:::* 1 : triangle (shifted) filter like [[ReduceBy2]] for more smoothing (decreased aliasing)&lt;br /&gt;
:::* 2 : triangle filter like [[BilinearResize]] for even more smoothing&lt;br /&gt;
:::* 3 : quadratic filter for even more smoothing&lt;br /&gt;
:::* 4 : cubic filter like [[BicubicResize]](b=1,c=0) for even more smoothing&lt;br /&gt;
&lt;br /&gt;
:: You may also try to apply some external filter to the''superclip'' or its coarse bottom part (by appropriate crop and overlay).&lt;br /&gt;
&lt;br /&gt;
:{{Par2|pelclip|clip| }}&lt;br /&gt;
::Optional upsampled source clip for using instead of internal sub-pixel interpolation (for {{FuncArg|pel}} &amp;gt; 1).&lt;br /&gt;
::Pixels at rows and columns positions multiple to {{FuncArg|pel}} (0,2,4,... for {{FuncArg|pel}}=2) (without padding) must be original source pixels; other pixels must be interpolated.&lt;br /&gt;
&lt;br /&gt;
::Example for {{Template:FuncDef|pel}}=2:&lt;br /&gt;
&amp;lt;div {{BoxWidthIndent|60|6}} &amp;gt;&lt;br /&gt;
 MSuper(..., pel=2, pelclip=LanczosResize(width*2,height*2,src_left=0.25, src_top=0.25))&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
::Another useful filter for {{FuncArg|pelclip}} is the [[EEDI3]] edge-directed resampler.&lt;br /&gt;
::Recent note: it is true for luma, but is not exactly corresponded to chroma pixels positions of internal '''MVTools''' interpolation. Nevertheless, vectors and motion compensation are quite similar for usual clips, same chroma would be with ''src_left=0.5'' for YUY2 and additionally ''src_top=0.5'' for YV12.{{Clarify}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
[[TODO]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------&lt;br /&gt;
'''Back to [[MVTools#Filters|MVTools2]] &amp;amp;larr;'''&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/MVTools</id>
		<title>MVTools</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/MVTools"/>
				<updated>2021-11-07T19:59:22Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: Addition of mt to the common parameters along a suggestion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat5|External_filters|Plugins|Plugins_x64|Other_filters|Support_filters}}&lt;br /&gt;
[[Category:Deep_color_tools]]&lt;br /&gt;
{{Filter&lt;br /&gt;
|Manao, Fizick, Tsp, TSchniede, SEt, cretindesalpes, pinterf&lt;br /&gt;
|v2.7.39&lt;br /&gt;
|'''[https://github.com/pinterf/mvtools/releases mvtools-2.7.39-with-depans.7z]'''&lt;br /&gt;
(8-16(32) bits, 420,422,444 support, x86/x64)&lt;br /&gt;
|[[:Category:Support_filters|Support filters]], [[:Category:Deep_color_tools|Deep color tools]]&lt;br /&gt;
|&lt;br /&gt;
* [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0]&lt;br /&gt;
* AviSynth+ for x64 and native 10+ bits&lt;br /&gt;
* YV12&lt;br /&gt;
* YUY2&lt;br /&gt;
* YV16, YV24 (2.7.1-)&lt;br /&gt;
* YUV 4:2:0, 4:2:2, 4:4:4 10-16 bits (32 bits in selected filters)&lt;br /&gt;
|[https://www.gnu.org/licenses/gpl-2.0.txt GPLv2]&lt;br /&gt;
|7=[https://forum.doom9.org/showthread.php?t=84770 Doom9], [https://forum.doom9.org/showthread.php?t=131033 continued]&lt;br /&gt;
------&lt;br /&gt;
[https://forum.doom9.org/showthread.php?p=1386559#post1386559 Doom9 v2.6 mod], [https://forum.doom9.org/showthread.php?t=173356 v2.7mod]}}&lt;br /&gt;
&lt;br /&gt;
== About MVTools ==&lt;br /&gt;
MVTools plugin for AviSynth 2.6 is a collection of functions for estimation and compensation of objects motion in video clips. Motion compensation may be used for strong temporal denoising, advanced framerate conversions, image restoration and other tasks.&lt;br /&gt;
&lt;br /&gt;
The plugin contains the motion estimation server-function MAnalyse to find the motion vectors and several motion compensation client-functions (MCompensate, MMask and others) which use these vectors.&lt;br /&gt;
&lt;br /&gt;
Plugin uses block-matching method of motion estimation (similar methods are used in MPEG2, MPEG4, etc). At analysis stage plugin divides frames by small blocks and try to find for every block in current frame the most similar (matching) block in second frame (previous or next). The relative shift of these blocks is motion vector. The main measure of block similarity is sum of absolute differences (SAD) of all pixels of these two blocks compared. SAD is a value which says how good the motion estimation was.&lt;br /&gt;
&lt;br /&gt;
The output of MAnalyse (server) is special clip with motion vector information in some format.&lt;br /&gt;
&lt;br /&gt;
At compensation stage the plugin client functions read the motion vectors and use them to move blocks and form motion compensated frame (or realize some other full or partial motion compensation or interpolation function). Every object (block) in this (fully) compensated frame is placed in the same position as this object in current frame. So, we may (for example) use strong temporal denoising even for quite fast moving objects without producing annoying artifacts and ghosting (object's features and edges are coincide if compensation is perfect). Plugin can create compensated neighbor frames for every current frame, and denoise it by internal function. Alternatively, you can use compensated and original frames to create interleaved clip, denoise it by any external temporal filter, and select central cleaned original frames for output (see examples).&lt;br /&gt;
&lt;br /&gt;
Of course, the motion estimation and compensation is not ideal and precise. In some complex cases (video with fading, ultra-fast motion, or periodic structures) the motion estimation may be completely wrong, and compensated frame will be blocky and (or) ugly. Severe difficulty is also due to objects mutual screening (occlusion) or reverse opening. Complex Avisynth scripts with many motion compensation functions may eat huge amount of memory and result in very slow processing. It is not simple but quite advanced plugin. Use it for appropriate cases only, and try to tune its parameters. There are many discussions about motion compensation using at doom9 Avisynth forum. In particular see [https://forum.doom9.org/showthread.php?t=76041 old MVTools thread], [https://forum.doom9.org/showthread.php?t=102071 true motion thread], [https://forum.doom9.org/showthread.php?t=84770 new MVTools thread] and some other. Try to read the postings in addition to this documentation and ask for support there. If you really interested in motion estimation and compensation topics, you can easy find numerous scientific publications (use WWW search).&lt;br /&gt;
&lt;br /&gt;
Notes 1: Try to use a smart deinterlacer for interlaced video (SeparateFields may works too with or without SelectEven/SelectOdd). Some complex scripts (MVBOB, MCBOB, TempGaussMC) use MVTools for motion compensated deinterlacing.&lt;br /&gt;
Alternatively you can try to use Motion plugin by mg262.&lt;br /&gt;
&lt;br /&gt;
Notes 2:  Stacked 16 bit output for MDegrain1-6 and MDegrainN are also supported in general.&lt;br /&gt;
Native 10-16 bit colorspaces (and 32 bit float in MDegrain) are available when using MVTools with AviSynth+ r2294-.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Latest documentation:&amp;lt;/span&amp;gt; https://github.com/pinterf/mvtools/blob/mvtools-pfmod/Documentation/mvtools2.html'''&lt;br /&gt;
&lt;br /&gt;
== Common parameters ==&lt;br /&gt;
Filters that use motion vectors have common parameters. Those are the scene-change detection thresholds, and the isse MMX flag. They also use one or several vectors stream, which are produced by MAnalyse.&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|thSCD1}} (int, 400): threshold which decides whether a block has changed between the previous frame and the current one. When a block has changed, it means that motion estimation for it isn't relevant. It occurs for example at scene changes. So it is one of the thresholds used to tweak the scene changes detection engine. Raising it will lower the number of blocks detected as changed. It may be useful for noisy or flickered video. The threshold is compared to the SAD (Sum of Absolute Differences, a value which says how bad the motion estimation was ) value. For exactly identical blocks we have SAD=0. But real blocks are always different because of objects complex movement (zoom, rotation, deformation), discrete pixels sampling, and noise. Suppose we have two compared 8x8 blocks with every pixel different by 5. It this case SAD will be 8x8x5 = 320 (block will not detected as changed for thSCD1=400). If you use 4x4 blocks, SAD will be 320/4. If you use 16x16 blocks, SAD will be 320*4. Really this parameter is scaled internally in MVTools, and you must always use reduced to block size 8x8 value. Default is 400 (since v.1.4.1).&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|thSCD2}} (int, 130): Threshold which sets how many blocks have to change for the frame to be considered as a scene change. It is ranged from 0 to 255, 0 meaning 0 %, 255 meaning 100 %. Default is 130 (which means 51 %).&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|isse}} (bool, true): Flag which allows to enable (if set to true) or disable ISSE, MMX and other CPU optimizations (for debugging). If your processor doesn't support CPU optimizations, it will be disabled anyway (and you won't be able to activate them).&lt;br /&gt;
 &lt;br /&gt;
*{{Template:FuncDef2|planar}} (bool, false): Legacy flag to use a hack planar color format for YUY2 clips, both for input and output of functions. It uses a hack to store frames with planar data (separate Y, U, V planes in memory) in normal interleaved YUY2 frames format as a container. This way we can avoid numerous internal interleaved to planar conversions and increase speed. You can convert a normal interleaved YUY2 source clip to planar with Interleaved2planar from SSETools and convert back with Planar2interleaved. This special planar YUY2 format is also supported by Removegrain, MaskTools2 and some others. This trick is not needed in Avisynth 2.6 with native support of planar YV16 format. This parameter is ignored for YV12 clips. Note: super clip is always planar. &lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|mt}} (bool, true): When true, enables internal multi-threading via AVSTP. Only available in some functions, like [[MVTools2/MSuper]] and [[MVTools2/MSuper]].&amp;lt;br&amp;gt;'''Might''' be better to disable when using AVS+ 3.6 and leting the frameserver do its thing ([http://publishwith.me/ep/pad/view/ro.rDkwcdWn4k9/latest MTmodes.avsi], if loaded, sets the number of AVSTP threads to 1, which should give the same result as mt=false)&lt;br /&gt;
&lt;br /&gt;
== Filters ==&lt;br /&gt;
{{PluginFilterTable}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MSuper|&lt;br /&gt;
Get source clip and prepare special &amp;quot;super&amp;quot; clip with multilevel (hierarchical scaled) frames data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, Planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MAnalyse|&lt;br /&gt;
Get prepared multilevel super clip, estimate motion by block-matching method and produce special output clip with motion vectors data (used by other functions).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MCompensate|&lt;br /&gt;
Do a full motion compensation of the frame.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MMask|&lt;br /&gt;
Creates mask clip from source clip with motion vectors data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MSCDetection|&lt;br /&gt;
Creates scene detection mask clip from motion vectors data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MShow|&lt;br /&gt;
Shows the motion vectors on padded source by super clip opening.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDepan|&lt;br /&gt;
Get the motion vectors, estimate global motion and put data to output frame in special format for [[DePan]] plugin.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlow|&lt;br /&gt;
Do a motion compensation of the frame not by blocks (like MCompensate), but by pixels.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowInter|&lt;br /&gt;
Motion interpolation function. It is not the same (but similar) as MVInterpolate function of older MVTools version.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowFps|&lt;br /&gt;
Will change the frame rate (fps) of the clip. The function can be used for frame rate conversion, slow-motion effect, etc.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MBlockFps|&lt;br /&gt;
The function uses block-based partial motion compensation to change the framerate (fps) of the clip (and number of frames).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowBlur|&lt;br /&gt;
Experimental simple motion blur function. It may be used for FILM-effect (to simulate finite shutter time).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDegrain''X''|&lt;br /&gt;
Temporal denoising with motion compensation. MDeGrain''X'' has a temporal radius of ''X'', up to 6.&amp;lt;br&amp;gt;&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDegrainN|&lt;br /&gt;
Temporal denoising with motion compensation. MDeGrainN has a temporal radius given by the tr parameter, and uses a special motion vector clip.&amp;lt;br&amp;gt;&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MRecalculate|&lt;br /&gt;
Refines and recalculates motion data of previously estimated (by MAnalyse) motion vectors with different super clip or new parameters set (e.g. lesser block size), after divide, etc.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MScaleVect|&lt;br /&gt;
Rescales motion vectors / blocksize. Main purpose is to allows vectors to be used on a differently sized clip or on a clip having different bit depth than they were analyzed from. &lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MStoreVect|&lt;br /&gt;
Stores (multiple) motion vectors in a encodable clip. Allows you to encode vectors to a file (must use a lossless format). Convenient for splitting up very slow scripts. Can also use to process the same footage in multiple ways. Use MRestoreVect to get the motion vectors back out of the clip. &lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MRestoreVect|&lt;br /&gt;
Fetches a single motion vector clip from a special clip prepared earlier by MStoreVect. Call multiple times if there are several clips stored. The function returns a single motion vectors clip.&lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MShow|&lt;br /&gt;
Shows the motion vectors on padded source by super clip opening. &lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note1: native 10-16 bits and 4:2:0 and 8-16 bits 4:2:2, 4:4:4 color spaces are supported in 2.7.x branch&lt;br /&gt;
Note2: native 10+ bits only work with Avisynth+&lt;br /&gt;
Note3: MDegrain supports 32 bit float input clips (Super and Input) but motion vectors should be calculated from 8-16 bits&lt;br /&gt;
&lt;br /&gt;
== Changelog ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;border: 1px solid darkgray&amp;quot;&lt;br /&gt;
!Version&lt;br /&gt;
!Date&lt;br /&gt;
!Author&lt;br /&gt;
!Changes&lt;br /&gt;
|-&lt;br /&gt;
|2.7.30&lt;br /&gt;
|20180405&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: crash in MFlowInter (and possibly other MFlow...). v2.7.29 revealed this additional bug (which was not even 100% reproducible), this fix is basically the 2nd part of the solution.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.29&lt;br /&gt;
|20180403&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MFlowInter (and possibly other MFlow...) crash with specific combination of analyze parameters (e.g. blkSize=16,overlapv=4,divide=1). Bug existed since at least 2.5.11.22&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.28&lt;br /&gt;
|20180323&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: in MDegrain1-6/N allow Y8 input for out16 parameter&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.27&lt;br /&gt;
|20180318&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MDepan: use zerow parameter. The parameter had no effect probably since it had been introduced.&amp;lt;br&amp;gt;&lt;br /&gt;
MDepan: report MT mode for Avisynth+. MT_MULTI_INSTANCE, except for logfile writing output mode when it reports MT_SERIALIZED. (other filters already have proper registration, MDepan was missed)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.26&lt;br /&gt;
|20180314&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: MDegrain1-6 and N: new parameter bool &amp;quot;out16&amp;quot; = false. If set, 8 bit input results in native 16bit output (like lsb=true hack but this is native, faster).&amp;lt;br&amp;gt;&lt;br /&gt;
Faster: special 10 bit SAD functions instead of the generic 10-16bit one.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.25&lt;br /&gt;
|20180227&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: x64: not-cleared mmx state in MSuper assembly code would cause crash later, e.g. in x264 encoding, depending on following filters.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MSCDetection SC value parameter name to Ysc from Yth (must be an ancient typo), docs are OK, but the fix is mentioned in docs&amp;lt;br&amp;gt;&lt;br /&gt;
MSuper: import 8 bit sse2 interpolators from mvtools-vs. Extend them for 10-16bits (faster super clip). Some filters are still todo.&amp;lt;br&amp;gt;&lt;br /&gt;
MSuper: support 32bit float clips, which can be used later by MDegrains (but not for MAnalyse)&amp;lt;br&amp;gt;&lt;br /&gt;
MDegrains: allow degraining clip with different bit depth from vectors. Clip and Super must be the same bit depth&amp;lt;br&amp;gt;&lt;br /&gt;
MDegrains: consistently use limit and limitC, 255 do nothing, otherwise scale 0-254 value to the current bit-depth range&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: more correct internal rounding for 8 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: round for 16bits&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: 32bit float (but still use the original 11 bit window constants)&amp;lt;br&amp;gt;&lt;br /&gt;
Project: change from yasm to nasm.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.24&lt;br /&gt;
|20171205&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MFlowBlur: possible access violation crash when nPel&amp;gt;1&amp;lt;br&amp;gt;&lt;br /&gt;
New: MScaleVect parameter 'bits'. e.g. Analyze 8 bit clips, use their vectors for 16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Move project to VS2017&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.23&lt;br /&gt;
|20171012&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MScaleVect wrong rounding of scaled motion vectors with negative components. e.g. proper scaling (-1;-2) to (-2;-4) instead of (-1,-3)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.22&lt;br /&gt;
|20170830&lt;br /&gt;
|pinterf&lt;br /&gt;
|Misc: Stop using version suffix .22&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DCT 8x8@8bit] garbage on x64: internal assembly code did not save xmm6/xmm7&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DCT 8x8@8bit] safe multithreading for integer DCT (8x8 block size, 8 bit video): assembly had a single working buffer.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MDegrain] did not release input motion vector clips in destructor, possible hang at script closing. Bug since 2.7.1.22 (introducing MDegrain4/5)&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: fftw conversion constant of sqrt(2)/2 is more accurate (was:0.707), 16 bit formats may benefit (by feisty2)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: SSE4 assembly instructions in x64, broke on non-SSE4 processors&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.21.22&lt;br /&gt;
|20170629&lt;br /&gt;
|pinterf&lt;br /&gt;
|Mod: [MMask] Faster: request source frame only for kind=5.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.20.22&lt;br /&gt;
|2017.05.26&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: [MMask] greyscale input resulted in AV when filter exiting&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.19.22&lt;br /&gt;
|2017.05.25&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: [MMask] Support any planar input video formats e.g. greyscale, Planar RGB. Input clip can even be of different bit depth or format from vector's original format. For kind==5 where U and V is filled, the greyscale option is not allowed&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: [MMask] Faster: request source frame only for kind=5.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MxxxxFPS,MMask]: MakeVectorOcclusionMaskTime garbage in bottom blocks&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MMask] bottom padding garbage for padded frame dimension&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MMask] proper 10+ bits scene change values (for default: 1023, 4095, 16383, 65535. Was: 65535). Parameter is still in 8-bit range&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MRecalculate] prevent overflow during thSAD scaling in 16 bits or large block sizes (32, 48...)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DepanEstimate] Sometimes giving wrong motion instead of scene change detection. Bug only existed in previous pfmod builds.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MAnalyze] Possible overflow in MAnalyze 8 bit, block size 48x48 and above. Overflow-safe predictor recalc for big block sizes.&amp;lt;br&amp;gt;&lt;br /&gt;
New: [General] Add block size 12x3 for SAD, allow 6x24&amp;lt;br&amp;gt;&lt;br /&gt;
List of available block sizes&amp;lt;br&amp;gt;&lt;br /&gt;
- 64x64, 64x48, 64x32, 64x16&amp;lt;br&amp;gt;&lt;br /&gt;
- 48x64, 48x48, 48x24, 48x12&amp;lt;br&amp;gt;&lt;br /&gt;
- 32x64, 32x32, 32x24, 32x16, 32x8&amp;lt;br&amp;gt;&lt;br /&gt;
- 24x48, 24x24, 24x32, 24x12, 24x6&amp;lt;br&amp;gt;&lt;br /&gt;
- 16x64, 16x32, 16x16, 16x12, 16x8, 16x4, 16x2&amp;lt;br&amp;gt;&lt;br /&gt;
- 12x48, 12x24, 12x16, 12x12, 12x6, 12x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 8x32, 8x16, 8x8, 8x4, 8x2, 8x1&amp;lt;br&amp;gt;&lt;br /&gt;
- 6x24, 6x12, 6x6, 6x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 4x8, 4x4, 4x2&amp;lt;br&amp;gt;&lt;br /&gt;
- 3x6, 3x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 2x4, 2x2&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: [Internal] Reorganized 10-16 bit SAD simd intrinsics, faster 8-12% for BlkSize 12-32&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.18.22&lt;br /&gt;
|2017.05.12&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: 10-16 bit: DCT buffer possible overflow&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: DCT is fast again for non 8x8 blocksizes. Regression since 2.7.5.22.&amp;lt;br&amp;gt;&lt;br /&gt;
New: Chroma SAD is now always half of luma SAD, regardless of video format. Without this: YV24's luma:chroma SAD ratio is 4:8 instead of 4:2 (of YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
New: MAnalyze, MRecalculate new parameter: &amp;quot;scaleCSAD&amp;quot; integer, default 0.&amp;lt;br&amp;gt;&lt;br /&gt;
Fine tune chroma SAD weight relative to luma SAD.&amp;lt;br&amp;gt;&lt;br /&gt;
ScaleCSAD values for luma:chroma SAD ratio&amp;lt;br&amp;gt;&lt;br /&gt;
* -2: 4:0.5&amp;lt;br&amp;gt;&lt;br /&gt;
* -1: 4:1&amp;lt;br&amp;gt;&lt;br /&gt;
* 0: 4:2 (default, same as the native ratio for YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
* 1: 4:4&amp;lt;br&amp;gt;&lt;br /&gt;
* 2: 4:8&amp;lt;br&amp;gt;&lt;br /&gt;
New: Block sizes 64, 48, 24, 12, 6.&amp;lt;br&amp;gt;&lt;br /&gt;
MAnalyze/MRecalculate new block sizes (SATD support mod4 sizes)&amp;lt;br&amp;gt;&lt;br /&gt;
Note: some smaller block sizes can only be available in 4:4:4 formats, due to block size division (chroma subsampling)&amp;lt;br&amp;gt;&lt;br /&gt;
New: All block sizes are supported in MDegrain1-6, MDegrainN, and MScaleVect&amp;lt;br&amp;gt;&lt;br /&gt;
New: Changed to 2017 version of asm files for 8 bit SAD/SATD functions from x265 project. Added not implemented asm code for 12, 24, 48 sizes&amp;lt;br&amp;gt;&lt;br /&gt;
For some block sizes AVX2 and SSE4 is supported (AVX2 if reported under AviSynth+) e.g. BlkSize 32 is faster now.&amp;lt;br&amp;gt;&lt;br /&gt;
New: MMask SAD Mask to give identical weights for other-than-YV12 formats, e.g. for YV24&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.17.22&lt;br /&gt;
|2017.04.26&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: Regression in 2.7.16.22: MDegrain right pixel artifacts on non-modulo 16 widths&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MMask, mode SADMask output is normalized further by video subsampling (YV16/YV24 has larger SAD value due to bigger chroma part that classic YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.16.22&lt;br /&gt;
|2017.04.23&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MMask 10-16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MRecalculate 14-16 bits passed nSCD1=999999 internally which caused overflow (scene change problems later)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix is done by clamping SCD1 to 8*8*(255-0) (maximum value of sum of SADs on a 8x8 block)&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MDegrainX 8 bits: internal 16 bit buffer to 8 bits: SSE2&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MFlow access violation in internal mv resizer when resizing factor was big (MCaWarpSharp3 4x supersampling case) (bug possibly introduced in upstream 2.5.11.22)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.15.22&lt;br /&gt;
|2017.03.16&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: 16 bit SAD for non-AVX code path&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MDegrain1-6: add error on lsb_flag=true for non-8 bit sources&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.14.22&lt;br /&gt;
|2017.02.06&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MAnalyze divide=2 showed &amp;quot;vector clip is too small&amp;quot; (inherited from 2.6.0.5, sanity check was done but length was not filled for divideextra data)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MFlow access violation in internal mv resizer when resizing factor was big (MCaWarpSharp3 4x supersampling case) (bug possibly introduced in upstream 2.5.11.22)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.13.22&lt;br /&gt;
|2017.02.01&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MDegrain1-6,N 10-16 bit thSCD scaling&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MVShow: tolerance scaling for 10-16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.12.22&lt;br /&gt;
|2017.01.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: Faster SATD (dct=5..10) 8 bit: updated x264 function selectors, SSE2/4/AVX/AVX2; +10% speed for a whole typical MDegrain3 process on i7-3770&amp;lt;br&amp;gt;&lt;br /&gt;
New: Much Faster SATD (dct=5..10) 10-16 bit: SSE2/SSE4 instead of C +50% speed for a whole typical MDegrain3 process (which is approx half speed of 8 bit)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.11.22&lt;br /&gt;
|2017.01.16&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: MDegrain6&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: MDegrain1-6 SSE4 for 10-16 bit (was: C. 3-5% gain, wasn't bottleneck)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.10.22&lt;br /&gt;
|2016.12.28&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: for YV12 the debug info text chroma part was positioned at wrong place&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.9.22&lt;br /&gt;
|2016.12.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|Apply 2.5.11.9-svp analysis speedup, mainly when chroma is involved&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.8.22&lt;br /&gt;
|2016.12.18&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: YUY2 input access violation (regression after 2.7.0.22d) - Fixed also in Depan.dll&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MDegrain: free up YUY2 planes only if not planar input (bug inherited from 2.5.11.22 MDegrain3) resulting in freeze at script exit&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.7.22&lt;br /&gt;
|2016.12.14&lt;br /&gt;
|pinterf&lt;br /&gt;
|Optimizing 8 bits&amp;lt;br&amp;gt;&lt;br /&gt;
speed: change some 8 bit SAD functions for the better&amp;lt;br&amp;gt;&lt;br /&gt;
speed: separating bottleneck 8 bit/16 bit code paths in order not to use slower int64 calculations for 8 bit, where there are no integer overflow problems&amp;lt;br&amp;gt;&lt;br /&gt;
speed: more __forceinlines for helping the compiler&amp;lt;br&amp;gt;&lt;br /&gt;
info:  general speed gain of 5-15% compared to 2.7.6.22, much reduced speed gap compared to the &amp;quot;classic&amp;quot; YV12 8 bit mvtools2 versions&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.6.22&lt;br /&gt;
|2016.12.04&lt;br /&gt;
|pinterf&lt;br /&gt;
|fix: sumLumaChange underflow (used for dct=2,6,9) (regression during 16 bit support)&amp;lt;br&amp;gt;&lt;br /&gt;
fix: MeanLumaChange scale for 10-16 bits (used for dct=2,6,9)&amp;lt;br&amp;gt;&lt;br /&gt;
fix: Mask fix: 8 bit mask resizer bug in SIMD intrinsics (regression on inline asm -&amp;gt; SIMD transition)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: dctmode=1,2: pixel distance was not corrected for 16 bit pixel sizes&amp;lt;br&amp;gt;&lt;br /&gt;
speed: Let's help VS2015 with some __forceinline directives to recognize the truth.&amp;lt;br&amp;gt;&lt;br /&gt;
speed: Misc optimizations throughout the code (bit shifts instead of div or mul)&amp;lt;br&amp;gt;&lt;br /&gt;
speed: FFTW DCT: C code replaced with SIMD SSE2/SSE4 (FloatToBytes, BytesToFloat)&amp;lt;br&amp;gt;&lt;br /&gt;
speed: 16 bit SAD: a few optimizations in SSE2, AVX-coded SSE2 and AVX2 codepath&amp;lt;br&amp;gt;&lt;br /&gt;
VS2015 compiler: /MT -&amp;gt; /MD (from static to dynamic dlls - now it reallys need VS2015 redistributables)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.5.22&lt;br /&gt;
|2016.11.19&lt;br /&gt;
|pinterf&lt;br /&gt;
|Milestone release:&lt;br /&gt;
General support of 10-16 bit formats with Avisynth Plus (r2294 or newer recommended) with new MDegrain4 and MDegrain5 filters.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix for MSCDetection: scene change filler pixel default value was always 0 (2.7.1.22 regression)&amp;lt;br&amp;gt;&lt;br /&gt;
MCompensate: possible bugfix bottom padding UV&amp;lt;br&amp;gt;&lt;br /&gt;
Fix SAD for 10-16 bit depths for horizontal block sizes &amp;gt;= 16&amp;lt;br&amp;gt;&lt;br /&gt;
Fix nSCD2 (Scene change threshold block count %) (2.7.1.22 regression)&amp;lt;br&amp;gt;&lt;br /&gt;
MBlockFPS: overlap fixes (right columns and bottom lines)&amp;lt;br&amp;gt;&lt;br /&gt;
MBlockFPS: overlap fix: missing copy buffer to output&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.1.22&lt;br /&gt;
|2016.10.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|YV16 and YV24 avaliable&amp;lt;br&amp;gt;&lt;br /&gt;
dct modes &amp;gt;= 5 now use SATD again (so far it was in dead code, contrary to 2.5.13.1 remarks)&amp;lt;br&amp;gt;&lt;br /&gt;
New: MDegrain4, MDegrain5&amp;lt;br&amp;gt;&lt;br /&gt;
Experimental native 10-16 bit support (MSuper, MAnalyze, MDegrain1-5, MDegrainN) including 16 bit SATD (slow C) and SSE2 optimized regular SAD for 8+ (for 10+ bits you need at least Avisynth+ r2290)&amp;lt;br&amp;gt; &lt;br /&gt;
Inline assembly rewritten to intrinsics -&amp;gt; 64 bit build is possible in VS2015 (External assembly untouched)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.0.22&lt;br /&gt;
|2016.04.29&lt;br /&gt;
|pinterf&lt;br /&gt;
|Integrate Fizick's upstream changes of 2.5.11.22&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.0.1&lt;br /&gt;
|2016.03.31&lt;br /&gt;
|pinterf&lt;br /&gt;
|MVTools-pfmod&amp;lt;br&amp;gt;&lt;br /&gt;
2.6.0.5 x64 capable version ported under AviSynth 2.6 API&amp;lt;br&amp;gt;&lt;br /&gt;
Fixed access violation in MDepan&amp;lt;br&amp;gt;&lt;br /&gt;
Fixed access violation in x64 asm code&amp;lt;br&amp;gt;&lt;br /&gt;
Built with Visual Studio 2015 Community Edition, v140_xp toolset&amp;lt;br&amp;gt;&lt;br /&gt;
Compiler: Intel C++ 16 (because of inline 64 bit asm code)&amp;lt;br&amp;gt;&lt;br /&gt;
See [https://forum.doom9.org/showthread.php?t=173356 discussion] and [https://github.com/pinterf/mvtools/tree/mvtools-pfmod GitHub page] for more information.&amp;lt;br/&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.5&lt;br /&gt;
|2012.07.17&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MCompensate, MDegrainN: fixed a bug causing occasionally horizontal magenta stripes in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.4&lt;br /&gt;
|2012.06.14&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MCompensate: fixed artifacts related to overlap with tr &amp;gt; 3 in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.3&lt;br /&gt;
|2012.05.13&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MDegrainN: fixed artifacts related to overlap with tr &amp;gt; 3 in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.2&lt;br /&gt;
|2012.05.01&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MAnalyse: fixed a threading issue when using FFTW.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.1&lt;br /&gt;
|2012.03.12&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MAnalyse: fixed potential crash in multithreading mode.&amp;lt;br/&amp;gt;&lt;br /&gt;
MDegrainN: fixed systematic crash in multithreading mode.&amp;lt;br/&amp;gt;&lt;br /&gt;
All MDegrain functions: fixed potential crash when thSAD is set to 0.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.0&lt;br /&gt;
|2012.03.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MDegrainN: internally uses MDegrain1/2/3 when tr ≤ 3, for optimal speed.&amp;lt;br/&amp;gt;&lt;br /&gt;
MCompensate: added multi-compensation mode for easy use with temporal filters.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse, MSuper, MCompensate, MDegrainN: added multithreading (but partially, not for all code paths) using AVSTP.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: fixed a corruption of the global motion vector.&amp;lt;br/&amp;gt;&lt;br /&gt;
Improved page setting for this documentation.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.2&lt;br /&gt;
|2012.01.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed MScaleVect with multi-vector clips.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.1&lt;br /&gt;
|2011.12.13&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed crashes in the MDegrain functions when using both planar=true and lsb=true.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.0&lt;br /&gt;
|2011.11.28&lt;br /&gt;
|Firesledge and Vit&lt;br /&gt;
|Added MStoreVect, MRestoreVect and MScaleVect from the Vit's [https://forum.doom9.org/showthread.php?t=84770&amp;amp;page=76#post1538821 MVExtras plugin].&lt;br /&gt;
|-&lt;br /&gt;
|2.5.13.1&lt;br /&gt;
|2011.11.09&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MAnalyse, MRecalculate: added an SATD approximation for blksize &amp;gt; 16 and dct ≥ 5. Previously, the SATD calculation was silently bypassed and always returned a null SAD value.&amp;lt;br/&amp;gt;&lt;br /&gt;
Functions now check that the pel setting is the same in the superclip and the motion vectors, instead of crashing if not.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.13.0 beta&lt;br /&gt;
|2011.09.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MRecalculate: Can now process multi-vector clips.&amp;lt;br/&amp;gt;&lt;br /&gt;
All functions: Added the -Vit-'s fix that could improve the multithreading stability.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.12.1 beta&lt;br /&gt;
|2011.09.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MAnalyse: Fixed the ghosting bug introduced in the previous version.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.12.0 beta&lt;br /&gt;
|2011.09.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MDegrainN added.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: Added the &amp;quot;multi&amp;quot; mode for MDegrainN.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: Documented the negative delta values and fixed some functions accordingly.&amp;lt;br/&amp;gt;&lt;br /&gt;
MFlowInter: Fixed the YUY2 planar mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.11.2 beta mod16b&lt;br /&gt;
|2011.05.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed a regression in MDegrain1/2/3, related to the mod16 versions. thSADC is now taken into account correctly (instead of using thSAD).&lt;br /&gt;
|-&lt;br /&gt;
|2.5.11.2 beta mod16a&lt;br /&gt;
|2011.04.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Merged 2.5.11.2 and 2.5.11 mod16a versions.&lt;br /&gt;
|}&lt;br /&gt;
[http://www.avisynth.nl/users/fizick/mvtools/mvtools2.html#revisions Changelog up to v2.5.11.22]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Archived Downloads ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;; width=&amp;quot;500px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!!width=&amp;quot;100px&amp;quot;| Version&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Download&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Mirror&lt;br /&gt;
|-&lt;br /&gt;
!v2.6.0.5 (x64)&lt;br /&gt;
|[http://www.dropbox.com/s/swk97z4q834vugk/mvtools_2.6.0.5_x64.zip?dl=1 mvtools_2.6.0.5_x64.zip]&lt;br /&gt;
|[https://web.archive.org/web/20200608154645if_/https://files.videohelp.com/u/223002/mvtools_2.6.0.5_x64.zip mvtools_2.6.0.5_x64.zip]&lt;br /&gt;
|-&lt;br /&gt;
!v2.6.0.5&lt;br /&gt;
|[http://ldesoras.free.fr/src/avs/mvtools-2.6.0.5.zip mvtools-2.6.0.5.zip]&lt;br /&gt;
|[https://web.archive.org/web/20160604063048if_/http://ldesoras.free.fr/src/avs/mvtools-2.6.0.5.zip mvtools-2.6.0.5.zip]&lt;br /&gt;
|-&lt;br /&gt;
!v2.5.11.22&lt;br /&gt;
|[http://www.avisynth.nl/users/fizick/mvtools/mvtools-v2.5.11.22.zip mvtools-v2.5.11.22.zip]&lt;br /&gt;
|[https://web.archive.org/web/20170716135124if_/http://www.avisynth.nl/users/fizick/mvtools/mvtools-v2.5.11.22.zip mvtools-v2.5.11.22.zip]&lt;br /&gt;
|}&lt;br /&gt;
* Note: MVTools v2.6.0.5 (x64) was compiled with Intel Parallel Studio XE 2015 Composer Edition for C++.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==External Links ==&lt;br /&gt;
*[https://forum.doom9.org/showthread.php?t=84770 Doom9 Forum] - MVTools discussion.&lt;br /&gt;
*[http://www.nmm-hd.org/newbbs/viewtopic.php?f=7&amp;amp;t=1918 NMM-HD Forum] - MVTools documentation in Chinese.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php/MVTools</id>
		<title>MVTools</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/MVTools"/>
				<updated>2021-11-04T20:17:29Z</updated>
		
		<summary type="html">&lt;p&gt;Kogarou: Update to the main page of mvtools2 as per the latest docs + removal of legacy info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat5|External_filters|Plugins|Plugins_x64|Other_filters|Support_filters}}&lt;br /&gt;
[[Category:Deep_color_tools]]&lt;br /&gt;
{{Filter&lt;br /&gt;
|Manao, Fizick, Tsp, TSchniede, SEt, cretindesalpes, pinterf&lt;br /&gt;
|v2.7.39&lt;br /&gt;
|'''[https://github.com/pinterf/mvtools/releases mvtools-2.7.39-with-depans.7z]'''&lt;br /&gt;
(8-16(32) bits, 420,422,444 support, x86/x64)&lt;br /&gt;
|[[:Category:Support_filters|Support filters]], [[:Category:Deep_color_tools|Deep color tools]]&lt;br /&gt;
|&lt;br /&gt;
* [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0]&lt;br /&gt;
* AviSynth+ for x64 and native 10+ bits&lt;br /&gt;
* YV12&lt;br /&gt;
* YUY2&lt;br /&gt;
* YV16, YV24 (2.7.1-)&lt;br /&gt;
* YUV 4:2:0, 4:2:2, 4:4:4 10-16 bits (32 bits in selected filters)&lt;br /&gt;
|[https://www.gnu.org/licenses/gpl-2.0.txt GPLv2]&lt;br /&gt;
|7=[https://forum.doom9.org/showthread.php?t=84770 Doom9], [https://forum.doom9.org/showthread.php?t=131033 continued]&lt;br /&gt;
------&lt;br /&gt;
[https://forum.doom9.org/showthread.php?p=1386559#post1386559 Doom9 v2.6 mod], [https://forum.doom9.org/showthread.php?t=173356 v2.7mod]}}&lt;br /&gt;
&lt;br /&gt;
== About MVTools ==&lt;br /&gt;
MVTools plugin for AviSynth 2.6 is a collection of functions for estimation and compensation of objects motion in video clips. Motion compensation may be used for strong temporal denoising, advanced framerate conversions, image restoration and other tasks.&lt;br /&gt;
&lt;br /&gt;
The plugin contains the motion estimation server-function MAnalyse to find the motion vectors and several motion compensation client-functions (MCompensate, MMask and others) which use these vectors.&lt;br /&gt;
&lt;br /&gt;
Plugin uses block-matching method of motion estimation (similar methods are used in MPEG2, MPEG4, etc). At analysis stage plugin divides frames by small blocks and try to find for every block in current frame the most similar (matching) block in second frame (previous or next). The relative shift of these blocks is motion vector. The main measure of block similarity is sum of absolute differences (SAD) of all pixels of these two blocks compared. SAD is a value which says how good the motion estimation was.&lt;br /&gt;
&lt;br /&gt;
The output of MAnalyse (server) is special clip with motion vector information in some format.&lt;br /&gt;
&lt;br /&gt;
At compensation stage the plugin client functions read the motion vectors and use them to move blocks and form motion compensated frame (or realize some other full or partial motion compensation or interpolation function). Every object (block) in this (fully) compensated frame is placed in the same position as this object in current frame. So, we may (for example) use strong temporal denoising even for quite fast moving objects without producing annoying artifacts and ghosting (object's features and edges are coincide if compensation is perfect). Plugin can create compensated neighbor frames for every current frame, and denoise it by internal function. Alternatively, you can use compensated and original frames to create interleaved clip, denoise it by any external temporal filter, and select central cleaned original frames for output (see examples).&lt;br /&gt;
&lt;br /&gt;
Of course, the motion estimation and compensation is not ideal and precise. In some complex cases (video with fading, ultra-fast motion, or periodic structures) the motion estimation may be completely wrong, and compensated frame will be blocky and (or) ugly. Severe difficulty is also due to objects mutual screening (occlusion) or reverse opening. Complex Avisynth scripts with many motion compensation functions may eat huge amount of memory and result in very slow processing. It is not simple but quite advanced plugin. Use it for appropriate cases only, and try to tune its parameters. There are many discussions about motion compensation using at doom9 Avisynth forum. In particular see [https://forum.doom9.org/showthread.php?t=76041 old MVTools thread], [https://forum.doom9.org/showthread.php?t=102071 true motion thread], [https://forum.doom9.org/showthread.php?t=84770 new MVTools thread] and some other. Try to read the postings in addition to this documentation and ask for support there. If you really interested in motion estimation and compensation topics, you can easy find numerous scientific publications (use WWW search).&lt;br /&gt;
&lt;br /&gt;
Notes 1: Try to use a smart deinterlacer for interlaced video (SeparateFields may works too with or without SelectEven/SelectOdd). Some complex scripts (MVBOB, MCBOB, TempGaussMC) use MVTools for motion compensated deinterlacing.&lt;br /&gt;
Alternatively you can try to use Motion plugin by mg262.&lt;br /&gt;
&lt;br /&gt;
Notes 2:  Stacked 16 bit output for MDegrain1-6 and MDegrainN are also supported in general.&lt;br /&gt;
Native 10-16 bit colorspaces (and 32 bit float in MDegrain) are available when using MVTools with AviSynth+ r2294-.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Latest documentation:&amp;lt;/span&amp;gt; https://github.com/pinterf/mvtools/blob/mvtools-pfmod/Documentation/mvtools2.html'''&lt;br /&gt;
&lt;br /&gt;
== Common parameters ==&lt;br /&gt;
Filters that use motion vectors have common parameters. Those are the scene-change detection thresholds, and the isse MMX flag. They also use one or several vectors stream, which are produced by MAnalyse.&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|thSCD1}} (int, 400): threshold which decides whether a block has changed between the previous frame and the current one. When a block has changed, it means that motion estimation for it isn't relevant. It occurs for example at scene changes. So it is one of the thresholds used to tweak the scene changes detection engine. Raising it will lower the number of blocks detected as changed. It may be useful for noisy or flickered video. The threshold is compared to the SAD (Sum of Absolute Differences, a value which says how bad the motion estimation was ) value. For exactly identical blocks we have SAD=0. But real blocks are always different because of objects complex movement (zoom, rotation, deformation), discrete pixels sampling, and noise. Suppose we have two compared 8x8 blocks with every pixel different by 5. It this case SAD will be 8x8x5 = 320 (block will not detected as changed for thSCD1=400). If you use 4x4 blocks, SAD will be 320/4. If you use 16x16 blocks, SAD will be 320*4. Really this parameter is scaled internally in MVTools, and you must always use reduced to block size 8x8 value. Default is 400 (since v.1.4.1).&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|thSCD2}} (int, 130): Threshold which sets how many blocks have to change for the frame to be considered as a scene change. It is ranged from 0 to 255, 0 meaning 0 %, 255 meaning 100 %. Default is 130 (which means 51 %).&lt;br /&gt;
&lt;br /&gt;
*{{Template:FuncDef2|isse}} (bool, true): Flag which allows to enable (if set to true) or disable ISSE, MMX and other CPU optimizations (for debugging). If your processor doesn't support CPU optimizations, it will be disabled anyway (and you won't be able to activate them).&lt;br /&gt;
 &lt;br /&gt;
*{{Template:FuncDef2|planar}} (bool, false): Legacy flag to use a hack planar color format for YUY2 clips, both for input and output of functions. It uses a hack to store frames with planar data (separate Y, U, V planes in memory) in normal interleaved YUY2 frames format as a container. This way we can avoid numerous internal interleaved to planar conversions and increase speed. You can convert a normal interleaved YUY2 source clip to planar with Interleaved2planar from SSETools and convert back with Planar2interleaved. This special planar YUY2 format is also supported by Removegrain, MaskTools2 and some others. This trick is not needed in Avisynth 2.6 with native support of planar YV16 format. This parameter is ignored for YV12 clips. Note: super clip is always planar. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Filters ==&lt;br /&gt;
{{PluginFilterTable}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MSuper|&lt;br /&gt;
Get source clip and prepare special &amp;quot;super&amp;quot; clip with multilevel (hierarchical scaled) frames data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, Planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MAnalyse|&lt;br /&gt;
Get prepared multilevel super clip, estimate motion by block-matching method and produce special output clip with motion vectors data (used by other functions).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MCompensate|&lt;br /&gt;
Do a full motion compensation of the frame.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MMask|&lt;br /&gt;
Creates mask clip from source clip with motion vectors data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MSCDetection|&lt;br /&gt;
Creates scene detection mask clip from motion vectors data.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MShow|&lt;br /&gt;
Shows the motion vectors on padded source by super clip opening.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDepan|&lt;br /&gt;
Get the motion vectors, estimate global motion and put data to output frame in special format for [[DePan]] plugin.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlow|&lt;br /&gt;
Do a motion compensation of the frame not by blocks (like MCompensate), but by pixels.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowInter|&lt;br /&gt;
Motion interpolation function. It is not the same (but similar) as MVInterpolate function of older MVTools version.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowFps|&lt;br /&gt;
Will change the frame rate (fps) of the clip. The function can be used for frame rate conversion, slow-motion effect, etc.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MBlockFps|&lt;br /&gt;
The function uses block-based partial motion compensation to change the framerate (fps) of the clip (and number of frames).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{PluginFilterRow|MVTools2|MFlowBlur|&lt;br /&gt;
Experimental simple motion blur function. It may be used for FILM-effect (to simulate finite shutter time).&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDegrain''X''|&lt;br /&gt;
Temporal denoising with motion compensation. MDeGrain''X'' has a temporal radius of ''X'', up to 6.&amp;lt;br&amp;gt;&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MDegrainN|&lt;br /&gt;
Temporal denoising with motion compensation. MDeGrainN has a temporal radius given by the tr parameter, and uses a special motion vector clip.&amp;lt;br&amp;gt;&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-32 bits 4:2:0, 4:2:2, 4:4:4, planar RGB&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MRecalculate|&lt;br /&gt;
Refines and recalculates motion data of previously estimated (by MAnalyse) motion vectors with different super clip or new parameters set (e.g. lesser block size), after divide, etc.&lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MScaleVect|&lt;br /&gt;
Rescales motion vectors / blocksize. Main purpose is to allows vectors to be used on a differently sized clip or on a clip having different bit depth than they were analyzed from. &lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MStoreVect|&lt;br /&gt;
Stores (multiple) motion vectors in a encodable clip. Allows you to encode vectors to a file (must use a lossless format). Convenient for splitting up very slow scripts. Can also use to process the same footage in multiple ways. Use MRestoreVect to get the motion vectors back out of the clip. &lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MRestoreVect|&lt;br /&gt;
Fetches a single motion vector clip from a special clip prepared earlier by MStoreVect. Call multiple times if there are several clips stored. The function returns a single motion vectors clip.&lt;br /&gt;
| ?&lt;br /&gt;
}}&lt;br /&gt;
{{PluginFilterRow|MVTools2|MShow|&lt;br /&gt;
Shows the motion vectors on padded source by super clip opening. &lt;br /&gt;
| [[YV12]], [[YUY2]],&amp;lt;br&amp;gt;any 8-16 bits 4:2:0, 4:2:2, 4:4:4&lt;br /&gt;
}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note1: native 10-16 bits and 4:2:0 and 8-16 bits 4:2:2, 4:4:4 color spaces are supported in 2.7.x branch&lt;br /&gt;
Note2: native 10+ bits only work with Avisynth+&lt;br /&gt;
Note3: MDegrain supports 32 bit float input clips (Super and Input) but motion vectors should be calculated from 8-16 bits&lt;br /&gt;
&lt;br /&gt;
== Changelog ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;border: 1px solid darkgray&amp;quot;&lt;br /&gt;
!Version&lt;br /&gt;
!Date&lt;br /&gt;
!Author&lt;br /&gt;
!Changes&lt;br /&gt;
|-&lt;br /&gt;
|2.7.30&lt;br /&gt;
|20180405&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: crash in MFlowInter (and possibly other MFlow...). v2.7.29 revealed this additional bug (which was not even 100% reproducible), this fix is basically the 2nd part of the solution.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.29&lt;br /&gt;
|20180403&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MFlowInter (and possibly other MFlow...) crash with specific combination of analyze parameters (e.g. blkSize=16,overlapv=4,divide=1). Bug existed since at least 2.5.11.22&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.28&lt;br /&gt;
|20180323&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: in MDegrain1-6/N allow Y8 input for out16 parameter&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.27&lt;br /&gt;
|20180318&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MDepan: use zerow parameter. The parameter had no effect probably since it had been introduced.&amp;lt;br&amp;gt;&lt;br /&gt;
MDepan: report MT mode for Avisynth+. MT_MULTI_INSTANCE, except for logfile writing output mode when it reports MT_SERIALIZED. (other filters already have proper registration, MDepan was missed)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.26&lt;br /&gt;
|20180314&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: MDegrain1-6 and N: new parameter bool &amp;quot;out16&amp;quot; = false. If set, 8 bit input results in native 16bit output (like lsb=true hack but this is native, faster).&amp;lt;br&amp;gt;&lt;br /&gt;
Faster: special 10 bit SAD functions instead of the generic 10-16bit one.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.25&lt;br /&gt;
|20180227&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: x64: not-cleared mmx state in MSuper assembly code would cause crash later, e.g. in x264 encoding, depending on following filters.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MSCDetection SC value parameter name to Ysc from Yth (must be an ancient typo), docs are OK, but the fix is mentioned in docs&amp;lt;br&amp;gt;&lt;br /&gt;
MSuper: import 8 bit sse2 interpolators from mvtools-vs. Extend them for 10-16bits (faster super clip). Some filters are still todo.&amp;lt;br&amp;gt;&lt;br /&gt;
MSuper: support 32bit float clips, which can be used later by MDegrains (but not for MAnalyse)&amp;lt;br&amp;gt;&lt;br /&gt;
MDegrains: allow degraining clip with different bit depth from vectors. Clip and Super must be the same bit depth&amp;lt;br&amp;gt;&lt;br /&gt;
MDegrains: consistently use limit and limitC, 255 do nothing, otherwise scale 0-254 value to the current bit-depth range&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: more correct internal rounding for 8 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: round for 16bits&amp;lt;br&amp;gt;&lt;br /&gt;
Overlaps: 32bit float (but still use the original 11 bit window constants)&amp;lt;br&amp;gt;&lt;br /&gt;
Project: change from yasm to nasm.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.24&lt;br /&gt;
|20171205&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MFlowBlur: possible access violation crash when nPel&amp;gt;1&amp;lt;br&amp;gt;&lt;br /&gt;
New: MScaleVect parameter 'bits'. e.g. Analyze 8 bit clips, use their vectors for 16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Move project to VS2017&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.23&lt;br /&gt;
|20171012&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MScaleVect wrong rounding of scaled motion vectors with negative components. e.g. proper scaling (-1;-2) to (-2;-4) instead of (-1,-3)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.22&lt;br /&gt;
|20170830&lt;br /&gt;
|pinterf&lt;br /&gt;
|Misc: Stop using version suffix .22&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DCT 8x8@8bit] garbage on x64: internal assembly code did not save xmm6/xmm7&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DCT 8x8@8bit] safe multithreading for integer DCT (8x8 block size, 8 bit video): assembly had a single working buffer.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MDegrain] did not release input motion vector clips in destructor, possible hang at script closing. Bug since 2.7.1.22 (introducing MDegrain4/5)&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: fftw conversion constant of sqrt(2)/2 is more accurate (was:0.707), 16 bit formats may benefit (by feisty2)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: SSE4 assembly instructions in x64, broke on non-SSE4 processors&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.21.22&lt;br /&gt;
|20170629&lt;br /&gt;
|pinterf&lt;br /&gt;
|Mod: [MMask] Faster: request source frame only for kind=5.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.20.22&lt;br /&gt;
|2017.05.26&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: [MMask] greyscale input resulted in AV when filter exiting&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.19.22&lt;br /&gt;
|2017.05.25&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: [MMask] Support any planar input video formats e.g. greyscale, Planar RGB. Input clip can even be of different bit depth or format from vector's original format. For kind==5 where U and V is filled, the greyscale option is not allowed&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: [MMask] Faster: request source frame only for kind=5.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MxxxxFPS,MMask]: MakeVectorOcclusionMaskTime garbage in bottom blocks&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MMask] bottom padding garbage for padded frame dimension&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MMask] proper 10+ bits scene change values (for default: 1023, 4095, 16383, 65535. Was: 65535). Parameter is still in 8-bit range&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MRecalculate] prevent overflow during thSAD scaling in 16 bits or large block sizes (32, 48...)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [DepanEstimate] Sometimes giving wrong motion instead of scene change detection. Bug only existed in previous pfmod builds.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: [MAnalyze] Possible overflow in MAnalyze 8 bit, block size 48x48 and above. Overflow-safe predictor recalc for big block sizes.&amp;lt;br&amp;gt;&lt;br /&gt;
New: [General] Add block size 12x3 for SAD, allow 6x24&amp;lt;br&amp;gt;&lt;br /&gt;
List of available block sizes&amp;lt;br&amp;gt;&lt;br /&gt;
- 64x64, 64x48, 64x32, 64x16&amp;lt;br&amp;gt;&lt;br /&gt;
- 48x64, 48x48, 48x24, 48x12&amp;lt;br&amp;gt;&lt;br /&gt;
- 32x64, 32x32, 32x24, 32x16, 32x8&amp;lt;br&amp;gt;&lt;br /&gt;
- 24x48, 24x24, 24x32, 24x12, 24x6&amp;lt;br&amp;gt;&lt;br /&gt;
- 16x64, 16x32, 16x16, 16x12, 16x8, 16x4, 16x2&amp;lt;br&amp;gt;&lt;br /&gt;
- 12x48, 12x24, 12x16, 12x12, 12x6, 12x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 8x32, 8x16, 8x8, 8x4, 8x2, 8x1&amp;lt;br&amp;gt;&lt;br /&gt;
- 6x24, 6x12, 6x6, 6x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 4x8, 4x4, 4x2&amp;lt;br&amp;gt;&lt;br /&gt;
- 3x6, 3x3&amp;lt;br&amp;gt;&lt;br /&gt;
- 2x4, 2x2&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: [Internal] Reorganized 10-16 bit SAD simd intrinsics, faster 8-12% for BlkSize 12-32&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.18.22&lt;br /&gt;
|2017.05.12&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: 10-16 bit: DCT buffer possible overflow&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: DCT is fast again for non 8x8 blocksizes. Regression since 2.7.5.22.&amp;lt;br&amp;gt;&lt;br /&gt;
New: Chroma SAD is now always half of luma SAD, regardless of video format. Without this: YV24's luma:chroma SAD ratio is 4:8 instead of 4:2 (of YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
New: MAnalyze, MRecalculate new parameter: &amp;quot;scaleCSAD&amp;quot; integer, default 0.&amp;lt;br&amp;gt;&lt;br /&gt;
Fine tune chroma SAD weight relative to luma SAD.&amp;lt;br&amp;gt;&lt;br /&gt;
ScaleCSAD values for luma:chroma SAD ratio&amp;lt;br&amp;gt;&lt;br /&gt;
* -2: 4:0.5&amp;lt;br&amp;gt;&lt;br /&gt;
* -1: 4:1&amp;lt;br&amp;gt;&lt;br /&gt;
* 0: 4:2 (default, same as the native ratio for YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
* 1: 4:4&amp;lt;br&amp;gt;&lt;br /&gt;
* 2: 4:8&amp;lt;br&amp;gt;&lt;br /&gt;
New: Block sizes 64, 48, 24, 12, 6.&amp;lt;br&amp;gt;&lt;br /&gt;
MAnalyze/MRecalculate new block sizes (SATD support mod4 sizes)&amp;lt;br&amp;gt;&lt;br /&gt;
Note: some smaller block sizes can only be available in 4:4:4 formats, due to block size division (chroma subsampling)&amp;lt;br&amp;gt;&lt;br /&gt;
New: All block sizes are supported in MDegrain1-6, MDegrainN, and MScaleVect&amp;lt;br&amp;gt;&lt;br /&gt;
New: Changed to 2017 version of asm files for 8 bit SAD/SATD functions from x265 project. Added not implemented asm code for 12, 24, 48 sizes&amp;lt;br&amp;gt;&lt;br /&gt;
For some block sizes AVX2 and SSE4 is supported (AVX2 if reported under AviSynth+) e.g. BlkSize 32 is faster now.&amp;lt;br&amp;gt;&lt;br /&gt;
New: MMask SAD Mask to give identical weights for other-than-YV12 formats, e.g. for YV24&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.17.22&lt;br /&gt;
|2017.04.26&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: Regression in 2.7.16.22: MDegrain right pixel artifacts on non-modulo 16 widths&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MMask, mode SADMask output is normalized further by video subsampling (YV16/YV24 has larger SAD value due to bigger chroma part that classic YV12)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.16.22&lt;br /&gt;
|2017.04.23&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MMask 10-16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MRecalculate 14-16 bits passed nSCD1=999999 internally which caused overflow (scene change problems later)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix is done by clamping SCD1 to 8*8*(255-0) (maximum value of sum of SADs on a 8x8 block)&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MDegrainX 8 bits: internal 16 bit buffer to 8 bits: SSE2&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MFlow access violation in internal mv resizer when resizing factor was big (MCaWarpSharp3 4x supersampling case) (bug possibly introduced in upstream 2.5.11.22)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.15.22&lt;br /&gt;
|2017.03.16&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: 16 bit SAD for non-AVX code path&amp;lt;br&amp;gt;&lt;br /&gt;
Misc: MDegrain1-6: add error on lsb_flag=true for non-8 bit sources&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.14.22&lt;br /&gt;
|2017.02.06&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MAnalyze divide=2 showed &amp;quot;vector clip is too small&amp;quot; (inherited from 2.6.0.5, sanity check was done but length was not filled for divideextra data)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MFlow access violation in internal mv resizer when resizing factor was big (MCaWarpSharp3 4x supersampling case) (bug possibly introduced in upstream 2.5.11.22)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.13.22&lt;br /&gt;
|2017.02.01&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: MDegrain1-6,N 10-16 bit thSCD scaling&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MVShow: tolerance scaling for 10-16 bits&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.12.22&lt;br /&gt;
|2017.01.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: Faster SATD (dct=5..10) 8 bit: updated x264 function selectors, SSE2/4/AVX/AVX2; +10% speed for a whole typical MDegrain3 process on i7-3770&amp;lt;br&amp;gt;&lt;br /&gt;
New: Much Faster SATD (dct=5..10) 10-16 bit: SSE2/SSE4 instead of C +50% speed for a whole typical MDegrain3 process (which is approx half speed of 8 bit)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.11.22&lt;br /&gt;
|2017.01.16&lt;br /&gt;
|pinterf&lt;br /&gt;
|New: MDegrain6&amp;lt;br&amp;gt;&lt;br /&gt;
Mod: MDegrain1-6 SSE4 for 10-16 bit (was: C. 3-5% gain, wasn't bottleneck)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.10.22&lt;br /&gt;
|2016.12.28&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: for YV12 the debug info text chroma part was positioned at wrong place&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.9.22&lt;br /&gt;
|2016.12.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|Apply 2.5.11.9-svp analysis speedup, mainly when chroma is involved&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.8.22&lt;br /&gt;
|2016.12.18&lt;br /&gt;
|pinterf&lt;br /&gt;
|Fix: YUY2 input access violation (regression after 2.7.0.22d) - Fixed also in Depan.dll&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: MDegrain: free up YUY2 planes only if not planar input (bug inherited from 2.5.11.22 MDegrain3) resulting in freeze at script exit&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.7.22&lt;br /&gt;
|2016.12.14&lt;br /&gt;
|pinterf&lt;br /&gt;
|Optimizing 8 bits&amp;lt;br&amp;gt;&lt;br /&gt;
speed: change some 8 bit SAD functions for the better&amp;lt;br&amp;gt;&lt;br /&gt;
speed: separating bottleneck 8 bit/16 bit code paths in order not to use slower int64 calculations for 8 bit, where there are no integer overflow problems&amp;lt;br&amp;gt;&lt;br /&gt;
speed: more __forceinlines for helping the compiler&amp;lt;br&amp;gt;&lt;br /&gt;
info:  general speed gain of 5-15% compared to 2.7.6.22, much reduced speed gap compared to the &amp;quot;classic&amp;quot; YV12 8 bit mvtools2 versions&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.6.22&lt;br /&gt;
|2016.12.04&lt;br /&gt;
|pinterf&lt;br /&gt;
|fix: sumLumaChange underflow (used for dct=2,6,9) (regression during 16 bit support)&amp;lt;br&amp;gt;&lt;br /&gt;
fix: MeanLumaChange scale for 10-16 bits (used for dct=2,6,9)&amp;lt;br&amp;gt;&lt;br /&gt;
fix: Mask fix: 8 bit mask resizer bug in SIMD intrinsics (regression on inline asm -&amp;gt; SIMD transition)&amp;lt;br&amp;gt;&lt;br /&gt;
Fix: dctmode=1,2: pixel distance was not corrected for 16 bit pixel sizes&amp;lt;br&amp;gt;&lt;br /&gt;
speed: Let's help VS2015 with some __forceinline directives to recognize the truth.&amp;lt;br&amp;gt;&lt;br /&gt;
speed: Misc optimizations throughout the code (bit shifts instead of div or mul)&amp;lt;br&amp;gt;&lt;br /&gt;
speed: FFTW DCT: C code replaced with SIMD SSE2/SSE4 (FloatToBytes, BytesToFloat)&amp;lt;br&amp;gt;&lt;br /&gt;
speed: 16 bit SAD: a few optimizations in SSE2, AVX-coded SSE2 and AVX2 codepath&amp;lt;br&amp;gt;&lt;br /&gt;
VS2015 compiler: /MT -&amp;gt; /MD (from static to dynamic dlls - now it reallys need VS2015 redistributables)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.5.22&lt;br /&gt;
|2016.11.19&lt;br /&gt;
|pinterf&lt;br /&gt;
|Milestone release:&lt;br /&gt;
General support of 10-16 bit formats with Avisynth Plus (r2294 or newer recommended) with new MDegrain4 and MDegrain5 filters.&amp;lt;br&amp;gt;&lt;br /&gt;
Fix for MSCDetection: scene change filler pixel default value was always 0 (2.7.1.22 regression)&amp;lt;br&amp;gt;&lt;br /&gt;
MCompensate: possible bugfix bottom padding UV&amp;lt;br&amp;gt;&lt;br /&gt;
Fix SAD for 10-16 bit depths for horizontal block sizes &amp;gt;= 16&amp;lt;br&amp;gt;&lt;br /&gt;
Fix nSCD2 (Scene change threshold block count %) (2.7.1.22 regression)&amp;lt;br&amp;gt;&lt;br /&gt;
MBlockFPS: overlap fixes (right columns and bottom lines)&amp;lt;br&amp;gt;&lt;br /&gt;
MBlockFPS: overlap fix: missing copy buffer to output&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.1.22&lt;br /&gt;
|2016.10.20&lt;br /&gt;
|pinterf&lt;br /&gt;
|YV16 and YV24 avaliable&amp;lt;br&amp;gt;&lt;br /&gt;
dct modes &amp;gt;= 5 now use SATD again (so far it was in dead code, contrary to 2.5.13.1 remarks)&amp;lt;br&amp;gt;&lt;br /&gt;
New: MDegrain4, MDegrain5&amp;lt;br&amp;gt;&lt;br /&gt;
Experimental native 10-16 bit support (MSuper, MAnalyze, MDegrain1-5, MDegrainN) including 16 bit SATD (slow C) and SSE2 optimized regular SAD for 8+ (for 10+ bits you need at least Avisynth+ r2290)&amp;lt;br&amp;gt; &lt;br /&gt;
Inline assembly rewritten to intrinsics -&amp;gt; 64 bit build is possible in VS2015 (External assembly untouched)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.0.22&lt;br /&gt;
|2016.04.29&lt;br /&gt;
|pinterf&lt;br /&gt;
|Integrate Fizick's upstream changes of 2.5.11.22&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2.7.0.1&lt;br /&gt;
|2016.03.31&lt;br /&gt;
|pinterf&lt;br /&gt;
|MVTools-pfmod&amp;lt;br&amp;gt;&lt;br /&gt;
2.6.0.5 x64 capable version ported under AviSynth 2.6 API&amp;lt;br&amp;gt;&lt;br /&gt;
Fixed access violation in MDepan&amp;lt;br&amp;gt;&lt;br /&gt;
Fixed access violation in x64 asm code&amp;lt;br&amp;gt;&lt;br /&gt;
Built with Visual Studio 2015 Community Edition, v140_xp toolset&amp;lt;br&amp;gt;&lt;br /&gt;
Compiler: Intel C++ 16 (because of inline 64 bit asm code)&amp;lt;br&amp;gt;&lt;br /&gt;
See [https://forum.doom9.org/showthread.php?t=173356 discussion] and [https://github.com/pinterf/mvtools/tree/mvtools-pfmod GitHub page] for more information.&amp;lt;br/&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.5&lt;br /&gt;
|2012.07.17&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MCompensate, MDegrainN: fixed a bug causing occasionally horizontal magenta stripes in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.4&lt;br /&gt;
|2012.06.14&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MCompensate: fixed artifacts related to overlap with tr &amp;gt; 3 in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.3&lt;br /&gt;
|2012.05.13&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MDegrainN: fixed artifacts related to overlap with tr &amp;gt; 3 in multithreading mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.2&lt;br /&gt;
|2012.05.01&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MAnalyse: fixed a threading issue when using FFTW.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.1&lt;br /&gt;
|2012.03.12&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MAnalyse: fixed potential crash in multithreading mode.&amp;lt;br/&amp;gt;&lt;br /&gt;
MDegrainN: fixed systematic crash in multithreading mode.&amp;lt;br/&amp;gt;&lt;br /&gt;
All MDegrain functions: fixed potential crash when thSAD is set to 0.&lt;br /&gt;
|-&lt;br /&gt;
|2.6.0.0&lt;br /&gt;
|2012.03.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MDegrainN: internally uses MDegrain1/2/3 when tr ≤ 3, for optimal speed.&amp;lt;br/&amp;gt;&lt;br /&gt;
MCompensate: added multi-compensation mode for easy use with temporal filters.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse, MSuper, MCompensate, MDegrainN: added multithreading (but partially, not for all code paths) using AVSTP.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: fixed a corruption of the global motion vector.&amp;lt;br/&amp;gt;&lt;br /&gt;
Improved page setting for this documentation.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.2&lt;br /&gt;
|2012.01.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed MScaleVect with multi-vector clips.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.1&lt;br /&gt;
|2011.12.13&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed crashes in the MDegrain functions when using both planar=true and lsb=true.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.14.0&lt;br /&gt;
|2011.11.28&lt;br /&gt;
|Firesledge and Vit&lt;br /&gt;
|Added MStoreVect, MRestoreVect and MScaleVect from the Vit's [https://forum.doom9.org/showthread.php?t=84770&amp;amp;page=76#post1538821 MVExtras plugin].&lt;br /&gt;
|-&lt;br /&gt;
|2.5.13.1&lt;br /&gt;
|2011.11.09&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MAnalyse, MRecalculate: added an SATD approximation for blksize &amp;gt; 16 and dct ≥ 5. Previously, the SATD calculation was silently bypassed and always returned a null SAD value.&amp;lt;br/&amp;gt;&lt;br /&gt;
Functions now check that the pel setting is the same in the superclip and the motion vectors, instead of crashing if not.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.13.0 beta&lt;br /&gt;
|2011.09.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MRecalculate: Can now process multi-vector clips.&amp;lt;br/&amp;gt;&lt;br /&gt;
All functions: Added the -Vit-'s fix that could improve the multithreading stability.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.12.1 beta&lt;br /&gt;
|2011.09.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|MAnalyse: Fixed the ghosting bug introduced in the previous version.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.12.0 beta&lt;br /&gt;
|2011.09.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|&lt;br /&gt;
MDegrainN added.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: Added the &amp;quot;multi&amp;quot; mode for MDegrainN.&amp;lt;br/&amp;gt;&lt;br /&gt;
MAnalyse: Documented the negative delta values and fixed some functions accordingly.&amp;lt;br/&amp;gt;&lt;br /&gt;
MFlowInter: Fixed the YUY2 planar mode.&lt;br /&gt;
|-&lt;br /&gt;
|2.5.11.2 beta mod16b&lt;br /&gt;
|2011.05.11&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Fixed a regression in MDegrain1/2/3, related to the mod16 versions. thSADC is now taken into account correctly (instead of using thSAD).&lt;br /&gt;
|-&lt;br /&gt;
|2.5.11.2 beta mod16a&lt;br /&gt;
|2011.04.10&lt;br /&gt;
|Firesledge&lt;br /&gt;
|Merged 2.5.11.2 and 2.5.11 mod16a versions.&lt;br /&gt;
|}&lt;br /&gt;
[http://www.avisynth.nl/users/fizick/mvtools/mvtools2.html#revisions Changelog up to v2.5.11.22]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Archived Downloads ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;; width=&amp;quot;500px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!!width=&amp;quot;100px&amp;quot;| Version&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Download&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Mirror&lt;br /&gt;
|-&lt;br /&gt;
!v2.6.0.5 (x64)&lt;br /&gt;
|[http://www.dropbox.com/s/swk97z4q834vugk/mvtools_2.6.0.5_x64.zip?dl=1 mvtools_2.6.0.5_x64.zip]&lt;br /&gt;
|[https://web.archive.org/web/20200608154645if_/https://files.videohelp.com/u/223002/mvtools_2.6.0.5_x64.zip mvtools_2.6.0.5_x64.zip]&lt;br /&gt;
|-&lt;br /&gt;
!v2.6.0.5&lt;br /&gt;
|[http://ldesoras.free.fr/src/avs/mvtools-2.6.0.5.zip mvtools-2.6.0.5.zip]&lt;br /&gt;
|[https://web.archive.org/web/20160604063048if_/http://ldesoras.free.fr/src/avs/mvtools-2.6.0.5.zip mvtools-2.6.0.5.zip]&lt;br /&gt;
|-&lt;br /&gt;
!v2.5.11.22&lt;br /&gt;
|[http://www.avisynth.nl/users/fizick/mvtools/mvtools-v2.5.11.22.zip mvtools-v2.5.11.22.zip]&lt;br /&gt;
|[https://web.archive.org/web/20170716135124if_/http://www.avisynth.nl/users/fizick/mvtools/mvtools-v2.5.11.22.zip mvtools-v2.5.11.22.zip]&lt;br /&gt;
|}&lt;br /&gt;
* Note: MVTools v2.6.0.5 (x64) was compiled with Intel Parallel Studio XE 2015 Composer Edition for C++.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==External Links ==&lt;br /&gt;
*[https://forum.doom9.org/showthread.php?t=84770 Doom9 Forum] - MVTools discussion.&lt;br /&gt;
*[http://www.nmm-hd.org/newbbs/viewtopic.php?f=7&amp;amp;t=1918 NMM-HD Forum] - MVTools documentation in Chinese.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kogarou</name></author>	</entry>

	</feed>