1 /* 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_FLOAT_TYPE_H_ 12 #define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_FLOAT_TYPE_H_ 13 14 #include "modules/audio_coding/codecs/isac/main/include/isac.h" 15 16 namespace webrtc { 17 18 struct IsacFloat { 19 using instance_type = ISACStruct; 20 static const bool has_swb = true; ControlIsacFloat21 static inline int16_t Control(instance_type* inst, 22 int32_t rate, 23 int framesize) { 24 return WebRtcIsac_Control(inst, rate, framesize); 25 } ControlBweIsacFloat26 static inline int16_t ControlBwe(instance_type* inst, 27 int32_t rate_bps, 28 int frame_size_ms, 29 int16_t enforce_frame_size) { 30 return WebRtcIsac_ControlBwe(inst, rate_bps, frame_size_ms, 31 enforce_frame_size); 32 } CreateIsacFloat33 static inline int16_t Create(instance_type** inst) { 34 return WebRtcIsac_Create(inst); 35 } DecodeInternalIsacFloat36 static inline int DecodeInternal(instance_type* inst, 37 const uint8_t* encoded, 38 size_t len, 39 int16_t* decoded, 40 int16_t* speech_type) { 41 return WebRtcIsac_Decode(inst, encoded, len, decoded, speech_type); 42 } DecodePlcIsacFloat43 static inline size_t DecodePlc(instance_type* inst, 44 int16_t* decoded, 45 size_t num_lost_frames) { 46 return WebRtcIsac_DecodePlc(inst, decoded, num_lost_frames); 47 } 48 DecoderInitIsacFloat49 static inline void DecoderInit(instance_type* inst) { 50 WebRtcIsac_DecoderInit(inst); 51 } EncodeIsacFloat52 static inline int Encode(instance_type* inst, 53 const int16_t* speech_in, 54 uint8_t* encoded) { 55 return WebRtcIsac_Encode(inst, speech_in, encoded); 56 } EncoderInitIsacFloat57 static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) { 58 return WebRtcIsac_EncoderInit(inst, coding_mode); 59 } EncSampRateIsacFloat60 static inline uint16_t EncSampRate(instance_type* inst) { 61 return WebRtcIsac_EncSampRate(inst); 62 } 63 FreeIsacFloat64 static inline int16_t Free(instance_type* inst) { 65 return WebRtcIsac_Free(inst); 66 } GetErrorCodeIsacFloat67 static inline int16_t GetErrorCode(instance_type* inst) { 68 return WebRtcIsac_GetErrorCode(inst); 69 } 70 GetNewFrameLenIsacFloat71 static inline int16_t GetNewFrameLen(instance_type* inst) { 72 return WebRtcIsac_GetNewFrameLen(inst); 73 } SetDecSampRateIsacFloat74 static inline int16_t SetDecSampRate(instance_type* inst, 75 uint16_t sample_rate_hz) { 76 return WebRtcIsac_SetDecSampRate(inst, sample_rate_hz); 77 } SetEncSampRateIsacFloat78 static inline int16_t SetEncSampRate(instance_type* inst, 79 uint16_t sample_rate_hz) { 80 return WebRtcIsac_SetEncSampRate(inst, sample_rate_hz); 81 } SetEncSampRateInDecoderIsacFloat82 static inline void SetEncSampRateInDecoder(instance_type* inst, 83 uint16_t sample_rate_hz) { 84 WebRtcIsac_SetEncSampRateInDecoder(inst, sample_rate_hz); 85 } SetInitialBweBottleneckIsacFloat86 static inline void SetInitialBweBottleneck(instance_type* inst, 87 int bottleneck_bits_per_second) { 88 WebRtcIsac_SetInitialBweBottleneck(inst, bottleneck_bits_per_second); 89 } SetMaxPayloadSizeIsacFloat90 static inline int16_t SetMaxPayloadSize(instance_type* inst, 91 int16_t max_payload_size_bytes) { 92 return WebRtcIsac_SetMaxPayloadSize(inst, max_payload_size_bytes); 93 } SetMaxRateIsacFloat94 static inline int16_t SetMaxRate(instance_type* inst, int32_t max_bit_rate) { 95 return WebRtcIsac_SetMaxRate(inst, max_bit_rate); 96 } 97 }; 98 99 } // namespace webrtc 100 #endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_FLOAT_TYPE_H_ 101