Change buffer_alloc_sz and frame_size type to size_t
1. Changed buffer_alloc_sz and frame_size type to size_t. 2. Added a TODO for video resolution limits. On 32 bit systems, the maximum resolution supported in the encoder is 4k(3840x2160). The malloc() would fail if encoding >4k video on a 32 bit system. Change-Id: Ibd91b28fd63d1b04e8ac9a5270a17629f239188a
This commit is contained in:
@@ -96,7 +96,7 @@ class HBDMetricsTestBase {
|
|||||||
void RunAccuracyCheck() {
|
void RunAccuracyCheck() {
|
||||||
const int width = 1920;
|
const int width = 1920;
|
||||||
const int height = 1080;
|
const int height = 1080;
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
const uint8_t kPixFiller = 128;
|
const uint8_t kPixFiller = 128;
|
||||||
YV12_BUFFER_CONFIG lbd_src, lbd_dst;
|
YV12_BUFFER_CONFIG lbd_src, lbd_dst;
|
||||||
YV12_BUFFER_CONFIG hbd_src, hbd_dst;
|
YV12_BUFFER_CONFIG hbd_src, hbd_dst;
|
||||||
|
|||||||
@@ -99,17 +99,21 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
|
|||||||
memset(ybf->buffer_alloc, 0, (int)frame_size);
|
memset(ybf->buffer_alloc, 0, (int)frame_size);
|
||||||
#endif
|
#endif
|
||||||
#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.
|
// Allocation to hold larger frame, or first allocation.
|
||||||
vpx_free(ybf->buffer_alloc);
|
vpx_free(ybf->buffer_alloc);
|
||||||
ybf->buffer_alloc = NULL;
|
ybf->buffer_alloc = NULL;
|
||||||
|
|
||||||
if (frame_size != (size_t)frame_size) return -1;
|
if (frame_size != (size_t)frame_size) return -1;
|
||||||
|
|
||||||
|
// TODO(yunqingwang): On 32 bit systems, the maximum resolution supported
|
||||||
|
// in the encoder is 4k(3840x2160). The malloc() would fail if encoding
|
||||||
|
// >4k video on a 32 bit system. Later, maybe disable usage of up-sampled
|
||||||
|
// references to allow >4k video encoding on 32 bit platforms.
|
||||||
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, (size_t)frame_size);
|
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, (size_t)frame_size);
|
||||||
if (!ybf->buffer_alloc) return -1;
|
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
|
// This memset is needed for fixing valgrind error from C loop filter
|
||||||
// due to access uninitialized memory in frame border. It could be
|
// due to access uninitialized memory in frame border. It could be
|
||||||
@@ -137,7 +141,7 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
|
|||||||
ybf->uv_stride = uv_stride;
|
ybf->uv_stride = uv_stride;
|
||||||
|
|
||||||
ybf->border = border;
|
ybf->border = border;
|
||||||
ybf->frame_size = (int)frame_size;
|
ybf->frame_size = (size_t)frame_size;
|
||||||
ybf->subsampling_x = ss_x;
|
ybf->subsampling_x = ss_x;
|
||||||
ybf->subsampling_y = ss_y;
|
ybf->subsampling_y = ss_y;
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ typedef struct yv12_buffer_config {
|
|||||||
uint8_t *alpha_buffer;
|
uint8_t *alpha_buffer;
|
||||||
|
|
||||||
uint8_t *buffer_alloc;
|
uint8_t *buffer_alloc;
|
||||||
int buffer_alloc_sz;
|
size_t buffer_alloc_sz;
|
||||||
int border;
|
int border;
|
||||||
int frame_size;
|
size_t frame_size;
|
||||||
int subsampling_x;
|
int subsampling_x;
|
||||||
int subsampling_y;
|
int subsampling_y;
|
||||||
unsigned int bit_depth;
|
unsigned int bit_depth;
|
||||||
|
|||||||
Reference in New Issue
Block a user