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 #include "config.h"
26 #include "libavutil/intmath.h"
27 
28 #if HAVE_ARMV6_INLINE && AV_GCC_VERSION_AT_LEAST(4,4) && !CONFIG_THUMB
29 
30 #define decode_blockcodes decode_blockcodes
31 static inline int decode_blockcodes(int code1, int code2, int levels,
32  int *values)
33 {
34  int v0, v1, v2, v3, v4, v5;
35 
36  __asm__ ("smmul %8, %14, %18 \n"
37  "smmul %11, %15, %18 \n"
38  "smlabb %14, %8, %17, %14 \n"
39  "smlabb %15, %11, %17, %15 \n"
40  "smmul %9, %8, %18 \n"
41  "smmul %12, %11, %18 \n"
42  "sub %14, %14, %16, lsr #1 \n"
43  "sub %15, %15, %16, lsr #1 \n"
44  "smlabb %8, %9, %17, %8 \n"
45  "smlabb %11, %12, %17, %11 \n"
46  "smmul %10, %9, %18 \n"
47  "smmul %13, %12, %18 \n"
48  "str %14, %0 \n"
49  "str %15, %4 \n"
50  "sub %8, %8, %16, lsr #1 \n"
51  "sub %11, %11, %16, lsr #1 \n"
52  "smlabb %9, %10, %17, %9 \n"
53  "smlabb %12, %13, %17, %12 \n"
54  "smmul %14, %10, %18 \n"
55  "smmul %15, %13, %18 \n"
56  "str %8, %1 \n"
57  "str %11, %5 \n"
58  "sub %9, %9, %16, lsr #1 \n"
59  "sub %12, %12, %16, lsr #1 \n"
60  "smlabb %10, %14, %17, %10 \n"
61  "smlabb %13, %15, %17, %13 \n"
62  "str %9, %2 \n"
63  "str %12, %6 \n"
64  "sub %10, %10, %16, lsr #1 \n"
65  "sub %13, %13, %16, lsr #1 \n"
66  "str %10, %3 \n"
67  "str %13, %7 \n"
68  : "=m"(values[0]), "=m"(values[1]),
69  "=m"(values[2]), "=m"(values[3]),
70  "=m"(values[4]), "=m"(values[5]),
71  "=m"(values[6]), "=m"(values[7]),
72  "=&r"(v0), "=&r"(v1), "=&r"(v2),
73  "=&r"(v3), "=&r"(v4), "=&r"(v5),
74  "+&r"(code1), "+&r"(code2)
75  : "r"(levels - 1), "r"(-levels), "r"(ff_inverse[levels]));
76 
77  return code1 | code2;
78 }
79 
80 #endif
81 
82 #if HAVE_NEON_INLINE && HAVE_ASM_MOD_Y
83 
84 #define int8x8_fmul_int32 int8x8_fmul_int32
85 static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
86 {
87  __asm__ ("vcvt.f32.s32 %2, %2, #4 \n"
88  "vld1.8 {d0}, [%1,:64] \n"
89  "vmovl.s8 q0, d0 \n"
90  "vmovl.s16 q1, d1 \n"
91  "vmovl.s16 q0, d0 \n"
92  "vcvt.f32.s32 q0, q0 \n"
93  "vcvt.f32.s32 q1, q1 \n"
94  "vmul.f32 q0, q0, %y2 \n"
95  "vmul.f32 q1, q1, %y2 \n"
96  "vst1.32 {q0-q1}, [%m0,:128] \n"
97  : "=Um"(*(float (*)[8])dst)
98  : "r"(src), "x"(scale)
99  : "d0", "d1", "d2", "d3");
100 }
101 
102 #endif
103 
104 #endif /* AVCODEC_ARM_DCA_H */