Fix integer overflow issue in bits allocated
authorDeepa K G <deepa.kg@ittiam.com>
Wed, 30 Jan 2019 09:20:56 +0000 (14:50 +0530)
committerDeepa K G <deepa.kg@ittiam.com>
Thu, 31 Jan 2019 06:01:53 +0000 (11:31 +0530)
When encoding at high bitrates, integer overflow
occurs in the the calculation of bits allocated
for layered ARF frames.

Change-Id: I94ad9eea759367a222235a3b5d1c777578dc6ba9

vp9/encoder/vp9_firstpass.c

index 8f0da48..7844db9 100644 (file)
@@ -2340,7 +2340,7 @@ static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
       switch (gf_group->update_type[idx]) {
         case ARF_UPDATE:
           gf_group->bit_allocation[idx] =
-              (int)((arf_depth_bits[gf_group->layer_depth[idx]] *
+              (int)(((int64_t)arf_depth_bits[gf_group->layer_depth[idx]] *
                      gf_group->gfu_boost[idx]) /
                     arf_depth_boost[gf_group->layer_depth[idx]]);
           break;