@@ -52,14 +52,15 @@ bool T2Decompress::processPacket(TileCodingParams *tcp,
52
52
auto cp = tileProcessor->m_cp ;
53
53
auto tilec = tileProcessor->tile ->comps + currPi->compno ;
54
54
auto tilecBuffer = tilec->getBuffer ();
55
- auto packetLengths = tileProcessor->pltMarkers ;
56
- // we don't currently support PLM markers,
57
- // so we disable packet length markers if we have both PLT and PLM
58
- bool usePlt = packetLengths && !cp->plm_markers ;
59
- uint32_t pltMarkerLen = 0 ;
60
- if (usePlt)
61
- pltMarkerLen = packetLengths->getNext ();
62
55
auto packetInfo = tileProcessor->packetInfoCache .get ();
56
+ if (!packetInfo->packetLength ) {
57
+ // we don't currently support PLM markers,
58
+ // so we disable packet length markers if we have both PLT and PLM
59
+ auto packetLengths = tileProcessor->pltMarkers ;
60
+ bool usePlt = packetLengths && !cp->plm_markers ;
61
+ if (usePlt)
62
+ packetInfo->packetLength = packetLengths->getNext ();
63
+ }
63
64
auto res = tilec->tileCompResolution + currPi->resno ;
64
65
auto skipPacket = currPi->layno >= tcp->num_layers_to_decompress
65
66
|| currPi->resno >= tilec->resolutions_to_decompress ;
@@ -82,7 +83,7 @@ bool T2Decompress::processPacket(TileCodingParams *tcp,
82
83
}
83
84
}
84
85
}
85
- if (!skipPacket || !usePlt ) {
86
+ if (!skipPacket || !packetInfo-> packetLength ) {
86
87
for (uint32_t bandIndex = 0 ; bandIndex < res->numTileBandWindows ; ++bandIndex) {
87
88
auto band = res->tileBand + bandIndex;
88
89
if (band->isEmpty ())
@@ -102,13 +103,11 @@ bool T2Decompress::processPacket(TileCodingParams *tcp,
102
103
tilec->resolutions_decompressed = std::max<uint8_t >(currPi->resno ,tilec->resolutions_decompressed );
103
104
tileProcessor->tile ->numDecompressedPackets ++;
104
105
} else {
105
- if (pltMarkerLen) {
106
- srcBuf->incrementCurrentChunkOffset (pltMarkerLen);
107
- packetInfo->packetLength = pltMarkerLen;
108
- } else {
106
+ if (packetInfo->packetLength )
107
+ srcBuf->incrementCurrentChunkOffset (packetInfo->packetLength );
108
+ else
109
109
if (!decompressPacket (tcp, currPi, srcBuf,packetInfo,true ))
110
110
return false ;
111
- }
112
111
}
113
112
tileProcessor->tile ->numProcessedPackets ++;
114
113
return true ;
0 commit comments