00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef AVCODEC_MLP_H
00023 #define AVCODEC_MLP_H
00024 
00025 #include <stdint.h>
00026 
00027 #include "avcodec.h"
00028 
00030 #define MAX_CHANNELS        16
00031 
00035 #define MAX_MATRICES        15
00036 
00040 #define MAX_SUBSTREAMS      2
00041 
00043 #define MAX_SAMPLERATE      192000
00044 
00046 #define MAX_BLOCKSIZE       (40 * (MAX_SAMPLERATE / 48000))
00047 
00048 #define MAX_BLOCKSIZE_POW2  (64 * (MAX_SAMPLERATE / 48000))
00049 
00051 #define NUM_FILTERS         2
00052 
00057 #define MAX_FILTER_ORDER    8
00058 
00060 #define END_OF_STREAM       0xd234d234
00061 
00062 #define FIR 0
00063 #define IIR 1
00064 
00066 typedef struct {
00067     uint8_t     order; 
00068     uint8_t     shift; 
00069 
00070     int32_t     coeff[MAX_FILTER_ORDER];
00071     int32_t     state[MAX_FILTER_ORDER];
00072 } FilterParams;
00073 
00075 typedef struct {
00076     FilterParams filter_params[NUM_FILTERS];
00077 
00078     int16_t     huff_offset;      
00079     int32_t     sign_huff_offset; 
00080     uint8_t     codebook;         
00081     uint8_t     huff_lsbs;        
00082 } ChannelParams;
00083 
00089 extern const uint8_t ff_mlp_huffman_tables[3][18][2];
00090 
00096 uint8_t  ff_mlp_checksum8 (const uint8_t *buf, unsigned int buf_size);
00097 uint16_t ff_mlp_checksum16(const uint8_t *buf, unsigned int buf_size);
00098 
00102 uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size);
00103 
00107 uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size);
00108 
00109 void ff_mlp_init_crc(void);
00110 
00112 static inline uint8_t xor_32_to_8(uint32_t value)
00113 {
00114     value ^= value >> 16;
00115     value ^= value >>  8;
00116     return value;
00117 }
00118 
00119 #endif