simplify lpc
Originally committed as revision 10628 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d1a5c4216c
commit
b8de342919
@ -876,10 +876,10 @@ static void encode_residual_fixed(int32_t *res, const int32_t *smp, int n,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define LPC1(x) {\
|
#define LPC1(x) {\
|
||||||
int s = smp[i-(x)+1];\
|
int c = coefs[(x)-1];\
|
||||||
p1 += c*s;\
|
|
||||||
c = coefs[(x)-2];\
|
|
||||||
p0 += c*s;\
|
p0 += c*s;\
|
||||||
|
s = smp[i-(x)+1];\
|
||||||
|
p1 += c*s;\
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline void encode_residual_lpc_unrolled(
|
static av_always_inline void encode_residual_lpc_unrolled(
|
||||||
@ -888,9 +888,8 @@ static av_always_inline void encode_residual_lpc_unrolled(
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=order; i<n; i+=2) {
|
for(i=order; i<n; i+=2) {
|
||||||
int c = coefs[order-1];
|
int s = smp[i-order];
|
||||||
int p0 = c * smp[i-order];
|
int p0 = 0, p1 = 0;
|
||||||
int p1 = 0;
|
|
||||||
if(big) {
|
if(big) {
|
||||||
switch(order) {
|
switch(order) {
|
||||||
case 32: LPC1(32)
|
case 32: LPC1(32)
|
||||||
@ -924,6 +923,7 @@ static av_always_inline void encode_residual_lpc_unrolled(
|
|||||||
LPC1( 4)
|
LPC1( 4)
|
||||||
LPC1( 3)
|
LPC1( 3)
|
||||||
LPC1( 2)
|
LPC1( 2)
|
||||||
|
LPC1( 1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch(order) {
|
switch(order) {
|
||||||
@ -934,9 +934,9 @@ static av_always_inline void encode_residual_lpc_unrolled(
|
|||||||
case 4: LPC1( 4)
|
case 4: LPC1( 4)
|
||||||
case 3: LPC1( 3)
|
case 3: LPC1( 3)
|
||||||
case 2: LPC1( 2)
|
case 2: LPC1( 2)
|
||||||
|
case 1: LPC1( 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p1 += c * smp[i];
|
|
||||||
res[i ] = smp[i ] - (p0 >> shift);
|
res[i ] = smp[i ] - (p0 >> shift);
|
||||||
res[i+1] = smp[i+1] - (p1 >> shift);
|
res[i+1] = smp[i+1] - (p1 >> shift);
|
||||||
}
|
}
|
||||||
@ -952,16 +952,15 @@ static void encode_residual_lpc(int32_t *res, const int32_t *smp, int n,
|
|||||||
#ifdef CONFIG_SMALL
|
#ifdef CONFIG_SMALL
|
||||||
for(i=order; i<n; i+=2) {
|
for(i=order; i<n; i+=2) {
|
||||||
int j;
|
int j;
|
||||||
int32_t c = coefs[0];
|
int s = smp[i];
|
||||||
int32_t p0 = 0, p1 = c*smp[i];
|
int p0 = 0, p1 = 0;
|
||||||
for(j=1; j<order; j++) {
|
for(j=0; j<order; j++) {
|
||||||
int32_t s = smp[i-j];
|
int c = coefs[j];
|
||||||
p0 += c*s;
|
|
||||||
c = coefs[j];
|
|
||||||
p1 += c*s;
|
p1 += c*s;
|
||||||
|
s = smp[i-j-1];
|
||||||
|
p0 += c*s;
|
||||||
}
|
}
|
||||||
p0 += c*smp[i-order];
|
res[i ] = smp[i ] - (p0 >> shift);
|
||||||
res[i+0] = smp[i+0] - (p0 >> shift);
|
|
||||||
res[i+1] = smp[i+1] - (p1 >> shift);
|
res[i+1] = smp[i+1] - (p1 >> shift);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user