ref: 4a168eb343af95be4b3a00ef2c5cf40da1d6b7e0
parent: 5752d659fda9194a95542093498e669d7059d725
author: Jean-Marc Valin <[email protected]>
date: Tue Dec 10 20:34:06 EST 2013
Remove useless code in alloc_trim_analysis()
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -756,7 +756,7 @@
int i;
opus_val32 diff=0;
int c;
- int trim_index = 5;
+ int trim_index;
opus_val16 trim = QCONST16(5.f, 8);
opus_val16 logXC, logXC2;
if (C==2)
@@ -781,14 +781,6 @@
}
minXC = MIN16(QCONST16(1.f, 10), ABS16(minXC));
/*printf ("%f\n", sum);*/
- if (sum > QCONST16(.995f,10))
- trim_index-=4;
- else if (sum > QCONST16(.92f,10))
- trim_index-=3;
- else if (sum > QCONST16(.85f,10))
- trim_index-=2;
- else if (sum > QCONST16(.8f,10))
- trim_index-=1;
/* mid-side savings estimations based on the LF average*/
logXC = celt_log2(QCONST32(1.001f, 20)-MULT16_16(sum, sum));
/* mid-side savings estimations based on min correlation */
@@ -812,14 +804,6 @@
} while (++c<C);
diff /= C*(end-1);
/*printf("%f\n", diff);*/
- if (diff > QCONST16(2.f, DB_SHIFT))
- trim_index--;
- if (diff > QCONST16(8.f, DB_SHIFT))
- trim_index--;
- if (diff < -QCONST16(4.f, DB_SHIFT))
- trim_index++;
- if (diff < -QCONST16(10.f, DB_SHIFT))
- trim_index++;
trim -= MAX16(-QCONST16(2.f, 8), MIN16(QCONST16(2.f, 8), SHR16(diff+QCONST16(1.f, DB_SHIFT),DB_SHIFT-8)/6 ));
trim -= SHR16(surround_trim, DB_SHIFT-8);
trim -= 2*SHR16(tf_estimate, 14-8);
@@ -836,10 +820,7 @@
#else
trim_index = (int)floor(.5f+trim);
#endif
- if (trim_index<0)
- trim_index = 0;
- if (trim_index>10)
- trim_index = 10;
+ trim_index = IMAX(0, IMIN(10, trim_index));
/*printf("%d\n", trim_index);*/
#ifdef FUZZING
trim_index = rand()%11;