History

avcodec/ac3enc: Combine cpl_coord buffers

Andreas Rheinhardt committed 2 years ago

Commit da460fb1 parent 5b9fab02 files · +7 −8Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/ac3enc.c +6 −6
  2. libavcodec/ac3enc.h +1 −2
libavcodec/ac3enc.c+6−6
@@ -2194,8 +2194,7 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx) · 2193 unmodified lines
2194 av_freep(&s->band_psd_buffer);2194 av_freep(&s->band_psd_buffer);
2195 av_freep(&s->mask_buffer);2195 av_freep(&s->mask_buffer);
2196 av_freep(&s->qmant_buffer);2196 av_freep(&s->qmant_buffer);
2197 av_freep(&s->cpl_coord_exp_buffer);2197 av_freep(&s->cpl_coord_buffer);
2198 av_freep(&s->cpl_coord_mant_buffer);
2199 av_freep(&s->fdsp);2198 av_freep(&s->fdsp);
2200 2199
2201 av_tx_uninit(&s->tx);2200 av_tx_uninit(&s->tx);
@@ -2439,6 +2438,7 @@ static av_cold int allocate_buffers(AC3EncodeContext *s) · 237 unmodified lines
2439 int channels = s->channels + 1; /* includes coupling channel */2438 int channels = s->channels + 1; /* includes coupling channel */
2440 int channel_blocks = channels * s->num_blocks;2439 int channel_blocks = channels * s->num_blocks;
2441 int total_coefs = AC3_MAX_COEFS * channel_blocks;2440 int total_coefs = AC3_MAX_COEFS * channel_blocks;
2441 uint8_t *cpl_coord_mant_buffer;
2442 const unsigned sampletype_size = SAMPLETYPE_SIZE(s);2442 const unsigned sampletype_size = SAMPLETYPE_SIZE(s);
2443 2443
2444 for (int ch = 0; ch < s->channels; ch++) {2444 for (int ch = 0; ch < s->channels; ch++) {
@@ -2464,9 +2464,9 @@ static av_cold int allocate_buffers(AC3EncodeContext *s) · 19 unmodified lines
2464 return AVERROR(ENOMEM);2464 return AVERROR(ENOMEM);
2465 }2465 }
2466 if (s->cpl_enabled) {2466 if (s->cpl_enabled) {
2467 if (!FF_ALLOC_TYPED_ARRAY(s->cpl_coord_exp_buffer, channel_blocks * 16) ||2467 if (!FF_ALLOC_TYPED_ARRAY(s->cpl_coord_buffer, channel_blocks * 32))
2468 !FF_ALLOC_TYPED_ARRAY(s->cpl_coord_mant_buffer, channel_blocks * 16))
2469 return AVERROR(ENOMEM);2468 return AVERROR(ENOMEM);
2469 cpl_coord_mant_buffer = s->cpl_coord_buffer + 16 * channel_blocks;
2470 }2470 }
2471 for (blk = 0; blk < s->num_blocks; blk++) {2471 for (blk = 0; blk < s->num_blocks; blk++) {
2472 AC3Block *block = &s->blocks[blk];2472 AC3Block *block = &s->blocks[blk];
@@ -2479,8 +2479,8 @@ static av_cold int allocate_buffers(AC3EncodeContext *s) · 6 unmodified lines
2479 block->mask[ch] = &s->mask_buffer [64 * (blk * channels + ch)];2479 block->mask[ch] = &s->mask_buffer [64 * (blk * channels + ch)];
2480 block->qmant[ch] = &s->qmant_buffer [AC3_MAX_COEFS * (blk * channels + ch)];2480 block->qmant[ch] = &s->qmant_buffer [AC3_MAX_COEFS * (blk * channels + ch)];
2481 if (s->cpl_enabled) {2481 if (s->cpl_enabled) {
2482 block->cpl_coord_exp[ch] = &s->cpl_coord_exp_buffer [16 * (blk * channels + ch)];2482 block->cpl_coord_exp[ch] = &s->cpl_coord_buffer [16 * (blk * channels + ch)];
2483 block->cpl_coord_mant[ch] = &s->cpl_coord_mant_buffer[16 * (blk * channels + ch)];2483 block->cpl_coord_mant[ch] = &cpl_coord_mant_buffer[16 * (blk * channels + ch)];
2484 }2484 }
2485 2485
2486 /* arrangement: channel, block, coeff */2486 /* arrangement: channel, block, coeff */
libavcodec/ac3enc.h+1−2
@@ -243,8 +243,7 @@ typedef struct AC3EncodeContext { · 242 unmodified lines
243 int16_t *band_psd_buffer;243 int16_t *band_psd_buffer;
244 int16_t *mask_buffer;244 int16_t *mask_buffer;
245 int16_t *qmant_buffer;245 int16_t *qmant_buffer;
246 uint8_t *cpl_coord_exp_buffer;246 uint8_t *cpl_coord_buffer;
247 uint8_t *cpl_coord_mant_buffer;
248 247
249 uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< exponent strategies248 uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< exponent strategies
250 uint8_t frame_exp_strategy[AC3_MAX_CHANNELS]; ///< frame exp strategy index249 uint8_t frame_exp_strategy[AC3_MAX_CHANNELS]; ///< frame exp strategy index

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t