Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 2/9] avcodec/dynamic_hdr_vivid: fix three spline params
Date: Fri, 24 Feb 2023 10:33:38 -0300
Message-ID: <8bf59545-b8a1-bd88-f83c-ba0db7ee6f04@gmail.com> (raw)
In-Reply-To: <tencent_CC5E9A8C40BB9A5E9F2BAB4C4EDD70312D08@qq.com>

On 2/24/2023 6:08 PM, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> ---
>   libavcodec/dynamic_hdr_vivid.c | 34 +++++++++++++++++++++++-----------
>   1 file changed, 23 insertions(+), 11 deletions(-)
> 
> diff --git a/libavcodec/dynamic_hdr_vivid.c b/libavcodec/dynamic_hdr_vivid.c
> index d689669dec..35be6f5e2b 100644
> --- a/libavcodec/dynamic_hdr_vivid.c
> +++ b/libavcodec/dynamic_hdr_vivid.c
> @@ -98,26 +98,38 @@ int ff_parse_itu_t_t35_to_dynamic_hdr_vivid(AVDynamicHDRVivid *s, const uint8_t
>                               return AVERROR_INVALIDDATA;
>                           tm_params->three_Spline_enable_flag = get_bits(gb, 1);
>                           if (tm_params->three_Spline_enable_flag) {
> +                            AVHDRVivid3SplineParams *three_spline;
> +
>                               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))
> +                                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) {
> +                                three_spline = tm_params->three_spline + j;

Preferably do:

three_spline = &tm_params->three_spline[j];

> +                                three_spline->th_mode = get_bits(gb, 2);
> +                                if (three_spline->th_mode == 0 || 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};
> +                                    three_spline->th_enable_mb = (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};
> +                                three_spline->th_enable = (AVRational){get_bits(gb, 12),  4095};
> +                                three_spline->th_delta1 = (AVRational){get_bits(gb, 10),  1023};
> +                                three_spline->th_delta2 = (AVRational){get_bits(gb, 10),  1023};
> +                                three_spline->enable_strength = (AVRational){get_bits(gb,  8),  255};
>                               }
> -                        } else {
> -                            tm_params->three_Spline_num     = 1;
> -                            tm_params->three_Spline_TH_mode = 0;
> +#if FF_API_HDR_VIVID_THREE_SPLINE
> +                            three_spline = tm_params->three_spline;

Also here:

three_spline = &tm_params->three_spline[0];

Same in every other case in this patchset.

> +                            AV_NOWARN_DEPRECATED(

This is an internal file, so use the FF_DISABLE_DEPRECATION_WARNINGS and 
FF_ENABLE_DEPRECATION_WARNINGS wrappers instead of the public one.

> +                            tm_params->three_Spline_TH_mode = three_spline->th_mode;
> +                            tm_params->three_Spline_TH_enable_MB = three_spline->th_enable_mb;
> +                            tm_params->three_Spline_TH_enable = three_spline->th_enable;
> +                            tm_params->three_Spline_TH_Delta1 = three_spline->th_delta1;
> +                            tm_params->three_Spline_TH_Delta2 = three_spline->th_delta2;
> +                            tm_params->three_Spline_enable_Strength = three_spline->enable_strength;
> +                            )
> +#endif
>                           }
> -
>                       }
>                   }
>               }
_______________________________________________
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-02-24 13:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230224210848.535436-1-quinkblack@foxmail.com>
2023-02-24 21:08 ` Zhao Zhili
2023-02-24 13:33   ` James Almer [this message]
2023-02-24 15:52     ` [FFmpeg-devel] [PATCH v2 1/9] libavutil/hdr_dynamic_vivid_metadata: " Zhao Zhili
2023-03-17  3:16       ` "zhilizhao(赵志立)"
     [not found]     ` <20230224155222.194400-1-quinkblack@foxmail.com>
2023-02-24 15:52       ` [FFmpeg-devel] [PATCH v2 2/9] avcodec/dynamic_hdr_vivid: " Zhao Zhili
2023-02-24 15:52       ` [FFmpeg-devel] [PATCH v2 3/9] avfilter/vf_showinfo: fix HDR vivid info Zhao Zhili
2023-02-24 15:52       ` [FFmpeg-devel] [PATCH v2 4/9] fftools/ffprobe: " Zhao Zhili
2023-02-24 15:52       ` [FFmpeg-devel] [PATCH v2 5/9] libavcodec/dynamic_hdr_vivid: fix start code check Zhao Zhili
2023-02-24 15:52       ` [FFmpeg-devel] [PATCH v2 6/9] avcodec/dynamic_hdr_vivid: fix base_param_Delta Zhao Zhili
2023-02-24 15:52       ` [FFmpeg-devel] [PATCH v2 7/9] avcodec/dynamic_hdr_vivid: fix base_enable_flag control Zhao Zhili
2023-02-24 15:52       ` [FFmpeg-devel] [PATCH v2 8/9] avcodec/dynamic_hdr_vivid: reindent after the previous commit Zhao Zhili
2023-02-24 15:52       ` [FFmpeg-devel] [PATCH v2 9/9] fftools/ffprobe: fix print_dynamic_hdr_vivid Zhao Zhili
2023-02-24 21:08 ` [FFmpeg-devel] [PATCH 3/9] avfilter/vf_showinfo: fix HDR vivid info Zhao Zhili
2023-02-24 21:08 ` [FFmpeg-devel] [PATCH 4/9] fftools/ffprobe: " Zhao Zhili
2023-02-24 21:08 ` [FFmpeg-devel] [PATCH 5/9] libavcodec/dynamic_hdr_vivid: fix start code check Zhao Zhili
2023-02-24 21:08 ` [FFmpeg-devel] [PATCH 6/9] avcodec/dynamic_hdr_vivid: fix base_param_Delta Zhao Zhili
2023-02-24 21:08 ` [FFmpeg-devel] [PATCH 7/9] avcodec/dynamic_hdr_vivid: fix base_enable_flag control Zhao Zhili
2023-02-24 21:08 ` [FFmpeg-devel] [PATCH 8/9] avcodec/dynamic_hdr_vivid: reindent after the previous commit Zhao Zhili
2023-02-24 21:08 ` [FFmpeg-devel] [PATCH 9/9] fftools/ffprobe: fix print_dynamic_hdr_vivid Zhao Zhili

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=8bf59545-b8a1-bd88-f83c-ba0db7ee6f04@gmail.com \
    --to=jamrial@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