[*] I'm just not going to bother for.now

This commit is contained in:
Reece Wilson 2023-10-11 06:54:51 +01:00
parent d48d6ce08d
commit e3ba8cf1c5

View File

@ -69,13 +69,20 @@ namespace Aurora::Compression
}
}
meta.uThreads = AuMin(AuHwInfo::GetCPUInfo().uThreads, meta.uThreads);
if (auto uThreadsMin = AuHwInfo::GetCPUInfo().uThreads)
{
meta.uThreads = AuMin(uThreadsMin, meta.uThreads);
}
if (meta.uThreads > 1)
{
uRet = ZSTD_CCtx_setParameter(this->cctx_, ZSTD_c_nbWorkers, AuMax(meta.uThreads, AuUInt8(1u)));
if (ZSTD_isError(uRet))
{
SysPushErrorArg();
return false;
}
}
for (const auto &[a, b] : meta.options)
{
@ -138,6 +145,8 @@ namespace Aurora::Compression
return AuMakePair(read, 0);
}
this->bContd = true;
this->bLastFrameHasNotFinished_ = bLastFrame && uRet;
if (!output.pos)
@ -204,6 +213,7 @@ namespace Aurora::Compression
this->pIterator_ += this->input_.pos;
this->uAvailableIn_ -= this->input_.pos;
this->bContd = false;
return true;// RunFlush(ZSTD_e_continue);
}
@ -212,7 +222,17 @@ namespace Aurora::Compression
AuUInt32 uOutFrameLength = AuUInt32(ZSTD_DStreamOutSize());
ZSTD_outBuffer output = { this->dout_, uOutFrameLength, 0 };
if (meta.uThreads == 1)
{
Flush();
}
else
{
if (!this->bContd)
{
return true;
}
}
size_t uRet;
do
@ -233,6 +253,8 @@ namespace Aurora::Compression
}
while (uRet);
this->bContd = false;
return true;
}
@ -246,5 +268,6 @@ namespace Aurora::Compression
AuUInt32 uAvailableIn_ {};
ZSTD_inBuffer input_ {};
bool bLastFrameHasNotFinished_ {};
bool bContd {};
};
}