OLD | NEW |
1 /* Copyright (c) 2007-2008 CSIRO | 1 /* Copyright (c) 2007-2008 CSIRO |
2 Copyright (c) 2007-2009 Xiph.Org Foundation | 2 Copyright (c) 2007-2009 Xiph.Org Foundation |
3 Copyright (c) 2008 Gregory Maxwell | 3 Copyright (c) 2008 Gregory Maxwell |
4 Written by Jean-Marc Valin and Gregory Maxwell */ | 4 Written by Jean-Marc Valin and Gregory Maxwell */ |
5 /** | 5 /** |
6 @file celt.h | 6 @file celt.h |
7 @brief Contains all the functions for encoding and decoding audio | 7 @brief Contains all the functions for encoding and decoding audio |
8 */ | 8 */ |
9 | 9 |
10 /* | 10 /* |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "arch.h" | 43 #include "arch.h" |
44 | 44 |
45 #ifdef __cplusplus | 45 #ifdef __cplusplus |
46 extern "C" { | 46 extern "C" { |
47 #endif | 47 #endif |
48 | 48 |
49 #define CELTEncoder OpusCustomEncoder | 49 #define CELTEncoder OpusCustomEncoder |
50 #define CELTDecoder OpusCustomDecoder | 50 #define CELTDecoder OpusCustomDecoder |
51 #define CELTMode OpusCustomMode | 51 #define CELTMode OpusCustomMode |
52 | 52 |
| 53 #define LEAK_BANDS 19 |
| 54 |
53 typedef struct { | 55 typedef struct { |
54 int valid; | 56 int valid; |
55 float tonality; | 57 float tonality; |
56 float tonality_slope; | 58 float tonality_slope; |
57 float noisiness; | 59 float noisiness; |
58 float activity; | 60 float activity; |
59 float music_prob; | 61 float music_prob; |
60 int bandwidth; | 62 float vad_prob; |
61 }AnalysisInfo; | 63 int bandwidth; |
| 64 float activity_probability; |
| 65 /* Store as Q6 char to save space. */ |
| 66 unsigned char leak_boost[LEAK_BANDS]; |
| 67 } AnalysisInfo; |
| 68 |
| 69 typedef struct { |
| 70 int signalType; |
| 71 int offset; |
| 72 } SILKInfo; |
62 | 73 |
63 #define __celt_check_mode_ptr_ptr(ptr) ((ptr) + ((ptr) - (const CELTMode**)(ptr)
)) | 74 #define __celt_check_mode_ptr_ptr(ptr) ((ptr) + ((ptr) - (const CELTMode**)(ptr)
)) |
64 | 75 |
65 #define __celt_check_analysis_ptr(ptr) ((ptr) + ((ptr) - (const AnalysisInfo*)(p
tr))) | 76 #define __celt_check_analysis_ptr(ptr) ((ptr) + ((ptr) - (const AnalysisInfo*)(p
tr))) |
66 | 77 |
| 78 #define __celt_check_silkinfo_ptr(ptr) ((ptr) + ((ptr) - (const SILKInfo*)(ptr))
) |
| 79 |
67 /* Encoder/decoder Requests */ | 80 /* Encoder/decoder Requests */ |
68 | 81 |
69 /* Expose this option again when variable framesize actually works */ | |
70 #define OPUS_FRAMESIZE_VARIABLE 5010 /**< Optimize the frame size d
ynamically */ | |
71 | |
72 | 82 |
73 #define CELT_SET_PREDICTION_REQUEST 10002 | 83 #define CELT_SET_PREDICTION_REQUEST 10002 |
74 /** Controls the use of interframe prediction. | 84 /** Controls the use of interframe prediction. |
75 0=Independent frames | 85 0=Independent frames |
76 1=Short term interframe prediction allowed | 86 1=Short term interframe prediction allowed |
77 2=Long term prediction allowed | 87 2=Long term prediction allowed |
78 */ | 88 */ |
79 #define CELT_SET_PREDICTION(x) CELT_SET_PREDICTION_REQUEST, __opus_check_int(x) | 89 #define CELT_SET_PREDICTION(x) CELT_SET_PREDICTION_REQUEST, __opus_check_int(x) |
80 | 90 |
81 #define CELT_SET_INPUT_CLIPPING_REQUEST 10004 | 91 #define CELT_SET_INPUT_CLIPPING_REQUEST 10004 |
(...skipping 27 matching lines...) Expand all Loading... |
109 | 119 |
110 #define CELT_SET_ANALYSIS_REQUEST 10022 | 120 #define CELT_SET_ANALYSIS_REQUEST 10022 |
111 #define CELT_SET_ANALYSIS(x) CELT_SET_ANALYSIS_REQUEST, __celt_check_analysis_pt
r(x) | 121 #define CELT_SET_ANALYSIS(x) CELT_SET_ANALYSIS_REQUEST, __celt_check_analysis_pt
r(x) |
112 | 122 |
113 #define OPUS_SET_LFE_REQUEST 10024 | 123 #define OPUS_SET_LFE_REQUEST 10024 |
114 #define OPUS_SET_LFE(x) OPUS_SET_LFE_REQUEST, __opus_check_int(x) | 124 #define OPUS_SET_LFE(x) OPUS_SET_LFE_REQUEST, __opus_check_int(x) |
115 | 125 |
116 #define OPUS_SET_ENERGY_MASK_REQUEST 10026 | 126 #define OPUS_SET_ENERGY_MASK_REQUEST 10026 |
117 #define OPUS_SET_ENERGY_MASK(x) OPUS_SET_ENERGY_MASK_REQUEST, __opus_check_val16
_ptr(x) | 127 #define OPUS_SET_ENERGY_MASK(x) OPUS_SET_ENERGY_MASK_REQUEST, __opus_check_val16
_ptr(x) |
118 | 128 |
| 129 #define CELT_SET_SILK_INFO_REQUEST 10028 |
| 130 #define CELT_SET_SILK_INFO(x) CELT_SET_SILK_INFO_REQUEST, __celt_check_silkinfo_
ptr(x) |
| 131 |
119 /* Encoder stuff */ | 132 /* Encoder stuff */ |
120 | 133 |
121 int celt_encoder_get_size(int channels); | 134 int celt_encoder_get_size(int channels); |
122 | 135 |
123 int celt_encode_with_ec(OpusCustomEncoder * OPUS_RESTRICT st, const opus_val16 *
pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *
enc); | 136 int celt_encode_with_ec(OpusCustomEncoder * OPUS_RESTRICT st, const opus_val16 *
pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *
enc); |
124 | 137 |
125 int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels, | 138 int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels, |
126 int arch); | 139 int arch); |
127 | 140 |
128 | 141 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[], | 233 void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[], |
221 opus_val16 *oldBandE, int start, int effEnd, int C, int CC, int isTransien
t, | 234 opus_val16 *oldBandE, int start, int effEnd, int C, int CC, int isTransien
t, |
222 int LM, int downsample, int silence); | 235 int LM, int downsample, int silence); |
223 #endif | 236 #endif |
224 | 237 |
225 #ifdef __cplusplus | 238 #ifdef __cplusplus |
226 } | 239 } |
227 #endif | 240 #endif |
228 | 241 |
229 #endif /* CELT_H */ | 242 #endif /* CELT_H */ |
OLD | NEW |