1/* 2 * Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net> 3 * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21#include "config.h" 22#include "libavutil/arm/asm.S" 23 24/** 25 * ARM VFP optimized float to int16 conversion. 26 * Assume that len is a positive number and is multiple of 8, destination 27 * buffer is at least 4 bytes aligned (8 bytes alignment is better for 28 * performance), little-endian byte sex. 29 */ 30@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len) 31function ff_float_to_int16_vfp, export=1 32 push {r4-r8,lr} 33 vpush {d8-d11} 34 vldmia r1!, {s16-s23} 35 vcvt.s32.f32 s0, s16 36 vcvt.s32.f32 s1, s17 37 vcvt.s32.f32 s2, s18 38 vcvt.s32.f32 s3, s19 39 vcvt.s32.f32 s4, s20 40 vcvt.s32.f32 s5, s21 41 vcvt.s32.f32 s6, s22 42 vcvt.s32.f32 s7, s23 431: 44 subs r2, r2, #8 45 vmov r3, r4, s0, s1 46 vmov r5, r6, s2, s3 47 vmov r7, r8, s4, s5 48 vmov ip, lr, s6, s7 49 it gt 50 vldmiagt r1!, {s16-s23} 51 ssat r4, #16, r4 52 ssat r3, #16, r3 53 ssat r6, #16, r6 54 ssat r5, #16, r5 55 pkhbt r3, r3, r4, lsl #16 56 pkhbt r4, r5, r6, lsl #16 57 itttt gt 58 vcvtgt.s32.f32 s0, s16 59 vcvtgt.s32.f32 s1, s17 60 vcvtgt.s32.f32 s2, s18 61 vcvtgt.s32.f32 s3, s19 62 itttt gt 63 vcvtgt.s32.f32 s4, s20 64 vcvtgt.s32.f32 s5, s21 65 vcvtgt.s32.f32 s6, s22 66 vcvtgt.s32.f32 s7, s23 67 ssat r8, #16, r8 68 ssat r7, #16, r7 69 ssat lr, #16, lr 70 ssat ip, #16, ip 71 pkhbt r5, r7, r8, lsl #16 72 pkhbt r6, ip, lr, lsl #16 73 stmia r0!, {r3-r6} 74 bgt 1b 75 76 vpop {d8-d11} 77 pop {r4-r8,pc} 78endfunc 79