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

Steve Borho steve at borho.org
Wed Mar 5 18:06:16 CET 2014


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?

This line recently caught my attention; I could not figure out why the
output of sqrt() was being clipped to a negative base number, or why
it was clipped on top either, for that matter.

-- 
Steve Borho


More information about the x265-devel mailing list