Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Zhao Zhili <quinkblack@foxmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Zhao Zhili <zhilizhao@tencent.com>
Subject: [FFmpeg-devel] [PATCH major bump 1/6] libavutil/hdr_dynamic_vivid_metadata: fix AVHDRVividColorToneMappingParams
Date: Thu,  2 Feb 2023 15:02:03 +0800
Message-ID: <tencent_D693399C714B94261050A326F4E7C1EA8406@qq.com> (raw)
In-Reply-To: <20230202070208.1962086-1-quinkblack@foxmail.com>

From: Zhao Zhili <zhilizhao@tencent.com>

There are two group of three_Spline params. Fix the struct
definition and usecases inside libavcodec, libavfilter and ffprobe.

Co-Author: Houxiang ZHU <zhuhouxiang@theuwa.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 fftools/ffprobe.c                      | 14 ++++++++------
 libavcodec/dynamic_hdr_vivid.c         | 20 +++++++++-----------
 libavfilter/vf_showinfo.c              | 17 +++++++++--------
 libavutil/hdr_dynamic_vivid_metadata.h | 12 ++++++------
 4 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index dfa7ff1b24..a853c70f56 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2246,14 +2246,16 @@ static void print_dynamic_hdr_vivid(WriterContext *w, const AVDynamicHDRVivid *m
                 print_int("3Spline_enable_flag", tm_params->three_Spline_enable_flag);
                 if (tm_params->three_Spline_enable_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_enable", tm_params->three_Spline_TH_enable, '/');
-                        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("3Spline_TH_mode", tm_params->three_Spline_TH_mode[j]);
+                        if (tm_params->three_Spline_TH_mode[j] == 0 || tm_params->three_Spline_TH_mode[j] == 2) {
+                            print_q("3Spline_TH_enable_MB", tm_params->three_Spline_TH_enable_MB[j], '/');
+                        }
+                        print_q("3Spline_TH_enable", tm_params->three_Spline_TH_enable[j], '/');
+                        print_q("3Spline_TH_Delta1", tm_params->three_Spline_TH_Delta1[j], '/');
+                        print_q("3Spline_TH_Delta2", tm_params->three_Spline_TH_Delta2[j], '/');
+                        print_q("3Spline_enable_Strength", tm_params->three_Spline_enable_Strength[j], '/');
                     }
                 }
             }
diff --git a/libavcodec/dynamic_hdr_vivid.c b/libavcodec/dynamic_hdr_vivid.c
index d689669dec..f7a41ed2d5 100644
--- a/libavcodec/dynamic_hdr_vivid.c
+++ b/libavcodec/dynamic_hdr_vivid.c
@@ -101,23 +101,21 @@ int ff_parse_itu_t_t35_to_dynamic_hdr_vivid(AVDynamicHDRVivid *s, const uint8_t
                             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;
+                            if (tm_params->three_Spline_num > FF_ARRAY_ELEMS(tm_params->three_Spline_TH_mode))
+                                return AVERROR_INVALIDDATA;
                             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) {
+                                tm_params->three_Spline_TH_mode[j] = get_bits(gb, 2);
+                                if (tm_params->three_Spline_TH_mode[j] == 0 || tm_params->three_Spline_TH_mode[j] == 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_enable_MB[j] = (AVRational){get_bits(gb, 8),  255};
                                 }
-                                tm_params->three_Spline_TH_enable = (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};
+                                tm_params->three_Spline_TH_enable[j] = (AVRational){get_bits(gb, 12),  4095};
+                                tm_params->three_Spline_TH_Delta1[j] = (AVRational){get_bits(gb, 10),  1023};
+                                tm_params->three_Spline_TH_Delta2[j] = (AVRational){get_bits(gb, 10),  1023};
+                                tm_params->three_Spline_enable_Strength[j] = (AVRational){get_bits(gb,  8),  255};
                             }
