ref: 08192e317c23f8e2752efe53b016b0a21f483fc2
parent: 4d12a82c18138affb6d0a5f5fce83db6fa01adfe
author: Jean-Marc Valin <[email protected]>
date: Thu Jul 2 09:28:55 EDT 2009
ietf doc: more source code formatting changes, got rid of float_cast.h
--- 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,8 +41,10 @@
#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)
@@ -49,16 +51,17 @@
#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))
--- a/doc/ietf/convert_source.sh
+++ b/doc/ietf/convert_source.sh
@@ -13,9 +13,9 @@
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 @@
#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 @@
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
--- 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 @@
<?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"?>
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -384,8 +384,9 @@
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;