FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dca.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
3  *
4  * This file is part of Libav.
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #ifndef AVCODEC_ARM_DCA_H
22 #define AVCODEC_ARM_DCA_H
23 
24 #include <stdint.h>
25 
26 #include "config.h"
27 #include "libavcodec/mathops.h"
28 
29 #if HAVE_ARMV6_INLINE && AV_GCC_VERSION_AT_LEAST(4,4) && !CONFIG_THUMB
30 
31 #define decode_blockcodes decode_blockcodes
32 static inline int decode_blockcodes(int code1, int code2, int levels,
33  int *values)
34 {
35  int v0, v1, v2, v3, v4, v5;
36 
37  __asm__ ("smmul %8, %14, %18 \n"
38  "smmul %11, %15, %18 \n"
39  "smlabb %14, %8, %17, %14 \n"
40  "smlabb %15, %11, %17, %15 \n"
41  "smmul %9, %8, %18 \n"
42  "smmul %12, %11, %18 \n"
43  "sub %14, %14, %16, lsr #1 \n"
44  "sub %15, %15, %16, lsr #1 \n"
45  "smlabb %8, %9, %17, %8 \n"
46  "smlabb %11, %12, %17, %11 \n"
47  "smmul %10, %9, %18 \n"
48  "smmul %13, %12, %18 \n"
49  "str %14, %0 \n"
50  "str %15, %4 \n"
51  "sub %8, %8, %16, lsr #1 \n"
52  "sub %11, %11, %16, lsr #1 \n"
53  "smlabb %9, %10, %17, %9 \n"
54  "smlabb %12, %13, %17, %12 \n"
55  "smmul %14, %10, %18 \n"
56  "smmul %15, %13, %18 \n"
57  "str %8, %1 \n"
58  "str %11, %5 \n"
59  "sub %9, %9, %16, lsr #1 \n"
60  "sub %12, %12, %16, lsr #1 \n"
61  "smlabb %10, %14, %17, %10 \n"
62  "smlabb %13, %15, %17, %13 \n"
63  "str %9, %2 \n"
64  "str %12, %6 \n"
65  "sub %10, %10, %16, lsr #1 \n"
66  "sub %13, %13, %16, lsr #1 \n"
67  "str %10, %3 \n"
68  "str %13, %7 \n"
69  : "=m"(values[0]), "=m"(values[1]),
70  "=m"(values[2]), "=m"(values[3]),
71  "=m"(values[4]), "=m"(values[5]),
72  "=m"(values[6]), "=m"(values[7]),
73  "=&r"(v0), "=&r"(v1), "=&r"(v2),
74  "=&r"(v3), "=&r"(v4), "=&r"(v5),
75  "+&r"(code1), "+&r"(code2)
76  : "r"(levels - 1), "r"(-levels), "r"(ff_inverse[levels]));
77 
78  return code1 | code2;
79 }
80 
81 #endif
82 
83 #if HAVE_NEON_INLINE && HAVE_ASM_MOD_Y
84 
85 #define int8x8_fmul_int32 int8x8_fmul_int32
86 static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
87 {
88  __asm__ ("vcvt.f32.s32 %2, %2, #4 \n"
89  "vld1.8 {d0}, [%1,:64] \n"
90  "vmovl.s8 q0, d0 \n"
91  "vmovl.s16 q1, d1 \n"
92  "vmovl.s16 q0, d0 \n"
93  "vcvt.f32.s32 q0, q0 \n"
94  "vcvt.f32.s32 q1, q1 \n"
95  "vmul.f32 q0, q0, %y2 \n"
96  "vmul.f32 q1, q1, %y2 \n"
97  "vst1.32 {q0-q1}, [%m0,:128] \n"
98  : "=Um"(*(float (*)[8])dst)
99  : "r"(src), "x"(scale)
100  : "d0", "d1", "d2", "d3");
101 }
102 
103 #endif
104 
105 #endif /* AVCODEC_ARM_DCA_H */