Mercurial > libavcodec.hg
comparison aacenc.c @ 12095:108e7da64995 libavcodec
aacenc: replace VLA with fixed size
Number of channels is restricted to 6 so the size is acceptable
for the stack.
author | mru |
---|---|
date | Tue, 06 Jul 2010 00:06:15 +0000 |
parents | 949d048b7611 |
children | fb0ad62e952e |
comparison
equal
deleted
inserted
replaced
12094:f7bedc1ce1bc | 12095:108e7da64995 |
---|---|
39 #include "aactab.h" | 39 #include "aactab.h" |
40 #include "aacenc.h" | 40 #include "aacenc.h" |
41 | 41 |
42 #include "psymodel.h" | 42 #include "psymodel.h" |
43 | 43 |
44 #define AAC_MAX_CHANNELS 6 | |
45 | |
44 static const uint8_t swb_size_1024_96[] = { | 46 static const uint8_t swb_size_1024_96[] = { |
45 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, | 47 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, |
46 12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44, | 48 12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44, |
47 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 | 49 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 |
48 }; | 50 }; |
164 break; | 166 break; |
165 if (i == 16) { | 167 if (i == 16) { |
166 av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate); | 168 av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate); |
167 return -1; | 169 return -1; |
168 } | 170 } |
169 if (avctx->channels > 6) { | 171 if (avctx->channels > AAC_MAX_CHANNELS) { |
170 av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", avctx->channels); | 172 av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", avctx->channels); |
171 return -1; | 173 return -1; |
172 } | 174 } |
173 if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) { | 175 if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) { |
174 av_log(avctx, AV_LOG_ERROR, "Unsupported profile %d\n", avctx->profile); | 176 av_log(avctx, AV_LOG_ERROR, "Unsupported profile %d\n", avctx->profile); |
484 int16_t *samples = s->samples, *samples2, *la; | 486 int16_t *samples = s->samples, *samples2, *la; |
485 ChannelElement *cpe; | 487 ChannelElement *cpe; |
486 int i, j, chans, tag, start_ch; | 488 int i, j, chans, tag, start_ch; |
487 const uint8_t *chan_map = aac_chan_configs[avctx->channels-1]; | 489 const uint8_t *chan_map = aac_chan_configs[avctx->channels-1]; |
488 int chan_el_counter[4]; | 490 int chan_el_counter[4]; |
489 FFPsyWindowInfo windows[avctx->channels]; | 491 FFPsyWindowInfo windows[AAC_MAX_CHANNELS]; |
490 | 492 |
491 if (s->last_frame) | 493 if (s->last_frame) |
492 return 0; | 494 return 0; |
493 if (data) { | 495 if (data) { |
494 if (!s->psypp) { | 496 if (!s->psypp) { |