PandA-2024.02
Macros | Functions | Variables
adpcm.c File Reference
#include <stdio.h>
Include dependency graph for adpcm.c:

Go to the source code of this file.

Macros

#define SIZE   100
 
#define IN_END   100
 

Functions

int encode (int, int)
 
void decode (int)
 
int filtez (int *bpl, int *dlt)
 
void upzero (int dlt, int *dlti, int *bli)
 
int filtep (int rlt1, int al1, int rlt2, int al2)
 
int quantl (int el, int detl)
 
int logscl (int il, int nbl)
 
int scalel (int nbl, int shift_constant)
 
int uppol2 (int al1, int al2, int plt, int plt1, int plt2)
 
int uppol1 (int al1, int apl2, int plt, int plt1)
 
int logsch (int ih, int nbh)
 
void reset ()
 
int abs (int n)
 
void adpcm_main ()
 
int main ()
 

Variables

int tqmf [24]
 
const int h [24]
 
int xl
 
int xh
 
int accumc [11]
 
int accumd [11]
 
int xout1
 
int xout2
 
int xs
 
int xd
 
int il
 
int szl
 
int spl
 
int sl
 
int el
 
const int qq4_code4_table [16]
 
const int qq6_code6_table [64]
 
int delay_bpl [6]
 
int delay_dltx [6]
 
const int wl_code_table [16]
 
const int ilb_table [32]
 
int nbl
 
int al1
 
int al2
 
int plt
 
int plt1
 
int plt2
 
int dlt
 
int rlt
 
int rlt1
 
int rlt2
 
const int decis_levl [30]
 
int detl
 
const int quant26bt_pos [31]
 
const int quant26bt_neg [31]
 
int deth
 
int sh
 
int eh
 
const int qq2_code2_table [4]
 
const int wh_code_table [4]
 
int dh
 
int ih
 
int nbh
 
int szh
 
int sph
 
int ph
 
int yh
 
int rh
 
int delay_dhx [6]
 
int delay_bph [6]
 
int ah1
 
int ah2
 
int ph1
 
int ph2
 
int rh1
 
int rh2
 
int ilr
 
int rl
 
int dec_deth
 
int dec_detl
 
int dec_dlt
 
int dec_del_bpl [6]
 
int dec_del_dltx [6]
 
int dec_plt
 
int dec_plt1
 
int dec_plt2
 
int dec_szl
 
int dec_spl
 
int dec_sl
 
int dec_rlt1
 
int dec_rlt2
 
int dec_rlt
 
int dec_al1
 
int dec_al2
 
int dl
 
int dec_nbl
 
int dec_dh
 
int dec_nbh
 
int dec_del_bph [6]
 
int dec_del_dhx [6]
 
int dec_szh
 
int dec_rh1
 
int dec_rh2
 
int dec_ah1
 
int dec_ah2
 
int dec_ph
 
int dec_sph
 
int dec_sh
 
int dec_ph1
 
int dec_ph2
 
const int test_data [SIZE]
 
int compressed [SIZE]
 
int result [SIZE]
 
const int test_compressed [SIZE]
 
const int test_result [SIZE]
 

Macro Definition Documentation

◆ IN_END

#define IN_END   100

Definition at line 776 of file adpcm.c.

Referenced by adpcm_main(), and main().

◆ SIZE

#define SIZE   100

Definition at line 775 of file adpcm.c.

Function Documentation

◆ abs()

int abs ( int  n)

Definition at line 236 of file adpcm.c.

◆ adpcm_main()

void adpcm_main ( )

Definition at line 837 of file adpcm.c.

References compressed, decode(), encode(), IN_END, reset(), result, test_data, xout1, and xout2.

Here is the call graph for this function:

◆ decode()

void decode ( int  input)

◆ encode()

int encode ( int  xin1,
int  xin2 
)

Definition at line 248 of file adpcm.c.

