Den 25.07.2024 17:16, skrev Terje J. Hanssen:
Usually 8-bit color depth is refered to 420 pixel formats and 10-bit to the higher color quality 422 pixel formats, which sub-sampled keeps respectively 25% and 50% color information, compared with a full 444 format.
But what about the "opposite" cases, 10-bit 420 and 8-bit 422 pixel formats? What and when are they used and good for (applications)? For example frame grabbers like my HDMI->USB3 mini capture card, looks to support 'YUY2',' a 8-bit 422 pixel format.
And among 8-bit and 10-bit depths, there are 'yuv', 'nv', 'y' and 'p' prefixed pixel formats as well.
I have found some more useful information and references to this topic, and add related extracts from these below (some overlapped): YUY2 * is a packed color format that uses 4:2:2 chroma subsampling. Each pixel has either a U or V sample, but not both. * 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. YV12 * 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. * 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 https://www.afterdawn.com/guides/archive/digital_video_fundamentals-color_fo... YUY2 * 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. YV12 * 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. NV12 * 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. NV21 * 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). https://learn.microsoft.com/en-us/windows-hardware/drivers/display/4-2-0-vid... https://www.loc.gov/preservation/digital/formats/fdd/fdd000364.shtml YUY2 * 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. * 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. * 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). YV12 * Even less chroma sampling * 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. https://www.animemusicvideos.org/guides/avtech/colorspace.html Avisynthplus: Color formats and YV12 (a frameserver available for Windows, Linux, BSD and MacOS): What is YV12? * 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. * The subsampling used by YV12 is also called "4:2:0" compared to "4:2:2" which is used by YUY2 and UYVY. What will be the main advantages of processing in YV12? * speed increase: * 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. * no color conversions: * The colour information doesn't get interpolated (so often) and thus stays more realistic. 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: * 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. * 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. http://avisynth.nl/index.php/FAQ_YV12#What_is_YV12.3F http://avisynth.nl/index.php/Avisynthplus_color_formats#Color_Format_Table
......snip
References: Chroma Subsampling in ffmpeg https://trac.ffmpeg.org/wiki/Chroma%20Subsampling#SettingChromaSubsamplingin... Preferred YUV Formats (Microsoft Windows, Learn) https://learn.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-y...