Mercurial > libavcodec.hg
comparison adpcm.c @ 1695:2d11403fde4e libavcodec
initial predictors are not sent to the output in QT IMA; fix stereo QT
IMA decoding
author | melanson |
---|---|
date | Tue, 16 Dec 2003 01:17:58 +0000 |
parents | d29e96720e21 |
children | d39bb6945761 |
comparison
equal
deleted
inserted
replaced
1694:13169235c306 | 1695:2d11403fde4e |
---|---|
502 cs->step = step_table[cs->step_index]; | 502 cs->step = step_table[cs->step_index]; |
503 | 503 |
504 if (st && channel) | 504 if (st && channel) |
505 samples++; | 505 samples++; |
506 | 506 |
507 *samples++ = cs->predictor; | |
508 samples += st; | |
509 | |
510 for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */ | 507 for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */ |
511 *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F); | 508 *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F); |
512 samples += avctx->channels; | 509 samples += avctx->channels; |
513 *samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F); | 510 *samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F); |
514 samples += avctx->channels; | 511 samples += avctx->channels; |
515 src ++; | 512 src ++; |
516 } | 513 } |
517 | 514 |
518 if(st) { /* handle stereo interlacing */ | 515 if(st) { /* handle stereo interlacing */ |
519 c->channel = (channel + 1) % 2; /* we get one packet for left, then one for right data */ | 516 c->channel = (channel + 1) % 2; /* we get one packet for left, then one for right data */ |
520 if(channel == 0) { /* wait for the other packet before outputing anything */ | 517 if(channel == 1) { /* wait for the other packet before outputing anything */ |
521 *data_size = 0; | 518 *data_size = 0; |
522 return src - buf; | 519 return src - buf; |
523 } | 520 } |
524 } | 521 } |
525 break; | 522 break; |
581 } | 578 } |
582 c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; | 579 c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; |
583 if(st){ | 580 if(st){ |
584 c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; | 581 c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; |
585 } | 582 } |
586 // if (cs->step_index < 0) cs->step_index = 0; | 583 if (cs->step_index < 0) cs->step_index = 0; |
587 // if (cs->step_index > 88) cs->step_index = 88; | 584 if (cs->step_index > 88) cs->step_index = 88; |
588 | 585 |
589 m= (buf_size - (src - buf))>>st; | 586 m= (buf_size - (src - buf))>>st; |
590 //printf("%d %d %d %d\n", st, m, c->status[0].predictor, c->status[0].step_index); | |
591 //FIXME / XXX decode chanels individual & interleave samples | |
592 for(i=0; i<m; i++) { | 587 for(i=0; i<m; i++) { |
593 *samples++ = adpcm_4xa_expand_nibble(&c->status[0], src[i] & 0x0F); | 588 *samples++ = adpcm_4xa_expand_nibble(&c->status[0], src[i] & 0x0F); |
594 if (st) | 589 if (st) |
595 *samples++ = adpcm_4xa_expand_nibble(&c->status[1], src[i+m] & 0x0F); | 590 *samples++ = adpcm_4xa_expand_nibble(&c->status[1], src[i+m] & 0x0F); |
596 *samples++ = adpcm_4xa_expand_nibble(&c->status[0], src[i] >> 4); | 591 *samples++ = adpcm_4xa_expand_nibble(&c->status[0], src[i] >> 4); |