compression: emit POC marker when only one single POC is requested (fixes #1191)

This commit is contained in:
Even Rouault 2019-04-25 00:17:13 +02:00
parent 5dd75f62e2
commit 1e3a57563d
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D
3 changed files with 19 additions and 1 deletions

View File

@ -1702,6 +1702,13 @@ static OPJ_BOOL opj_j2k_check_poc_val(const opj_poc_t *p_pocs,
for (resno = 0; resno < p_nb_resolutions; ++resno) {
for (compno = 0; compno < p_num_comps; ++compno) {
loss |= (packet_array[index] != 1);
#ifdef DEBUG_VERBOSE
if (packet_array[index] != 1) {
fprintf(stderr,
"Missing packet in POC: layno=%d resno=%d compno=%d\n",
layno, resno, compno);
}
#endif
/*index = step_r * resno + step_c * compno + step_l * layno;*/
index += step_c;
}
@ -11759,7 +11766,7 @@ static OPJ_BOOL opj_j2k_write_first_tile_part(opj_j2k_t *p_j2k,
total_data_size -= l_current_nb_bytes_written;
}
#endif
if (l_cp->tcps[p_j2k->m_current_tile_number].numpocs) {
if (l_cp->tcps[p_j2k->m_current_tile_number].POC) {
l_current_nb_bytes_written = 0;
opj_j2k_write_poc_in_memory(p_j2k, p_data, &l_current_nb_bytes_written,
p_manager);

View File

@ -673,6 +673,14 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
OPJ_BOOL packet_empty = OPJ_FALSE;
#endif
#ifdef DEBUG_VERBOSE
if (p_t2_mode == FINAL_PASS) {
fprintf(stderr,
"encode packet compono=%d, resno=%d, precno=%d, layno=%d\n",
compno, resno, precno, layno);
}
#endif
/* <SOP 0xff91> */
if (tcp->csty & J2K_CP_CSTY_SOP) {
if (length < 6) {

View File

@ -171,6 +171,9 @@ opj_compress -i @INPUT_NR_PATH@/Bretagne2.ppm -o @TEMP_PATH@/Bretagne2_empty_ban
opj_compress -i @INPUT_NR_PATH@/issue982.bmp -o @TEMP_PATH@/issue982.j2k -n 1
# Test generating only one POC
opj_compress -i @INPUT_NR_PATH@/byte.tif -o @TEMP_PATH@/byte_one_poc.j2k -n 2 -r 20,1 -POC T1=0,0,2,2,1,CPRL -b 4,4
# DECODER TEST SUITE
opj_decompress -i @INPUT_NR_PATH@/Bretagne2.j2k -o @TEMP_PATH@/Bretagne2.j2k.pgx
opj_decompress -i @INPUT_NR_PATH@/_00042.j2k -o @TEMP_PATH@/_00042.j2k.pgx