summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-01-08 09:38:44 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-01-08 09:38:44 +0100
commit07d526e4cb93b6d2e1a52cf49e3d011d3d4caa11 (patch)
tree141f2ce1a02dc4ff3203dc940111093341530a2f /src/lib
parentbdcead70d5900cf5b90774b218183334ca898723 (diff)
opj_t2_encode_packet(): disable setting empty packet header bit to 1 when there is an empty packet
This effectively reverts commit 2609fb8077125b5b31f1bcc2f98c12ff1e6572d7 since it has been reported that such packets cause decoding issues with cinema J2K hardware decoders: https://groups.google.com/forum/#!topic/openjpeg/M7M_fLX_Bco
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/t2.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/openjp2/t2.c b/src/lib/openjp2/t2.c
index 6f956d1c..9825118c 100644
--- a/src/lib/openjp2/t2.c
+++ b/src/lib/openjp2/t2.c
@@ -667,7 +667,11 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
opj_bio_t *bio = 00; /* BIO component */
+#ifdef ENABLE_EMPTY_PACKET_OPTIMIZATION
OPJ_BOOL packet_empty = OPJ_TRUE;
+#else
+ OPJ_BOOL packet_empty = OPJ_FALSE;
+#endif
/* <SOP 0xff91> */
if (tcp->csty & J2K_CP_CSTY_SOP) {
@@ -728,6 +732,11 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
}
opj_bio_init_enc(bio, c, length);
+#ifdef ENABLE_EMPTY_PACKET_OPTIMIZATION
+ /* WARNING: this code branch is disabled, since it has been reported that */
+ /* such packets cause decoding issues with cinema J2K hardware */
+ /* decoders: https://groups.google.com/forum/#!topic/openjpeg/M7M_fLX_Bco */
+
/* Check if the packet is empty */
/* Note: we could also skip that step and always write a packet header */
band = res->bands;
@@ -755,10 +764,9 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
break;
}
}
-
+#endif
opj_bio_write(bio, packet_empty ? 0 : 1, 1); /* Empty header bit */
-
/* Writing Packet header */
band = res->bands;
for (bandno = 0; !packet_empty &&