Mercurial > libavcodec.hg
comparison adpcm.c @ 6677:abb1f01ca0db libavcodec
remove ima qt decoding hack, decode whole frame at once
author | bcoudurier |
---|---|
date | Fri, 25 Apr 2008 15:09:26 +0000 |
parents | 36d091f338ca |
children | 92a91e7e7321 |
comparison
equal
deleted
inserted
replaced
6676:36d091f338ca | 6677:abb1f01ca0db |
---|---|
919 | 919 |
920 st = avctx->channels == 2 ? 1 : 0; | 920 st = avctx->channels == 2 ? 1 : 0; |
921 | 921 |
922 switch(avctx->codec->id) { | 922 switch(avctx->codec->id) { |
923 case CODEC_ID_ADPCM_IMA_QT: | 923 case CODEC_ID_ADPCM_IMA_QT: |
924 n = (buf_size - 2);/* >> 2*avctx->channels;*/ | 924 n = buf_size - 2*avctx->channels; |
925 channel = c->channel; | 925 for (channel = 0; channel < avctx->channels; channel++) { |
926 cs = &(c->status[channel]); | 926 cs = &(c->status[channel]); |
927 /* (pppppp) (piiiiiii) */ | 927 /* (pppppp) (piiiiiii) */ |
928 | 928 |
929 /* Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value */ | 929 /* Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value */ |
930 cs->predictor = (*src++) << 8; | 930 cs->predictor = (*src++) << 8; |
944 cs->step_index = 88; | 944 cs->step_index = 88; |
945 } | 945 } |
946 | 946 |
947 cs->step = step_table[cs->step_index]; | 947 cs->step = step_table[cs->step_index]; |
948 | 948 |
949 if (st && channel) | 949 samples = (short*)data + channel; |
950 samples++; | |
951 | 950 |
952 for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */ | 951 for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */ |
953 *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3); | 952 *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3); |
954 samples += avctx->channels; | 953 samples += avctx->channels; |
955 *samples = adpcm_ima_expand_nibble(cs, src[0] >> 4 , 3); | 954 *samples = adpcm_ima_expand_nibble(cs, src[0] >> 4 , 3); |
956 samples += avctx->channels; | 955 samples += avctx->channels; |
957 src ++; | 956 src ++; |
958 } | 957 } |
959 | 958 } |
960 if(st) { /* handle stereo interlacing */ | 959 if (st) |
961 c->channel = (channel + 1) % 2; /* we get one packet for left, then one for right data */ | |
962 if(!channel) { /* wait for the other packet before outputing anything */ | |
963 return src - buf; | |
964 } | |
965 samples--; | 960 samples--; |
966 } | |
967 break; | 961 break; |
968 case CODEC_ID_ADPCM_IMA_WAV: | 962 case CODEC_ID_ADPCM_IMA_WAV: |
969 if (avctx->block_align != 0 && buf_size > avctx->block_align) | 963 if (avctx->block_align != 0 && buf_size > avctx->block_align) |
970 buf_size = avctx->block_align; | 964 buf_size = avctx->block_align; |
971 | 965 |