-                        } else {
-                            tm_params->three_Spline_num     = 1;
-                            tm_params->three_Spline_TH_mode = 0;
                         }
-
                     }
                 }
             }
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index e55625b338..05829289a5 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -354,19 +354,20 @@ static void dump_dynamic_hdr_vivid(AVFilterContext *ctx, AVFrameSideData *sd)
                 av_log(ctx, AV_LOG_INFO, "3Spline_enable_flag[%d][%d]: %d, ",
                        w, i, tm_params->three_Spline_enable_flag);
                 if (tm_params->three_Spline_enable_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_mode[%d][%d]:  %d, ", w, i, tm_params->three_Spline_TH_mode[j]);
+                        if (tm_params->three_Spline_TH_mode[j] == 0 || tm_params->three_Spline_TH_mode[j] == 2) {
+                            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[j]));
+                        }
                         av_log(ctx, AV_LOG_INFO, "3Spline_TH_enable[%d][%d][%d]: %.4f, ",
-                                w, i, j, av_q2d(tm_params->three_Spline_TH_enable));
+                                w, i, j, av_q2d(tm_params->three_Spline_TH_enable[j]));
                         av_log(ctx, AV_LOG_INFO, "3Spline_TH_Delta1[%d][%d][%d]: %.4f, ",
-                                w, i, j, av_q2d(tm_params->three_Spline_TH_Delta1));
+                                w, i, j, av_q2d(tm_params->three_Spline_TH_Delta1[j]));
                         av_log(ctx, AV_LOG_INFO, "3Spline_TH_Delta2[%d][%d][%d]: %.4f, ",
-                                w, i, j, av_q2d(tm_params->three_Spline_TH_Delta2));
+                                w, i, j, av_q2d(tm_params->three_Spline_TH_Delta2[j]));
                         av_log(ctx, AV_LOG_INFO, "3Spline_enable_Strength[%d][%d][%d]: %.4f, ",
-                                w, i, j, av_q2d(tm_params->three_Spline_enable_Strength));
+                                w, i, j, av_q2d(tm_params->three_Spline_enable_Strength[j]));
                     }
                 }
             }
diff --git a/libavutil/hdr_dynamic_vivid_metadata.h b/libavutil/hdr_dynamic_vivid_metadata.h
index a34f83072c..4ceddc539d 100644
--- a/libavutil/hdr_dynamic_vivid_metadata.h
+++ b/libavutil/hdr_dynamic_vivid_metadata.h
@@ -126,42 +126,42 @@ typedef struct AVHDRVividColorToneMappingParams {
      * The mode of three Spline. the value shall be in the range
      * of 0 to 3, inclusive.
      */
-    int three_Spline_TH_mode;
+    int three_Spline_TH_mode[2];
 
     /**
      * 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;
+    AVRational three_Spline_TH_enable_MB[2];
 
     /**
      * 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_enable;
+    AVRational three_Spline_TH_enable[2];
 
     /**
      * 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;
+    AVRational three_Spline_TH_Delta1[2];
 
     /**
      * 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;
+    AVRational three_Spline_TH_Delta2[2];
 
     /**
      * 3Spline_enable_Strength of three Spline.
      * The value shall be in the range of 0.0 to 1.0, inclusive,
      * and in multiples of 1.0/255.
      */
-    AVRational three_Spline_enable_Strength;
+    AVRational three_Spline_enable_Strength[2];
 } AVHDRVividColorToneMappingParams;
 
 
-- 
2.25.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".

  parent reply	other threads:[~2023-02-02  7:12 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 13:38 [FFmpeg-devel] [PATCH 00/26] Major library version bump James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 01/26] avcodec: remove FF_API_OPENH264_SLICE_MODE James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 02/26] avcodec: remove FF_API_OPENH264_CABAC James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 03/26] avcodec: remove FF_API_UNUSED_CODEC_CAPS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 04/26] avcodec: remove FF_API_THREAD_SAFE_CALLBACKS James Almer
2023-01-20 22:44   ` Michael Niedermayer
2023-01-23 22:05     ` James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 05/26] avcodec: remove FF_API_DEBUG_MV James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 06/26] avcodec: remove FF_API_GET_FRAME_CLASS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 07/26] avcodec: remove FF_API_AUTO_THREADS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 08/26] avcodec: remove FF_API_AVCTX_TIMEBASE James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 09/26] avcodec: remove FF_API_FLAG_TRUNCATED James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 10/26] avcodec: remove FF_API_SUB_TEXT_FORMAT James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 11/26] avformat: remove FF_API_LAVF_PRIV_OPT James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 12/26] avformat: remove FF_API_AVIOCONTEXT_WRITTEN James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 13/26] avformat: remove FF_HLS_TS_OPTIONS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 14/26] avformat: remove FF_API_AVSTREAM_CLASS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 15/26] avfilter: remove FF_API_SWS_PARAM_OPTION James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 16/26] avfilter: remove FF_API_BUFFERSINK_ALLOC James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 17/26] avfilter: remove FF_API_PAD_COUNT James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 18/26] avdevice: remove FF_API_DEVICE_CAPABILITIES James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 19/26] avutil: remove FF_API_D2STR James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 20/26] avutil: remove FF_API_DECLARE_ALIGNED James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 21/26] avutil: remove FF_API_COLORSPACE_NAME James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 22/26] avutil: remove FF_API_AV_MALLOCZ_ARRAY James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 23/26] avutil/version: postpone the remaining API deprecations James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 24/26] avcodec/version: " James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 25/26] avformat/version: " James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 26/26] Bump major versions of all libraries James Almer
2023-01-18 19:28 ` [FFmpeg-devel] [PATCH 00/26] Major library version bump Anton Khirnov
2023-01-18 21:23   ` James Almer
2023-01-19  7:26     ` Anton Khirnov
2023-01-19 12:18       ` James Almer
2023-01-19 15:23         ` Anton Khirnov
2023-01-20  2:05     ` Michael Niedermayer
2023-01-21 16:51       ` Anton Khirnov
2023-01-21 19:33         ` Marvin Scholz
2023-01-21 20:17           ` Hendrik Leppkes
2023-01-21 21:30             ` Marvin Scholz
2023-01-21 22:47               ` Hendrik Leppkes
2023-01-21 21:36         ` Michael Niedermayer
2023-01-21 22:00           ` Marton Balint
2023-01-22 22:54             ` Michael Niedermayer
2023-01-23 17:03             ` Anton Khirnov
2023-01-23 22:41               ` Marton Balint
2023-01-23 22:50                 ` Anton Khirnov
2023-01-23 23:22                   ` Marton Balint
2023-01-24  0:01                     ` Michael Niedermayer
2023-01-24  0:06                       ` Marton Balint
2023-01-24  7:59                         ` Anton Khirnov
2023-01-24 19:48                           ` Marton Balint
2023-01-21 22:01           ` Marvin Scholz
2023-01-20 15:07     ` Tomas Härdin
2023-01-20 21:23   ` Leo Izen
2023-01-21 16:54     ` Anton Khirnov
2023-01-24 15:45 ` Anton Khirnov
2023-01-25 15:44   ` James Almer
2023-01-25 20:08     ` Marton Balint
2023-01-25 20:44       ` Jean-Baptiste Kempf
2023-01-25 21:03         ` Marton Balint
2023-01-25 21:15           ` Jean-Baptiste Kempf
2023-01-25 21:20             ` Paul B Mahol
2023-01-25 21:26               ` Jean-Baptiste Kempf
2023-01-25 21:29                 ` Paul B Mahol
2023-01-25 21:31                   ` Jean-Baptiste Kempf
2023-01-25 21:34                     ` Paul B Mahol
2023-01-25 22:28             ` Marton Balint
2023-01-25 22:48               ` Jean-Baptiste Kempf
2023-01-25 23:25                 ` Marton Balint
2023-01-26 22:16                   ` Michael Niedermayer
2023-01-26 22:49                     ` Jean-Baptiste Kempf
2023-01-26 23:19                       ` Michael Niedermayer
2023-01-26 23:21                         ` Jean-Baptiste Kempf
2023-01-27 18:42                       ` James Almer
2023-01-27 14:05 ` [FFmpeg-devel] [PATCH 26/31] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE Andreas Rheinhardt
     [not found] ` <20230127140600.2831578-1-andreas.rheinhardt@outlook.com>
2023-01-27 14:05   ` [FFmpeg-devel] [PATCH 27/31] avformat/avformat: Remove AVOutputFormat.data_codec Andreas Rheinhardt
2023-01-27 14:05   ` [FFmpeg-devel] [PATCH 28/31] avformat/avformat: Move codecpar up in AVStream Andreas Rheinhardt
2023-01-27 14:05   ` [FFmpeg-devel] [PATCH 29/31] avcodec: Make avcodec_decode_subtitle2 accept a const AVPacket* Andreas Rheinhardt
2023-01-27 14:05   ` [FFmpeg-devel] [PATCH 30/31] avformat/demux: Avoid stack packet when decoding frame Andreas Rheinhardt
2023-01-27 14:06   ` [FFmpeg-devel] [PATCH 31/31] avformat/avformat: Move AVOutputFormat internals out of public header Andreas Rheinhardt
2023-01-28 13:58 ` [FFmpeg-devel] [PATCH 32/32] avutil/{color_utils, csp}: merge color_utils into csp and expose API Leo Izen
2023-01-29 11:08   ` Anton Khirnov
2023-01-30 16:50     ` [FFmpeg-devel] [PATCH v2] " Leo Izen
2023-01-30 17:08       ` Zhao Zhili
2023-01-30 17:12         ` Paul B Mahol
2023-01-30 18:22         ` Leo Izen
2023-01-31  2:20           ` "zhilizhao(赵志立)"
2023-02-02  7:02   ` [FFmpeg-devel] [PATCH major bump 0/6] Fix HDR vivid support Zhao Zhili
2023-02-02  8:00     ` Lance Wang
     [not found]   ` <20230202070208.1962086-1-quinkblack@foxmail.com>
