summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-01-01 23:57:07 +0000
committercah <cah@ableton.com>2019-12-03 11:37:14 +0100
commit445405975d61d4e1f52093974518ca8422bff462 (patch)
tree7f61389d77e1cbe84e540b3fa56a4b5f9f604083 /src/lib
parent1754dd52057ec3404163e328ad46e3c9590f2d0f (diff)
Revert "Packet header writing: set empty packet header bit to 0 when appropriate (small optimization)"
This reverts commit 2609fb8077125b5b31f1bcc2f98c12ff1e6572d7. I am testing this reversion to see if it fixes problems with DCP playback on various systems (DCP-o-matic bug #1136).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/t2.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/src/lib/openjp2/t2.c b/src/lib/openjp2/t2.c
index 6f956d1c..381d7863 100644
--- a/src/lib/openjp2/t2.c
+++ b/src/lib/openjp2/t2.c
@@ -667,7 +667,6 @@ 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 */
- OPJ_BOOL packet_empty = OPJ_TRUE;
/* <SOP 0xff91> */
if (tcp->csty & J2K_CP_CSTY_SOP) {
@@ -727,42 +726,11 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
return OPJ_FALSE;
}
opj_bio_init_enc(bio, c, length);
-
- /* Check if the packet is empty */
- /* Note: we could also skip that step and always write a packet header */
- band = res->bands;
- for (bandno = 0; bandno < res->numbands; ++bandno, ++band) {
- opj_tcd_precinct_t *prc;
- /* Skip empty bands */
- if (opj_tcd_is_band_empty(band)) {
- continue;
- }
-
- prc = &band->precincts[precno];
- l_nb_blocks = prc->cw * prc->ch;
- cblk = prc->cblks.enc;
- for (cblkno = 0; cblkno < l_nb_blocks; cblkno++, ++cblk) {
- opj_tcd_layer_t *layer = &cblk->layers[layno];
-
- /* if cblk not included, go to the next cblk */
- if (!layer->numpasses) {
- continue;
- }
- packet_empty = OPJ_FALSE;
- break;
- }
- if (!packet_empty) {
- break;
- }
- }
-
- opj_bio_write(bio, packet_empty ? 0 : 1, 1); /* Empty header bit */
-
+ opj_bio_write(bio, 1, 1); /* Empty header bit */
/* Writing Packet header */
band = res->bands;
- for (bandno = 0; !packet_empty &&
- bandno < res->numbands; ++bandno, ++band) {
+ for (bandno = 0; bandno < res->numbands; ++bandno, ++band) {
opj_tcd_precinct_t *prc;
/* Skip empty bands */
@@ -895,7 +863,7 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
/* Writing the packet body */
band = res->bands;
- for (bandno = 0; !packet_empty && bandno < res->numbands; bandno++, ++band) {
+ for (bandno = 0; bandno < res->numbands; bandno++, ++band) {
opj_tcd_precinct_t *prc;
/* Skip empty bands */