The spec states:
* Only the lowest 12 spectral coefficients of any LFE may be non-zero
We were using the 12 lowest *bands*.
| ... | ... |
@@ -540,6 +540,12 @@ static int aac_encode_frame(AVCodecContext *avctx, |
| 540 | 540 |
wi[ch].window_shape = 0; |
| 541 | 541 |
wi[ch].num_windows = 1; |
| 542 | 542 |
wi[ch].grouping[0] = 1; |
| 543 |
+ |
|
| 544 |
+ /* Only the lowest 12 coefficients are used in a LFE channel. |
|
| 545 |
+ * The expression below results in only the bottom 8 coefficients |
|
| 546 |
+ * being used for 11.025kHz to 16kHz sample rates. |
|
| 547 |
+ */ |
|
| 548 |
+ ics->num_swb = s->samplerate_index >= 8 ? 1 : 3; |
|
| 543 | 549 |
} else {
|
| 544 | 550 |
wi[ch] = s->psy.model->window(&s->psy, samples2, la, cur_channel, |
| 545 | 551 |
ics->window_sequence[0]); |
| ... | ... |
@@ -550,7 +556,7 @@ static int aac_encode_frame(AVCodecContext *avctx, |
| 550 | 550 |
ics->use_kb_window[0] = wi[ch].window_shape; |
| 551 | 551 |
ics->num_windows = wi[ch].num_windows; |
| 552 | 552 |
ics->swb_sizes = s->psy.bands [ics->num_windows == 8]; |
| 553 |
- ics->num_swb = tag == TYPE_LFE ? 12 : s->psy.num_bands[ics->num_windows == 8]; |
|
| 553 |
+ ics->num_swb = tag == TYPE_LFE ? ics->num_swb : s->psy.num_bands[ics->num_windows == 8]; |
|
| 554 | 554 |
for (w = 0; w < ics->num_windows; w++) |
| 555 | 555 |
ics->group_len[w] = wi[ch].grouping[w]; |
| 556 | 556 |
|