From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 5/6] avcodec/ac3enc: Combine cpl_coord buffers Date: Sun, 14 Apr 2024 20:30:04 +0200 Message-ID: <AS8P250MB0744E4633FED46F6E63BBCDC8F0A2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AS8P250MB0744432E9416A30719F18EDF8F0A2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/ac3enc.c | 12 ++++++------ libavcodec/ac3enc.h | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index eb878afc7b..71d3026d40 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -2194,8 +2194,7 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx) av_freep(&s->band_psd_buffer); av_freep(&s->mask_buffer); av_freep(&s->qmant_buffer); - av_freep(&s->cpl_coord_exp_buffer); - av_freep(&s->cpl_coord_mant_buffer); + av_freep(&s->cpl_coord_buffer); av_freep(&s->fdsp); av_tx_uninit(&s->tx); @@ -2439,6 +2438,7 @@ static av_cold int allocate_buffers(AC3EncodeContext *s) int channels = s->channels + 1; /* includes coupling channel */ int channel_blocks = channels * s->num_blocks; int total_coefs = AC3_MAX_COEFS * channel_blocks; + uint8_t *cpl_coord_mant_buffer; const unsigned sampletype_size = SAMPLETYPE_SIZE(s); for (int ch = 0; ch < s->channels; ch++) { @@ -2464,9 +2464,9 @@ static av_cold int allocate_buffers(AC3EncodeContext *s) return AVERROR(ENOMEM); } if (s->cpl_enabled) { - if (!FF_ALLOC_TYPED_ARRAY(s->cpl_coord_exp_buffer, channel_blocks * 16) || - !FF_ALLOC_TYPED_ARRAY(s->cpl_coord_mant_buffer, channel_blocks * 16)) + if (!FF_ALLOC_TYPED_ARRAY(s->cpl_coord_buffer, channel_blocks * 32)) return AVERROR(ENOMEM); + cpl_coord_mant_buffer = s->cpl_coord_buffer + 16 * channel_blocks; } for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; @@ -2479,8 +2479,8 @@ static av_cold int allocate_buffers(AC3EncodeContext *s) block->mask[ch] = &s->mask_buffer [64 * (blk * channels + ch)]; block->qmant[ch] = &s->qmant_buffer [AC3_MAX_COEFS * (blk * channels + ch)]; if (s->cpl_enabled) { - block->cpl_coord_exp[ch] = &s->cpl_coord_exp_buffer [16 * (blk * channels + ch)]; - block->cpl_coord_mant[ch] = &s->cpl_coord_mant_buffer[16 * (blk * channels + ch)]; + block->cpl_coord_exp[ch] = &s->cpl_coord_buffer [16 * (blk * channels + ch)]; + block->cpl_coord_mant[ch] = &cpl_coord_mant_buffer[16 * (blk * channels + ch)]; } /* arrangement: channel, block, coeff */ diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h index 54e14d43d9..4241a908a1 100644 --- a/libavcodec/ac3enc.h +++ b/libavcodec/ac3enc.h @@ -243,8 +243,7 @@ typedef struct AC3EncodeContext { int16_t *band_psd_buffer; int16_t *mask_buffer; int16_t *qmant_buffer; - uint8_t *cpl_coord_exp_buffer; - uint8_t *cpl_coord_mant_buffer; + uint8_t *cpl_coord_buffer; uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< exponent strategies uint8_t frame_exp_strategy[AC3_MAX_CHANNELS]; ///< frame exp strategy index -- 2.40.1 _______________________________________________ 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-14 18:30 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-14 18:28 [FFmpeg-devel] [PATCH 1/6] avcodec/ac3enc: Avoid allocation for windowed_samples Andreas Rheinhardt 2024-04-14 18:30 ` [FFmpeg-devel] [PATCH 2/6] avcodec/ac3enc: Avoid allocation for mdct_window Andreas Rheinhardt 2024-04-14 18:30 ` [FFmpeg-devel] [PATCH 3/6] avcodec/ac3enc: Avoid indirections, allocations of small arrays Andreas Rheinhardt 2024-04-14 18:30 ` [FFmpeg-devel] [PATCH 4/6] avcodec/ac3enc: Combine loops Andreas Rheinhardt 2024-04-14 18:30 ` Andreas Rheinhardt [this message] 2024-04-14 18:30 ` [FFmpeg-devel] [PATCH 6/6] avcodec/ac3enc: Avoid copying samples Andreas Rheinhardt 2024-04-17 15:04 ` [FFmpeg-devel] [PATCH 1/6] avcodec/ac3enc: Avoid allocation for windowed_samples Andreas Rheinhardt
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=AS8P250MB0744E4633FED46F6E63BBCDC8F0A2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.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