Update Fast LZMA2

This commit is contained in:
conor42
2019-03-29 00:16:26 +10:00
parent 38dd2d5a35
commit 04371fb60c
13 changed files with 601 additions and 187 deletions

View File

@@ -66,7 +66,7 @@ void RC_printPriceTable()
for (Probability i = 31; i <= kBitModelTotal - 31; ++i) {
RangeEncoder rc;
RC_reset(&rc);
RC_setOutputBuffer(&rc, buf, sizeof(buf));
RC_setOutputBuffer(&rc, buf);
for (unsigned j = 0; j < test_size; ++j) {
Probability prob = i;
RC_encodeBit0(&rc, &prob);
@@ -74,7 +74,7 @@ void RC_printPriceTable()
RC_flush(&rc);
table0[i >> kNumMoveReducingBits] += (unsigned)rc.out_index - 5;
RC_reset(&rc);
RC_setOutputBuffer(&rc, buf, sizeof(buf));
RC_setOutputBuffer(&rc, buf);
for (unsigned j = 0; j < test_size; ++j) {
Probability prob = i;
RC_encodeBit1(&rc, &prob);
@@ -104,10 +104,9 @@ void RC_printPriceTable()
#endif
void RC_setOutputBuffer(RangeEncoder* const rc, BYTE *const out_buffer, size_t chunk_size)
void RC_setOutputBuffer(RangeEncoder* const rc, BYTE *const out_buffer)
{
rc->out_buffer = out_buffer;
rc->chunk_size = chunk_size;
rc->out_index = 0;
}
@@ -125,7 +124,8 @@ void FORCE_NOINLINE RC_shiftLow(RangeEncoder* const rc)
{
U64 low = rc->low;
rc->low = (U32)(low << 8);
if (low < 0xFF000000 || low > 0xFFFFFFFF) {
/* VC15 compiles 'if (low < 0xFF000000 || low > 0xFFFFFFFF)' to this single-branch conditional */
if (low + 0xFFFFFFFF01000000 > 0xFFFFFF) {
BYTE high = (BYTE)(low >> 32);
rc->out_buffer[rc->out_index++] = rc->cache + high;
rc->cache = (BYTE)(low >> 24);