[x265] [PATCH] bitcost: avoid overflow when mvx and mvy costs are added together

Steve Borho steve at borho.org
Mon Jul 6 17:47:25 CEST 2015


On 07/06, deepthi at multicorewareinc.com wrote:
> # HG changeset patch
> # User Deepthi Nandakumar <deepthi at multicorewareinc.com>
> # Date 1436172175 -19800
> #      Mon Jul 06 14:12:55 2015 +0530
> # Node ID 0497a2dd6a2a20eaaac3c57302b3bc7f103f0854
> # Parent  bf57ce5d38d5208a491bf4192e389ab1eb4a4f32
> bitcost: avoid overflow when mvx and mvy costs are added together
> 
> This will prevent overflow and wrap-around errors, giving erroneously low mvcosts.

seems ok

> diff -r bf57ce5d38d5 -r 0497a2dd6a2a source/encoder/bitcost.cpp
> --- a/source/encoder/bitcost.cpp	Fri Jul 03 19:50:02 2015 +0530
> +++ b/source/encoder/bitcost.cpp	Mon Jul 06 14:12:55 2015 +0530
> @@ -45,7 +45,7 @@
>  
>              // estimate same cost for negative and positive MVD
>              for (int i = 0; i <= 2 * BC_MAX_MV; i++)
> -                s_costs[qp][i] = s_costs[qp][-i] = (uint16_t)X265_MIN(s_bitsizes[i] * lambda + 0.5f, (1 << 16) - 1);
> +                s_costs[qp][i] = s_costs[qp][-i] = (uint16_t)X265_MIN(s_bitsizes[i] * lambda + 0.5f, (1 << 15) - 1);
>          }
>      }
>  
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list