bit_cnt.h revision 41050cdb033641ddf26831d9272c0930f7b40a2d
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	File:		bit_cnt.h
18
19	Content:	Huffman Bitcounter & coder structure and functions
20
21*******************************************************************************/
22
23#ifndef __BITCOUNT_H
24#define __BITCOUNT_H
25
26#include "bitbuffer.h"
27#include "basic_op.h"
28#define INVALID_BITCOUNT (MAX_16/4)
29
30/*
31  code book number table
32*/
33
34enum codeBookNo{
35  CODE_BOOK_ZERO_NO=               0,
36  CODE_BOOK_1_NO=                  1,
37  CODE_BOOK_2_NO=                  2,
38  CODE_BOOK_3_NO=                  3,
39  CODE_BOOK_4_NO=                  4,
40  CODE_BOOK_5_NO=                  5,
41  CODE_BOOK_6_NO=                  6,
42  CODE_BOOK_7_NO=                  7,
43  CODE_BOOK_8_NO=                  8,
44  CODE_BOOK_9_NO=                  9,
45  CODE_BOOK_10_NO=                10,
46  CODE_BOOK_ESC_NO=               11,
47  CODE_BOOK_RES_NO=               12,
48  CODE_BOOK_PNS_NO=               13
49};
50
51/*
52  code book index table
53*/
54
55enum codeBookNdx{
56  CODE_BOOK_ZERO_NDX=0,
57  CODE_BOOK_1_NDX,
58  CODE_BOOK_2_NDX,
59  CODE_BOOK_3_NDX,
60  CODE_BOOK_4_NDX,
61  CODE_BOOK_5_NDX,
62  CODE_BOOK_6_NDX,
63  CODE_BOOK_7_NDX,
64  CODE_BOOK_8_NDX,
65  CODE_BOOK_9_NDX,
66  CODE_BOOK_10_NDX,
67  CODE_BOOK_ESC_NDX,
68  CODE_BOOK_RES_NDX,
69  CODE_BOOK_PNS_NDX,
70  NUMBER_OF_CODE_BOOKS
71};
72
73/*
74  code book lav table
75*/
76
77enum codeBookLav{
78  CODE_BOOK_ZERO_LAV=0,
79  CODE_BOOK_1_LAV=1,
80  CODE_BOOK_2_LAV=1,
81  CODE_BOOK_3_LAV=2,
82  CODE_BOOK_4_LAV=2,
83  CODE_BOOK_5_LAV=4,
84  CODE_BOOK_6_LAV=4,
85  CODE_BOOK_7_LAV=7,
86  CODE_BOOK_8_LAV=7,
87  CODE_BOOK_9_LAV=12,
88  CODE_BOOK_10_LAV=12,
89  CODE_BOOK_ESC_LAV=16,
90  CODE_BOOK_SCF_LAV=60,
91  CODE_BOOK_PNS_LAV=60
92};
93
94Word16 bitCount(const Word16 *aQuantSpectrum,
95                const Word16  noOfSpecLines,
96                Word16        maxVal,
97                Word16       *bitCountLut);
98
99Word16 codeValues(Word16 *values, Word16 width, Word16 codeBook, HANDLE_BIT_BUF hBitstream);
100
101Word16 bitCountScalefactorDelta(Word16 delta);
102Word16 codeScalefactorDelta(Word16 scalefactor, HANDLE_BIT_BUF hBitstream);
103
104
105
106#endif
107