<?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=Firesledge</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=Firesledge"/>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Special:Contributions/Firesledge"/>
		<updated>2026-04-07T23:01:03Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.19.24</generator>

	<entry>
		<id>http://avisynth.nl/index.php/Swap</id>
		<title>Swap</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php/Swap"/>
				<updated>2021-08-08T14:51:16Z</updated>
		
		<summary type="html">&lt;p&gt;Firesledge: Added alpha channel parameter to YToUV() for Avisynth+&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Swaps chroma channels in [[YUV]] clips.&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ==== Syntax and Parameters ==== --&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;max-width:62em&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{FuncDefH4|SwapUV}}&lt;br /&gt;
{{FuncDef&lt;br /&gt;
|SwapUV(clip ''clip'')&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
:Swaps ''U'' and ''V'' (chroma) channels. Corrects certain decoding errors &amp;amp;ndash; faces blue instead of red, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{FuncDefH4|UToY, VToY}}&lt;br /&gt;
{{Func2Def&lt;br /&gt;
|UToY(clip ''clip'')&lt;br /&gt;
|VToY(clip ''clip'')&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
:Copies ''U'' or ''V'' chroma plane to the ''Y'' luma plane. &lt;br /&gt;
:All color (chroma) information is removed, so the image is now greyscale. &lt;br /&gt;
:Depending on the color format, the image resolution can be changed &amp;amp;ndash; i.e.,&lt;br /&gt;
:with a [[YV24]] source, '''UToY''' is the same width and height as {{FuncArg|clip}}, but&lt;br /&gt;
:with a [[YV12]] source, '''UToY''' is half {{FuncArg|clip}}'s width and height.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{FuncDefH4|UToY8, VToY8}}&lt;br /&gt;
{{Func2Def&lt;br /&gt;
|UToY8(clip ''clip'')&lt;br /&gt;
|VToY8(clip ''clip'')&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
:Shorthand for '''UToY.'''[[ConvertToY8]] and '''VToY.'''[[ConvertToY8]], but faster.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{FuncDefH4|YToUV}}&lt;br /&gt;
{{FuncDef&lt;br /&gt;
|YToUV(clip ''clipU'', clip ''clipV'' [, clip ''clipY'' [, clip ''clipA'' ] ] )&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
:Copies the ''Y'' (luma channel) of {{FuncArg|clipU}} to the ''U'' channel of the output clip and the ''Y'' (luma channel) of {{FuncArg|clipV}} to the ''V'' channel of the output clip. &lt;br /&gt;
:If {{FuncArg|clipY}} is given, copies the ''Y'' (luma channel) of {{FuncArg|clipY}} to the ''Y'' channel of the output clip.&lt;br /&gt;
:{{AvsPluscon}} And if {{FuncArg|clipA}} is given too, copies the ''Y'' (luma channel) of {{FuncArg|clipA}} to the ''A'' channel of the output clip.&lt;br /&gt;
:Depending on the color format, the image resolution can be changed.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== See Also ====&lt;br /&gt;
*Show [[RGB]] channels with [[ShowAlpha|ShowAlpha/Red/Green/Blue]].&lt;br /&gt;
*{{AvsPluscon}} [[Extract]] for {{Deep_color}} support.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;max-width:62em&amp;quot; &amp;gt;&lt;br /&gt;
* Blur the U chroma channel&lt;br /&gt;
&amp;lt;div {{BoxWidthIndent|32|2}} &amp;gt;&lt;br /&gt;
 video = [[ColorBars]](512, 512).[[ConvertToYV12]]&lt;br /&gt;
 u_chroma = '''UToY'''(video).[[Blur]](1.5)&lt;br /&gt;
 '''YToUV'''(u_chroma, video.'''VToY''')&lt;br /&gt;
 [[MergeLuma]](video)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Show ''U'' and ''V'' channels stacked for illustration purposes. &lt;br /&gt;
** Note that with a [[YV12]] source (like the one below), the ''U'' and ''V'' images will be half the size of the original.&lt;br /&gt;
** In the ''U'' and ''V'' images, gray will be at 128{{D}} and saturated colors will appear brighter or darker. &lt;br /&gt;
{{HalfBreak}}&lt;br /&gt;
:[[File:SwapEx-Sintel9150.jpg]]&lt;br /&gt;
&amp;lt;div {{BoxWidthIndent|32|2}} &amp;gt;&lt;br /&gt;
 [[StackVertical]](&lt;br /&gt;
 \  [[Subtitle]](&amp;quot;YV12 original&amp;quot;, align=2),&lt;br /&gt;
 \  [[StackHorizontal]](&lt;br /&gt;
 \       '''UtoY'''.Subtitle(&amp;quot;UtoY&amp;quot;, align=2), &lt;br /&gt;
 \       '''VtoY'''.Subtitle(&amp;quot;VtoY&amp;quot;, align=2)&lt;br /&gt;
 \  )&lt;br /&gt;
 \ )&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Changes ====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| v2.60&lt;br /&gt;
| Added UToY8, VToY8.&lt;br /&gt;
|- &lt;br /&gt;
| v2.60&lt;br /&gt;
| Added new color formats [[Y8]], [[YV411]], [[YV16]] and [[YV24]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Internal_filters]]&lt;br /&gt;
[[Category:Levels_and_Chroma_filters]]&lt;/div&gt;</summary>
		<author><name>Firesledge</name></author>	</entry>

	</feed>