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 uint8_t csnroffst;
00070 ba_t cplba;
00071 ba_t ba[5];
00072 ba_t lfeba;
00073
00074 uint8_t cplfleak;
00075 uint8_t cplsleak;
00076
00077 expbap_t cpl_expbap;
00078 expbap_t fbw_expbap[5];
00079 expbap_t lfe_expbap;
00080
00081 sample_t * samples;
00082 int downmixed;
00083 };
00084
00085 #define LEVEL_PLUS6DB 2.0
00086 #define LEVEL_PLUS3DB 1.4142135623730951
00087 #define LEVEL_3DB 0.7071067811865476
00088 #define LEVEL_45DB 0.5946035575013605
00089 #define LEVEL_6DB 0.5
00090
00091 #define EXP_REUSE (0)
00092 #define EXP_D15 (1)
00093 #define EXP_D25 (2)
00094 #define EXP_D45 (3)
00095
00096 #define DELTA_BIT_REUSE (0)
00097 #define DELTA_BIT_NEW (1)
00098 #define DELTA_BIT_NONE (2)
00099 #define DELTA_BIT_RESERVED (3)
00100
00101 void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
00102 int start, int end, int fastleak, int slowleak,
00103 expbap_t * expbap);
00104
00105 int a52_downmix_init (int input, int flags, sample_t * level,
00106 sample_t clev, sample_t slev);
00107 int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
00108 sample_t clev, sample_t slev);
00109 void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
00110 sample_t clev, sample_t slev);
00111 void a52_upmix (sample_t * samples, int acmod, int output);
00112
00113 void a52_imdct_init (uint32_t mm_accel);
00114 void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias);
00115 void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias);