jmemmgr.c File Reference

#include "jinclude.h"
#include "jpeglib.h"
#include "jmemsys.h"

Go to the source code of this file.

Classes

union  small_pool_struct
union  large_pool_struct
struct  my_memory_mgr
struct  jvirt_sarray_control
struct  jvirt_barray_control

Defines

#define JPEG_INTERNALS
#define AM_MEMORY_MANAGER
#define ALIGN_TYPE   double
#define MIN_SLOP   50

Typedefs

typedef small_pool_structsmall_pool_ptr
typedef small_pool_struct small_pool_hdr
typedef large_pool_struct
FAR * 
large_pool_ptr
typedef large_pool_struct large_pool_hdr
typedef my_memory_mgrmy_mem_ptr

Functions

 out_of_memory (j_common_ptr cinfo, int which)
 alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
 alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
 alloc_sarray (j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow, JDIMENSION numrows)
 alloc_barray (j_common_ptr cinfo, int pool_id, JDIMENSION blocksperrow, JDIMENSION numrows)
 request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION samplesperrow, JDIMENSION numrows, JDIMENSION maxaccess)
 request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION blocksperrow, JDIMENSION numrows, JDIMENSION maxaccess)
 realize_virt_arrays (j_common_ptr cinfo)
 do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
 do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
 access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)
 access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)
 free_pool (j_common_ptr cinfo, int pool_id)
 self_destruct (j_common_ptr cinfo)
 jinit_memory_mgr (j_common_ptr cinfo)

Variables

static const size_t first_pool_slop [JPOOL_NUMPOOLS]
static const size_t extra_pool_slop [JPOOL_NUMPOOLS]


Define Documentation

#define ALIGN_TYPE   double

Definition at line 73 of file jmemmgr.c.

Referenced by alloc_large(), alloc_small(), and jinit_memory_mgr().

#define AM_MEMORY_MANAGER

Definition at line 28 of file jmemmgr.c.

#define JPEG_INTERNALS

Definition at line 27 of file jmemmgr.c.

#define MIN_SLOP   50

Definition at line 253 of file jmemmgr.c.

Referenced by alloc_small().


Typedef Documentation

typedef union large_pool_struct large_pool_hdr

typedef union large_pool_struct FAR* large_pool_ptr

Definition at line 100 of file jmemmgr.c.

typedef my_memory_mgr* my_mem_ptr

Definition at line 140 of file jmemmgr.c.

typedef union small_pool_struct small_pool_hdr

typedef union small_pool_struct* small_pool_ptr

Definition at line 89 of file jmemmgr.c.


Function Documentation

access_virt_barray ( j_common_ptr  cinfo,
jvirt_barray_ptr  ptr,
JDIMENSION  start_row,
JDIMENSION  num_rows,
boolean  writable 
)

Definition at line 841 of file jmemmgr.c.

References do_barray_io(), ERREXIT, FALSE, FAR, jzero_far(), long, NULL, size_t, SIZEOF, and TRUE.

Referenced by jinit_memory_mgr().

access_virt_sarray ( j_common_ptr  cinfo,
jvirt_sarray_ptr  ptr,
JDIMENSION  start_row,
JDIMENSION  num_rows,
boolean  writable 
)

Definition at line 756 of file jmemmgr.c.

References do_sarray_io(), ERREXIT, FALSE, FAR, jzero_far(), long, NULL, size_t, SIZEOF, and TRUE.

Referenced by jinit_memory_mgr().

alloc_barray ( j_common_ptr  cinfo,
int  pool_id,
JDIMENSION  blocksperrow,
JDIMENSION  numrows 
)

Definition at line 443 of file jmemmgr.c.

References alloc_large(), alloc_small(), ERREXIT, i, my_memory_mgr::last_rowsperchunk, long, MAX_ALLOC_CHUNK, MIN, result(), size_t, and SIZEOF.

Referenced by jinit_memory_mgr(), and realize_virt_arrays().

alloc_large ( j_common_ptr  cinfo,
int  pool_id,
size_t  sizeofobject 
)

Definition at line 342 of file jmemmgr.c.

References ALIGN_TYPE, ERREXIT1, if(), jpeg_get_large(), JPOOL_NUMPOOLS, my_memory_mgr::large_list, MAX_ALLOC_CHUNK, NULL, out_of_memory(), size_t, SIZEOF, and my_memory_mgr::total_space_allocated.

Referenced by alloc_barray(), alloc_sarray(), and jinit_memory_mgr().

alloc_sarray ( j_common_ptr  cinfo,
int  pool_id,
JDIMENSION  samplesperrow,
JDIMENSION  numrows 
)

Definition at line 395 of file jmemmgr.c.

References alloc_large(), alloc_small(), ERREXIT, i, my_memory_mgr::last_rowsperchunk, long, MAX_ALLOC_CHUNK, MIN, result(), size_t, and SIZEOF.

Referenced by jinit_memory_mgr(), and realize_virt_arrays().

alloc_small ( j_common_ptr  cinfo,
int  pool_id,
size_t  sizeofobject 
)

Definition at line 257 of file jmemmgr.c.

References ALIGN_TYPE, small_pool_struct::bytes_left, small_pool_struct::bytes_used, ERREXIT1, small_pool_struct::hdr, if(), jpeg_get_small(), JPOOL_NUMPOOLS, MAX_ALLOC_CHUNK, MIN_SLOP, small_pool_struct::next, NULL, out_of_memory(), size_t, SIZEOF, my_memory_mgr::small_list, and my_memory_mgr::total_space_allocated.

