libavcodec/x86/mathops.h

Go to the documentation of this file.
00001 /*
00002  * simple math operations
00003  * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #ifndef AVCODEC_X86_MATHOPS_H
00023 #define AVCODEC_X86_MATHOPS_H
00024 
00025 #include "config.h"
00026 #include "libavutil/common.h"
00027 
00028 #if ARCH_X86_32
00029 #define MULL(ra, rb, shift) \
00030  ({ int rt, dummy; __asm__ (\
00031  "imull %3 \n\t"\
00032  "shrdl %4, %%edx, %%eax \n\t"\
00033  : "=a"(rt), "=d"(dummy)\
00034  : "a" ((int)ra), "rm" ((int)rb), "i"(shift));\
00035  rt; })
00036 
00037 #define MULH(ra, rb) \
00038  ({ int rt, dummy;\
00039  __asm__ ("imull %3\n\t" : "=d"(rt), "=a"(dummy): "a" ((int)ra), "rm" ((int)rb));\
00040  rt; })
00041 
00042 #define MUL64(ra, rb) \
00043  ({ int64_t rt;\
00044  __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)ra), "g" ((int)rb));\
00045  rt; })
00046 #endif
00047 
00048 #if HAVE_CMOV
00049 /* median of 3 */
00050 #define mid_pred mid_pred
00051 static inline av_const int mid_pred(int a, int b, int c)
00052 {
00053 int i=b;
00054 __asm__ volatile(
00055 "cmp %2, %1 \n\t"
00056 "cmovg %1, %0 \n\t"
00057 "cmovg %2, %1 \n\t"
00058 "cmp %3, %1 \n\t"
00059 "cmovl %3, %1 \n\t"
00060 "cmp %1, %0 \n\t"
00061 "cmovg %1, %0 \n\t"
00062 :"+&r"(i), "+&r"(a)
00063 :"r"(b), "r"(c)
00064 );
00065 return i;
00066 }
00067 #endif
00068 
00069 #endif /* AVCODEC_X86_MATHOPS_H */

Generated on Fri Oct 26 02:35:35 2012 for FFmpeg by doxygen 1.5.8

AltStyle によって変換されたページ (->オリジナル) /