rename files
This commit is contained in:
parent
9043214b2c
commit
eda35a2253
22 changed files with 684 additions and 684 deletions
|
@ -37,7 +37,7 @@
|
||||||
#include "cc6_bands.h"
|
#include "cc6_bands.h"
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "vq.h"
|
#include "vq.h"
|
||||||
#include "cwrs.h"
|
#include "cc6_cwrs.h"
|
||||||
#include "stack_alloc.h"
|
#include "stack_alloc.h"
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
#include "mathops.h"
|
#include "mathops.h"
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
|
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "entenc.h"
|
#include "cc6_entenc.h"
|
||||||
#include "entdec.h"
|
#include "cc6_entdec.h"
|
||||||
#include "rate.h"
|
#include "rate.h"
|
||||||
|
|
||||||
/** Compute the amplitude (sqrt energy) in each of the bands
|
/** Compute the amplitude (sqrt energy) in each of the bands
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include "kiss_fftr.h"
|
#include "kiss_fftr.h"
|
||||||
#include "cc6_bands.h"
|
#include "cc6_bands.h"
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "entcode.h"
|
#include "cc6_entcode.h"
|
||||||
#include "quant_bands.h"
|
#include "quant_bands.h"
|
||||||
#include "psy.h"
|
#include "psy.h"
|
||||||
#include "rate.h"
|
#include "rate.h"
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "cwrs.h"
|
#include "cc6_cwrs.h"
|
||||||
#include "mathops.h"
|
#include "mathops.h"
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
|
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
#include "stack_alloc.h"
|
#include "stack_alloc.h"
|
||||||
#include "entenc.h"
|
#include "cc6_entenc.h"
|
||||||
#include "entdec.h"
|
#include "cc6_entdec.h"
|
||||||
|
|
||||||
int log2_frac(ec_uint32 val, int frac);
|
int log2_frac(ec_uint32 val, int frac);
|
||||||
|
|
||||||
|
|
|
@ -1,70 +1,70 @@
|
||||||
/* (C) 2001-2008 Timothy B. Terriberry
|
/* (C) 2001-2008 Timothy B. Terriberry
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
- Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "entcode.h"
|
#include "cc6_entcode.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ec_ilog(ec_uint32 _v){
|
int ec_ilog(ec_uint32 _v){
|
||||||
#if defined(EC_CLZ)
|
#if defined(EC_CLZ)
|
||||||
return EC_CLZ0-EC_CLZ(_v);
|
return EC_CLZ0-EC_CLZ(_v);
|
||||||
#else
|
#else
|
||||||
/*On a Pentium M, this branchless version tested as the fastest on
|
/*On a Pentium M, this branchless version tested as the fastest on
|
||||||
1,000,000,000 random 32-bit integers, edging out a similar version with
|
1,000,000,000 random 32-bit integers, edging out a similar version with
|
||||||
branches, and a 256-entry LUT version.*/
|
branches, and a 256-entry LUT version.*/
|
||||||
int ret;
|
int ret;
|
||||||
int m;
|
int m;
|
||||||
ret=!!_v;
|
ret=!!_v;
|
||||||
m=!!(_v&0xFFFF0000)<<4;
|
m=!!(_v&0xFFFF0000)<<4;
|
||||||
_v>>=m;
|
_v>>=m;
|
||||||
ret|=m;
|
ret|=m;
|
||||||
m=!!(_v&0xFF00)<<3;
|
m=!!(_v&0xFF00)<<3;
|
||||||
_v>>=m;
|
_v>>=m;
|
||||||
ret|=m;
|
ret|=m;
|
||||||
m=!!(_v&0xF0)<<2;
|
m=!!(_v&0xF0)<<2;
|
||||||
_v>>=m;
|
_v>>=m;
|
||||||
ret|=m;
|
ret|=m;
|
||||||
m=!!(_v&0xC)<<1;
|
m=!!(_v&0xC)<<1;
|
||||||
_v>>=m;
|
_v>>=m;
|
||||||
ret|=m;
|
ret|=m;
|
||||||
ret+=!!(_v&0x2);
|
ret+=!!(_v&0x2);
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#if !defined(_entcode_H)
|
#if !defined(_entcode_H)
|
||||||
# define _entcode_H (1)
|
# define _entcode_H (1)
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
# include "ecintrin.h"
|
# include "cc6_ecintrin.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "entdec.h"
|
#include "cc6_entdec.h"
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
|
|
||||||
|
|
|
@ -1,134 +1,134 @@
|
||||||
/* (C) 2001-2008 Timothy B. Terriberry
|
/* (C) 2001-2008 Timothy B. Terriberry
|
||||||
(C) 2008 Jean-Marc Valin */
|
(C) 2008 Jean-Marc Valin */
|
||||||
/*
|
/*
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
- Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_entdec_H)
|
#if !defined(_entdec_H)
|
||||||
# define _entdec_H (1)
|
# define _entdec_H (1)
|
||||||
# include "entcode.h"
|
# include "cc6_entcode.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct ec_dec ec_dec;
|
typedef struct ec_dec ec_dec;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*The entropy decoder.*/
|
/*The entropy decoder.*/
|
||||||
struct ec_dec{
|
struct ec_dec{
|
||||||
/*The buffer to decode.*/
|
/*The buffer to decode.*/
|
||||||
ec_byte_buffer *buf;
|
ec_byte_buffer *buf;
|
||||||
/*The remainder of a buffered input symbol.*/
|
/*The remainder of a buffered input symbol.*/
|
||||||
int rem;
|
int rem;
|
||||||
/*The number of values in the current range.*/
|
/*The number of values in the current range.*/
|
||||||
ec_uint32 rng;
|
ec_uint32 rng;
|
||||||
/*The difference between the input value and the lowest value in the current
|
/*The difference between the input value and the lowest value in the current
|
||||||
range.*/
|
range.*/
|
||||||
ec_uint32 dif;
|
ec_uint32 dif;
|
||||||
/*Normalization factor.*/
|
/*Normalization factor.*/
|
||||||
ec_uint32 nrm;
|
ec_uint32 nrm;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*Initializes the decoder.
|
/*Initializes the decoder.
|
||||||
_buf: The input buffer to use.
|
_buf: The input buffer to use.
|
||||||
Return: 0 on success, or a negative value on error.*/
|
Return: 0 on success, or a negative value on error.*/
|
||||||
void ec_dec_init(ec_dec *_this,ec_byte_buffer *_buf);
|
void ec_dec_init(ec_dec *_this,ec_byte_buffer *_buf);
|
||||||
/*Calculates the cumulative frequency for the next symbol.
|
/*Calculates the cumulative frequency for the next symbol.
|
||||||
This can then be fed into the probability model to determine what that
|
This can then be fed into the probability model to determine what that
|
||||||
symbol is, and the additional frequency information required to advance to
|
symbol is, and the additional frequency information required to advance to
|
||||||
the next symbol.
|
the next symbol.
|
||||||
This function cannot be called more than once without a corresponding call to
|
This function cannot be called more than once without a corresponding call to
|
||||||
ec_dec_update(), or decoding will not proceed correctly.
|
ec_dec_update(), or decoding will not proceed correctly.
|
||||||
_ft: The total frequency of the symbols in the alphabet the next symbol was
|
_ft: The total frequency of the symbols in the alphabet the next symbol was
|
||||||
encoded with.
|
encoded with.
|
||||||
Return: A cumulative frequency representing the encoded symbol.
|
Return: A cumulative frequency representing the encoded symbol.
|
||||||
If the cumulative frequency of all the symbols before the one that
|
If the cumulative frequency of all the symbols before the one that
|
||||||
was encoded was fl, and the cumulative frequency of all the symbols
|
was encoded was fl, and the cumulative frequency of all the symbols
|
||||||
up to and including the one encoded is fh, then the returned value
|
up to and including the one encoded is fh, then the returned value
|
||||||
will fall in the range [fl,fh).*/
|
will fall in the range [fl,fh).*/
|
||||||
unsigned ec_decode(ec_dec *_this,unsigned _ft);
|
unsigned ec_decode(ec_dec *_this,unsigned _ft);
|
||||||
unsigned ec_decode_bin(ec_dec *_this,unsigned bits);
|
unsigned ec_decode_bin(ec_dec *_this,unsigned bits);
|
||||||
/*Advance the decoder past the next symbol using the frequency information the
|
/*Advance the decoder past the next symbol using the frequency information the
|
||||||
symbol was encoded with.
|
symbol was encoded with.
|
||||||
Exactly one call to ec_decode() must have been made so that all necessary
|
Exactly one call to ec_decode() must have been made so that all necessary
|
||||||
intermediate calculations are performed.
|
intermediate calculations are performed.
|
||||||
_fl: The cumulative frequency of all symbols that come before the symbol
|
_fl: The cumulative frequency of all symbols that come before the symbol
|
||||||
decoded.
|
decoded.
|
||||||
_fh: The cumulative frequency of all symbols up to and including the symbol
|
_fh: The cumulative frequency of all symbols up to and including the symbol
|
||||||
decoded.
|
decoded.
|
||||||
Together with _fl, this defines the range [_fl,_fh) in which the value
|
Together with _fl, this defines the range [_fl,_fh) in which the value
|
||||||
returned above must fall.
|
returned above must fall.
|
||||||
_ft: The total frequency of the symbols in the alphabet the symbol decoded
|
_ft: The total frequency of the symbols in the alphabet the symbol decoded
|
||||||
was encoded in.
|
was encoded in.
|
||||||
This must be the same as passed to the preceding call to ec_decode().*/
|
This must be the same as passed to the preceding call to ec_decode().*/
|
||||||
void ec_dec_update(ec_dec *_this,unsigned _fl,unsigned _fh,
|
void ec_dec_update(ec_dec *_this,unsigned _fl,unsigned _fh,
|
||||||
unsigned _ft);
|
unsigned _ft);
|
||||||
/*Extracts a sequence of raw bits from the stream.
|
/*Extracts a sequence of raw bits from the stream.
|
||||||
The bits must have been encoded with ec_enc_bits().
|
The bits must have been encoded with ec_enc_bits().
|
||||||
No call to ec_dec_update() is necessary after this call.
|
No call to ec_dec_update() is necessary after this call.
|
||||||
_ftb: The number of bits to extract.
|
_ftb: The number of bits to extract.
|
||||||
This must be at least one, and no more than 32.
|
This must be at least one, and no more than 32.
|
||||||
Return: The decoded bits.*/
|
Return: The decoded bits.*/
|
||||||
ec_uint32 ec_dec_bits(ec_dec *_this,int _ftb);
|
ec_uint32 ec_dec_bits(ec_dec *_this,int _ftb);
|
||||||
/*Extracts a sequence of raw bits from the stream.
|
/*Extracts a sequence of raw bits from the stream.
|
||||||
The bits must have been encoded with ec_enc_bits64().
|
The bits must have been encoded with ec_enc_bits64().
|
||||||
No call to ec_dec_update() is necessary after this call.
|
No call to ec_dec_update() is necessary after this call.
|
||||||
_ftb: The number of bits to extract.
|
_ftb: The number of bits to extract.
|
||||||
This must be at least one, and no more than 64.
|
This must be at least one, and no more than 64.
|
||||||
Return: The decoded bits.*/
|
Return: The decoded bits.*/
|
||||||
ec_uint64 ec_dec_bits64(ec_dec *_this,int _ftb);
|
ec_uint64 ec_dec_bits64(ec_dec *_this,int _ftb);
|
||||||
/*Extracts a raw unsigned integer with a non-power-of-2 range from the stream.
|
/*Extracts a raw unsigned integer with a non-power-of-2 range from the stream.
|
||||||
The bits must have been encoded with ec_enc_uint().
|
The bits must have been encoded with ec_enc_uint().
|
||||||
No call to ec_dec_update() is necessary after this call.
|
No call to ec_dec_update() is necessary after this call.
|
||||||
_ft: The number of integers that can be decoded (one more than the max).
|
_ft: The number of integers that can be decoded (one more than the max).
|
||||||
This must be at least one, and no more than 2**32-1.
|
This must be at least one, and no more than 2**32-1.
|
||||||
Return: The decoded bits.*/
|
Return: The decoded bits.*/
|
||||||
ec_uint32 ec_dec_uint(ec_dec *_this,ec_uint32 _ft);
|
ec_uint32 ec_dec_uint(ec_dec *_this,ec_uint32 _ft);
|
||||||
/*Extracts a raw unsigned integer with a non-power-of-2 range from the stream.
|
/*Extracts a raw unsigned integer with a non-power-of-2 range from the stream.
|
||||||
The bits must have been encoded with ec_enc_uint64().
|
The bits must have been encoded with ec_enc_uint64().
|
||||||
No call to ec_dec_update() is necessary after this call.
|
No call to ec_dec_update() is necessary after this call.
|
||||||
_ft: The number of integers that can be decoded (one more than the max).
|
_ft: The number of integers that can be decoded (one more than the max).
|
||||||
This must be at least one, and no more than 2**64-1.
|
This must be at least one, and no more than 2**64-1.
|
||||||
Return: The decoded bits.*/
|
Return: The decoded bits.*/
|
||||||
ec_uint64 ec_dec_uint64(ec_dec *_this,ec_uint64 _ft);
|
ec_uint64 ec_dec_uint64(ec_dec *_this,ec_uint64 _ft);
|
||||||
|
|
||||||
/*Returns the number of bits "used" by the decoded symbols so far.
|
/*Returns the number of bits "used" by the decoded symbols so far.
|
||||||
The actual number of bits may be larger, due to rounding to whole bytes, or
|
The actual number of bits may be larger, due to rounding to whole bytes, or
|
||||||
smaller, due to trailing zeros that were be stripped, so this is not an
|
smaller, due to trailing zeros that were be stripped, so this is not an
|
||||||
estimate of the true packet size.
|
estimate of the true packet size.
|
||||||
This same number can be computed by the encoder, and is suitable for making
|
This same number can be computed by the encoder, and is suitable for making
|
||||||
coding decisions.
|
coding decisions.
|
||||||
_b: The number of extra bits of precision to include.
|
_b: The number of extra bits of precision to include.
|
||||||
At most 16 will be accurate.
|
At most 16 will be accurate.
|
||||||
Return: The number of bits scaled by 2**_b.
|
Return: The number of bits scaled by 2**_b.
|
||||||
This will always be slightly larger than the exact value (e.g., all
|
This will always be slightly larger than the exact value (e.g., all
|
||||||
rounding error is in the positive direction).*/
|
rounding error is in the positive direction).*/
|
||||||
long ec_dec_tell(ec_dec *_this,int _b);
|
long ec_dec_tell(ec_dec *_this,int _b);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
#include "entenc.h"
|
#include "cc6_entenc.h"
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,116 +1,116 @@
|
||||||
/* (C) 2001-2008 Timothy B. Terriberry
|
/* (C) 2001-2008 Timothy B. Terriberry
|
||||||
(C) 2008 Jean-Marc Valin */
|
(C) 2008 Jean-Marc Valin */
|
||||||
/*
|
/*
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
- Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_entenc_H)
|
#if !defined(_entenc_H)
|
||||||
# define _entenc_H (1)
|
# define _entenc_H (1)
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include "entcode.h"
|
# include "cc6_entcode.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct ec_enc ec_enc;
|
typedef struct ec_enc ec_enc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*The entropy encoder.*/
|
/*The entropy encoder.*/
|
||||||
struct ec_enc{
|
struct ec_enc{
|
||||||
/*Buffered output.*/
|
/*Buffered output.*/
|
||||||
ec_byte_buffer *buf;
|
ec_byte_buffer *buf;
|
||||||
/*A buffered output symbol, awaiting carry propagation.*/
|
/*A buffered output symbol, awaiting carry propagation.*/
|
||||||
int rem;
|
int rem;
|
||||||
/*Number of extra carry propagating symbols.*/
|
/*Number of extra carry propagating symbols.*/
|
||||||
size_t ext;
|
size_t ext;
|
||||||
/*The number of values in the current range.*/
|
/*The number of values in the current range.*/
|
||||||
ec_uint32 rng;
|
ec_uint32 rng;
|
||||||
/*The low end of the current range (inclusive).*/
|
/*The low end of the current range (inclusive).*/
|
||||||
ec_uint32 low;
|
ec_uint32 low;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*Initializes the encoder.
|
/*Initializes the encoder.
|
||||||
_buf: The buffer to store output bytes in.
|
_buf: The buffer to store output bytes in.
|
||||||
This must have already been initialized for writing and reset.*/
|
This must have already been initialized for writing and reset.*/
|
||||||
void ec_enc_init(ec_enc *_this,ec_byte_buffer *_buf);
|
void ec_enc_init(ec_enc *_this,ec_byte_buffer *_buf);
|
||||||
/*Encodes a symbol given its frequency information.
|
/*Encodes a symbol given its frequency information.
|
||||||
The frequency information must be discernable by the decoder, assuming it
|
The frequency information must be discernable by the decoder, assuming it
|
||||||
has read only the previous symbols from the stream.
|
has read only the previous symbols from the stream.
|
||||||
It is allowable to change the frequency information, or even the entire
|
It is allowable to change the frequency information, or even the entire
|
||||||
source alphabet, so long as the decoder can tell from the context of the
|
source alphabet, so long as the decoder can tell from the context of the
|
||||||
previously encoded information that it is supposed to do so as well.
|
previously encoded information that it is supposed to do so as well.
|
||||||
_fl: The cumulative frequency of all symbols that come before the one to be
|
_fl: The cumulative frequency of all symbols that come before the one to be
|
||||||
encoded.
|
encoded.
|
||||||
_fh: The cumulative frequency of all symbols up to and including the one to
|
_fh: The cumulative frequency of all symbols up to and including the one to
|
||||||
be encoded.
|
be encoded.
|
||||||
Together with _fl, this defines the range [_fl,_fh) in which the
|
Together with _fl, this defines the range [_fl,_fh) in which the
|
||||||
decoded value will fall.
|
decoded value will fall.
|
||||||
_ft: The sum of the frequencies of all the symbols*/
|
_ft: The sum of the frequencies of all the symbols*/
|
||||||
void ec_encode(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned _ft);
|
void ec_encode(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned _ft);
|
||||||
void ec_encode_bin(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned bits);
|
void ec_encode_bin(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned bits);
|
||||||
/*Encodes a sequence of raw bits in the stream.
|
/*Encodes a sequence of raw bits in the stream.
|
||||||
_fl: The bits to encode.
|
_fl: The bits to encode.
|
||||||
_ftb: The number of bits to encode.
|
_ftb: The number of bits to encode.
|
||||||
This must be at least one, and no more than 32.*/
|
This must be at least one, and no more than 32.*/
|
||||||
void ec_enc_bits(ec_enc *_this,ec_uint32 _fl,int _ftb);
|
void ec_enc_bits(ec_enc *_this,ec_uint32 _fl,int _ftb);
|
||||||
/*Encodes a sequence of raw bits in the stream.
|
/*Encodes a sequence of raw bits in the stream.
|
||||||
_fl: The bits to encode.
|
_fl: The bits to encode.
|
||||||
_ftb: The number of bits to encode.
|
_ftb: The number of bits to encode.
|
||||||
This must be at least one, and no more than 64.*/
|
This must be at least one, and no more than 64.*/
|
||||||
void ec_enc_bits64(ec_enc *_this,ec_uint64 _fl,int _ftb);
|
void ec_enc_bits64(ec_enc *_this,ec_uint64 _fl,int _ftb);
|
||||||
/*Encodes a raw unsigned integer in the stream.
|
/*Encodes a raw unsigned integer in the stream.
|
||||||
_fl: The integer to encode.
|
_fl: The integer to encode.
|
||||||
_ft: The number of integers that can be encoded (one more than the max).
|
_ft: The number of integers that can be encoded (one more than the max).
|
||||||
This must be at least one, and no more than 2**32-1.*/
|
This must be at least one, and no more than 2**32-1.*/
|
||||||
void ec_enc_uint(ec_enc *_this,ec_uint32 _fl,ec_uint32 _ft);
|
void ec_enc_uint(ec_enc *_this,ec_uint32 _fl,ec_uint32 _ft);
|
||||||
/*Encodes a raw unsigned integer in the stream.
|
/*Encodes a raw unsigned integer in the stream.
|
||||||
_fl: The integer to encode.
|
_fl: The integer to encode.
|
||||||
_ft: The number of integers that can be encoded (one more than the max).
|
_ft: The number of integers that can be encoded (one more than the max).
|
||||||
This must be at least one, and no more than 2**64-1.*/
|
This must be at least one, and no more than 2**64-1.*/
|
||||||
void ec_enc_uint64(ec_enc *_this,ec_uint64 _fl,ec_uint64 _ft);
|
void ec_enc_uint64(ec_enc *_this,ec_uint64 _fl,ec_uint64 _ft);
|
||||||
|
|
||||||
/*Returns the number of bits "used" by the encoded symbols so far.
|
/*Returns the number of bits "used" by the encoded symbols so far.
|
||||||
The actual number of bits may be larger, due to rounding to whole bytes, or
|
The actual number of bits may be larger, due to rounding to whole bytes, or
|
||||||
smaller, due to trailing zeros that can be stripped, so this is not an
|
smaller, due to trailing zeros that can be stripped, so this is not an
|
||||||
estimate of the true packet size.
|
estimate of the true packet size.
|
||||||
This same number can be computed by the decoder, and is suitable for making
|
This same number can be computed by the decoder, and is suitable for making
|
||||||
coding decisions.
|
coding decisions.
|
||||||
_b: The number of extra bits of precision to include.
|
_b: The number of extra bits of precision to include.
|
||||||
At most 16 will be accurate.
|
At most 16 will be accurate.
|
||||||
Return: The number of bits scaled by 2**_b.
|
Return: The number of bits scaled by 2**_b.
|
||||||
This will always be slightly larger than the exact value (e.g., all
|
This will always be slightly larger than the exact value (e.g., all
|
||||||
rounding error is in the positive direction).*/
|
rounding error is in the positive direction).*/
|
||||||
long ec_enc_tell(ec_enc *_this,int _b);
|
long ec_enc_tell(ec_enc *_this,int _b);
|
||||||
|
|
||||||
/*Indicates that there are no more symbols to encode.
|
/*Indicates that there are no more symbols to encode.
|
||||||
All reamining output bytes are flushed to the output buffer.
|
All reamining output bytes are flushed to the output buffer.
|
||||||
ec_enc_init() must be called before the encoder can be used again.*/
|
ec_enc_init() must be called before the encoder can be used again.*/
|
||||||
void ec_enc_done(ec_enc *_this);
|
void ec_enc_done(ec_enc *_this);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
/* (C) 2007 Jean-Marc Valin, CSIRO
|
/* (C) 2007 Jean-Marc Valin, CSIRO
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
- Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "entenc.h"
|
#include "cc6_entenc.h"
|
||||||
#include "entdec.h"
|
#include "cc6_entdec.h"
|
||||||
|
|
||||||
int ec_laplace_get_start_freq(int decay);
|
int ec_laplace_get_start_freq(int decay);
|
||||||
|
|
||||||
/** Encode a value that is assumed to be the realisation of a
|
/** Encode a value that is assumed to be the realisation of a
|
||||||
Laplace-distributed random process
|
Laplace-distributed random process
|
||||||
@param enc Entropy encoder state
|
@param enc Entropy encoder state
|
||||||
@param value Value to encode
|
@param value Value to encode
|
||||||
@param decay Probability of the value +/- 1, multiplied by 16384
|
@param decay Probability of the value +/- 1, multiplied by 16384
|
||||||
*/
|
*/
|
||||||
void ec_laplace_encode(ec_enc *enc, int *value, int decay);
|
void ec_laplace_encode(ec_enc *enc, int *value, int decay);
|
||||||
|
|
||||||
void ec_laplace_encode_start(ec_enc *enc, int *value, int decay, int fs);
|
void ec_laplace_encode_start(ec_enc *enc, int *value, int decay, int fs);
|
||||||
|
|
||||||
/** Decode a value that is assumed to be the realisation of a
|
/** Decode a value that is assumed to be the realisation of a
|
||||||
Laplace-distributed random process
|
Laplace-distributed random process
|
||||||
@param dec Entropy decoder state
|
@param dec Entropy decoder state
|
||||||
@param decay Probability of the value +/- 1, multiplied by 16384
|
@param decay Probability of the value +/- 1, multiplied by 16384
|
||||||
@return Value decoded
|
@return Value decoded
|
||||||
*/
|
*/
|
||||||
int ec_laplace_decode(ec_dec *dec, int decay);
|
int ec_laplace_decode(ec_dec *dec, int decay);
|
||||||
|
|
||||||
int ec_laplace_decode_start(ec_dec *dec, int decay, int fs);
|
int ec_laplace_decode_start(ec_dec *dec, int decay, int fs);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#define MATHOPS_H
|
#define MATHOPS_H
|
||||||
|
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
#include "entcode.h"
|
#include "cc6_entcode.h"
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifndef OVERRIDE_CELT_ILOG2
|
#ifndef OVERRIDE_CELT_ILOG2
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
/* (C) 2001-2008 Timothy B. Terriberry
|
/* (C) 2001-2008 Timothy B. Terriberry
|
||||||
(C) 2008 Jean-Marc Valin */
|
(C) 2008 Jean-Marc Valin */
|
||||||
/*
|
/*
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
- Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_mfrngcode_H)
|
#if !defined(_mfrngcode_H)
|
||||||
# define _mfrngcode_H (1)
|
# define _mfrngcode_H (1)
|
||||||
# include "entcode.h"
|
# include "cc6_entcode.h"
|
||||||
|
|
||||||
/*Constants used by the entropy encoder/decoder.*/
|
/*Constants used by the entropy encoder/decoder.*/
|
||||||
|
|
||||||
/*The number of bits to output at a time.*/
|
/*The number of bits to output at a time.*/
|
||||||
# define EC_SYM_BITS (8)
|
# define EC_SYM_BITS (8)
|
||||||
/*The total number of bits in each of the state registers.*/
|
/*The total number of bits in each of the state registers.*/
|
||||||
# define EC_CODE_BITS (32)
|
# define EC_CODE_BITS (32)
|
||||||
/*The maximum symbol value.*/
|
/*The maximum symbol value.*/
|
||||||
# define EC_SYM_MAX ((1U<<EC_SYM_BITS)-1)
|
# define EC_SYM_MAX ((1U<<EC_SYM_BITS)-1)
|
||||||
/*Bits to shift by to move a symbol into the high-order position.*/
|
/*Bits to shift by to move a symbol into the high-order position.*/
|
||||||
# define EC_CODE_SHIFT (EC_CODE_BITS-EC_SYM_BITS-1)
|
# define EC_CODE_SHIFT (EC_CODE_BITS-EC_SYM_BITS-1)
|
||||||
/*Carry bit of the high-order range symbol.*/
|
/*Carry bit of the high-order range symbol.*/
|
||||||
# define EC_CODE_TOP (((ec_uint32)1U)<<EC_CODE_BITS-1)
|
# define EC_CODE_TOP (((ec_uint32)1U)<<EC_CODE_BITS-1)
|
||||||
/*Low-order bit of the high-order range symbol.*/
|
/*Low-order bit of the high-order range symbol.*/
|
||||||
# define EC_CODE_BOT (EC_CODE_TOP>>EC_SYM_BITS)
|
# define EC_CODE_BOT (EC_CODE_TOP>>EC_SYM_BITS)
|
||||||
/*Code for which propagating carries are possible.*/
|
/*Code for which propagating carries are possible.*/
|
||||||
# define EC_CODE_CARRY (((ec_uint32)EC_SYM_MAX)<<EC_CODE_SHIFT)
|
# define EC_CODE_CARRY (((ec_uint32)EC_SYM_MAX)<<EC_CODE_SHIFT)
|
||||||
/*The number of bits available for the last, partial symbol in the code field.*/
|
/*The number of bits available for the last, partial symbol in the code field.*/
|
||||||
# define EC_CODE_EXTRA ((EC_CODE_BITS-2)%EC_SYM_BITS+1)
|
# define EC_CODE_EXTRA ((EC_CODE_BITS-2)%EC_SYM_BITS+1)
|
||||||
/*A mask for the bits available in the coding buffer.
|
/*A mask for the bits available in the coding buffer.
|
||||||
This allows different platforms to use a variable with more bits, if it is
|
This allows different platforms to use a variable with more bits, if it is
|
||||||
convenient.
|
convenient.
|
||||||
We will only use EC_CODE_BITS of it.*/
|
We will only use EC_CODE_BITS of it.*/
|
||||||
# define EC_CODE_MASK ((((ec_uint32)1U)<<EC_CODE_BITS-1)-1<<1|1)
|
# define EC_CODE_MASK ((((ec_uint32)1U)<<EC_CODE_BITS-1)-1<<1|1)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
|
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "entenc.h"
|
#include "cc6_entenc.h"
|
||||||
#include "entdec.h"
|
#include "cc6_entdec.h"
|
||||||
#include "mathops.h"
|
#include "mathops.h"
|
||||||
|
|
||||||
static __inline celt_word16_t amp2Log(celt_word32_t amp)
|
static __inline celt_word16_t amp2Log(celt_word32_t amp)
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
#include "entdec.h"
|
#include "cc6_entdec.h"
|
||||||
#include "mfrngcod.h"
|
#include "mfrngcod.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
#include "entenc.h"
|
#include "cc6_entenc.h"
|
||||||
#include "mfrngcod.h"
|
#include "mfrngcod.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,11 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "cwrs.h"
|
#include "cc6_cwrs.h"
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
|
|
||||||
#include "entcode.h"
|
#include "cc6_entcode.h"
|
||||||
#include "rate.h"
|
#include "rate.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
288
libs/celt/rate.h
288
libs/celt/rate.h
|
@ -1,144 +1,144 @@
|
||||||
/* (C) 2007-2008 Jean-Marc Valin, CSIRO
|
/* (C) 2007-2008 Jean-Marc Valin, CSIRO
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
- Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RATE_H
|
#ifndef RATE_H
|
||||||
#define RATE_H
|
#define RATE_H
|
||||||
|
|
||||||
#define MAX_PULSES 128
|
#define MAX_PULSES 128
|
||||||
#define LOG_MAX_PULSES 7
|
#define LOG_MAX_PULSES 7
|
||||||
|
|
||||||
#define BITRES 4
|
#define BITRES 4
|
||||||
#define BITROUND 8
|
#define BITROUND 8
|
||||||
#define BITOVERFLOW 30000
|
#define BITOVERFLOW 30000
|
||||||
|
|
||||||
#include "cwrs.h"
|
#include "cc6_cwrs.h"
|
||||||
|
|
||||||
static __inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, int N, int bits)
|
static __inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, int N, int bits)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int lo, hi;
|
int lo, hi;
|
||||||
lo = 0;
|
lo = 0;
|
||||||
hi = MAX_PULSES-1;
|
hi = MAX_PULSES-1;
|
||||||
|
|
||||||
#if 0 /* Disabled until we can make that useful */
|
#if 0 /* Disabled until we can make that useful */
|
||||||
/* Use of more than MAX_PULSES is disabled until we are able to cwrs that decently */
|
/* Use of more than MAX_PULSES is disabled until we are able to cwrs that decently */
|
||||||
if (bits > cache[MAX_PULSES-1] && N<=4)
|
if (bits > cache[MAX_PULSES-1] && N<=4)
|
||||||
{
|
{
|
||||||
/*int pulses;
|
/*int pulses;
|
||||||
pulses = 127;
|
pulses = 127;
|
||||||
while (16 + log2_frac(2*(pulses+1)*(pulses+1) + 1, 4) <= bits && pulses < 32767)
|
while (16 + log2_frac(2*(pulses+1)*(pulses+1) + 1, 4) <= bits && pulses < 32767)
|
||||||
pulses++;*/
|
pulses++;*/
|
||||||
lo = 127;
|
lo = 127;
|
||||||
switch (N)
|
switch (N)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
hi = 1024;
|
hi = 1024;
|
||||||
for (i=0;i<10;i++)
|
for (i=0;i<10;i++)
|
||||||
{
|
{
|
||||||
int pulses = (lo+hi)>>1;
|
int pulses = (lo+hi)>>1;
|
||||||
if (log2_frac(((UMUL16_16(pulses,pulses)>>1)+1)>>1, 4) > bits)
|
if (log2_frac(((UMUL16_16(pulses,pulses)>>1)+1)>>1, 4) > bits)
|
||||||
hi = pulses;
|
hi = pulses;
|
||||||
else
|
else
|
||||||
lo = pulses;
|
lo = pulses;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
hi = 1024;
|
hi = 1024;
|
||||||
for (i=0;i<10;i++)
|
for (i=0;i<10;i++)
|
||||||
{
|
{
|
||||||
int pulses = (lo+hi)>>1;
|
int pulses = (lo+hi)>>1;
|
||||||
if (log2_frac((UMUL32(UMUL16_16(pulses,pulses)+2,pulses))/3<<3, 4) > bits)
|
if (log2_frac((UMUL32(UMUL16_16(pulses,pulses)+2,pulses))/3<<3, 4) > bits)
|
||||||
hi = pulses;
|
hi = pulses;
|
||||||
else
|
else
|
||||||
lo = pulses;
|
lo = pulses;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return lo;
|
return lo;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Instead of using the "bisection condition" we use a fixed number of
|
/* Instead of using the "bisection condition" we use a fixed number of
|
||||||
iterations because it should be faster */
|
iterations because it should be faster */
|
||||||
/*while (hi-lo != 1)*/
|
/*while (hi-lo != 1)*/
|
||||||
for (i=0;i<LOG_MAX_PULSES;i++)
|
for (i=0;i<LOG_MAX_PULSES;i++)
|
||||||
{
|
{
|
||||||
int mid = (lo+hi)>>1;
|
int mid = (lo+hi)>>1;
|
||||||
/* OPT: Make sure this is implemented with a conditional move */
|
/* OPT: Make sure this is implemented with a conditional move */
|
||||||
if (cache[mid] >= bits)
|
if (cache[mid] >= bits)
|
||||||
hi = mid;
|
hi = mid;
|
||||||
else
|
else
|
||||||
lo = mid;
|
lo = mid;
|
||||||
}
|
}
|
||||||
if (bits-cache[lo] <= cache[hi]-bits)
|
if (bits-cache[lo] <= cache[hi]-bits)
|
||||||
return lo;
|
return lo;
|
||||||
else
|
else
|
||||||
return hi;
|
return hi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static __inline int pulses2bits(const celt_int16_t *cache, int N, int pulses)
|
static __inline int pulses2bits(const celt_int16_t *cache, int N, int pulses)
|
||||||
{
|
{
|
||||||
#if 0 /* Use of more than MAX_PULSES is disabled until we are able to cwrs that decently */
|
#if 0 /* Use of more than MAX_PULSES is disabled until we are able to cwrs that decently */
|
||||||
if (pulses > 127)
|
if (pulses > 127)
|
||||||
{
|
{
|
||||||
int bits;
|
int bits;
|
||||||
switch (N)
|
switch (N)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
bits = log2_frac(((UMUL16_16(pulses,pulses)>>1)+1)>>1, 4);
|
bits = log2_frac(((UMUL16_16(pulses,pulses)>>1)+1)>>1, 4);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
bits = log2_frac((UMUL32(UMUL16_16(pulses,pulses)+2,pulses))/3<<3, 4);
|
bits = log2_frac((UMUL32(UMUL16_16(pulses,pulses)+2,pulses))/3<<3, 4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*printf ("%d <- %d\n", bits, pulses);*/
|
/*printf ("%d <- %d\n", bits, pulses);*/
|
||||||
return bits;
|
return bits;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return cache[pulses];
|
return cache[pulses];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Computes a cache of the pulses->bits mapping in each band */
|
/** Computes a cache of the pulses->bits mapping in each band */
|
||||||
celt_int16_t **compute_alloc_cache(CELTMode *m, int C);
|
celt_int16_t **compute_alloc_cache(CELTMode *m, int C);
|
||||||
|
|
||||||
/** Compute the pulse allocation, i.e. how many pulses will go in each
|
/** Compute the pulse allocation, i.e. how many pulses will go in each
|
||||||
* band.
|
* band.
|
||||||
@param m mode
|
@param m mode
|
||||||
@param offsets Requested increase or decrease in the number of bits for
|
@param offsets Requested increase or decrease in the number of bits for
|
||||||
each band
|
each band
|
||||||
@param total Number of bands
|
@param total Number of bands
|
||||||
@param pulses Number of pulses per band (returned)
|
@param pulses Number of pulses per band (returned)
|
||||||
@return Total number of bits allocated
|
@return Total number of bits allocated
|
||||||
*/
|
*/
|
||||||
void compute_allocation(const CELTMode *m, int *offsets, int total, int *pulses, int *ebits, int *fine_priority);
|
void compute_allocation(const CELTMode *m, int *offsets, int total, int *pulses, int *ebits, int *fine_priority);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mathops.h"
|
#include "mathops.h"
|
||||||
#include "cwrs.h"
|
#include "cc6_cwrs.h"
|
||||||
#include "vq.h"
|
#include "vq.h"
|
||||||
#include "cc6_arch.h"
|
#include "cc6_arch.h"
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
|
|
158
libs/celt/vq.h
158
libs/celt/vq.h
|
@ -1,79 +1,79 @@
|
||||||
/* (C) 2007-2008 Jean-Marc Valin, CSIRO
|
/* (C) 2007-2008 Jean-Marc Valin, CSIRO
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
@file vq.h
|
@file vq.h
|
||||||
@brief Vector quantisation of the residual
|
@brief Vector quantisation of the residual
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
- Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef VQ_H
|
#ifndef VQ_H
|
||||||
#define VQ_H
|
#define VQ_H
|
||||||
|
|
||||||
#include "entenc.h"
|
#include "cc6_entenc.h"
|
||||||
#include "entdec.h"
|
#include "cc6_entdec.h"
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
|
|
||||||
/** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of
|
/** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of
|
||||||
* the pitch and a combination of pulses such that its norm is still equal
|
* the pitch and a combination of pulses such that its norm is still equal
|
||||||
* to 1. This is the function that will typically require the most CPU.
|
* to 1. This is the function that will typically require the most CPU.
|
||||||
* @param x Residual signal to quantise/encode (returns quantised version)
|
* @param x Residual signal to quantise/encode (returns quantised version)
|
||||||
* @param W Perceptual weight to use when optimising (currently unused)
|
* @param W Perceptual weight to use when optimising (currently unused)
|
||||||
* @param N Number of samples to encode
|
* @param N Number of samples to encode
|
||||||
* @param K Number of pulses to use
|
* @param K Number of pulses to use
|
||||||
* @param p Pitch vector (it is assumed that p+x is a unit vector)
|
* @param p Pitch vector (it is assumed that p+x is a unit vector)
|
||||||
* @param enc Entropy encoder state
|
* @param enc Entropy encoder state
|
||||||
*/
|
*/
|
||||||
void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, ec_enc *enc);
|
void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, ec_enc *enc);
|
||||||
|
|
||||||
/** Algebraic pulse decoder
|
/** Algebraic pulse decoder
|
||||||
* @param x Decoded normalised spectrum (returned)
|
* @param x Decoded normalised spectrum (returned)
|
||||||
* @param N Number of samples to decode
|
* @param N Number of samples to decode
|
||||||
* @param K Number of pulses to use
|
* @param K Number of pulses to use
|
||||||
* @param p Pitch vector (automatically added to x)
|
* @param p Pitch vector (automatically added to x)
|
||||||
* @param dec Entropy decoder state
|
* @param dec Entropy decoder state
|
||||||
*/
|
*/
|
||||||
void alg_unquant(celt_norm_t *X, int N, int K, celt_norm_t *P, ec_dec *dec);
|
void alg_unquant(celt_norm_t *X, int N, int K, celt_norm_t *P, ec_dec *dec);
|
||||||
|
|
||||||
celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int stride);
|
celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int stride);
|
||||||
|
|
||||||
/** Intra-frame predictor that matches a section of the current frame (at lower
|
/** Intra-frame predictor that matches a section of the current frame (at lower
|
||||||
* frequencies) to encode the current band.
|
* frequencies) to encode the current band.
|
||||||
* @param x Residual signal to quantise/encode (returns quantised version)
|
* @param x Residual signal to quantise/encode (returns quantised version)
|
||||||
* @param W Perceptual weight
|
* @param W Perceptual weight
|
||||||
* @param N Number of samples to encode
|
* @param N Number of samples to encode
|
||||||
* @param K Number of pulses to use
|
* @param K Number of pulses to use
|
||||||
* @param Y Lower frequency spectrum to use, normalised to the same standard deviation
|
* @param Y Lower frequency spectrum to use, normalised to the same standard deviation
|
||||||
* @param P Pitch vector (it is assumed that p+x is a unit vector)
|
* @param P Pitch vector (it is assumed that p+x is a unit vector)
|
||||||
* @param B Stride (number of channels multiplied by the number of MDCTs per frame)
|
* @param B Stride (number of channels multiplied by the number of MDCTs per frame)
|
||||||
* @param N0 Number of valid offsets
|
* @param N0 Number of valid offsets
|
||||||
*/
|
*/
|
||||||
void intra_fold(const CELTMode *m, celt_norm_t * __restrict x, int N, int *pulses, celt_norm_t *Y, celt_norm_t * __restrict P, int N0, int B);
|
void intra_fold(const CELTMode *m, celt_norm_t * __restrict x, int N, int *pulses, celt_norm_t *Y, celt_norm_t * __restrict P, int N0, int B);
|
||||||
|
|
||||||
#endif /* VQ_H */
|
#endif /* VQ_H */
|
||||||
|
|
16
llcon.pro
16
llcon.pro
|
@ -103,11 +103,11 @@ HEADERS += src/audiomixerboard.h \
|
||||||
libs/celt/cc6_bands.h \
|
libs/celt/cc6_bands.h \
|
||||||
libs/celt/fixed_c5x.h \
|
libs/celt/fixed_c5x.h \
|
||||||
libs/celt/fixed_c6x.h \
|
libs/celt/fixed_c6x.h \
|
||||||
libs/celt/cwrs.h \
|
libs/celt/cc6_cwrs.h \
|
||||||
libs/celt/ecintrin.h \
|
libs/celt/cc6_ecintrin.h \
|
||||||
libs/celt/entcode.h \
|
libs/celt/cc6_entcode.h \
|
||||||
libs/celt/entdec.h \
|
libs/celt/cc6_entdec.h \
|
||||||
libs/celt/entenc.h \
|
libs/celt/cc6_entenc.h \
|
||||||
libs/celt/fixed_generic.h \
|
libs/celt/fixed_generic.h \
|
||||||
libs/celt/float_cast.h \
|
libs/celt/float_cast.h \
|
||||||
libs/celt/kfft_double.h \
|
libs/celt/kfft_double.h \
|
||||||
|
@ -150,9 +150,9 @@ SOURCES += src/audiomixerboard.cpp \
|
||||||
libs/celt/cc6_bands.c \
|
libs/celt/cc6_bands.c \
|
||||||
libs/celt/cc6_celt.c \
|
libs/celt/cc6_celt.c \
|
||||||
libs/celt/cc6_cwrs.c \
|
libs/celt/cc6_cwrs.c \
|
||||||
libs/celt/entcode.c \
|
libs/celt/cc6_entcode.c \
|
||||||
libs/celt/entdec.c \
|
libs/celt/cc6_entdec.c \
|
||||||
libs/celt/entenc.c \
|
libs/celt/cc6_entenc.c \
|
||||||
libs/celt/header.c \
|
libs/celt/header.c \
|
||||||
libs/celt/kfft_single.c \
|
libs/celt/kfft_single.c \
|
||||||
libs/celt/cc6__kiss_fft.c \
|
libs/celt/cc6__kiss_fft.c \
|
||||||
|
|
Loading…
Add table
Reference in a new issue