Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 6700:dd38dc6306a8 libavcodec
simplify: remove useless fields and vars
author | bcoudurier |
---|---|
date | Sat, 26 Apr 2008 14:28:18 +0000 |
parents | 99cf02b8f831 |
children | ef18192d8474 |
comparison
equal
deleted
inserted
replaced
6699:99cf02b8f831 | 6700:dd38dc6306a8 |
---|---|
2470 /** | 2470 /** |
2471 * Context for MP3On4 decoder | 2471 * Context for MP3On4 decoder |
2472 */ | 2472 */ |
2473 typedef struct MP3On4DecodeContext { | 2473 typedef struct MP3On4DecodeContext { |
2474 int frames; ///< number of mp3 frames per block (number of mp3 decoder instances) | 2474 int frames; ///< number of mp3 frames per block (number of mp3 decoder instances) |
2475 int chan_cfg; ///< channel config number | |
2476 int syncword; ///< syncword patch | 2475 int syncword; ///< syncword patch |
2476 const uint8_t *coff; ///< channels offsets in output buffer | |
2477 MPADecodeContext *mp3decctx[5]; ///< MPADecodeContext for every decoder instance | 2477 MPADecodeContext *mp3decctx[5]; ///< MPADecodeContext for every decoder instance |
2478 } MP3On4DecodeContext; | 2478 } MP3On4DecodeContext; |
2479 | 2479 |
2480 #include "mpeg4audio.h" | 2480 #include "mpeg4audio.h" |
2481 | 2481 |
2508 ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size); | 2508 ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size); |
2509 if (!cfg.chan_config || cfg.chan_config > 7) { | 2509 if (!cfg.chan_config || cfg.chan_config > 7) { |
2510 av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n"); | 2510 av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n"); |
2511 return -1; | 2511 return -1; |
2512 } | 2512 } |
2513 s->chan_cfg = cfg.chan_config; | 2513 s->frames = mp3Frames[cfg.chan_config]; |
2514 s->frames = mp3Frames[s->chan_cfg]; | 2514 s->coff = chan_offset[cfg.chan_config]; |
2515 avctx->channels = ff_mpeg4audio_channels[s->chan_cfg]; | 2515 avctx->channels = ff_mpeg4audio_channels[cfg.chan_config]; |
2516 | 2516 |
2517 if (cfg.sample_rate < 16000) | 2517 if (cfg.sample_rate < 16000) |
2518 s->syncword = 0xffe00000; | 2518 s->syncword = 0xffe00000; |
2519 else | 2519 else |
2520 s->syncword = 0xfff00000; | 2520 s->syncword = 0xfff00000; |
2572 OUT_INT decoded_buf[MPA_FRAME_SIZE * MPA_MAX_CHANNELS]; | 2572 OUT_INT decoded_buf[MPA_FRAME_SIZE * MPA_MAX_CHANNELS]; |
2573 OUT_INT *outptr, *bp; | 2573 OUT_INT *outptr, *bp; |
2574 int fsize; | 2574 int fsize; |
2575 int fr, i, j, n; | 2575 int fr, i, j, n; |
2576 int off = avctx->channels; | 2576 int off = avctx->channels; |
2577 const uint8_t *coff = chan_offset[s->chan_cfg]; | |
2578 | 2577 |
2579 len = buf_size; | 2578 len = buf_size; |
2580 | 2579 |
2581 *data_size = 0; | 2580 *data_size = 0; |
2582 // Discard too short frames | 2581 // Discard too short frames |
2605 len -= fsize; | 2604 len -= fsize; |
2606 | 2605 |
2607 if(s->frames > 1) { | 2606 if(s->frames > 1) { |
2608 n = m->avctx->frame_size*m->nb_channels; | 2607 n = m->avctx->frame_size*m->nb_channels; |
2609 /* interleave output data */ | 2608 /* interleave output data */ |
2610 bp = out_samples + coff[fr]; | 2609 bp = out_samples + s->coff[fr]; |
2611 if(m->nb_channels == 1) { | 2610 if(m->nb_channels == 1) { |
2612 for(j = 0; j < n; j++) { | 2611 for(j = 0; j < n; j++) { |
2613 *bp = decoded_buf[j]; | 2612 *bp = decoded_buf[j]; |
2614 bp += off; | 2613 bp += off; |
2615 } | 2614 } |