History

avcodec/evc_ps: use get_bits1() where useful

James Almer committed 3 years ago

Commit 5b372c71 parent ea190b81 file · +37 −37Browse files

Unified · Split

libavcodec/evc_ps.c+37−37
@@ -177,7 +177,7 @@ int ff_evc_parse_sps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 176 unmodified lines
177 sps->bit_depth_luma_minus8 = get_ue_golomb(&gb);177 sps->bit_depth_luma_minus8 = get_ue_golomb(&gb);
178 sps->bit_depth_chroma_minus8 = get_ue_golomb(&gb);178 sps->bit_depth_chroma_minus8 = get_ue_golomb(&gb);
179 179
180 sps->sps_btt_flag = get_bits(&gb, 1);180 sps->sps_btt_flag = get_bits1(&gb);
181 if (sps->sps_btt_flag) {181 if (sps->sps_btt_flag) {
182 sps->log2_ctu_size_minus5 = get_ue_golomb(&gb);182 sps->log2_ctu_size_minus5 = get_ue_golomb(&gb);
183 sps->log2_min_cb_size_minus2 = get_ue_golomb(&gb);183 sps->log2_min_cb_size_minus2 = get_ue_golomb(&gb);
@@ -186,43 +186,43 @@ int ff_evc_parse_sps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 2 unmodified lines
186 sps->log2_diff_min_cb_min_tt_cb_size_minus2 = get_ue_golomb(&gb);186 sps->log2_diff_min_cb_min_tt_cb_size_minus2 = get_ue_golomb(&gb);
187 }187 }
188 188
189 sps->sps_suco_flag = get_bits(&gb, 1);189 sps->sps_suco_flag = get_bits1(&gb);
190 if (sps->sps_suco_flag) {190 if (sps->sps_suco_flag) {
191 sps->log2_diff_ctu_size_max_suco_cb_size = get_ue_golomb(&gb);191 sps->log2_diff_ctu_size_max_suco_cb_size = get_ue_golomb(&gb);
192 sps->log2_diff_max_suco_min_suco_cb_size = get_ue_golomb(&gb);192 sps->log2_diff_max_suco_min_suco_cb_size = get_ue_golomb(&gb);
193 }193 }
194 194
195 sps->sps_admvp_flag = get_bits(&gb, 1);195 sps->sps_admvp_flag = get_bits1(&gb);
196 if (sps->sps_admvp_flag) {196 if (sps->sps_admvp_flag) {
197 sps->sps_affine_flag = get_bits(&gb, 1);197 sps->sps_affine_flag = get_bits1(&gb);
198 sps->sps_amvr_flag = get_bits(&gb, 1);198 sps->sps_amvr_flag = get_bits1(&gb);
199 sps->sps_dmvr_flag = get_bits(&gb, 1);199 sps->sps_dmvr_flag = get_bits1(&gb);
200 sps->sps_mmvd_flag = get_bits(&gb, 1);200 sps->sps_mmvd_flag = get_bits1(&gb);
201 sps->sps_hmvp_flag = get_bits(&gb, 1);201 sps->sps_hmvp_flag = get_bits1(&gb);
202 }202 }
203 203
204 sps->sps_eipd_flag = get_bits(&gb, 1);204 sps->sps_eipd_flag = get_bits1(&gb);
205 if (sps->sps_eipd_flag) {205 if (sps->sps_eipd_flag) {
206 sps->sps_ibc_flag = get_bits(&gb, 1);206 sps->sps_ibc_flag = get_bits1(&gb);
207 if (sps->sps_ibc_flag)207 if (sps->sps_ibc_flag)
208 sps->log2_max_ibc_cand_size_minus2 = get_ue_golomb(&gb);208 sps->log2_max_ibc_cand_size_minus2 = get_ue_golomb(&gb);
209 }209 }
210 210
211 sps->sps_cm_init_flag = get_bits(&gb, 1);211 sps->sps_cm_init_flag = get_bits1(&gb);
212 if (sps->sps_cm_init_flag)212 if (sps->sps_cm_init_flag)
213 sps->sps_adcc_flag = get_bits(&gb, 1);213 sps->sps_adcc_flag = get_bits1(&gb);
214 214
215 sps->sps_iqt_flag = get_bits(&gb, 1);215 sps->sps_iqt_flag = get_bits1(&gb);
216 if (sps->sps_iqt_flag)216 if (sps->sps_iqt_flag)
217 sps->sps_ats_flag = get_bits(&gb, 1);217 sps->sps_ats_flag = get_bits1(&gb);
218 218
219 sps->sps_addb_flag = get_bits(&gb, 1);219 sps->sps_addb_flag = get_bits1(&gb);
220 sps->sps_alf_flag = get_bits(&gb, 1);220 sps->sps_alf_flag = get_bits1(&gb);
221 sps->sps_htdf_flag = get_bits(&gb, 1);221 sps->sps_htdf_flag = get_bits1(&gb);
222 sps->sps_rpl_flag = get_bits(&gb, 1);222 sps->sps_rpl_flag = get_bits1(&gb);
223 sps->sps_pocs_flag = get_bits(&gb, 1);223 sps->sps_pocs_flag = get_bits1(&gb);
224 sps->sps_dquant_flag = get_bits(&gb, 1);224 sps->sps_dquant_flag = get_bits1(&gb);
225 sps->sps_dra_flag = get_bits(&gb, 1);225 sps->sps_dra_flag = get_bits1(&gb);
226 226
227 if (sps->sps_pocs_flag) {227 if (sps->sps_pocs_flag) {
228 sps->log2_max_pic_order_cnt_lsb_minus4 = get_ue_golomb(&gb);228 sps->log2_max_pic_order_cnt_lsb_minus4 = get_ue_golomb(&gb);
@@ -246,8 +246,8 @@ int ff_evc_parse_sps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 17 unmodified lines
246 sps->max_num_tid0_ref_pics = get_ue_golomb(&gb);246 sps->max_num_tid0_ref_pics = get_ue_golomb(&gb);
247 else {247 else {
248 sps->sps_max_dec_pic_buffering_minus1 = get_ue_golomb(&gb);248 sps->sps_max_dec_pic_buffering_minus1 = get_ue_golomb(&gb);
249 sps->long_term_ref_pic_flag = get_bits(&gb, 1);249 sps->long_term_ref_pic_flag = get_bits1(&gb);
250 sps->rpl1_same_as_rpl0_flag = get_bits(&gb, 1);250 sps->rpl1_same_as_rpl0_flag = get_bits1(&gb);
251 sps->num_ref_pic_list_in_sps[0] = get_ue_golomb(&gb);251 sps->num_ref_pic_list_in_sps[0] = get_ue_golomb(&gb);
252 252
253 for (int i = 0; i < sps->num_ref_pic_list_in_sps[0]; ++i)253 for (int i = 0; i < sps->num_ref_pic_list_in_sps[0]; ++i)
@@ -260,7 +260,7 @@ int ff_evc_parse_sps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 6 unmodified lines
260 }260 }
261 }261 }
262 262
263 sps->picture_cropping_flag = get_bits(&gb, 1);263 sps->picture_cropping_flag = get_bits1(&gb);
264 264
265 if (sps->picture_cropping_flag) {265 if (sps->picture_cropping_flag) {
266 sps->picture_crop_left_offset = get_ue_golomb(&gb);266 sps->picture_crop_left_offset = get_ue_golomb(&gb);
@@ -270,11 +270,11 @@ int ff_evc_parse_sps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 3 unmodified lines
270 }270 }
271 271
272 if (sps->chroma_format_idc != 0) {272 if (sps->chroma_format_idc != 0) {
273 sps->chroma_qp_table_struct.chroma_qp_table_present_flag = get_bits(&gb, 1);273 sps->chroma_qp_table_struct.chroma_qp_table_present_flag = get_bits1(&gb);
274 274
275 if (sps->chroma_qp_table_struct.chroma_qp_table_present_flag) {275 if (sps->chroma_qp_table_struct.chroma_qp_table_present_flag) {
276 sps->chroma_qp_table_struct.same_qp_table_for_chroma = get_bits(&gb, 1);276 sps->chroma_qp_table_struct.same_qp_table_for_chroma = get_bits1(&gb);
277 sps->chroma_qp_table_struct.global_offset_flag = get_bits(&gb, 1);277 sps->chroma_qp_table_struct.global_offset_flag = get_bits1(&gb);
278 for (int i = 0; i < (sps->chroma_qp_table_struct.same_qp_table_for_chroma ? 1 : 2); i++) {278 for (int i = 0; i < (sps->chroma_qp_table_struct.same_qp_table_for_chroma ? 1 : 2); i++) {
279 sps->chroma_qp_table_struct.num_points_in_qp_table_minus1[i] = get_ue_golomb(&gb);279 sps->chroma_qp_table_struct.num_points_in_qp_table_minus1[i] = get_ue_golomb(&gb);
280 if (sps->chroma_qp_table_struct.num_points_in_qp_table_minus1[i] >= EVC_MAX_QP_TABLE_SIZE) {280 if (sps->chroma_qp_table_struct.num_points_in_qp_table_minus1[i] >= EVC_MAX_QP_TABLE_SIZE) {
@@ -289,7 +289,7 @@ int ff_evc_parse_sps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 8 unmodified lines
289 }289 }
290 }290 }
291 291
292 sps->vui_parameters_present_flag = get_bits(&gb, 1);292 sps->vui_parameters_present_flag = get_bits1(&gb);
293 if (sps->vui_parameters_present_flag)293 if (sps->vui_parameters_present_flag)
294 vui_parameters(&gb, &(sps->vui_parameters));294 vui_parameters(&gb, &(sps->vui_parameters));
295 295
@@ -345,8 +345,8 @@ int ff_evc_parse_pps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 49 unmodified lines
345 pps->num_ref_idx_default_active_minus1[0] = get_ue_golomb(&gb);345 pps->num_ref_idx_default_active_minus1[0] = get_ue_golomb(&gb);
346 pps->num_ref_idx_default_active_minus1[1] = get_ue_golomb(&gb);346 pps->num_ref_idx_default_active_minus1[1] = get_ue_golomb(&gb);
347 pps->additional_lt_poc_lsb_len = get_ue_golomb(&gb);347 pps->additional_lt_poc_lsb_len = get_ue_golomb(&gb);
348 pps->rpl1_idx_present_flag = get_bits(&gb, 1);348 pps->rpl1_idx_present_flag = get_bits1(&gb);
349 pps->single_tile_in_pic_flag = get_bits(&gb, 1);349 pps->single_tile_in_pic_flag = get_bits1(&gb);
350 350
351 if (!pps->single_tile_in_pic_flag) {351 if (!pps->single_tile_in_pic_flag) {
352 pps->num_tile_columns_minus1 = get_ue_golomb(&gb);352 pps->num_tile_columns_minus1 = get_ue_golomb(&gb);
@@ -356,7 +356,7 @@ int ff_evc_parse_pps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 3 unmodified lines
356 ret = AVERROR_INVALIDDATA;356 ret = AVERROR_INVALIDDATA;
357 goto fail;357 goto fail;
358 }358 }
359 pps->uniform_tile_spacing_flag = get_bits(&gb, 1);359 pps->uniform_tile_spacing_flag = get_bits1(&gb);
360 360
361 if (!pps->uniform_tile_spacing_flag) {361 if (!pps->uniform_tile_spacing_flag) {
362 for (int i = 0; i < pps->num_tile_columns_minus1; i++)362 for (int i = 0; i < pps->num_tile_columns_minus1; i++)
@@ -365,7 +365,7 @@ int ff_evc_parse_pps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 2 unmodified lines
365 for (int i = 0; i < pps->num_tile_rows_minus1; i++)365 for (int i = 0; i < pps->num_tile_rows_minus1; i++)
366 pps->tile_row_height_minus1[i] = get_ue_golomb(&gb);366 pps->tile_row_height_minus1[i] = get_ue_golomb(&gb);
367 }367 }
368 pps->loop_filter_across_tiles_enabled_flag = get_bits(&gb, 1);368 pps->loop_filter_across_tiles_enabled_flag = get_bits1(&gb);
369 pps->tile_offset_len_minus1 = get_ue_golomb(&gb);369 pps->tile_offset_len_minus1 = get_ue_golomb(&gb);
370 }370 }
371 371
@@ -374,7 +374,7 @@ int ff_evc_parse_pps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 2 unmodified lines
374 ret = AVERROR_INVALIDDATA;374 ret = AVERROR_INVALIDDATA;
375 goto fail;375 goto fail;
376 }376 }
377 pps->explicit_tile_id_flag = get_bits(&gb, 1);377 pps->explicit_tile_id_flag = get_bits1(&gb);
378 378
379 if (pps->explicit_tile_id_flag) {379 if (pps->explicit_tile_id_flag) {
380 for (int i = 0; i <= pps->num_tile_rows_minus1; i++) {380 for (int i = 0; i <= pps->num_tile_rows_minus1; i++) {
@@ -384,14 +384,14 @@ int ff_evc_parse_pps(EVCParamSets *ps, const uint8_t *bs, int bs_size) · 3 unmodified lines
384 }384 }
385 385
386 pps->pic_dra_enabled_flag = 0;386 pps->pic_dra_enabled_flag = 0;
387 pps->pic_dra_enabled_flag = get_bits(&gb, 1);387 pps->pic_dra_enabled_flag = get_bits1(&gb);
388 388
389 if (pps->pic_dra_enabled_flag)389 if (pps->pic_dra_enabled_flag)
390 pps->pic_dra_aps_id = get_bits(&gb, 5);390 pps->pic_dra_aps_id = get_bits(&gb, 5);
391 391
392 pps->arbitrary_slice_present_flag = get_bits(&gb, 1);392 pps->arbitrary_slice_present_flag = get_bits1(&gb);
393 pps->constrained_intra_pred_flag = get_bits(&gb, 1);393 pps->constrained_intra_pred_flag = get_bits1(&gb);
394 pps->cu_qp_delta_enabled_flag = get_bits(&gb, 1);394 pps->cu_qp_delta_enabled_flag = get_bits1(&gb);
395 395
396 if (pps->cu_qp_delta_enabled_flag)396 if (pps->cu_qp_delta_enabled_flag)
397 pps->log2_cu_qp_delta_area_minus6 = get_ue_golomb(&gb);397 pps->log2_cu_qp_delta_area_minus6 = get_ue_golomb(&gb);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t