diff options
author | Bo Xu <bo_xu@foxitsoftware.com> | 2014-07-08 15:30:46 -0700 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2014-07-08 15:30:46 -0700 |
commit | 3522876d5291922ddc62bf1b70d02743b0850673 (patch) | |
tree | b3fd7eda6e8ed8f07674f6a6fba21e82ca83bee7 /core/src/fxcodec/fx_libopenjpeg | |
parent | e7ee98e4c6fd56c9e930194e9fc11cc10e8293a1 (diff) | |
download | pdfium-3522876d5291922ddc62bf1b70d02743b0850673.tar.xz |
Remove custom memory manager
BUG=
R=palmer@chromium.org
Review URL: https://codereview.chromium.org/372473003
Diffstat (limited to 'core/src/fxcodec/fx_libopenjpeg')
-rw-r--r-- | core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/dwt.c | 13 | ||||
-rw-r--r-- | core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c | 40 | ||||
-rw-r--r-- | core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/opj_malloc.h | 12 |
3 files changed, 5 insertions, 60 deletions
diff --git a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/dwt.c b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/dwt.c index 5f710e87b2..60698e3ffe 100644 --- a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/dwt.c +++ b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/dwt.c @@ -140,9 +140,7 @@ static void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restric static void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read); -//#ifdef __SSE__ -// Disable __SSE__ due to bug http://crbug.com/373619. Should enable this after adding aligned malloc in memory manager -#if 0 +#ifdef __SSE__ static void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c); static void opj_v4dwt_decode_step2_sse(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, __m128 c); @@ -673,9 +671,8 @@ void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , } } -//#ifdef __SSE__ -// Disable __SSE__ due to bug http://crbug.com/373619. Should enable this after adding aligned malloc in memory manager -#if 0 +#ifdef __SSE__ + void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c){ __m128* restrict vw = (__m128*) w; OPJ_INT32 i; @@ -812,9 +809,7 @@ void opj_v4dwt_decode(opj_v4dwt_t* restrict dwt) b = 0; } -//#ifdef __SSE__ -// Disable __SSE__ due to bug http://crbug.com/373619. Should enable this after adding aligned malloc in memory manager -#if 0 +#ifdef __SSE__ opj_v4dwt_decode_step1_sse(dwt->wavelet+a, dwt->sn, _mm_set1_ps(opj_K)); opj_v4dwt_decode_step1_sse(dwt->wavelet+b, dwt->dn, _mm_set1_ps(opj_c13318)); opj_v4dwt_decode_step2_sse(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, opj_int_min(dwt->sn, dwt->dn-a), _mm_set1_ps(opj_dwt_delta)); diff --git a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c index 77a864ebb9..bf411efca5 100644 --- a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c +++ b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c @@ -10253,43 +10253,3 @@ OPJ_BOOL opj_j2k_write_tile (opj_j2k_t * p_j2k, return OPJ_TRUE; } - -#ifdef _FOXIT_MEM_MANAGER_ -/** Allocate number of bytes */ -void* FXMEM_DefaultAlloc(int byte_size, int flags); -void* FXMEM_DefaultRealloc(void* pointer, int new_size, int flags); -void FXMEM_DefaultFree(void* pointer, int flags); - -void* opj_malloc(size_t size) -{ - if (size >= (size_t)-0x100 || (int)size < 0) return NULL; - - return FXMEM_DefaultAlloc(size, 0); -} - -void* opj_calloc(size_t _NumOfElements, size_t _SizeOfElements) -{ - void* buffer = NULL; - - if (_NumOfElements != 0 && _NumOfElements >= (size_t)-0x100 / _SizeOfElements) return NULL; - if ((int)_NumOfElements < 0 || (int)_SizeOfElements < 0) return NULL; - - buffer = FXMEM_DefaultAlloc(_NumOfElements * _SizeOfElements, 0); - if (!buffer) return 0; - - memset(buffer, 0, _NumOfElements * _SizeOfElements); - return buffer; -} - -void* opj_realloc(void * m, size_t s) -{ - if (s >= (size_t)-0x100 || (int)s < 0) return NULL; - return FXMEM_DefaultRealloc(m, s, 0); -} - -void opj_free(void * m) -{ - FXMEM_DefaultFree(m, 0); -} - -#endif diff --git a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/opj_malloc.h b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/opj_malloc.h index ed1dfaf983..f2fe82f1a3 100644 --- a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/opj_malloc.h +++ b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/opj_malloc.h @@ -50,16 +50,7 @@ Allocate an uninitialized memory block @param size Bytes to allocate @return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available */ -#define _FOXIT_MEM_MANAGER_ -#ifdef _FOXIT_MEM_MANAGER_ -void* opj_malloc(size_t size); -void* opj_calloc(size_t _NumOfElements, size_t _SizeOfElements); -void* opj_realloc(void * m, size_t s); -void opj_free(void * m); - -#define opj_aligned_malloc(size) opj_malloc(size) -#define opj_aligned_free(m) opj_free(m) -#else + #ifdef ALLOC_PERF_OPT void * OPJ_CALLCONV opj_malloc(size_t size); #else @@ -170,7 +161,6 @@ void * OPJ_CALLCONV opj_realloc(void * m, size_t s); #else #define opj_realloc(m, s) realloc(m, s) #endif -#endif /** Deallocates or frees a memory block. |