Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Jan Ekström" <jeebjp@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 1/4] avcodec/cbs_{h2645, sei}: add support for Ambient Viewing Environment SEI
Date: Tue, 10 Jan 2023 23:19:46 +0200
Message-ID: <20230110211949.8195-1-jeebjp@gmail.com> (raw)

Defined by H.274, this SEI message is utilized by iPhones to save
the nominal ambient viewing environment for the display of recorded
HDR content.
---
 libavcodec/cbs_h2645.c               |  6 ++++++
 libavcodec/cbs_sei.h                 |  6 ++++++
 libavcodec/cbs_sei_syntax_template.c | 17 +++++++++++++++++
 3 files changed, 29 insertions(+)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 4ee06003c3..80e48829af 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -1500,6 +1500,12 @@ static const SEIMessageTypeDescriptor cbs_sei_common_types[] = {
         sizeof(SEIRawAlternativeTransferCharacteristics),
         SEI_MESSAGE_RW(sei, alternative_transfer_characteristics),
     },
+    {
+        SEI_TYPE_AMBIENT_VIEWING_ENVIRONMENT,
+        1, 0,
+        sizeof(SEIRawAmbientViewingEnvironment),
+        SEI_MESSAGE_RW(sei, ambient_viewing_environment),
+    },
     SEI_MESSAGE_TYPE_END,
 };
 
diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h
index c7a7a95be0..1c327a4689 100644
--- a/libavcodec/cbs_sei.h
+++ b/libavcodec/cbs_sei.h
@@ -65,6 +65,12 @@ typedef struct SEIRawAlternativeTransferCharacteristics {
     uint8_t preferred_transfer_characteristics;
 } SEIRawAlternativeTransferCharacteristics;
 
+typedef struct SEIRawAmbientViewingEnvironment {
+    uint32_t ambient_illuminance;
+    uint16_t ambient_light_x;
+    uint16_t ambient_light_y;
+} SEIRawAmbientViewingEnvironment;
+
 typedef struct SEIRawMessage {
     uint32_t     payload_type;
     uint32_t     payload_size;
diff --git a/libavcodec/cbs_sei_syntax_template.c b/libavcodec/cbs_sei_syntax_template.c
index 0ef7b42ed9..6a7cc36dda 100644
--- a/libavcodec/cbs_sei_syntax_template.c
+++ b/libavcodec/cbs_sei_syntax_template.c
@@ -144,6 +144,23 @@ static int FUNC(alternative_transfer_characteristics)
     return 0;
 }
 
+static int FUNC(ambient_viewing_environment)
+    (CodedBitstreamContext *ctx, RWContext *rw,
+     SEIRawAmbientViewingEnvironment *current,
+     SEIMessageState *state)
+{
+    static const uint16_t max_ambient_light_value = 50000;
+    int err;
+
+    HEADER("Ambient Viewing Environment");
+
+    u(32, ambient_illuminance, 1, MAX_UINT_BITS(32));
+    u(16, ambient_light_x, 0, max_ambient_light_value);
+    u(16, ambient_light_y, 0, max_ambient_light_value);
+
+    return 0;
+}
+
 static int FUNC(message)(CodedBitstreamContext *ctx, RWContext *rw,
                          SEIRawMessage *current)
 {
-- 
2.39.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-01-10 21:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 21:19 Jan Ekström [this message]
2023-01-10 21:19 ` [FFmpeg-devel] [PATCH 2/4] avutil: introduce AVAmbientViewingEnvironment side data Jan Ekström
2023-01-10 21:25   ` James Almer
2023-01-10 21:19 ` [FFmpeg-devel] [PATCH 3/4] ffprobe: expose AVAmbientViewingEnvironment side data in AVFrames Jan Ekström
2023-01-10 21:35   ` James Almer
2023-01-14 20:03   ` Stefano Sabatini
2023-01-14 20:59     ` Jan Ekström
2023-01-15  1:14       ` Stefano Sabatini
2023-01-10 21:19 ` [FFmpeg-devel] [PATCH 4/4] avcodec/h2645_sei: add support for Ambient Viewing Environment SEI Jan Ekström
2023-01-10 21:33   ` James Almer
2023-01-10 21:34 ` [FFmpeg-devel] [PATCH 1/4] avcodec/cbs_{h2645, sei}: " James Almer
2023-01-11 18:57 ` [FFmpeg-devel] [PATCH v2 " Jan Ekström
2023-01-11 18:57   ` [FFmpeg-devel] [PATCH v2 2/4] avutil: introduce AVAmbientViewingEnvironment side data Jan Ekström
2023-01-11 18:57   ` [FFmpeg-devel] [PATCH v2 3/4] ffprobe: expose AVAmbientViewingEnvironment side data in AVFrames Jan Ekström
2023-01-11 18:57   ` [FFmpeg-devel] [PATCH v2 4/4] avcodec/h2645_sei: add support for Ambient Viewing Environment SEI Jan Ekström
2023-01-13 19:39   ` [FFmpeg-devel] [PATCH v2 1/4] avcodec/cbs_{h2645, sei}: " Jan Ekström

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=20230110211949.8195-1-jeebjp@gmail.com \
    --to=jeebjp@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