MCPcopy Create free account
hub / github.com/PDAL/PDAL / compress

Method compress

io/BpfCompressor.cpp:68–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67
68void BpfCompressor::compress()
69{
70 // Note our position so that we know how much we've written.
71 uint32_t rawWritten = (uint32_t)m_out.position();
72
73 // Pop our temp stream so that we can write the real output file.
74 delete m_out.popStream();
75
76 m_rawSize += rawWritten;
77
78 // Deflate the data in the buffer and write it to the output stream.
79 m_strm.avail_in = rawWritten;
80 m_strm.next_in = (unsigned char *)m_inbuf.data();
81 m_strm.avail_out = CHUNKSIZE;
82 m_strm.next_out = m_tmpbuf;
83 while (m_strm.avail_in)
84 {
85 int ret = ::deflate(&m_strm, Z_NO_FLUSH);
86 size_t written = CHUNKSIZE - m_strm.avail_out;
87 m_compressedSize += written;
88 m_out.put(m_tmpbuf, written);
89 m_strm.avail_out = CHUNKSIZE;
90 m_strm.next_out = m_tmpbuf;
91 }
92
93 // All data has been written. Reinitialize input buffer's streambuf and
94 // push it.
95 m_charbuf.initialize(m_inbuf.data(), m_inbuf.size());
96 m_out.pushStream(new std::ostream(&m_charbuf));
97}
98
99
100void BpfCompressor::finish()

Callers 8

writePointMajorMethod · 0.45
writeDimMajorMethod · 0.45
writeByteMajorMethod · 0.45
writeLazPerfBufMethod · 0.45
writeCompressedMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 5

positionMethod · 0.45
dataMethod · 0.45
putMethod · 0.45
initializeMethod · 0.45
sizeMethod · 0.45

Tested by 3

TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36