* [FFmpeg-devel] [PATCH] lavu/pixfmt: summarize yuv naming conventions
@ 2022-07-27 15:24 Nicolas George
2022-07-27 15:58 ` Hendrik Leppkes
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas George @ 2022-07-27 15:24 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Nicolas George <george@nsup.org>
---
libavutil/pixfmt.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
Note: we have log2_chroma_h = 2 for yuv410p, meaning each chroma pixel
is 4×4 luma pixels, but everywhere I look on the web, ilcuding:
https://en.wikipedia.org/wiki/Chroma_subsampling
I find that it is supposed to be 4×2, and we should set log2_chroma_h = 1.
Who is right?
Regards,
--
Nicolas George
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 2d3927cc3f..3d0f92ed4d 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -60,6 +60,23 @@
* For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
* for pal8. This palette is filled in automatically by the function
* allocating the picture.
+ *
+ * @par
+ * Summary of the naming conventions for YUV formats:
+ * 444 422 440 420 411 410
+ * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━┿━┿━┿━╋ ╋━┿━┿━┿━╋
+ * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╂─╂─╂─╂─╂ ╂─┼─╂─┼─╂ ╋━┿━┿━┿━╋ ╂─┼─┼─┼─╂
+ * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━┿━┿━┿━╋ ╂─┼─┼─┼─╂
+ * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╂─╂─╂─╂─╂ ╂─┼─╂─┼─╂ ╋━┿━┿━┿━╋ ╂─┼─┼─┼─╂
+ * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━┿━┿━┿━╋ ╋━┿━┿━┿━╋
+ * where
+ * ┼─┼ = luma pixel ╋━╋ = chroma pixel
+ * ┼─┼ ╋━╋
+ *
+ * yuv4ab →
+ * log2_chroma_w = log₂(4/a)
+ * log2_chroma_h = b == a ? 0 : b == 0 ? log2_chroma_w : unused
+ * i.e. a = horizontally, number of luma pixels for four chroma pixels
*/
enum AVPixelFormat {
AV_PIX_FMT_NONE = -1,
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavu/pixfmt: summarize yuv naming conventions
2022-07-27 15:24 [FFmpeg-devel] [PATCH] lavu/pixfmt: summarize yuv naming conventions Nicolas George
@ 2022-07-27 15:58 ` Hendrik Leppkes
2022-07-27 16:48 ` Nicolas George
0 siblings, 1 reply; 3+ messages in thread
From: Hendrik Leppkes @ 2022-07-27 15:58 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, Jul 27, 2022 at 5:25 PM Nicolas George <george@nsup.org> wrote:
>
> Signed-off-by: Nicolas George <george@nsup.org>
> ---
> libavutil/pixfmt.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
>
> Note: we have log2_chroma_h = 2 for yuv410p, meaning each chroma pixel
> is 4×4 luma pixels, but everywhere I look on the web, ilcuding:
> https://en.wikipedia.org/wiki/Chroma_subsampling
> I find that it is supposed to be 4×2, and we should set log2_chroma_h = 1.
> Who is right?
Following the actual naming convention, you would arrive at a 4x2
grid, however even the Wikipedia article linked above is inconsistent
with that. In the first section describing how the naming convention
works, it lists an exception that 4:1:0 is supposedly referencing a
4x4 grid, however further down where 4:1:0 is being detailed, this is
no longer the case.
Many other resources just seem to copy this second Wikipedia description.
We have a variety of decoders that use this format as it is defined
right now, presumably successfully. Of course that could just mean
this format exists, and is just named wrong, on the other hand, did
any decoder ever require the one pixel per 4x4 grid format, giving any
technical baking to the other interpretation?
- Hendrik
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavu/pixfmt: summarize yuv naming conventions
2022-07-27 15:58 ` Hendrik Leppkes
@ 2022-07-27 16:48 ` Nicolas George
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas George @ 2022-07-27 16:48 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 925 bytes --]
Hendrik Leppkes (12022-07-27):
> Following the actual naming convention, you would arrive at a 4x2
> grid, however even the Wikipedia article linked above is inconsistent
> with that. In the first section describing how the naming convention
> works, it lists an exception that 4:1:0 is supposedly referencing a
> 4x4 grid, however further down where 4:1:0 is being detailed, this is
> no longer the case.
> Many other resources just seem to copy this second Wikipedia description.
>
> We have a variety of decoders that use this format as it is defined
> right now, presumably successfully. Of course that could just mean
> this format exists, and is just named wrong, on the other hand, did
> any decoder ever require the one pixel per 4x4 grid format, giving any
> technical baking to the other interpretation?
Thanks for the clarification. Let us leave it as it is.
Regards,
--
Nicolas George
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-27 16:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 15:24 [FFmpeg-devel] [PATCH] lavu/pixfmt: summarize yuv naming conventions Nicolas George
2022-07-27 15:58 ` Hendrik Leppkes
2022-07-27 16:48 ` Nicolas George
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git