formats: clarify setting of reverse_bytes
[sox.git] / src / amr-wb.c
blob7824f6721cece32d7a7d0d385acbcd7e7008c481
1 /* File format: AMR-WB (c) 2007 robs@users.sourceforge.net
3 * This library is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU Lesser General Public License as published by
5 * the Free Software Foundation; either version 2.1 of the License, or (at
6 * your option) any later version.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
11 * General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * In order to use the AMR format with SoX, you need to have an
20 * AMR library installed at SoX build time. The SoX build system
21 * recognizes the AMR implementations available from
22 * http://opencore-amr.sourceforge.net/
25 #include "sox_i.h"
27 /* Common definitions: */
29 static const uint8_t amrwb_block_size[] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
30 static char const amrwb_magic[] = "#!AMR-WB\n";
31 #define amr_block_size amrwb_block_size
32 #define amr_magic amrwb_magic
33 #define amr_priv_t amrwb_priv_t
34 #define amr_opencore_funcs amrwb_opencore_funcs
35 #define amr_vo_funcs amrwb_vo_funcs
37 #define AMR_CODED_MAX 61 /* NB_SERIAL_MAX */
38 #define AMR_ENCODING SOX_ENCODING_AMR_WB
39 #define AMR_FORMAT_FN lsx_amr_wb_format_fn
40 #define AMR_FRAME 320 /* L_FRAME16k */
41 #define AMR_MODE_MAX 8
42 #define AMR_NAMES "amr-wb", "awb"
43 #define AMR_RATE 16000
44 #define AMR_DESC "3GPP Adaptive Multi Rate Wide-Band (AMR-WB) lossy speech compressor"
46 /* OpenCore definitions: */
48 #ifdef DL_OPENCORE_AMRWB
49 #define AMR_OC_FUNC LSX_DLENTRY_DYNAMIC
50 #else
51 #define AMR_OC_FUNC LSX_DLENTRY_STATIC
52 #endif
54 #if defined(HAVE_OPENCORE_AMRWB_DEC_IF_H) || defined(DL_OPENCORE_AMRWB)
55 #define AMR_OPENCORE 1
56 #define AMR_OPENCORE_ENABLE_ENCODE 0
57 #endif
59 #define AMR_OPENCORE_FUNC_ENTRIES(f,x) \
60 AMR_OC_FUNC(f,x, void*, D_IF_init, (void)) \
61 AMR_OC_FUNC(f,x, void, D_IF_decode, (void* state, const unsigned char* in, short* out, int bfi)) \
62 AMR_OC_FUNC(f,x, void, D_IF_exit, (void* state)) \
64 #define AmrDecoderInit() \
65 D_IF_init()
66 #define AmrDecoderDecode(state, in, out, bfi) \
67 D_IF_decode(state, in, out, bfi)
68 #define AmrDecoderExit(state) \
69 D_IF_exit(state)
71 #define AMR_OPENCORE_DESC "amr-wb OpenCore library"
72 static const char* const amr_opencore_library_names[] =
74 #ifdef DL_OPENCORE_AMRWB
75 "libopencore-amrwb",
76 "libopencore-amrwb-0",
77 #endif
78 NULL
81 /* VO definitions: */
83 #ifdef DL_VO_AMRWBENC
84 #define AMR_VO_FUNC LSX_DLENTRY_DYNAMIC
85 #else
86 #define AMR_VO_FUNC LSX_DLENTRY_STATIC
87 #endif
89 #if defined(HAVE_VO_AMRWBENC_ENC_IF_H) || defined(DL_VO_AMRWBENC)
90 #define AMR_VO 1
91 #endif
93 #define AMR_VO_FUNC_ENTRIES(f,x) \
94 AMR_VO_FUNC(f,x, void*, E_IF_init, (void)) \
95 AMR_VO_FUNC(f,x, int, E_IF_encode,(void* state, int16_t mode, int16_t* in, uint8_t* out, int16_t dtx)) \
96 AMR_VO_FUNC(f,x, void, E_IF_exit, (void* state)) \
98 #define AmrEncoderInit() \
99 E_IF_init()
100 #define AmrEncoderEncode(state, mode, in, out, forceSpeech) \
101 E_IF_encode(state, mode, in, out, forceSpeech)
102 #define AmrEncoderExit(state) \
103 E_IF_exit(state)
105 #define AMR_VO_DESC "amr-wb VisualOn library"
106 static const char* const amr_vo_library_names[] =
108 #ifdef DL_VO_AMRWBENC
109 "libvo-amrwbenc",
110 "libvo-amrwbenc-0",
111 #endif
112 NULL
115 #include "amr.h"