diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-06-12 11:23:55 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-06-12 18:37:50 +0200 |
| commit | 73d1510d473b7dcfccfdee57e0e511e6791d5091 (patch) | |
| tree | 668e073423435d7db608d6ff49875dd4b855cac0 /src/lib/openjp2/t1.c | |
| parent | 81c5311758a0ae1f1aea349a6ee0bca2a238fa79 (diff) | |
Encoder: fix packet writing of empty sub-bands (#891, #892)
There are situations where, given a tile size, at a resolution level,
there are sub-bands with x0==x1 or y0==y1, that consequently don't have any
valid codeblocks, but the other sub-bands may be non-empty.
Given that we recycle the memory from one tile to another one, those
ghost codeblocks might be non-0 and thus candidate for packet inclusion.
Diffstat (limited to 'src/lib/openjp2/t1.c')
| -rw-r--r-- | src/lib/openjp2/t1.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/openjp2/t1.c b/src/lib/openjp2/t1.c index 15ac0407..94aa9b29 100644 --- a/src/lib/openjp2/t1.c +++ b/src/lib/openjp2/t1.c @@ -2008,8 +2008,14 @@ OPJ_BOOL opj_t1_encode_cblks(opj_t1_t *t1, for (bandno = 0; bandno < res->numbands; ++bandno) { opj_tcd_band_t* OPJ_RESTRICT band = &res->bands[bandno]; - OPJ_INT32 bandconst = 8192 * 8192 / ((OPJ_INT32) floor(band->stepsize * 8192)); + OPJ_INT32 bandconst; + /* Skip empty bands */ + if (opj_tcd_is_band_empty(band)) { + continue; + } + + bandconst = 8192 * 8192 / ((OPJ_INT32) floor(band->stepsize * 8192)); for (precno = 0; precno < res->pw * res->ph; ++precno) { opj_tcd_precinct_t *prc = &band->precincts[precno]; |
