[FFmpeg-devel] [PATCH v4 4/9] avcodec: add cbs for h266/vvc

James Almer jamrial at gmail.com
Mon Jan 25 20:35:26 EET 2021


On 1/25/2021 2:12 PM, James Almer wrote:
> On 1/25/2021 11:15 AM, Nuo Mi wrote:
>> +static int FUNC(ref_pic_list_struct)(CodedBitstreamContext *ctx, 
>> RWContext *rw,
>> +                                     H266RefPicListStruct *current,
>> +                                     uint8_t list_idx, uint8_t rpls_idx,
>> +                                     const H266RawSPS *sps)
>> +{
>> +    CodedBitstreamH266Context *h266 = ctx->priv_data;
>> +    int err, i, j, general_layer_idx = -1, num_direct_ref_layers = 0;
>> +    const H266RawVPS *vps = h266->vps[sps->sps_video_parameter_set_id];
>> +
>> +    if (!vps) {
>> +        av_log(ctx->log_ctx, AV_LOG_ERROR,
>> +               "VPS id %d not available.\n", 
>> sps->sps_video_parameter_set_id);
>> +        return AVERROR_INVALIDDATA;
> 
> Wont this break all the samples that lack a VPS?
> 
> (I thought for that matter that all those samples having this field but 
> then no VPS at all was odd).

Right, i see now that vps_video_parameter_set_id in a VPS is meant to 
never be 0, so apparently a VPS with id 0 and default values is implicit 
to always exist while not being coded in the bitstream, and that's what 
these SPS with sps_video_parameter_set_id == 0 reference.

I don't know if allocating it when parsing the first SPS is the best 
idea, but i can't think if a better alternative right now.


More information about the ffmpeg-devel mailing list