]> granicus.if.org Git - libvpx/commitdiff
Change buffer_alloc_sz and frame_size type to size_t
authorYunqing Wang <yunqingwang@google.com>
Tue, 30 Aug 2016 18:48:44 +0000 (11:48 -0700)
committerYunqing Wang <yunqingwang@google.com>
Wed, 31 Aug 2016 21:56:21 +0000 (14:56 -0700)
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

test/hbd_metrics_test.cc
vpx_scale/generic/yv12config.c
vpx_scale/yv12config.h

index f8c0517083c21aaa995181b1e73227b009373aee..abe82beeaae41d998b2b699ddd0d8d3da1e4dab3 100644 (file)
@@ -96,7 +96,7 @@ class HBDMetricsTestBase {
   void RunAccuracyCheck() {
     const int width = 1920;
     const int height = 1080;
-    int i = 0;
+    size_t i = 0;
     const uint8_t kPixFiller = 128;
     YV12_BUFFER_CONFIG lbd_src, lbd_dst;
     YV12_BUFFER_CONFIG hbd_src, hbd_dst;
index 6ed4321e84e74b0d2c82119cd255dade56df9676..13fbd2860fcc9f07821bfd58b759cfb121fbf95b 100644 (file)
@@ -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);
 #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;
 
       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);
       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
@@ -137,7 +141,7 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
     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;
 
index 6b72c7233280211f8fab74615972b9a73592dd35..d581db98bd34c16c0ec88de5ebced1b7bcee2322 100644 (file)
@@ -53,9 +53,9 @@ typedef struct yv12_buffer_config {
   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;