From: James Almer <jamrial@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH 10/10] lavc/hevc_ps: compactify ShortTermRPS Date: Thu, 11 Apr 2024 09:35:37 -0300 Message-ID: <10d1bd4f-674b-4202-8b28-7fb02235c6df@gmail.com> (raw) In-Reply-To: <20240410133118.28144-10-anton@khirnov.net> On 4/10/2024 10:31 AM, Anton Khirnov wrote: > Do not use larger fields than needed, use size-1 bitfields for flags. > > Reduces sizeof(HEVCSPS) by 1280 bytes. > --- > libavcodec/hevc_ps.c | 6 +++--- > libavcodec/hevc_ps.h | 19 +++++++++++-------- > libavcodec/vulkan_hevc.c | 2 +- > 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 92b85115f7..a8d07aa1b2 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; Wont the compiler add two bytes of padding if you put this here? > + > + 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 c2b65fc201..b109475194 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, _______________________________________________ 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-11 12:35 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 ` [FFmpeg-devel] [PATCH 05/10] lavc/hevc_ps: reduce the size of used_by_curr_pic_lt_sps_flag Anton Khirnov 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 [this message] 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=10d1bd4f-674b-4202-8b28-7fb02235c6df@gmail.com \ --to=jamrial@gmail.com \ --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