G729 codec compiled for iOS arm64 does not function properly -


i used g729 codec in voip app, when app target armv7, works fine. callee can hear voice clearly. turn arm64, callee no longer voice clearly. record input voice raw data before , after g729 codec both on armv7 device , arm64 device on caller side, , convert g729 encoded data back. find converted voice armv7 device better arm64 device.

this depends on g729 implementation using, if using samuel vinson's, believe found problem.

in lpc.c there comparison between result , subtraction between 2 values on lines 643 , 698 respectively:

lpc.c:643  if ((uword32)(t0 - 0xfe000000l) < 0x01ffffffl -  0xfe000000l) lpc.c:698  if ((uword32)(t0 - 0xff000000l) < 0x00ffffffl -  0xff000000l) 

the result of 0x00ffffffl - 0xff000000l 1ffffff (33554431) on 32 bit, ffffffff01ffffff (-4261412865) on 64 bit, because long way larger on 64 bit on arm processor (i testing iphone 4, armv7, 32 bit , iphone 5s, arm64, 64 bit).

so on 64 bit comparison fail check second term negative , uword32 positive.

my solution use hardcoded results of subtraction on 32 bit, using 0x3ffffffl first conditional , 0x1ffffffl second, fixes voice quality issue me:

lpc.c:643  if ((uword32)(t0 - 0xff000000l) < 0x3ffffffl) lpc.c:698  if ((uword32)(t0 - 0xfe000000l) < 0x1ffffffl) 

hope helps.


Comments