Fixed issues with cstr_info when codestream has components with different number of resolutions.
This commit is contained in:
parent
abfba20b99
commit
569bbb0077
|
@ -5,6 +5,9 @@ What's New for OpenJPEG
|
||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
September 17, 2007
|
||||||
|
* [FOD] Fixed issues with cstr_info when codestream has components with different number of resolutions.
|
||||||
|
|
||||||
September 12, 2007
|
September 12, 2007
|
||||||
* [FOD] Patch from Callum Lerwick.
|
* [FOD] Patch from Callum Lerwick.
|
||||||
Fixed the library linking so it links with the soversion properly set.
|
Fixed the library linking so it links with the soversion properly set.
|
||||||
|
|
|
@ -596,10 +596,11 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
fprintf(stream, "%d\n", cstr_info->numlayers);
|
fprintf(stream, "%d\n", cstr_info->numlayers);
|
||||||
fprintf(stream, "%d\n", cstr_info->numdecompos);
|
fprintf(stream, "%d\n", cstr_info->numdecompos);
|
||||||
|
|
||||||
for (resno = cstr_info->numdecompos; resno >= 0; resno--) {
|
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
|
||||||
fprintf(stream, "[%d,%d] ",
|
fprintf(stream, "[%d,%d] ",
|
||||||
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 */
|
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 and component 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
||||||
|
@ -623,8 +624,14 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||||
int start_pos, end_ph_pos, end_pos;
|
int start_pos, end_ph_pos, end_pos;
|
||||||
double disto = 0;
|
double disto = 0;
|
||||||
|
int max_numdecompos = 0;
|
||||||
pack_nb = 0;
|
pack_nb = 0;
|
||||||
|
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
|
if (max_numdecompos < cstr_info->numdecompos[compno])
|
||||||
|
max_numdecompos = cstr_info->numdecompos[compno];
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
||||||
fprintf(stream, "part_nb tileno num_packs start_pos end_tph_pos end_pos\n");
|
fprintf(stream, "part_nb tileno num_packs start_pos end_tph_pos end_pos\n");
|
||||||
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
|
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
|
||||||
|
@ -639,9 +646,12 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos disto\n");
|
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos disto\n");
|
||||||
|
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max;
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
@ -660,10 +670,13 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
|
|
||||||
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos disto\n");
|
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos disto\n");
|
||||||
|
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max;
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
@ -682,7 +695,7 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
|
|
||||||
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos disto\n");
|
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos disto\n");
|
||||||
|
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
/* I suppose components have same XRsiz, YRsiz */
|
/* I suppose components have same XRsiz, YRsiz */
|
||||||
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||||
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||||
|
@ -690,10 +703,12 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
int y1 = y0 + cstr_info->tile_y;
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
|
@ -728,12 +743,12 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos disto\n");
|
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos disto\n");
|
||||||
|
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
|
@ -769,12 +784,12 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
int x1 = x0 + cstr_info->tile_x;
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
int y1 = y0 + cstr_info->tile_y;
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
|
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
|
|
|
@ -259,9 +259,9 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
fprintf(stream, "%d\n", cstr_info->numlayers);
|
fprintf(stream, "%d\n", cstr_info->numlayers);
|
||||||
fprintf(stream, "%d\n", cstr_info->numdecompos);
|
fprintf(stream, "%d\n", cstr_info->numdecompos);
|
||||||
|
|
||||||
for (resno = cstr_info->numdecompos; resno >= 0; resno--) {
|
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
|
||||||
fprintf(stream, "[%d,%d] ",
|
fprintf(stream, "[%d,%d] ",
|
||||||
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 */
|
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 and component 0*/
|
||||||
}
|
}
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
||||||
|
@ -281,8 +281,14 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
|
|
||||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||||
int start_pos, end_ph_pos, end_pos;
|
int start_pos, end_ph_pos, end_pos;
|
||||||
|
int max_numdecompos = 0;
|
||||||
pack_nb = 0;
|
pack_nb = 0;
|
||||||
|
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
|
if (max_numdecompos < cstr_info->numdecompos[compno])
|
||||||
|
max_numdecompos = cstr_info->numdecompos[compno];
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
||||||
fprintf(stream, "part_nb tileno num_packs start_pos end_tph_pos end_pos\n");
|
fprintf(stream, "part_nb tileno num_packs start_pos end_tph_pos end_pos\n");
|
||||||
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
|
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
|
||||||
|
@ -297,9 +303,12 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos\n");
|
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos\n");
|
||||||
|
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max;
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
@ -316,10 +325,13 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
|
|
||||||
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos\n");
|
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos\n");
|
||||||
|
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max;
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
@ -336,18 +348,21 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
|
|
||||||
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos\n");
|
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos\n");
|
||||||
|
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
/* I suppose components have same XRsiz, YRsiz */
|
/* I suppose components have same XRsiz, YRsiz */
|
||||||
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||||
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||||
int x1 = x0 + cstr_info->tile_x;
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
int y1 = y0 + cstr_info->tile_y;
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max;
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
|
@ -380,12 +395,12 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos\n");
|
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos\n");
|
||||||
|
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
|
@ -419,12 +434,12 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
int x1 = x0 + cstr_info->tile_x;
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
int y1 = y0 + cstr_info->tile_y;
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
|
|
||||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
|
@ -1024,3 +1039,5 @@ int main(int argc, char **argv) {
|
||||||
//end main
|
//end main
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -824,7 +824,10 @@ static void j2k_read_cod(opj_j2k_t *j2k) {
|
||||||
opj_codestream_info_t *cstr_info = j2k->cstr_info;
|
opj_codestream_info_t *cstr_info = j2k->cstr_info;
|
||||||
cstr_info->prog = tcp->prg;
|
cstr_info->prog = tcp->prg;
|
||||||
cstr_info->numlayers = tcp->numlayers;
|
cstr_info->numlayers = tcp->numlayers;
|
||||||
cstr_info->numdecompos = tcp->tccps[0].numresolutions - 1;
|
cstr_info->numdecompos = (int*) malloc (image->numcomps * sizeof(int));
|
||||||
|
for (i = 0; i < image->numcomps; i++) {
|
||||||
|
cstr_info->numdecompos[i] = tcp->tccps[i].numresolutions - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1376,10 +1379,14 @@ static void j2k_read_sot(opj_j2k_t *j2k) {
|
||||||
j2k->cstr_info->tile[tileno].start_pos = cio_tell(cio) - 12;
|
j2k->cstr_info->tile[tileno].start_pos = cio_tell(cio) - 12;
|
||||||
j2k->cstr_info->tile[tileno].end_pos = j2k->cstr_info->tile[tileno].start_pos + totlen - 1;
|
j2k->cstr_info->tile[tileno].end_pos = j2k->cstr_info->tile[tileno].start_pos + totlen - 1;
|
||||||
j2k->cstr_info->tile[tileno].num_tps = numparts;
|
j2k->cstr_info->tile[tileno].num_tps = numparts;
|
||||||
|
if (numparts)
|
||||||
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(numparts * sizeof(opj_tp_info_t));
|
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(numparts * sizeof(opj_tp_info_t));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
|
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(10 * sizeof(opj_tp_info_t)); // Fixme (10)
|
||||||
|
}
|
||||||
|
else {
|
||||||
j2k->cstr_info->tile[tileno].end_pos += totlen;
|
j2k->cstr_info->tile[tileno].end_pos += totlen;
|
||||||
|
}
|
||||||
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos = cio_tell(cio) - 12;
|
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos = cio_tell(cio) - 12;
|
||||||
j2k->cstr_info->tile[tileno].tp[partno].tp_end_pos =
|
j2k->cstr_info->tile[tileno].tp[partno].tp_end_pos =
|
||||||
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos + totlen - 1;
|
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos + totlen - 1;
|
||||||
|
@ -2278,6 +2285,7 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
||||||
/* INDEX >> */
|
/* INDEX >> */
|
||||||
j2k->cstr_info = cstr_info;
|
j2k->cstr_info = cstr_info;
|
||||||
if (cstr_info) {
|
if (cstr_info) {
|
||||||
|
int compno;
|
||||||
cstr_info->tile = (opj_tile_info_t *) opj_malloc(cp->tw * cp->th * sizeof(opj_tile_info_t));
|
cstr_info->tile = (opj_tile_info_t *) opj_malloc(cp->tw * cp->th * sizeof(opj_tile_info_t));
|
||||||
cstr_info->image_w = image->x1 - image->x0;
|
cstr_info->image_w = image->x1 - image->x0;
|
||||||
cstr_info->image_h = image->y1 - image->y0;
|
cstr_info->image_h = image->y1 - image->y0;
|
||||||
|
@ -2290,7 +2298,10 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
||||||
cstr_info->tile_Oy = cp->ty0; /* new version parser */
|
cstr_info->tile_Oy = cp->ty0; /* new version parser */
|
||||||
cstr_info->numcomps = image->numcomps;
|
cstr_info->numcomps = image->numcomps;
|
||||||
cstr_info->numlayers = (&cp->tcps[0])->numlayers;
|
cstr_info->numlayers = (&cp->tcps[0])->numlayers;
|
||||||
cstr_info->numdecompos = (&cp->tcps[0])->tccps->numresolutions - 1;
|
cstr_info->numdecompos = (int*) malloc (image->numcomps * sizeof(int));
|
||||||
|
for (compno=0; compno < image->numcomps; compno++) {
|
||||||
|
cstr_info->numdecompos[compno] = (&cp->tcps[0])->tccps->numresolutions - 1;
|
||||||
|
}
|
||||||
cstr_info->D_max = 0; /* ADD Marcela */
|
cstr_info->D_max = 0; /* ADD Marcela */
|
||||||
cstr_info->main_head_start = cio_tell(cio); /* position of SOC */
|
cstr_info->main_head_start = cio_tell(cio); /* position of SOC */
|
||||||
}
|
}
|
||||||
|
@ -2469,3 +2480,5 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -690,8 +690,8 @@ typedef struct opj_codestream_info {
|
||||||
int numcomps;
|
int numcomps;
|
||||||
/** number of layer */
|
/** number of layer */
|
||||||
int numlayers;
|
int numlayers;
|
||||||
/** number of decomposition of first component */
|
/** number of decomposition for each component */
|
||||||
int numdecompos;
|
int *numdecompos;
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
/** number of markers */
|
/** number of markers */
|
||||||
int marknum;
|
int marknum;
|
||||||
|
|
|
@ -771,3 +771,5 @@ void t2_destroy(opj_t2_t *t2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1309,25 +1309,27 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
||||||
|
|
||||||
/* INDEX >> */
|
/* INDEX >> */
|
||||||
if(cstr_info) {
|
if(cstr_info) {
|
||||||
int i, numpacks = 0;
|
int resno, compno, numprec = 0;
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
opj_tcp_t *tcp = &tcd->cp->tcps[0];
|
opj_tcp_t *tcp = &tcd->cp->tcps[0];
|
||||||
opj_tccp_t *tccp = &tcp->tccps[0];
|
opj_tccp_t *tccp = &tcp->tccps[compno];
|
||||||
opj_tcd_tilecomp_t *tilec_idx = &tile->comps[0]; /* based on component 0 */
|
opj_tcd_tilecomp_t *tilec_idx = &tile->comps[compno];
|
||||||
for (i = 0; i < tilec_idx->numresolutions; i++) {
|
for (resno = 0; resno < tilec_idx->numresolutions; resno++) {
|
||||||
opj_tcd_resolution_t *res_idx = &tilec_idx->resolutions[i];
|
opj_tcd_resolution_t *res_idx = &tilec_idx->resolutions[resno];
|
||||||
cstr_info->tile[tileno].pw[i] = res_idx->pw;
|
cstr_info->tile[tileno].pw[resno] = res_idx->pw;
|
||||||
cstr_info->tile[tileno].ph[i] = res_idx->ph;
|
cstr_info->tile[tileno].ph[resno] = res_idx->ph;
|
||||||
numpacks += res_idx->pw * res_idx->ph;
|
numprec += res_idx->pw * res_idx->ph;
|
||||||
if (tccp->csty & J2K_CP_CSTY_PRT) {
|
if (tccp->csty & J2K_CP_CSTY_PRT) {
|
||||||
cstr_info->tile[tileno].pdx[i] = tccp->prcw[i];
|
cstr_info->tile[tileno].pdx[resno] = tccp->prcw[resno];
|
||||||
cstr_info->tile[tileno].pdy[i] = tccp->prch[i];
|
cstr_info->tile[tileno].pdy[resno] = tccp->prch[resno];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cstr_info->tile[tileno].pdx[i] = 15;
|
cstr_info->tile[tileno].pdx[resno] = 15;
|
||||||
cstr_info->tile[tileno].pdx[i] = 15;
|
cstr_info->tile[tileno].pdx[resno] = 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cstr_info->tile[tileno].packet = (opj_packet_info_t *) opj_malloc(cstr_info->numcomps * cstr_info->numlayers * numpacks * sizeof(opj_packet_info_t));
|
}
|
||||||
|
cstr_info->tile[tileno].packet = (opj_packet_info_t *) opj_malloc(cstr_info->numlayers * numprec * sizeof(opj_packet_info_t));
|
||||||
cstr_info->packno = 0;
|
cstr_info->packno = 0;
|
||||||
}
|
}
|
||||||
/* << INDEX */
|
/* << INDEX */
|
||||||
|
@ -1472,3 +1474,5 @@ void tcd_free_decode_tile(opj_tcd_t *tcd, int tileno) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue