aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/hevc_ps.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-04-10 12:28:09 +0200
committerAnton Khirnov <anton@khirnov.net>2024-05-31 19:26:06 +0200
commit6fed1841a1f5dd3cdcf343f77925af0781ebe83a (patch)
treec1b9ad2d4c2cbe6a15763e94450285ff6870aabd /libavcodec/hevc_ps.c
parentbd1a06dc439403d7e16a220629165e34791016d7 (diff)
downloadffmpeg-6fed1841a1f5dd3cdcf343f77925af0781ebe83a.tar.gz
lavc/hevc_ps/HEVCSPS: change flags into uint8_t
Reduces sizeof(HEVCSPS) by 64 bytes. Also improve flag names: drop redundant suffixes and prefixes, and consistently use disabled/enabled.
Diffstat (limited to 'libavcodec/hevc_ps.c')
-rw-r--r--libavcodec/hevc_ps.c95
1 files changed, 47 insertions, 48 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 8d5fc0d0ca..1af691414e 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -895,7 +895,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
return AVERROR_INVALIDDATA;
}
- sps->temporal_id_nesting_flag = get_bits(gb, 1);
+ sps->temporal_id_nesting = get_bits(gb, 1);
if ((ret = parse_ptl(gb, avctx, &sps->ptl, sps->max_sub_layers)) < 0)
return ret;
@@ -913,9 +913,9 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
}
if (sps->chroma_format_idc == 3)
- sps->separate_colour_plane_flag = get_bits1(gb);
+ sps->separate_colour_plane = get_bits1(gb);
- if (sps->separate_colour_plane_flag)
+ if (sps->separate_colour_plane)
sps->chroma_format_idc = 0;
sps->width = get_ue_golomb_long(gb);
@@ -924,8 +924,8 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
sps->height, 0, avctx)) < 0)
return ret;
- sps->conformance_window_flag = get_bits1(gb);
- if (sps->conformance_window_flag) {
+ sps->conformance_window = get_bits1(gb);
+ if (sps->conformance_window) {
int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];
int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];
sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult;
@@ -982,8 +982,8 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
return AVERROR_INVALIDDATA;
}
- sps->sublayer_ordering_info_flag = get_bits1(gb);
- start = sps->sublayer_ordering_info_flag ? 0 : sps->max_sub_layers - 1;
+ sps->sublayer_ordering_info = get_bits1(gb);
+ start = sps->sublayer_ordering_info ? 0 : sps->max_sub_layers - 1;
for (i = start; i < sps->max_sub_layers; i++) {
sps->temporal_layer[i].max_dec_pic_buffering = get_ue_golomb_long(gb) + 1;
sps->temporal_layer[i].num_reorder_pics = get_ue_golomb_long(gb);
@@ -1004,7 +1004,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
}
}
- if (!sps->sublayer_ordering_info_flag) {
+ if (!sps->sublayer_ordering_info) {
for (i = 0; i < start; i++) {
sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[start].max_dec_pic_buffering;
sps->temporal_layer[i].num_reorder_pics = sps->temporal_layer[start].num_reorder_pics;
@@ -1043,8 +1043,8 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
sps->max_transform_hierarchy_depth_inter = get_ue_golomb_long(gb);
sps->max_transform_hierarchy_depth_intra = get_ue_golomb_long(gb);
- sps->scaling_list_enable_flag = get_bits1(gb);
- if (sps->scaling_list_enable_flag) {
+ sps->scaling_list_enabled = get_bits1(gb);
+ if (sps->scaling_list_enabled) {
set_default_scaling_list_data(&sps->scaling_list);
if (get_bits1(gb)) {
@@ -1054,11 +1054,11 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
}
}
- sps->amp_enabled_flag = get_bits1(gb);
- sps->sao_enabled = get_bits1(gb);
+ sps->amp_enabled = get_bits1(gb);
+ sps->sao_enabled = get_bits1(gb);
- sps->pcm_enabled_flag = get_bits1(gb);
- if (sps->pcm_enabled_flag) {
+ sps->pcm_enabled = get_bits1(gb);
+ if (sps->pcm_enabled) {
sps->pcm.bit_depth = get_bits(gb, 4) + 1;
sps->pcm.bit_depth_chroma = get_bits(gb, 4) + 1;
sps->pcm.log2_min_pcm_cb_size = get_ue_golomb_long(gb) + 3;
@@ -1071,7 +1071,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
return AVERROR_INVALIDDATA;
}
- sps->pcm.loop_filter_disable_flag = get_bits1(gb);
+ sps->pcm_loop_filter_disabled = get_bits1(gb);
}
sps->nb_st_rps = get_ue_golomb_long(gb);
@@ -1086,8 +1086,8 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
return ret;
}
- sps->long_term_ref_pics_present_flag = get_bits1(gb);
- if (sps->long_term_ref_pics_present_flag) {
+ sps->long_term_ref_pics_present = get_bits1(gb);
+ if (sps->long_term_ref_pics_present) {
sps->num_long_term_ref_pics_sps = get_ue_golomb_long(gb);
if (sps->num_long_term_ref_pics_sps > HEVC_MAX_LONG_TERM_REF_PICS) {
av_log(avctx, AV_LOG_ERROR, "Too many long term ref pics: %d.\n",
@@ -1102,54 +1102,53 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
}
}
- sps->sps_temporal_mvp_enabled_flag = get_bits1(gb);
- sps->sps_strong_intra_smoothing_enable_flag = get_bits1(gb);
+ sps->temporal_mvp_enabled = get_bits1(gb);
+ sps->strong_intra_smoothing_enabled = get_bits1(gb);
sps->vui.common.sar = (AVRational){0, 1};
sps->vui_present = get_bits1(gb);
if (sps->vui_present)
decode_vui(gb, avctx, apply_defdispwin, sps);
- sps->sps_extension_present_flag = get_bits1(gb);
- if (sps->sps_extension_present_flag) {
- sps->sps_range_extension_flag = get_bits1(gb);
- sps->sps_multilayer_extension_flag = get_bits1(gb);
- sps->sps_3d_extension_flag = get_bits1(gb);
- sps->sps_scc_extension_flag = get_bits1(gb);
+ sps->extension_present = get_bits1(gb);
+ if (sps->extension_present) {
+ sps->range_extension = get_bits1(gb);
+ sps->multilayer_extension = get_bits1(gb);
+ sps->sps_3d_extension = get_bits1(gb);
+ sps->scc_extension = get_bits1(gb);
skip_bits(gb, 4); // sps_extension_4bits
- if (sps->sps_range_extension_flag) {
- sps->transform_skip_rotation_enabled_flag = get_bits1(gb);
- sps->transform_skip_context_enabled_flag = get_bits1(gb);
- sps->implicit_rdpcm_enabled_flag = get_bits1(gb);
+ if (sps->range_extension) {
+ sps->transform_skip_rotation_enabled = get_bits1(gb);
+ sps->transform_skip_context_enabled = get_bits1(gb);
+ sps->implicit_rdpcm_enabled = get_bits1(gb);
+ sps->explicit_rdpcm_enabled = get_bits1(gb);
- sps->explicit_rdpcm_enabled_flag = get_bits1(gb);
-
- sps->extended_precision_processing_flag = get_bits1(gb);
- if (sps->extended_precision_processing_flag)
+ sps->extended_precision_processing = get_bits1(gb);
+ if (sps->extended_precision_processing)
av_log(avctx, AV_LOG_WARNING,
"extended_precision_processing_flag not yet implemented\n");
- sps->intra_smoothing_disabled_flag = get_bits1(gb);
- sps->high_precision_offsets_enabled_flag = get_bits1(gb);
- if (sps->high_precision_offsets_enabled_flag)
+ sps->intra_smoothing_disabled = get_bits1(gb);
+ sps->high_precision_offsets_enabled = get_bits1(gb);
+ if (sps->high_precision_offsets_enabled)
av_log(avctx, AV_LOG_WARNING,
"high_precision_offsets_enabled_flag not yet implemented\n");
- sps->persistent_rice_adaptation_enabled_flag = get_bits1(gb);
+ sps->persistent_rice_adaptation_enabled = get_bits1(gb);
- sps->cabac_bypass_alignment_enabled_flag = get_bits1(gb);
- if (sps->cabac_bypass_alignment_enabled_flag)
+ sps->cabac_bypass_alignment_enabled = get_bits1(gb);
+ if (sps->cabac_bypass_alignment_enabled)
av_log(avctx, AV_LOG_WARNING,
"cabac_bypass_alignment_enabled_flag not yet implemented\n");
}
- if (sps->sps_multilayer_extension_flag) {
+ if (sps->multilayer_extension) {
skip_bits1(gb); // inter_view_mv_vert_constraint_flag
av_log(avctx, AV_LOG_WARNING,
"sps_multilayer_extension_flag not yet implemented\n");
}
- if (sps->sps_3d_extension_flag) {
+ if (sps->sps_3d_extension) {
for (i = 0; i <= 1; i++) {
skip_bits1(gb); // iv_di_mc_enabled_flag
skip_bits1(gb); // iv_mv_scal_enabled_flag
@@ -1173,15 +1172,15 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
"sps_3d_extension_flag not yet implemented\n");
}
- if (sps->sps_scc_extension_flag) {
- sps->sps_curr_pic_ref_enabled_flag = get_bits1(gb);
- sps->palette_mode_enabled_flag = get_bits1(gb);
- if (sps->palette_mode_enabled_flag) {
+ if (sps->scc_extension) {
+ sps->curr_pic_ref_enabled = get_bits1(gb);
+ sps->palette_mode_enabled = get_bits1(gb);
+ if (sps->palette_mode_enabled) {
sps->palette_max_size = get_ue_golomb(gb);
sps->delta_palette_max_predictor_size = get_ue_golomb(gb);
- sps->sps_palette_predictor_initializers_present_flag = get_bits1(gb);
+ sps->palette_predictor_initializers_present = get_bits1(gb);
- if (sps->sps_palette_predictor_initializers_present_flag) {
+ if (sps->palette_predictor_initializers_present) {
sps->sps_num_palette_predictor_initializers = get_ue_golomb(gb) + 1;
if (sps->sps_num_palette_predictor_initializers > HEVC_MAX_PALETTE_PREDICTOR_SIZE) {
av_log(avctx, AV_LOG_ERROR,
@@ -1198,7 +1197,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
}
}
sps->motion_vector_resolution_control_idc = get_bits(gb, 2);
- sps->intra_boundary_filtering_disabled_flag = get_bits1(gb);
+ sps->intra_boundary_filtering_disabled = get_bits1(gb);
}
}
if (apply_defdispwin) {