>From a825fc8ad61d6296d12cc4074eda494e4b978fa3 Mon Sep 17 00:00:00 2001 From: ZhouXiaoyong <zhouxiaoy...@loongson.cn> Date: Fri, 15 May 2015 01:30:42 +0800 Subject: [PATCH] avcodec: loongson fix optimized ff_sqrt bug
Signed-off-by: ZhouXiaoyong <zhouxiaoy...@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 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel