Merge branch 'mr/build' into pu
[sox/ew.git] / src / adpcm.h
blobaf4d6f08117d12df1a9dab6d24e1d9859ff49c57
1 /* adpcm.h codex functions for MS_ADPCM data
2 * (hopefully) provides interoperability with
3 * Microsoft's ADPCM format, but, as usual,
4 * see LACK-OF-WARRANTY information below.
6 * Copyright (C) 1999 Stanley J. Brooks <stabro@megsinet.net>
8 * This library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or (at
11 * your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
16 * General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "sox.h"
25 #ifndef SAMPL
26 #define SAMPL short
27 #endif
29 /* default coef sets */
30 extern const short lsx_ms_adpcm_i_coef[7][2];
32 /* lsx_ms_adpcm_block_expand_i() outputs interleaved samples into one output buffer */
33 extern const char *lsx_ms_adpcm_block_expand_i(
34 unsigned chans, /* total channels */
35 int nCoef,
36 const short *coef,
37 const unsigned char *ibuff,/* input buffer[blockAlign] */
38 SAMPL *obuff, /* output samples, n*chans */
39 int n /* samples to decode PER channel, REQUIRE n % 8 == 1 */
42 extern void lsx_ms_adpcm_block_mash_i(
43 unsigned chans, /* total channels */
44 const SAMPL *ip, /* ip[n*chans] is interleaved input samples */
45 int n, /* samples to encode PER channel, REQUIRE */
46 int *st, /* input/output steps, 16<=st[i] */
47 unsigned char *obuff, /* output buffer[blockAlign] */
48 int blockAlign /* >= 7*chans + n/2 */
51 /* Some helper functions for computing samples/block and blockalign */
54 * lsx_ms_adpcm_samples_in(dataLen, chans, blockAlign, samplesPerBlock)
55 * returns the number of samples/channel which would be
56 * in the dataLen, given the other parameters ...
57 * if input samplesPerBlock is 0, then returns the max
58 * samplesPerBlock which would go into a block of size blockAlign
59 * Yes, it is confusing usage.
61 extern size_t lsx_ms_adpcm_samples_in(
62 size_t dataLen,
63 size_t chans,
64 size_t blockAlign,
65 size_t samplesPerBlock
69 * size_t lsx_ms_adpcm_bytes_per_block(chans, samplesPerBlock)
70 * return minimum blocksize which would be required
71 * to encode number of chans with given samplesPerBlock
73 extern size_t lsx_ms_adpcm_bytes_per_block(
74 size_t chans,
75 size_t samplesPerBlock