Mercurial > libavcodec.hg
comparison imc.c @ 6307:e0601aa8ebef libavcodec
IMC decoder always operates on 64-byte blocks
author | kostya |
---|---|
date | Sat, 02 Feb 2008 08:26:49 +0000 |
parents | dfdff1ca78a7 |
children | 195356fc7230 |
comparison
equal
deleted
inserted
replaced
6306:23c0704067f6 | 6307:e0601aa8ebef |
---|---|
39 #include "bitstream.h" | 39 #include "bitstream.h" |
40 #include "dsputil.h" | 40 #include "dsputil.h" |
41 | 41 |
42 #include "imcdata.h" | 42 #include "imcdata.h" |
43 | 43 |
44 #define IMC_BLOCK_SIZE 64 | |
44 #define IMC_FRAME_ID 0x21 | 45 #define IMC_FRAME_ID 0x21 |
45 #define BANDS 32 | 46 #define BANDS 32 |
46 #define COEFFS 256 | 47 #define COEFFS 256 |
47 | 48 |
48 typedef struct { | 49 typedef struct { |
635 int flag; | 636 int flag; |
636 int bits, summer; | 637 int bits, summer; |
637 int counter, bitscount; | 638 int counter, bitscount; |
638 uint16_t *buf16 = (uint16_t *) buf; | 639 uint16_t *buf16 = (uint16_t *) buf; |
639 | 640 |
640 /* FIXME: input should not be modified */ | 641 for(i = 0; i < IMC_BLOCK_SIZE / 2; i++) |
641 for(i = 0; i < FFMIN(buf_size, avctx->block_align) / 2; i++) | |
642 buf16[i] = bswap_16(buf16[i]); | 642 buf16[i] = bswap_16(buf16[i]); |
643 | 643 |
644 init_get_bits(&q->gb, buf, 512); | 644 init_get_bits(&q->gb, buf, IMC_BLOCK_SIZE * 8); |
645 | 645 |
646 /* Check the frame header */ | 646 /* Check the frame header */ |
647 imc_hdr = get_bits(&q->gb, 9); | 647 imc_hdr = get_bits(&q->gb, 9); |
648 if (imc_hdr != IMC_FRAME_ID) { | 648 if (imc_hdr != IMC_FRAME_ID) { |
649 av_log(avctx, AV_LOG_ERROR, "imc frame header check failed!\n"); | 649 av_log(avctx, AV_LOG_ERROR, "imc frame header check failed!\n"); |
786 | 786 |
787 q->dsp.float_to_int16(data, q->out_samples, COEFFS); | 787 q->dsp.float_to_int16(data, q->out_samples, COEFFS); |
788 | 788 |
789 *data_size = COEFFS * sizeof(int16_t); | 789 *data_size = COEFFS * sizeof(int16_t); |
790 | 790 |
791 return avctx->block_align; | 791 return IMC_BLOCK_SIZE; |
792 } | 792 } |
793 | 793 |
794 | 794 |
795 static int imc_decode_close(AVCodecContext * avctx) | 795 static int imc_decode_close(AVCodecContext * avctx) |
796 { | 796 { |