References abs(), ah1, ah2, al1, al2, delay_bph, delay_bpl, delay_dhx, delay_dltx, deth, detl, dh, dlt, eh, el, filtep(), filtez(), h, ih, il, L, logsch(), logscl(), nbh, nbl, ph, ph1, ph2, plt, plt1, plt2, qq2_code2_table, qq4_code4_table, quantl(), rh1, rh2, rlt, rlt1, rlt2, scalel(), sh, sl, sph, spl, szh, szl, tqmf, uppol1(), uppol2(), upzero(), xh, xl, and yh.

Here is the call graph for this function:

◆ filtep()

int filtep ( int  rlt1,
int  al1,
int  rlt2,
int  al2 
)

Definition at line 596 of file adpcm.c.

References rlt1, and rlt2.

◆ filtez()

int filtez ( int *  bpl,
int *  dlt 
)

Definition at line 581 of file adpcm.c.

◆ logsch()

int logsch ( int  ih,
int  nbh 
)

Definition at line 754 of file adpcm.c.

References ih, L, and wh_code_table.

◆ logscl()

int logscl ( int  il,
int  nbl 
)

Definition at line 634 of file adpcm.c.

References L, and wl_code_table.

◆ main()

int main ( void  )

Definition at line 859 of file adpcm.c.

References adpcm_main(), compressed, IN_END, main_result, result, test_compressed, and test_result.

Here is the call graph for this function:

◆ quantl()

int quantl ( int  el,
int  detl 
)

Definition at line 608 of file adpcm.c.

References abs(), decis_levl, L, quant26bt_neg, and quant26bt_pos.

Here is the call graph for this function:

◆ reset()

void reset ( )

◆ scalel()

int scalel ( int  nbl,
int  shift_constant 
)

Definition at line 649 of file adpcm.c.

References ilb_table.

◆ uppol1()

int uppol1 ( int  al1,
int  apl2,
int  plt,
int  plt1 
)

Definition at line 728 of file adpcm.c.

References L.

◆ uppol2()

int uppol2 ( int  al1,
int  al2,
int  plt,
int  plt1,
int  plt2 
)

Definition at line 698 of file adpcm.c.

References L.

◆ upzero()

void upzero ( int  dlt,
int *  dlti,
int *  bli 
)

Definition at line 662 of file adpcm.c.

References dlt, and L.

Variable Documentation

◆ accumc

int accumc[11]

Definition at line 96 of file adpcm.c.

◆ accumd

int accumd[11]

Definition at line 96 of file adpcm.c.

◆ ah1

int ah1

Definition at line 196 of file adpcm.c.

◆ ah2

int ah2

Definition at line 196 of file adpcm.c.

◆ al1

int al1

Definition at line 141 of file adpcm.c.

◆ al2

int al2

Definition at line 141 of file adpcm.c.

◆ compressed

int compressed[SIZE]

Definition at line 800 of file adpcm.c.

◆ dec_ah1

int dec_ah1

Definition at line 223 of file adpcm.c.

◆ dec_ah2

int dec_ah2

Definition at line 223 of file adpcm.c.

◆ dec_al1

int dec_al1

Definition at line 211 of file adpcm.c.

◆ dec_al2

int dec_al2

Definition at line 211 of file adpcm.c.

◆ dec_del_bph

int dec_del_bph[6]

Definition at line 216 of file adpcm.c.

◆ dec_del_bpl

int dec_del_bpl[6]

Definition at line 204 of file adpcm.c.

◆ dec_del_dhx

int dec_del_dhx[6]

Definition at line 218 of file adpcm.c.

◆ dec_del_dltx

int dec_del_dltx[6]

Definition at line 206 of file adpcm.c.

◆ dec_deth

int dec_deth

Definition at line 202 of file adpcm.c.

◆ dec_detl

int dec_detl

Definition at line 202 of file adpcm.c.

◆ dec_dh

int dec_dh

Definition at line 213 of file adpcm.c.

