summaryrefslogtreecommitdiff
path: root/libopenjpeg
diff options
context:
space:
mode:
authorParvatha Elangovan <p.elangovan@intopix.com>2007-09-18 13:07:29 +0000
committerParvatha Elangovan <p.elangovan@intopix.com>2007-09-18 13:07:29 +0000
commita6ba04cdf49772f2e90515b277f174a0849bc8b6 (patch)
tree3e6c84b511eea2b4e8cdee54b8b346d9846e1251 /libopenjpeg
parent55c4c14352519b84ad79abcb2f8527e1c25b9e54 (diff)
Fixed issues with Reading and Writing TIF images in convert.c to avoid segmentation fault.
Fixed issues relating to using user specified rates for CINEMA option for multiple images.
Diffstat (limited to 'libopenjpeg')
-rw-r--r--libopenjpeg/t2.c3
-rw-r--r--libopenjpeg/tcd.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/libopenjpeg/t2.c b/libopenjpeg/t2.c
index 5692a1ec..84d8bee7 100644
--- a/libopenjpeg/t2.c
+++ b/libopenjpeg/t2.c
@@ -591,6 +591,7 @@ int t2_encode_packets(opj_t2_t* t2,int tileno, opj_tcd_tile_t *tile, int maxlaye
int poc;
opj_image_t *image = t2->image;
opj_cp_t *cp = t2->cp;
+ opj_tcp_t *tcp = &cp->tcps[tileno];
int pocno = cp->cinema == CINEMA4K_24? 2: 1;
int maxcomp = cp->max_comp_size > 0 ? image->numcomps : 1;
@@ -645,7 +646,7 @@ int t2_encode_packets(opj_t2_t* t2,int tileno, opj_tcd_tile_t *tile, int maxlaye
if (!cstr_info->packno) {
info_PK->start_pos = info_TL->end_header + 1;
} else {
- info_PK->start_pos = (cp->tp_on && info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
+ info_PK->start_pos = ((cp->tp_on | tcp->POC)&& info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
}
info_PK->end_pos = info_PK->start_pos + e - 1;
info_PK->end_ph_pos += info_PK->start_pos - 1; // End of packet header which now only represents the distance
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c
index 8f59caa4..42c07384 100644
--- a/libopenjpeg/tcd.c
+++ b/libopenjpeg/tcd.c
@@ -1069,11 +1069,12 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
==> possible to have some lossy layers and the last layer for sure lossless */
if ( ((cp->disto_alloc==1) && (tcd_tcp->rates[layno]>0)) || ((cp->fixed_quality==1) && (tcd_tcp->distoratio[layno]>0))) {
opj_t2_t *t2 = t2_create(tcd->cinfo, tcd->image, cp);
+ double thresh = 0;
for (i = 0; i < 32; i++) {
- double thresh = (lo + hi) / 2;
int l = 0;
double distoachieved = 0; /* fixed_quality */
+ thresh = (lo + hi) / 2;
tcd_makelayer(tcd, layno, thresh, 0);
@@ -1117,7 +1118,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
}
}
success = 1;
- goodthresh = stable_thresh;
+ goodthresh = stable_thresh == 0? thresh : stable_thresh;
t2_destroy(t2);
} else {
success = 1;