File: settings.h

package info (click to toggle)
chromium-browser 41.0.2272.118-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,189,132 kB
  • sloc: cpp: 9,691,462; ansic: 3,341,451; python: 712,689; asm: 518,779; xml: 208,926; java: 169,820; sh: 119,353; perl: 68,907; makefile: 28,311; yacc: 13,305; objc: 11,385; tcl: 3,186; cs: 2,225; sql: 2,217; lex: 2,215; lisp: 1,349; pascal: 1,256; awk: 407; ruby: 155; sed: 53; php: 14; exp: 11
file content (207 lines) | stat: -rw-r--r-- 8,588 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

/*
 * settings.h
 *
 * Declaration of #defines used in the iSAC codec
 *
 */

#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_

/* sampling frequency (Hz) */
#define FS                                      16000

/* number of samples per frame (either 320 (20ms), 480 (30ms) or 960 (60ms)) */
#define INITIAL_FRAMESAMPLES     960


#define MAXFFTSIZE 2048
#define NFACTOR 11



/* do not modify the following; this will have to be modified if we
 * have a 20ms framesize option */
/**********************************************************************/
/* miliseconds */
#define FRAMESIZE                               30
/* number of samples per frame processed in the encoder, 480 */
#define FRAMESAMPLES                            480 /* ((FRAMESIZE*FS)/1000) */
#define FRAMESAMPLES_HALF      240
#define FRAMESAMPLES_QUARTER                    120
/**********************************************************************/



/* max number of samples per frame (= 60 ms frame) */
#define MAX_FRAMESAMPLES      960
#define MAX_SWBFRAMESAMPLES                     (MAX_FRAMESAMPLES * 2)
/* number of samples per 10ms frame */
#define FRAMESAMPLES_10ms                       ((10*FS)/1000)
#define SWBFRAMESAMPLES_10ms                    (FRAMESAMPLES_10ms * 2)
/* number of samples in 30 ms frame */
#define FRAMESAMPLES_30ms            480
/* number of subframes */
#define SUBFRAMES                               6
/* length of a subframe */
#define UPDATE                                  80
/* length of half a subframe (low/high band) */
#define HALF_SUBFRAMELEN                        (UPDATE/2)
/* samples of look ahead (in a half-band, so actually
 * half the samples of look ahead @ FS) */
#define QLOOKAHEAD                              24    /* 3 ms */
/* order of AR model in spectral entropy coder */
#define AR_ORDER                                6
/* order of LP model in spectral entropy coder */
#define LP_ORDER                                0

/* window length (masking analysis) */
#define WINLEN                                  256
/* order of low-band pole filter used to approximate masking curve */
#define ORDERLO                                 12
/* order of hi-band pole filter used to approximate masking curve */
#define ORDERHI                                 6

#define UB_LPC_ORDER                            4
#define UB_LPC_VEC_PER_FRAME                    2
#define UB16_LPC_VEC_PER_FRAME                  4
#define UB_ACTIVE_SUBFRAMES                     2
#define UB_MAX_LPC_ORDER                        6
#define UB_INTERPOL_SEGMENTS                    1
#define UB16_INTERPOL_SEGMENTS                  3
#define LB_TOTAL_DELAY_SAMPLES                 48
enum ISACBandwidth {isac8kHz = 8, isac12kHz = 12, isac16kHz = 16};
enum ISACBand {kIsacLowerBand = 0, kIsacUpperBand12 = 1, kIsacUpperBand16 = 2};
enum IsacSamplingRate {kIsacWideband = 16,  kIsacSuperWideband = 32};
#define UB_LPC_GAIN_DIM                 SUBFRAMES
#define FB_STATE_SIZE_WORD32                    6


/* order for post_filter_bank */
#define POSTQORDER                              3
/* order for pre-filterbank */
#define QORDER                                  3
/* another order */
#define QORDER_ALL                              (POSTQORDER+QORDER-1)
/* for decimator */
#define ALLPASSSECTIONS                         2


/* array size for byte stream in number of bytes. */
/* The old maximum size still needed for the decoding */
#define STREAM_SIZE_MAX     600
#define STREAM_SIZE_MAX_30  200 /* 200 bytes=53.4 kbps @ 30 ms.framelength */
#define STREAM_SIZE_MAX_60  400 /* 400 bytes=53.4 kbps @ 60 ms.framelength */

/* storage size for bit counts */
#define BIT_COUNTER_SIZE                        30
/* maximum order of any AR model or filter */
#define MAX_AR_MODEL_ORDER                      12//50


