Coverage Report

Created: 2025-08-28 07:12

/src/ffmpeg/libavcodec/evc_ps.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * This file is part of FFmpeg.
3
 *
4
 * FFmpeg is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2.1 of the License, or (at your option) any later version.
8
 *
9
 * FFmpeg is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15
 * License along with FFmpeg; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
 */
18
19
#include "libavutil/mem.h"
20
#include "get_bits.h"
21
#include "golomb.h"
22
#include "evc.h"
23
#include "evc_ps.h"
24
25
72.8k
#define EXTENDED_SAR 255
26
27
// @see ISO_IEC_23094-1 (7.3.7 Reference picture list structure syntax)
28
static int ref_pic_list_struct(const EVCParserSPS *sps, GetBitContext *gb, RefPicListStruct *rpl)
29
216k
{
30
216k
    uint32_t delta_poc_st, strp_entry_sign_flag = 0;
31
216k
    rpl->ref_pic_num = get_ue_golomb_long(gb);
32
33
216k
    if ((unsigned)rpl->ref_pic_num  > sps->sps_max_dec_pic_buffering_minus1)
34
6.86k
        return AVERROR_INVALIDDATA;
35
36
209k
    if (rpl->ref_pic_num > 0) {
37
74.4k
        delta_poc_st = get_ue_golomb_long(gb);
38
39
74.4k
        rpl->ref_pics[0] = delta_poc_st;
40
74.4k
        if (rpl->ref_pics[0] != 0) {
41
37.2k
            strp_entry_sign_flag = get_bits(gb, 1);
42
43
37.2k
            rpl->ref_pics[0] *= 1 - (strp_entry_sign_flag << 1);
44
37.2k
        }
45
74.4k
    }
46
47
462k
    for (int i = 1; i < rpl->ref_pic_num; ++i) {
48
253k
        delta_poc_st = get_ue_golomb_long(gb);
49
253k
        if (delta_poc_st != 0)
50
167k
            strp_entry_sign_flag = get_bits(gb, 1);
51
253k
        rpl->ref_pics[i] = rpl->ref_pics[i - 1] + delta_poc_st * (1 - (strp_entry_sign_flag << 1));
52
253k
    }
53
54
209k
    return 0;
55
216k
}
56
57
// @see  ISO_IEC_23094-1 (E.2.2 HRD parameters syntax)
58
static int hrd_parameters(GetBitContext *gb, HRDParameters *hrd)
59
82.3k
{
60
82.3k
    hrd->cpb_cnt_minus1 = get_ue_golomb_31(gb);
61
82.3k
    if (hrd->cpb_cnt_minus1 >= FF_ARRAY_ELEMS(hrd->cpb_size_value_minus1))
62
2.15k
        return AVERROR_INVALIDDATA;
63
64
80.1k
    hrd->bit_rate_scale = get_bits(gb, 4);
65
80.1k
    hrd->cpb_size_scale = get_bits(gb, 4);
66
234k
    for (int SchedSelIdx = 0; SchedSelIdx <= hrd->cpb_cnt_minus1; SchedSelIdx++) {
67
154k
        hrd->bit_rate_value_minus1[SchedSelIdx] = get_ue_golomb_long(gb);
68
154k
        hrd->cpb_size_value_minus1[SchedSelIdx] = get_ue_golomb_long(gb);
69
154k
        hrd->cbr_flag[SchedSelIdx] = get_bits(gb, 1);
70
154k
    }
71
80.1k
    hrd->initial_cpb_removal_delay_length_minus1 = get_bits(gb, 5);
72
80.1k
    hrd->cpb_removal_delay_length_minus1 = get_bits(gb, 5);
73
80.1k
    hrd->cpb_removal_delay_length_minus1 = get_bits(gb, 5);
74
80.1k
    hrd->time_offset_length = get_bits(gb, 5);
75
76
80.1k
    return 0;
77
82.3k
}
78
79
// @see  ISO_IEC_23094-1 (E.2.1 VUI parameters syntax)
80
static int vui_parameters(GetBitContext *gb, VUIParameters *vui)
81
96.0k
{
82
96.0k
    int ret;
83
84
96.0k
    vui->aspect_ratio_info_present_flag = get_bits(gb, 1);
85
96.0k
    if (vui->aspect_ratio_info_present_flag) {
86
72.8k
        vui->aspect_ratio_idc = get_bits(gb, 8);
87
72.8k
        if (vui->aspect_ratio_idc == EXTENDED_SAR) {
88
22.0k
            vui->sar_width = get_bits(gb, 16);
89
22.0k
            vui->sar_height = get_bits(gb, 16);
90
22.0k
        }
91
72.8k
    }
92
96.0k
    vui->overscan_info_present_flag = get_bits(gb, 1);
93
96.0k
    if (vui->overscan_info_present_flag)
94
46.0k
        vui->overscan_appropriate_flag = get_bits(gb, 1);
95
96.0k
    vui->video_signal_type_present_flag = get_bits(gb, 1);
96
96.0k
    if (vui->video_signal_type_present_flag) {
97
53.7k
        vui->video_format = get_bits(gb, 3);
98
53.7k
        vui->video_full_range_flag = get_bits(gb, 1);
99
53.7k
        vui->colour_description_present_flag = get_bits(gb, 1);
100
53.7k
        if (vui->colour_description_present_flag) {
101
33.0k
            vui->colour_primaries = get_bits(gb, 8);
102
33.0k
            vui->transfer_characteristics = get_bits(gb, 8);
103
33.0k
            vui->matrix_coefficients = get_bits(gb, 8);
104
33.0k
        }
105
53.7k
    }
106
96.0k
    vui->chroma_loc_info_present_flag = get_bits(gb, 1);
107
96.0k
    if (vui->chroma_loc_info_present_flag) {
108
50.4k
        vui->chroma_sample_loc_type_top_field = get_ue_golomb_31(gb);
109
50.4k
        vui->chroma_sample_loc_type_bottom_field = get_ue_golomb_31(gb);
110
50.4k
    }
111
96.0k
    vui->neutral_chroma_indication_flag = get_bits(gb, 1);
112
113
96.0k
    vui->field_seq_flag = get_bits(gb, 1);
114
115
96.0k
    vui->timing_info_present_flag = get_bits(gb, 1);
116
96.0k
    if (vui->timing_info_present_flag) {
117
49.5k
        vui->num_units_in_tick = get_bits_long(gb, 32);
118
49.5k
        vui->time_scale = get_bits_long(gb, 32);
119
49.5k
        vui->fixed_pic_rate_flag = get_bits(gb, 1);
120
49.5k
    }
121
96.0k
    vui->nal_hrd_parameters_present_flag = get_bits(gb, 1);
122
96.0k
    if (vui->nal_hrd_parameters_present_flag) {
123
43.6k
        ret = hrd_parameters(gb, &vui->hrd_parameters);
124
43.6k
        if (ret < 0)
125
901
            return ret;
126
43.6k
    }
127
128
95.1k
    vui->vcl_hrd_parameters_present_flag = get_bits(gb, 1);
129
95.1k
    if (vui->vcl_hrd_parameters_present_flag) {
130
38.6k
        ret = hrd_parameters(gb, &vui->hrd_parameters);
131
38.6k
        if (ret < 0)
132
1.25k
            return ret;
133
38.6k
    }
134
93.9k
    if (vui->nal_hrd_parameters_present_flag || vui->vcl_hrd_parameters_present_flag)
135
52.2k
        vui->low_delay_hrd_flag = get_bits(gb, 1);
136
93.9k
    vui->pic_struct_present_flag = get_bits(gb, 1);
137
93.9k
    vui->bitstream_restriction_flag = get_bits(gb, 1);
138
93.9k
    if (vui->bitstream_restriction_flag) {
139
33.7k
        vui->motion_vectors_over_pic_boundaries_flag = get_bits(gb, 1);
140
33.7k
        vui->max_bytes_per_pic_denom = get_ue_golomb_31(gb);
141
33.7k
        vui->max_bits_per_mb_denom = get_ue_golomb_31(gb);
142
33.7k
        vui->log2_max_mv_length_horizontal = get_ue_golomb_31(gb);
143
33.7k
        vui->log2_max_mv_length_vertical = get_ue_golomb_31(gb);
144
33.7k
        vui->num_reorder_pics = get_ue_golomb_long(gb);
145
33.7k
        vui->max_dec_pic_buffering = get_ue_golomb_long(gb);
146
33.7k
    }
147
148
93.9k
    return 0;
149
95.1k
}
150
151
// @see ISO_IEC_23094-1 (7.3.2.1 SPS RBSP syntax)
152
int ff_evc_parse_sps(GetBitContext *gb, EVCParamSets *ps)
153
164k
{
154
164k
    EVCParserSPS *sps;
155
164k
    unsigned sps_seq_parameter_set_id;
156
164k
    int ret;
157
158
164k
    sps_seq_parameter_set_id = get_ue_golomb(gb);
159
160
164k
    if (sps_seq_parameter_set_id >= EVC_MAX_SPS_COUNT)
161
6.59k
        return AVERROR_INVALIDDATA;
162
163
158k
    sps = av_mallocz(sizeof(*sps));
164
158k
    if (!sps)
165
0
        return AVERROR(ENOMEM);
166
167
158k
    sps->sps_seq_parameter_set_id = sps_seq_parameter_set_id;
168
169
    // the Baseline profile is indicated by profile_idc eqal to 0
170
    // the Main profile is indicated by profile_idc eqal to 1
171
158k
    sps->profile_idc = get_bits(gb, 8);
172
173
158k
    sps->level_idc = get_bits(gb, 8);
174
175
158k
    skip_bits_long(gb, 32); /* skip toolset_idc_h */
176
158k
    skip_bits_long(gb, 32); /* skip toolset_idc_l */
177
178
    // 0 - monochrome
179
    // 1 - 4:2:0
180
    // 2 - 4:2:2
181
    // 3 - 4:4:4
182
158k
    sps->chroma_format_idc = get_ue_golomb_31(gb);
183
158k
    if (sps->chroma_format_idc > 3) {
184
4.72k
        ret = AVERROR_INVALIDDATA;
185
4.72k
        goto fail;
186
4.72k
    }
187
188
153k
    sps->pic_width_in_luma_samples = get_ue_golomb_long(gb);
189
153k
    sps->pic_height_in_luma_samples = get_ue_golomb_long(gb);
190
191
153k
    sps->bit_depth_luma_minus8 = get_ue_golomb_31(gb);
192
153k
    sps->bit_depth_chroma_minus8 = get_ue_golomb_31(gb);
193
194
153k
    sps->sps_btt_flag = get_bits1(gb);
195
153k
    if (sps->sps_btt_flag) {
196
91.2k
        sps->log2_ctu_size_minus2 = get_ue_golomb_long(gb);
197
91.2k
        sps->log2_min_cb_size_minus2 = get_ue_golomb_long(gb);
198
91.2k
        sps->log2_diff_ctu_max_14_cb_size = get_ue_golomb_long(gb);
199
91.2k
        sps->log2_diff_ctu_max_tt_cb_size = get_ue_golomb_long(gb);
200
91.2k
        sps->log2_diff_min_cb_min_tt_cb_size_minus2 = get_ue_golomb_long(gb);
201
91.2k
    }
202
203
153k
    sps->sps_suco_flag = get_bits1(gb);
204
153k
    if (sps->sps_suco_flag) {
205
87.9k
        sps->log2_diff_ctu_size_max_suco_cb_size = get_ue_golomb_long(gb);
206
87.9k
        sps->log2_diff_max_suco_min_suco_cb_size = get_ue_golomb_long(gb);
207
87.9k
    }
208
209
153k
    sps->sps_admvp_flag = get_bits1(gb);
210
153k
    if (sps->sps_admvp_flag) {
211
89.9k
        sps->sps_affine_flag = get_bits1(gb);
212
89.9k
        sps->sps_amvr_flag = get_bits1(gb);
213
89.9k
        sps->sps_dmvr_flag = get_bits1(gb);
214
89.9k
        sps->sps_mmvd_flag = get_bits1(gb);
215
89.9k
        sps->sps_hmvp_flag = get_bits1(gb);
216
89.9k
    }
217
218
153k
    sps->sps_eipd_flag =  get_bits1(gb);
219
153k
    if (sps->sps_eipd_flag) {
220
81.9k
        sps->sps_ibc_flag = get_bits1(gb);
221
81.9k
        if (sps->sps_ibc_flag)
222
54.4k
            sps->log2_max_ibc_cand_size_minus2 = get_ue_golomb(gb);
223
81.9k
    }
224
225
153k
    sps->sps_cm_init_flag = get_bits1(gb);
226
153k
    if (sps->sps_cm_init_flag)
227
67.3k
        sps->sps_adcc_flag = get_bits1(gb);
228
229
153k
    sps->sps_iqt_flag = get_bits1(gb);
230
153k
    if (sps->sps_iqt_flag)
231
78.5k
        sps->sps_ats_flag = get_bits1(gb);
232
233
153k
    sps->sps_addb_flag = get_bits1(gb);
234
153k
    sps->sps_alf_flag = get_bits1(gb);
235
153k
    sps->sps_htdf_flag = get_bits1(gb);
236
153k
    sps->sps_rpl_flag = get_bits1(gb);
237
153k
    sps->sps_pocs_flag = get_bits1(gb);
238
153k
    sps->sps_dquant_flag = get_bits1(gb);
239
153k
    sps->sps_dra_flag = get_bits1(gb);
240
241
153k
    if (sps->sps_pocs_flag) {
242
84.1k
        sps->log2_max_pic_order_cnt_lsb_minus4 = get_ue_golomb(gb);
243
84.1k
        if (sps->log2_max_pic_order_cnt_lsb_minus4 > 12U) {
244
3.27k
            ret = AVERROR_INVALIDDATA;
245
3.27k
            goto fail;
246
3.27k
        }
247
84.1k
    }
248
249
150k
    if (!sps->sps_pocs_flag || !sps->sps_rpl_flag) {
250
97.3k
        sps->log2_sub_gop_length = get_ue_golomb(gb);
251
97.3k
        if (sps->log2_sub_gop_length > 5U) {
252
9.66k
            ret = AVERROR_INVALIDDATA;
253
9.66k
            goto fail;
254
9.66k
        }
255
87.6k
        if (sps->log2_sub_gop_length == 0)
256
53.2k
            sps->log2_ref_pic_gap_length = get_ue_golomb(gb);
257
87.6k
    }
258
259
140k
    if (!sps->sps_rpl_flag)
260
54.3k
        sps->max_num_tid0_ref_pics = get_ue_golomb_31(gb);
261
86.0k
    else {
262
86.0k
        sps->sps_max_dec_pic_buffering_minus1 = get_ue_golomb_long(gb);
263
86.0k
        if ((unsigned)sps->sps_max_dec_pic_buffering_minus1 > 16 - 1) {
264
2.41k
            ret = AVERROR_INVALIDDATA;
265
2.41k
            goto fail;
266
2.41k
        }
267
83.6k
        sps->long_term_ref_pic_flag = get_bits1(gb);
268
83.6k
        sps->rpl1_same_as_rpl0_flag = get_bits1(gb);
269
83.6k
        sps->num_ref_pic_list_in_sps[0] = get_ue_golomb(gb);
270
271
83.6k
        if ((unsigned)sps->num_ref_pic_list_in_sps[0] >= EVC_MAX_NUM_RPLS) {
272
2.20k
            ret = AVERROR_INVALIDDATA;
273
2.20k
            goto fail;
274
2.20k
        }
275
276
174k
        for (int i = 0; i < sps->num_ref_pic_list_in_sps[0]; ++i) {
277
97.7k
            ret = ref_pic_list_struct(sps, gb, &sps->rpls[0][i]);
278
97.7k
            if (ret < 0)
279
4.30k
                goto fail;
280
97.7k
        }
281
282
77.1k
        if (!sps->rpl1_same_as_rpl0_flag) {
283
30.2k
            sps->num_ref_pic_list_in_sps[1] = get_ue_golomb(gb);
284
30.2k
            if ((unsigned)sps->num_ref_pic_list_in_sps[1] >= EVC_MAX_NUM_RPLS) {
285
1.28k
                ret = AVERROR_INVALIDDATA;
286
1.28k
                goto fail;
287
1.28k
            }
288
145k
            for (int i = 0; i < sps->num_ref_pic_list_in_sps[1]; ++i) {
289
118k
                ret = ref_pic_list_struct(sps, gb, &sps->rpls[1][i]);
290
118k
                if (ret < 0)
291
2.56k
                    goto fail;
292
118k
            }
293
28.9k
        }
294
77.1k
    }
295
296
127k
    sps->picture_cropping_flag = get_bits1(gb);
297
298
127k
    if (sps->picture_cropping_flag) {
299
81.0k
        sps->picture_crop_left_offset = get_ue_golomb_long(gb);
300
81.0k
        sps->picture_crop_right_offset = get_ue_golomb_long(gb);
301
81.0k
        sps->picture_crop_top_offset = get_ue_golomb_long(gb);
302
81.0k
        sps->picture_crop_bottom_offset = get_ue_golomb_long(gb);
303
81.0k
    }
304
305
127k
    if (sps->chroma_format_idc != 0) {
306
64.3k
        sps->chroma_qp_table_struct.chroma_qp_table_present_flag = get_bits1(gb);
307
308
64.3k
        if (sps->chroma_qp_table_struct.chroma_qp_table_present_flag) {
309
42.7k
            sps->chroma_qp_table_struct.same_qp_table_for_chroma = get_bits1(gb);
310
42.7k
            sps->chroma_qp_table_struct.global_offset_flag = get_bits1(gb);
311
97.9k
            for (int i = 0; i < (sps->chroma_qp_table_struct.same_qp_table_for_chroma ? 1 : 2); i++) {
312
58.9k
                sps->chroma_qp_table_struct.num_points_in_qp_table_minus1[i] = get_ue_golomb(gb);
313
58.9k
                if (sps->chroma_qp_table_struct.num_points_in_qp_table_minus1[i] >= EVC_MAX_QP_TABLE_SIZE) {
314
3.82k
                    ret = AVERROR_INVALIDDATA;
315
3.82k
                    goto fail;
316
3.82k
                }
317
412k
                for (int j = 0; j <= sps->chroma_qp_table_struct.num_points_in_qp_table_minus1[i]; j++) {
318
356k
                    sps->chroma_qp_table_struct.delta_qp_in_val_minus1[i][j] = get_bits(gb, 6);
319
356k
                    sps->chroma_qp_table_struct.delta_qp_out_val[i][j] = get_se_golomb_long(gb);
320
356k
                }
321
55.1k
            }
322
42.7k
        }
323
64.3k
    }
324
325
123k
    sps->vui_parameters_present_flag = get_bits1(gb);
326
123k
    if (sps->vui_parameters_present_flag) {
327
96.0k
        ret = vui_parameters(gb, &(sps->vui_parameters));
328
96.0k
        if (ret < 0)
329
2.15k
            goto fail;
330
96.0k
    }
331
332
    // @note
333
    // If necessary, add the missing fields to the EVCParserSPS structure
334
    // and then extend parser implementation
335
336
121k
    av_freep(&ps->sps[sps_seq_parameter_set_id]);
337
121k
    ps->sps[sps_seq_parameter_set_id] = sps;
338
339
121k
    return 0;
340
36.4k
fail:
341
36.4k
    av_free(sps);
342
36.4k
    return ret;
343
123k
}
344
345
// @see ISO_IEC_23094-1 (7.3.2.2 SPS RBSP syntax)
346
//
347
// @note
348
// The current implementation of parse_sps function doesn't handle VUI parameters parsing.
349
// If it will be needed, parse_sps function could be extended to handle VUI parameters parsing
350
// to initialize fields of the AVCodecContex i.e. color_primaries, color_trc,color_range
351
//
352
int ff_evc_parse_pps(GetBitContext *gb, EVCParamSets *ps)
353
81.2k
{
354
81.2k
    EVCParserPPS *pps;
355
81.2k
    unsigned pps_pic_parameter_set_id;
356
81.2k
    int ret;
357
358
81.2k
    pps_pic_parameter_set_id = get_ue_golomb(gb);
359
81.2k
    if (pps_pic_parameter_set_id >= EVC_MAX_PPS_COUNT)
360
5.27k
        return AVERROR_INVALIDDATA;
361
362
75.9k
    pps = av_mallocz(sizeof(*pps));
363
75.9k
    if (!pps)
364
0
        return AVERROR(ENOMEM);
365
366
75.9k
    pps->pps_pic_parameter_set_id = pps_pic_parameter_set_id;
367
368
75.9k
    pps->pps_seq_parameter_set_id = get_ue_golomb(gb);
369
75.9k
    if (pps->pps_seq_parameter_set_id >= EVC_MAX_SPS_COUNT) {
370
3.98k
        ret = AVERROR_INVALIDDATA;
371
3.98k
        goto fail;
372
3.98k
    }
373
374
71.9k
    pps->num_ref_idx_default_active_minus1[0] = get_ue_golomb(gb);
375
71.9k
    pps->num_ref_idx_default_active_minus1[1] = get_ue_golomb(gb);
376
71.9k
    pps->additional_lt_poc_lsb_len = get_ue_golomb(gb);
377
71.9k
    pps->rpl1_idx_present_flag = get_bits1(gb);
378
71.9k
    pps->single_tile_in_pic_flag = get_bits1(gb);
379
380
71.9k
    if (!pps->single_tile_in_pic_flag) {
381
48.4k
        pps->num_tile_columns_minus1 = get_ue_golomb(gb);
382
48.4k
        pps->num_tile_rows_minus1 = get_ue_golomb(gb);
383
48.4k
        if (pps->num_tile_columns_minus1 >= EVC_MAX_TILE_COLUMNS ||
384
48.4k
            pps->num_tile_rows_minus1 >= EVC_MAX_TILE_ROWS) {
385
7.23k
            ret = AVERROR_INVALIDDATA;
386
7.23k
            goto fail;
387
7.23k
        }
388
41.2k
        pps->uniform_tile_spacing_flag = get_bits1(gb);
389
390
41.2k
        if (!pps->uniform_tile_spacing_flag) {
391
108k
            for (int i = 0; i < pps->num_tile_columns_minus1; i++)
392
78.9k
                pps->tile_column_width_minus1[i] = get_ue_golomb(gb);
393
394
135k
            for (int i = 0; i < pps->num_tile_rows_minus1; i++)
395
106k
                pps->tile_row_height_minus1[i] = get_ue_golomb(gb);
396
29.8k
        }
397
41.2k
        pps->loop_filter_across_tiles_enabled_flag = get_bits1(gb);
398
41.2k
        pps->tile_offset_len_minus1 = get_ue_golomb(gb);
399
41.2k
    }
400
401
64.7k
    pps->tile_id_len_minus1 = get_ue_golomb(gb);
402
64.7k
    if (pps->tile_id_len_minus1 > 15U) {
403
7.09k
        ret = AVERROR_INVALIDDATA;
404
7.09k
        goto fail;
405
7.09k
    }
406
57.6k
    pps->explicit_tile_id_flag = get_bits1(gb);
407
408
57.6k
    if (pps->explicit_tile_id_flag) {
409
137k
        for (int i = 0; i <= pps->num_tile_rows_minus1; i++) {
410
612k
            for (int j = 0; j <= pps->num_tile_columns_minus1; j++)
411
512k
                pps->tile_id_val[i][j] = get_bits(gb, pps->tile_id_len_minus1 + 1);
412
99.8k
        }
413
38.0k
    }
414
415
57.6k
    pps->pic_dra_enabled_flag = 0;
416
57.6k
    pps->pic_dra_enabled_flag = get_bits1(gb);
417
418
57.6k
    if (pps->pic_dra_enabled_flag)
419
31.5k
        pps->pic_dra_aps_id = get_bits(gb, 5);
420
421
57.6k
    pps->arbitrary_slice_present_flag = get_bits1(gb);
422
57.6k
    pps->constrained_intra_pred_flag = get_bits1(gb);
423
57.6k
    pps->cu_qp_delta_enabled_flag = get_bits1(gb);
424
425
57.6k
    if (pps->cu_qp_delta_enabled_flag)
426
31.3k
        pps->log2_cu_qp_delta_area_minus6 = get_ue_golomb(gb);
427
428
57.6k
    av_freep(&ps->pps[pps_pic_parameter_set_id]);
429
57.6k
    ps->pps[pps_pic_parameter_set_id] = pps;
430
431
57.6k
    return 0;
432
18.3k
fail:
433
18.3k
    av_free(pps);
434
18.3k
    return ret;
435
64.7k
}
436
437
46.0k
void ff_evc_ps_free(EVCParamSets *ps) {
438
782k
    for (int i = 0; i < EVC_MAX_SPS_COUNT; i++)
439
736k
        av_freep(&ps->sps[i]);
440
441
2.99M
    for (int i = 0; i < EVC_MAX_PPS_COUNT; i++)
442
2.94M
        av_freep(&ps->pps[i]);
443
46.0k
}