◆ dec_dlt

int dec_dlt

Definition at line 202 of file adpcm.c.

◆ dec_nbh

int dec_nbh

Definition at line 213 of file adpcm.c.

◆ dec_nbl

int dec_nbl

Definition at line 213 of file adpcm.c.

◆ dec_ph

int dec_ph

Definition at line 224 of file adpcm.c.

◆ dec_ph1

int dec_ph1

Definition at line 228 of file adpcm.c.

◆ dec_ph2

int dec_ph2

Definition at line 228 of file adpcm.c.

◆ dec_plt

int dec_plt

Definition at line 208 of file adpcm.c.

◆ dec_plt1

int dec_plt1

Definition at line 208 of file adpcm.c.

◆ dec_plt2

int dec_plt2

Definition at line 208 of file adpcm.c.

◆ dec_rh1

int dec_rh1

Definition at line 222 of file adpcm.c.

◆ dec_rh2

int dec_rh2

Definition at line 222 of file adpcm.c.

◆ dec_rlt

int dec_rlt

Definition at line 210 of file adpcm.c.

◆ dec_rlt1

int dec_rlt1

Definition at line 210 of file adpcm.c.

◆ dec_rlt2

int dec_rlt2

Definition at line 210 of file adpcm.c.

◆ dec_sh

int dec_sh

Definition at line 226 of file adpcm.c.

◆ dec_sl

int dec_sl

Definition at line 209 of file adpcm.c.

◆ dec_sph

int dec_sph

Definition at line 224 of file adpcm.c.

◆ dec_spl

int dec_spl

Definition at line 209 of file adpcm.c.

◆ dec_szh

int dec_szh

Definition at line 220 of file adpcm.c.

◆ dec_szl

int dec_szl

Definition at line 209 of file adpcm.c.

◆ decis_levl

const int decis_levl[30]
Initial value:
= {
280, 576, 880, 1200, 1520, 1864, 2208, 2584,
2960, 3376, 3784, 4240, 4696, 5200, 5712, 6288,
6864, 7520, 8184, 8968, 9752, 10712, 11664, 12896,
14120, 15840, 17560, 20456, 23352, 32767
}

Definition at line 147 of file adpcm.c.

◆ delay_bph

int delay_bph[6]

Definition at line 194 of file adpcm.c.

◆ delay_bpl

int delay_bpl[6]

Definition at line 124 of file adpcm.c.

◆ delay_dhx

int delay_dhx[6]

Definition at line 192 of file adpcm.c.

◆ delay_dltx

int delay_dltx[6]

Definition at line 126 of file adpcm.c.

◆ deth

int deth

Definition at line 175 of file adpcm.c.

◆ detl

int detl

Definition at line 154 of file adpcm.c.

◆ dh

int dh

Definition at line 188 of file adpcm.c.

◆ dl

int dl

Definition at line 212 of file adpcm.c.

◆ dlt

int dlt

Definition at line 143 of file adpcm.c.

◆ eh

int eh

Definition at line 177 of file adpcm.c.

◆ el

int el

Definition at line 105 of file adpcm.c.

◆ h

const int h[24]
Initial value:
= {
12, -44, -44, 212, 48, -624, 128, 1448,
-840, -3220, 3804, 15504, 15504, 3804, -3220, -840,
1448, 128, -624, 48, 212, -44, -44, 12
}

Definition at line 87 of file adpcm.c.

◆ ih

int ih

Definition at line 188 of file adpcm.c.

◆ il

int il

Definition at line 105 of file adpcm.c.

◆ ilb_table

const int ilb_table[32]
Initial value:
= {
2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383,
2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834,
2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371,
3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008
}

Definition at line 133 of file adpcm.c.

◆ ilr

int ilr

Definition at line 201 of file adpcm.c.

◆ nbh

int nbh

Definition at line 189 of file adpcm.c.

◆ nbl

int nbl

Definition at line 140 of file adpcm.c.

◆ ph

int ph

Definition at line 190 of file adpcm.c.

◆ ph1

int ph1

Definition at line 197 of file adpcm.c.

◆ ph2

int ph2

Definition at line 197 of file adpcm.c.

◆ plt

int plt

Definition at line 142 of file adpcm.c.

◆ plt1

int plt1

Definition at line 142 of file adpcm.c.

◆ plt2

int plt2

Definition at line 142 of file adpcm.c.

◆ qq2_code2_table

const int qq2_code2_table[4]
Initial value:
= {
-7408, -1616, 7408, 1616
}

Definition at line 179 of file adpcm.c.

◆ qq4_code4_table

const int qq4_code4_table[16]
Initial value:
= {
0, -20456, -12896, -8968, -6288, -4240, -2584, -1200,
20456, 12896, 8968, 6288, 4240, 2584, 1200, 0
}

Definition at line 107 of file adpcm.c.

◆ qq6_code6_table

const int qq6_code6_table[64]
Initial value:
= {
-136, -136, -136, -136, -24808, -21904, -19008, -16704,
-14984, -13512, -12280, -11192, -10232, -9360, -8576, -7856,
-7192, -6576, -6000, -5456, -4944, -4464, -4008, -3576,
-3168, -2776, -2400, -2032, -1688, -1360, -1040, -728,
24808, 21904, 19008, 16704, 14984, 13512, 12280, 11192,
10232, 9360, 8576, 7856, 7192, 6576, 6000, 5456,
4944, 4464, 4008, 3576, 3168, 2776, 2400, 2032,
1688, 1360, 1040, 728, 432, 136, -432, -136
}

Definition at line 113 of file adpcm.c.

◆ quant26bt_neg

const int quant26bt_neg[31]
Initial value:
= {
63, 62, 31, 30, 29, 28, 27, 26,
25, 24, 23, 22, 21, 20, 19, 18,
17, 16, 15, 14, 13, 12, 11, 10,
9, 8, 7, 6, 5, 4, 4
}

Definition at line 167 of file adpcm.c.

◆ quant26bt_pos

const int quant26bt_pos[31]
Initial value:
= {
61, 60, 59, 58, 57, 56, 55, 54,
53, 52, 51, 50, 49, 48, 47, 46,
45, 44, 43, 42, 41, 40, 39, 38,
37, 36, 35, 34, 33, 32, 32
}

Definition at line 158 of file adpcm.c.

◆ result

int result[SIZE]

Definition at line 800 of file adpcm.c.

◆ rh

int rh

Definition at line 190 of file adpcm.c.

◆ rh1

int rh1

Definition at line 198 of file adpcm.c.

◆ rh2

int rh2

Definition at line 198 of file adpcm.c.

◆ rl

int rl

Definition at line 201 of file adpcm.c.

◆ rlt

int rlt

Definition at line 144 of file adpcm.c.

◆ rlt1

int rlt1

Definition at line 144 of file adpcm.c.

◆ rlt2

int rlt2

Definition at line 144 of file adpcm.c.

◆ sh

int sh

Definition at line 176 of file adpcm.c.

◆ sl

int sl

Definition at line 105 of file adpcm.c.

◆ sph

int sph

Definition at line 190 of file adpcm.c.

◆ spl

int spl

Definition at line 105 of file adpcm.c.

◆ szh

int szh

Definition at line 189 of file adpcm.c.

◆ szl

int szl

Definition at line 105 of file adpcm.c.

◆ test_compressed

const int test_compressed[SIZE]
Initial value:
= {
0xfd, 0xde, 0x77, 0xba, 0xf2,
0x90, 0x20, 0xa0, 0xec, 0xed,
0xef, 0xf1, 0xf3, 0xf4, 0xf5,
0xf5, 0xf5, 0xf5, 0xf6, 0xf6,
0xf6, 0xf7, 0xf8, 0xf7, 0xf8,
0xf7, 0xf9, 0xf8, 0xf7, 0xf9,
0xf8, 0xf8, 0xf6, 0xf8, 0xf8,
0xf7, 0xf9, 0xf9, 0xf9, 0xf8,
0xf7, 0xfa, 0xf8, 0xf8, 0xf7,
0xfb, 0xfa, 0xf9, 0xf8, 0xf8
}

Definition at line 801 of file adpcm.c.

◆ test_data

const int test_data[SIZE]
Initial value:
= {
0x44, 0x44, 0x44, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44, 0x44,
0x44, 0x44, 0x43, 0x43, 0x43,
0x43, 0x43, 0x43, 0x43, 0x42,
0x42, 0x42, 0x42, 0x42, 0x42,
0x41, 0x41, 0x41, 0x41, 0x41,
0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x40, 0x3f, 0x3f,
0x3f, 0x3f, 0x3f, 0x3e, 0x3e,
0x3e, 0x3e, 0x3e, 0x3e, 0x3d,
0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
0x3c, 0x3c, 0x3c, 0x3c, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3c, 0x3c, 0x3c,
0x3c, 0x3c, 0x3c, 0x3c, 0x3c
}

Definition at line 778 of file adpcm.c.

◆ test_result

const int test_result[SIZE]
Initial value:
= {
0, 0xffffffff, 0xffffffff, 0, 0,
0xffffffff, 0, 0, 0xffffffff, 0xffffffff,
0, 0, 0x1, 0x1, 0,
0xfffffffe, 0xffffffff, 0xfffffffe, 0, 0xfffffffc,
0x1, 0x1, 0x1, 0xfffffffb, 0x2,
0x2, 0x3, 0xb, 0x14, 0x14,
0x16, 0x18, 0x20, 0x21, 0x26,
0x27, 0x2e, 0x2f, 0x33, 0x32,
0x35, 0x33, 0x36, 0x34, 0x37,
0x34, 0x37, 0x35, 0x38, 0x36,
0x39, 0x38, 0x3b, 0x3a, 0x3f,
0x3f, 0x40, 0x3a, 0x3d, 0x3e,
0x41, 0x3c, 0x3e, 0x3f, 0x42,
0x3e, 0x3b, 0x37, 0x3b, 0x3e,
0x41, 0x3b, 0x3b, 0x3a, 0x3b,
0x36, 0x39, 0x3b, 0x3f, 0x3c,
0x3b, 0x37, 0x3b, 0x3d, 0x41,
0x3d, 0x3e, 0x3c, 0x3e, 0x3b,
0x3a, 0x37, 0x3b, 0x3e, 0x41,
0x3c, 0x3b, 0x39, 0x3a, 0x36
}

Definition at line 813 of file adpcm.c.

◆ tqmf

int tqmf[24]

Definition at line 83 of file adpcm.c.

◆ wh_code_table

const int wh_code_table[4]
Initial value:
= {
798, -214, 798, -214
}

Definition at line 183 of file adpcm.c.

◆ wl_code_table

const int wl_code_table[16]
Initial value:
= {
-60, 3042, 1198, 538, 334, 172, 58, -30,
3042, 1198, 538, 334, 172, 58, -30, -60
}

Definition at line 128 of file adpcm.c.

◆ xd

int xd

Definition at line 101 of file adpcm.c.

◆ xh

int xh

Definition at line 93 of file adpcm.c.

◆ xl

int xl

Definition at line 93 of file adpcm.c.

◆ xout1

int xout1

Definition at line 99 of file adpcm.c.

◆ xout2

int xout2

Definition at line 99 of file adpcm.c.

◆ xs

int xs

Definition at line 101 of file adpcm.c.

◆ yh

int yh

Definition at line 190 of file adpcm.c.


Generated on Mon Feb 12 2024 13:03:01 for PandA-2024.02 by doxygen 1.8.13