2023-02-02  7:02     ` Zhao Zhili [this message]
2023-02-02  8:16       ` [FFmpeg-devel] [PATCH major bump 1/6] libavutil/hdr_dynamic_vivid_metadata: fix AVHDRVividColorToneMappingParams Anton Khirnov
2023-02-02  8:52         ` "zhilizhao(赵志立)"
2023-02-03 14:28           ` Anton Khirnov
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 2/6] libavcodec/dynamic_hdr_vivid: fix start code check Zhao Zhili
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 3/6] avcodec/dynamic_hdr_vivid: fix base_param_Delta Zhao Zhili
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 4/6] avcodec/dynamic_hdr_vivid: fix base_enable_flag control Zhao Zhili
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 5/6] avcodec/dynamic_hdr_vivid: reindent after the previous commit Zhao Zhili
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 6/6] fftools/ffprobe: fix print_dynamic_hdr_vivid Zhao Zhili
2023-01-29 10:17 ` [FFmpeg-devel] [PATCH 1/3] lavu/fifo: remove FF_API_FIFO_PEEK2 Anton Khirnov
2023-01-29 10:17   ` [FFmpeg-devel] [PATCH 2/3] lavu/fifo: uninline deprecated av_fifo_peek2() Anton Khirnov
2023-01-29 16:11     ` Andreas Rheinhardt
2023-01-29 10:17   ` [FFmpeg-devel] [PATCH 3/3] lavu/fifo: mark all AVFifoBuffer members as deprecated Anton Khirnov

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=tencent_D693399C714B94261050A326F4E7C1EA8406@qq.com \
    --to=quinkblack@foxmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=zhilizhao@tencent.com \
    /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