RE: MPlayer-dev-eng Digest, Vol 43, Issue 72
Date: Sat, 15 Jul 2006 17:53:05 +0200 From: "Emanuele Giaquinta" <emanuele.giaquinta@gmail.com> On 7/15/06, Romain Dolbeau <romain@dolbeau.org> wrote:
There's an assumption not mentioned in the code : that both parameters to the function a52_resample_STEREO_to_2_altivec are akligned on a 16-bytes boundary. You might want to check that dynamically, I'm not sure if it's really guaranteed or if it happens to "just work".
They are if the system has a working memalign, which should be the case on glibc.
-- Emanuele Giaquinta
ok, this memalign stuff might be the problem, I'll test it as soon as I can find some time (might take a few days). Anyway, parse.c from liba52 dynamically tests if it could get a memaligned malloc, if using SSE with these lines (at lines 77 to 80): if(((int)state->samples%16) && (mm_accel&MM_ACCEL_X86_SSE)){ mm_accel &=~MM_ACCEL_X86_SSE; fprintf(stderr, "liba52: unable to get 16 byte aligned memory disabling usage of SSE instructions\n"); } I guess we should at least add the same for PPCs altivec: if(((int)state->samples%16) && (mm_accel&MM_ACCEL_PPC_ALTIVEC)){ mm_accel &=~MM_ACCEL_PPC_ALTIVEC; fprintf(stderr, "liba52: unable to get 16 byte aligned memory disabling usage of ALTIVEC instructions\n"); } btw. mplayer configure detects a working memalign for the mini on linux, but I guess memalign can always go wrong.. do you agree Emanuele? Romain, Emanuele, I see in another mail ( do not define MEMALIGN_HACK on OSX) some problems with memalign on OSX? Is it possible that the altivec resampler works on OSX, but not on linux because of some side effect of this? Just a thought.... thanks& best regards, Bas Hulsken
Bas Hulsken wrote:
ok, this memalign stuff might be the problem, I'll test it as soon as I can find some time (might take a few days). Anyway, parse.c from liba52 dynamically tests if it could get a memaligned malloc, if using SSE with these lines (at lines 77 to 80):
if(((int)state->samples%16) && (mm_accel&MM_ACCEL_X86_SSE)){ mm_accel &=~MM_ACCEL_X86_SSE; fprintf(stderr, "liba52: unable to get 16 byte aligned memory disabling usage of SSE instructions\n"); }
Ugly and should be removed...
I guess we should at least add the same for PPCs altivec:
Maybe is possible to fix the original problem ^^;
btw. mplayer configure detects a working memalign for the mini on linux, but I guess memalign can always go wrong.. do you agree Emanuele?
if memalign exists and the people providing your glibc aren't morons or something quite ugly happened during the QA validation... ...shouldn't ^^;
Romain, Emanuele, I see in another mail ( do not define MEMALIGN_HACK on OSX) some problems with memalign on OSX? Is it possible that the altivec resampler works on OSX, but not on linux because of some side effect of this? Just a thought....
I'll hunt for a ac3 sample and I'll test soon. lu -- Luca Barbato Gentoo/linux Gentoo/PPC http://dev.gentoo.org/~lu_zero
On Mon, Jul 17, 2006 at 08:54:49AM +0000, Bas Hulsken wrote:
ok, this memalign stuff might be the problem, I'll test it as soon as I can find some time (might take a few days). Anyway, parse.c from liba52 dynamically tests if it could get a memaligned malloc, if using SSE with these lines (at lines 77 to 80):
if(((int)state->samples%16) && (mm_accel&MM_ACCEL_X86_SSE)){
Whoever wrote this code needs to drink 100l, because it (in principle) performs a DIVIDE instruction rather than an AND instruction due to the signed cast. If the cast were to unsigned or if they just wrote &15 like they mean, it would work correctly. gcc _may_ be able to tell that you only care if it's zero/nonzero and optimize away the divide, but I wouldn't count on it. Why can't people just write what they mean??
I guess we should at least add the same for PPCs altivec:
Absolutely not; this code is disgusting. Rich
Bas Hulsken wrote: [snip] I cannot reproduce the issue in gentoo/ppc lu -- Luca Barbato Gentoo/linux Gentoo/PPC http://dev.gentoo.org/~lu_zero
participants (3)
-
Bas Hulsken -
Luca Barbato -
Rich Felker