Mercurial > libavcodec.hg
comparison aacenc.c @ 12109:fb0ad62e952e libavcodec
aacenc: Enforce LFE bitstream restrictions.
author | alexc |
---|---|
date | Wed, 07 Jul 2010 21:48:51 +0000 |
parents | 108e7da64995 |
children | eb5059b0a051 |
comparison
equal
deleted
inserted
replaced
12108:c35d7bc64882 | 12109:fb0ad62e952e |
---|---|
207 | 207 |
208 s->lambda = avctx->global_quality ? avctx->global_quality : 120; | 208 s->lambda = avctx->global_quality ? avctx->global_quality : 120; |
209 | 209 |
210 ff_aac_tableinit(); | 210 ff_aac_tableinit(); |
211 | 211 |
212 if (avctx->channels > 5) | |
213 av_log(avctx, AV_LOG_ERROR, "This encoder does not yet enforce the restrictions on LFEs. " | |
214 "The output will most likely be an illegal bitstream.\n"); | |
215 | |
216 return 0; | 212 return 0; |
217 } | 213 } |
218 | 214 |
219 static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s, | 215 static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s, |
220 SingleChannelElement *sce, short *audio, int channel) | 216 SingleChannelElement *sce, short *audio, int channel) |
525 if (!data) | 521 if (!data) |
526 la = NULL; | 522 la = NULL; |
527 for (j = 0; j < chans; j++) { | 523 for (j = 0; j < chans; j++) { |
528 IndividualChannelStream *ics = &cpe->ch[j].ics; | 524 IndividualChannelStream *ics = &cpe->ch[j].ics; |
529 int k; | 525 int k; |
526 if (tag == TYPE_LFE) { | |
527 wi[j].window_type[0] = ONLY_LONG_SEQUENCE; | |
528 wi[j].window_shape = 0; | |
529 wi[j].num_windows = 1; | |
530 wi[j].grouping[0] = 1; | |
531 } else { | |
530 wi[j] = ff_psy_suggest_window(&s->psy, samples2, la, start_ch + j, ics->window_sequence[0]); | 532 wi[j] = ff_psy_suggest_window(&s->psy, samples2, la, start_ch + j, ics->window_sequence[0]); |
533 } | |
531 ics->window_sequence[1] = ics->window_sequence[0]; | 534 ics->window_sequence[1] = ics->window_sequence[0]; |
532 ics->window_sequence[0] = wi[j].window_type[0]; | 535 ics->window_sequence[0] = wi[j].window_type[0]; |
533 ics->use_kb_window[1] = ics->use_kb_window[0]; | 536 ics->use_kb_window[1] = ics->use_kb_window[0]; |
534 ics->use_kb_window[0] = wi[j].window_shape; | 537 ics->use_kb_window[0] = wi[j].window_shape; |
535 ics->num_windows = wi[j].num_windows; | 538 ics->num_windows = wi[j].num_windows; |
536 ics->swb_sizes = s->psy.bands [ics->num_windows == 8]; | 539 ics->swb_sizes = s->psy.bands [ics->num_windows == 8]; |
537 ics->num_swb = s->psy.num_bands[ics->num_windows == 8]; | 540 ics->num_swb = tag == TYPE_LFE ? 12 : s->psy.num_bands[ics->num_windows == 8]; |
538 for (k = 0; k < ics->num_windows; k++) | 541 for (k = 0; k < ics->num_windows; k++) |
539 ics->group_len[k] = wi[j].grouping[k]; | 542 ics->group_len[k] = wi[j].grouping[k]; |
540 | 543 |
541 s->cur_channel = start_ch + j; | 544 s->cur_channel = start_ch + j; |
542 apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2, j); | 545 apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2, j); |