Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions iaa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ int UncompressIAA(uint8_t* input, uint32_t* input_length, uint8_t* output,
job->dictionary = nullptr;

qpl_status status = qpl_execute_job(job);
if (status != QPL_STS_OK) {
if (status != QPL_STS_OK && status != QPL_STS_MORE_OUTPUT_NEEDED) {
Log(LogLevel::LOG_ERROR, "UncompressIAA() Line ", __LINE__,
" qpl_execute_job status ", status, "\n");
return 1;
Expand All @@ -230,9 +230,12 @@ int UncompressIAA(uint8_t* input, uint32_t* input_length, uint8_t* output,
if (gzip_ext) {
*input_length = gzip_ext_dest_size + GZIP_EXT_HDRFTR_SIZE;
}
*end_of_stream = true;
// IAA decompression is stateless in this wrapper; when more output is needed
// the caller must continue via zlib path.
*end_of_stream = (status == QPL_STS_OK);
Log(LogLevel::LOG_INFO, "UncompressIAA() Line ", __LINE__, " output size ",
job->total_out, "\n");
job->total_out, ", status ", status, ", end_of_stream ", *end_of_stream,
"\n");
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ inline void Log(LogLevel level, Args&&... args) {
}

std::ostream& stream = GetLogStream();
stream << std::dec;
switch (level) {
case LogLevel::LOG_ERROR:
stream << "Error: ";
Expand Down
1 change: 1 addition & 0 deletions qat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void QATJob::Init(QzSessionPtr &qzSession, CompressedFormat format,
}

// Initialize QAT hardware
qzSetLogLevel(LOG_NONE);
int status = qzInit(session.get(), 0);
if (status != QZ_OK && status != QZ_DUPLICATE) {
Log(LogLevel::LOG_ERROR, "qzInit() failure Line ", __LINE__, " session ",
Expand Down
2 changes: 2 additions & 0 deletions qat.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#define VISIBLE_FOR_TESTING __attribute__((visibility("default")))

inline constexpr unsigned int QAT_DEST_BUFFER_MIN_SIZE = 512;

inline constexpr unsigned int QAT_HW_BUFF_SZ = QZ_HW_BUFF_MAX_SZ;

class QATJob {
Expand Down
11 changes: 9 additions & 2 deletions zlib_accel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ int ZEXPORT deflate(z_streamp strm, int flush) {
#endif
#ifdef USE_QAT
qat_available =
configs[USE_QAT_COMPRESS] &&
configs[USE_QAT_COMPRESS] && output_len >= QAT_DEST_BUFFER_MIN_SIZE &&
SupportedOptionsQAT(deflate_settings->window_bits, input_len);
#endif

Expand Down Expand Up @@ -489,6 +489,11 @@ int ZEXPORT inflate(z_streamp strm, int flush) {
&output_len, qpl_path_hardware,
inflate_settings->window_bits, &end_of_stream);
inflate_settings->path = IAA;
// IAA inflate is stateless in this wrapper. If stream end was not
// reached, use zlib for stateful continuation.
if (!end_of_stream) {
ret = 1;
}
in_call = false;
INCREMENT_STAT(INFLATE_IAA_COUNT);
INCREMENT_STAT_COND(ret != 0, INFLATE_IAA_ERROR_COUNT);
Expand Down Expand Up @@ -681,6 +686,9 @@ int ZEXPORT uncompress2(Bytef* dest, uLongf* destLen, const Bytef* source,
in_call = true;
ret = UncompressIAA(const_cast<uint8_t*>(source), &input_len, dest,
&output_len, qpl_path_hardware, 15, &end_of_stream);
if (!end_of_stream) {
ret = 1;
}
in_call = false;
#endif // USE_IAA
} else if (path_selected == QAT) {
Expand Down Expand Up @@ -1352,7 +1360,6 @@ int ZEXPORT gzeof(gzFile file) {
GzipFile* gz = gzip_files.Get(file);
return gz->reached_eof;
}

#if defined(__clang__)
#pragma clang attribute pop
#endif