OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISA
C_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISA
C_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISA
C_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISA
C_H_ |
13 | 13 |
14 #include "webrtc/base/checks.h" | |
15 #include "webrtc/base/scoped_ptr.h" | |
16 #include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h" | 14 #include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h" |
17 #include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h" | 15 #include "webrtc/modules/audio_coding/codecs/isac/main/source/isac_float_type.h" |
18 | 16 |
19 namespace webrtc { | 17 namespace webrtc { |
20 | 18 |
21 struct IsacFloat { | |
22 typedef ISACStruct instance_type; | |
23 static const bool has_swb = true; | |
24 static inline int16_t Control(instance_type* inst, | |
25 int32_t rate, | |
26 int framesize) { | |
27 return WebRtcIsac_Control(inst, rate, framesize); | |
28 } | |
29 static inline int16_t ControlBwe(instance_type* inst, | |
30 int32_t rate_bps, | |
31 int frame_size_ms, | |
32 int16_t enforce_frame_size) { | |
33 return WebRtcIsac_ControlBwe(inst, rate_bps, frame_size_ms, | |
34 enforce_frame_size); | |
35 } | |
36 static inline int16_t Create(instance_type** inst) { | |
37 return WebRtcIsac_Create(inst); | |
38 } | |
39 static inline int DecodeInternal(instance_type* inst, | |
40 const uint8_t* encoded, | |
41 size_t len, | |
42 int16_t* decoded, | |
43 int16_t* speech_type) { | |
44 return WebRtcIsac_Decode(inst, encoded, len, decoded, speech_type); | |
45 } | |
46 static inline size_t DecodePlc(instance_type* inst, | |
47 int16_t* decoded, | |
48 size_t num_lost_frames) { | |
49 return WebRtcIsac_DecodePlc(inst, decoded, num_lost_frames); | |
50 } | |
51 | |
52 static inline void DecoderInit(instance_type* inst) { | |
53 WebRtcIsac_DecoderInit(inst); | |
54 } | |
55 static inline int Encode(instance_type* inst, | |
56 const int16_t* speech_in, | |
57 uint8_t* encoded) { | |
58 return WebRtcIsac_Encode(inst, speech_in, encoded); | |
59 } | |
60 static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) { | |
61 return WebRtcIsac_EncoderInit(inst, coding_mode); | |
62 } | |
63 static inline uint16_t EncSampRate(instance_type* inst) { | |
64 return WebRtcIsac_EncSampRate(inst); | |
65 } | |
66 | |
67 static inline int16_t Free(instance_type* inst) { | |
68 return WebRtcIsac_Free(inst); | |
69 } | |
70 static inline void GetBandwidthInfo(instance_type* inst, | |
71 IsacBandwidthInfo* bwinfo) { | |
72 WebRtcIsac_GetBandwidthInfo(inst, bwinfo); | |
73 } | |
74 static inline int16_t GetErrorCode(instance_type* inst) { | |
75 return WebRtcIsac_GetErrorCode(inst); | |
76 } | |
77 | |
78 static inline int16_t GetNewFrameLen(instance_type* inst) { | |
79 return WebRtcIsac_GetNewFrameLen(inst); | |
80 } | |
81 static inline void SetBandwidthInfo(instance_type* inst, | |
82 const IsacBandwidthInfo* bwinfo) { | |
83 WebRtcIsac_SetBandwidthInfo(inst, bwinfo); | |
84 } | |
85 static inline int16_t SetDecSampRate(instance_type* inst, | |
86 uint16_t sample_rate_hz) { | |
87 return WebRtcIsac_SetDecSampRate(inst, sample_rate_hz); | |
88 } | |
89 static inline int16_t SetEncSampRate(instance_type* inst, | |
90 uint16_t sample_rate_hz) { | |
91 return WebRtcIsac_SetEncSampRate(inst, sample_rate_hz); | |
92 } | |
93 static inline void SetEncSampRateInDecoder(instance_type* inst, | |
94 uint16_t sample_rate_hz) { | |
95 WebRtcIsac_SetEncSampRateInDecoder(inst, sample_rate_hz); | |
96 } | |
97 static inline void SetInitialBweBottleneck( | |
98 instance_type* inst, | |
99 int bottleneck_bits_per_second) { | |
100 WebRtcIsac_SetInitialBweBottleneck(inst, bottleneck_bits_per_second); | |
101 } | |
102 static inline int16_t UpdateBwEstimate(instance_type* inst, | |
103 const uint8_t* encoded, | |
104 size_t packet_size, | |
105 uint16_t rtp_seq_number, | |
106 uint32_t send_ts, | |
107 uint32_t arr_ts) { | |
108 return WebRtcIsac_UpdateBwEstimate(inst, encoded, packet_size, | |
109 rtp_seq_number, send_ts, arr_ts); | |
110 } | |
111 static inline int16_t SetMaxPayloadSize(instance_type* inst, | |
112 int16_t max_payload_size_bytes) { | |
113 return WebRtcIsac_SetMaxPayloadSize(inst, max_payload_size_bytes); | |
114 } | |
115 static inline int16_t SetMaxRate(instance_type* inst, int32_t max_bit_rate) { | |
116 return WebRtcIsac_SetMaxRate(inst, max_bit_rate); | |
117 } | |
118 }; | |
119 | |
120 using AudioEncoderIsac = AudioEncoderIsacT<IsacFloat>; | 19 using AudioEncoderIsac = AudioEncoderIsacT<IsacFloat>; |
121 using AudioDecoderIsac = AudioDecoderIsacT<IsacFloat>; | |
122 | 20 |
123 } // namespace webrtc | 21 } // namespace webrtc |
124 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_
ISAC_H_ | 22 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_
ISAC_H_ |
OLD | NEW |