00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 typedef struct {
00025 uint8_t bai;
00026 uint8_t deltbae;
00027 int8_t deltba[50];
00028 } ba_t;
00029
00030 typedef struct {
00031 uint8_t exp[256];
00032 int8_t bap[256];
00033 } expbap_t;
00034
00035 struct a52_state_s {
00036 uint8_t fscod;
00037 uint8_t halfrate;
00038 uint8_t acmod;
00039 uint8_t lfeon;
00040 sample_t clev;
00041 sample_t slev;
00042
00043 int output;
00044 sample_t level;
00045 sample_t bias;
00046
00047 int dynrnge;
00048 sample_t dynrng;
00049 void * dynrngdata;
00050 sample_t (* dynrngcall) (sample_t range, void * dynrngdata);
00051
00052 uint8_t chincpl;
00053 uint8_t phsflginu;
00054 uint8_t cplstrtmant;
00055 uint8_t cplendmant;
00056 uint32_t cplbndstrc;
00057 sample_t cplco[5][18];
00058
00059
00060 uint8_t cplstrtbnd;
00061 uint8_t ncplbnd;
00062
00063 uint8_t rematflg;
00064
00065 uint8_t endmant[5];
00066
00067 uint16_t bai;
00068
00069 uint32_t * buffer_start;
00070 uint16_t lfsr_state;
00071 uint32_t bits_left;
00072 uint32_t current_word;
00073
00074 uint8_t csnroffst;
00075 ba_t cplba;
00076 ba_t ba[5];
00077 ba_t lfeba;
00078
00079 uint8_t cplfleak;
00080 uint8_t cplsleak;
00081
00082 expbap_t cpl_expbap;
00083 expbap_t fbw_expbap[5];
00084 expbap_t lfe_expbap;
00085
00086 sample_t * samples;
00087 int downmixed;
00088 };
00089
00090 #define LEVEL_PLUS6DB 2.0
00091 #define LEVEL_PLUS3DB 1.4142135623730951
00092 #define LEVEL_3DB 0.7071067811865476
00093 #define LEVEL_45DB 0.5946035575013605
00094 #define LEVEL_6DB 0.5
00095
00096 #define EXP_REUSE (0)
00097 #define EXP_D15 (1)
00098 #define EXP_D25 (2)
00099 #define EXP_D45 (3)
00100
00101 #define DELTA_BIT_REUSE (0)
00102 #define DELTA_BIT_NEW (1)
00103 #define DELTA_BIT_NONE (2)
00104 #define DELTA_BIT_RESERVED (3)
00105
00106 void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
00107 int start, int end, int fastleak, int slowleak,
00108 expbap_t * expbap);
00109
00110 int a52_downmix_init (int input, int flags, sample_t * level,
00111 sample_t clev, sample_t slev);
00112 int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
00113 sample_t clev, sample_t slev);
00114 void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
00115 sample_t clev, sample_t slev);
00116 void a52_upmix (sample_t * samples, int acmod, int output);
00117
00118 void a52_imdct_init (uint32_t mm_accel);
00119 void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias);
00120 void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias);