[x265] [PATCH 1/2] weight prediction: use sqrtf

Steve Borho steve at borho.org
Thu Mar 6 18:56:22 CET 2014


On Thu, Mar 6, 2014 at 11:44 AM, Rafaël Carré <funman at videolan.org> wrote:
> On 03/05/14 18:06, Steve Borho wrote:
>> On Wed, Mar 5, 2014 at 4:38 AM, Rafaël Carré <funman at videolan.org> wrote:
>>> ---
>>>  source/encoder/weightPrediction.cpp | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/source/encoder/weightPrediction.cpp b/source/encoder/weightPrediction.cpp
>>> index c04361a..c0710fd 100644
>>> --- a/source/encoder/weightPrediction.cpp
>>> +++ b/source/encoder/weightPrediction.cpp
>>> @@ -203,7 +203,7 @@ bool WeightPrediction::checkDenom(int denom)
>>>                  uint64_t fencVar = fenc->wp_ssd[yuv] + !ref->wp_ssd[yuv];
>>>                  uint64_t refVar  = ref->wp_ssd[yuv] + !ref->wp_ssd[yuv];
>>>                  if (fencVar && refVar)
>>> -                    guessScale[yuv] = Clip3(-2.f, 1.8f, std::sqrt((float)fencVar / refVar));
>>> +                    guessScale[yuv] = Clip3(-2.f, 1.8f, sqrtf((float)fencVar / refVar));
>>
>> Is something wrong with std::sqrt?
>
> I got:
> x265/source/encoder/weightPrediction.cpp:206:57: error: 'sqrt' is not a
> member of 'std'
>
> With g++ 4.8.2
>
> Full command line is :
>
> cd /home/fun/x265/source/encoder && /usr/bin/c++   -DHAVE_INT_TYPES_H=1
> -DHIGH_BIT_DEPTH=0 -DLOG_CU_STATISTICS=0 -DX265_ARCH_X86=1 -DX86_64=1
> -O2 -g -DNDEBUG -I/home/fun/x265/source/. -I/home/fun/x265/source/Lib
> -I/home/fun/x265/source/common -I/home/fun/x265/source/encoder
> -I/home/fun/x265/source    -Wall -Wextra -Wshadow -ffast-math
> -mstackrealign -fPIC -o CMakeFiles/encoder.dir/weightPrediction.cpp.o -c
> /home/fun/x265/source/encoder/weightPrediction.cpp
>
> Perhaps I am missing a -stdc++=something that was added later?

No, I don't believe so.  I build this regularly with gcc 4.8.1 on both
Linux and MinGW.

http://en.cppreference.com/w/cpp/numeric/math/sqrt

Does adding #include <cmath> to the file help?

-- 
Steve Borho


More information about the x265-devel mailing list