[FFmpeg-devel] [PATCH] avcodec/cbs_h266: read vps_ptl_max_tid before using it

Nuo Mi nuomi2021 at gmail.com
Sun May 19 17:24:07 EEST 2024


On Sun, May 19, 2024 at 9:28 PM James Almer <jamrial at gmail.com> wrote:

> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/cbs_h266_syntax_template.c | 28 ++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/libavcodec/cbs_h266_syntax_template.c
> b/libavcodec/cbs_h266_syntax_template.c
> index 725cee5b03..38685704c5 100644
> --- a/libavcodec/cbs_h266_syntax_template.c
> +++ b/libavcodec/cbs_h266_syntax_template.c
> @@ -790,6 +790,21 @@ static int FUNC(vps) (CodedBitstreamContext *ctx,
> RWContext *rw,
>          infer(vps_each_layer_is_an_ols_flag, 1);
>          infer(vps_num_ptls_minus1, 0);
>      }
> +
> +    for (i = 0; i <= current->vps_num_ptls_minus1; i++) {
> +        if (i > 0)
> +            flags(vps_pt_present_flag[i], 1, i);
> +        else
> +            infer(vps_pt_present_flag[i], 1);
> +
> +        if (!current->vps_default_ptl_dpb_hrd_max_tid_flag)
> +            us(3, vps_ptl_max_tid[i], 0,
> current->vps_max_sublayers_minus1, 1, i);
> +        else
> +            infer(vps_ptl_max_tid[i], current->vps_max_sublayers_minus1);
> +    }
> +    while (byte_alignment(rw) != 0)
> +        fixed(1, vps_ptl_alignment_zero_bit, 0);
> +
>      {
>          //calc NumMultiLayerOlss
>          int m;
> @@ -915,19 +930,6 @@ static int FUNC(vps) (CodedBitstreamContext *ctx,
> RWContext *rw,
>              return AVERROR_INVALIDDATA;
>      }
>
> -    for (i = 0; i <= current->vps_num_ptls_minus1; i++) {
> -        if (i > 0)
> -            flags(vps_pt_present_flag[i], 1, i);
> -        else
> -            infer(vps_pt_present_flag[i], 1);
> -
> -        if (!current->vps_default_ptl_dpb_hrd_max_tid_flag)
> -            us(3, vps_ptl_max_tid[i], 0,
> current->vps_max_sublayers_minus1, 1, i);
> -        else
> -            infer(vps_ptl_max_tid[i], current->vps_max_sublayers_minus1);
> -    }
> -    while (byte_alignment(rw) != 0)
> -        fixed(1, vps_ptl_alignment_zero_bit, 0);
>      for (i = 0; i <= current->vps_num_ptls_minus1; i++) {
>          CHECK(FUNC(profile_tier_level) (ctx, rw,
>                                          current->vps_profile_tier_level +
> i,
> --
> 2.45.1
>
LGTM
Thank you, James.

>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list