summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Larsson <banan@ludd.ltu.se>2006-04-28 14:19:11 +0000
committerBenjamin Larsson <banan@ludd.ltu.se>2006-04-28 14:19:11 +0000
commit6eb1427f0fbfe74946a104f067072131c693e570 (patch)
tree045e070faad626c03f6117f7556a6ce4aaa099c7
parent392f6da8971b0beda317fb6433e2d45b2e4d3cc8 (diff)
Revert bad ac3enc commit, the commited code was bigger and slower.
Originally committed as revision 5327 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/ac3enc.c47
-rw-r--r--libavcodec/ac3tab.h41
2 files changed, 38 insertions, 50 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index a587c647b5..5ec8b4f5ac 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -81,51 +81,6 @@ static inline int16_t fix15(float a)
return v;
}
-
-/**
- * Generate a Kaiser Window.
- */
-static void k_window_init(int alpha, double *window, int n, int iter)
-{
- int j, k;
- double a, x;
- a = alpha * M_PI / n;
- a = a*a;
- for(k=0; k<n; k++) {
- x = k * (n - k) * a;
- window[k] = 1.0;
- for(j=iter; j>0; j--) {
- window[k] = (window[k] * x / (j*j)) + 1.0;
- }
- }
-}
-
-/**
- * Generate a Kaiser-Bessel Derived Window.
- * @param alpha determines window shape
- * @param window array to fill with window values
- * @param iter number of iterations to use in BesselI0
- */
-
-static void kbd_window_init(int alpha, int16_t *out_window, int iter)
-{
- int k, n2;
- double kwindow[256];
- double window[256];
-
- n2 = 256;
- k_window_init(alpha, kwindow, n2, iter);
- window[0] = kwindow[0];
- for(k=1; k<n2; k++) {
- window[k] = window[k-1] + kwindow[k];
- }
- for(k=0; k<n2; k++) {
- window[k] = sqrt(window[k] / (window[n2-1]+1));
- //out_window[k] = round(window[k]*((1<<15)-1)); //enable this for a rounded window
- out_window[k] = fix15(window[k]);
- }
-}
-
static inline int calc_lowcomp1(int a, int b0, int b1)
{
if ((b0 + 256) == b1) {
@@ -927,8 +882,6 @@ static int AC3_encode_init(AVCodecContext *avctx)
ac3_common_init();
/* mdct init */
- kbd_window_init(5.0, ac3_window, 50);
-
fft_init(MDCT_NBITS - 2);
for(i=0;i<N/4;i++) {
alpha = 2 * M_PI * (i + 1.0 / 8.0) / (float)N;
diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
index 3621b87a71..d8771fbeee 100644
--- a/libavcodec/ac3tab.h
+++ b/libavcodec/ac3tab.h
@@ -12,6 +12,44 @@ static const uint16_t ac3_bitratetab[19] = {
160, 192, 224, 256, 320, 384, 448, 512, 576, 640
};
+/* AC3 MDCT window */
+
+/* MDCT window */
+static const int16_t ac3_window[256] = {
+ 4, 7, 12, 16, 21, 28, 34, 42,
+ 51, 61, 72, 84, 97, 111, 127, 145,
+ 164, 184, 207, 231, 257, 285, 315, 347,
+ 382, 419, 458, 500, 544, 591, 641, 694,
+ 750, 810, 872, 937, 1007, 1079, 1155, 1235,
+ 1318, 1406, 1497, 1593, 1692, 1796, 1903, 2016,
+ 2132, 2253, 2379, 2509, 2644, 2783, 2927, 3076,
+ 3230, 3389, 3552, 3721, 3894, 4072, 4255, 4444,
+ 4637, 4835, 5038, 5246, 5459, 5677, 5899, 6127,
+ 6359, 6596, 6837, 7083, 7334, 7589, 7848, 8112,
+ 8380, 8652, 8927, 9207, 9491, 9778,10069,10363,
+10660,10960,11264,11570,11879,12190,12504,12820,
+13138,13458,13780,14103,14427,14753,15079,15407,
+15735,16063,16392,16720,17049,17377,17705,18032,
+18358,18683,19007,19330,19651,19970,20287,20602,
+20914,21225,21532,21837,22139,22438,22733,23025,
+23314,23599,23880,24157,24430,24699,24964,25225,
+25481,25732,25979,26221,26459,26691,26919,27142,
+27359,27572,27780,27983,28180,28373,28560,28742,
+28919,29091,29258,29420,29577,29729,29876,30018,
+30155,30288,30415,30538,30657,30771,30880,30985,
+31086,31182,31274,31363,31447,31528,31605,31678,
+31747,31814,31877,31936,31993,32046,32097,32145,
+32190,32232,32272,32310,32345,32378,32409,32438,
+32465,32490,32513,32535,32556,32574,32592,32608,
+32623,32636,32649,32661,32671,32681,32690,32698,
+32705,32712,32718,32724,32729,32733,32737,32741,
+32744,32747,32750,32752,32754,32756,32757,32759,
+32760,32761,32762,32763,32764,32764,32765,32765,
+32766,32766,32766,32766,32767,32767,32767,32767,
+32767,32767,32767,32767,32767,32767,32767,32767,
+32767,32767,32767,32767,32767,32767,32767,32767,
+};
+
static uint8_t masktab[253];
static const uint8_t latab[260]= {
@@ -138,9 +176,6 @@ static const uint8_t bndsz[50]={
static uint8_t bndtab[51];
-/* AC3 MDCT window */
-static int16_t ac3_window[256];
-
/* fft & mdct sin cos tables */
static int16_t costab[64];
static int16_t sintab[64];