Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec: use sRGB to stringify gbr/bt709/iec61966-2-1 instead
@ 2023-06-17 18:07 Leo Izen
  2023-06-18 11:24 ` Derek Buitenhuis
  0 siblings, 1 reply; 2+ messages in thread
From: Leo Izen @ 2023-06-17 18:07 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Leo Izen

The sRGB color space uses RGB matrix (i.e. identity), BT.709 primaries,
and the ISO/IEC 61966-2-1 transfer function (unique to sRGB). This set
of tags is very common, so printing it as "sRGB" instead of the current
form "gbr/bt709/iec61966-2-1" is preferable.

Signed-off-by: <leo.izen@gmail.com>
---
 libavcodec/avcodec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index db8226f9b3..8132c76aad 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -571,7 +571,11 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
                 const char *col = unknown_if_null(av_color_space_name(enc->colorspace));
                 const char *pri = unknown_if_null(av_color_primaries_name(enc->color_primaries));
                 const char *trc = unknown_if_null(av_color_transfer_name(enc->color_trc));
-                if (strcmp(col, pri) || strcmp(col, trc)) {
+                if (enc->colorspace == AVCOL_SPC_RGB &&
+                        enc->color_primaries == AVCOL_PRI_BT709 &&
+                        enc->color_trc == AVCOL_TRC_IEC61966_2_1) {
+                    av_bprintf(&bprint, "sRGB, ");
+                } else if (strcmp(col, pri) || strcmp(col, trc)) {
                     new_line = 1;
                     av_bprintf(&bprint, "%s/%s/%s, ", col, pri, trc);
                 } else
-- 
2.41.0

_______________________________________________
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] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec: use sRGB to stringify gbr/bt709/iec61966-2-1 instead
  2023-06-17 18:07 [FFmpeg-devel] [PATCH] avcodec: use sRGB to stringify gbr/bt709/iec61966-2-1 instead Leo Izen
@ 2023-06-18 11:24 ` Derek Buitenhuis
  0 siblings, 0 replies; 2+ messages in thread
From: Derek Buitenhuis @ 2023-06-18 11:24 UTC (permalink / raw)
  To: ffmpeg-devel

On 6/17/2023 7:07 PM, Leo Izen wrote:
> -                if (strcmp(col, pri) || strcmp(col, trc)) {
> +                if (enc->colorspace == AVCOL_SPC_RGB &&
> +                        enc->color_primaries == AVCOL_PRI_BT709 &&
> +                        enc->color_trc == AVCOL_TRC_IEC61966_2_1) {
> +                    av_bprintf(&bprint, "sRGB, ");
> +                } else if (strcmp(col, pri) || strcmp(col, trc)) {

I real dont think special casing a single colorspace like this is a good idea,
nor do I think hiding the explicit values is.

Same reason we do not special case e.g. HLG.

- Derek
_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2023-06-18 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-17 18:07 [FFmpeg-devel] [PATCH] avcodec: use sRGB to stringify gbr/bt709/iec61966-2-1 instead Leo Izen
2023-06-18 11:24 ` Derek Buitenhuis

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