From 6696a1443bd6da8c8fbe26ddc5e12baa7eb2b75c Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Mon, 22 Aug 2011 10:40:38 -0400 Subject: [PATCH] Moves align() to a single header --- opus_headers.txt | 3 ++- src/opus.h | 4 ++-- src/opus_decoder.c | 8 ++------ src/opus_encoder.c | 9 ++------- src/opus_private.h | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 src/opus_private.h diff --git a/opus_headers.txt b/opus_headers.txt index 2b03c0d7..0e381852 100644 --- a/opus_headers.txt +++ b/opus_headers.txt @@ -1,2 +1,3 @@ OPUS_HEAD = \ -src/opus.h +src/opus.h \ +src/opus_private.h diff --git a/src/opus.h b/src/opus.h index 1ae7d75d..1be2298c 100644 --- a/src/opus.h +++ b/src/opus.h @@ -1,5 +1,5 @@ -/* Copyright (c) 2010 Xiph.Org Foundation - Written by Jean-Marc Valin */ +/* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited + Written by Jean-Marc Valin and Koen Vos */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/src/opus_decoder.c b/src/opus_decoder.c index a022840c..6b937f89 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -40,6 +40,8 @@ #include "silk_API.h" #include "stack_alloc.h" #include "float_cast.h" +#include "opus_private.h" + #ifdef FIXED_POINT #define celt_decode_native celt_decode @@ -70,12 +72,6 @@ static inline opus_int16 SAT16(opus_int32 x) { }; #endif -/* Make sure everything's aligned to 4 bytes (this may need to be increased - on really weird architectures) */ -static inline int align(int i) -{ - return (i+3)&-4; -} int opus_decoder_get_size(int channels) { diff --git a/src/opus_encoder.c b/src/opus_encoder.c index e90472fa..a6340f3b 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 Xiph.Org Foundation, Skype Limited +/* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited Written by Jean-Marc Valin and Koen Vos */ /* Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include "float_cast.h" #include "opus.h" #include "arch.h" +#include "opus_private.h" #ifdef FIXED_POINT #define celt_encode_native celt_encode @@ -96,12 +97,6 @@ static const int audio_bandwidth_thresholds[10] = { 33000, 2000, /* SWB<->FB */ }; -/* Make sure everything's aligned to 4 bytes (this may need to be increased - on really weird architectures) */ -static inline int align(int i) -{ - return (i+3)&-4; -} int opus_encoder_get_size(int channels) { diff --git a/src/opus_private.h b/src/opus_private.h new file mode 100644 index 00000000..6d03a94c --- /dev/null +++ b/src/opus_private.h @@ -0,0 +1,39 @@ +/* Copyright (c) 2011 Xiph.Org Foundation + Written by Jean-Marc Valin */ +/* + 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 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. + + 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 OPUS_PRIVATE_H +#define OPUS_PRIVATE_H + +/* Make sure everything's aligned to 4 bytes (this may need to be increased + on really weird architectures) */ +static inline int align(int i) +{ + return (i+3)&-4; +} + +#endif /* OPUS_PRIVATE_H_ */