summaryrefslogtreecommitdiff
path: root/jmemmgr.c
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@4ff67af0-8c30-449e-8e8b-ad334ec8d88c>2011-08-03 03:13:08 +0000
committerhbono@chromium.org <hbono@chromium.org@4ff67af0-8c30-449e-8e8b-ad334ec8d88c>2011-08-03 03:13:08 +0000
commit9862697206250265c6bb37a4186b0a411c78de3b (patch)
tree1713b1df6c111f7d47cceb3cf138e7584ac764d0 /jmemmgr.c
parent0758f15d76566a0504857c18bdce8530074f816a (diff)
Updates libjpeg-turbo to 1.1.90
This change updates our copy of libjpeg-turbo to 1.1.90 (r677), which supports ARM NEON. BUG=none TEST=none Review URL: http://codereview.chromium.org/7554002 git-svn-id: http://src.chromium.org/svn/trunk/deps/third_party/libjpeg_turbo@95196 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Diffstat (limited to 'jmemmgr.c')
-rw-r--r--jmemmgr.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/jmemmgr.c b/jmemmgr.c
index 5458952..cf32524 100644
--- a/jmemmgr.c
+++ b/jmemmgr.c
@@ -37,6 +37,15 @@ extern char * getenv JPP((const char * name));
#endif
+LOCAL(size_t)
+round_up_pow2 (size_t a, size_t b)
+/* a rounded up to the next multiple of b, i.e. ceil(a/b)*b */
+/* Assumes a >= 0, b > 0, and b is a power of 2 */
+{
+ return ((a + b - 1) & (~(b - 1)));
+}
+
+
/*
* Some important notes:
* The allocation routines provided here must never return NULL.
@@ -265,7 +274,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
* and so that algorithms can straddle outside the proper area up
* to the next alignment.
*/
- sizeofobject = jround_up(sizeofobject, ALIGN_SIZE);
+ sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
/* Check for unsatisfiable request (do now to ensure no overflow below) */
if ((SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
@@ -354,7 +363,7 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
* algorithms can straddle outside the proper area up to the next
* alignment.
*/
- sizeofobject = jround_up(sizeofobject, ALIGN_SIZE);
+ sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
/* Check for unsatisfiable request (do now to ensure no overflow below) */
if ((SIZEOF(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
@@ -420,7 +429,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
/* Make sure each row is properly aligned */
if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0)
out_of_memory(cinfo, 5); /* safety check */
- samplesperrow = (JDIMENSION)jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
+ samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
/* Calculate max # of rows allowed in one allocation chunk */
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /