diff options
| author | Antonin Descampe <antonin@gmail.com> | 2008-05-22 16:39:40 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2008-05-22 16:39:40 +0000 |
| commit | 295ad6b112ab37974fba276fbf3c0cd4ccfd70d1 (patch) | |
| tree | afcbbf996908f921c7f598d1d14619bda1000179 /libopenjpeg | |
| parent | f4d394d9324f12e820339fce0182b1d47f831059 (diff) | |
fixed a bug in j2k.c (j2k_write_sod) that allowed to get negative rates, thanks zhong1985624 for pointing this.
Diffstat (limited to 'libopenjpeg')
| -rw-r--r-- | libopenjpeg/j2k.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index bd4a1bd6..563efd68 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -1438,7 +1438,11 @@ static void j2k_write_sod(opj_j2k_t *j2k, void *tile_coder) { tcp = &cp->tcps[j2k->curtileno]; for (layno = 0; layno < tcp->numlayers; layno++) { - tcp->rates[layno] -= tcp->rates[layno] ? (j2k->sod_start / (cp->th * cp->tw)) : 0; + if (tcp->rates[layno]>(j2k->sod_start / (cp->th * cp->tw))) { + tcp->rates[layno]-=(j2k->sod_start / (cp->th * cp->tw)); + } else if (tcp->rates[layno]) { + tcp->rates[layno]=1; + } } if(j2k->cur_tp_num == 0){ tcd->tcd_image->tiles->packno = 0; |
