1 /* 2 * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland 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 picokpdf.h 18 * 19 * knowledge handling for pdf 20 * 21 * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland 22 * All rights reserved. 23 * 24 * History: 25 * - 2009-04-20 -- initial version 26 * 27 */ 28 29 #ifndef PICOKPDF_H_ 30 #define PICOKPDF_H_ 31 32 #include "picoos.h" 33 #include "picoknow.h" 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 #if 0 39 } 40 #endif 41 42 43 /* ************************************************************/ 44 /** 45 * @addtogroup picokpdf 46 * 47 Two specialized pdf kb types are provided by this knowledge 48 handling module: 49 50 - pdf dur: ...kpdf_DUR (for dur) 51 - pdf mul: ...kpdf_MUL (for lfz and mgc) 52 - pdf phs: ...kpdf_PHS (for phase) 53 54 */ 55 /* ************************************************************/ 56 57 58 /* ************************************************************/ 59 /* defines and functions to create specialized kb, */ 60 /* to be used by picorsrc only */ 61 /* ************************************************************/ 62 63 #define PICOKPDF_MAX_NUM_STATES 10 64 65 #define PICOKPDF_MAX_MUL_LFZ_CEPORDER 1 66 #define PICOKPDF_MAX_MUL_MGC_CEPORDER 25 67 68 /* trade accuracy against computation: more long multiplications. 69 * Maximum is 15 when invdiag0=(1<<(2*bigpow))/diag0 used 70 * currently observing instability in mlpg when bigpow >= 14, this needs to be investigated */ 71 72 #define PICOKPDF_BIG_POW 12 73 74 typedef enum { 75 PICOKPDF_KPDFTYPE_DUR, 76 PICOKPDF_KPDFTYPE_MUL, 77 PICOKPDF_KPDFTYPE_PHS 78 } picokpdf_kpdftype_t; 79 80 pico_status_t picokpdf_specializePdfKnowledgeBase(picoknow_KnowledgeBase this, 81 picoos_Common common, 82 const picokpdf_kpdftype_t type); 83 84 85 /* ************************************************************/ 86 /* pdf types and get Pdf functions */ 87 /* ************************************************************/ 88 89 /** object : PdfDur, PdfMUL 90 * shortcut : kpdf* 91 * derived from : picoknow_KnowledgeBase 92 */ 93 94 typedef struct picokpdf_pdfdur *picokpdf_PdfDUR; 95 typedef struct picokpdf_pdfmul *picokpdf_PdfMUL; 96 typedef struct picokpdf_pdfphs *picokpdf_PdfPHS; 97 98 /* subobj specific for pdf dur type */ 99 typedef struct picokpdf_pdfdur { 100 picoos_uint16 numframes; 101 picoos_uint8 vecsize; 102 picoos_uint8 sampperframe; 103 picoos_uint8 phonquantlen; 104 picoos_uint8 *phonquant; 105 picoos_uint8 statequantlen; 106 picoos_uint8 *statequant; 107 picoos_uint8 *content; 108 } picokpdf_pdfdur_t; 109 110 /* subobj specific for pdf mul type */ 111 typedef struct picokpdf_pdfmul { 112 picoos_uint16 numframes; 113 picoos_uint8 vecsize; 114 picoos_uint8 numstates; 115 picoos_uint16 stateoffset[PICOKPDF_MAX_NUM_STATES]; /* offset within a phone to find the state ? */ 116 picoos_uint8 ceporder; 117 picoos_uint8 numvuv; 118 picoos_uint8 numdeltas; 119 picoos_uint8 meanpow; 120 picoos_uint8 bigpow; 121 picoos_uint8 amplif; 122 picoos_uint8 *meanpowUm; /* KPDF_NUMSTREAMS x ceporder values */ 123 picoos_uint8 *ivarpow; /* KPDF_NUMSTREAMS x ceporder values */ 124 picoos_uint8 *content; 125 } picokpdf_pdfmul_t; 126 127 /* subobj specific for pdf phs type */ 128 typedef struct picokpdf_pdfphs { 129 picoos_uint16 numvectors; 130 picoos_uint8 *indexBase; 131 picoos_uint8 *contentBase; 132 } picokpdf_pdfphs_t; 133 134 /* return kb pdf for usage in PU */ 135 picokpdf_PdfDUR picokpdf_getPdfDUR(picoknow_KnowledgeBase this); 136 picokpdf_PdfMUL picokpdf_getPdfMUL(picoknow_KnowledgeBase this); 137 picokpdf_PdfPHS picokpdf_getPdfPHS(picoknow_KnowledgeBase this); 138 139 140 /* ************************************************************/ 141 /* PDF DUR functions */ 142 /* ************************************************************/ 143 144 /* e.g. */ 145 /*picoos_uint8 picokpdf_pdfDURgetEle(const picokpdf_PdfDUR this, 146 const picoos_uint16 row, 147 const picoos_uint16 col, 148 picoos_uint16 *val); 149 */ 150 151 /* ************************************************************/ 152 /* PDF MUL functions */ 153 /* ************************************************************/ 154 155 #ifdef __cplusplus 156 } 157 #endif 158 159 160 #endif /*PICOKPDF_H_*/ 161