[FFmpeg-devel] [PATCH 09/10] lavc/hevc_ps: reduce the size of ShortTermRPS.used
James Almer
jamrial at gmail.com
Fri May 24 14:54:10 EEST 2024
On 5/24/2024 6:11 AM, Anton Khirnov wrote:
> Quoting James Almer (2024-04-10 15:42:51)
>>
>>
>> On 4/10/2024 10:31 AM, Anton Khirnov wrote:
>>> diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c
>>> index 5d7c6b1b64..c2b65fc201 100644
>>> --- a/libavcodec/vulkan_hevc.c
>>> +++ b/libavcodec/vulkan_hevc.c
>>> @@ -374,17 +374,17 @@ static void set_sps(const HEVCSPS *sps, int sps_idx,
>>> /* NOTE: This is the predicted, and *reordered* version.
>>> * Probably incorrect, but the spec doesn't say which version to use. */
>>> for (int j = 0; j < sps->st_rps[i].num_delta_pocs; j++)
>>> - str[i].used_by_curr_pic_flag |= sps->st_rps[i].used[j] << j;
>>> + str[i].used_by_curr_pic_flag |= st_rps->used;
>>>
>>> for (int j = 0; j < str[i].num_negative_pics; j++) {
>>> - str[i].delta_poc_s0_minus1[j] = st_rps->delta_poc[j] - (j ? st_rps->delta_poc[j - 1] : 0) - 1;
>>> - str[i].used_by_curr_pic_s0_flag |= sps->st_rps[i].used[j] << j;
>>> + str[i].delta_poc_s0_minus1[j] = st_rps->delta_poc[j] - (j ? st_rps->delta_poc[j - 1] : 0) - 1;
>>> + str[i].used_by_curr_pic_s0_flag |= st_rps->used & ((1 << str[i].num_negative_pics) - 1);
>>
>> av_mod_uintp2(st_rps->used, str[i].num_negative_pics).
>
> unrelated change
It's a nit, but not unrelated. You're adding a "i & ((1 << j) - 1)"
line, which can be simplified (and optimized) by using av_mod_uintp2()
instead.
More information about the ffmpeg-devel
mailing list