2 * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
4 * This file is part of Libav.
6 * Libav 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.
11 * Libav 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.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with Libav; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef AVCODEC_ARM_DCA_H
22 #define AVCODEC_ARM_DCA_H
26 #include "libavutil/intmath.h"
28 #if HAVE_ARMV6 && HAVE_INLINE_ASM
30 #define decode_blockcode decode_blockcode
31 static inline int decode_blockcode(int code, int levels, int *values)
35 __asm__ ("smmul %4, %8, %11 \n"
36 "smlabb %8, %4, %10, %8 \n"
37 "smmul %5, %4, %11 \n"
38 "sub %8, %8, %9, lsr #1 \n"
39 "smlabb %4, %5, %10, %4 \n"
40 "smmul %6, %5, %11 \n"
42 "sub %4, %4, %9, lsr #1 \n"
43 "smlabb %5, %6, %10, %5 \n"
44 "smmul %7, %6, %11 \n"
46 "sub %5, %5, %9, lsr #1 \n"
47 "smlabb %6, %7, %10, %6 \n"
50 "sub %6, %6, %9, lsr #1 \n"
54 : "=m"(values[0]), "=m"(values[1]),
55 "=m"(values[2]), "=m"(values[3]),
56 "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3),
58 : "r"(levels - 1), "r"(-levels), "r"(ff_inverse[levels])
66 #if HAVE_NEON && HAVE_INLINE_ASM && HAVE_ASM_MOD_Y
68 #define int8x8_fmul_int32 int8x8_fmul_int32
69 static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
71 __asm__ ("vcvt.f32.s32 %2, %2, #4 \n"
72 "vld1.8 {d0}, [%1,:64] \n"
76 "vcvt.f32.s32 q0, q0 \n"
77 "vcvt.f32.s32 q1, q1 \n"
78 "vmul.f32 q0, q0, %y2 \n"
79 "vmul.f32 q1, q1, %y2 \n"
80 "vst1.32 {q0-q1}, [%m0,:128] \n"
81 : "=Um"(*(float (*)[8])dst)
82 : "r"(src), "x"(scale)
83 : "d0", "d1", "d2", "d3");
88 #endif /* AVCODEC_ARM_DCA_H */