/* For pitch analysis */
#define PITCH_FRAME_LEN                         (FRAMESAMPLES_HALF) /* 30 ms  */
#define PITCH_MAX_LAG                           140     /* 57 Hz  */
#define PITCH_MIN_LAG                           20              /* 400 Hz */
#define PITCH_MAX_GAIN                          0.45
#define PITCH_MAX_GAIN_06                       0.27  /* PITCH_MAX_GAIN*0.6 */
#define PITCH_MAX_GAIN_Q12      1843
#define PITCH_LAG_SPAN2                     (PITCH_MAX_LAG/2-PITCH_MIN_LAG/2+5)
#define PITCH_CORR_LEN2                         60     /* 15 ms  */
#define PITCH_CORR_STEP2                        (PITCH_FRAME_LEN/4)
#define PITCH_BW        11     /* half the band width of correlation surface */
#define PITCH_SUBFRAMES                         4
#define PITCH_GRAN_PER_SUBFRAME                 5
#define PITCH_SUBFRAME_LEN        (PITCH_FRAME_LEN/PITCH_SUBFRAMES)
#define PITCH_UPDATE              (PITCH_SUBFRAME_LEN/PITCH_GRAN_PER_SUBFRAME)
/* maximum number of peaks to be examined in correlation surface */
#define PITCH_MAX_NUM_PEAKS                  10
#define PITCH_PEAK_DECAY               0.85
/* For weighting filter */
#define PITCH_WLPCORDER                   6
#define PITCH_WLPCWINLEN               PITCH_FRAME_LEN
#define PITCH_WLPCASYM                   0.3         /* asymmetry parameter */
#define PITCH_WLPCBUFLEN               PITCH_WLPCWINLEN
/* For pitch filter */
/* Extra 50 for fraction and LP filters */
#define PITCH_BUFFSIZE                   (PITCH_MAX_LAG + 50)
#define PITCH_INTBUFFSIZE               (PITCH_FRAME_LEN+PITCH_BUFFSIZE)
/* Max rel. step for interpolation */
#define PITCH_UPSTEP                1.5
/* Max rel. step for interpolation */
#define PITCH_DOWNSTEP                   0.67
#define PITCH_FRACS                             8
#define PITCH_FRACORDER                         9
#define PITCH_DAMPORDER                         5
#define PITCH_FILTDELAY                         1.5f
/* stepsize for quantization of the pitch Gain */
#define PITCH_GAIN_STEPSIZE                     0.125



/* Order of high pass filter */
#define HPORDER                                 2

/* some mathematical constants */
/* log2(exp) */
#define LOG2EXP                                 1.44269504088896
#define PI                                      3.14159265358979

/* Maximum number of iterations allowed to limit payload size */
#define MAX_PAYLOAD_LIMIT_ITERATION             5

/* Redundant Coding */
#define RCU_BOTTLENECK_BPS                      16000
#define RCU_TRANSCODING_SCALE                   0.40f
#define RCU_TRANSCODING_SCALE_INVERSE           2.5f

#define RCU_TRANSCODING_SCALE_UB                0.50f
#define RCU_TRANSCODING_SCALE_UB_INVERSE        2.0f

#define SIZE_RESAMPLER_STATE  6

/* Define Error codes */
/* 6000 General */
#define ISAC_MEMORY_ALLOCATION_FAILED    6010
#define ISAC_MODE_MISMATCH       6020
#define ISAC_DISALLOWED_BOTTLENECK     6030
#define ISAC_DISALLOWED_FRAME_LENGTH    6040
#define ISAC_UNSUPPORTED_SAMPLING_FREQUENCY         6050

/* 6200 Bandwidth estimator */
#define ISAC_RANGE_ERROR_BW_ESTIMATOR    6240
/* 6400 Encoder */
#define ISAC_ENCODER_NOT_INITIATED     6410
#define ISAC_DISALLOWED_CODING_MODE     6420
#define ISAC_DISALLOWED_FRAME_MODE_ENCODER   6430
#define ISAC_DISALLOWED_BITSTREAM_LENGTH            6440
#define ISAC_PAYLOAD_LARGER_THAN_LIMIT              6450
#define ISAC_DISALLOWED_ENCODER_BANDWIDTH           6460
/* 6600 Decoder */
#define ISAC_DECODER_NOT_INITIATED     6610
#define ISAC_EMPTY_PACKET       6620
#define ISAC_DISALLOWED_FRAME_MODE_DECODER   6630
#define ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH  6640
#define ISAC_RANGE_ERROR_DECODE_BANDWIDTH   6650
#define ISAC_RANGE_ERROR_DECODE_PITCH_GAIN   6660
#define ISAC_RANGE_ERROR_DECODE_PITCH_LAG   6670
#define ISAC_RANGE_ERROR_DECODE_LPC     6680
#define ISAC_RANGE_ERROR_DECODE_SPECTRUM   6690
#define ISAC_LENGTH_MISMATCH      6730
#define ISAC_RANGE_ERROR_DECODE_BANDWITH            6740
#define ISAC_DISALLOWED_BANDWIDTH_MODE_DECODER      6750
#define ISAC_DISALLOWED_LPC_MODEL                   6760
/* 6800 Call setup formats */
#define ISAC_INCOMPATIBLE_FORMATS     6810

#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_ */