2 * Optimization of some functions from mpegvideo.c for armv5te
3 * Copyright (c) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net>
5 * This file is part of Libav.
7 * Libav is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * Libav is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "libavutil/arm/asm.S"
26 * Special optimized version of dct_unquantize_h263_helper_c, it
27 * requires the block to be at least 8 bytes aligned, and may process
28 * more elements than requested. But it is guaranteed to never
29 * process more than 64 elements provided that count argument is <= 64,
30 * so it is safe. This function is optimized for a common distribution
31 * of values for nCoeffs (they are mostly multiple of 8 plus one or
32 * two extra elements). So this function processes data as 8 elements
33 * per loop iteration and contains optional 2 elements processing in
36 * Inner loop should take 6 cycles per element on arm926ej-s (Nokia 770)
39 .macro dequant_t dst, src, mul, add, tmp
40 rsbs \tmp, ip, \src, asr #16
46 smlatbne \dst, \src, \mul, \tmp
49 .macro dequant_b dst, src, mul, add, tmp
50 rsbs \tmp, ip, \src, lsl #16
56 smlabbne \dst, \src, \mul, \tmp
59 function ff_dct_unquantize_h263_armv5te, export=1
68 dequant_t r9, r4, r1, r2, r9
69 dequant_t lr, r5, r1, r2, lr
70 dequant_b r4, r4, r1, r2, r8
71 dequant_b r5, r5, r1, r2, r8
78 dequant_t r9, r6, r1, r2, r9
79 dequant_t lr, r7, r1, r2, lr
80 dequant_b r6, r6, r1, r2, r8
81 dequant_b r7, r7, r1, r2, r8
90 ldrdgt r4, r5, [r0, #0] /* load data early to avoid load/use pipeline stall */
104 smlabbne r9, r9, r1, r8
110 smlabbne lr, lr, r1, r8