summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2013-02-22 11:46:34 -0800
committerJames Zern <jzern@google.com>2013-02-22 12:45:28 -0800
commit4e00060d296d426814fc01d9ff874b1364691664 (patch)
tree62dbe5dccb054356eebf189c9500a8fd9ba8f19f
parent0ef72720d0c54be9faa8287652eeab7b4cd5b7fb (diff)
downloadlibvpx-4e00060d296d426814fc01d9ff874b1364691664.tar
libvpx-4e00060d296d426814fc01d9ff874b1364691664.tar.gz
libvpx-4e00060d296d426814fc01d9ff874b1364691664.tar.bz2
libvpx-4e00060d296d426814fc01d9ff874b1364691664.zip
vp8: make gf_group_bits 64-bit
avoids signed integer overflow; matches kf_group_bits Change-Id: I193145cdc4fa53e70fba0a1731a03eb1a574931d
-rw-r--r--vp8/encoder/firstpass.c6
-rw-r--r--vp8/encoder/onyx_int.h2
-rw-r--r--vp9/encoder/vp9_firstpass.c5
3 files changed, 8 insertions, 5 deletions
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index 68095ca68..406113dbb 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -2131,8 +2131,10 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
/* Clip cpi->twopass.gf_group_bits based on user supplied data rate
* variability limit (cpi->oxcf.two_pass_vbrmax_section)
*/
- if (cpi->twopass.gf_group_bits > max_bits * cpi->baseline_gf_interval)
- cpi->twopass.gf_group_bits = max_bits * cpi->baseline_gf_interval;
+ if (cpi->twopass.gf_group_bits >
+ (int64_t)max_bits * cpi->baseline_gf_interval)
+ cpi->twopass.gf_group_bits =
+ (int64_t)max_bits * cpi->baseline_gf_interval;
/* Reset the file position */
reset_fpf_position(cpi, start_pos);
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index fb8ad357c..378731d0a 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -587,7 +587,7 @@ typedef struct VP8_COMP
/* Error score of frames still to be coded in kf group */
int64_t kf_group_error_left;
/* Projected Bits available for a group including 1 GF or ARF */
- int gf_group_bits;
+ int64_t gf_group_bits;
/* Bits for the golden frame or ARF */
int gf_bits;
int alt_extra_bits;
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index db981754e..f38e5397b 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1707,8 +1707,9 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// Clip cpi->twopass.gf_group_bits based on user supplied data rate
// variability limit (cpi->oxcf.two_pass_vbrmax_section)
- if (cpi->twopass.gf_group_bits > max_bits * cpi->baseline_gf_interval)
- cpi->twopass.gf_group_bits = max_bits * cpi->baseline_gf_interval;
+ if (cpi->twopass.gf_group_bits >
+ (int64_t)max_bits * cpi->baseline_gf_interval)
+ cpi->twopass.gf_group_bits = (int64_t)max_bits * cpi->baseline_gf_interval;
// Reset the file position
reset_fpf_position(cpi, start_pos);