Referenced by alloc_barray(), alloc_sarray(), jinit_memory_mgr(), request_virt_barray(), and request_virt_sarray().

do_barray_io ( j_common_ptr  cinfo,
jvirt_barray_ptr  ptr,
boolean  writing 
)

Definition at line 723 of file jmemmgr.c.

References FAR, i, long, MIN, and SIZEOF.

Referenced by access_virt_barray().

do_sarray_io ( j_common_ptr  cinfo,
jvirt_sarray_ptr  ptr,
boolean  writing 
)

Definition at line 690 of file jmemmgr.c.

References FAR, i, long, MIN, and SIZEOF.

Referenced by access_virt_sarray().

free_pool ( j_common_ptr  cinfo,
int  pool_id 
)

Definition at line 930 of file jmemmgr.c.

References jvirt_sarray_control::b_s_info, jvirt_barray_control::b_s_info, jvirt_barray_control::b_s_open, jvirt_sarray_control::b_s_open, small_pool_struct::bytes_used, ERREXIT1, FALSE, FAR, small_pool_struct::hdr, large_pool_struct::hdr, if(), jpeg_free_large(), jpeg_free_small(), JPOOL_IMAGE, JPOOL_NUMPOOLS, my_memory_mgr::large_list, jvirt_sarray_control::next, large_pool_struct::next, jvirt_barray_control::next, small_pool_struct::next, NULL, size_t, SIZEOF, my_memory_mgr::small_list, my_memory_mgr::total_space_allocated, my_memory_mgr::virt_barray_list, and my_memory_mgr::virt_sarray_list.

Referenced by jinit_memory_mgr(), and self_destruct().

jinit_memory_mgr ( j_common_ptr  cinfo  ) 

Definition at line 1028 of file jmemmgr.c.

References access_virt_barray(), access_virt_sarray(), ALIGN_TYPE, alloc_barray(), alloc_large(), alloc_sarray(), alloc_small(), ERREXIT, ERREXIT1, free_pool(), getenv(), JERR_OUT_OF_MEMORY, jpeg_get_small(), jpeg_mem_init(), jpeg_mem_term(), JPOOL_NUMPOOLS, JPOOL_PERMANENT, RooFitShortHand::L(), my_memory_mgr::large_list, MAX_ALLOC_CHUNK, jpeg_memory_mgr::max_alloc_chunk, jpeg_memory_mgr::max_memory_to_use, NULL, my_memory_mgr::pub, realize_virt_arrays(), request_virt_barray(), request_virt_sarray(), self_destruct(), size_t, SIZEOF, my_memory_mgr::small_list, my_memory_mgr::total_space_allocated, my_memory_mgr::virt_barray_list, and my_memory_mgr::virt_sarray_list.

Referenced by jpeg_CreateCompress(), and jpeg_CreateDecompress().

out_of_memory ( j_common_ptr  cinfo,
int  which 
)

Definition at line 217 of file jmemmgr.c.

References ERREXIT1, and JERR_OUT_OF_MEMORY.

Referenced by alloc_large(), and alloc_small().

realize_virt_arrays ( j_common_ptr  cinfo  ) 

Definition at line 583 of file jmemmgr.c.

References alloc_barray(), alloc_sarray(), FALSE, for(), jpeg_mem_available(), jpeg_open_backing_store(), JPOOL_IMAGE, RooFitShortHand::L(), my_memory_mgr::last_rowsperchunk, long, NULL, SIZEOF, my_memory_mgr::total_space_allocated, TRUE, my_memory_mgr::virt_barray_list, and my_memory_mgr::virt_sarray_list.

Referenced by jinit_memory_mgr().

request_virt_barray ( j_common_ptr  cinfo,
int  pool_id,
boolean  pre_zero,
JDIMENSION  blocksperrow,
JDIMENSION  numrows,
JDIMENSION  maxaccess 
)

Definition at line 553 of file jmemmgr.c.

References alloc_small(), ERREXIT1, FALSE, if(), JPOOL_IMAGE, NULL, result(), SIZEOF, and my_memory_mgr::virt_barray_list.

Referenced by jinit_memory_mgr().

request_virt_sarray ( j_common_ptr  cinfo,
int  pool_id,
boolean  pre_zero,
JDIMENSION  samplesperrow,
JDIMENSION  numrows,
JDIMENSION  maxaccess 
)

Definition at line 523 of file jmemmgr.c.

References alloc_small(), ERREXIT1, FALSE, if(), JPOOL_IMAGE, NULL, result(), SIZEOF, and my_memory_mgr::virt_sarray_list.

Referenced by jinit_memory_mgr().

self_destruct ( j_common_ptr  cinfo  ) 

Definition at line 1002 of file jmemmgr.c.

References free_pool(), jpeg_free_small(), jpeg_mem_term(), JPOOL_NUMPOOLS, JPOOL_PERMANENT, NULL, and SIZEOF.

Referenced by jinit_memory_mgr().


Variable Documentation

const size_t extra_pool_slop[JPOOL_NUMPOOLS] [static]

Initial value:

 
{
        0,                      
        5000                    
}

Definition at line 247 of file jmemmgr.c.

const size_t first_pool_slop[JPOOL_NUMPOOLS] [static]

Initial value:

 
{
        1600,                   
        16000                   
}

Definition at line 241 of file jmemmgr.c.


Generated on Tue Jul 5 15:57:56 2011 for ROOT_528-00b_version by  doxygen 1.5.1