diff options
| author | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-11-14 08:45:00 +0000 |
|---|---|---|
| committer | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-11-14 08:45:00 +0000 |
| commit | 24e189e4d8a231e7273d788b2bd77e2484cec761 (patch) | |
| tree | 48f57b8a816afa4b9bf6c6167a45eecfca91a778 /libopenjpeg/t1.c | |
| parent | 61a15672bb980744297909e6dfe97b23c2430aea (diff) | |
Patch by Callum Lerwick. This patch rearranges the largest memory allocations so they're allocated as late as possible, and freed as soon as possible. This cuts memory usage by about half on two large test images.
Diffstat (limited to 'libopenjpeg/t1.c')
| -rw-r--r-- | libopenjpeg/t1.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libopenjpeg/t1.c b/libopenjpeg/t1.c index 83b10efd..63d42fa1 100644 --- a/libopenjpeg/t1.c +++ b/libopenjpeg/t1.c @@ -1131,10 +1131,10 @@ void t1_decode_cblks( opj_tcd_band_t* restrict band = &res->bands[bandno]; for (precno = 0; precno < res->pw * res->ph; ++precno) { - opj_tcd_precinct_t* prc = &band->precincts[precno]; + opj_tcd_precinct_t* precinct = &band->precincts[precno]; - for (cblkno = 0; cblkno < prc->cw * prc->ch; ++cblkno) { - opj_tcd_cblk_t* cblk = &prc->cblks[cblkno]; + for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) { + opj_tcd_cblk_t* cblk = &precinct->cblks[cblkno]; int* restrict datap; void* restrict tiledp; int cblk_w, cblk_h; @@ -1194,6 +1194,7 @@ void t1_decode_cblks( } } } /* cblkno */ + opj_free(precinct->cblks); } /* precno */ } /* bandno */ } /* resno */ |
