mirror of https://git.ffmpeg.org/ffmpeg.git
lavc/hevc_ps: reduce the size of used_by_curr_pic_lt_sps_flag
It is currently an array of 32 uint8_t, each storing a single flag. A single uint32_t is sufficient.
This commit is contained in:
parent
72bdbce00d
commit
bd1a06dc43
|
@ -1094,9 +1094,11 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
|||
sps->num_long_term_ref_pics_sps);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
sps->used_by_curr_pic_lt = 0;
|
||||
for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) {
|
||||
sps->lt_ref_pic_poc_lsb_sps[i] = get_bits(gb, sps->log2_max_poc_lsb);
|
||||
sps->used_by_curr_pic_lt_sps_flag[i] = get_bits1(gb);
|
||||
sps->used_by_curr_pic_lt |= get_bits1(gb) * (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ typedef struct HEVCSPS {
|
|||
|
||||
uint8_t long_term_ref_pics_present_flag;
|
||||
uint16_t lt_ref_pic_poc_lsb_sps[HEVC_MAX_LONG_TERM_REF_PICS];
|
||||
uint8_t used_by_curr_pic_lt_sps_flag[HEVC_MAX_LONG_TERM_REF_PICS];
|
||||
uint32_t used_by_curr_pic_lt;
|
||||
uint8_t num_long_term_ref_pics_sps;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -295,7 +295,7 @@ static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
|
|||
lt_idx_sps = get_bits(gb, av_ceil_log2(sps->num_long_term_ref_pics_sps));
|
||||
|
||||
rps->poc[i] = sps->lt_ref_pic_poc_lsb_sps[lt_idx_sps];
|
||||
rps->used[i] = sps->used_by_curr_pic_lt_sps_flag[lt_idx_sps];
|
||||
rps->used[i] = !!(sps->used_by_curr_pic_lt & (1 << lt_idx_sps));
|
||||
} else {
|
||||
rps->poc[i] = get_bits(gb, sps->log2_max_poc_lsb);
|
||||
rps->used[i] = get_bits1(gb);
|
||||
|
|
|
@ -386,11 +386,10 @@ static void set_sps(const HEVCSPS *sps, int sps_idx,
|
|||
}
|
||||
|
||||
*ltr = (StdVideoH265LongTermRefPicsSps) {
|
||||
.used_by_curr_pic_lt_sps_flag = 0x0,
|
||||
.used_by_curr_pic_lt_sps_flag = sps->used_by_curr_pic_lt,
|
||||
};
|
||||
|
||||
for (int i = 0; i < sps->num_long_term_ref_pics_sps; i++) {
|
||||
ltr->used_by_curr_pic_lt_sps_flag |= sps->used_by_curr_pic_lt_sps_flag[i] << i;
|
||||
ltr->lt_ref_pic_poc_lsb_sps[i] = sps->lt_ref_pic_poc_lsb_sps[i];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue