16f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin/*
26f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
36f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *
46f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *  Use of this source code is governed by a BSD-style license
56f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *  that can be found in the LICENSE file in the root of the source
66f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *  tree. An additional intellectual property rights grant can be found
76f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *  in the file PATENTS.  All contributing project authors may
86f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *  be found in the AUTHORS file in the root of the source tree.
96f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin */
106f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
116f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin/*
126f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin * arith_routines.h
136f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *
146f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin * Functions for arithmetic coding.
156f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin *
166f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin */
176f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
186f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_
196f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_
206f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
216f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin#include "structs.h"
226f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
236f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
246f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkinint WebRtcIsac_EncLogisticMulti2(
256f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    Bitstr *streamdata,              /* in-/output struct containing bitstream */
266f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    WebRtc_Word16 *dataQ7,           /* input: data vector */
276f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_UWord16 *env,       /* input: side info vector defining the width of the pdf */
286f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const int N,                     /* input: data vector length */
296f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_Word16 isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
306f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
316f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin/* returns the number of bytes in the stream */
326f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkinint WebRtcIsac_EncTerminate(Bitstr *streamdata); /* in-/output struct containing bitstream */
336f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
346f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin/* returns the number of bytes in the stream so far */
356f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkinint WebRtcIsac_DecLogisticMulti2(
366f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    WebRtc_Word16 *data,             /* output: data vector */
376f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    Bitstr *streamdata,              /* in-/output struct containing bitstream */
386f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_UWord16 *env,       /* input: side info vector defining the width of the pdf */
396f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_Word16 *dither,     /* input: dither vector */
406f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const int N,                     /* input: data vector length */
416f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_Word16 isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
426f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
436f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkinvoid WebRtcIsac_EncHistMulti(
446f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    Bitstr *streamdata,         /* in-/output struct containing bitstream */
456f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const int *data,            /* input: data vector */
466f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
476f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const int N);               /* input: data vector length */
486f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
496f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkinint WebRtcIsac_DecHistBisectMulti(
506f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    int *data,                      /* output: data vector */
516f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    Bitstr *streamdata,             /* in-/output struct containing bitstream */
526f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_UWord16 **cdf,     /* input: array of cdf arrays */
536f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_UWord16 *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
546f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const int N);                   /* input: data vector length */
556f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
566f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkinint WebRtcIsac_DecHistOneStepMulti(
576f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    int *data,                       /* output: data vector */
586f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    Bitstr *streamdata,              /* in-/output struct containing bitstream */
596f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_UWord16 **cdf,      /* input: array of cdf arrays */
606f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const WebRtc_UWord16 *init_index,/* input: vector of initial cdf table search entries */
616f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin    const int N);                    /* input: data vector length */
626f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin
636f12fff925188ced26e518cd2252aff3e93bb04eAlexander Gutkin#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_ */
64