diff options
| author | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-11-14 10:52:02 +0000 |
|---|---|---|
| committer | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-11-14 10:52:02 +0000 |
| commit | 010ae27471655e3fe05912bd9965245a4f2cd7f3 (patch) | |
| tree | 5799bb0c4d6b0a1c26e842a7f0c6ece5276724b9 /libopenjpeg/tcd.h | |
| parent | 24e189e4d8a231e7273d788b2bd77e2484cec761 (diff) | |
Patch by Callum Lerwick. The opj_tcd_cblk array is one of the largest allocations, because it contains a bunch of static buffers. This also makes it a major source of cache thrashing. This patch allocates the buffers from the heap, and dynamically sizes them in the decoder. I have not yet managed to dynamically size them in the encoder, getting the decoder to do it was tricky enough... I also split opj_tcd_cblk_t into separate encode and decode versions. A lot of fields were not used by both, so this cuts its size even further.
Diffstat (limited to 'libopenjpeg/tcd.h')
| -rw-r--r-- | libopenjpeg/tcd.h | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/libopenjpeg/tcd.h b/libopenjpeg/tcd.h index 787cb8fa..f0ac5619 100644 --- a/libopenjpeg/tcd.h +++ b/libopenjpeg/tcd.h @@ -45,9 +45,10 @@ each other. The functions in TCD.C are used by some function in J2K.C. FIXME: documentation */ typedef struct opj_tcd_seg { + unsigned char** data; + int dataindex; int numpasses; int len; - unsigned char *data; int maxpasses; int numnewpasses; int newlen; @@ -75,21 +76,28 @@ typedef struct opj_tcd_layer { /** FIXME: documentation */ -typedef struct opj_tcd_cblk { +typedef struct opj_tcd_cblk_enc { + unsigned char* data; /* Data */ + opj_tcd_layer_t* layers; /* layer information */ + opj_tcd_pass_t* passes; /* information about the passes */ int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ int numbps; int numlenbits; - int len; /* length */ int numpasses; /* number of pass already done for the code-blocks */ - int numnewpasses; /* number of pass added to the code-blocks */ - int numsegs; /* number of segments */ - opj_tcd_seg_t segs[100]; /* segments informations */ - unsigned char data[8192]; /* Data */ int numpassesinlayers; /* number of passes in the layer */ - opj_tcd_layer_t layers[100]; /* layer information */ int totalpasses; /* total number of passes */ - opj_tcd_pass_t passes[100]; /* information about the passes */ -} opj_tcd_cblk_t; +} opj_tcd_cblk_enc_t; + +typedef struct opj_tcd_cblk_dec { + unsigned char* data; /* Data */ + opj_tcd_seg_t* segs; /* segments informations */ + int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ + int numbps; + int numlenbits; + int len; /* length */ + int numnewpasses; /* number of pass added to the code-blocks */ + int numsegs; /* number of segments */ +} opj_tcd_cblk_dec_t; /** FIXME: documentation @@ -97,7 +105,10 @@ FIXME: documentation typedef struct opj_tcd_precinct { int x0, y0, x1, y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */ int cw, ch; /* number of precinct in width and heigth */ - opj_tcd_cblk_t *cblks; /* code-blocks informations */ + union{ /* code-blocks informations */ + opj_tcd_cblk_enc_t* enc; + opj_tcd_cblk_dec_t* dec; + } cblks; opj_tgt_tree_t *incltree; /* inclusion tree */ opj_tgt_tree_t *imsbtree; /* IMSB tree */ } opj_tcd_precinct_t; |
