[FFmpeg-devel] [PATCH] avcodec: loongson fix optimized ff_sqrt bug
周晓勇
zhouxiaoyong at loongson.cn
Thu May 14 11:49:32 CEST 2015
>From a825fc8ad61d6296d12cc4074eda494e4b978fa3 Mon Sep 17 00:00:00 2001
From: ZhouXiaoyong <zhouxiaoyong at loongson.cn>
Date: Fri, 15 May 2015 01:30:42 +0800
Subject: [PATCH] avcodec: loongson fix optimized ff_sqrt bug
Signed-off-by: ZhouXiaoyong <zhouxiaoyong at loongson.cn>
---
libavcodec/mips/mathops.h | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/libavcodec/mips/mathops.h b/libavcodec/mips/mathops.h
index cdc7705..76a0f2d 100644
--- a/libavcodec/mips/mathops.h
+++ b/libavcodec/mips/mathops.h
@@ -76,15 +76,12 @@ static inline av_const int mid_pred(int a, int b, int c)
#define ff_sqrt ff_sqrt
static inline av_const unsigned int ff_sqrt(unsigned int a)
{
- unsigned int b;
+ float b;
+ __asm__ ("sqrt.s %0, %1 \n\t"
+ : "=f"(b)
+ : "f"((float)a));
- __asm__ ("ctc1 %1, $f0 \n\t"
- "sqrt.s $f2, $f0 \n\t"
- "cvt.w.s $f0, $f2 \n\t"
- "cfc1 %0, $f0 \n\t"
- : "=r"(b)
- : "r"(a));
- return b;
+ return (unsigned int)b;
}
static inline av_const int64_t MAC64(int64_t d, int a, int b)
--
2.1.4
More information about the ffmpeg-devel
mailing list