[FFmpeg-devel] [PATCH 00/72] Implement support for Vulkan multiplane images and video decoding

Anton Khirnov anton at khirnov.net
Mon Feb 20 18:56:55 EET 2023


Quoting Lynne (2023-02-17 04:43:50)
> From 1279c6011c610fdb054cd9eea7a6f07c94f69f29 Mon Sep 17 00:00:00 2001
> From: Lynne <dev at lynne.ee>
> Date: Wed, 14 Dec 2022 00:09:08 +0100
> Subject: [PATCH 08/72] h264_ps: expose bit rate and CPB size fields
> 
> ---
>  libavcodec/h264_ps.c | 8 ++++----
>  libavcodec/h264_ps.h | 4 ++++
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> index d9df570718..fc8715876a 100644
> --- a/libavcodec/h264_ps.c
> +++ b/libavcodec/h264_ps.c
> @@ -113,12 +113,12 @@ static inline int decode_hrd_parameters(GetBitContext *gb, void *logctx,
>          return AVERROR_INVALIDDATA;
>      }
>  
> -    get_bits(gb, 4); /* bit_rate_scale */
> +    sps->bit_rate_scale = get_bits(gb, 4);
>      get_bits(gb, 4); /* cpb_size_scale */
>      for (i = 0; i < cpb_count; i++) {
> -        get_ue_golomb_long(gb); /* bit_rate_value_minus1 */
> -        get_ue_golomb_long(gb); /* cpb_size_value_minus1 */
> -        get_bits1(gb);          /* cbr_flag */
> +        sps->bit_rate_value[i] = get_ue_golomb_long(gb) + 1; /* bit_rate_value_minus1 + 1 */
> +        sps->cpb_size_value[i] = get_ue_golomb_long(gb) + 1; /* cpb_size_value_minus1 + 1 */
> +        sps->cpr_flag[i]       = get_bits1(gb);
>      }
>      sps->initial_cpb_removal_delay_length = get_bits(gb, 5) + 1;
>      sps->cpb_removal_delay_length         = get_bits(gb, 5) + 1;
> diff --git a/libavcodec/h264_ps.h b/libavcodec/h264_ps.h
> index 906bab7214..03bd0227d6 100644
> --- a/libavcodec/h264_ps.h
> +++ b/libavcodec/h264_ps.h
> @@ -89,6 +89,10 @@ typedef struct SPS {
>      int pic_struct_present_flag;
>      int time_offset_length;
>      int cpb_cnt;                          ///< See H.264 E.1.2
> +    int bit_rate_scale;
> +    uint32_t bit_rate_value[32];          ///< bit_rate_value_minus1 + 1
> +    uint32_t cpb_size_value[32];          ///< cpb_size_value_minus1 + 1
> +    uint8_t cpr_flag[32];

If only there was a way to store 32 flags in less than 32 bytes.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list