Hello community, here is the log from the commit of package ccaudio2 checked in at Tue Aug 15 18:22:56 CEST 2006. -------- --- ccaudio2/ccaudio2.changes 2006-07-18 18:26:59.000000000 +0200 +++ ccaudio2/ccaudio2.changes 2006-08-15 15:13:30.000000000 +0200 @@ -1,0 +2,10 @@ +Tue Aug 15 15:09:04 CEST 2006 - kkeil@suse.de + +- update to 0.9.9 + * fix for adpcm audio codec + * g.723 codecs, additional file name rules for .a24/.a32/.a40 + * combined g.721/723 codecs into new adpcm.codec module +- fix const declaration for speex codec +- compile C++ with RPM_OPT_FLAGS + +------------------------------------------------------------------- Old: ---- ccaudio2-0.9.7.tar.bz2 New: ---- ccaudio2-0.9.9-const.patch ccaudio2-0.9.9.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ccaudio2.spec ++++++ --- /var/tmp/diff_new_pack.DV5tl3/_old 2006-08-15 18:22:39.000000000 +0200 +++ /var/tmp/diff_new_pack.DV5tl3/_new 2006-08-15 18:22:39.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package ccaudio2 (Version 0.9.7) +# spec file for package ccaudio2 (Version 0.9.9) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,7 +11,7 @@ # norootforbuild Name: ccaudio2 -BuildRequires: commoncpp2-devel gcc-c++ libgsm-devel speex-devel +BuildRequires: commoncpp2-devel gcc-c++ glibc-devel libgsm-devel speex-devel URL: http://www.gnu.org/software/ccaudio/ License: GPL Group: System/Libraries @@ -20,9 +20,10 @@ Provides: ccaudio Obsoletes: ccaudio Summary: a C++ class framework for processing audio files -Version: 0.9.7 +Version: 0.9.9 Release: 1 -Source: ccaudio2-%{version}.tar.bz2 +Source: %{name}-%{version}.tar.bz2 +Patch: %{name}-%{version}-const.patch %description The GNU ccAudio2 package offers a highly portable C++ class framework @@ -59,10 +60,11 @@ %prep %setup -n ccaudio2-%{version} +%patch -p1 %build autoreconf --force --install -CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} \ +CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} \ --libdir=%{_prefix}/%_lib --mandir=%{_mandir} --infodir=%{_infodir} --disable-static --disable-gsm make @@ -97,6 +99,13 @@ %{_mandir}/man1/*.1* %changelog -n ccaudio2 +* Tue Aug 15 2006 - kkeil@suse.de +- update to 0.9.9 + * fix for adpcm audio codec + * g.723 codecs, additional file name rules for .a24/.a32/.a40 + * combined g.721/723 codecs into new adpcm.codec module +- fix const declaration for speex codec +- compile C++ with RPM_OPT_FLAGS * Tue Jul 18 2006 - kkaempf@suse.de - update to 0.9.7 - g721 adpcm codec added ++++++ ccaudio2-0.9.9-const.patch ++++++ Index: ccaudio2-0.9.9/codecs/speex.cpp =================================================================== --- ccaudio2-0.9.9.orig/codecs/speex.cpp +++ ccaudio2-0.9.9/codecs/speex.cpp @@ -48,7 +48,7 @@ using namespace ost; class SpeexCommon: public AudioCodec { protected: - SpeexMode *spx_mode; + const SpeexMode *spx_mode; SpeexBits enc_bits, dec_bits; unsigned int spx_clock, spx_channel; void *encoder, *decoder; ++++++ ccaudio2-0.9.7.tar.bz2 -> ccaudio2-0.9.9.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/ChangeLog new/ccaudio2-0.9.9/ChangeLog --- old/ccaudio2-0.9.7/ChangeLog 2006-06-07 04:52:13.000000000 +0200 +++ new/ccaudio2-0.9.9/ChangeLog 2006-07-20 18:00:59.000000000 +0200 @@ -1,3 +1,10 @@ +Changes from 0.9.8 to 0.9.9 +- g.723 codecs, additional file name rules for .a24/.a32/.a40 +- combined g.721/723 codecs into new adpcm.codec module + +Changes from 0.9.7 to 0.9.8 +- fix for adpcm audio codec + Changes from 0.9.6 to 0.9.7 - fix for timing base of gsm audio diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/ccaudio2.list new/ccaudio2-0.9.9/ccaudio2.list --- old/ccaudio2-0.9.7/ccaudio2.list 2006-06-07 04:56:03.000000000 +0200 +++ new/ccaudio2-0.9.9/ccaudio2.list 2006-07-20 19:04:57.000000000 +0200 @@ -14,7 +14,7 @@ # Product information %product GNU ccAudio Framework -%version 0.9.7 -100 +%version 0.9.9 -100 %copyright 1999-2003 Open Source Telecom Corporation %vendor Open Source Telecom Corp %license COPYING @@ -30,9 +30,9 @@ d 0755 root root ${codecdir} f 0644 root root ${codecdir}/g.711 ./codecs/g.711 %system darwin -f 0644 root root ${libdir} ./src/.libs/libccaudio2-0.9.7.dylib -l 0644 root root ${libdir}/libccaudio2.dylib libccaudio2-0.9.7.dylib -l 0644 root root ${libdir}/libccaudio2.dylib-0.9.7.@LT_SUBVER@.dylib libccaudio2-0.9.7.dylib +f 0644 root root ${libdir} ./src/.libs/libccaudio2-0.9.9.dylib +l 0644 root root ${libdir}/libccaudio2.dylib libccaudio2-0.9.9.dylib +l 0644 root root ${libdir}/libccaudio2.dylib-0.9.9.@LT_SUBVER@.dylib libccaudio2-0.9.9.dylib %system freebsd f 0644 root root ${libdir} ./src/.libs/libccaudio2-0.9.so.* %system linux solaris diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/ccaudio2.spec new/ccaudio2-0.9.9/ccaudio2.spec --- old/ccaudio2-0.9.7/ccaudio2.spec 2006-06-07 04:56:03.000000000 +0200 +++ new/ccaudio2-0.9.9/ccaudio2.spec 2006-07-20 19:04:57.000000000 +0200 @@ -1,6 +1,6 @@ Summary: GNU ccAudio2 - a C++ class framework for processing audio files. Name: ccaudio2 -Version: 0.9.7 +Version: 0.9.9 Release: 1 Group: Development/Libraries URL: http://www.gnu.org/software/ccaudio diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/codecs/Makefile.am new/ccaudio2-0.9.9/codecs/Makefile.am --- old/ccaudio2-0.9.7/codecs/Makefile.am 2006-05-23 14:52:58.000000000 +0200 +++ new/ccaudio2-0.9.9/codecs/Makefile.am 2006-07-20 17:59:22.000000000 +0200 @@ -15,7 +15,7 @@ noinst_HEADERS = codecs.h if MODULES -pkglib_PROGRAMS = g.711.codec g.721.codec oki.codec +pkglib_PROGRAMS = g.711.codec adpcm.codec oki.codec if GSM_CODEC pkglib_PROGRAMS += gsm.codec @@ -30,8 +30,8 @@ oki_codec_SOURCES = oki.cpp oki_codec_LDFLAGS = @MODULE_FLAGS@ -lm -g_721_codec_SOURCES = g721.cpp -g_721_codec_LDFLAGS = @MODULE_FLAGS@ -lm +adpcm_codec_SOURCES = adpcm.cpp +adpcm_codec_LDFLAGS = @MODULE_FLAGS@ -lm g_711_codec_SOURCES = g711.cpp g_711_codec_LDFLAGS = @MODULE_FLAGS@ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/codecs/Makefile.in new/ccaudio2-0.9.9/codecs/Makefile.in --- old/ccaudio2-0.9.7/codecs/Makefile.in 2006-06-07 04:55:51.000000000 +0200 +++ new/ccaudio2-0.9.9/codecs/Makefile.in 2006-07-20 19:04:41.000000000 +0200 @@ -48,7 +48,7 @@ host_triplet = @host@ target_triplet = @target@ @MODULES_TRUE@pkglib_PROGRAMS = g.711.codec$(EXEEXT) \ -@MODULES_TRUE@ g.721.codec$(EXEEXT) oki.codec$(EXEEXT) \ +@MODULES_TRUE@ adpcm.codec$(EXEEXT) oki.codec$(EXEEXT) \ @MODULES_TRUE@ $(am__EXEEXT_1) $(am__EXEEXT_2) @GSM_CODEC_TRUE@@MODULES_TRUE@am__append_1 = gsm.codec @MODULES_TRUE@@SPEEX_CODEC_TRUE@am__append_2 = speex.codec @@ -71,16 +71,16 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" pkglibPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(pkglib_PROGRAMS) +am__adpcm_codec_SOURCES_DIST = adpcm.cpp +@MODULES_TRUE@am_adpcm_codec_OBJECTS = adpcm.$(OBJEXT) +adpcm_codec_OBJECTS = $(am_adpcm_codec_OBJECTS) +adpcm_codec_LDADD = $(LDADD) +adpcm_codec_DEPENDENCIES = ../src/libccaudio2.la am__g_711_codec_SOURCES_DIST = g711.cpp @MODULES_TRUE@am_g_711_codec_OBJECTS = g711.$(OBJEXT) g_711_codec_OBJECTS = $(am_g_711_codec_OBJECTS) g_711_codec_LDADD = $(LDADD) g_711_codec_DEPENDENCIES = ../src/libccaudio2.la -am__g_721_codec_SOURCES_DIST = g721.cpp -@MODULES_TRUE@am_g_721_codec_OBJECTS = g721.$(OBJEXT) -g_721_codec_OBJECTS = $(am_g_721_codec_OBJECTS) -g_721_codec_LDADD = $(LDADD) -g_721_codec_DEPENDENCIES = ../src/libccaudio2.la am__gsm_codec_SOURCES_DIST = gsm.cpp @GSM_CODEC_TRUE@@MODULES_TRUE@am_gsm_codec_OBJECTS = gsm.$(OBJEXT) gsm_codec_OBJECTS = $(am_gsm_codec_OBJECTS) @@ -108,11 +108,11 @@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(g_711_codec_SOURCES) $(g_721_codec_SOURCES) \ +SOURCES = $(adpcm_codec_SOURCES) $(g_711_codec_SOURCES) \ $(gsm_codec_SOURCES) $(oki_codec_SOURCES) \ $(speex_codec_SOURCES) -DIST_SOURCES = $(am__g_711_codec_SOURCES_DIST) \ - $(am__g_721_codec_SOURCES_DIST) $(am__gsm_codec_SOURCES_DIST) \ +DIST_SOURCES = $(am__adpcm_codec_SOURCES_DIST) \ + $(am__g_711_codec_SOURCES_DIST) $(am__gsm_codec_SOURCES_DIST) \ $(am__oki_codec_SOURCES_DIST) $(am__speex_codec_SOURCES_DIST) HEADERS = $(noinst_HEADERS) ETAGS = etags @@ -253,8 +253,8 @@ @MODULES_TRUE@AM_CPPFLAGS = -I../src -I$(top_srcdir)/src -fPIC -DPIC @MODULES_TRUE@oki_codec_SOURCES = oki.cpp @MODULES_TRUE@oki_codec_LDFLAGS = @MODULE_FLAGS@ -lm -@MODULES_TRUE@g_721_codec_SOURCES = g721.cpp -@MODULES_TRUE@g_721_codec_LDFLAGS = @MODULE_FLAGS@ -lm +@MODULES_TRUE@adpcm_codec_SOURCES = adpcm.cpp +@MODULES_TRUE@adpcm_codec_LDFLAGS = @MODULE_FLAGS@ -lm @MODULES_TRUE@g_711_codec_SOURCES = g711.cpp @MODULES_TRUE@g_711_codec_LDFLAGS = @MODULE_FLAGS@ @GSM_CODEC_TRUE@@MODULES_TRUE@gsm_codec_SOURCES = gsm.cpp @@ -322,12 +322,12 @@ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done +adpcm.codec$(EXEEXT): $(adpcm_codec_OBJECTS) $(adpcm_codec_DEPENDENCIES) + @rm -f adpcm.codec$(EXEEXT) + $(CXXLINK) $(adpcm_codec_LDFLAGS) $(adpcm_codec_OBJECTS) $(adpcm_codec_LDADD) $(LIBS) g.711.codec$(EXEEXT): $(g_711_codec_OBJECTS) $(g_711_codec_DEPENDENCIES) @rm -f g.711.codec$(EXEEXT) $(CXXLINK) $(g_711_codec_LDFLAGS) $(g_711_codec_OBJECTS) $(g_711_codec_LDADD) $(LIBS) -g.721.codec$(EXEEXT): $(g_721_codec_OBJECTS) $(g_721_codec_DEPENDENCIES) - @rm -f g.721.codec$(EXEEXT) - $(CXXLINK) $(g_721_codec_LDFLAGS) $(g_721_codec_OBJECTS) $(g_721_codec_LDADD) $(LIBS) gsm.codec$(EXEEXT): $(gsm_codec_OBJECTS) $(gsm_codec_DEPENDENCIES) @rm -f gsm.codec$(EXEEXT) $(CXXLINK) $(gsm_codec_LDFLAGS) $(gsm_codec_OBJECTS) $(gsm_codec_LDADD) $(LIBS) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/codecs/adpcm.cpp new/ccaudio2-0.9.9/codecs/adpcm.cpp --- old/ccaudio2-0.9.7/codecs/adpcm.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/ccaudio2-0.9.9/codecs/adpcm.cpp 2006-07-20 19:04:02.000000000 +0200 @@ -0,0 +1,920 @@ +// Copyright (C) 1999-2001 Open Source Telecom Corporation. +// +// 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// As a special exception to the GNU General Public License, permission is +// granted for additional uses of the text contained in its release +// of ccaudio. +// +// The exception is that, if you link the ccaudio library with other +// files to produce an executable, this does not by itself cause the +// resulting executable to be covered by the GNU General Public License. +// Your use of that executable is in no way restricted on account of +// linking the ccaudio library code into it. +// +// This exception does not however invalidate any other reasons why +// the executable file might be covered by the GNU General Public License. +// +// This exception applies only to the code released under the +// name ccaudio. If you copy code from other releases into a copy of +// ccaudio, as the General Public License permits, the exception does +// not apply to the code that you add in this way. To avoid misleading +// anyone as to the status of such modified files, you must delete +// this exception notice from them. +// +// If you write modifications of your own for ccaudio, it is your choice +// whether to permit this exception to apply to your modifications. +// If you do not wish that, delete this exception notice. +// +// Based on freely licensed g72x codec code from Sun Microsystems, Inc. + + +#include "codecs.h" + +namespace ccAudioCodec { +using namespace ost; + +static short power2[15] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80, + 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000}; + +typedef struct state +{ + long yl; + short yu; + short dms; + short dml; + short ap; + short a[2]; + short b[6]; + short pk[2]; + short dq[6]; + short sr[2]; + char td; +} state_t; + +static int quan( + int val, + short *table, + int size) +{ + int i; + + for (i = 0; i < size; i++) + if (val < *table++) + break; + return (i); +} + +static int quantize( + int d, /* Raw difference signal sample */ + int y, /* Step size multiplier */ + short *table, /* quantization table */ + int size) /* table size of short integers */ +{ + short dqm; /* Magnitude of 'd' */ + short exp; /* Integer part of base 2 log of 'd' */ + short mant; /* Fractional part of base 2 log */ + short dl; /* Log of magnitude of 'd' */ + short dln; /* Step size scale factor normalized log */ + int i; + + /* + * LOG + * + * Compute base 2 log of 'd', and store in 'dl'. + */ + dqm = abs(d); + exp = quan(dqm >> 1, power2, 15); + mant = ((dqm << 7) >> exp) & 0x7F; /* Fractional portion. */ + dl = (exp << 7) + mant; + + /* + * SUBTB + * + * "Divide" by step size multiplier. + */ + dln = dl - (y >> 2); + + /* + * QUAN + * + * Obtain codword i for 'd'. + */ + i = quan(dln, table, size); + if (d < 0) /* take 1's complement of i */ + return ((size << 1) + 1 - i); + else if (i == 0) /* take 1's complement of 0 */ + return ((size << 1) + 1); /* new in 1988 */ + else + return (i); +} + +static int fmult( + int an, + int srn) +{ + short anmag, anexp, anmant; + short wanexp, wanmant; + short retval; + + anmag = (an > 0) ? an : ((-an) & 0x1FFF); + anexp = quan(anmag, power2, 15) - 6; + anmant = (anmag == 0) ? 32 : + (anexp >= 0) ? anmag >> anexp : anmag << -anexp; + wanexp = anexp + ((srn >> 6) & 0xF) - 13; + + wanmant = (anmant * (srn & 077) + 0x30) >> 4; + retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) : + (wanmant >> -wanexp); + + return (((an ^ srn) < 0) ? -retval : retval); +} + +static int reconstruct( + int sign, /* 0 for non-negative value */ + int dqln, /* G.72x codeword */ + int y) /* Step size multiplier */ +{ + short dql; /* Log of 'dq' magnitude */ + short dex; /* Integer part of log */ + short dqt; + short dq; /* Reconstructed difference signal sample */ + + dql = dqln + (y >> 2); /* ADDA */ + + if (dql < 0) { + return ((sign) ? -0x8000 : 0); + } else { /* ANTILOG */ + dex = (dql >> 7) & 15; + dqt = 128 + (dql & 127); + dq = (dqt << 7) >> (14 - dex); + return ((sign) ? (dq - 0x8000) : dq); + } +} + +static void update( + int code_size, /* distinguish 723_40 with others */ + int y, /* quantizer step size */ + int wi, /* scale factor multiplier */ + int fi, /* for long/short term energies */ + int dq, /* quantized prediction difference */ + int sr, /* reconstructed signal */ + int dqsez, /* difference from 2-pole predictor */ + state_t *state_ptr) /* coder state pointer */ +{ + int cnt; + short mag, exp; /* Adaptive predictor, FLOAT A */ + short a2p = 0; /* LIMC */ + short a1ul; /* UPA1 */ + short pks1; /* UPA2 */ + short fa1; + char tr; /* tone/transition detector */ + short ylint, thr2, dqthr; + short ylfrac, thr1; + short pk0; + + pk0 = (dqsez < 0) ? 1 : 0; /* needed in updating predictor poles */ + + mag = dq & 0x7FFF; /* prediction difference magnitude */ + /* TRANS */ + ylint = (short)(state_ptr->yl >> 15); /* exponent part of yl */ + ylfrac = (state_ptr->yl >> 10) & 0x1F; /* fractional part of yl */ + thr1 = (32 + ylfrac) << ylint; /* threshold */ + thr2 = (short)((ylint > 9) ? 31 << 10 : thr1); /* limit thr2 to 31 << 10 */ + dqthr = (thr2 + (thr2 >> 1)) >> 1; /* dqthr = 0.75 * thr2 */ + if (state_ptr->td == 0) /* signal supposed voice */ + tr = 0; + else if (mag <= dqthr) /* supposed data, but small mag */ + tr = 0; /* treated as voice */ + else /* signal is data (modem) */ + tr = 1; + + /* + * Quantizer scale factor adaptation. + */ + + /* FUNCTW & FILTD & DELAY */ + /* update non-steady state step size multiplier */ + state_ptr->yu = y + ((wi - y) >> 5); + + /* LIMB */ + if (state_ptr->yu < 544) /* 544 <= yu <= 5120 */ + state_ptr->yu = 544; + else if (state_ptr->yu > 5120) + state_ptr->yu = 5120; + + /* FILTE & DELAY */ + /* update steady state step size multiplier */ + state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6); + + /* + * Adaptive predictor coefficients. + */ + if (tr == 1) { /* reset a's and b's for modem signal */ + state_ptr->a[0] = 0; + state_ptr->a[1] = 0; + state_ptr->b[0] = 0; + state_ptr->b[1] = 0; + state_ptr->b[2] = 0; + state_ptr->b[3] = 0; + state_ptr->b[4] = 0; + state_ptr->b[5] = 0; + } else { /* update a's and b's */ + pks1 = pk0 ^ state_ptr->pk[0]; /* UPA2 */ + + /* update predictor pole a[1] */ + a2p = state_ptr->a[1] - (state_ptr->a[1] >> 7); + if (dqsez != 0) { + fa1 = (pks1) ? state_ptr->a[0] : -state_ptr->a[0]; + if (fa1 < -8191) /* a2p = function of fa1 */ + a2p -= 0x100; + else if (fa1 > 8191) + a2p += 0xFF; + else + a2p += fa1 >> 5; + + if (pk0 ^ state_ptr->pk[1]) + /* LIMC */ + if (a2p <= -12160) + a2p = -12288; + else if (a2p >= 12416) + a2p = 12288; + else + a2p -= 0x80; + else if (a2p <= -12416) + a2p = -12288; + else if (a2p >= 12160) + a2p = 12288; + else + a2p += 0x80; + } + + /* TRIGB & DELAY */ + state_ptr->a[1] = a2p; + + /* UPA1 */ + /* update predictor pole a[0] */ + state_ptr->a[0] -= state_ptr->a[0] >> 8; + if (dqsez != 0) + if (pks1 == 0) + state_ptr->a[0] += 192; + else + state_ptr->a[0] -= 192; + + /* LIMD */ + a1ul = 15360 - a2p; + if (state_ptr->a[0] < -a1ul) + state_ptr->a[0] = -a1ul; + else if (state_ptr->a[0] > a1ul) + state_ptr->a[0] = a1ul; + + /* UPB : update predictor zeros b[6] */ + for (cnt = 0; cnt < 6; cnt++) { + if (code_size == 5) /* for 40Kbps G.723 */ + state_ptr->b[cnt] -= state_ptr->b[cnt] >> 9; + else /* for G.721 and 24Kbps G.723 */ + state_ptr->b[cnt] -= state_ptr->b[cnt] >> 8; + if (dq & 0x7FFF) { /* XOR */ + if ((dq ^ state_ptr->dq[cnt]) >= 0) + state_ptr->b[cnt] += 128; + else + state_ptr->b[cnt] -= 128; + } + } + } + + for (cnt = 5; cnt > 0; cnt--) + state_ptr->dq[cnt] = state_ptr->dq[cnt-1]; + /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */ + if (mag == 0) { + state_ptr->dq[0] = (dq >= 0) ? 0x20 : 0xFC20; + } else { + exp = quan(mag, power2, 15); + state_ptr->dq[0] = (dq >= 0) ? + (exp << 6) + ((mag << 6) >> exp) : + (exp << 6) + ((mag << 6) >> exp) - 0x400; + } + + state_ptr->sr[1] = state_ptr->sr[0]; + /* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */ + if (sr == 0) { + state_ptr->sr[0] = 0x20; + } else if (sr > 0) { + exp = quan(sr, power2, 15); + state_ptr->sr[0] = (exp << 6) + ((sr << 6) >> exp); + } else if (sr > -32768) { + mag = -sr; + exp = quan(mag, power2, 15); + state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400; + } else + state_ptr->sr[0] = (short)0xFC20; + + /* DELAY A */ + state_ptr->pk[1] = state_ptr->pk[0]; + state_ptr->pk[0] = pk0; + + /* TONE */ + if (tr == 1) /* this sample has been treated as data */ + state_ptr->td = 0; /* next one will be treated as voice */ + else if (a2p < -11776) /* small sample-to-sample correlation */ + state_ptr->td = 1; /* signal may be data */ + else /* signal is voice */ + state_ptr->td = 0; + + /* + * Adaptation speed control. + */ + state_ptr->dms += (fi - state_ptr->dms) >> 5; /* FILTA */ + state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7); /* FILTB */ + + if (tr == 1) + state_ptr->ap = 256; + else if (y < 1536) /* SUBTC */ + state_ptr->ap += (0x200 - state_ptr->ap) >> 4; + else if (state_ptr->td == 1) + state_ptr->ap += (0x200 - state_ptr->ap) >> 4; + else if (abs((state_ptr->dms << 2) - state_ptr->dml) >= + (state_ptr->dml >> 3)) + state_ptr->ap += (0x200 - state_ptr->ap) >> 4; + else + state_ptr->ap += (-state_ptr->ap) >> 4; +} + +static int predictor_zero( + state_t *state_ptr) +{ + int i; + int sezi; + + sezi = fmult(state_ptr->b[0] >> 2, state_ptr->dq[0]); + for (i = 1; i < 6; i++) /* ACCUM */ + sezi += fmult(state_ptr->b[i] >> 2, state_ptr->dq[i]); + return (sezi); +} + +static int predictor_pole( + state_t *state_ptr) +{ + return (fmult(state_ptr->a[1] >> 2, state_ptr->sr[1]) + + fmult(state_ptr->a[0] >> 2, state_ptr->sr[0])); +} + +static int step_size( + state_t *state_ptr) +{ + int y; + int dif; + int al; + + if (state_ptr->ap >= 256) + return (state_ptr->yu); + else { + y = state_ptr->yl >> 6; + dif = state_ptr->yu - y; + al = state_ptr->ap >> 2; + if (dif > 0) + y += (dif * al) >> 6; + else if (dif < 0) + y += (dif * al + 0x3F) >> 6; + return (y); + } +} + +class g721Codec : public AudioCodec +{ +private: + static short _dqlntab[16]; + static short _witab[16]; + static short _fitab[16]; + static short qtab_721[7]; + + state_t encode_state, decode_state; + +public: + AudioCodec *getByInfo(Info &info); + AudioCodec *getByFormat(const char *format); + + unsigned decode(Linear buffer, void *from, unsigned lsamples); + unsigned encode(Linear buffer, void *dest, unsigned lsamples); + short coder(state_t *state, int nib); + unsigned char encoder(short sl, state_t *state); + + g721Codec(const char *id, Encoding e); + g721Codec(); + ~g721Codec(); +}; + + +class g723_3Codec : public AudioCodec +{ +private: + static short _dqlntab[8]; + static short _witab[8]; + static short _fitab[8]; + static short qtab_723_24[3]; + + state_t encode_state, decode_state; + +public: + AudioCodec *getByInfo(Info &info); + AudioCodec *getByFormat(const char *format); + + unsigned decode(Linear buffer, void *from, unsigned lsamples); + unsigned encode(Linear buffer, void *dest, unsigned lsamples); + short coder(state_t *state, int nib); + unsigned char encoder(short sl, state_t *state); + + g723_3Codec(const char *id, Encoding e); + g723_3Codec(); + ~g723_3Codec(); +}; + + +class g723_5Codec : public AudioCodec +{ +private: + static short _dqlntab[32]; + static short _witab[32]; + static short _fitab[32]; + static short qtab_723_40[15]; + + state_t encode_state, decode_state; + +public: + AudioCodec *getByInfo(Info &info); + AudioCodec *getByFormat(const char *format); + + unsigned decode(Linear buffer, void *from, unsigned lsamples); + unsigned encode(Linear buffer, void *dest, unsigned lsamples); + short coder(state_t *state, int nib); + unsigned char encoder(short sl, state_t *state); + + g723_5Codec(const char *id, Encoding e); + g723_5Codec(); + ~g723_5Codec(); +}; + + +short g723_3Codec::_dqlntab[8] = {-2048, 135, 273, 373, 373, 273, 135, -2048}; +short g723_3Codec::_witab[8] = {-128, 960, 4384, 18624, 18624, 4384, 960, -128}; +short g723_3Codec::_fitab[8] = {0, 0x200, 0x400, 0xE00, 0xE00, 0x400, 0x200, 0}; +short g723_3Codec::qtab_723_24[3] = {8, 218, 331}; + +short g723_5Codec::_dqlntab[32] = {-2048, -66, 28, 104, 169, 224, 274, 318, + 358, 395, 429, 459, 488, 514, 539, 566, + 566, 539, 514, 488, 459, 429, 395, 358, + 318, 274, 224, 169, 104, 28, -66, -2048}; + +short g723_5Codec::_witab[32] = {448, 448, 768, 1248, 1280, 1312, 1856, 3200, + 4512, 5728, 7008, 8960, 11456, 14080, 16928, 22272, + 22272, 16928, 14080, 11456, 8960, 7008, 5728, 4512, + 3200, 1856, 1312, 1280, 1248, 768, 448, 448}; + +short g723_5Codec::_fitab[32] = {0, 0, 0, 0, 0, 0x200, 0x200, 0x200, + 0x200, 0x200, 0x400, 0x600, 0x800, 0xA00, 0xC00, 0xC00, + 0xC00, 0xC00, 0xA00, 0x800, 0x600, 0x400, 0x200, 0x200, + 0x200, 0x200, 0x200, 0, 0, 0, 0, 0}; + +short g723_5Codec::qtab_723_40[15] = {-122, -16, 68, 139, 198, 250, 298, 339, + 378, 413, 445, 475, 502, 528, 553}; + + +short g721Codec::_dqlntab[16] = {-2048, 4, 135, 213, 273, 323, 373, 425, + 425, 373, 323, 273, 213, 135, 4, -2048}; +short g721Codec::_witab[16] = {-12, 18, 41, 64, 112, 198, 355, 1122, + 1122, 355, 198, 112, 64, 41, 18, -12}; +short g721Codec::_fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00, + 0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0}; +short g721Codec::qtab_721[7] = {-124, 80, 178, 246, 300, 349, 400}; + +g723_3Codec::g723_3Codec() : AudioCodec() +{ + unsigned pos; + + info.framesize = 3; + info.framecount = 8; + info.bitrate = 24000; + info.encoding = g723_3bit; + info.annotation = "g.723"; + info.rate = 8000; + memset(&encode_state, 0, sizeof(encode_state)); + memset(&decode_state, 0, sizeof(decode_state)); + encode_state.yl = decode_state.yl = 34816; + encode_state.yu = decode_state.yu = 544; + encode_state.sr[0] = encode_state.sr[1] = decode_state.sr[0] = decode_state.sr[1] = 32; + + for(pos = 0; pos < 6; ++pos) + encode_state.dq[pos] = decode_state.dq[pos] = 32; +} + +g723_3Codec::g723_3Codec(const char *id, Encoding e) : AudioCodec(id, e) +{ + info.framesize = 3; + info.framecount = 8; + info.bitrate = 24000; + info.rate = 8000; + info.annotation = "g.723"; +} + +g723_3Codec::~g723_3Codec() +{} + + +unsigned char g723_3Codec::encoder(short sl, state_t *state_ptr) +{ + short sezi, se, sez, sei; + short d, sr, y, dqsez, dq, i; + + sl >>= 2; + + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + d = sl - se; /* d = estimation diff. */ + + /* quantize prediction difference d */ + y = step_size(state_ptr); /* quantizer step size */ + i = quantize(d, y, qtab_723_24, 3); /* i = ADPCM code */ + dq = reconstruct(i & 4, _dqlntab[i], y); /* quantized diff. */ + + sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */ + dqsez = sr + sez - se; /* pole prediction diff. */ + + update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + return (unsigned char)(i); +} + +short g723_3Codec::coder(state_t *state_ptr, int i) +{ + short sezi, sei, sez, se; + short y, sr, dq, dqsez; + + i &= 0x07; /* mask to get proper bits */ + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + y = step_size(state_ptr); /* adaptive quantizer step size */ + dq = reconstruct(i & 0x04, _dqlntab[i], y); /* unquantize pred diff */ + + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */ + + dqsez = sr - se + sez; /* pole prediction diff. */ + + update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + + return sr << 2; +} + +unsigned g723_3Codec::encode(Linear buffer, void *coded, unsigned lsamples) +{ + unsigned count = (lsamples / 8); + Encoded dest = (Encoded)coded; + unsigned i, data, byte, bits; + + while(count--) + { + bits = 0; + data = 0; + for(i = 0; i < 8; ++i) + { + byte = encoder(*(buffer++), &encode_state); + data |= (byte << bits); + bits += 3; + if(bits >= 8) + { + *(dest++) = (data & 0xff); + bits -= 8; + data >>= 8; + } + } + } + return (lsamples / 8) * 8; +} + +unsigned g723_3Codec::decode(Linear buffer, void *from, unsigned lsamples) +{ + Encoded src = (Encoded)from; + unsigned count = (lsamples / 8) * 8; + unsigned char byte, nib; + unsigned bits = 0, data = 0; + + while(count--) + { + if(bits < 3) + { + byte = *(src++); + data |= (byte << bits); + bits += 8; + } + nib = data & 0x07; + data >>= 3; + bits -= 3; + *(buffer++) = coder(&decode_state, nib); + } + return (lsamples / 8) * 8; +} + +AudioCodec *g723_3Codec::getByInfo(Info &info) +{ + return (AudioCodec *)new g723_3Codec(); +} + +AudioCodec *g723_3Codec::getByFormat(const char *format) +{ + return (AudioCodec *)new g723_3Codec(); +} + +g723_5Codec::g723_5Codec() : AudioCodec() +{ + unsigned pos; + + info.framesize = 5; + info.framecount = 8; + info.bitrate = 40000; + info.encoding = g723_5bit; + info.annotation = "g.723"; + info.rate = 8000; + memset(&encode_state, 0, sizeof(encode_state)); + memset(&decode_state, 0, sizeof(decode_state)); + encode_state.yl = decode_state.yl = 34816; + encode_state.yu = decode_state.yu = 544; + encode_state.sr[0] = encode_state.sr[1] = decode_state.sr[0] = decode_state.sr[1] = 32; + + for(pos = 0; pos < 6; ++pos) + encode_state.dq[pos] = decode_state.dq[pos] = 32; +} + +g723_5Codec::g723_5Codec(const char *id, Encoding e) : AudioCodec(id, e) +{ + info.framesize = 5; + info.framecount = 8; + info.bitrate = 40000; + info.rate = 8000; + info.annotation = "g.723"; +} + +g723_5Codec::~g723_5Codec() +{} + +unsigned char g723_5Codec::encoder(short sl, state_t *state_ptr) +{ + short sei, sezi, se, sez; /* ACCUM */ + short d; /* SUBTA */ + short y; /* MIX */ + short sr; /* ADDB */ + short dqsez; /* ADDC */ + short dq, i; + + sl >>= 2; + + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + d = sl - se; /* d = estimation difference */ + + /* quantize prediction difference */ + y = step_size(state_ptr); /* adaptive quantizer step size */ + i = quantize(d, y, qtab_723_40, 15); /* i = ADPCM code */ + + dq = reconstruct(i & 0x10, _dqlntab[i], y); /* quantized diff */ + + sr = (dq < 0) ? se - (dq & 0x7FFF) : se + dq; /* reconstructed signal */ + dqsez = sr + sez - se; /* dqsez = pole prediction diff. */ + + update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + + return (unsigned char)(i); +} + +short g723_5Codec::coder(state_t *state_ptr, int i) +{ + short sezi, sei, sez, se; /* ACCUM */ + short y; /* MIX */ + short sr; /* ADDB */ + short dq; + short dqsez; + + i &= 0x1f; /* mask to get proper bits */ + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + y = step_size(state_ptr); /* adaptive quantizer step size */ + dq = reconstruct(i & 0x10, _dqlntab[i], y); /* estimation diff. */ + + sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq); /* reconst. signal */ + + dqsez = sr - se + sez; /* pole prediction diff. */ + + update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + return sr << 2; +} + +unsigned g723_5Codec::encode(Linear buffer, void *coded, unsigned lsamples) +{ + unsigned count = (lsamples / 8); + Encoded dest = (Encoded)coded; + unsigned i, data, byte, bits; + + while(count--) + { + bits = 0; + data = 0; + for(i = 0; i < 8; ++i) + { + byte = encoder(*(buffer++), &encode_state); + data |= (byte << bits); + bits += 5; + if(bits >= 8) + { + *(dest++) = (data & 0xff); + bits -= 8; + data >>= 8; + } + } + } + return (lsamples / 8) * 8; +} + +unsigned g723_5Codec::decode(Linear buffer, void *from, unsigned lsamples) +{ + Encoded src = (Encoded)from; + unsigned count = (lsamples / 8) * 8; + unsigned char byte, nib; + unsigned bits = 0, data = 0; + + while(count--) + { + if(bits < 5) + { + byte = *(src++); + data |= (byte << bits); + bits += 8; + } + nib = data & 0x1f; + data >>= 5; + bits -= 5; + *(buffer++) = coder(&decode_state, nib); + } + return (lsamples / 8) * 8; +} + +AudioCodec *g723_5Codec::getByInfo(Info &info) +{ + return (AudioCodec *)new g723_5Codec(); +} + +AudioCodec *g723_5Codec::getByFormat(const char *format) +{ + return (AudioCodec *)new g723_5Codec(); +} + +g721Codec::g721Codec() : AudioCodec() +{ + unsigned pos; + + info.framesize = 1; + info.framecount = 2; + info.rate = 8000; + info.bitrate = 32000; + info.annotation = "g.721"; + info.encoding = g721ADPCM; + + memset(&encode_state, 0, sizeof(encode_state)); + memset(&decode_state, 0, sizeof(decode_state)); + encode_state.yl = decode_state.yl = 34816; + encode_state.yu = decode_state.yu = 544; + encode_state.sr[0] = encode_state.sr[1] = decode_state.sr[0] = decode_state.sr[1] = 32; + + for(pos = 0; pos < 6; ++pos) + encode_state.dq[pos] = decode_state.dq[pos] = 32; +} + +g721Codec::g721Codec(const char *id, Encoding e) : AudioCodec(id, e) +{ + info.framesize = 1; + info.framecount = 2; + info.rate = 8000; + info.bitrate = 32000; + info.annotation = "g.721"; +} + +g721Codec::~g721Codec() +{} + +unsigned char g721Codec::encoder(short sl, state_t *state) +{ + short sezi, se, sez; + short d, sr, y, dqsez, dq, i; + + sl >>= 2; + + sezi = predictor_zero(state); + sez = sezi >> 1; + se = (sezi + predictor_pole(state)) >> 1; + + d = sl - se; + + y = step_size(state); + i = quantize(d, y, qtab_721, 7); + dq = reconstruct(i & 8, _dqlntab[i], y); + sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; + + dqsez = sr + sez - se; + + update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state); + + return (unsigned char)(i); +} + +short g721Codec::coder(state_t *state, int i) +{ + short sezi, sei, sez, se; + short y, sr, dq, dqsez; + + sezi = predictor_zero(state); + sez = sezi >> 1; + sei = sezi + predictor_pole(state); + se = sei >> 1; + y = step_size(state); + dq = reconstruct(i & 0x08, _dqlntab[i], y); + sr = (dq < 0) ? (se - (dq & 0x3fff)) : se + dq; + dqsez = sr - se + sez; + update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state); + return sr << 2; +} + +unsigned g721Codec::encode(Linear buffer, void *coded, unsigned lsamples) +{ + unsigned count = (lsamples / 2); + unsigned char byte = 0; + Encoded dest = (Encoded)coded; + unsigned data, bits, i; + + while(count--) + { + bits = 0; + data = 0; + for(i = 0; i < 2; ++i) + { + byte = encoder(*(buffer++), &encode_state); + data |= (byte << bits); + bits += 4; + if(bits >= 8) + *(dest++) = (data & 0xff); + } + } + return (lsamples / 2) * 2; +} + +unsigned g721Codec::decode(Linear buffer, void *from, unsigned lsamples) +{ + Encoded src = (Encoded)from; + unsigned count = lsamples / 2; + unsigned data; + + while(count--) + { + data = *(src++); + *(buffer++) = coder(&decode_state, (data & 0x0f)); + data >>= 4; + *(buffer++) = coder(&decode_state, (data & 0x0f)); + } + return (lsamples / 2) * 2; +} + +AudioCodec *g721Codec::getByInfo(Info &info) +{ + return (AudioCodec *)new g721Codec(); +} + +AudioCodec *g721Codec::getByFormat(const char *format) +{ + return (AudioCodec *)new g721Codec(); +} + +static g721Codec g723_4("adpcm", Audio::g721ADPCM); +static g723_3Codec g723_3("g.723", Audio::g723_3bit); +static g723_5Codec g723_5("g.723", Audio::g723_5bit); + +} // namespace + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/codecs/g721.cpp new/ccaudio2-0.9.9/codecs/g721.cpp --- old/ccaudio2-0.9.7/codecs/g721.cpp 2006-05-23 14:08:56.000000000 +0200 +++ new/ccaudio2-0.9.9/codecs/g721.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,214 +0,0 @@ -// Copyright (C) 1999-2001 Open Source Telecom Corporation. -// -// 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// As a special exception to the GNU General Public License, permission is -// granted for additional uses of the text contained in its release -// of ccaudio. -// -// The exception is that, if you link the ccaudio library with other -// files to produce an executable, this does not by itself cause the -// resulting executable to be covered by the GNU General Public License. -// Your use of that executable is in no way restricted on account of -// linking the ccaudio library code into it. -// -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. -// -// This exception applies only to the code released under the -// name ccaudio. If you copy code from other releases into a copy of -// ccaudio, as the General Public License permits, the exception does -// not apply to the code that you add in this way. To avoid misleading -// anyone as to the status of such modified files, you must delete -// this exception notice from them. -// -// If you write modifications of your own for ccaudio, it is your choice -// whether to permit this exception to apply to your modifications. -// If you do not wish that, delete this exception notice. - -#include "codecs.h" - -namespace ccAudioCodec { -using namespace ost; - -static int index[8] = { -1, -1, -1, -1, 2, 4, 6, 8 }; - -static int steps[49] = { - 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, - 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, - 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, - 1060, 1166, 1282, 1411, 1552 -}; - -class g721Codec : public AudioCodec -{ -private: - typedef struct state - { - int ssindex; - int signal; - int next_flag; - } state_t; - - state_t encode_state, decode_state; - -public: - AudioCodec *getByInfo(Info &info); - AudioCodec *getByFormat(const char *format); - - unsigned decode(Linear buffer, void *from, unsigned lsamples); - unsigned encode(Linear buffer, void *dest, unsigned lsamples); - short coder(state_t *state, int nib); - - g721Codec(const char *id, Encoding e); - g721Codec(); - ~g721Codec(); -}; - -g721Codec::g721Codec() : AudioCodec() -{ - info.framesize = 1; - info.framecount = 2; - info.rate = 8000; - info.bitrate = 32000; - info.annotation = "g.721"; - info.encoding = g721ADPCM; - - memset(&encode_state, 0, sizeof(encode_state)); - memset(&decode_state, 0, sizeof(decode_state)); -} - -g721Codec::g721Codec(const char *id, Encoding e) : AudioCodec(id, e) -{ - info.framesize = 1; - info.framecount = 2; - info.rate = 8000; - info.bitrate = 32000; - info.annotation = "g.721"; -} - -g721Codec::~g721Codec() -{} - -short g721Codec::coder(state_t *state, int nib) -{ - int step, sign, diff; - - step = steps[state->ssindex]; - sign = nib & 0x08; - nib &= 0x07; - - diff = (((nib << 1) + 1) * step) >> 3; - - if(sign) - diff = -diff; - - if(state->next_flag & 0x01) - state->signal -= 8; - else if(state->next_flag & 0x02) - state->signal += 8; - - state->signal += diff; - if (state->signal > 2047) - state->signal = 2047; - else if (state->signal < -2047) - state->signal = -2047; - - state->next_flag = 0; - state->ssindex += index[nib]; - if (state->ssindex < 0) - state->ssindex = 0; - else if(state->ssindex > 48) - state->ssindex = 48; - - return state->signal << 4; -} - -unsigned g721Codec::encode(Linear buffer, void *coded, unsigned lsamples) -{ - unsigned count = (lsamples / 2) * 2; - short data; - bool hi = false; - int diff, step, nib; - unsigned char byte = 0; - Encoded dest = (Encoded)coded; - - while(count--) - { - data = (*(buffer++)) >> 4; - step = steps[encode_state.ssindex]; - diff = data - encode_state.signal; - - if(diff < 0) - { - nib = (-diff << 2) / step; - if(nib > 7) - nib = 7; - nib |= 0x08; - } - else - { - nib = (diff << 2) / step; - if(nib > 7) - nib = 7; - } - coder(&encode_state, nib); - if(hi) - { - byte |= nib; - *(dest++) = byte; - hi = false; - } - else - { - byte = (unsigned char)(nib << 4); - hi = true; - } - - } - return (lsamples / 2) * 2; -} - -unsigned g721Codec::decode(Linear buffer, void *from, unsigned lsamples) -{ - Encoded src = (Encoded)from; - unsigned count = lsamples / 2; - int nib; - - while(count--) - { - nib = (*src >> 4) & 0x0f; - *(buffer++) = coder(&decode_state, nib); - nib = *src & 0x0f; - *(buffer++) = coder(&decode_state, nib); - ++src; - } - return (lsamples / 2) * 2; -} - -AudioCodec *g721Codec::getByInfo(Info &info) -{ - return (AudioCodec *)new g721Codec(); -} - -AudioCodec *g721Codec::getByFormat(const char *format) -{ - return (AudioCodec *)new g721Codec(); -} - -static g721Codec codec("adpcm", Audio::g721ADPCM); - -} // namespace - diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/configure new/ccaudio2-0.9.9/configure --- old/ccaudio2-0.9.7/configure 2006-06-07 04:55:53.000000000 +0200 +++ new/ccaudio2-0.9.9/configure 2006-07-20 19:04:44.000000000 +0200 @@ -1523,9 +1523,9 @@ AUDIO_LIBS="" -VERSION="0.9.7" +VERSION="0.9.9" LT_RELEASE="0.9" -LT_VERSION="0:7" +LT_VERSION="0:9" ac_aux_dir= for ac_dir in autoconf $srcdir/autoconf; do if test -f $ac_dir/install-sh; then diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/configure.ac new/ccaudio2-0.9.9/configure.ac --- old/ccaudio2-0.9.7/configure.ac 2006-06-07 04:55:38.000000000 +0200 +++ new/ccaudio2-0.9.9/configure.ac 2006-07-20 18:37:09.000000000 +0200 @@ -33,9 +33,9 @@ AUDIO_LIBS="" -VERSION="0.9.7" +VERSION="0.9.9" LT_RELEASE="0.9" -LT_VERSION="0:7" +LT_VERSION="0:9" AC_CONFIG_AUX_DIR(autoconf) AC_CANONICAL_SYSTEM AC_PROG_CPP diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/libccaudio2.pc new/ccaudio2-0.9.9/libccaudio2.pc --- old/ccaudio2-0.9.7/libccaudio2.pc 2006-06-07 04:56:03.000000000 +0200 +++ new/ccaudio2-0.9.9/libccaudio2.pc 2006-07-20 19:04:57.000000000 +0200 @@ -11,7 +11,7 @@ Name: libccaudio2 Description: GNU ccAudio core library -Version: 0.9.7 +Version: 0.9.9 Libs: -lccaudio2 -ldl -lm Cflags: -I${includedir} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/src/audio2.h new/ccaudio2-0.9.9/src/audio2.h --- old/ccaudio2-0.9.7/src/audio2.h 2006-05-22 17:26:54.000000000 +0200 +++ new/ccaudio2-0.9.9/src/audio2.h 2006-07-20 17:01:22.000000000 +0200 @@ -239,7 +239,9 @@ speexAudio, g729Audio, - ilbcAudio + ilbcAudio, + + g723_4bit = g721ADPCM }; typedef enum Encoding Encoding; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/src/audiofile.cpp new/ccaudio2-0.9.9/src/audiofile.cpp --- old/ccaudio2-0.9.7/src/audiofile.cpp 2006-05-22 17:34:33.000000000 +0200 +++ new/ccaudio2-0.9.9/src/audiofile.cpp 2006-07-20 17:08:06.000000000 +0200 @@ -260,7 +260,7 @@ info.framesize = 33; info.bitrate = 13200; } - else if(!stricmp(ext, ".adpcm")) + else if(!stricmp(ext, ".adpcm") || !stricmp(ext, ".a32")) { info.encoding = g721ADPCM; info.format = raw; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/src/codec.cpp new/ccaudio2-0.9.9/src/codec.cpp --- old/ccaudio2-0.9.7/src/codec.cpp 2006-05-23 14:51:18.000000000 +0200 +++ new/ccaudio2-0.9.9/src/codec.cpp 2006-07-20 18:11:53.000000000 +0200 @@ -158,14 +158,12 @@ case alawAudio: return load("g.711"); case g721ADPCM: - return load("g.721"); + case g723_3bit: + case g723_5bit: + return load("adpcm"); case okiADPCM: case voxADPCM: return load("oki"); - case g723_2bit: - case g723_3bit: - case g723_5bit: - return load("g.723"); case mp1Audio: case mp2Audio: case mp3Audio: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/src/friends.cpp new/ccaudio2-0.9.9/src/friends.cpp --- old/ccaudio2-0.9.7/src/friends.cpp 2006-06-07 04:55:07.000000000 +0200 +++ new/ccaudio2-0.9.9/src/friends.cpp 2006-07-20 17:08:28.000000000 +0200 @@ -181,6 +181,10 @@ return ".sx"; case g721ADPCM: return ".adpcm"; + case g723_3bit: + return ".a24"; + case g723_5bit: + return ".a40"; case g729Audio: return ".g729"; case ilbcAudio: @@ -291,6 +295,14 @@ return g721ADPCM; else if(!stricmp(name, ".g721")) return g721ADPCM; + else if(!stricmp(name, ".a32")) + return g721ADPCM; + else if(!stricmp(name, ".a24")) + return g723_3bit; + else if(!stricmp(name, ".a40")) + return g723_5bit; + else if(!stricmp(name, ".g723")) + return g723_3bit; else if(!stricmp(name, ".g729")) return g729Audio; else if(!stricmp(name, ".ilbc")) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/w32/ccaudio2.dsp new/ccaudio2-0.9.9/w32/ccaudio2.dsp --- old/ccaudio2-0.9.7/w32/ccaudio2.dsp 2006-05-03 13:47:15.000000000 +0200 +++ new/ccaudio2-0.9.9/w32/ccaudio2.dsp 2006-07-20 05:08:40.000000000 +0200 @@ -24,7 +24,8 @@ # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" -# PROP Scc_LocalPath "" +# PROP Scc_LocalPath "Desktop" +# PROP WCE_FormatVersion "" CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -130,6 +131,10 @@ # End Source File # Begin Source File +SOURCE=..\src\resample.cpp +# End Source File +# Begin Source File + SOURCE=..\src\stream.cpp # End Source File # Begin Source File diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ccaudio2-0.9.7/w32/ccaudio2.rc new/ccaudio2-0.9.9/w32/ccaudio2.rc --- old/ccaudio2-0.9.7/w32/ccaudio2.rc 2006-06-07 04:56:03.000000000 +0200 +++ new/ccaudio2-0.9.9/w32/ccaudio2.rc 2006-07-20 19:04:57.000000000 +0200 @@ -58,8 +58,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,7,0 - PRODUCTVERSION 0,9,7,0 + FILEVERSION 0,9,9,0 + PRODUCTVERSION 0,9,9,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -77,14 +77,14 @@ VALUE "Comments", "\0" VALUE "CompanyName", "Open Source Telecom Corp.\0" VALUE "FileDescription", "Common C++ Audio Library\0" - VALUE "FileVersion", "0,9,7,0\0" + VALUE "FileVersion", "0,9,9,0\0" VALUE "InternalName", "ccaudio2\0" VALUE "LegalCopyright", "Copyright © 1999-2004 Open Source Telecomm Corp.\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "ccaudio2.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "OST Common C++ Audio Library\0" - VALUE "ProductVersion", "0,9,7,0\0" + VALUE "ProductVersion", "0,9,9,0\0" VALUE "SpecialBuild", "\0" END #ifndef __MINGW32__ @@ -93,14 +93,14 @@ VALUE "Comments", "\0" VALUE "CompanyName", "Open Source Telecom Corp.\0" VALUE "FileDescription", "Common C++ 2\0" - VALUE "FileVersion", "0,9,7,0\0" + VALUE "FileVersion", "0,9,9,0\0" VALUE "InternalName", "ccaudio2\0" VALUE "LegalCopyright", "Copyright © 1999-2004 Open Source Telecomm Corp.\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "ccaudio2.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "OST Common C++ Audio Library\0" - VALUE "ProductVersion", "0,9,7,0\0" + VALUE "ProductVersion", "0,9,9,0\0" VALUE "SpecialBuild", "\0" END #endif ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org