diff options
author | Jean-Marc Valin <jean-marc.valin@octasic.com> | 2009-07-02 21:28:55 +0400 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@octasic.com> | 2009-07-02 21:29:33 +0400 |
commit | 08192e317c23f8e2752efe53b016b0a21f483fc2 (patch) | |
tree | 3464ae6880d12cb74b4814dcf5df4f71c14e65b0 | |
parent | 4d12a82c18138affb6d0a5f5fce83db6fa01adfe (diff) |
ietf doc: more source code formatting changes, got rid of float_cast.h
-rw-r--r-- | doc/ietf/arch.h | 69 | ||||
-rwxr-xr-x | doc/ietf/convert_source.sh | 10 | ||||
-rw-r--r-- | doc/ietf/draft-valin-celt-codec.xml | 3 | ||||
-rw-r--r-- | libcelt/modes.c | 3 |
4 files changed, 44 insertions, 41 deletions
diff --git a/doc/ietf/arch.h b/doc/ietf/arch.h index 254f0bf..8e6f9ab 100644 --- a/doc/ietf/arch.h +++ b/doc/ietf/arch.h @@ -4,32 +4,32 @@ @brief Various architecture definitions for CELT */ /* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. - - Neither the name of the Xiph.org Foundation nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef ARCH_H @@ -41,24 +41,27 @@ #define celt_fatal(str) _celt_fatal(str, __FILE__, __LINE__); #ifdef ENABLE_ASSERTIONS -#define celt_assert(cond) {if (!(cond)) {celt_fatal("assertion failed: " #cond);}} -#define celt_assert2(cond, message) {if (!(cond)) {celt_fatal("assertion failed: " #cond "\n" message);}} +#define celt_assert(cond) {if (!(cond)) \ + {celt_fatal("assertion failed: " #cond);}} +#define celt_assert2(cond, message) {if (!(cond)) \ + {celt_fatal("assertion failed: " #cond "\n" message);}} #else #define celt_assert(cond) #define celt_assert2(cond, message) #endif -#define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */ -#define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */ -#define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Minimum 16-bit value. */ -#define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */ -#define ABS32(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 32-bit value. */ -#define MIN32(a,b) ((a) < (b) ? (a) : (b)) /**< Minimum 32-bit value. */ -#define MAX32(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */ -#define IMIN(a,b) ((a) < (b) ? (a) : (b)) /**< Minimum int value. */ -#define IMAX(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum int value. */ +#define ABS(x) ((x) < 0 ? (-(x)) : (x)) +#define ABS16(x) ((x) < 0 ? (-(x)) : (x)) +#define MIN16(a,b) ((a) < (b) ? (a) : (b)) +#define MAX16(a,b) ((a) > (b) ? (a) : (b)) +#define ABS32(x) ((x) < 0 ? (-(x)) : (x)) +#define MIN32(a,b) ((a) < (b) ? (a) : (b)) +#define MAX32(a,b) ((a) > (b) ? (a) : (b)) +#define IMIN(a,b) ((a) < (b) ? (a) : (b)) +#define IMAX(a,b) ((a) > (b) ? (a) : (b)) +#define float2int(flt) ((int)(floor(.5+flt))) #define SCALEIN(a) ((a)*CELT_SIG_SCALE) #define SCALEOUT(a) ((a)*(1/CELT_SIG_SCALE)) diff --git a/doc/ietf/convert_source.sh b/doc/ietf/convert_source.sh index 91b514f..707e2c8 100755 --- a/doc/ietf/convert_source.sh +++ b/doc/ietf/convert_source.sh @@ -13,9 +13,9 @@ echo '#include "substitutions.h"' > tata.c echo 'SOURCE_CODE_BEGIN' >> tata.c if echo $i | grep '\.h' > /dev/null; then - cat ../../libcelt/$i | sed 's/^#/\/\/PREPROCESS_REMOVE#/' >> tata.c + cat ../../libcelt/$i | sed -e 's/=\*/= \*/' -e 's/=-/= -/' -e 's/\t/ /g' -e 's/^#/\/\/PREPROCESS_REMOVE#/' >> tata.c else - cat ../../libcelt/$i | sed 's/^#include/\/\/PREPROCESS_REMOVE#include/' | sed 's/^#define/\/\/PREPROCESS_REMOVE#define/'>> tata.c + cat ../../libcelt/$i | sed -e 's/=\*/= \*/' -e 's/=-/= -/' -e 's/\t/ /g' -e 's/^#include/\/\/PREPROCESS_REMOVE#include/' | sed 's/^#define/\/\/PREPROCESS_REMOVE#define/'>> tata.c fi #cat ../../libcelt/$i | sed 's/^#/\/\/PREPROCESS_REMOVE#/' >> tata.c @@ -25,8 +25,9 @@ gcc -DHAVE_CONFIG_H -C -E -nostdinc tata.c | grep -v '^#' | sed 's/\/\/PREPROCES #cat ../../libcelt/$i >> tata.c #gcc -C -E -nostdinc tata.c -fdirectives-only | perl -ne 'if ($begin) {print $_} if (/SOURCE_CODE_BEGIN/) {$begin=1}' > tata2.c -indent -nsc -ncdb -original -sob -i2 -bl -bli0 --no-tabs -l72 --format-all-comments tata2.c -o tata.c -cat tata.c > source/$i +indent -nsc -ncdb -original -sob -i2 -bl -bli0 --no-tabs -l69 --format-all-comments tata2.c -o tata.c +cat tata.c | grep -v 'include.*float_cast' | ./wrap_lines > source/$i +#cat tata.c > source/$i @@ -40,7 +41,6 @@ cat tata.c > source/$i done -cp ../../libcelt/float_cast.h source/float_cast.h cp arch.h source/arch.h cp celt_types.h source/celt_types.h cp config.h source/config.h diff --git a/doc/ietf/draft-valin-celt-codec.xml b/doc/ietf/draft-valin-celt-codec.xml index 30390c9..405d49b 100644 --- a/doc/ietf/draft-valin-celt-codec.xml +++ b/doc/ietf/draft-valin-celt-codec.xml @@ -56,7 +56,7 @@ </author> --> -<date day="8" month="June" year="2009" /> +<date day="3" month="July" year="2009" /> <area>General</area> @@ -980,7 +980,6 @@ argument simulates random packet loss (argument is in tenths or a percent). <?rfc include="xml_source/arch.h"?> <?rfc include="xml_source/mathops.h"?> <?rfc include="xml_source/os_support.h"?> -<?rfc include="xml_source/float_cast.h"?> <?rfc include="xml_source/stack_alloc.h"?> <?rfc include="xml_source/celt_types.h"?> <?rfc include="xml_source/_kiss_fft_guts.h"?> diff --git a/libcelt/modes.c b/libcelt/modes.c index ba5e5d4..be2e081 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -384,8 +384,9 @@ CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int *e mode->nbShortMdcts = 1; } + /* Overlap must be divisible by 4 */ if (mode->nbShortMdcts > 1) - mode->overlap = ((frame_size/mode->nbShortMdcts)>>2)<<2; /* Overlap must be divisible by 4 */ + mode->overlap = ((frame_size/mode->nbShortMdcts)>>2)<<2; else mode->overlap = (frame_size>>3)<<2; |