MCPcopy Create free account
hub / github.com/catboost/catboost / QuickLZDecompress

Function QuickLZDecompress

library/cpp/par/compression.cpp:57–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 }
56
57 void QuickLZDecompress(TVector<char>* dst) {
58 if (!dst) {
59 return;
60 }
61 int srcSize = dst->ysize();
62 if (srcSize < SIZEOF_SIGNATURE) {
63 return;
64 }
65 if (*(int*)dst->data() != N_SIGNATURE) {
66 return;
67 }
68 TVector<char> unpacked;
69 const ICodec* usedCodec = GetCodec();
70 for (size_t i = SIZEOF_SIGNATURE; i < (*dst).size();) {
71 TBlockLen packedBlockSize = *(TBlockLen*)(dst->data() + i);
72 TStringBuf srcDataBlock{dst->data() + i + sizeof(TBlockLen), packedBlockSize};
73 size_t unpackedPreviousSize = unpacked.size();
74 unpacked.yresize(unpackedPreviousSize + usedCodec->DecompressedLength(srcDataBlock));
75 unpacked.yresize(unpackedPreviousSize + usedCodec->Decompress(srcDataBlock, unpacked.data() + unpackedPreviousSize));
76 i += packedBlockSize + sizeof(TBlockLen);
77 }
78 dst->swap(unpacked);
79 }
80}

Callers 3

ReceiveLoopFuncMethod · 0.85

Calls 8

yresizeMethod · 0.80
GetCodecFunction · 0.70
ysizeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
DecompressedLengthMethod · 0.45
DecompressMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected