Web lists-archives.org

[MPlayer-dev-eng] [PATCH] remove crackle from a52 resample_altivec




Removes the crackling from the sound when a52 downmixes with altivec 
instructions.
Put in an upperbounds check on values, as currently only a lowerbounds check 
was being done in the altivec version, but both were done in the standard C 
one.

Regards,
Carl O'Dwyer
Index: liba52/resample_altivec.c
===================================================================
--- liba52/resample_altivec.c	(revision 27209)
+++ liba52/resample_altivec.c	(working copy)
@@ -27,10 +27,15 @@
 #endif
 
 const vector signed int magic = {0x43c00000,0x43c00000,0x43c00000,0x43c00000};
+const vector signed int magicmax = {0x43c07fff,0x43c07fff,0x43c07fff,0x43c07fff};
 
 static inline vector signed short convert16_altivec(vector signed int v1, vector signed int v2)
 {
   register vector signed short result;
+
+  v1 = vec_min(v1,magicmax);
+  v2 = vec_min(v2,magicmax);
+
   v1 = vec_subs(v1, magic);
   v2 = vec_subs(v2, magic);
   result = vec_packs(v1, v2);
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng