<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<br>
<div class="moz-cite-prefix">Den 25.07.2024 17:16, skrev Terje J.
Hanssen:<br>
</div>
<blockquote type="cite"
cite="mid:43f28a4d-2d28-4158-a62d-a82a38229f28@gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Usually 8-bit color depth is refered to 420 pixel formats and
10-bit to the higher color quality 422 pixel formats,<br>
which sub-sampled keeps respectively 25% and 50% color
information, compared with a full 444 format.<br>
<br>
But what about the "opposite" cases, 10-bit 420 and 8-bit 422
pixel formats?<br>
What and when are they used and good for (applications)?<br>
For example frame grabbers like my HDMI->USB3 mini capture
card, looks to support 'YUY2',' a 8-bit 422 pixel format. <br>
<br>
And among 8-bit and 10-bit depths, there are 'yuv', 'nv', 'y' and
'p' prefixed pixel formats as well.<br>
</blockquote>
<br>
<br>
I have found some more useful information and references to this
topic, and add related extracts from these below (some overlapped):<br>
<br>
YUY2<br>
<ul>
<li>is a packed color format that uses 4:2:2 chroma subsampling.
Each pixel has either a U or V sample, but not both.
</li>
<li>is a Chroma subsampled YUV Color Space with chroma sampled at
half the horizontal Resolution Luma is sampled at. YUY2 is
mostly used for analog Capture and editing because it's
generally not considered compressed enough for storage or
transmission purposes.</li>
</ul>
YV12 <br>
<ul>
<li>is a planar color format that uses 4:2:0 chroma subsampling.
Each chroma sample is located at the nexus of 4 pixels. In the
diagram below the chroma layers are shown relative to pixel
positions. </li>
<li>is a Chroma subsampled YUV Color Space with chroma sampled at
half the horizontal and vertical Resolution Luma is sampled at.
YV12 is primarily used for compressing for storage and
transmission because it's not as good as YUY2 for editing. DVD
uses YV12 </li>
</ul>
<a class="moz-txt-link-freetext" href="https://www.afterdawn.com/guides/archive/digital_video_fundamentals-color_formats_page_5.cfm">https://www.afterdawn.com/guides/archive/digital_video_fundamentals-color_formats_page_5.cfm</a><br>
<br>
<br>
YUY2 <br>
<ul>
<li>As described in 4:2:2 Video Pixel Formats, except that two
lines of output Cb and Cr samples are produced for each actual
line of 4:2:0 Cb and Cr samples. The second line of each pair of
output lines is generally either a duplicate of the first line
or is produced by averaging the samples in the first line of the
pair with the samples of the first line of the next pair.</li>
</ul>
YV12 <br>
<ul>
<li>All Y samples are found first in memory as an array of
unsigned char (possibly with a larger stride for memory
alignment), followed immediately by all Cr samples (with half
the stride of the Y lines, and half the number of lines), then
followed immediately by all Cb samples in a similar fashion.</li>
</ul>
NV12 <br>
<ul>
<li>A format in which all Y samples are found first in memory as
an array of unsigned char with an even number of lines (possibly
with a larger stride for memory alignment). This is followed
immediately by an array of unsigned char containing interleaved
Cb and Cr samples. If these samples are addressed as a
little-endian WORD type, Cb would be in the least significant
bits and Cr would be in the most significant bits with the same
total stride as the Y samples. NV12 is the preferred 4:2:0 pixel
format.</li>
</ul>
NV21 <br>
<ul>
<li>The same as NV12, except that Cb and Cr samples are swapped so
that the chroma array of unsigned char would have Cr followed by
Cb for each sample (such that if addressed as a little-endian
WORD type, Cr would be in the least significant bits and Cb
would be in the most significant bits).</li>
</ul>
<a class="moz-txt-link-freetext" href="https://learn.microsoft.com/en-us/windows-hardware/drivers/display/4-2-0-video-pixel-formats">https://learn.microsoft.com/en-us/windows-hardware/drivers/display/4-2-0-video-pixel-formats</a><br>
<a class="moz-txt-link-freetext" href="https://www.loc.gov/preservation/digital/formats/fdd/fdd000364.shtml">https://www.loc.gov/preservation/digital/formats/fdd/fdd000364.shtml</a><br>
<br>
<br>
YUY2 <br>
<ul>
<li>is a type of YUV that samples the luma once every pixel but
only samples the chroma once every horizontal pair of pixels -
the point being that the human eye doesn't really notice that
the chroma of the two pixels is the same when the luma values
are different. It's just like the way you can be less accurate
when coloring in a black and white picutre than if you were
making the picture from scratch with only colored pencils.</li>
<li>So basically YUY2 stores color data at a lower accuracy than
RGB without us really noticing that much. Effectively what
happens is that the chroma information is half the regular
vertical resolution.</li>
<li>Due to this nature of YUY2, when you convert between YUY2 and
RGB you either lose some data (as the chroma is averaged), or
assumptions have to be made and data must be guessed at or
interpolated (because the chroma is averaged already we can't
find out what the real value was before).</li>
</ul>
YV12 <br>
<ul>
<li>Even less chroma sampling</li>
<li>is much like YUY2 but takes this one step further. Where YUY2
samples chroma once in every 2 pixels in a row, YV12 samples
chroma once in every 2x2 pixel block! You'd think that only
having one chroma sample in a 2x2 square would look terrible but
the fact is that we don't really notice the difference all that
much. Of course, because there are so many less chroma samples
(it's effectively half the resoltion than the luma) there is
less information to store which is great for saving bits. All
major distribution codecs use a 1 chroma for 4 pixels method -
including MPEG2 on DVDs. </li>
</ul>
<a class="moz-txt-link-freetext" href="https://www.animemusicvideos.org/guides/avtech/colorspace.html">https://www.animemusicvideos.org/guides/avtech/colorspace.html</a><br>
<br>
<br>
Avisynthplus: Color formats and YV12 (a frameserver available for
Windows, Linux, BSD and MacOS):<br>
<br>
What is YV12?<br>
<ul>
<li>These are several different ways to represent colors. For
example: YUV and RGB colorspace. In YUV colorspace there is one
component that represent lightness (luma) and two other
components that represent color (chroma). As long as the luma is
conveyed with full detail, detail in the chroma components can
be reduced by subsampling (filtering, or averaging) which can be
done in several ways (thus there are multiple formats for
storing a picture in YUV colorspace). YV12 is such a format
(where chroma is shared in every 2x2 pixel block) that is
supported by AviSynth. Many important codecs stored the video in
YV12: MPEG-4 (x264, XviD, DivX and many others), MPEG-2 on DVDs,
MPEG-1 and MJPEG.</li>
<li>The subsampling used by YV12 is also called "4:2:0" compared
to "4:2:2" which is used by YUY2 and UYVY.</li>
</ul>
What will be the main advantages of processing in YV12?<br>
<ul>
<li>speed increase:</li>
<li>That depends entirely on the external plugins whether they
will have YV12 support or not. Speed increases like 25-35
percent are expected. Of course there will only be a large speed
increase if both your source and target are in YV12, for example
in DVD to DivX/Xvid conversions. </li>
<li>no color conversions:</li>
<li>The colour information doesn't get interpolated (so often) and
thus stays more realistic. </li>
</ul>
MPEG-2 encoders such as CCE, Procoder and TMPGEnc can't handle YV12
input directly. CCE and Procoder needs YUY2, and TMPGEnc RGB24. This
only means that the last line of AviSynth must be a ConvertToYUY2
(for CCE/Procoder, or ConvertToRGB24 for TMPGEnc) call, and that you
will not be able to take full advantage of YV12 colorspace. Still
there are two advantages:<br>
<ul>
<li>All internal filtering in AviSynth will be faster though (less
data to filter, better structure to filter, and a very fast
conversion from YV12 to YUY2), and you will definitely be able
to tell the difference between v2.06 and v2.5.</li>
<li>If you are making a progressive clip there is another
advantage. Putting off the YV12->YUY2 conversion until the
end of the script allows you to first IVTC or Deinterlace to
create progressive frames. But the YV12 to YUY2 conversion for
progressive frames maintains more chroma detail than it does for
interlaced or field-based frames.</li>
</ul>
<a class="moz-txt-link-freetext" href="http://avisynth.nl/index.php/FAQ_YV12#What_is_YV12.3F">http://avisynth.nl/index.php/FAQ_YV12#What_is_YV12.3F</a><br>
<a class="moz-txt-link-freetext" href="http://avisynth.nl/index.php/Avisynthplus_color_formats#Color_Format_Table">http://avisynth.nl/index.php/Avisynthplus_color_formats#Color_Format_Table</a><br>
<br>
<br>
<blockquote type="cite"
cite="mid:43f28a4d-2d28-4158-a62d-a82a38229f28@gmail.com">......snip<br>
</blockquote>
<br>
<blockquote type="cite"
cite="mid:43f28a4d-2d28-4158-a62d-a82a38229f28@gmail.com">
References:<br>
Chroma Subsampling in ffmpeg<br>
<a class="moz-txt-link-freetext"
href="https://trac.ffmpeg.org/wiki/Chroma%20Subsampling#SettingChromaSubsamplinginffmpeg"
moz-do-not-send="true">https://trac.ffmpeg.org/wiki/Chroma%20Subsampling#SettingChromaSubsamplinginffmpeg</a><br>
Preferred YUV Formats (Microsoft Windows, Learn)<br>
<a class="moz-txt-link-freetext"
href="https://learn.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats#preferred-yuv-formats"
moz-do-not-send="true">https://learn.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats#preferred-yuv-formats</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
</body>
</html>