diff options
author | Mamadou DIOP <bossiel@yahoo.fr> | 2015-08-17 01:56:35 +0200 |
---|---|---|
committer | Mamadou DIOP <bossiel@yahoo.fr> | 2015-08-17 01:56:35 +0200 |
commit | 631fffee8a28b1bec5ed1f1d26a20e0135967f99 (patch) | |
tree | 74afe3bf3efe15aa82bcd0272b2b0f4d48c2d837 /tinyMEDIA/include/tinymedia/tmedia_denoise.h | |
parent | 7908865936604036e6f200f1b5e069f8752f3a3a (diff) | |
download | doubango-631fffee8a28b1bec5ed1f1d26a20e0135967f99.zip doubango-631fffee8a28b1bec5ed1f1d26a20e0135967f99.tar.gz |
-
Diffstat (limited to 'tinyMEDIA/include/tinymedia/tmedia_denoise.h')
-rw-r--r-- | tinyMEDIA/include/tinymedia/tmedia_denoise.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/tinyMEDIA/include/tinymedia/tmedia_denoise.h b/tinyMEDIA/include/tinymedia/tmedia_denoise.h new file mode 100644 index 0000000..d8818f4 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_denoise.h @@ -0,0 +1,97 @@ +/* +* Copyright (C) 2010-2015 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmedia_denoise.h + * @brief Denoiser (Noise suppression, AGC, AEC, VAD) Plugin + */ +#ifndef TINYMEDIA_DENOISE_H +#define TINYMEDIA_DENOISE_H + +#include "tinymedia_config.h" +#include "tinymedia/tmedia_params.h" + +#include "tsk_buffer.h" +#include "tsk_object.h" + +TMEDIA_BEGIN_DECLS + +/** cast any pointer to @ref tmedia_denoise_t* object */ +#define TMEDIA_DENOISE(self) ((tmedia_denoise_t*)(self)) + +/** Base object for all Denoisers */ +typedef struct tmedia_denoise_s +{ + TSK_DECLARE_OBJECT; + + tsk_bool_t opened; + + uint32_t echo_tail; + uint32_t echo_skew; + tsk_bool_t echo_supp_enabled; + tsk_bool_t agc_enabled ; + float agc_level; + tsk_bool_t vad_enabled; + tsk_bool_t noise_supp_enabled; + int32_t noise_supp_level; + tsk_buffer_t *record_frame; + tsk_buffer_t *playback_frame; + const struct tmedia_denoise_plugin_def_s* plugin; +} +tmedia_denoise_t; + +#define TMEDIA_DECLARE_DENOISE tmedia_denoise_t __denoise__ + +/** Virtual table used to define a consumer plugin */ +typedef struct tmedia_denoise_plugin_def_s +{ + //! object definition used to create an instance of the denoiser + const tsk_object_def_t* objdef; + + //! full description (usefull for debugging) + const char* desc; + + int (*set) (tmedia_denoise_t* , const tmedia_param_t*); + int (* open) (tmedia_denoise_t*, uint32_t record_frame_size_samples, uint32_t record_sampling_rate, uint32_t record_channels, uint32_t playback_frame_size_samples, uint32_t playback_sampling_rate, uint32_t playback_channels); + int (*echo_playback) (tmedia_denoise_t* self, const void* echo_frame, uint32_t echo_frame_size_bytes); + //! aec, vad, noise suppression, echo cancellation before sending packet over network + int (* process_record) (tmedia_denoise_t*, void* audio_frame, uint32_t audio_frame_size_bytes, tsk_bool_t* silence_or_noise); + //! noise suppression before playing sound + int (* process_playback) (tmedia_denoise_t*, void* audio_frame, uint32_t audio_frame_size_bytes); + int (* close) (tmedia_denoise_t* ); +} +tmedia_denoise_plugin_def_t; + +TINYMEDIA_API int tmedia_denoise_init(tmedia_denoise_t* self); +TINYMEDIA_API int tmedia_denoise_set(tmedia_denoise_t* self, const tmedia_param_t* param); +TINYMEDIA_API int tmedia_denoise_open(tmedia_denoise_t* self, uint32_t record_frame_size_samples, uint32_t record_sampling_rate, uint32_t record_channels, uint32_t playback_frame_size_samples, uint32_t playback_sampling_rate, uint32_t playback_channels); +TINYMEDIA_API int tmedia_denoise_echo_playback(tmedia_denoise_t* self, const void* echo_frame, uint32_t echo_frame_size_bytes); +TINYMEDIA_API int tmedia_denoise_process_record(tmedia_denoise_t* self, void* audio_frame, uint32_t audio_frame_size_bytes, tsk_bool_t* silence_or_noise); +TINYMEDIA_API int tmedia_denoise_process_playback(tmedia_denoise_t* self, void* audio_frame, uint32_t audio_frame_size_bytes); +TINYMEDIA_API int tmedia_denoise_close(tmedia_denoise_t* self); +TINYMEDIA_API int tmedia_denoise_deinit(tmedia_denoise_t* self); + +TINYMEDIA_API int tmedia_denoise_plugin_register(const tmedia_denoise_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_denoise_plugin_unregister(const tmedia_denoise_plugin_def_t* plugin); +TINYMEDIA_API tmedia_denoise_t* tmedia_denoise_create(); + +TMEDIA_END_DECLS + + +#endif /* TINYMEDIA_DENOISE_H */ |