• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/arm/dca.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
00003  *
00004  * This file is part of Libav.
00005  *
00006  * Libav is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * Libav is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with Libav; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #ifndef AVCODEC_ARM_DCA_H
00022 #define AVCODEC_ARM_DCA_H
00023 
00024 #include <stdint.h>
00025 #include "config.h"
00026 #include "libavutil/intmath.h"
00027 
00028 #if HAVE_ARMV6 && HAVE_INLINE_ASM && AV_GCC_VERSION_AT_LEAST(4,4)
00029 
00030 #define decode_blockcodes decode_blockcodes
00031 static inline int decode_blockcodes(int code1, int code2, int levels,
00032                                     int *values)
00033 {
00034     int v0, v1, v2, v3, v4, v5;
00035 
00036     __asm__ ("smmul   %8,  %14, %18           \n"
00037              "smmul   %11, %15, %18           \n"
00038              "smlabb  %14, %8,  %17, %14      \n"
00039              "smlabb  %15, %11, %17, %15      \n"
00040              "smmul   %9,  %8,  %18           \n"
00041              "smmul   %12, %11, %18           \n"
00042              "sub     %14, %14, %16, lsr #1   \n"
00043              "sub     %15, %15, %16, lsr #1   \n"
00044              "smlabb  %8,  %9,  %17, %8       \n"
00045              "smlabb  %11, %12, %17, %11      \n"
00046              "smmul   %10, %9,  %18           \n"
00047              "smmul   %13, %12, %18           \n"
00048              "str     %14, %0                 \n"
00049              "str     %15, %4                 \n"
00050              "sub     %8,  %8,  %16, lsr #1   \n"
00051              "sub     %11, %11, %16, lsr #1   \n"
00052              "smlabb  %9,  %10, %17, %9       \n"
00053              "smlabb  %12, %13, %17, %12      \n"
00054              "smmul   %14, %10, %18           \n"
00055              "smmul   %15, %13, %18           \n"
00056              "str     %8,  %1                 \n"
00057              "str     %11, %5                 \n"
00058              "sub     %9,  %9,  %16, lsr #1   \n"
00059              "sub     %12, %12, %16, lsr #1   \n"
00060              "smlabb  %10, %14, %17, %10      \n"
00061              "smlabb  %13, %15, %17, %13      \n"
00062              "str     %9,  %2                 \n"
00063              "str     %12, %6                 \n"
00064              "sub     %10, %10, %16, lsr #1   \n"
00065              "sub     %13, %13, %16, lsr #1   \n"
00066              "str     %10, %3                 \n"
00067              "str     %13, %7                 \n"
00068              : "=m"(values[0]), "=m"(values[1]),
00069                "=m"(values[2]), "=m"(values[3]),
00070                "=m"(values[4]), "=m"(values[5]),
00071                "=m"(values[6]), "=m"(values[7]),
00072                "=&r"(v0), "=&r"(v1), "=&r"(v2),
00073                "=&r"(v3), "=&r"(v4), "=&r"(v5),
00074                "+&r"(code1), "+&r"(code2)
00075              : "r"(levels - 1), "r"(-levels), "r"(ff_inverse[levels]));
00076 
00077     return code1 | code2;
00078 }
00079 
00080 #endif
00081 
00082 #if HAVE_NEON && HAVE_INLINE_ASM && HAVE_ASM_MOD_Y
00083 
00084 #define int8x8_fmul_int32 int8x8_fmul_int32
00085 static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
00086 {
00087     __asm__ ("vcvt.f32.s32 %2,  %2,  #4         \n"
00088              "vld1.8       {d0},     [%1,:64]   \n"
00089              "vmovl.s8     q0,  d0              \n"
00090              "vmovl.s16    q1,  d1              \n"
00091              "vmovl.s16    q0,  d0              \n"
00092              "vcvt.f32.s32 q0,  q0              \n"
00093              "vcvt.f32.s32 q1,  q1              \n"
00094              "vmul.f32     q0,  q0,  %y2        \n"
00095              "vmul.f32     q1,  q1,  %y2        \n"
00096              "vst1.32      {q0-q1},  [%m0,:128] \n"
00097              : "=Um"(*(float (*)[8])dst)
00098              : "r"(src), "x"(scale)
00099              : "d0", "d1", "d2", "d3");
00100 }
00101 
00102 #endif
00103 
00104 #endif /* AVCODEC_ARM_DCA_H */
Generated on Thu Jan 24 2013 17:08:50 for Libav by doxygen 1.7.1