1/*
2 ** Copyright 2003-2010, VisualOn, Inc.
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 **     http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16
17
18/*--------------------------------------------------------------------------*
19*                         BITS.H                                           *
20*--------------------------------------------------------------------------*
21*       Number of bits for different modes			           *
22*--------------------------------------------------------------------------*/
23
24#ifndef __BITS_H__
25#define __BITS_H__
26
27#include <stdio.h>
28#include "typedef.h"
29#include "cnst.h"
30#include "cod_main.h"
31
32#define NBBITS_7k     132                  /* 6.60k  */
33#define NBBITS_9k     177                  /* 8.85k  */
34#define NBBITS_12k    253                  /* 12.65k */
35#define NBBITS_14k    285                  /* 14.25k */
36#define NBBITS_16k    317                  /* 15.85k */
37#define NBBITS_18k    365                  /* 18.25k */
38#define NBBITS_20k    397                  /* 19.85k */
39#define NBBITS_23k    461                  /* 23.05k */
40#define NBBITS_24k    477                  /* 23.85k */
41
42#define NBBITS_SID    35
43#define NB_BITS_MAX   NBBITS_24k
44
45#define BIT_0     (Word16)-127
46#define BIT_1     (Word16)127
47#define BIT_0_ITU (Word16)0x007F
48#define BIT_1_ITU (Word16)0x0081
49
50#define SIZE_MAX1  (3+NB_BITS_MAX)          /* serial size max */
51#define TX_FRAME_TYPE (Word16)0x6b21
52#define RX_FRAME_TYPE (Word16)0x6b20
53
54static const Word16 nb_of_bits[NUM_OF_MODES] = {
55	NBBITS_7k,
56	NBBITS_9k,
57	NBBITS_12k,
58	NBBITS_14k,
59	NBBITS_16k,
60	NBBITS_18k,
61	NBBITS_20k,
62	NBBITS_23k,
63	NBBITS_24k,
64	NBBITS_SID
65};
66
67/*typedef struct
68{
69Word16 sid_update_counter;
70Word16 sid_handover_debt;
71Word16 prev_ft;
72} TX_State;
73*/
74
75//typedef struct
76//{
77//	Word16 prev_ft;
78//	Word16 prev_mode;
79//} RX_State;
80
81int PackBits(Word16 prms[], Word16 coding_mode, Word16 mode, Coder_State *st);
82
83
84void Parm_serial(
85		Word16 value,                         /* input : parameter value */
86		Word16 no_of_bits,                    /* input : number of bits  */
87		Word16 ** prms
88		);
89
90
91#endif  //__BITS_H__
92
93