[FFmpeg-user] questions about libavcodec
卜弋天
buyit at live.cn
Mon Feb 27 10:34:03 CET 2012
Hi Experts:
please help, thanks very much.
Best Regards
From: buyit at live.cn
To: ffmpeg-user at ffmpeg.org
Subject: questions about libavcodec
Date: Sun, 26 Feb 2012 22:44:51 +0800
Hi experts:
i have some questions about the libavcodec.so:
1. when compiling, how can i specify this library is compiled for ARM? and it includes NEON instruction supports?
2. suppose ARCH_ARM and HAVE_NEON are defined, which i mentioned in question 1, does it mean this library can only be executed on ARM platform and the ARM chipset must have NEON module?
3. suppose the answer of quesion 2 is yes, then how can user choose libavcodec.so as they want? for example, there is an Android application "ROAMSAVE", it will use libavcodec.so, then how can i choose a suitable version libavcodec.so for roamsave? suppose i do not have any source code, and just want to download this library from internet, how can i find the correct libavcodec?
4. if the application roamsave together with a specific libavcodec run well on a Samsung smart phone, and i am sure this libavcodec supports ARM and can execute NEON instruction correctly. but when i use them on another smart phone(Motorola), it crashs in libavcodec.so, the problem is alignment of second parameter of function ff_scalarproduct_int16_neon(), and the crash point is as below:
vld1.16 {d20-d21}, [r1,:128]!
on ARM architecture, this assembler instruction has strict alignment requirement for r1 register,
it must align to 128 bit. when crash, the value of r1 is 0x002bb232, which is not align to 128 bit.
how can i find the root cause? the libavcodec runs NEON instruction well on Samsumg phone, so it means this library compiled with correct GCC version and can handle stack alignment well , right? but why it crashs because of alignment problem when run on another smart phone which also support NEON instruction?
from the point of my view, alignment control should be handled by libavcodec internal, the application roamsave just call API of libavcodec and should not be responsible for alignment , right?
when i check the source code of libavcodec, i find there is obviously abnormal code exist:
1. the crash function ff_scalarproduct_int16_neon is registered to be function scalarproduct_int16, the function define is in file Dsputil.h:
int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2/*align 16*/, int len, int shift);
it means the second parameter should align to 128 bits.
2. in file libavcodec\G729postfilter.c , function get_tile_comp() calls scalarproduct_int16() as below:
rh0 = dsp->scalarproduct_int16(lp_gn + 10, lp_gn + 10, 20, 0);
rh1 = dsp->scalarproduct_int16(lp_gn + 10, lp_gn + 11, 20, 0);
no doubt, "lp_gn + 10" and "lp_gn + 11" cannot align to 128 bits at the same time. how to explain this?
i am very confused about this issue, please help me, thanks very much.
Best Regards
More information about the ffmpeg-user
mailing list