aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-04-10 14:42:37 +0200
committerAnton Khirnov <anton@khirnov.net>2024-05-31 19:26:06 +0200
commit63a96dbcced2a67e96ee7306874dd2574e2d7d74 (patch)
tree5d0ac9ef672a42ffb8abf8ab6f7179753c864d61
parent9127819d514a3a82031f7448b40714f2880d7804 (diff)
downloadffmpeg-63a96dbcced2a67e96ee7306874dd2574e2d7d74.tar.gz
lavc/hevc_ps: compactify ShortTermRPS
Do not use larger fields than needed, use size-1 bitfields for flags. Reduces sizeof(HEVCSPS) by 1280 bytes.
-rw-r--r--libavcodec/hevc_ps.c6
-rw-r--r--libavcodec/hevc_ps.h19
-rw-r--r--libavcodec/vulkan_hevc.c2
3 files changed, 15 insertions, 12 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 76fe507e7b..7b486ce0af 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -143,11 +143,11 @@ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
for (i = 0; i <= rps_ridx->num_delta_pocs; i++) {
used[k] = get_bits1(gb);
- rps->use_delta_flag = 0;
+ rps->use_delta = 0;
if (!used[k])
- rps->use_delta_flag = get_bits1(gb);
+ rps->use_delta = get_bits1(gb);
- if (used[k] || rps->use_delta_flag) {
+ if (used[k] || rps->use_delta) {
if (i < rps_ridx->num_delta_pocs)
delta_poc = delta_rps + rps_ridx->delta_poc[i];
else
diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
index ed6372c747..d06d7cf1d4 100644
--- a/libavcodec/hevc_ps.h
+++ b/libavcodec/hevc_ps.h
@@ -70,16 +70,19 @@ typedef struct HEVCHdrParams {
} HEVCHdrParams;
typedef struct ShortTermRPS {
- uint8_t rps_predict;
- unsigned int delta_idx;
- uint8_t use_delta_flag;
- uint8_t delta_rps_sign;
- unsigned int abs_delta_rps;
- unsigned int num_negative_pics;
- int num_delta_pocs;
- int rps_idx_num_delta_pocs;
int32_t delta_poc[32];
uint32_t used;
+
+ uint8_t delta_idx;
+ uint8_t num_negative_pics;
+ uint8_t num_delta_pocs;
+ uint8_t rps_idx_num_delta_pocs;
+
+ uint16_t abs_delta_rps;
+ unsigned delta_rps_sign:1;
+
+ unsigned rps_predict:1;
+ unsigned use_delta:1;
} ShortTermRPS;
typedef struct HEVCWindow {
diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c
index a35f3d992d..5583f56285 100644
--- a/libavcodec/vulkan_hevc.c
+++ b/libavcodec/vulkan_hevc.c
@@ -359,7 +359,7 @@ static void set_sps(const HEVCSPS *sps, int sps_idx,
.delta_rps_sign = sps->st_rps[i].delta_rps_sign,
},
.delta_idx_minus1 = sps->st_rps[i].delta_idx - 1,
- .use_delta_flag = sps->st_rps[i].use_delta_flag,
+ .use_delta_flag = sps->st_rps[i].use_delta,
.abs_delta_rps_minus1 = sps->st_rps[i].abs_delta_rps - 1,
.used_by_curr_pic_flag = 0x0,
.used_by_curr_pic_s0_flag = 0x0,