Commit 6acc72a5 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Update state structure name while retaining API and ABI compatibility

parent 261a795c
......@@ -25,7 +25,7 @@ DTS_LFE : Low frequency effects channel. Normally used to connect a
Initialization
--------------
dts_state_t * dts_init (uint32_t mm_accel);
dca_state_t * dts_init (uint32_t mm_accel);
Initializes the DTS library. Takes as a parameter the acceptable
optimizations which may be used, such as MMX. These are found in the
......@@ -75,7 +75,7 @@ well detect the kind of bitstream it is dealing with (big/little endian,
Starting to decode a frame
--------------------------
int dts_frame (dts_state_t * state, uint8_t * buf, int * flags,
int dts_frame (dca_state_t * state, uint8_t * buf, int * flags,
sample_t * level, sample_t bias);
This starts the work of decoding the DTS frame (to be completed using
......@@ -139,7 +139,7 @@ reused next when decoding blocks.
Dynamic range compression
-------------------------
void dts_dynrng (dts_state_t * state,
void dts_dynrng (dca_state_t * state,
sample_t (* call) (sample_t, void *), void * data);
This function is purely optional. If you dont call it, libdts will
......@@ -167,7 +167,7 @@ if this is what you want.
Finding the number of blocks
----------------------------
int dts_blocks_num (dts_state_t * state);
int dts_blocks_num (dca_state_t * state);
Every DTS frame is composed of a variable number of blocks. Calling
dts_blocks_num() after dts_frame() will give you the number of blocks in the
......@@ -176,7 +176,7 @@ current frame.
Decoding blocks
---------------
int dts_block (dts_state_t * state);
int dts_block (dca_state_t * state);
Every DTS frame is composed of a variable number of blocks, each with an
output of 256 samples for each channel. The dts_block() function decodes
......@@ -186,7 +186,7 @@ decode all of the audio in the frame.
Getting the decoded audio samples
---------------------------------
sample_t * dts_samples (dts_state_t * state);
sample_t * dts_samples (dca_state_t * state);
After each call to dts_block(), you should extract the audio data from the
internal samples buffer.
......@@ -203,7 +203,7 @@ libdts does not leave an empty space between channels.
Pseudocode example
------------------
dts_state_t * state = dts_init (mm_accel());
dca_state_t * state = dts_init (mm_accel());
loop on input bytes:
if at least 14 bytes in the buffer:
......
......@@ -41,7 +41,7 @@ typedef float sample_t;
typedef float level_t;
#endif
typedef struct dts_state_s dts_state_t;
typedef struct dca_state_s dca_state_t;
#define DTS_MONO 0
#define DTS_CHANNEL 1
......@@ -64,22 +64,22 @@ typedef struct dts_state_s dts_state_t;
#define DTS_LFE 0x80
#define DTS_ADJUST_LEVEL 0x100
dts_state_t * dts_init (uint32_t mm_accel);
dca_state_t * dts_init (uint32_t mm_accel);
int dts_syncinfo (dts_state_t *state, uint8_t * buf, int * flags,
int dts_syncinfo (dca_state_t *state, uint8_t * buf, int * flags,
int * sample_rate, int * bit_rate, int *frame_length);
int dts_frame (dts_state_t * state, uint8_t * buf, int * flags,
int dts_frame (dca_state_t * state, uint8_t * buf, int * flags,
level_t * level, sample_t bias);
void dts_dynrng (dts_state_t * state,
void dts_dynrng (dca_state_t * state,
level_t (* call) (level_t, void *), void * data);
int dts_blocks_num (dts_state_t * state);
int dts_block (dts_state_t * state);
int dts_blocks_num (dca_state_t * state);
int dts_block (dca_state_t * state);
sample_t * dts_samples (dts_state_t * state);
sample_t * dts_samples (dca_state_t * state);
void dts_free (dts_state_t * state);
void dts_free (dca_state_t * state);
#endif /* LIBDCA_DCA_H */
......@@ -21,3 +21,5 @@
*/
#include <dca.h>
typedef struct dca_state_s dts_state_t;
......@@ -32,7 +32,7 @@
#define BUFFER_SIZE 4096
void dts_bitstream_init (dts_state_t * state, uint8_t * buf, int word_mode,
void dts_bitstream_init (dca_state_t * state, uint8_t * buf, int word_mode,
int bigendian_mode)
{
intptr_t align;
......@@ -46,7 +46,7 @@ void dts_bitstream_init (dts_state_t * state, uint8_t * buf, int word_mode,
bitstream_get (state, align * 8);
}
#include<stdio.h>
static inline void bitstream_fill_current (dts_state_t * state)
static inline void bitstream_fill_current (dca_state_t * state)
{
uint32_t tmp;
......@@ -73,7 +73,7 @@ static inline void bitstream_fill_current (dts_state_t * state)
* -ah
*/
uint32_t dts_bitstream_get_bh (dts_state_t * state, uint32_t num_bits)
uint32_t dts_bitstream_get_bh (dca_state_t * state, uint32_t num_bits)
{
uint32_t result;
......
......@@ -47,11 +47,11 @@
#endif
void dts_bitstream_init (dts_state_t * state, uint8_t * buf, int word_mode,
void dts_bitstream_init (dca_state_t * state, uint8_t * buf, int word_mode,
int endian_mode);
uint32_t dts_bitstream_get_bh (dts_state_t * state, uint32_t num_bits);
uint32_t dts_bitstream_get_bh (dca_state_t * state, uint32_t num_bits);
static inline uint32_t bitstream_get (dts_state_t * state, uint32_t num_bits)
static inline uint32_t bitstream_get (dca_state_t * state, uint32_t num_bits)
{
uint32_t result;
......
......@@ -29,7 +29,7 @@
#define DTS_SUBSUBFAMES_MAX (4)
#define DTS_LFE_MAX (3)
struct dts_state_s {
struct dca_state_s {
/* Frame header */
int frame_type; /* type of the current frame */
......
......@@ -57,7 +57,7 @@ void * memalign (size_t align, size_t size);
static int decode_blockcode (int code, int levels, int *values);
static void qmf_32_subbands (dts_state_t * state, int chans,
static void qmf_32_subbands (dca_state_t * state, int chans,
double samples_in[32][8], sample_t *samples_out,
double rScale, sample_t bias);
......@@ -65,18 +65,18 @@ static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample,
double *samples_in, sample_t *samples_out,
double rScale, sample_t bias );
static void pre_calc_cosmod( dts_state_t * state );
static void pre_calc_cosmod( dca_state_t * state );
dts_state_t * dts_init (uint32_t mm_accel)
dca_state_t * dts_init (uint32_t mm_accel)
{
dts_state_t * state;
dca_state_t * state;
int i;
state = (dts_state_t *) malloc (sizeof (dts_state_t));
state = (dca_state_t *) malloc (sizeof (dca_state_t));
if (state == NULL)
return NULL;
memset (state, 0, sizeof(dts_state_t));
memset (state, 0, sizeof(dca_state_t));
state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t));
if (state->samples == NULL) {
......@@ -95,18 +95,18 @@ dts_state_t * dts_init (uint32_t mm_accel)
return state;
}
sample_t * dts_samples (dts_state_t * state)
sample_t * dts_samples (dca_state_t * state)
{
return state->samples;
}
int dts_blocks_num (dts_state_t * state)
int dts_blocks_num (dca_state_t * state)
{
/* 8 samples per subsubframe and per subband */
return state->sample_blocks / 8;
}
static int syncinfo (dts_state_t * state, int * flags,
static int syncinfo (dca_state_t * state, int * flags,
int * sample_rate, int * bit_rate, int * frame_length)
{
int frame_size;
......@@ -148,7 +148,7 @@ static int syncinfo (dts_state_t * state, int * flags,
return frame_size;
}
int dts_syncinfo (dts_state_t * state, uint8_t * buf, int * flags,
int dts_syncinfo (dca_state_t * state, uint8_t * buf, int * flags,
int * sample_rate, int * bit_rate, int * frame_length)
{
/*
......@@ -204,7 +204,7 @@ int dts_syncinfo (dts_state_t * state, uint8_t * buf, int * flags,
return 0;
}
int dts_frame (dts_state_t * state, uint8_t * buf, int * flags,
int dts_frame (dca_state_t * state, uint8_t * buf, int * flags,
level_t * level, sample_t bias)
{
int i, j;
......@@ -440,7 +440,7 @@ int dts_frame (dts_state_t * state, uint8_t * buf, int * flags,
return 0;
}
static int dts_subframe_header (dts_state_t * state)
static int dts_subframe_header (dca_state_t * state)
{
/* Primary audio coding side information */
int j, k;
......@@ -754,7 +754,7 @@ static int dts_subframe_header (dts_state_t * state)
return 0;
}
static int dts_subsubframe (dts_state_t * state)
static int dts_subsubframe (dca_state_t * state)
{
int k, l;
int subsubframe = state->current_subsubframe;
......@@ -1017,7 +1017,7 @@ static int dts_subsubframe (dts_state_t * state)
return 0;
}
static int dts_subframe_footer (dts_state_t * state)
static int dts_subframe_footer (dca_state_t * state)
{
int aux_data_count = 0, i;
int lfe_samples;
......@@ -1054,7 +1054,7 @@ static int dts_subframe_footer (dts_state_t * state)
return 0;
}
int dts_block (dts_state_t * state)
int dts_block (dca_state_t * state)
{
/* Sanity check */
if (state->current_subframe >= state->subframes)
......@@ -1120,7 +1120,7 @@ int decode_blockcode( int code, int levels, int *values )
}
}
static void pre_calc_cosmod( dts_state_t * state )
static void pre_calc_cosmod( dca_state_t * state )
{
int i, j, k;
......@@ -1139,7 +1139,7 @@ static void pre_calc_cosmod( dts_state_t * state )
state->cos_mod[j++] = -0.25/(2.0*sin((2*k+1)*M_PI/128));
}
static void qmf_32_subbands (dts_state_t * state, int chans,
static void qmf_32_subbands (dca_state_t * state, int chans,
double samples_in[32][8], sample_t *samples_out,
double scale, sample_t bias)
{
......@@ -1272,7 +1272,7 @@ static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample,
}
}
void dts_dynrng (dts_state_t * state,
void dts_dynrng (dca_state_t * state,
level_t (* call) (level_t, void *), void * data)
{
state->dynrange = 0;
......@@ -1283,7 +1283,7 @@ void dts_dynrng (dts_state_t * state,
}
}
void dts_free (dts_state_t * state)
void dts_free (dca_state_t * state)
{
free (state->samples);
free (state);
......
......@@ -1045,7 +1045,7 @@ huff_entry_t *bitalloc_select[11][8] =
bitalloc_e_129, bitalloc_f_129, bitalloc_g_129, 0 },
};
static int InverseQ( dts_state_t * state, huff_entry_t * huff )
static int InverseQ( dca_state_t * state, huff_entry_t * huff )
{
int value = 0;
int length = 0, j;
......
......@@ -54,7 +54,7 @@ static int disable_adjust = 0;
static float gain = 1;
static ao_open_t * output_open = NULL;
static ao_instance_t * output;
static dts_state_t * state;
static dca_state_t * state;
static int sigint = 0;
#ifdef HAVE_GETTIMEOFDAY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment