[FFmpeg-devel] [PATCH 06/10] lavc/hevc_ps/HEVCSPS: change flags into size-1 bitfields

Anton Khirnov anton at khirnov.net
Wed Apr 10 16:31:14 EEST 2024


Reduces sizeof(HEVCSPS) by 96 bytes.

Also improve flag names: drop redundant suffixes and prefixes, and
consistently use disabled/enabled.
---
 libavcodec/dxva2_hevc.c        | 24 ++++-----
 libavcodec/hevc_cabac.c        | 36 ++++++-------
 libavcodec/hevc_filter.c       |  8 +--
 libavcodec/hevc_parser.c       |  2 +-
 libavcodec/hevc_ps.c           | 95 +++++++++++++++++-----------------
 libavcodec/hevc_ps.h           | 62 +++++++++++-----------
 libavcodec/hevcdec.c           | 10 ++--
 libavcodec/hevcpred_template.c |  4 +-
 libavcodec/mips/hevcpred_msa.c |  6 +--
 libavcodec/nvdec_hevc.c        | 42 +++++++--------
 libavcodec/qsvenc_hevc.c       |  2 +-
 libavcodec/vaapi_hevc.c        | 42 +++++++--------
 libavcodec/vdpau_hevc.c        | 36 ++++++-------
 libavcodec/vulkan_hevc.c       | 56 ++++++++++----------
 14 files changed, 212 insertions(+), 213 deletions(-)

diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
index 31d74a7164..b500d7917a 100644
--- a/libavcodec/dxva2_hevc.c
+++ b/libavcodec/dxva2_hevc.c
@@ -72,7 +72,7 @@ void ff_dxva2_hevc_fill_picture_parameters(const AVCodecContext *avctx, AVDXVACo
     pp->PicHeightInMinCbsY = sps->min_cb_height;
 
     pp->wFormatAndSequenceInfoFlags = (sps->chroma_format_idc             <<  0) |
-                                      (sps->separate_colour_plane_flag    <<  2) |
+                                      (sps->separate_colour_plane         <<  2) |
                                       ((sps->bit_depth - 8)               <<  3) |
                                       ((sps->bit_depth - 8)               <<  6) |
                                       ((sps->log2_max_poc_lsb - 4)        <<  9) |
@@ -99,18 +99,18 @@ void ff_dxva2_hevc_fill_picture_parameters(const AVCodecContext *avctx, AVDXVACo
         pp->wNumBitsForShortTermRPSInSlice       = h->sh.short_term_ref_pic_set_size;
     }
 
-    pp->dwCodingParamToolFlags = (sps->scaling_list_enable_flag                  <<  0) |
-                                 (sps->amp_enabled_flag                          <<  1) |
+    pp->dwCodingParamToolFlags = (sps->scaling_list_enabled                      <<  0) |
+                                 (sps->amp_enabled                               <<  1) |
                                  (sps->sao_enabled                               <<  2) |
-                                 (sps->pcm_enabled_flag                          <<  3) |
-                                 ((sps->pcm_enabled_flag ? (sps->pcm.bit_depth - 1) : 0)            <<  4) |
-                                 ((sps->pcm_enabled_flag ? (sps->pcm.bit_depth_chroma - 1) : 0)     <<  8) |
-                                 ((sps->pcm_enabled_flag ? (sps->pcm.log2_min_pcm_cb_size - 3) : 0) << 12) |
-                                 ((sps->pcm_enabled_flag ? (sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size) : 0) << 14) |
-                                 (sps->pcm.loop_filter_disable_flag              << 16) |
-                                 (sps->long_term_ref_pics_present_flag           << 17) |
-                                 (sps->sps_temporal_mvp_enabled_flag             << 18) |
-                                 (sps->sps_strong_intra_smoothing_enable_flag    << 19) |
+                                 (sps->pcm_enabled                               <<  3) |
+                                 ((sps->pcm_enabled      ? (sps->pcm.bit_depth - 1) : 0)            <<  4) |
+                                 ((sps->pcm_enabled      ? (sps->pcm.bit_depth_chroma - 1) : 0)     <<  8) |
+                                 ((sps->pcm_enabled      ? (sps->pcm.log2_min_pcm_cb_size - 3) : 0) << 12) |
+                                 ((sps->pcm_enabled      ? (sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size) : 0) << 14) |
+                                 (sps->pcm_loop_filter_disabled                  << 16) |
+                                 (sps->long_term_ref_pics_present                << 17) |
+                                 (sps->temporal_mvp_enabled                      << 18) |
+                                 (sps->strong_intra_smoothing_enabled            << 19) |
                                  (pps->dependent_slice_segments_enabled_flag     << 20) |
                                  (pps->output_flag_present_flag                  << 21) |
                                  (pps->num_extra_slice_header_bits               << 22) |
diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c
index 63ffb3d37c..2e639a7e41 100644
--- a/libavcodec/hevc_cabac.c
+++ b/libavcodec/hevc_cabac.c
@@ -408,7 +408,7 @@ void ff_hevc_save_states(HEVCLocalContext *lc, int ctb_addr_ts)
          (s->ps.sps->ctb_width == 2 &&
           ctb_addr_ts % s->ps.sps->ctb_width == 0))) {
         memcpy(lc->common_cabac_state->state, lc->cabac_state, HEVC_CONTEXTS);
-        if (s->ps.sps->persistent_rice_adaptation_enabled_flag) {
+        if (s->ps.sps->persistent_rice_adaptation_enabled) {
             memcpy(lc->common_cabac_state->stat_coeff, lc->stat_coeff, HEVC_STAT_COEFFS);
         }
     }
@@ -417,7 +417,7 @@ void ff_hevc_save_states(HEVCLocalContext *lc, int ctb_addr_ts)
 static void load_states(HEVCLocalContext *lc, const HEVCContext *s)
 {
     memcpy(lc->cabac_state, lc->common_cabac_state->state, HEVC_CONTEXTS);
-    if (s->ps.sps->persistent_rice_adaptation_enabled_flag) {
+    if (s->ps.sps->persistent_rice_adaptation_enabled) {
         memcpy(lc->stat_coeff, lc->common_cabac_state->stat_coeff, HEVC_STAT_COEFFS);
     }
 }
@@ -683,7 +683,7 @@ int ff_hevc_part_mode_decode(HEVCLocalContext *lc, int log2_cb_size)
         return PART_NxN; // 000
     }
 
-    if (!lc->parent->ps.sps->amp_enabled_flag) {
+    if (!lc->parent->ps.sps->amp_enabled) {
         if (GET_CABAC(PART_MODE_OFFSET + 1)) // 01
             return PART_2NxN;
         return PART_Nx2N;
@@ -1091,7 +1091,7 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
         scale_m  = 16; // default when no custom scaling lists.
         dc_scale = 16;
 
-        if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) {
+        if (s->ps.sps->scaling_list_enabled && !(transform_skip_flag && log2_trafo_size > 2)) {
             const ScalingList *sl = s->ps.pps->scaling_list_data_present_flag ?
             &s->ps.pps->scaling_list : &s->ps.sps->scaling_list;
             int matrix_id = lc->cu.pred_mode != MODE_INTRA;
@@ -1109,7 +1109,7 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
         dc_scale     = 0;
     }
 
-    if (lc->cu.pred_mode == MODE_INTER && s->ps.sps->explicit_rdpcm_enabled_flag &&
+    if (lc->cu.pred_mode == MODE_INTER && s->ps.sps->explicit_rdpcm_enabled &&
         (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) {
         explicit_rdpcm_flag = explicit_rdpcm_flag_decode(lc, c_idx);
         if (explicit_rdpcm_flag) {
@@ -1240,7 +1240,7 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
             };
             const uint8_t *ctx_idx_map_p;
             int scf_offset = 0;
-            if (s->ps.sps->transform_skip_context_enabled_flag &&
+            if (s->ps.sps->transform_skip_context_enabled &&
                 (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) {
                 ctx_idx_map_p = &ctx_idx_map[4 * 16];
                 if (c_idx == 0) {
@@ -1281,7 +1281,7 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
                 }
             }
             if (implicit_non_zero_coeff == 0) {
-                if (s->ps.sps->transform_skip_context_enabled_flag &&
+                if (s->ps.sps->transform_skip_context_enabled &&
                     (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) {
                     if (c_idx == 0) {
                         scf_offset = 42;
@@ -1326,7 +1326,7 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
             // initialize first elem of coeff_bas_level_greater1_flag
             int ctx_set = (i > 0 && c_idx == 0) ? 2 : 0;
 
-            if (s->ps.sps->persistent_rice_adaptation_enabled_flag) {
+            if (s->ps.sps->persistent_rice_adaptation_enabled) {
                 if (!transform_skip_flag && !lc->cu.cu_transquant_bypass_flag)
                     sb_type = 2 * (c_idx == 0 ? 1 : 0);
                 else
@@ -1355,7 +1355,7 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
 
             if (lc->cu.cu_transquant_bypass_flag ||
                 (lc->cu.pred_mode ==  MODE_INTRA  &&
-                 s->ps.sps->implicit_rdpcm_enabled_flag  &&  transform_skip_flag  &&
+                 s->ps.sps->implicit_rdpcm_enabled  &&  transform_skip_flag  &&
                  (pred_mode_intra == 10 || pred_mode_intra  ==  26 )) ||
                  explicit_rdpcm_flag)
                 sign_hidden = 0;
@@ -1381,8 +1381,8 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
 
                         trans_coeff_level += last_coeff_abs_level_remaining;
                         if (trans_coeff_level > (3 << c_rice_param))
-                            c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4);
-                        if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) {
+                            c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4);
+                        if (s->ps.sps->persistent_rice_adaptation_enabled && !rice_init) {
                             int c_rice_p_init = lc->stat_coeff[sb_type] / 4;
                             if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init))
                                 lc->stat_coeff[sb_type]++;
@@ -1397,8 +1397,8 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
 
                     trans_coeff_level = 1 + last_coeff_abs_level_remaining;
                     if (trans_coeff_level > (3 << c_rice_param))
-                        c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4);
-                    if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) {
+                        c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4);
+                    if (s->ps.sps->persistent_rice_adaptation_enabled && !rice_init) {
                         int c_rice_p_init = lc->stat_coeff[sb_type] / 4;
                         if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init))
                             lc->stat_coeff[sb_type]++;
@@ -1417,7 +1417,7 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
                     trans_coeff_level = -trans_coeff_level;
                 coeff_sign_flag <<= 1;
                 if(!lc->cu.cu_transquant_bypass_flag) {
-                    if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) {
+                    if (s->ps.sps->scaling_list_enabled && !(transform_skip_flag && log2_trafo_size > 2)) {
                         if(y_c || x_c || log2_trafo_size < 4) {
                             switch(log2_trafo_size) {
                                 case 3: pos = (y_c << 3) + x_c; break;
@@ -1445,15 +1445,15 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
     }
 
     if (lc->cu.cu_transquant_bypass_flag) {
-        if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag &&
+        if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled &&
                                     (pred_mode_intra == 10 || pred_mode_intra == 26))) {
-            int mode = s->ps.sps->implicit_rdpcm_enabled_flag ? (pred_mode_intra == 26) : explicit_rdpcm_dir_flag;
+            int mode = s->ps.sps->implicit_rdpcm_enabled ? (pred_mode_intra == 26) : explicit_rdpcm_dir_flag;
 
             s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode);
         }
     } else {
         if (transform_skip_flag) {
-            int rot = s->ps.sps->transform_skip_rotation_enabled_flag &&
+            int rot = s->ps.sps->transform_skip_rotation_enabled &&
                       log2_trafo_size == 2 &&
                       lc->cu.pred_mode == MODE_INTRA;
             if (rot) {
@@ -1463,7 +1463,7 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0,
 
             s->hevcdsp.dequant(coeffs, log2_trafo_size);
 
-            if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag &&
+            if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled &&
                                         lc->cu.pred_mode == MODE_INTRA &&
                                         (pred_mode_intra == 10 || pred_mode_intra == 26))) {
                 int mode = explicit_rdpcm_flag ? explicit_rdpcm_dir_flag : (pred_mode_intra == 26);
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 0c45310ea6..70d3ca588a 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -224,7 +224,7 @@ static void restore_tqb_pixels(const HEVCContext *s,
                                int x0, int y0, int width, int height, int c_idx)
 {
     if ( s->ps.pps->transquant_bypass_enable_flag ||
-            (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
+            (s->ps.sps->pcm_loop_filter_disabled && s->ps.sps->pcm_enabled)) {
         int x, y;
         int min_pu_size  = 1 << s->ps.sps->log2_min_pu_size;
         int hshift       = s->ps.sps->hshift[c_idx];
@@ -330,7 +330,7 @@ static void sao_filter_CTB(HEVCLocalContext *lc, const HEVCContext *s, int x, in
             copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
                            x_ctb, y_ctb);
             if (s->ps.pps->transquant_bypass_enable_flag ||
-                (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
+                (s->ps.sps->pcm_loop_filter_disabled && s->ps.sps->pcm_enabled)) {
                 dst = lc->edge_emu_buffer;
                 stride_dst = 2*MAX_PB_SIZE;
                 copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src);
@@ -500,8 +500,8 @@ static void deblocking_filter_CTB(const HEVCContext *s, int x0, int y0)
     int cur_beta_offset = s->deblock[ctb].beta_offset;
     int left_tc_offset, left_beta_offset;
     int tc_offset, beta_offset;
-    int pcmf = (s->ps.sps->pcm_enabled_flag &&
-                s->ps.sps->pcm.loop_filter_disable_flag) ||
+    int pcmf = (s->ps.sps->pcm_enabled &&
+                s->ps.sps->pcm_loop_filter_disabled) ||
                s->ps.pps->transquant_bypass_enable_flag;
 
     if (x0) {
diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index f174d419e4..73fc5d6372 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -150,7 +150,7 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal,
     if (ps->pps->output_flag_present_flag)
         skip_bits1(gb); // pic_output_flag
 
-    if (ps->sps->separate_colour_plane_flag)
+    if (ps->sps->separate_colour_plane)
         skip_bits(gb, 2);   // colour_plane_id
 
     if (!IS_IDR_NAL(nal)) {
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) {
diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
index b2f3a8dbd1..9801b4347f 100644
--- a/libavcodec/hevc_ps.h
+++ b/libavcodec/hevc_ps.h
@@ -188,11 +188,9 @@ typedef struct ScalingList {
 typedef struct HEVCSPS {
     unsigned vps_id;
     int chroma_format_idc;
-    uint8_t separate_colour_plane_flag;
 
     HEVCWindow output_window;
 
-    uint8_t conformance_window_flag;
     HEVCWindow pic_conf_win;
 
     HEVCHdrParams hdr;
@@ -203,32 +201,23 @@ typedef struct HEVCSPS {
     enum AVPixelFormat pix_fmt;
 
     unsigned int log2_max_poc_lsb;
-    int pcm_enabled_flag;
 
-    uint8_t sublayer_ordering_info_flag;
     int max_sub_layers;
     struct {
         int max_dec_pic_buffering;
         int num_reorder_pics;
         int max_latency_increase;
     } temporal_layer[HEVC_MAX_SUB_LAYERS];
-    uint8_t temporal_id_nesting_flag;
 
     int vui_present;
     VUI vui;
     PTL ptl;
 
-    uint8_t sps_extension_present_flag;
-    uint8_t scaling_list_enable_flag;
     ScalingList scaling_list;
 
     unsigned int nb_st_rps;
     ShortTermRPS st_rps[HEVC_MAX_SHORT_TERM_REF_PIC_SETS];
 
-    uint8_t amp_enabled_flag;
-    uint8_t sao_enabled;
-
-    uint8_t long_term_ref_pics_present_flag;
     uint16_t lt_ref_pic_poc_lsb_sps[HEVC_MAX_LONG_TERM_REF_PICS];
     uint32_t used_by_curr_pic_lt;
     uint8_t num_long_term_ref_pics_sps;
@@ -238,10 +227,7 @@ typedef struct HEVCSPS {
         uint8_t bit_depth_chroma;
         unsigned int log2_min_pcm_cb_size;
         unsigned int log2_max_pcm_cb_size;
-        uint8_t loop_filter_disable_flag;
     } pcm;
-    uint8_t sps_temporal_mvp_enabled_flag;
-    uint8_t sps_strong_intra_smoothing_enable_flag;
 
     unsigned int log2_min_cb_size;
     unsigned int log2_diff_max_min_coding_block_size;
@@ -254,30 +240,44 @@ typedef struct HEVCSPS {
     int max_transform_hierarchy_depth_inter;
     int max_transform_hierarchy_depth_intra;
 
-    int sps_range_extension_flag;
-    int transform_skip_rotation_enabled_flag;
-    int transform_skip_context_enabled_flag;
-    int implicit_rdpcm_enabled_flag;
-    int explicit_rdpcm_enabled_flag;
-    int extended_precision_processing_flag;
-    int intra_smoothing_disabled_flag;
-    int high_precision_offsets_enabled_flag;
-    int persistent_rice_adaptation_enabled_flag;
-    int cabac_bypass_alignment_enabled_flag;
+    unsigned separate_colour_plane:1;
+    unsigned conformance_window:1;
+    unsigned pcm_enabled:1;
+    unsigned pcm_loop_filter_disabled:1;
+    unsigned sublayer_ordering_info:1;
+    unsigned temporal_id_nesting:1;
+    unsigned extension_present:1;
+    unsigned scaling_list_enabled:1;
+    unsigned amp_enabled:1;
+    unsigned sao_enabled:1;
+    unsigned long_term_ref_pics_present:1;
+    unsigned temporal_mvp_enabled:1;
+    unsigned strong_intra_smoothing_enabled:1;
+    unsigned range_extension:1;
+    unsigned transform_skip_rotation_enabled:1;
+    unsigned transform_skip_context_enabled:1;
+    unsigned implicit_rdpcm_enabled:1;
+    unsigned explicit_rdpcm_enabled:1;
+    unsigned extended_precision_processing:1;
+    unsigned intra_smoothing_disabled:1;
+    unsigned high_precision_offsets_enabled:1;
+    unsigned persistent_rice_adaptation_enabled:1;
+    unsigned cabac_bypass_alignment_enabled:1;
 
-    int sps_multilayer_extension_flag;
-    int sps_3d_extension_flag;
+    unsigned multilayer_extension:1;
+    unsigned sps_3d_extension:1;
+
+    unsigned scc_extension:1;
+    unsigned curr_pic_ref_enabled:1;
+    unsigned palette_mode_enabled:1;
+    unsigned palette_predictor_initializers_present:1;
+    unsigned intra_boundary_filtering_disabled:1;
 
-    int sps_scc_extension_flag;
-    int sps_curr_pic_ref_enabled_flag;
-    int palette_mode_enabled_flag;
     int palette_max_size;
     int delta_palette_max_predictor_size;
-    int sps_palette_predictor_initializers_present_flag;
     int sps_num_palette_predictor_initializers;
     int sps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE];
     int motion_vector_resolution_control_idc;
-    int intra_boundary_filtering_disabled_flag;
 
     ///< coded frame dimension in various units
     int width;
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 4a7046bdec..eb03c45e8a 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -272,7 +272,7 @@ static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
     int i;
 
     rps->nb_refs = 0;
-    if (!sps->long_term_ref_pics_present_flag)
+    if (!sps->long_term_ref_pics_present)
         return 0;
 
     if (sps->num_long_term_ref_pics_sps > 0)
@@ -705,7 +705,7 @@ static int hls_slice_header(HEVCContext *s)
         if (s->ps.pps->output_flag_present_flag)
             sh->pic_output_flag = get_bits1(gb);
 
-        if (s->ps.sps->separate_colour_plane_flag)
+        if (s->ps.sps->separate_colour_plane)
             sh->colour_plane_id = get_bits(gb, 2);
 
         if (!IS_IDR(s)) {
@@ -753,7 +753,7 @@ static int hls_slice_header(HEVCContext *s)
             }
             sh->long_term_ref_pic_set_size = pos - get_bits_left(gb);
 
-            if (s->ps.sps->sps_temporal_mvp_enabled_flag)
+            if (s->ps.sps->temporal_mvp_enabled)
                 sh->slice_temporal_mvp_enabled_flag = get_bits1(gb);
             else
                 sh->slice_temporal_mvp_enabled_flag = 0;
@@ -2294,7 +2294,7 @@ static int hls_coding_unit(HEVCLocalContext *lc, const HEVCContext *s, int x0, i
         }
 
         if (lc->cu.pred_mode == MODE_INTRA) {
-            if (lc->cu.part_mode == PART_2Nx2N && s->ps.sps->pcm_enabled_flag &&
+            if (lc->cu.part_mode == PART_2Nx2N && s->ps.sps->pcm_enabled &&
                 log2_cb_size >= s->ps.sps->pcm.log2_min_pcm_cb_size &&
                 log2_cb_size <= s->ps.sps->pcm.log2_max_pcm_cb_size) {
                 pcm_flag = ff_hevc_pcm_flag_decode(lc);
@@ -2302,7 +2302,7 @@ static int hls_coding_unit(HEVCLocalContext *lc, const HEVCContext *s, int x0, i
             if (pcm_flag) {
                 intra_prediction_unit_default_value(lc, x0, y0, log2_cb_size);
                 ret = hls_pcm_sample(lc, x0, y0, log2_cb_size);
-                if (s->ps.sps->pcm.loop_filter_disable_flag)
+                if (s->ps.sps->pcm_loop_filter_disabled)
                     set_deblocking_bypass(s, x0, y0, log2_cb_size);
 
                 if (ret < 0)
diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c
index 46bd806523..9082a816e0 100644
--- a/libavcodec/hevcpred_template.c
+++ b/libavcodec/hevcpred_template.c
@@ -285,14 +285,14 @@ do {                                  \
     top[-1] = left[-1];
 
     // Filtering process
-    if (!s->ps.sps->intra_smoothing_disabled_flag && (c_idx == 0  || s->ps.sps->chroma_format_idc == 3)) {
+    if (!s->ps.sps->intra_smoothing_disabled && (c_idx == 0  || s->ps.sps->chroma_format_idc == 3)) {
         if (mode != INTRA_DC && size != 4){
             int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
             int min_dist_vert_hor = FFMIN(FFABS((int)(mode - 26U)),
                                           FFABS((int)(mode - 10U)));
             if (min_dist_vert_hor > intra_hor_ver_dist_thresh[log2_size - 3]) {
                 int threshold = 1 << (BIT_DEPTH - 5);
-                if (s->ps.sps->sps_strong_intra_smoothing_enable_flag && c_idx == 0 &&
+                if (s->ps.sps->strong_intra_smoothing_enabled && c_idx == 0 &&
                     log2_size == 5 &&
                     FFABS(top[-1]  + top[63]  - 2 * top[31])  < threshold &&
                     FFABS(left[-1] + left[63] - 2 * left[31]) < threshold) {
diff --git a/libavcodec/mips/hevcpred_msa.c b/libavcodec/mips/hevcpred_msa.c
index b056ee986b..d9137519ad 100644
--- a/libavcodec/mips/hevcpred_msa.c
+++ b/libavcodec/mips/hevcpred_msa.c
@@ -2369,7 +2369,7 @@ void ff_intra_pred_8_16x16_msa(HEVCLocalContext *lc, int x0, int y0, int c_idx)
     top[-1] = left[-1];
 
 
-    if (!s->ps.sps->intra_smoothing_disabled_flag
+    if (!s->ps.sps->intra_smoothing_disabled
         && (c_idx == 0 || s->ps.sps->chroma_format_idc == 3)) {
         if (mode != INTRA_DC && 16 != 4) {
             int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
@@ -2886,7 +2886,7 @@ void ff_intra_pred_8_32x32_msa(HEVCLocalContext *lc, int x0, int y0, int c_idx)
     top[-1] = left[-1];
 
 
-    if (!s->ps.sps->intra_smoothing_disabled_flag
+    if (!s->ps.sps->intra_smoothing_disabled
         && (c_idx == 0 || s->ps.sps->chroma_format_idc == 3)) {
         if (mode != INTRA_DC && 32 != 4) {
             int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
@@ -2901,7 +2901,7 @@ void ff_intra_pred_8_32x32_msa(HEVCLocalContext *lc, int x0, int y0, int c_idx)
                      0 ? ((int) (mode - 26U)) : (-((int) (mode - 26U))))));
             if (min_dist_vert_hor > intra_hor_ver_dist_thresh[5 - 3]) {
                 int threshold = 1 << (8 - 5);
-                if (s->ps.sps->sps_strong_intra_smoothing_enable_flag
+                if (s->ps.sps->strong_intra_smoothing_enabled
                     && c_idx == 0
                     && ((top[-1] + top[63] - 2 * top[31]) >=
                         0 ? (top[-1] + top[63] -
diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c
index f26ced71ef..3d704666d0 100644
--- a/libavcodec/nvdec_hevc.c
+++ b/libavcodec/nvdec_hevc.c
@@ -105,44 +105,44 @@ static int nvdec_hevc_start_frame(AVCodecContext *avctx,
             .log2_diff_max_min_luma_coding_block_size     = sps->log2_diff_max_min_coding_block_size,
             .log2_min_transform_block_size_minus2         = sps->log2_min_tb_size - 2,
             .log2_diff_max_min_transform_block_size       = sps->log2_max_trafo_size - sps->log2_min_tb_size,
-            .pcm_enabled_flag                             = sps->pcm_enabled_flag,
-            .log2_min_pcm_luma_coding_block_size_minus3   = sps->pcm_enabled_flag ? sps->pcm.log2_min_pcm_cb_size - 3 : 0,
+            .pcm_enabled_flag                             = sps->pcm_enabled,
+            .log2_min_pcm_luma_coding_block_size_minus3   = sps->pcm_enabled ? sps->pcm.log2_min_pcm_cb_size - 3 : 0,
             .log2_diff_max_min_pcm_luma_coding_block_size = sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size,
-            .pcm_sample_bit_depth_luma_minus1             = sps->pcm_enabled_flag ? sps->pcm.bit_depth - 1 : 0,
-            .pcm_sample_bit_depth_chroma_minus1           = sps->pcm_enabled_flag ? sps->pcm.bit_depth_chroma - 1 : 0,
+            .pcm_sample_bit_depth_luma_minus1             = sps->pcm_enabled ? sps->pcm.bit_depth - 1 : 0,
+            .pcm_sample_bit_depth_chroma_minus1           = sps->pcm_enabled ? sps->pcm.bit_depth_chroma - 1 : 0,
 #if NVDECAPI_CHECK_VERSION(8, 1)
             .log2_max_transform_skip_block_size_minus2    = pps->log2_max_transform_skip_block_size - 2,
             .log2_sao_offset_scale_luma                   = pps->log2_sao_offset_scale_luma,
             .log2_sao_offset_scale_chroma                 = pps->log2_sao_offset_scale_chroma,
-            .high_precision_offsets_enabled_flag          = sps->high_precision_offsets_enabled_flag,
+            .high_precision_offsets_enabled_flag          = sps->high_precision_offsets_enabled,
 #endif
-            .pcm_loop_filter_disabled_flag                = sps->pcm.loop_filter_disable_flag,
-            .strong_intra_smoothing_enabled_flag          = sps->sps_strong_intra_smoothing_enable_flag,
+            .pcm_loop_filter_disabled_flag                = sps->pcm_loop_filter_disabled,
+            .strong_intra_smoothing_enabled_flag          = sps->strong_intra_smoothing_enabled,
             .max_transform_hierarchy_depth_intra          = sps->max_transform_hierarchy_depth_intra,
             .max_transform_hierarchy_depth_inter          = sps->max_transform_hierarchy_depth_inter,
-            .amp_enabled_flag                             = sps->amp_enabled_flag,
-            .separate_colour_plane_flag                   = sps->separate_colour_plane_flag,
+            .amp_enabled_flag                             = sps->amp_enabled,
+            .separate_colour_plane_flag                   = sps->separate_colour_plane,
             .log2_max_pic_order_cnt_lsb_minus4            = sps->log2_max_poc_lsb - 4,
             .num_short_term_ref_pic_sets                  = sps->nb_st_rps,
-            .long_term_ref_pics_present_flag              = sps->long_term_ref_pics_present_flag,
+            .long_term_ref_pics_present_flag              = sps->long_term_ref_pics_present,
             .num_long_term_ref_pics_sps                   = sps->num_long_term_ref_pics_sps,
-            .sps_temporal_mvp_enabled_flag                = sps->sps_temporal_mvp_enabled_flag,
+            .sps_temporal_mvp_enabled_flag                = sps->temporal_mvp_enabled,
             .sample_adaptive_offset_enabled_flag          = sps->sao_enabled,
-            .scaling_list_enable_flag                     = sps->scaling_list_enable_flag,
+            .scaling_list_enable_flag                     = sps->scaling_list_enabled,
             .IrapPicFlag                                  = IS_IRAP(s),
             .IdrPicFlag                                   = IS_IDR(s),
             .bit_depth_luma_minus8                        = sps->bit_depth - 8,
             .bit_depth_chroma_minus8                      = sps->bit_depth - 8,
 #if NVDECAPI_CHECK_VERSION(9, 0)
-            .sps_range_extension_flag                     = sps->sps_range_extension_flag,
-            .transform_skip_rotation_enabled_flag         = sps->transform_skip_rotation_enabled_flag,
-            .transform_skip_context_enabled_flag          = sps->transform_skip_context_enabled_flag,
-            .implicit_rdpcm_enabled_flag                  = sps->implicit_rdpcm_enabled_flag,
-            .explicit_rdpcm_enabled_flag                  = sps->explicit_rdpcm_enabled_flag,
-            .extended_precision_processing_flag           = sps->extended_precision_processing_flag,
-            .intra_smoothing_disabled_flag                = sps->intra_smoothing_disabled_flag,
-            .persistent_rice_adaptation_enabled_flag      = sps->persistent_rice_adaptation_enabled_flag,
-            .cabac_bypass_alignment_enabled_flag          = sps->cabac_bypass_alignment_enabled_flag,
+            .sps_range_extension_flag                     = sps->range_extension,
+            .transform_skip_rotation_enabled_flag         = sps->transform_skip_rotation_enabled,
+            .transform_skip_context_enabled_flag          = sps->transform_skip_context_enabled,
+            .implicit_rdpcm_enabled_flag                  = sps->implicit_rdpcm_enabled,
+            .explicit_rdpcm_enabled_flag                  = sps->explicit_rdpcm_enabled,
+            .extended_precision_processing_flag           = sps->extended_precision_processing,
+            .intra_smoothing_disabled_flag                = sps->intra_smoothing_disabled,
+            .persistent_rice_adaptation_enabled_flag      = sps->persistent_rice_adaptation_enabled,
+            .cabac_bypass_alignment_enabled_flag          = sps->cabac_bypass_alignment_enabled,
 #endif
 
             .dependent_slice_segments_enabled_flag        = pps->dependent_slice_segments_enabled_flag,
diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index 2ccbe0464b..40cff6335a 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -108,7 +108,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
     /* generate the VPS */
     vps.vps_max_layers     = 1;
     vps.vps_max_sub_layers = sps.max_sub_layers;
-    vps.vps_temporal_id_nesting_flag = sps.temporal_id_nesting_flag;
+    vps.vps_temporal_id_nesting_flag = sps.temporal_id_nesting;
     memcpy(&vps.ptl, &sps.ptl, sizeof(vps.ptl));
     vps.vps_sub_layer_ordering_info_present_flag = 1;
     for (i = 0; i < HEVC_MAX_SUB_LAYERS; i++) {
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 3bdd2dd1b8..5af297c2af 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -171,12 +171,12 @@ static int vaapi_hevc_start_frame(AVCodecContext          *avctx,
         .pic_fields.bits = {
             .chroma_format_idc                          = sps->chroma_format_idc,
             .tiles_enabled_flag                         = pps->tiles_enabled_flag,
-            .separate_colour_plane_flag                 = sps->separate_colour_plane_flag,
-            .pcm_enabled_flag                           = sps->pcm_enabled_flag,
-            .scaling_list_enabled_flag                  = sps->scaling_list_enable_flag,
+            .separate_colour_plane_flag                 = sps->separate_colour_plane,
+            .pcm_enabled_flag                           = sps->pcm_enabled,
+            .scaling_list_enabled_flag                  = sps->scaling_list_enabled,
             .transform_skip_enabled_flag                = pps->transform_skip_enabled_flag,
-            .amp_enabled_flag                           = sps->amp_enabled_flag,
-            .strong_intra_smoothing_enabled_flag        = sps->sps_strong_intra_smoothing_enable_flag,
+            .amp_enabled_flag                           = sps->amp_enabled,
+            .strong_intra_smoothing_enabled_flag        = sps->strong_intra_smoothing_enabled,
             .sign_data_hiding_enabled_flag              = pps->sign_data_hiding_flag,
             .constrained_intra_pred_flag                = pps->constrained_intra_pred_flag,
             .cu_qp_delta_enabled_flag                   = pps->cu_qp_delta_enabled_flag,
@@ -186,12 +186,12 @@ static int vaapi_hevc_start_frame(AVCodecContext          *avctx,
             .entropy_coding_sync_enabled_flag           = pps->entropy_coding_sync_enabled_flag,
             .pps_loop_filter_across_slices_enabled_flag = pps->seq_loop_filter_across_slices_enabled_flag,
             .loop_filter_across_tiles_enabled_flag      = pps->loop_filter_across_tiles_enabled_flag,
-            .pcm_loop_filter_disabled_flag              = sps->pcm.loop_filter_disable_flag,
+            .pcm_loop_filter_disabled_flag              = sps->pcm_loop_filter_disabled,
         },
         .slice_parsing_fields.bits = {
             .lists_modification_present_flag             = pps->lists_modification_present_flag,
-            .long_term_ref_pics_present_flag             = sps->long_term_ref_pics_present_flag,
-            .sps_temporal_mvp_enabled_flag               = sps->sps_temporal_mvp_enabled_flag,
+            .long_term_ref_pics_present_flag             = sps->long_term_ref_pics_present,
+            .sps_temporal_mvp_enabled_flag               = sps->temporal_mvp_enabled,
             .cabac_init_present_flag                     = pps->cabac_init_present_flag,
             .output_flag_present_flag                    = pps->output_flag_present_flag,
             .dependent_slice_segments_enabled_flag       = pps->dependent_slice_segments_enabled_flag,
@@ -231,15 +231,15 @@ static int vaapi_hevc_start_frame(AVCodecContext          *avctx,
         avctx->profile == AV_PROFILE_HEVC_SCC) {
         pic->pic_param.rext = (VAPictureParameterBufferHEVCRext) {
             .range_extension_pic_fields.bits  = {
-                .transform_skip_rotation_enabled_flag       = sps->transform_skip_rotation_enabled_flag,
-                .transform_skip_context_enabled_flag        = sps->transform_skip_context_enabled_flag,
-                .implicit_rdpcm_enabled_flag                = sps->implicit_rdpcm_enabled_flag,
-                .explicit_rdpcm_enabled_flag                = sps->explicit_rdpcm_enabled_flag,
-                .extended_precision_processing_flag         = sps->extended_precision_processing_flag,
-                .intra_smoothing_disabled_flag              = sps->intra_smoothing_disabled_flag,
-                .high_precision_offsets_enabled_flag        = sps->high_precision_offsets_enabled_flag,
-                .persistent_rice_adaptation_enabled_flag    = sps->persistent_rice_adaptation_enabled_flag,
-                .cabac_bypass_alignment_enabled_flag        = sps->cabac_bypass_alignment_enabled_flag,
+                .transform_skip_rotation_enabled_flag       = sps->transform_skip_rotation_enabled,
+                .transform_skip_context_enabled_flag        = sps->transform_skip_context_enabled,
+                .implicit_rdpcm_enabled_flag                = sps->implicit_rdpcm_enabled,
+                .explicit_rdpcm_enabled_flag                = sps->explicit_rdpcm_enabled,
+                .extended_precision_processing_flag         = sps->extended_precision_processing,
+                .intra_smoothing_disabled_flag              = sps->intra_smoothing_disabled,
+                .high_precision_offsets_enabled_flag        = sps->high_precision_offsets_enabled,
+                .persistent_rice_adaptation_enabled_flag    = sps->persistent_rice_adaptation_enabled,
+                .cabac_bypass_alignment_enabled_flag        = sps->cabac_bypass_alignment_enabled,
                 .cross_component_prediction_enabled_flag    = pps->cross_component_prediction_enabled_flag,
                 .chroma_qp_offset_list_enabled_flag         = pps->chroma_qp_offset_list_enabled_flag,
             },
@@ -258,7 +258,7 @@ static int vaapi_hevc_start_frame(AVCodecContext          *avctx,
 
     pre_palette_size = pps->pps_palette_predictor_initializers_present_flag ?
                        pps->pps_num_palette_predictor_initializers :
-                       (sps->sps_palette_predictor_initializers_present_flag ?
+                       (sps->palette_predictor_initializers_present ?
                        sps->sps_num_palette_predictor_initializers :
                        0);
 
@@ -266,9 +266,9 @@ static int vaapi_hevc_start_frame(AVCodecContext          *avctx,
         pic->pic_param.scc = (VAPictureParameterBufferHEVCScc) {
             .screen_content_pic_fields.bits = {
                 .pps_curr_pic_ref_enabled_flag              = pps->pps_curr_pic_ref_enabled_flag,
-                .palette_mode_enabled_flag                  = sps->palette_mode_enabled_flag,
+                .palette_mode_enabled_flag                  = sps->palette_mode_enabled,
                 .motion_vector_resolution_control_idc       = sps->motion_vector_resolution_control_idc,
-                .intra_boundary_filtering_disabled_flag     = sps->intra_boundary_filtering_disabled_flag,
+                .intra_boundary_filtering_disabled_flag     = sps->intra_boundary_filtering_disabled,
                 .residual_adaptive_colour_transform_enabled_flag
                                                             = pps->residual_adaptive_colour_transform_enabled_flag,
                 .pps_slice_act_qp_offsets_present_flag      = pps->pps_slice_act_qp_offsets_present_flag,
@@ -305,7 +305,7 @@ static int vaapi_hevc_start_frame(AVCodecContext          *avctx,
 
     if (pps->scaling_list_data_present_flag)
         scaling_list = &pps->scaling_list;
-    else if (sps->scaling_list_enable_flag)
+    else if (sps->scaling_list_enabled)
         scaling_list = &sps->scaling_list;
 
     if (scaling_list) {
diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
index 4cd7ce5621..b029f9c42e 100644
--- a/libavcodec/vdpau_hevc.c
+++ b/libavcodec/vdpau_hevc.c
@@ -53,7 +53,7 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
 
     /* SPS */
     info->chroma_format_idc = sps->chroma_format_idc;
-    info->separate_colour_plane_flag = sps->separate_colour_plane_flag;
+    info->separate_colour_plane_flag = sps->separate_colour_plane;
     info->pic_width_in_luma_samples = sps->width;
     info->pic_height_in_luma_samples = sps->height;
     info->bit_depth_luma_minus8 = sps->bit_depth - 8;
@@ -68,7 +68,7 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
     info->log2_diff_max_min_transform_block_size = sps->log2_max_trafo_size - sps->log2_min_tb_size;
     info->max_transform_hierarchy_depth_inter = sps->max_transform_hierarchy_depth_inter;
     info->max_transform_hierarchy_depth_intra = sps->max_transform_hierarchy_depth_intra;
-    info->scaling_list_enabled_flag = sps->scaling_list_enable_flag;
+    info->scaling_list_enabled_flag = sps->scaling_list_enabled;
     /* Scaling lists, in diagonal order, to be used for this frame. */
     for (size_t i = 0; i < 6; i++) {
         for (size_t j = 0; j < 16; j++) {
@@ -100,9 +100,9 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
             info->ScalingListDCCoeff32x32[i] = sl->sl_dc[1][i * 3];
         }
     }
-    info->amp_enabled_flag = sps->amp_enabled_flag;
+    info->amp_enabled_flag = sps->amp_enabled;
     info->sample_adaptive_offset_enabled_flag = sps->sao_enabled;
-    info->pcm_enabled_flag = sps->pcm_enabled_flag;
+    info->pcm_enabled_flag = sps->pcm_enabled;
     if (info->pcm_enabled_flag) {
         /* Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
         info->pcm_sample_bit_depth_luma_minus1 = sps->pcm.bit_depth - 1;
@@ -113,17 +113,17 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
         /* Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
         info->log2_diff_max_min_pcm_luma_coding_block_size = sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size;
         /* Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
-        info->pcm_loop_filter_disabled_flag = sps->pcm.loop_filter_disable_flag;
+        info->pcm_loop_filter_disabled_flag = sps->pcm_loop_filter_disabled;
     }
     /* Per spec, when zero, assume short_term_ref_pic_set_sps_flag
        is also zero. */
     info->num_short_term_ref_pic_sets = sps->nb_st_rps;
-    info->long_term_ref_pics_present_flag = sps->long_term_ref_pics_present_flag;
+    info->long_term_ref_pics_present_flag = sps->long_term_ref_pics_present;
     /* Only needed if long_term_ref_pics_present_flag is set. Ignored
        otherwise. */
     info->num_long_term_ref_pics_sps = sps->num_long_term_ref_pics_sps;
-    info->sps_temporal_mvp_enabled_flag = sps->sps_temporal_mvp_enabled_flag;
-    info->strong_intra_smoothing_enabled_flag = sps->sps_strong_intra_smoothing_enable_flag;
+    info->sps_temporal_mvp_enabled_flag = sps->temporal_mvp_enabled;
+    info->strong_intra_smoothing_enabled_flag = sps->strong_intra_smoothing_enabled;
 
     /* Copy the HEVC Picture Parameter Set bitstream fields. */
     info->dependent_slice_segments_enabled_flag = pps->dependent_slice_segments_enabled_flag;
@@ -360,17 +360,17 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
     }
 
 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
-    if (sps->sps_range_extension_flag) {
+    if (sps->range_extension) {
         info2->sps_range_extension_flag             = 1;
-        info2->transformSkipRotationEnableFlag      = sps->transform_skip_rotation_enabled_flag;
-        info2->transformSkipContextEnableFlag       = sps->transform_skip_context_enabled_flag;
-        info2->implicitRdpcmEnableFlag              = sps->implicit_rdpcm_enabled_flag;
-        info2->explicitRdpcmEnableFlag              = sps->explicit_rdpcm_enabled_flag;
-        info2->extendedPrecisionProcessingFlag      = sps->extended_precision_processing_flag;
-        info2->intraSmoothingDisabledFlag           = sps->intra_smoothing_disabled_flag;
-        info2->highPrecisionOffsetsEnableFlag       = sps->high_precision_offsets_enabled_flag;
-        info2->persistentRiceAdaptationEnableFlag   = sps->persistent_rice_adaptation_enabled_flag;
-        info2->cabacBypassAlignmentEnableFlag       = sps->cabac_bypass_alignment_enabled_flag;
+        info2->transformSkipRotationEnableFlag      = sps->transform_skip_rotation_enabled;
+        info2->transformSkipContextEnableFlag       = sps->transform_skip_context_enabled;
+        info2->implicitRdpcmEnableFlag              = sps->implicit_rdpcm_enabled;
+        info2->explicitRdpcmEnableFlag              = sps->explicit_rdpcm_enabled;
+        info2->extendedPrecisionProcessingFlag      = sps->extended_precision_processing;
+        info2->intraSmoothingDisabledFlag           = sps->intra_smoothing_disabled;
+        info2->highPrecisionOffsetsEnableFlag       = sps->high_precision_offsets_enabled;
+        info2->persistentRiceAdaptationEnableFlag   = sps->persistent_rice_adaptation_enabled;
+        info2->cabacBypassAlignmentEnableFlag       = sps->cabac_bypass_alignment_enabled;
     } else {
         info2->sps_range_extension_flag = 0;
     }
diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c
index 9b40f5ad58..df86049d22 100644
--- a/libavcodec/vulkan_hevc.c
+++ b/libavcodec/vulkan_hevc.c
@@ -395,36 +395,36 @@ static void set_sps(const HEVCSPS *sps, int sps_idx,
 
     *vksps = (StdVideoH265SequenceParameterSet) {
         .flags = (StdVideoH265SpsFlags) {
-            .sps_temporal_id_nesting_flag = sps->temporal_id_nesting_flag,
-            .separate_colour_plane_flag = sps->separate_colour_plane_flag,
-            .conformance_window_flag = sps->conformance_window_flag,
-            .sps_sub_layer_ordering_info_present_flag = sps->sublayer_ordering_info_flag,
-            .scaling_list_enabled_flag = sps->scaling_list_enable_flag,
-            .sps_scaling_list_data_present_flag = sps->scaling_list_enable_flag,
-            .amp_enabled_flag = sps->amp_enabled_flag,
+            .sps_temporal_id_nesting_flag = sps->temporal_id_nesting,
+            .separate_colour_plane_flag = sps->separate_colour_plane,
+            .conformance_window_flag = sps->conformance_window,
+            .sps_sub_layer_ordering_info_present_flag = sps->sublayer_ordering_info,
+            .scaling_list_enabled_flag = sps->scaling_list_enabled,
+            .sps_scaling_list_data_present_flag = sps->scaling_list_enabled,
+            .amp_enabled_flag = sps->amp_enabled,
             .sample_adaptive_offset_enabled_flag = sps->sao_enabled,
-            .pcm_enabled_flag = sps->pcm_enabled_flag,
-            .pcm_loop_filter_disabled_flag = sps->pcm.loop_filter_disable_flag,
-            .long_term_ref_pics_present_flag = sps->long_term_ref_pics_present_flag,
-            .sps_temporal_mvp_enabled_flag = sps->sps_temporal_mvp_enabled_flag,
-            .strong_intra_smoothing_enabled_flag = sps->sps_strong_intra_smoothing_enable_flag,
+            .pcm_enabled_flag = sps->pcm_enabled,
+            .pcm_loop_filter_disabled_flag = sps->pcm_loop_filter_disabled,
+            .long_term_ref_pics_present_flag = sps->long_term_ref_pics_present,
+            .sps_temporal_mvp_enabled_flag = sps->temporal_mvp_enabled,
+            .strong_intra_smoothing_enabled_flag = sps->strong_intra_smoothing_enabled,
             .vui_parameters_present_flag = sps->vui_present,
-            .sps_extension_present_flag = sps->sps_extension_present_flag,
-            .sps_range_extension_flag = sps->sps_range_extension_flag,
-            .transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled_flag,
-            .transform_skip_context_enabled_flag = sps->transform_skip_context_enabled_flag,
-            .implicit_rdpcm_enabled_flag = sps->implicit_rdpcm_enabled_flag,
-            .explicit_rdpcm_enabled_flag = sps->explicit_rdpcm_enabled_flag,
-            .extended_precision_processing_flag = sps->extended_precision_processing_flag,
-            .intra_smoothing_disabled_flag = sps->intra_smoothing_disabled_flag,
-            .high_precision_offsets_enabled_flag = sps->high_precision_offsets_enabled_flag,
-            .persistent_rice_adaptation_enabled_flag = sps->persistent_rice_adaptation_enabled_flag,
-            .cabac_bypass_alignment_enabled_flag = sps->cabac_bypass_alignment_enabled_flag,
-            .sps_scc_extension_flag = sps->sps_scc_extension_flag,
-            .sps_curr_pic_ref_enabled_flag = sps->sps_curr_pic_ref_enabled_flag,
-            .palette_mode_enabled_flag = sps->palette_mode_enabled_flag,
-            .sps_palette_predictor_initializers_present_flag = sps->sps_palette_predictor_initializers_present_flag,
-            .intra_boundary_filtering_disabled_flag = sps->intra_boundary_filtering_disabled_flag,
+            .sps_extension_present_flag = sps->extension_present,
+            .sps_range_extension_flag = sps->range_extension,
+            .transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled,
+            .transform_skip_context_enabled_flag = sps->transform_skip_context_enabled,
+            .implicit_rdpcm_enabled_flag = sps->implicit_rdpcm_enabled,
+            .explicit_rdpcm_enabled_flag = sps->explicit_rdpcm_enabled,
+            .extended_precision_processing_flag = sps->extended_precision_processing,
+            .intra_smoothing_disabled_flag = sps->intra_smoothing_disabled,
+            .high_precision_offsets_enabled_flag = sps->high_precision_offsets_enabled,
+            .persistent_rice_adaptation_enabled_flag = sps->persistent_rice_adaptation_enabled,
+            .cabac_bypass_alignment_enabled_flag = sps->cabac_bypass_alignment_enabled,
+            .sps_scc_extension_flag = sps->scc_extension,
+            .sps_curr_pic_ref_enabled_flag = sps->curr_pic_ref_enabled,
+            .palette_mode_enabled_flag = sps->palette_mode_enabled,
+            .sps_palette_predictor_initializers_present_flag = sps->palette_predictor_initializers_present,
+            .intra_boundary_filtering_disabled_flag = sps->intra_boundary_filtering_disabled,
         },
         .chroma_format_idc = sps->chroma_format_idc,
         .pic_width_in_luma_samples = sps->width,
-- 
2.43.0



More information about the ffmpeg-devel mailing list