comparison liba52/a52.h @ 18720:4bad7f00556e

sync with liba52 0.7.4, patch by Emanuele Giaquinta >emanuele.giaquinta ! gmail * com< part 1: functional changes
author rathann
date Thu, 15 Jun 2006 22:58:06 +0000
parents 07f1e7669772
children 0783dd397f74
comparison
equal deleted inserted replaced
18719:5d01eb066fa3 18720:4bad7f00556e
1 /* 1 /*
2 * a52.h 2 * a52.h
3 * Copyright (C) 2000-2001 Michel Lespinasse <walken@zoy.org> 3 * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> 4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
5 * 5 *
6 * This file is part of a52dec, a free ATSC A-52 stream decoder. 6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
7 * See http://liba52.sourceforge.net/ for updates. 7 * See http://liba52.sourceforge.net/ for updates.
8 * 8 *
32 typedef float sample_t; 32 typedef float sample_t;
33 #else 33 #else
34 typedef double sample_t; 34 typedef double sample_t;
35 #endif 35 #endif
36 36
37 typedef struct a52_ba_s { 37 typedef struct a52_state_s a52_state_t;
38 uint16_t fsnroffst; /* fine SNR offset */
39 uint16_t fgaincod; /* fast gain */
40 uint16_t deltbae; /* delta bit allocation exists */
41 int8_t deltba[50]; /* per-band delta bit allocation */
42 } a52_ba_t;
43
44 typedef struct a52_state_s {
45 uint8_t fscod; /* sample rate */
46 uint8_t halfrate; /* halfrate factor */
47 uint8_t acmod; /* coded channels */
48 sample_t clev; /* centre channel mix level */
49 sample_t slev; /* surround channels mix level */
50 uint8_t lfeon; /* coded lfe channel */
51
52 int output; /* type of output */
53 sample_t level; /* output level */
54 sample_t bias; /* output bias */
55
56 int dynrnge; /* apply dynamic range */
57 sample_t dynrng; /* dynamic range */
58 void * dynrngdata; /* dynamic range callback funtion and data */
59 sample_t (* dynrngcall) (sample_t range, void * dynrngdata);
60
61 uint16_t cplinu; /* coupling in use */
62 uint16_t chincpl[5]; /* channel coupled */
63 uint16_t phsflginu; /* phase flags in use (stereo only) */
64 uint16_t cplbndstrc[18]; /* coupling band structure */
65 uint16_t cplstrtmant; /* coupling channel start mantissa */
66 uint16_t cplendmant; /* coupling channel end mantissa */
67 sample_t cplco[5][18]; /* coupling coordinates */
68
69 /* derived information */
70 uint16_t cplstrtbnd; /* coupling start band (for bit allocation) */
71 uint16_t ncplbnd; /* number of coupling bands */
72
73 uint16_t rematflg[4]; /* stereo rematrixing */
74
75 uint16_t endmant[5]; /* channel end mantissa */
76
77 uint8_t cpl_exp[256]; /* decoded coupling channel exponents */
78 uint8_t fbw_exp[5][256]; /* decoded channel exponents */
79 uint8_t lfe_exp[7]; /* decoded lfe channel exponents */
80
81 uint16_t sdcycod; /* slow decay */
82 uint16_t fdcycod; /* fast decay */
83 uint16_t sgaincod; /* slow gain */
84 uint16_t dbpbcod; /* dB per bit - encodes the dbknee value */
85 uint16_t floorcod; /* masking floor */
86
87 uint16_t csnroffst; /* coarse SNR offset */
88 a52_ba_t cplba; /* coupling bit allocation parameters */
89 a52_ba_t ba[5]; /* channel bit allocation parameters */
90 a52_ba_t lfeba; /* lfe bit allocation parameters */
91
92 uint16_t cplfleak; /* coupling fast leak init */
93 uint16_t cplsleak; /* coupling slow leak init */
94
95 /* derived bit allocation information */
96 int8_t fbw_bap[5][256];
97 int8_t cpl_bap[256];
98 int8_t lfe_bap[7];
99 } a52_state_t;
100 38
101 #define A52_CHANNEL 0 39 #define A52_CHANNEL 0
102 #define A52_MONO 1 40 #define A52_MONO 1
103 #define A52_STEREO 2 41 #define A52_STEREO 2
104 #define A52_3F 3 42 #define A52_3F 3
112 #define A52_CHANNEL_MASK 15 50 #define A52_CHANNEL_MASK 15
113 51
114 #define A52_LFE 16 52 #define A52_LFE 16
115 #define A52_ADJUST_LEVEL 32 53 #define A52_ADJUST_LEVEL 32
116 54
117 sample_t * a52_init (uint32_t mm_accel); 55 a52_state_t * a52_init (uint32_t mm_accel);
56 sample_t * a52_samples (a52_state_t * state);
118 int a52_syncinfo (uint8_t * buf, int * flags, 57 int a52_syncinfo (uint8_t * buf, int * flags,
119 int * sample_rate, int * bit_rate); 58 int * sample_rate, int * bit_rate);
120 int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, 59 int a52_frame (a52_state_t * state, uint8_t * buf, int * flags,
121 sample_t * level, sample_t bias); 60 sample_t * level, sample_t bias);
122 void a52_dynrng (a52_state_t * state, 61 void a52_dynrng (a52_state_t * state,
123 sample_t (* call) (sample_t, void *), void * data); 62 sample_t (* call) (sample_t, void *), void * data);
124 int a52_block (a52_state_t * state, sample_t * samples); 63 int a52_block (a52_state_t * state);
64 void a52_free (a52_state_t * state);
125 65
126 void* a52_resample_init(uint32_t mm_accel,int flags,int chans); 66 void* a52_resample_init(uint32_t mm_accel,int flags,int chans);
127 extern int (* a52_resample) (float * _f, int16_t * s16); 67 extern int (* a52_resample) (float * _f, int16_t * s16);
128 68
129 uint16_t crc16_block(uint8_t *data,uint32_t num_bytes); 69 uint16_t crc16_block(uint8_t *data,uint32_t num_bytes);