wav: simplify extended fmt chunk handling [bug #198]
[sox.git] / src / adpcm.h
blobdb5cc6152196cf9c8061462f6886e07c3485e31a
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 extern void *lsx_ms_adpcm_alloc(unsigned chans);
34 /* lsx_ms_adpcm_block_expand_i() outputs interleaved samples into one output buffer */
35 extern const char *lsx_ms_adpcm_block_expand_i(
36 void *priv,
37 unsigned chans, /* total channels */
38 int nCoef,
39 const short *coef,
40 const unsigned char *ibuff,/* input buffer[blockAlign] */
41 SAMPL *obuff, /* output samples, n*chans */
42 int n /* samples to decode PER channel, REQUIRE n % 8 == 1 */
45 extern void lsx_ms_adpcm_block_mash_i(
46 unsigned chans, /* total channels */
47 const SAMPL *ip, /* ip[n*chans] is interleaved input samples */
48 int n, /* samples to encode PER channel, REQUIRE */
49 int *st, /* input/output steps, 16<=st[i] */
50 unsigned char *obuff, /* output buffer[blockAlign] */
51 int blockAlign /* >= 7*chans + n/2 */
54 /* Some helper functions for computing samples/block and blockalign */
57 * lsx_ms_adpcm_samples_in(dataLen, chans, blockAlign, samplesPerBlock)
58 * returns the number of samples/channel which would be
59 * in the dataLen, given the other parameters ...
60 * if input samplesPerBlock is 0, then returns the max
61 * samplesPerBlock which would go into a block of size blockAlign
62 * Yes, it is confusing usage.
64 extern size_t lsx_ms_adpcm_samples_in(
65 size_t dataLen,
66 size_t chans,
67 size_t blockAlign,
68 size_t samplesPerBlock
72 * size_t lsx_ms_adpcm_bytes_per_block(chans, samplesPerBlock)
73 * return minimum blocksize which would be required
74 * to encode number of chans with given samplesPerBlock
76 extern size_t lsx_ms_adpcm_bytes_per_block(
77 size_t chans,
78 size_t samplesPerBlock