Opened 12 years ago

Last modified 8 years ago

#598 assigned defect

alignment bug in liba52/resample_altivec.c

Reported by: ivan.middleton@… Owned by: reimar
Priority: normal Component: ad
Version: HEAD Severity: normal
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: Analyzed by developer:

Description

The AltiVec? load and store instructions require addresses to be 16-byte aligned
(the low 4 bits of the address are ignored). Since the code in
liba52/resample_altivec.c doesn't account for this, some very noticeable clicks
get introduced into the audio stream.

Attachments (1)

3sec.avi (162.8 KB) - added by ivan.middleton@… 12 years ago.
3-second AVI for testing altivec alignment bug

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by ivan.middleton@…

3-second AVI for testing altivec alignment bug

comment:1 Changed 12 years ago by ivan.middleton@…

The following commandline should exhibit the bug on a system with altivec:

mencoder -speed 0.95 -srate 48000 -af lavcresample=48000 -ovc copy -oac lavc
-lavcopts acodec=ac3:abitrate=128 3sec.avi -o clicks.avi

comment:2 Changed 12 years ago by ivan.middleton@…

  • Priority changed from important to normal

I should note that in most cases, the pointers passed to
a52_resample_STEREO_to_2_altivec are in fact 16-byte aligned.

The float pointer seems to always be aligned because of the memalign call in
a52_init (liba52/parse.c).

The int16 pointer s16 is sometimes not aligned-- the test case I've provided
seems to be exceptional because of the speed change.

It looks like it would be necessary to make sure that sh_audio->a_buffer /
sh_audio->a_buffer_len / sh_audio->a_out_buffer / sh_audio->a_out_buffer_len are
always 16-byte aligned. I can't tell whether this is feasible or not.

If that's not feasible, then the altivec code should test alignment and act
accordingly (I'm not sure what the fastest solution would be in the case of
non-alignment).

comment:3 Changed 12 years ago by poirierg@…

  • Status changed from new to assigned

(In reply to comment #1)

Created an attachment (id=274) [edit]
3-second AVI for testing altivec alignment bug

The following commandline should exhibit the bug on a system with altivec:

mencoder -speed 0.95 -srate 48000 -af lavcresample=48000 -ovc copy -oac lavc
-lavcopts acodec=ac3:abitrate=128 3sec.avi -o clicks.avi

Bug confirmed. I'll see what I can do. I'm afraid it's a bit too much of a corner case to have a high
priority in my list though :-(

Guillaume

comment:4 Changed 8 years ago by compn

  • Owner changed from r_togni@… to reimar
Note: See TracTickets for help on using tickets.