Home | History | Annotate | Download | only in lib
      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 picosig2.h
     18  *
     19  * Signal Generation PU - Internal functions - header file
     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 PICOSIG2_H_
     30 #define PICOSIG2_H_
     31 
     32 #include "picoos.h"
     33 #include "picodsp.h"
     34 
     35 #ifdef __cplusplus
     36 extern "C" {
     37 #endif
     38 #if 0
     39 }
     40 #endif
     41 
     42 /*----------------------------------------------------------
     43  // Name    :   sig_innerobj
     44  // Function:   innerobject definition for the sig processing
     45  // Shortcut:   sig
     46  //---------------------------------------------------------*/
     47 typedef struct sig_innerobj
     48 {
     49 
     50     /*-----------------------Definition of the local storage for this PU--------*/
     51     picoos_int16 *idx_vect1; /*reserved for bit reversal tables*/
     52     picoos_int16 *idx_vect2; /*reserved for table lookup "A" vector*/
     53     picoos_int16 *idx_vect4; /*reserved for max peak index arrax in pchip*/
     54     picoos_int16 *idx_vect5; /*reserved for min index arrax in sigana_singleIMF*/
     55     picoos_int16 *idx_vect6; /*reserved for max index arrax in sigana_singleIMF*/
     56     picoos_int16 *idx_vect7; /*reserved for dispersed phase */
     57     picoos_int16 *idx_vect8; /*reserved for LocV*/
     58     picoos_int16 *idx_vect9; /*reserved for LocU*/
     59 
     60     picoos_int32 *int_vec22; /*reserved for normalized hanning window - fixed point */
     61     picoos_int32 *int_vec23; /*reserved for impresp  - fixed point */
     62     picoos_int32 *int_vec24; /*reserved for impresp  - fixed point */
     63     picoos_int32 *int_vec25; /*reserved for window  - fixed point */
     64     picoos_int32 *int_vec26; /*reserved for wavBuf  - fixed point */
     65     picoos_int32 *int_vec28; /*reserved for cepstral vectors input - fixed point */
     66     picoos_int32 *int_vec29; /*reserved for cepstral vectors input - fixed point */
     67     picoos_int32 *int_vec38; /*reserved for cepstral vectors input - fixed point */
     68     picoos_int32 *int_vec30; /*reserved for cepstral vectors input - fixed point */
     69     picoos_int32 *int_vec31; /*reserved for cepstral vectors input - fixed point */
     70 
     71     picoos_int32 *int_vec32; /*reserved for cepstral vectors input - fixed point */
     72     picoos_int32 *int_vec33; /*reserved for cepstral vectors input - fixed point */
     73 
     74     picoos_int32 *int_vec34; /* reserved for sin table- fixed point */
     75     picoos_int32 *int_vec35; /* reserved for cos table - fixed point */
     76     picoos_int32 *int_vec36; /* reserved for currently used sin table- fixed point */
     77     picoos_int32 *int_vec37; /* reserved for currently used cos table - fixed point */
     78 
     79     picoos_int32 *int_vec39; /* reserved for ang - fixed point */
     80     picoos_int32 *int_vec40; /* reserved for cos table - fixed point */
     81 
     82     picoos_int32 *int_vec41[CEPST_BUFF_SIZE]; /*reserved for phase smoothing - cepstrum buffers */
     83     picoos_int32 *int_vec42[PHASE_BUFF_SIZE]; /*reserved for phase smoothing - phase buffers */
     84 
     85     picoos_int16 idx_vect10[CEPST_BUFF_SIZE]; /*reserved for pitch value buffering before phase smoothing*/
     86     picoos_int16 idx_vect11[CEPST_BUFF_SIZE]; /*reserved for phonetic value bufferingid before phase smoothing*/
     87     picoos_int16 idx_vect12[CEPST_BUFF_SIZE]; /*reserved for voicing value bufferingbefore phase smoothing*/
     88     picoos_int16 idx_vect13[CEPST_BUFF_SIZE]; /*reserved for unrectified pitch value bufferingbefore phase smoothing*/
     89     picoos_int16 idx_vect14[PHASE_BUFF_SIZE]; /*reserved for vox_bnd value buffering before phase smoothing*/
     90 
     91     picoos_int32 *sig_vec1;
     92 
     93     picoos_single bvalue1; /*reserved for warp*/
     94     picoos_int32 ibvalue2; /*reserved for voxbnd*/
     95     picoos_int32 ibvalue3; /*reserved for voxbnd2*/
     96     picoos_single bvalue4; /*reserved for E*/
     97     picoos_single bvalue5; /*reserved for F0*/
     98     picoos_single bvalue6; /*reserved for sMod*/
     99 
    100     picoos_single bvalue7; /*reserved for voicing*/
    101     picoos_single bvalue8; /*reserved for unrectified pitch*/
    102 
    103     picoos_int16 ivalue1; /*reserved for m1,ceporder*/
    104     picoos_int16 ivalue2; /*reserved for m2,fftorder,windowlen*/
    105     picoos_int16 ivalue3; /*reserved for fftorder/2*/
    106     picoos_int16 ivalue4; /*reserved for framelen, displacement*/
    107     picoos_int16 ivalue5; /*reserved for voiced*/
    108     picoos_int16 ivalue6; /*reserved for generic result code*/
    109     picoos_int16 ivalue7; /*reserved for i*/
    110     picoos_int16 ivalue8; /*reserved for j*/
    111     picoos_int16 ivalue9; /*reserved for hop*/
    112     picoos_int16 ivalue10; /*reserved for nextPeak*/
    113     picoos_int16 ivalue11; /*reserved for nFrame*/
    114     picoos_int16 ivalue12; /*reserved for raw*/
    115     picoos_int16 ivalue13; /*reserved for hts engine flag*/
    116     picoos_int16 ivalue14; /*reserved for ph id*/
    117     picoos_int16 ivalue15; /*reserved for Voiced*/
    118     picoos_int16 ivalue16; /*reserved for prevVoiced*/
    119     picoos_int16 ivalue17; /*reserved for nV (size of LocV)*/
    120     picoos_int16 ivalue18; /*reserved for nU (size of LocU)*/
    121 
    122     picoos_int16 ivalue19; /*reserved for voicTrans*/
    123 
    124     picoos_int16 ivalue20; /*reserved for n_availabe index*/
    125 
    126     picoos_int32 lvalue1; /*reserved for sampling rate*/
    127     picoos_int32 lvalue2; /*reserved for VCutoff*/
    128     picoos_int32 lvalue3; /*reserved for UVCutoff*/
    129     picoos_int32 lvalue4; /*reserved for fMax */
    130 
    131     picoos_int32 iRand; /*reserved for phase random table poointer ())*/
    132 
    133 } sig_innerobj_t;
    134 
    135 /*------------------------------------------------------------------
    136  Exported (to picosig.c) Service routines :
    137  routine name and I/O parameters are to be maintained for PICO compatibility!!
    138  ------------------------------------------------------------------*/
    139 extern pico_status_t sigAllocate(picoos_MemoryManager mm,
    140         sig_innerobj_t *sig_inObj);
    141 extern void sigDeallocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj);
    142 extern void sigDspInitialize(sig_innerobj_t *sig_inObj, picoos_int32 resetMode);
    143 
    144 /*------------------------------------------------------------------
    145  Exported (to picosig.c) Processing routines :
    146  routine number, name and content can be changed. unique I/O parameter should be  "sig"
    147  ------------------------------------------------------------------*/
    148 extern void mel_2_lin_init(sig_innerobj_t *sig_inObj);
    149 extern void save_transition_frame(sig_innerobj_t *sig_inObj);
    150 extern void mel_2_lin_init(sig_innerobj_t *sig_inObj);
    151 extern void post_filter_init(sig_innerobj_t *sig_inObj);
    152 extern void mel_2_lin_lookup(sig_innerobj_t *sig_inObj, picoos_uint32 mgc);
    153 extern void post_filter(sig_innerobj_t *sig_inObj);
    154 extern void phase_spec2(sig_innerobj_t *sig_inObj);
    155 extern void env_spec(sig_innerobj_t *sig_inObj);
    156 extern void save_transition_frame(sig_innerobj_t *sig_inObj);
    157 extern void td_psola2(sig_innerobj_t *sig_inObj);
    158 extern void impulse_response(sig_innerobj_t *sig_inObj);
    159 extern void overlap_add(sig_innerobj_t *sig_inObj);
    160 
    161 /* -------------------------------------------------------------------
    162  * symbolic vs area assignements
    163  * -------------------------------------------------------------------*/
    164 #define WavBuff_p   int_vec26       /*output is Wav buffer (2*FFTSize)*/
    165 #define window_p    int_vec25       /*window function (hanning) */
    166 #define ImpResp_p   int_vec23       /*output step 6*/
    167 #define imp_p       int_vec24       /*output step 6*/
    168 #define warp_p      bvalue1         /*warp factor */
    169 #define voxbnd_p    ibvalue2         /*phase spectra reconstruction noise factor V*/  /*  fixed point */
    170 #define voxbnd2_p   ibvalue3         /*phase spectra reconstruction noise factor UV */  /*  fixed point */
    171 #define E_p         bvalue4         /*energy after Envelope spectrum calculation */
    172 #define F0_p        bvalue5         /*pitch*/
    173 #define sMod_p      bvalue6         /*speaker modification factor*/
    174 #define voicing     bvalue7         /*voicing*/
    175 #define Fuv_p       bvalue8         /*unrectified pitch (for unvoiced too)*/
    176 #define m1_p        ivalue1         /*ceporder(melorder=ceporder-1) */
    177 #define m2_p        ivalue2         /*fftorder*/
    178 #define windowLen_p ivalue2         /*same as fftorder*/
    179 #define hfftsize_p  ivalue3         /*fftorder/2*/
    180 #define framesz_p   ivalue4         /*displacement*/
    181 #define voiced_p    ivalue5         /*voicing state*/
    182 #define nRes_p      ivalue6         /*generic result*/
    183 #define i_p         ivalue7         /*generic counter*/
    184 #define j_p         ivalue8         /*generic counter*/
    185 #define hop_p       ivalue9         /*hop */
    186 #define nextPeak_p  ivalue10        /*nextPeak*/
    187 #define phId_p      ivalue14        /*phonetic id*/
    188 #define prevVoiced_p ivalue16        /*previous voicing state (for frame 1)*/
    189 #define nV          ivalue17
    190 #define nU          ivalue18
    191 #define VoicTrans   ivalue19        /*  */
    192 #define Fs_p        lvalue1         /*Sampling frequency*/
    193 #define VCutoff_p   lvalue2         /*voicing cut off frequency in Hz*/
    194 #define UVCutoff_p  lvalue3         /*unvoicing cut off frequency in Hz*/
    195 /* Reusable area */
    196 #define wcep_pI     int_vec28       /*input step1*/
    197 #define d_p         int_vec38       /*output mel_2_lin_init  : table lookup  vector D*/
    198 #define A_p         idx_vect2       /*output mel_2_lin_init  : table lookup  vector A*/
    199 #define ang_p       int_vec39       /*output step4*/
    200 #define EnV         int_vec30
    201 #define EnU         int_vec31
    202 #define randCosTbl  int_vec34
    203 #define randSinTbl  int_vec35
    204 #define outCosTbl   int_vec36
    205 #define outSinTbl   int_vec37
    206 #define cos_table   int_vec40
    207 #define norm_window_p int_vec22     /*window function (hanning) */
    208 #define norm_window2_p int_vec27    /*window function (hanning) */
    209 #define F2r_p       int_vec32       /*output step 7*/
    210 #define F2i_p       int_vec33       /*output step 7*/
    211 #define LocV        idx_vect8       /*excitation position voiced pulses*/
    212 #define LocU        idx_vect9       /*excitation position unvoiced pulses*/
    213 
    214 #define CepBuff       int_vec41     /*Buffer for incoming cepstral vector pointers*/
    215 #define PhsBuff       int_vec42     /*Buffer for incoming phase vector pointers*/
    216 #define F0Buff        idx_vect10    /*Buffer for incoming F0 values*/
    217 #define PhIdBuff      idx_vect11    /*Buffer for incoming PhId values*/
    218 #define VoicingBuff   idx_vect12    /*Buffer for incoming voicing values*/
    219 #define FuVBuff       idx_vect13    /*Buffer for incoming FuV values*/
    220 #define VoxBndBuff    idx_vect14    /*Buffer for incoming VoxBnd values*/
    221 
    222 #define n_available   ivalue20      /*variable for indexing the incoming buffers*/
    223 
    224 
    225 #ifdef __cplusplus
    226 }
    227 #endif
    228 
    229 #endif
    230