Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 6692:25413354a79a libavcodec
simplify
author | bcoudurier |
---|---|
date | Sat, 26 Apr 2008 13:08:16 +0000 |
parents | 863e939331aa |
children | a2319e5d8bd3 |
comparison
equal
deleted
inserted
replaced
6691:863e939331aa | 6692:25413354a79a |
---|---|
2561 uint32_t header; | 2561 uint32_t header; |
2562 OUT_INT *out_samples = data; | 2562 OUT_INT *out_samples = data; |
2563 OUT_INT decoded_buf[MPA_FRAME_SIZE * MPA_MAX_CHANNELS]; | 2563 OUT_INT decoded_buf[MPA_FRAME_SIZE * MPA_MAX_CHANNELS]; |
2564 OUT_INT *outptr, *bp; | 2564 OUT_INT *outptr, *bp; |
2565 int fsize; | 2565 int fsize; |
2566 const unsigned char *start2 = buf, *start; | |
2567 int fr, i, j, n; | 2566 int fr, i, j, n; |
2568 int off = avctx->channels; | 2567 int off = avctx->channels; |
2569 const uint8_t *coff = chan_offset[s->chan_cfg]; | 2568 const uint8_t *coff = chan_offset[s->chan_cfg]; |
2570 | 2569 |
2571 len = buf_size; | 2570 len = buf_size; |
2577 | 2576 |
2578 // If only one decoder interleave is not needed | 2577 // If only one decoder interleave is not needed |
2579 outptr = s->frames == 1 ? out_samples : decoded_buf; | 2578 outptr = s->frames == 1 ? out_samples : decoded_buf; |
2580 | 2579 |
2581 for (fr = 0; fr < s->frames; fr++) { | 2580 for (fr = 0; fr < s->frames; fr++) { |
2582 start = start2; | 2581 fsize = AV_RB16(buf) >> 4; |
2583 fsize = AV_RB16(start) >> 4; | |
2584 fsize = FFMIN3(fsize, len, MPA_MAX_CODED_FRAME_SIZE); | 2582 fsize = FFMIN3(fsize, len, MPA_MAX_CODED_FRAME_SIZE); |
2585 start2 += fsize; | |
2586 len -= fsize; | |
2587 m = s->mp3decctx[fr]; | 2583 m = s->mp3decctx[fr]; |
2588 assert (m != NULL); | 2584 assert (m != NULL); |
2589 | 2585 |
2590 // Get header | 2586 // Get header |
2591 header = AV_RB32(start) | 0xfff00000; | 2587 header = AV_RB32(buf) | 0xfff00000; |
2592 | 2588 |
2593 if (ff_mpa_check_header(header) < 0) { // Bad header, discard block | 2589 if (ff_mpa_check_header(header) < 0) { // Bad header, discard block |
2594 *data_size = 0; | 2590 *data_size = 0; |
2595 return buf_size; | 2591 return buf_size; |
2596 } | 2592 } |
2597 | 2593 |
2598 ff_mpegaudio_decode_header(m, header); | 2594 ff_mpegaudio_decode_header(m, header); |
2599 out_size += mp_decode_frame(m, decoded_buf, start, fsize); | 2595 out_size += mp_decode_frame(m, decoded_buf, buf, fsize); |
2596 buf += fsize; | |
2597 len -= fsize; | |
2600 | 2598 |
2601 if(s->frames > 1) { | 2599 if(s->frames > 1) { |
2602 n = m->avctx->frame_size*m->nb_channels; | 2600 n = m->avctx->frame_size*m->nb_channels; |
2603 /* interleave output data */ | 2601 /* interleave output data */ |
2604 bp = out_samples + coff[fr]; | 2602 bp = out_samples + coff[fr]; |