From 2656fecceadddc7464c64bb9091d0c4e1ee4bf42 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.net> Date: Thu, 23 Apr 2009 14:48:45 -0400 Subject: [PATCH] Remove celt stuff --- sflphone-common/configure.ac | 21 --- sflphone-common/src/audio/codecs/Makefile.am | 19 +-- .../src/audio/codecs/celtcodec.cpp | 115 ------------- .../src/audio/codecs/speexcodec.cpp | 154 ------------------ 4 files changed, 3 insertions(+), 306 deletions(-) delete mode 100644 sflphone-common/src/audio/codecs/celtcodec.cpp delete mode 100644 sflphone-common/src/audio/codecs/speexcodec.cpp diff --git a/sflphone-common/configure.ac b/sflphone-common/configure.ac index 2a515125ae..ae0f806ec1 100644 --- a/sflphone-common/configure.ac +++ b/sflphone-common/configure.ac @@ -318,27 +318,6 @@ AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" ) AM_CONDITIONAL(ENABLE_SPEEXDSP, test $HAVE_SPEEXDSP = yes) -# check for libgsm1 (doesn't use pkg-config) -dnl Check for libgsm -AC_ARG_WITH([celt], - [AS_HELP_STRING([--without-celt], - [disable support for celt codec])], - [], - [with_celt=yes]) - -LIBCELT= -AS_IF([test "x$with_celt" != xno], - [AC_CHECK_HEADER([celt/celt.h], , AC_MSG_FAILURE([Unable to find the libcelt headers. You may use --without-celt to compile without celt codec support.]))] - [AC_CHECK_LIB([celt], [celt_decode], - [], - [AC_MSG_FAILURE( - [libcelt link test failed. You may use --without-celt to compile without celt codec support.])] - ) - ] - ) - -AC_DEFINE([HAVE_CELT], test "x$with_celt" = "xyes", [Define if you have libcelt]) -AM_CONDITIONAL(BUILD_CELT, test "x$with_celt" = "xyes" ) dnl Check for ilbc support AC_ARG_WITH([ilbc], diff --git a/sflphone-common/src/audio/codecs/Makefile.am b/sflphone-common/src/audio/codecs/Makefile.am index 45c1084ca2..e9a43dc1db 100644 --- a/sflphone-common/src/audio/codecs/Makefile.am +++ b/sflphone-common/src/audio/codecs/Makefile.am @@ -31,15 +31,6 @@ libcodec_speex_wb_so_LDFLAGS = --shared -lc -lspeex $(SPEEX_NIMP) INSTALL_SPEEX_WB_RULE = install-libcodec_speex_wb_so endif -if BUILD_CELT -CELT_LIB = libcodec_celt.so -libcodec_celt_so_SOURCES = celtcodec.cpp -libcodec_celt_so_CFLAGS = -fPIC -g -Wall -libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall -libcodec_celt_so_LDFLAGS = --shared -lc -lcelt $(CELT_NIMP) -INSTALL_CELT_RULE = install-libcodec_celt_so -endif - if BUILD_ILBC ILBC_LIB = libcodec_ilbc.so libcodec_ilbc_so_SOURCES = ilbc.cpp @@ -50,7 +41,7 @@ INSTALL_ILBC_RULE = install-libcodec_ilbc_so SUBDIRS = ilbc endif -noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so $(GSM_LIB) $(SPEEX_NB_LIB) $(SPEEX_WB_LIB) $(CELT_LIB) $(ILBC_LIB) +noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so $(GSM_LIB) $(SPEEX_NB_LIB) $(SPEEX_WB_LIB) $(ILBC_LIB) noinst_HEADERS = audiocodec.h @@ -66,8 +57,8 @@ libcodec_alaw_so_LDFLAGS = --shared -lc -install-exec-local: install-libcodec_ulaw_so install-libcodec_alaw_so $(INSTALL_GSM_RULE) $(INSTALL_SPEEX_NB_RULE) $(INSTALL_SPEEX_WB_RULE) $(INSTALL_CELT_RULE) $(INSTALL_ILBC_RULE) -uninstall-local: uninstall-libcodec_ulaw_so uninstall-libcodec_alaw_so uninstall-libcodec_gsm_so uninstall-libcodec_speex_nb_so uninstall-libcodec_speex_wb_so uninstall-libcodec_celt_so +install-exec-local: install-libcodec_ulaw_so install-libcodec_alaw_so $(INSTALL_GSM_RULE) $(INSTALL_SPEEX_NB_RULE) $(INSTALL_SPEEX_WB_RULE) $(INSTALL_ILBC_RULE) +uninstall-local: uninstall-libcodec_ulaw_so uninstall-libcodec_alaw_so uninstall-libcodec_gsm_so uninstall-libcodec_speex_nb_so uninstall-libcodec_speex_wb_so install-libcodec_ulaw_so: libcodec_ulaw.so mkdir -p $(sflcodecdir) @@ -80,8 +71,6 @@ install-libcodec_speex_nb_so: libcodec_speex_nb.so $(INSTALL_PROGRAM) libcodec_speex_nb.so $(sflcodecdir) install-libcodec_speex_wb_so: libcodec_speex_wb.so $(INSTALL_PROGRAM) libcodec_speex_wb.so $(sflcodecdir) -install-libcodec_celt_so: libcodec_celt.so - $(INSTALL_PROGRAM) libcodec_celt.so $(sflcodecdir) install-libcodec_ilbc_so: libcodec_ilbc.so $(INSTALL_PROGRAM) libcodec_ilbc.so $(sflcodecdir) @@ -96,8 +85,6 @@ uninstall-libcodec_speex_nb_so: rm -f $(sflcodecdir)/libcodec_speex_nb.so uninstall-libcodec_speex_wb_so: rm -f $(sflcodecdir)/libcodec_speex_wb.so -uninstall-libcodec_celt_so: - rm -f $(sflcodecdir)/libcodec_celt.so rm -rf $(sflcodecdir) uninstall-libcodec_ilbc_so: rm -f $(sflcodecdir)/libcodec_ilbc.so diff --git a/sflphone-common/src/audio/codecs/celtcodec.cpp b/sflphone-common/src/audio/codecs/celtcodec.cpp deleted file mode 100644 index 6be8d1553d..0000000000 --- a/sflphone-common/src/audio/codecs/celtcodec.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2007-2009 Savoir-Faire Linux inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "audiocodec.h" -#include <cstdio> -#include <celt/celt.h> - - -class Celt : public AudioCodec{ - public: - Celt(int payload=0) - : AudioCodec(payload, "celt") - { - _clockRate = 44100; - _frameSize = 512; // fixed frameSize, TODO: support 64 to 512 frame size - _channel = 1; - _bitrate = 0; - _bandwidth = 0; - initCelt(); - } - - Celt( const Celt& ); - Celt& operator=(const Celt&); - - void initCelt() { - printf("init celt"); - - mode = celt_mode_create(_clockRate, _channel, _frameSize, NULL); - // celt_mode_info(mode, CELT_GET_LOOKAHEAD, &skip); - - if (mode == NULL) - { - printf("failed to create a mode\n"); - } - - // bytes_per_packet = 1024; - // if (bytes_per_packet < 0 || bytes_per_packet > MAX_PACKET) - // { - // printf ("bytes per packet must be between 0 and %d\n"); - // } - - // celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size); - // celt_mode_info(mode, CELT_GET_NB_CHANNELS, &_channel); - - enc = celt_encoder_create(mode); - dec = celt_decoder_create(mode); - - celt_encoder_ctl(enc,CELT_SET_COMPLEXITY(8)); - - } - - ~Celt() - { - terminateCelt(); - } - - void terminateCelt() { - - celt_encoder_destroy(enc); - celt_decoder_destroy(dec); - } - - virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) - { - int err = 0; - err = celt_decode(dec, src, size, (celt_int16_t*)dst); - return _frameSize * sizeof(celt_int16_t); - } - - virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) - { - int len = 0; - len = celt_encode(enc, (celt_int16_t *)src, (celt_int16_t *)src, dst, 512); - // returns the number of bytes writen - return len; - } - - private: - - CELTMode *mode; - - CELTEncoder *enc; - CELTDecoder *dec; - - celt_int32_t _celt_frame_size; - celt_int32_t skip; - -}; - -// the class factories -extern "C" AudioCodec* create() { - return new Celt(115); -} - -extern "C" void destroy(AudioCodec* a) { - delete a; -} - diff --git a/sflphone-common/src/audio/codecs/speexcodec.cpp b/sflphone-common/src/audio/codecs/speexcodec.cpp deleted file mode 100644 index 07b81ed43f..0000000000 --- a/sflphone-common/src/audio/codecs/speexcodec.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2007-2009 Savoir-Faire Linux inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "audiocodec.h" -#include <cstdio> -#include <speex/speex.h> -#include <speex/speex_preprocess.h> - -class Speex : public AudioCodec{ - public: - Speex(int payload=0) - : AudioCodec(payload, "speex"), - _speexModePtr(NULL), - _speex_dec_bits(), - _speex_enc_bits(), - _speex_dec_state(), - _speex_enc_state(), - _speex_frame_size(), - _preprocess_state() - { - _clockRate = 16000; - _channel = 1; - _bitrate = 0; - _bandwidth = 0; - initSpeex(); - } - - Speex( const Speex& ); - Speex& operator=(const Speex&); - - void initSpeex() { - - int _samplingRate = 16000; - - // 8000 HZ --> Narrow-band mode - // TODO Manage the other modes - // _speexModePtr = &speex_nb_mode; - _speexModePtr = &speex_wb_mode; - - // Init the decoder struct - speex_bits_init(&_speex_dec_bits); - _speex_dec_state = speex_decoder_init(_speexModePtr); - - // Init the encoder struct - speex_bits_init(&_speex_enc_bits); - _speex_enc_state = speex_encoder_init(_speexModePtr); - - speex_encoder_ctl(_speex_enc_state,SPEEX_SET_SAMPLING_RATE,&_clockRate); - - speex_decoder_ctl(_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_frame_size); - -#ifdef HAVE_SPEEXDSP_LIB - - int enable = 1; - int quality = 10; - int complex = 10; - int attenuation = -10; - - speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VAD, &enable); - speex_encoder_ctl(_speex_enc_state, SPEEX_SET_DTX, &enable); - speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VBR_QUALITY, &quality); - speex_encoder_ctl(_speex_enc_state, SPEEX_SET_COMPLEXITY, &complex); - - // Init the decoder struct - speex_decoder_ctl(_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_frame_size); - - // Init the preprocess struct - _preprocess_state = speex_preprocess_state_init(_speex_frame_size,_clockRate); - speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_DENOISE, &enable); - speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &attenuation); - speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_VAD, &enable); - speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_AGC, &enable); -#endif - - } - - ~Speex() - { - terminateSpeex(); - } - - void terminateSpeex() { - // Destroy the decoder struct - speex_bits_destroy(&_speex_dec_bits); - speex_decoder_destroy(_speex_dec_state); - _speex_dec_state = 0; - - // Destroy the encoder struct - speex_bits_destroy(&_speex_enc_bits); - speex_encoder_destroy(_speex_enc_state); - _speex_enc_state = 0; - } - - virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) - { - - int ratio = 320 / _speex_frame_size; - speex_bits_read_from(&_speex_dec_bits, (char*)src, size); - speex_decode_int(_speex_dec_state, &_speex_dec_bits, dst); - - return 2 * _speex_frame_size * ratio; - } - - virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) - { - speex_bits_reset(&_speex_enc_bits); - -#ifdef HAVE_SPEEXDSP_LIB - - speex_preprocess_run(_preprocess_state, src); -#endif - - speex_encode_int(_speex_enc_state, src, &_speex_enc_bits); - int nbBytes = speex_bits_write(&_speex_enc_bits, (char*)dst, size); - printf("Codec::codecEncode() nbBytes: %i \n",nbBytes); - return nbBytes; - } - - private: - const SpeexMode* _speexModePtr; - SpeexBits _speex_dec_bits; - SpeexBits _speex_enc_bits; - void *_speex_dec_state; - void *_speex_enc_state; - int _speex_frame_size; - SpeexPreprocessState *_preprocess_state; -}; - -// the class factories -extern "C" AudioCodec* create() { - return new Speex(111); -} - -extern "C" void destroy(AudioCodec* a) { - delete a; -} - -- GitLab