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 1/4] avcodec/cbs_h265: fix range of sps_max_sub_layers_minus1
Date: Mon, 15 Jul 2024 15:29:39 -0300
Message-ID: <1f71d71b-edbe-4c9d-b6b7-b0bb0c8fa7c1@gmail.com> (raw)
In-Reply-To: <20240713145846.1331-1-jamrial@gmail.com>

On 7/13/2024 11:58 AM, James Almer wrote:
> The VPS referenced by the SPS must always be present as the max value for
> sps_max_sub_layers_minus1 is vps_max_sub_layers_minus1. This replaces a buggy
> custom range check for the aforementioned field.
> Also, add the missing conformance check for sps_temporal_id_nesting_flag while
> at it.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/cbs_h265_syntax_template.c | 37 +++++++++++++++------------
>   1 file changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
> index 86ca00a0c9..c6db439b3b 100644
> --- a/libavcodec/cbs_h265_syntax_template.c
> +++ b/libavcodec/cbs_h265_syntax_template.c
> @@ -788,25 +788,28 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
>   
>       ub(4, sps_video_parameter_set_id);
>       h265->active_vps = vps = h265->vps[current->sps_video_parameter_set_id];
> +    if (!vps) {
> +        av_log(ctx->log_ctx, AV_LOG_ERROR, "VPS id %d not available.\n",
> +               current->sps_video_parameter_set_id);
> +        return AVERROR_INVALIDDATA;
> +    }
>   
> -    u(3, sps_max_sub_layers_minus1, 0, HEVC_MAX_SUB_LAYERS - 1);
> +    u(3, sps_max_sub_layers_minus1, 0, vps->vps_max_sub_layers_minus1);
>       flag(sps_temporal_id_nesting_flag);
> -    if (vps) {
> -        if (vps->vps_max_sub_layers_minus1 > current->sps_max_sub_layers_minus1) {
> -            av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: "
> -                   "sps_max_sub_layers_minus1 (%d) must be less than or equal to "
> -                   "vps_max_sub_layers_minus1 (%d).\n",
> -                   vps->vps_max_sub_layers_minus1,
> -                   current->sps_max_sub_layers_minus1);
> -            return AVERROR_INVALIDDATA;
> -        }
> -        if (vps->vps_temporal_id_nesting_flag &&
> -            !current->sps_temporal_id_nesting_flag) {
> -            av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: "
> -                   "sps_temporal_id_nesting_flag must be 1 if "
> -                   "vps_temporal_id_nesting_flag is 1.\n");
> -            return AVERROR_INVALIDDATA;
> -        }
> +
> +    if (vps->vps_temporal_id_nesting_flag &&
> +        !current->sps_temporal_id_nesting_flag) {
> +        av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: "
> +               "sps_temporal_id_nesting_flag must be 1 if "
> +               "vps_temporal_id_nesting_flag is 1.\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +    if (current->sps_max_sub_layers_minus1 == 0 &&
> +        current->sps_temporal_id_nesting_flag != 1) {
> +        av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: "
> +               "sps_temporal_id_nesting_flag must be 1 if "
> +               "sps_max_sub_layers_minus1 is 0.\n");
> +        return AVERROR_INVALIDDATA;
>       }
>   
>       CHECK(FUNC(profile_tier_level)(ctx, rw, &current->profile_tier_level,

Will apply set.
_______________________________________________
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:[~2024-07-15 18:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-13 14:58 James Almer
2024-07-13 14:58 ` [FFmpeg-devel] [PATCH 2/4] avcodec/cbs_h265: add partial support for Multilayer extension fields in parameter set NALUs James Almer
2024-07-13 14:58 ` [FFmpeg-devel] [PATCH 3/4] avcodec/cbs_h265: reindent after the previous commit James Almer
2024-07-13 14:58 ` [FFmpeg-devel] [PATCH 4/4] avcodec/cbs_h265: add support for 3D Reference Displays Information SEI James Almer
2024-07-15 18:29 ` James Almer [this message]

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=1f71d71b-edbe-4c9d-b6b7-b0bb0c8fa7c1@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