1/*
2 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11/*
12 * arith_routines.h
13 *
14 * Functions for arithmetic coding.
15 *
16 */
17
18#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_
19#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_
20
21#include "structs.h"
22
23
24int WebRtcIsac_EncLogisticMulti2(
25    Bitstr *streamdata,              /* in-/output struct containing bitstream */
26    int16_t *dataQ7,           /* input: data vector */
27    const uint16_t *env,       /* input: side info vector defining the width of the pdf */
28    const int N,                     /* input: data vector length */
29    const int16_t isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
30
31/* returns the number of bytes in the stream */
32int WebRtcIsac_EncTerminate(Bitstr *streamdata); /* in-/output struct containing bitstream */
33
34/* returns the number of bytes in the stream so far */
35int WebRtcIsac_DecLogisticMulti2(
36    int16_t *data,             /* output: data vector */
37    Bitstr *streamdata,              /* in-/output struct containing bitstream */
38    const uint16_t *env,       /* input: side info vector defining the width of the pdf */
39    const int16_t *dither,     /* input: dither vector */
40    const int N,                     /* input: data vector length */
41    const int16_t isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
42
43void WebRtcIsac_EncHistMulti(
44    Bitstr *streamdata,         /* in-/output struct containing bitstream */
45    const int *data,            /* input: data vector */
46    const uint16_t **cdf, /* input: array of cdf arrays */
47    const int N);               /* input: data vector length */
48
49int WebRtcIsac_DecHistBisectMulti(
50    int *data,                      /* output: data vector */
51    Bitstr *streamdata,             /* in-/output struct containing bitstream */
52    const uint16_t **cdf,     /* input: array of cdf arrays */
53    const uint16_t *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
54    const int N);                   /* input: data vector length */
55
56int WebRtcIsac_DecHistOneStepMulti(
57    int *data,                       /* output: data vector */
58    Bitstr *streamdata,              /* in-/output struct containing bitstream */
59    const uint16_t **cdf,      /* input: array of cdf arrays */
60    const uint16_t *init_index,/* input: vector of initial cdf table search entries */
61    const int N);                    /* input: data vector length */
62
63#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_ */
64