ref: 73cbff0e531aea1c25a3c004afdee130651b6396
parent: 6b191c16c08de2431083410e33db72b97d65e184
author: Wan-Teh Chang <wtc@google.com>
date: Tue Nov 20 04:38:21 EST 2018
Declare buffer_alloc_sz and frame_size as size_t. Change-Id: Id632ddcbfb0bd3a4258aebdfb98f9dc2e4d04438
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -57,7 +57,7 @@
* uv_stride == y_stride/2, so enforce this here. */
int uv_stride = y_stride >> 1;
int uvplane_size = (uv_height + border) * uv_stride;
- const int frame_size = yplane_size + 2 * uvplane_size;
+ const size_t frame_size = yplane_size + 2 * uvplane_size;
if (!ybf->buffer_alloc) {
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, frame_size);
@@ -185,9 +185,9 @@
uint8_t *buf = NULL;
- // frame_size is stored in buffer_alloc_sz, which is an int. If it won't
+ // frame_size is stored in buffer_alloc_sz, which is a size_t. If it won't
// fit, fail early.
- if (frame_size > INT_MAX) {
+ if (frame_size > SIZE_MAX) {
return -1;
}
@@ -211,10 +211,10 @@
// This memset is needed for fixing the issue of using uninitialized
// value in msan test. It will cause a perf loss, so only do this for
// msan test.
- memset(ybf->buffer_alloc, 0, (int)frame_size);
+ memset(ybf->buffer_alloc, 0, (size_t)frame_size);
#endif
#endif
- } else if (frame_size > (size_t)ybf->buffer_alloc_sz) {
+ } else if (frame_size > ybf->buffer_alloc_sz) {
// Allocation to hold larger frame, or first allocation.
vpx_free(ybf->buffer_alloc);
ybf->buffer_alloc = NULL;
@@ -222,7 +222,7 @@
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, (size_t)frame_size);
if (!ybf->buffer_alloc) return -1;
- ybf->buffer_alloc_sz = (int)frame_size;
+ ybf->buffer_alloc_sz = (size_t)frame_size;
// This memset is needed for fixing valgrind error from C loop filter
// due to access uninitialized memory in frame border. It could be
@@ -243,7 +243,7 @@
ybf->uv_stride = uv_stride;
ybf->border = border;
- ybf->frame_size = (int)frame_size;
+ ybf->frame_size = (size_t)frame_size;
ybf->subsampling_x = ss_x;
ybf->subsampling_y = ss_y;
--- a/vpx_scale/yv12config.h
+++ b/vpx_scale/yv12config.h
@@ -49,9 +49,9 @@
uint8_t *alpha_buffer;
uint8_t *buffer_alloc;
- int buffer_alloc_sz;
+ size_t buffer_alloc_sz;
int border;
- int frame_size;
+ size_t frame_size;
int subsampling_x;
int subsampling_y;
unsigned int bit_depth;