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: dyn_bits.h 18 19 Content: Noiseless coder module structure and functions 20 21 *******************************************************************************/ 22 23 #ifndef __DYN_BITS_H 24 #define __DYN_BITS_H 25 26 #include "psy_const.h" 27 #include "tns.h" 28 #include "bit_cnt.h" 29 30 31 32 #define MAX_SECTIONS MAX_GROUPED_SFB 33 #define SECT_ESC_VAL_LONG 31 34 #define SECT_ESC_VAL_SHORT 7 35 #define CODE_BOOK_BITS 4 36 #define SECT_BITS_LONG 5 37 #define SECT_BITS_SHORT 3 38 39 typedef struct 40 { 41 Word16 codeBook; 42 Word16 sfbStart; 43 Word16 sfbCnt; 44 Word16 sectionBits; 45 } 46 SECTION_INFO; 47 48 49 50 51 typedef struct 52 { 53 Word16 blockType; 54 Word16 noOfGroups; 55 Word16 sfbCnt; 56 Word16 maxSfbPerGroup; 57 Word16 sfbPerGroup; 58 Word16 noOfSections; 59 SECTION_INFO sectionInfo[MAX_SECTIONS]; 60 Word16 sideInfoBits; /* sectioning bits */ 61 Word16 huffmanBits; /* huffman coded bits */ 62 Word16 scalefacBits; /* scalefac coded bits */ 63 Word16 firstScf; /* first scf to be coded */ 64 Word16 bitLookUp[MAX_SFB_LONG*(CODE_BOOK_ESC_NDX+1)]; 65 Word16 mergeGainLookUp[MAX_SFB_LONG]; 66 } 67 SECTION_DATA; /* Word16 size: 10 + 60(MAX_SECTIONS)*4(SECTION_INFO) + 51(MAX_SFB_LONG)*12(CODE_BOOK_ESC_NDX+1) + 51(MAX_SFB_LONG) = 913 */ 68 69 70 Word16 BCInit(void); 71 72 Word16 dynBitCount(const Word16 *quantSpectrum, 73 const UWord16 *maxValueInSfb, 74 const Word16 *scalefac, 75 const Word16 blockType, 76 const Word16 sfbCnt, 77 const Word16 maxSfbPerGroup, 78 const Word16 sfbPerGroup, 79 const Word16 *sfbOffset, 80 SECTION_DATA *sectionData); 81 82 #endif 83