[MPlayer-dev-eng] more on af_resample.c

Arpi arpi at thot.banki.hu
Thu Oct 3 00:47:39 CEST 2002


Hi,

what about this optimization:  works well for me but i'm not sure it's
correct and won't overflow for certain samples:

-#define FIR(x,w,y){ \
-  int16_t a = (w[0] *x[0] +w[1] *x[1] +w[2] *x[2] +w[3] *x[3] ) >> 16; \
-  int16_t b = (w[4] *x[4] +w[5] *x[5] +w[6] *x[6] +w[7] *x[7] ) >> 16; \
-  int16_t c = (w[8] *x[8] +w[9] *x[9] +w[10]*x[10]+w[11]*x[11]) >> 16; \
-  int16_t d = (w[12]*x[12]+w[13]*x[13]+w[14]*x[14]+w[15]*x[15]) >> 16; \
-  y[0]      = (a+b+c+d) >> 1; \
-}
+#define FIR(x,w,y) \
+  y[0] = ( w[0] *x[0] +w[1] *x[1] +w[2] *x[2] +w[3] *x[3] \
+         + w[4] *x[4] +w[5] *x[5] +w[6] *x[6] +w[7] *x[7] \
+         + w[8] *x[8] +w[9] *x[9] +w[10]*x[10]+w[11]*x[11] \
+         + w[12]*x[12]+w[13]*x[13]+w[14]*x[14]+w[15]*x[15] ) >> 16

and a question: why is the resample filter range limited to 
8001 Hz .. 192000 Hz ? it works fine even at 2000 Hz :)

-    if(((int*)arg)[0] <= 8000 || ((int*)arg)[0] > 192000){
-      mp_msg(MSGT_AFILTER,MSGL_ERR,"[resample] The output sample frequency must be between 8kHz and 192kHz. Current value is %i \n",((int*)arg)[0]);
+    if(((int*)arg)[0] < 2000 || ((int*)arg)[0] > 192000){
+      mp_msg(MSGT_AFILTER,MSGL_ERR,"[resample] The output sample frequency must be between 2kHz and 192kHz. Current value is %i \n",((int*)arg)[0]);

A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu



More information about the MPlayer-dev-eng mailing list