Commit 4e432bcb authored by alexc's avatar alexc

Refactor windowing and early psy from bitstream writing parts of the AAC encoder.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19380 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent b0bac9ba
...@@ -485,6 +485,7 @@ static int aac_encode_frame(AVCodecContext *avctx, ...@@ -485,6 +485,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
int i, j, chans, tag, start_ch; int i, j, chans, tag, start_ch;
const uint8_t *chan_map = aac_chan_configs[avctx->channels-1]; const uint8_t *chan_map = aac_chan_configs[avctx->channels-1];
int chan_el_counter[4]; int chan_el_counter[4];
FFPsyWindowInfo windows[avctx->channels];
if (s->last_frame) if (s->last_frame)
return 0; return 0;
...@@ -510,13 +511,9 @@ static int aac_encode_frame(AVCodecContext *avctx, ...@@ -510,13 +511,9 @@ static int aac_encode_frame(AVCodecContext *avctx,
return 0; return 0;
} }
init_put_bits(&s->pb, frame, buf_size*8);
if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT))
put_bitstream_info(avctx, s, LIBAVCODEC_IDENT);
start_ch = 0; start_ch = 0;
memset(chan_el_counter, 0, sizeof(chan_el_counter));
for (i = 0; i < chan_map[0]; i++) { for (i = 0; i < chan_map[0]; i++) {
FFPsyWindowInfo wi[2]; FFPsyWindowInfo* wi = windows + start_ch;
tag = chan_map[i+1]; tag = chan_map[i+1];
chans = tag == TYPE_CPE ? 2 : 1; chans = tag == TYPE_CPE ? 2 : 1;
cpe = &s->cpe[i]; cpe = &s->cpe[i];
...@@ -540,6 +537,20 @@ static int aac_encode_frame(AVCodecContext *avctx, ...@@ -540,6 +537,20 @@ static int aac_encode_frame(AVCodecContext *avctx,
s->cur_channel = start_ch + j; s->cur_channel = start_ch + j;
apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2, j); apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2, j);
}
start_ch += chans;
}
init_put_bits(&s->pb, frame, buf_size*8);
if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT))
put_bitstream_info(avctx, s, LIBAVCODEC_IDENT);
start_ch = 0;
memset(chan_el_counter, 0, sizeof(chan_el_counter));
for (i = 0; i < chan_map[0]; i++) {
FFPsyWindowInfo* wi = windows + start_ch;
tag = chan_map[i+1];
chans = tag == TYPE_CPE ? 2 : 1;
cpe = &s->cpe[i];
for (j = 0; j < chans; j++) {
s->coder->search_for_quantizers(avctx, s, &cpe->ch[j], s->lambda); s->coder->search_for_quantizers(avctx, s, &cpe->ch[j], s->lambda);
} }
cpe->common_window = 0; cpe->common_window = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment