Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Leo Izen <leo.izen@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Leo Izen <leo.izen@gmail.com>
Subject: [FFmpeg-devel] [PATCH] avcodec: use sRGB to stringify gbr/bt709/iec61966-2-1 instead
Date: Sat, 17 Jun 2023 14:07:54 -0400
Message-ID: <20230617180754.216755-1-leo.izen@gmail.com> (raw)

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".

             reply	other threads:[~2023-06-17 18:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17 18:07 Leo Izen [this message]
2023-06-18 11:24 ` Derek Buitenhuis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230617180754.216755-1-leo.izen@gmail.com \
    --to=leo.izen@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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