[FFmpeg-devel] [PATCH 28/42] lavc/hevc/ps: implement SPS parsing for nuh_layer_id>0
Anton Khirnov
anton at khirnov.net
Tue Sep 3 12:39:13 EEST 2024
Quoting James Almer (2024-08-30 04:52:39)
> On 8/27/2024 12:05 PM, Anton Khirnov wrote:
> > @@ -1167,16 +1167,26 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
> > }
> >
> > sps->max_sub_layers = get_bits(gb, 3) + 1;
> > + multi_layer_ext = nuh_layer_id > 0 &&
> > + sps->max_sub_layers == HEVC_MAX_SUB_LAYERS + 1;
> > + if (multi_layer_ext) {
> > + if (!sps->vps)
> > + return AVERROR(EINVAL);
> > +
> > + sps->max_sub_layers = sps->vps->vps_max_sub_layers;
> > + }
> > if (sps->max_sub_layers > HEVC_MAX_SUB_LAYERS) {
>
> Not strictly related to this patch, but sps->max_sub_layers should
> always be <= vps->vps_max_sub_layers (see F.7.4.3.2.1). So the presence
> of vps should be checked for.
>
> > av_log(avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n",
> > sps->max_sub_layers);
> > return AVERROR_INVALIDDATA;
> > }
> >
> > + if (!multi_layer_ext) {
> > sps->temporal_id_nesting = get_bits(gb, 1);
>
> Similarly (not strictly related to this patch), this needs to be 1 if
> sps->max_sub_layers is 0 or if vps->vps_temporal_id_nesting_flag is 1.
>
> >
> > if ((ret = parse_ptl(gb, avctx, 1, &sps->ptl, sps->max_sub_layers)) < 0)
> > return ret;
> > + }
>
> (Actually related this time) If multi_layer_ext is true,
> sps->temporal_id_nesting needs to be set to
> vps->vps_temporal_id_nesting_flag when sps->max_sub_layers > 1, or
> hardcoded to 1 if it's 1.
Honestly this feels like pointless churn. We don't support any of this
temporal id stuff in the decoder, so why bother?
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list