[FFmpeg-devel] need help--- "roamsave" crashs in libavcodec.so

卜弋天 buyit at live.cn
Sun Feb 26 02:24:18 CET 2012

Hi All:
     i checked source code of libavcodec, i found that the function ff_scalarproduct_int16_neon will be registered to be scalarproduct_int16.
    and the scalarproduct_int16 function has declare as below:
    int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2/*align 16*/, int len, int shift);

    it means the second parameter must align to 128 bit. and this function will be used in files such as G729postfilter.c , 
    static int16_t long_term_filter(DSPContext *dsp, int pitch_delay_int,
                                const int16_t* residual, int16_t *residual_filt,
                                int subframe_size)
    int16_t sig_scaled[SUBFRAME_SIZE + RES_PREV_DATA_SIZE];

    ener = dsp->scalarproduct_int16(sig_scaled + RES_PREV_DATA_SIZE,
                                    sig_scaled + RES_PREV_DATA_SIZE,
                                    subframe_size, 0);

1. here the second parameter is sig_scaled + RES_PREV_DATA_SIZE,   
2. RES_PREV_DATA_SIZE is 512, so it align to 128 bit.
3. sig_scaled is a buffer, the size of which is SUBFRAME_SIZE + RES_PREV_DATA_SIZE = 552 Bytes, i don't think compiler will arrange this buffer to align to 128 Bit(16 bytes).
    so how can libavcodec use scalarproduct_int16 correctly? i am very confused about this.
    please help me , thanks very much.
Best Regards

> From: buyit at live.cn
> To: ffmpeg-devel at ffmpeg.org
> Date: Sun, 26 Feb 2012 00:01:52 +0800
> Subject: [FFmpeg-devel] need help--- "roamsave" crashs in libavcodec.so
> Hi All:
> there is a strange crash happens on ARM Cortex-A9 smart phone. the platform is Android 2.3, and the APK is "roamsave", i just use it to make a call, then the application roamsave crashs. the Andorid logcat information is as below:
> #00 pc 00015cec /data/data/com.pccw.mobile.sip/lib/libavcodec.so
> from the logcat , i found that the crash point is in function ff_scalarproduct_int16_neon, sentence vld1.16 {d20-d21}, [r1,:128]! . 
> this instruction has strict alignment requirement :128, but the r1 register has value 0x002bb232 , which is not align to 128 bit.
> so my question is : to obey the alignment of ARM NEON instrction, is this the responsibility of APK roamsave or libavcodec ?
> from the point of my view, the application roamsave just read a file to a buffer, call libavcodec API such as avcodec_encode_audio() to handle the audio data. application should not do anything to align the buffer which will be passed as parameter when call avcodec_encode_audio(). all alignment work should be handled inside libavcodec.so internally. 
> anybody who can give me some hint to figure out how can i investigate this issue? 
> thanks very much.
> Best Regards 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

More information about the ffmpeg-devel mailing list