Opened 2 years ago

Closed 2 years ago

#9526 closed defect (invalid)

AV_PIX_FMT_YUV410P description incorrect

Reported by: Anton1699 Owned by:
Priority: normal Component: avutil
Version: git-master Keywords: pixdesc
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

[AV_PIX_FMT_YUV410P] = {
    .name = "yuv410p",
    .nb_components = 3,
    .log2_chroma_w = 2,
    .log2_chroma_h = 2,
    .comp = {
        { 0, 1, 0, 0, 8 },        /* Y */
        { 1, 1, 0, 0, 8 },        /* U */
        { 2, 1, 0, 0, 8 },        /* V */
    },
    .flags = AV_PIX_FMT_FLAG_PLANAR,
}

YUV 4:1:0 contains one pair of chroma samples per 4x2 block of luma samples, so log2_chroma_h should be 1 or am I reading this wrong?

Change History (2)

comment:1 by Anton1699, 2 years ago

Summary: AV_PIX_FMT_YUV410P description incorretAV_PIX_FMT_YUV410P description incorrect

comment:2 by Marton Balint, 2 years ago

Resolution: invalid
Status: newclosed

4:1:0 notation can be used for both one chroma pair per 4x2 block and one chroma pair per 4x4 block. However in ffmpeg AV_PIX_FMT_YUV410P means the latter, one chroma pair per 4x4 block.

Even wikipedia is confused and using both terms:

https://en.wikipedia.org/wiki/Chroma_subsampling

This notation is not valid for all combinations and has exceptions, e.g. 4:1:0 (where the height of the region is not 2 pixels, but 4 pixels, so if 8 bits per component are used, the media would be 9 bits per pixel) and 4:2:1.

but later:

This ratio uses half of the vertical and one-fourth the horizontal color resolutions, with only one-eighth of the bandwidth of the maximum color resolutions used. Uncompressed video in this format with 8-bit quantization uses 10 bytes for every macropixel (which is 4×2 pixels). Some video codecs may operate at 4:1:0.5 or 4:1:0.25 as an option, so as to allow similar to VHS quality.

So log2_chroma_h is fine as is in ffmpeg.

Note: See TracTickets for help on using tickets.