* [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata
@ 2022-02-14 23:44 lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec: " lance.lmwang
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: lance.lmwang @ 2022-02-14 23:44 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
libavutil/Makefile | 2 +
libavutil/frame.c | 1 +
libavutil/frame.h | 7 +
libavutil/hdr_dynamic_vivid_metadata.c | 47 ++++++
libavutil/hdr_dynamic_vivid_metadata.h | 285 +++++++++++++++++++++++++++++++++
libavutil/version.h | 2 +-
6 files changed, 343 insertions(+), 1 deletion(-)
create mode 100644 libavutil/hdr_dynamic_vivid_metadata.c
create mode 100644 libavutil/hdr_dynamic_vivid_metadata.h
diff --git a/libavutil/Makefile b/libavutil/Makefile
index d17876d..a8d7587 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -34,6 +34,7 @@ HEADERS = adler32.h \
frame.h \
hash.h \
hdr_dynamic_metadata.h \
+ hdr_dynamic_vivid_metadata.h \
hmac.h \
hwcontext.h \
hwcontext_cuda.h \
@@ -130,6 +131,7 @@ OBJS = adler32.o \
frame.o \
hash.o \
hdr_dynamic_metadata.o \
+ hdr_dynamic_vivid_metadata.o \
hmac.o \
hwcontext.o \
imgutils.o \
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 8997c85..b035e28 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -723,6 +723,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
case AV_FRAME_DATA_SPHERICAL: return "Spherical Mapping";
case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";
case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
+ case AV_FRAME_DATA_DYNAMIC_HDR_VIVID: return "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)";
case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
case AV_FRAME_DATA_VIDEO_ENC_PARAMS: return "Video encoding parameters";
case AV_FRAME_DATA_SEI_UNREGISTERED: return "H.26[45] User Data Unregistered SEI message";
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 18e239f..32cde3c 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -158,6 +158,13 @@ enum AVFrameSideDataType {
AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
/**
+ * HDR Vivid dynamic metadata associated with a video frame. The payload is
+ * an AVDynamicHDRVivid type and contains information for color
+ * volume transform - CUVA 005.1-2021.
+ */
+ AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
+
+ /**
* Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
* array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
*/
diff --git a/libavutil/hdr_dynamic_vivid_metadata.c b/libavutil/hdr_dynamic_vivid_metadata.c
new file mode 100644
index 0000000..32da01f
--- /dev/null
+++ b/libavutil/hdr_dynamic_vivid_metadata.c
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2021 Limin Wang <lance.lmwang at gmail.com>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "hdr_dynamic_vivid_metadata.h"
+#include "mem.h"
+
+AVDynamicHDRVivid *av_dynamic_hdr_vivid_alloc(size_t *size)
+{
+ AVDynamicHDRVivid *hdr_vivid = av_mallocz(sizeof(AVDynamicHDRVivid));
+ if (!hdr_vivid)
+ return NULL;
+
+ if (size)
+ *size = sizeof(*hdr_vivid);
+
+ return hdr_vivid;
+}
+
+AVDynamicHDRVivid *av_dynamic_hdr_vivid_create_side_data(AVFrame *frame)
+{
+ AVFrameSideData *side_data = av_frame_new_side_data(frame,
+ AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
+ sizeof(AVDynamicHDRVivid));
+ if (!side_data)
+ return NULL;
+
+ memset(side_data->data, 0, sizeof(AVDynamicHDRVivid));
+
+ return (AVDynamicHDRVivid *)side_data->data;
+}
diff --git a/libavutil/hdr_dynamic_vivid_metadata.h b/libavutil/hdr_dynamic_vivid_metadata.h
new file mode 100644
index 0000000..832f7f9
--- /dev/null
+++ b/libavutil/hdr_dynamic_vivid_metadata.h
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 2021 Limin Wang <lance.lmwang at gmail.com>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
+#define AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
+
+#include "frame.h"
+#include "rational.h"
+
+/**
+ * Color tone mapping parameters at a processing window in a dynamic metadata for
+ * CUVA 005.1:2021.
+ */
+typedef struct AVHDRVividColorToneMappingParams {
+ /**
+ * The nominal maximum display luminance of the targeted system display,
+ * in multiples of 1.0/4095 candelas per square metre. The value shall be in
+ * the range of 0.0 to 1.0, inclusive.
+ */
+ AVRational targeted_system_display_maximum_luminance;
+
+ /**
+ * This flag indicates that transfer the base paramter(for value of 1)
+ */
+ int base_enable_flag;
+
+ /**
+ * base_param_m_p in the base parameter,
+ * in multiples of 1.0/16383. The value shall be in
+ * the range of 0.0 to 1.0, inclusive.
+ */
+ AVRational base_param_m_p;
+
+ /**
+ * base_param_m_m in the base parameter,
+ * in multiples of 1.0/10. The value shall be in
+ * the range of 0.0 to 6.3, inclusive.
+ */
+ AVRational base_param_m_m;
+
+ /**
+ * base_param_m_a in the base parameter,
+ * in multiples of 1.0/1023. The value shall be in
+ * the range of 0.0 to 1.0 inclusive.
+ */
+ AVRational base_param_m_a;
+
+ /**
+ * base_param_m_b in the base parameter,
+ * in multiples of 1/1023. The value shall be in
+ * the range of 0.0 to 1.0, inclusive.
+ */
+ AVRational base_param_m_b;
+
+ /**
+ * base_param_m_n in the base parameter,
+ * in multiples of 1.0/10. The value shall be in
+ * the range of 0.0 to 6.3, inclusive.
+ */
+ AVRational base_param_m_n;
+
+ /**
+ * indicates k1_0 in the base parameter,
+ * base_param_k1 <= 1: k1_0 = base_param_k1
+ * base_param_k1 > 1: reserved
+ */
+ int base_param_k1;
+
+ /**
+ * indicates k2_0 in the base parameter,
+ * base_param_k2 <= 1: k2_0 = base_param_k2
+ * base_param_k2 > 1: reserved
+ */
+ int base_param_k2;
+
+ /**
+ * indicates k3_0 in the base parameter,
+ * base_param_k3 == 1: k3_0 = base_param_k3
+ * base_param_k3 == 2: k3_0 = maximum_maxrgb
+ * base_param_k3 > 2: reserved
+ */
+ int base_param_k3;
+
+ /**
+ * This flag indicates that delta mode of base paramter(for value of 1)
+ */
+ int base_param_Delta_enable_mode;
+
+ /**
+ * base_param_Delta in the base parameter,
+ * in multiples of 1.0/127. The value shall be in
+ * the range of 0.0 to 1.0, inclusive.
+ */
+ AVRational base_param_Delta;
+
+ /**
+ * indicates 3Spline_flag in the base parameter,
+ * This flag indicates that transfer three Spline of base paramter(for value of 1)
+ */
+ int three_Spline_flag;
+
+ /**
+ * The number of three Spline. The value shall be in the range
+ * of 1 to 2, inclusive.
+ */
+ int three_Spline_num;
+
+ /**
+ * The mode of three Spline. the value shall be in the range
+ * of 0 to 3, inclusive.
+ */
+ int three_Spline_TH_mode;
+
+ /**
+ * three_Spline_TH_enable MB is in the range of 0.0 to 1.0, inclusive
+ * and in multiples of 1.0/255.
+ *
+ */
+ AVRational three_Spline_TH_enable_MB;
+
+ /**
+ * 3Spline_TH_enable of three Spline.
+ * The value shall be in the range of 0.0 to 1.0, inclusive.
+ * and in multiples of 1.0/4095.
+ */
+ AVRational three_Spline_TH;
+
+ /**
+ * 3Spline_TH_Delta1 of three Spline.
+ * The value shall be in the range of 0.0 to 0.25, inclusive,
+ * and in multiples of 0.25/1023.
+ */
+ AVRational three_Spline_TH_Delta1;
+
+ /**
+ * 3Spline_TH_Delta2 of three Spline.
+ * The value shall be in the range of 0.0 to 0.25, inclusive,
+ * and in multiples of 0.25/1023.
+ */
+ AVRational three_Spline_TH_Delta2;
+
+ /**
+ * 3Spline_enable_Strength of three Spline.
+ * The value shall be in the range of 0.0 to 1, inclusive,
+ * and in multiples of 1.0/255.
+ */
+ AVRational three_Spline_enable_Strength;
+} AVHDRVividColorToneMappingParams;
+
+
+/**
+ * Color transform parameters at a processing window in a dynamic metadata for
+ * CUVA 005.1:2021.
+ */
+typedef struct AVHDRVividColorTransformParams {
+ /**
+ * Indicates the minimum brightness of the displayed content.
+ * The values should be in the range of 0.0 to 1.0,
+ * inclusive and in multiples of 1/4095.
+ */
+ AVRational minimum_maxrgb;
+
+ /**
+ * Indicates the average brightness of the displayed content.
+ * The values should be in the range of 0.0 to 1.0,
+ * inclusive and in multiples of 1/4095.
+ */
+ AVRational average_maxrgb;
+
+ /**
+ * Indicates the variance brightness of the displayed content.
+ * The values should be in the range of 0.0 to 1.0,
+ * inclusive and in multiples of 1/4095.
+ */
+ AVRational variance_maxrgb;
+
+ /**
+ * Indicates the maximum brightness of the displayed content.
+ * The values should be in the range of 0.0 to 1.0, inclusive
+ * and in multiples of 1/4095.
+ */
+ AVRational maximum_maxrgb;
+
+ /**
+ * This flag indicates that the metadata for the tone mapping function in
+ * the processing window is present (for value of 1).
+ */
+ int tone_mapping_mode_flag;
+
+ /**
+ * The number of tone mapping param. The value shall be in the range
+ * of 1 to 2, inclusive.
+ */
+ int tone_mapping_param_num;
+
+ /**
+ * The color tone mapping parameters.
+ */
+ AVHDRVividColorToneMappingParams tm_params[2];
+
+ /**
+ * This flag indicates that the metadata for the color saturation mapping in
+ * the processing window is present (for value of 1).
+ */
+ int color_saturation_mapping_flag;
+
+ /**
+ * The number of color saturation param. The value shall be in the range
+ * of 0 to 7, inclusive.
+ */
+ int color_saturation_num;
+
+ /**
+ * Indicates the color correction strength parameter.
+ * The values should be in the range of 0.0 to 2.0, inclusive
+ * and in multiples of 1/128.
+ */
+ AVRational color_saturation_gain[8];
+} AVHDRVividColorTransformParams;
+
+/**
+ * This struct represents dynamic metadata for color volume transform -
+ * CUVA 005.1:2021 standard
+ *
+ * To be used as payload of a AVFrameSideData or AVPacketSideData with the
+ * appropriate type.
+ *
+ * @note The struct should be allocated with
+ * av_dynamic_hdr_vivid_alloc() and its size is not a part of
+ * the public ABI.
+ */
+typedef struct AVDynamicHDRVivid {
+ /**
+ * The system start code. The value shall be set to 0x01.
+ */
+ uint8_t system_start_code;
+
+ /**
+ * The number of processing windows. The value shall be set to 0x01
+ * if the system_start_code is 0x01.
+ */
+ uint8_t num_windows;
+
+ /**
+ * The color transform parameters for every processing window.
+ */
+ AVHDRVividColorTransformParams params[3];
+} AVDynamicHDRVivid;
+
+/**
+ * Allocate an AVDynamicHDRVivid structure and set its fields to
+ * default values. The resulting struct can be freed using av_freep().
+ *
+ * @return An AVDynamicHDRVivid filled with default values or NULL
+ * on failure.
+ */
+AVDynamicHDRVivid *av_dynamic_hdr_vivid_alloc(size_t *size);
+
+/**
+ * Allocate a complete AVDynamicHDRVivid and add it to the frame.
+ * @param frame The frame which side data is added to.
+ *
+ * @return The AVDynamicHDRVivid structure to be filled by caller or NULL
+ * on failure.
+ */
+AVDynamicHDRVivid *av_dynamic_hdr_vivid_create_side_data(AVFrame *frame);
+
+#endif /* AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index a9c9bc6..c80e9d7 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 57
-#define LIBAVUTIL_VERSION_MINOR 21
+#define LIBAVUTIL_VERSION_MINOR 22
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
--
1.8.3.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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 2/4] avcodec: support for CUVA HDR Vivid metadata
2022-02-14 23:44 [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata lance.lmwang
@ 2022-02-14 23:44 ` lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 3/4] avfilter: " lance.lmwang
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: lance.lmwang @ 2022-02-14 23:44 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
libavcodec/Makefile | 2 +-
libavcodec/dynamic_hdr_vivid.c | 139 +++++++++++++++++++++++++++++++++++++++++
libavcodec/dynamic_hdr_vivid.h | 35 +++++++++++
libavcodec/hevc_sei.c | 48 +++++++++++++-
libavcodec/hevc_sei.h | 5 ++
libavcodec/hevcdec.c | 15 +++++
6 files changed, 241 insertions(+), 3 deletions(-)
create mode 100644 libavcodec/dynamic_hdr_vivid.c
create mode 100644 libavcodec/dynamic_hdr_vivid.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index cfc70a3..1910137 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -96,7 +96,7 @@ OBJS-$(CONFIG_H264PARSE) += h264_parse.o h2645_parse.o h264_ps.o
OBJS-$(CONFIG_H264PRED) += h264pred.o
OBJS-$(CONFIG_H264QPEL) += h264qpel.o
OBJS-$(CONFIG_HEVCPARSE) += hevc_parse.o h2645_parse.o hevc_ps.o hevc_sei.o hevc_data.o \
- dynamic_hdr10_plus.o
+ dynamic_hdr10_plus.o dynamic_hdr_vivid.o
OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
OBJS-$(CONFIG_HUFFMAN) += huffman.o
OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o
diff --git a/libavcodec/dynamic_hdr_vivid.c b/libavcodec/dynamic_hdr_vivid.c
new file mode 100644
index 0000000..7d0bd43
--- /dev/null
+++ b/libavcodec/dynamic_hdr_vivid.c
@@ -0,0 +1,139 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "dynamic_hdr_vivid.h"
+#include "get_bits.h"
+
+static const int32_t maxrgb_den = 4095;
+static const int32_t color_saturation_gain_den = 128;
+static const int32_t maximum_luminance_den = 4095;
+static const int32_t base_param_m_p_den = 16383;
+static const int32_t base_param_m_m_den = 10;
+static const int32_t base_param_m_a_den = 1023;
+static const int32_t base_param_m_b_den = 1023;
+static const int32_t base_param_m_n_den = 10;
+static const int32_t base_param_Delta_den = 127;
+
+int ff_parse_itu_t_t35_to_dynamic_hdr_vivid(AVDynamicHDRVivid *s, const uint8_t *data,
+ int size)
+{
+ GetBitContext gbc, *gb = &gbc;
+ int ret;
+
+ if (!s)
+ return AVERROR(ENOMEM);
+
+ ret = init_get_bits8(gb, data, size);
+ if (ret < 0)
+ return ret;
+
+ if (get_bits_left(gb) < 8)
+ return AVERROR_INVALIDDATA;
+
+ s->system_start_code = get_bits(gb, 8);
+ if (s->system_start_code == 0x01) {
+ s->num_windows = 1;
+
+ if (get_bits_left(gb) < 12 * 4 * s->num_windows)
+ return AVERROR_INVALIDDATA;
+ for (int w = 0; w < s->num_windows; w++) {
+ AVHDRVividColorTransformParams *params = &s->params[w];
+
+ params->minimum_maxrgb = (AVRational){get_bits(gb, 12), maxrgb_den};
+ params->average_maxrgb = (AVRational){get_bits(gb, 12), maxrgb_den};
+ params->variance_maxrgb = (AVRational){get_bits(gb, 12), maxrgb_den};
+ params->maximum_maxrgb = (AVRational){get_bits(gb, 12), maxrgb_den};
+ }
+
+ if (get_bits_left(gb) < 2 * s->num_windows)
+ return AVERROR_INVALIDDATA;
+ for (int w = 0; w < s->num_windows; w++) {
+ AVHDRVividColorTransformParams *params = &s->params[w];
+
+ params->tone_mapping_mode_flag = get_bits(gb, 1);
+ if (params->tone_mapping_mode_flag) {
+ if (get_bits_left(gb) < 1 )
+ return AVERROR_INVALIDDATA;
+ params->tone_mapping_param_num = get_bits(gb, 1) + 1;
+ for (int i = 0; i < params->tone_mapping_param_num; i++) {
+ AVHDRVividColorToneMappingParams *tm_params = ¶ms->tm_params[i];
+
+ if (get_bits_left(gb) < 13)
+ return AVERROR_INVALIDDATA;
+ tm_params->targeted_system_display_maximum_luminance = (AVRational){get_bits(gb, 12), maximum_luminance_den};
+ tm_params->base_enable_flag = get_bits(gb, 1);
+ if (tm_params->base_enable_flag) {
+ if (get_bits_left(gb) < (14 + 6 + 10 + 10 + 6 + 8 + 10))
+ return AVERROR_INVALIDDATA;
+ tm_params->base_param_m_p = (AVRational){get_bits(gb, 14), base_param_m_p_den};
+ tm_params->base_param_m_m = (AVRational){get_bits(gb, 6), base_param_m_m_den};
+ tm_params->base_param_m_a = (AVRational){get_bits(gb, 10), base_param_m_a_den};
+ tm_params->base_param_m_b = (AVRational){get_bits(gb, 10), base_param_m_b_den};
+ tm_params->base_param_m_n = (AVRational){get_bits(gb, 6), base_param_m_n_den};
+ tm_params->base_param_k1 = get_bits(gb, 2);
+ tm_params->base_param_k2 = get_bits(gb, 2);
+ tm_params->base_param_k3 = get_bits(gb, 4);
+ tm_params->base_param_Delta_enable_mode = get_bits(gb, 3);
+ if (tm_params->base_param_Delta_enable_mode == 2 || tm_params->base_param_Delta_enable_mode == 6)
+ tm_params->base_param_Delta = (AVRational){-get_bits(gb, 7), base_param_Delta_den};
+ else
+ tm_params->base_param_Delta = (AVRational){get_bits(gb, 7), base_param_Delta_den};
+
+ if (get_bits_left(gb) < 1)
+ return AVERROR_INVALIDDATA;
+ tm_params->three_Spline_flag = get_bits(gb, 1);
+ if (tm_params->three_Spline_flag) {
+ if (get_bits_left(gb) < 1 + tm_params->three_Spline_num * (2 + 12 + 28 + 1))
+ return AVERROR_INVALIDDATA;
+ tm_params->three_Spline_num = get_bits(gb, 1) + 1;
+ for (int j = 0; j < tm_params->three_Spline_num; j++) {
+ tm_params->three_Spline_TH_mode = get_bits(gb, 2);
+ if (tm_params->three_Spline_TH_mode == 0 || tm_params->three_Spline_TH_mode == 2) {
+ if (get_bits_left(gb) < 8)
+ return AVERROR_INVALIDDATA;
+ tm_params->three_Spline_TH_enable_MB = (AVRational){get_bits(gb, 8), 255};
+ }
+ tm_params->three_Spline_TH = (AVRational){get_bits(gb, 12), 4095};
+ tm_params->three_Spline_TH_Delta1 = (AVRational){get_bits(gb, 10), 1023};
+ tm_params->three_Spline_TH_Delta2 = (AVRational){get_bits(gb, 10), 1023};
+ tm_params->three_Spline_enable_Strength = (AVRational){get_bits(gb, 8), 255};
+ }
+ } else {
+ tm_params->three_Spline_num = 1;
+ tm_params->three_Spline_TH_mode = 0;
+ }
+
+ }
+ }
+ }
+
+ params->color_saturation_mapping_flag = get_bits(gb, 1);
+ if (params->color_saturation_mapping_flag) {
+ if (get_bits_left(gb) < 3 + params->color_saturation_num * 8)
+ return AVERROR_INVALIDDATA;
+
+ params->color_saturation_num = get_bits(gb, 3);
+ for (int i = 0; i < params->color_saturation_num; i++) {
+ params->color_saturation_gain[i] = (AVRational){get_bits(gb, 8), color_saturation_gain_den};
+ }
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/libavcodec/dynamic_hdr_vivid.h b/libavcodec/dynamic_hdr_vivid.h
new file mode 100644
index 0000000..d521b3d
--- /dev/null
+++ b/libavcodec/dynamic_hdr_vivid.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_DYNAMIC_HDR_VIVID_H
+#define AVCODEC_DYNAMIC_HDR_VIVID_H
+
+#include "libavutil/hdr_dynamic_vivid_metadata.h"
+
+/**
+ * Parse the user data registered ITU-T T.35 to AVbuffer (AVDynamicHDRVivid).
+ * @param s A pointer containing the decoded AVDynamicHDRVivid structure.
+ * @param data The byte array containing the raw ITU-T T.35 data.
+ * @param size Size of the data array in bytes.
+ *
+ * @return 0 if succeed. Otherwise, returns the appropriate AVERROR.
+ */
+int ff_parse_itu_t_t35_to_dynamic_hdr_vivid(AVDynamicHDRVivid *s, const uint8_t *data,
+ int size);
+
+#endif /* AVCODEC_DYNAMIC_HDR_VIVID_H */
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 7fd8226..ec3036f 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -24,6 +24,7 @@
#include "atsc_a53.h"
#include "dynamic_hdr10_plus.h"
+#include "dynamic_hdr_vivid.h"
#include "golomb.h"
#include "hevc_ps.h"
#include "hevc_sei.h"
@@ -245,6 +246,34 @@ static int decode_registered_user_data_dynamic_hdr_plus(HEVCSEIDynamicHDRPlus *s
return 0;
}
+static int decode_registered_user_data_dynamic_hdr_vivid(HEVCSEIDynamicHDRVivid *s,
+ GetBitContext *gb, int size)
+{
+ size_t meta_size;
+ int err;
+ AVDynamicHDRVivid *metadata = av_dynamic_hdr_vivid_alloc(&meta_size);
+ if (!metadata)
+ return AVERROR(ENOMEM);
+
+ err = ff_parse_itu_t_t35_to_dynamic_hdr_vivid(metadata,
+ gb->buffer + get_bits_count(gb) / 8, size);
+ if (err < 0) {
+ av_free(metadata);
+ return err;
+ }
+
+ av_buffer_unref(&s->info);
+ s->info = av_buffer_create((uint8_t *)metadata, meta_size, NULL, NULL, 0);
+ if (!s->info) {
+ av_free(metadata);
+ return AVERROR(ENOMEM);
+ }
+
+ skip_bits_long(gb, size * 8);
+
+ return 0;
+}
+
static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitContext *gb,
void *logctx, int size)
{
@@ -263,9 +292,9 @@ static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
size--;
}
- if (country_code != 0xB5) { // usa_country_code
+ if (country_code != 0xB5 && country_code != 0x26) { // usa_country_code and cn_country_code
av_log(logctx, AV_LOG_VERBOSE,
- "Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d)\n",
+ "Unsupported User Data Registered ITU-T T35 SEI message (country_code = 0x%x)\n",
country_code);
goto end;
}
@@ -273,6 +302,20 @@ static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
provider_code = get_bits(gb, 16);
switch (provider_code) {
+ case 0x04: { // cuva_provider_code
+ const uint16_t cuva_provider_oriented_code = 0x0005;
+ uint16_t provider_oriented_code;
+
+ if (size < 2)
+ return AVERROR_INVALIDDATA;
+ size -= 2;
+
+ provider_oriented_code = get_bits(gb, 16);
+ if (provider_oriented_code == cuva_provider_oriented_code) {
+ return decode_registered_user_data_dynamic_hdr_vivid(&s->dynamic_hdr_vivid, gb, size);
+ }
+ break;
+ }
case 0x3C: { // smpte_provider_code
// A/341 Amendment - 2094-40
const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
@@ -559,4 +602,5 @@ void ff_hevc_reset_sei(HEVCSEI *s)
s->unregistered.nb_buf_ref = 0;
av_freep(&s->unregistered.buf_ref);
av_buffer_unref(&s->dynamic_hdr_plus.info);
+ av_buffer_unref(&s->dynamic_hdr_vivid.info);
}
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index ac8c61c..f198402 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -78,6 +78,10 @@ typedef struct HEVCSEIDynamicHDRPlus {
AVBufferRef *info;
} HEVCSEIDynamicHDRPlus;
+typedef struct HEVCSEIDynamicHDRVivid {
+ AVBufferRef *info;
+} HEVCSEIDynamicHDRVivid;
+
typedef struct HEVCSEIContentLight {
int present;
uint16_t max_content_light_level;
@@ -139,6 +143,7 @@ typedef struct HEVCSEI {
HEVCSEIUnregistered unregistered;
HEVCSEIMasteringDisplay mastering_display;
HEVCSEIDynamicHDRPlus dynamic_hdr_plus;
+ HEVCSEIDynamicHDRVivid dynamic_hdr_vivid;
HEVCSEIContentLight content_light;
int active_seq_parameter_set_id;
HEVCSEIAlternativeTransfer alternative_transfer;
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 1d4ad42..068750d 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2984,6 +2984,17 @@ static int set_side_data(HEVCContext *s)
if ((ret = ff_dovi_attach_side_data(&s->dovi_ctx, out)) < 0)
return ret;
+ if (s->sei.dynamic_hdr_vivid.info) {
+ AVBufferRef *info_ref = av_buffer_ref(s->sei.dynamic_hdr_vivid.info);
+ if (!info_ref)
+ return AVERROR(ENOMEM);
+
+ if (!av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID, info_ref)) {
+ av_buffer_unref(&info_ref);
+ return AVERROR(ENOMEM);
+ }
+ }
+
return 0;
}
@@ -3777,6 +3788,10 @@ static int hevc_update_thread_context(AVCodecContext *dst,
if (ret < 0)
return ret;
+ ret = av_buffer_replace(&s->sei.dynamic_hdr_vivid.info, s0->sei.dynamic_hdr_vivid.info);
+ if (ret < 0)
+ return ret;
+
s->sei.frame_packing = s0->sei.frame_packing;
s->sei.display_orientation = s0->sei.display_orientation;
s->sei.mastering_display = s0->sei.mastering_display;
--
1.8.3.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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 3/4] avfilter: support for CUVA HDR Vivid metadata
2022-02-14 23:44 [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec: " lance.lmwang
@ 2022-02-14 23:44 ` lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 4/4] fftool/ffprobe: " lance.lmwang
2022-02-15 7:08 ` [FFmpeg-devel] [PATCH 1/4] avutil: add " Andreas Rheinhardt
3 siblings, 0 replies; 7+ messages in thread
From: lance.lmwang @ 2022-02-14 23:44 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
libavfilter/vf_showinfo.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 71728bc..bee84b2 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -32,6 +32,7 @@
#include "libavutil/internal.h"
#include "libavutil/film_grain_params.h"
#include "libavutil/hdr_dynamic_metadata.h"
+#include "libavutil/hdr_dynamic_vivid_metadata.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/spherical.h"
@@ -307,6 +308,88 @@ static void dump_dynamic_hdr_plus(AVFilterContext *ctx, AVFrameSideData *sd)
}
}
+static void dump_dynamic_hdr_vivid(AVFilterContext *ctx, AVFrameSideData *sd)
+{
+ AVDynamicHDRVivid *hdr_vivid;
+
+ av_log(ctx, AV_LOG_INFO, "HDR Vivid metadata: ");
+ if (sd->size < sizeof(*hdr_vivid)) {
+ av_log(ctx, AV_LOG_ERROR, "invalid hdr vivid data\n");
+ return;
+ }
+
+ hdr_vivid = (AVDynamicHDRVivid *)sd->data;
+ av_log(ctx, AV_LOG_INFO, "system_start_code: %d, ", hdr_vivid->system_start_code);
+ av_log(ctx, AV_LOG_INFO, "num_windows: %d, ", hdr_vivid->num_windows);
+ for (int w = 0; w < hdr_vivid->num_windows; w++) {
+ const AVHDRVividColorTransformParams *params = &hdr_vivid->params[w];
+
+ av_log(ctx, AV_LOG_INFO, "minimum_maxrgb[%d]: %.4f, ", w, av_q2d(params->minimum_maxrgb));
+ av_log(ctx, AV_LOG_INFO, "average_maxrgb[%d]: %.4f, ", w, av_q2d(params->average_maxrgb));
+ av_log(ctx, AV_LOG_INFO, "variance_maxrgb[%d]:%.4f, ", w, av_q2d(params->variance_maxrgb));
+ av_log(ctx, AV_LOG_INFO, "maximum_maxrgb[%d]: %.4f, ", w, av_q2d(params->maximum_maxrgb));
+ }
+
+ for (int w = 0; w < hdr_vivid->num_windows; w++) {
+ const AVHDRVividColorTransformParams *params = &hdr_vivid->params[w];
+
+ av_log(ctx, AV_LOG_INFO, "tone_mapping_mode_flag[%d]: %d, ", w, params->tone_mapping_mode_flag);
+ av_log(ctx, AV_LOG_INFO, "tone_mapping_param_num[%d]: %d, ", w, params->tone_mapping_param_num);
+ if (params->tone_mapping_mode_flag) {
+ for (int i = 0; i < params->tone_mapping_param_num; i++) {
+ const AVHDRVividColorToneMappingParams *tm_params = ¶ms->tm_params[i];
+
+ av_log(ctx, AV_LOG_INFO, "targeted_system_display_maximum_luminance[%d][%d]: %.4f, ",
+ w, i, av_q2d(tm_params->targeted_system_display_maximum_luminance));
+ av_log(ctx, AV_LOG_INFO, "base_enable_flag[%d][%d]: %d, ",
+ w, i, tm_params->base_enable_flag);
+ if (tm_params->base_enable_flag) {
+ av_log(ctx, AV_LOG_INFO, "base_param_m_p[%d][%d]: %.4f, ", w, i, av_q2d(tm_params->base_param_m_p));
+ av_log(ctx, AV_LOG_INFO, "base_param_m_m[%d][%d]: %.4f, ", w, i, av_q2d(tm_params->base_param_m_m));
+ av_log(ctx, AV_LOG_INFO, "base_param_m_a[%d][%d]: %.4f, ", w, i, av_q2d(tm_params->base_param_m_a));
+ av_log(ctx, AV_LOG_INFO, "base_param_m_b[%d][%d]: %.4f, ", w, i, av_q2d(tm_params->base_param_m_b));
+ av_log(ctx, AV_LOG_INFO, "base_param_m_n[%d][%d]: %.4f, ", w, i, av_q2d(tm_params->base_param_m_n));
+ av_log(ctx, AV_LOG_INFO, "base_param_k1[%d][%d]: %d, ", w, i, tm_params->base_param_k1);
+ av_log(ctx, AV_LOG_INFO, "base_param_k2[%d][%d]: %d, ", w, i, tm_params->base_param_k2);
+ av_log(ctx, AV_LOG_INFO, "base_param_k3[%d][%d]: %d, ", w, i, tm_params->base_param_k3);
+ av_log(ctx, AV_LOG_INFO, "base_param_Delta_enable_mode[%d][%d]: %d, ", w, i,
+ tm_params->base_param_Delta_enable_mode);
+ av_log(ctx, AV_LOG_INFO, "base_param_Delta[%d][%d]: %.4f, ", w, i, av_q2d(tm_params->base_param_Delta));
+ }
+ if (tm_params->three_Spline_flag) {
+ av_log(ctx, AV_LOG_INFO, "3Spline_flag[%d][%d]: %d, ", w, i, tm_params->three_Spline_flag);
+ av_log(ctx, AV_LOG_INFO, "3Spline_TH_mode[%d][%d]: %d, ", w, i, tm_params->three_Spline_TH_mode);
+
+ for (int j = 0; j < tm_params->three_Spline_num; j++) {
+ av_log(ctx, AV_LOG_INFO, "3Spline_TH_enable_MB[%d][%d][%d]: %.4f, ",
+ w, i, j, av_q2d(tm_params->three_Spline_TH_enable_MB));
+ av_log(ctx, AV_LOG_INFO, "3Spline_TH[%d][%d][%d]: %.4f, ",
+ w, i, j, av_q2d(tm_params->three_Spline_TH));
+ av_log(ctx, AV_LOG_INFO, "3Spline_TH_Delta1[%d][%d][%d]: %.4f, ",
+ w, i, j, av_q2d(tm_params->three_Spline_TH_Delta1));
+ av_log(ctx, AV_LOG_INFO, "3Spline_TH_Delta2[%d][%d][%d]: %.4f, ",
+ w, i, j, av_q2d(tm_params->three_Spline_TH_Delta2));
+ av_log(ctx, AV_LOG_INFO, "3Spline_enable_Strength[%d][%d][%d]: %.4f, ",
+ w, i, j, av_q2d(tm_params->three_Spline_enable_Strength));
+ }
+ }
+ }
+ }
+
+ av_log(ctx, AV_LOG_INFO, "color_saturation_mapping_flag[%d]: %d",
+ w, params->color_saturation_mapping_flag);
+ if (params->color_saturation_mapping_flag) {
+ av_log(ctx, AV_LOG_INFO, ", color_saturation_num[%d]: %d",
+ w, params->color_saturation_num);
+ for (int i = 0; i < params->color_saturation_num; i++) {
+ av_log(ctx, AV_LOG_INFO, ", color_saturation_gain[%d][%d]: %.4f",
+ w, i, av_q2d(params->color_saturation_gain[i]));
+ }
+ }
+ }
+}
+
+
static void dump_content_light_metadata(AVFilterContext *ctx, AVFrameSideData *sd)
{
const AVContentLightMetadata *metadata = (const AVContentLightMetadata *)sd->data;
@@ -704,6 +787,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
case AV_FRAME_DATA_DYNAMIC_HDR_PLUS:
dump_dynamic_hdr_plus(ctx, sd);
break;
+ case AV_FRAME_DATA_DYNAMIC_HDR_VIVID:
+ dump_dynamic_hdr_vivid(ctx, sd);
+ break;
case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL:
dump_content_light_metadata(ctx, sd);
break;
--
1.8.3.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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] fftool/ffprobe: support for CUVA HDR Vivid metadata
2022-02-14 23:44 [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec: " lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 3/4] avfilter: " lance.lmwang
@ 2022-02-14 23:44 ` lance.lmwang
2022-02-15 7:08 ` [FFmpeg-devel] [PATCH 1/4] avutil: add " Andreas Rheinhardt
3 siblings, 0 replies; 7+ messages in thread
From: lance.lmwang @ 2022-02-14 23:44 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
fftools/ffprobe.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 8a8e3de..0e8f1d5 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -38,6 +38,7 @@
#include "libavutil/hash.h"
#include "libavutil/hdr_dynamic_metadata.h"
#include "libavutil/mastering_display_metadata.h"
+#include "libavutil/hdr_dynamic_vivid_metadata.h"
#include "libavutil/dovi_meta.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
@@ -2118,6 +2119,72 @@ static void print_dynamic_hdr10_plus(WriterContext *w, const AVDynamicHDRPlus *m
}
}
+static void print_dynamic_hdr_vivid(WriterContext *w, const AVDynamicHDRVivid *metadata)
+{
+ if (!metadata)
+ return;
+ print_int("system_start_code", metadata->system_start_code);
+ print_int("num_windows", metadata->num_windows);
+
+ for (int n = 0; n < metadata->num_windows; n++) {
+ const AVHDRVividColorTransformParams *params = &metadata->params[n];
+
+ print_q("minimum_maxrgb", params->minimum_maxrgb, '/');
+ print_q("average_maxrgb", params->average_maxrgb, '/');
+ print_q("variance_maxrgb", params->variance_maxrgb, '/');
+ print_q("maximum_maxrgb", params->maximum_maxrgb, '/');
+ }
+
+ for (int n = 0; n < metadata->num_windows; n++) {
+ const AVHDRVividColorTransformParams *params = &metadata->params[n];
+
+ print_int("tone_mapping_mode_flag", params->tone_mapping_mode_flag);
+ print_int("tone_mapping_param_num", params->tone_mapping_param_num);
+ if (params->tone_mapping_mode_flag) {
+ for (int i = 0; i < params->tone_mapping_param_num; i++) {
+ const AVHDRVividColorToneMappingParams *tm_params = ¶ms->tm_params[i];
+
+ print_q("targeted_system_display_maximum_luminance",
+ tm_params->targeted_system_display_maximum_luminance, '/');
+ if (tm_params->base_enable_flag) {
+ print_q("base_param_m_p", tm_params->base_param_m_p, '/');
+ print_q("base_param_m_m", tm_params->base_param_m_m, '/');
+ print_q("base_param_m_a", tm_params->base_param_m_a, '/');
+ print_q("base_param_m_b", tm_params->base_param_m_b, '/');
+ print_q("base_param_m_n", tm_params->base_param_m_n, '/');
+
+ print_int("base_param_k1", tm_params->base_param_k1);
+ print_int("base_param_k2", tm_params->base_param_k2);
+ print_int("base_param_k3", tm_params->base_param_k3);
+ print_int("base_param_Delta_enable_mode",
+ tm_params->base_param_Delta_enable_mode);
+ print_q("base_param_Delta", tm_params->base_param_Delta, '/');
+ }
+ if (tm_params->three_Spline_flag) {
+ print_int("3Spline_num", tm_params->three_Spline_num);
+ print_int("3Spline_TH_mode", tm_params->three_Spline_TH_mode);
+
+ for (int j = 0; j < tm_params->three_Spline_num; j++) {
+ print_q("3Spline_TH_enable_MB", tm_params->three_Spline_TH_enable_MB, '/');
+ print_q("3Spline_TH", tm_params->three_Spline_TH, '/');
+ print_q("3Spline_TH_Delta1", tm_params->three_Spline_TH_Delta1, '/');
+ print_q("3Spline_TH_Delta2", tm_params->three_Spline_TH_Delta2, '/');
+ print_q("3Spline_enable_Strength", tm_params->three_Spline_enable_Strength, '/');
+ }
+ }
+ }
+ }
+
+ print_int("color_saturation_mapping_flag", params->color_saturation_mapping_flag);
+ if (params->color_saturation_mapping_flag) {
+ print_int("color_saturation_num", params->color_saturation_num);
+ for (int i = 0; i < params->color_saturation_num; i++) {
+ print_q("color_saturation_gain", params->color_saturation_gain[i], '/');
+ }
+ }
+ }
+}
+
static void print_pkt_side_data(WriterContext *w,
AVCodecParameters *par,
const AVPacketSideData *side_data,
@@ -2537,6 +2604,9 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
print_int("size", sd->size);
} else if (sd->type == AV_FRAME_DATA_DOVI_METADATA) {
print_dovi_metadata(w, (const AVDOVIMetadata *)sd->data);
+ } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_VIVID) {
+ AVDynamicHDRVivid *metadata = (AVDynamicHDRVivid *)sd->data;
+ print_dynamic_hdr_vivid(w, metadata);
}
writer_print_section_footer(w);
}
--
1.8.3.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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata
2022-02-14 23:44 [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata lance.lmwang
` (2 preceding siblings ...)
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 4/4] fftool/ffprobe: " lance.lmwang
@ 2022-02-15 7:08 ` Andreas Rheinhardt
2022-02-15 7:24 ` lance.lmwang
2022-02-26 6:11 ` lance.lmwang
3 siblings, 2 replies; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-02-15 7:08 UTC (permalink / raw)
To: ffmpeg-devel
lance.lmwang@gmail.com:
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavutil/Makefile | 2 +
> libavutil/frame.c | 1 +
> libavutil/frame.h | 7 +
> libavutil/hdr_dynamic_vivid_metadata.c | 47 ++++++
> libavutil/hdr_dynamic_vivid_metadata.h | 285 +++++++++++++++++++++++++++++++++
> libavutil/version.h | 2 +-
> 6 files changed, 343 insertions(+), 1 deletion(-)
> create mode 100644 libavutil/hdr_dynamic_vivid_metadata.c
> create mode 100644 libavutil/hdr_dynamic_vivid_metadata.h
>
> diff --git a/libavutil/Makefile b/libavutil/Makefile
> index d17876d..a8d7587 100644
> --- a/libavutil/Makefile
> +++ b/libavutil/Makefile
> @@ -34,6 +34,7 @@ HEADERS = adler32.h \
> frame.h \
> hash.h \
> hdr_dynamic_metadata.h \
> + hdr_dynamic_vivid_metadata.h \
> hmac.h \
> hwcontext.h \
> hwcontext_cuda.h \
> @@ -130,6 +131,7 @@ OBJS = adler32.o \
> frame.o \
> hash.o \
> hdr_dynamic_metadata.o \
> + hdr_dynamic_vivid_metadata.o \
> hmac.o \
> hwcontext.o \
> imgutils.o \
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index 8997c85..b035e28 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -723,6 +723,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
> case AV_FRAME_DATA_SPHERICAL: return "Spherical Mapping";
> case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";
> case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
> + case AV_FRAME_DATA_DYNAMIC_HDR_VIVID: return "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)";
> case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
> case AV_FRAME_DATA_VIDEO_ENC_PARAMS: return "Video encoding parameters";
> case AV_FRAME_DATA_SEI_UNREGISTERED: return "H.26[45] User Data Unregistered SEI message";
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index 18e239f..32cde3c 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -158,6 +158,13 @@ enum AVFrameSideDataType {
> AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
>
> /**
> + * HDR Vivid dynamic metadata associated with a video frame. The payload is
> + * an AVDynamicHDRVivid type and contains information for color
> + * volume transform - CUVA 005.1-2021.
> + */
> + AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
> +
Always add at the end. You are breaking ABI otherwise.
> + /**
> * Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
> * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
> */
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata
2022-02-15 7:08 ` [FFmpeg-devel] [PATCH 1/4] avutil: add " Andreas Rheinhardt
@ 2022-02-15 7:24 ` lance.lmwang
2022-02-26 6:11 ` lance.lmwang
1 sibling, 0 replies; 7+ messages in thread
From: lance.lmwang @ 2022-02-15 7:24 UTC (permalink / raw)
To: ffmpeg-devel
On Tue, Feb 15, 2022 at 08:08:51AM +0100, Andreas Rheinhardt wrote:
> lance.lmwang@gmail.com:
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavutil/Makefile | 2 +
> > libavutil/frame.c | 1 +
> > libavutil/frame.h | 7 +
> > libavutil/hdr_dynamic_vivid_metadata.c | 47 ++++++
> > libavutil/hdr_dynamic_vivid_metadata.h | 285 +++++++++++++++++++++++++++++++++
> > libavutil/version.h | 2 +-
> > 6 files changed, 343 insertions(+), 1 deletion(-)
> > create mode 100644 libavutil/hdr_dynamic_vivid_metadata.c
> > create mode 100644 libavutil/hdr_dynamic_vivid_metadata.h
> >
> > diff --git a/libavutil/Makefile b/libavutil/Makefile
> > index d17876d..a8d7587 100644
> > --- a/libavutil/Makefile
> > +++ b/libavutil/Makefile
> > @@ -34,6 +34,7 @@ HEADERS = adler32.h \
> > frame.h \
> > hash.h \
> > hdr_dynamic_metadata.h \
> > + hdr_dynamic_vivid_metadata.h \
> > hmac.h \
> > hwcontext.h \
> > hwcontext_cuda.h \
> > @@ -130,6 +131,7 @@ OBJS = adler32.o \
> > frame.o \
> > hash.o \
> > hdr_dynamic_metadata.o \
> > + hdr_dynamic_vivid_metadata.o \
> > hmac.o \
> > hwcontext.o \
> > imgutils.o \
> > diff --git a/libavutil/frame.c b/libavutil/frame.c
> > index 8997c85..b035e28 100644
> > --- a/libavutil/frame.c
> > +++ b/libavutil/frame.c
> > @@ -723,6 +723,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
> > case AV_FRAME_DATA_SPHERICAL: return "Spherical Mapping";
> > case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";
> > case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
> > + case AV_FRAME_DATA_DYNAMIC_HDR_VIVID: return "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)";
> > case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
> > case AV_FRAME_DATA_VIDEO_ENC_PARAMS: return "Video encoding parameters";
> > case AV_FRAME_DATA_SEI_UNREGISTERED: return "H.26[45] User Data Unregistered SEI message";
> > diff --git a/libavutil/frame.h b/libavutil/frame.h
> > index 18e239f..32cde3c 100644
> > --- a/libavutil/frame.h
> > +++ b/libavutil/frame.h
> > @@ -158,6 +158,13 @@ enum AVFrameSideDataType {
> > AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
> >
> > /**
> > + * HDR Vivid dynamic metadata associated with a video frame. The payload is
> > + * an AVDynamicHDRVivid type and contains information for color
> > + * volume transform - CUVA 005.1-2021.
> > + */
> > + AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
> > +
>
> Always add at the end. You are breaking ABI otherwise.
Thanks for the comments, will fix it in the next version.
>
> > + /**
> > * Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
> > * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
> > */
> _______________________________________________
> 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".
--
Thanks,
Limin Wang
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata
2022-02-15 7:08 ` [FFmpeg-devel] [PATCH 1/4] avutil: add " Andreas Rheinhardt
2022-02-15 7:24 ` lance.lmwang
@ 2022-02-26 6:11 ` lance.lmwang
1 sibling, 0 replies; 7+ messages in thread
From: lance.lmwang @ 2022-02-26 6:11 UTC (permalink / raw)
To: ffmpeg-devel
On Tue, Feb 15, 2022 at 08:08:51AM +0100, Andreas Rheinhardt wrote:
> lance.lmwang@gmail.com:
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavutil/Makefile | 2 +
> > libavutil/frame.c | 1 +
> > libavutil/frame.h | 7 +
> > libavutil/hdr_dynamic_vivid_metadata.c | 47 ++++++
> > libavutil/hdr_dynamic_vivid_metadata.h | 285 +++++++++++++++++++++++++++++++++
> > libavutil/version.h | 2 +-
> > 6 files changed, 343 insertions(+), 1 deletion(-)
> > create mode 100644 libavutil/hdr_dynamic_vivid_metadata.c
> > create mode 100644 libavutil/hdr_dynamic_vivid_metadata.h
> >
> > diff --git a/libavutil/Makefile b/libavutil/Makefile
> > index d17876d..a8d7587 100644
> > --- a/libavutil/Makefile
> > +++ b/libavutil/Makefile
> > @@ -34,6 +34,7 @@ HEADERS = adler32.h \
> > frame.h \
> > hash.h \
> > hdr_dynamic_metadata.h \
> > + hdr_dynamic_vivid_metadata.h \
> > hmac.h \
> > hwcontext.h \
> > hwcontext_cuda.h \
> > @@ -130,6 +131,7 @@ OBJS = adler32.o \
> > frame.o \
> > hash.o \
> > hdr_dynamic_metadata.o \
> > + hdr_dynamic_vivid_metadata.o \
> > hmac.o \
> > hwcontext.o \
> > imgutils.o \
> > diff --git a/libavutil/frame.c b/libavutil/frame.c
> > index 8997c85..b035e28 100644
> > --- a/libavutil/frame.c
> > +++ b/libavutil/frame.c
> > @@ -723,6 +723,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
> > case AV_FRAME_DATA_SPHERICAL: return "Spherical Mapping";
> > case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";
> > case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
> > + case AV_FRAME_DATA_DYNAMIC_HDR_VIVID: return "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)";
> > case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
> > case AV_FRAME_DATA_VIDEO_ENC_PARAMS: return "Video encoding parameters";
> > case AV_FRAME_DATA_SEI_UNREGISTERED: return "H.26[45] User Data Unregistered SEI message";
> > diff --git a/libavutil/frame.h b/libavutil/frame.h
> > index 18e239f..32cde3c 100644
> > --- a/libavutil/frame.h
> > +++ b/libavutil/frame.h
> > @@ -158,6 +158,13 @@ enum AVFrameSideDataType {
> > AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
> >
> > /**
> > + * HDR Vivid dynamic metadata associated with a video frame. The payload is
> > + * an AVDynamicHDRVivid type and contains information for color
> > + * volume transform - CUVA 005.1-2021.
> > + */
> > + AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
> > +
>
> Always add at the end. You are breaking ABI otherwise.
plan to push the patchset(including of moving the type at the end) in the next two day if no other more comments
>
> > + /**
> > * Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
> > * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
> > */
> _______________________________________________
> 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".
--
Thanks,
Limin Wang
_______________________________________________
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] 7+ messages in thread
end of thread, other threads:[~2022-02-26 6:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 23:44 [FFmpeg-devel] [PATCH 1/4] avutil: add support for CUVA HDR Vivid metadata lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec: " lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 3/4] avfilter: " lance.lmwang
2022-02-14 23:44 ` [FFmpeg-devel] [PATCH 4/4] fftool/ffprobe: " lance.lmwang
2022-02-15 7:08 ` [FFmpeg-devel] [PATCH 1/4] avutil: add " Andreas Rheinhardt
2022-02-15 7:24 ` lance.lmwang
2022-02-26 6:11 ` lance.lmwang
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