From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 05/10] lavc/hevc_ps: reduce the size of used_by_curr_pic_lt_sps_flag
Date: Wed, 10 Apr 2024 15:31:13 +0200
Message-ID: <20240410133118.28144-5-anton@khirnov.net> (raw)
In-Reply-To: <20240410133118.28144-1-anton@khirnov.net>
It is currently an array of 32 uint8_t, each storing a single flag. A
single uint32_t is sufficient.
---
libavcodec/hevc_ps.c | 4 +++-
libavcodec/hevc_ps.h | 2 +-
libavcodec/hevcdec.c | 2 +-
libavcodec/vulkan_hevc.c | 3 +--
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 25f087ed75..8d5fc0d0ca 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -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);
}
}
diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
index 61a0fe2219..b2f3a8dbd1 100644
--- a/libavcodec/hevc_ps.h
+++ b/libavcodec/hevc_ps.h
@@ -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 {
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 6b2c0b75ee..4a7046bdec 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -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);
diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c
index 2705a965b9..9b40f5ad58 100644
--- a/libavcodec/vulkan_hevc.c
+++ b/libavcodec/vulkan_hevc.c
@@ -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];
}
--
2.43.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-04-10 13:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 13:31 [FFmpeg-devel] [PATCH 01/10] lavc/hevcdec: rename HEVCContext.HEVClcList to local_ctx Anton Khirnov
2024-04-10 13:31 ` [FFmpeg-devel] [PATCH 02/10] lavc/hevcdec: track local context count separately from WPP thread count Anton Khirnov
2024-04-10 13:31 ` [FFmpeg-devel] [PATCH 03/10] lavc/hevcdec: allocate local_ctx as array of structs rather than pointers Anton Khirnov
2024-04-17 9:29 ` Andreas Rheinhardt
2024-05-24 9:03 ` Anton Khirnov
2024-05-27 13:10 ` Andreas Rheinhardt
2024-05-28 13:54 ` [FFmpeg-devel] [PATCH v2 " Anton Khirnov
2024-04-10 13:31 ` [FFmpeg-devel] [PATCH 04/10] lavc/hevcdec: drop a useless execute() call with 1 job Anton Khirnov
2024-04-10 13:31 ` Anton Khirnov [this message]
2024-04-10 13:31 ` [FFmpeg-devel] [PATCH 06/10] lavc/hevc_ps/HEVCSPS: change flags into size-1 bitfields Anton Khirnov
2024-04-11 11:55 ` Andreas Rheinhardt
2024-05-24 9:07 ` Anton Khirnov
2024-04-10 13:31 ` [FFmpeg-devel] [PATCH 07/10] lavc/hevc_ps: fix variable signedness in ff_hevc_decode_short_term_rps() Anton Khirnov
2024-04-10 13:31 ` [FFmpeg-devel] [PATCH 08/10] lavc/hevc_ps: do not store delta_poc_s[01] in ShortTermRPS Anton Khirnov
2024-04-10 13:31 ` [FFmpeg-devel] [PATCH 09/10] lavc/hevc_ps: reduce the size of ShortTermRPS.used Anton Khirnov
2024-04-10 13:42 ` James Almer
2024-05-24 9:11 ` Anton Khirnov
2024-05-24 11:54 ` James Almer
2024-05-29 8:05 ` [FFmpeg-devel] [PATCH v2 09-10] " Anton Khirnov
2024-04-10 13:31 ` [FFmpeg-devel] [PATCH 10/10] lavc/hevc_ps: compactify ShortTermRPS Anton Khirnov
2024-04-11 12:35 ` James Almer
2024-05-24 9:19 ` Anton Khirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240410133118.28144-5-anton@khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git