| 1 | /* |
| 2 | * Copyright (c) 2011 Mans Rullgard <mans@mansr.com> |
| 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 | #ifndef AVCODEC_ARM_DCA_H |
| 22 | #define AVCODEC_ARM_DCA_H |
| 23 | |
| 24 | #include <stdint.h> |
| 25 | |
| 26 | #include "config.h" |
| 27 | #include "libavcodec/dcadsp.h" |
| 28 | #include "libavcodec/mathops.h" |
| 29 | |
| 30 | #if HAVE_ARMV6_INLINE && AV_GCC_VERSION_AT_LEAST(4,4) && !CONFIG_THUMB |
| 31 | |
| 32 | #define decode_blockcodes decode_blockcodes |
| 33 | static inline int decode_blockcodes(int code1, int code2, int levels, |
| 34 | int32_t *values) |
| 35 | { |
| 36 | int32_t v0, v1, v2, v3, v4, v5; |
| 37 | |
| 38 | __asm__ ("smmul %0, %6, %10 \n" |
| 39 | "smmul %3, %7, %10 \n" |
| 40 | "smlabb %6, %0, %9, %6 \n" |
| 41 | "smlabb %7, %3, %9, %7 \n" |
| 42 | "smmul %1, %0, %10 \n" |
| 43 | "smmul %4, %3, %10 \n" |
| 44 | "sub %6, %6, %8, lsr #1 \n" |
| 45 | "sub %7, %7, %8, lsr #1 \n" |
| 46 | "smlabb %0, %1, %9, %0 \n" |
| 47 | "smlabb %3, %4, %9, %3 \n" |
| 48 | "smmul %2, %1, %10 \n" |
| 49 | "smmul %5, %4, %10 \n" |
| 50 | "str %6, [%11, #0] \n" |
| 51 | "str %7, [%11, #16] \n" |
| 52 | "sub %0, %0, %8, lsr #1 \n" |
| 53 | "sub %3, %3, %8, lsr #1 \n" |
| 54 | "smlabb %1, %2, %9, %1 \n" |
| 55 | "smlabb %4, %5, %9, %4 \n" |
| 56 | "smmul %6, %2, %10 \n" |
| 57 | "smmul %7, %5, %10 \n" |
| 58 | "str %0, [%11, #4] \n" |
| 59 | "str %3, [%11, #20] \n" |
| 60 | "sub %1, %1, %8, lsr #1 \n" |
| 61 | "sub %4, %4, %8, lsr #1 \n" |
| 62 | "smlabb %2, %6, %9, %2 \n" |
| 63 | "smlabb %5, %7, %9, %5 \n" |
| 64 | "str %1, [%11, #8] \n" |
| 65 | "str %4, [%11, #24] \n" |
| 66 | "sub %2, %2, %8, lsr #1 \n" |
| 67 | "sub %5, %5, %8, lsr #1 \n" |
| 68 | "str %2, [%11, #12] \n" |
| 69 | "str %5, [%11, #28] \n" |
| 70 | : "=&r"(v0), "=&r"(v1), "=&r"(v2), |
| 71 | "=&r"(v3), "=&r"(v4), "=&r"(v5), |
| 72 | "+&r"(code1), "+&r"(code2) |
| 73 | : "r"(levels - 1), "r"(-levels), |
| 74 | "r"(ff_inverse[levels]), "r"(values) |
| 75 | : "memory"); |
| 76 | |
| 77 | return code1 | code2; |
| 78 | } |
| 79 | |
| 80 | #endif |
| 81 | |
| 82 | #endif /* AVCODEC_ARM_DCA_H */ |