MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / tdefl_record_match

Function tdefl_record_match

SampleFramework12/v1.00/TinyEXR.cpp:3577–3605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3575}
3576
3577static MZ_FORCEINLINE void
3578tdefl_record_match(tdefl_compressor *d, mz_uint match_len, mz_uint match_dist) {
3579 mz_uint32 s0, s1;
3580
3581 MZ_ASSERT((match_len >= TDEFL_MIN_MATCH_LEN) && (match_dist >= 1) &&
3582 (match_dist <= TDEFL_LZ_DICT_SIZE));
3583
3584 d->m_total_lz_bytes += match_len;
3585
3586 d->m_pLZ_code_buf[0] = (mz_uint8)(match_len - TDEFL_MIN_MATCH_LEN);
3587
3588 match_dist -= 1;
3589 d->m_pLZ_code_buf[1] = (mz_uint8)(match_dist & 0xFF);
3590 d->m_pLZ_code_buf[2] = (mz_uint8)(match_dist >> 8);
3591 d->m_pLZ_code_buf += 3;
3592
3593 *d->m_pLZ_flags = (mz_uint8)((*d->m_pLZ_flags >> 1) | 0x80);
3594 if (--d->m_num_flags_left == 0) {
3595 d->m_num_flags_left = 8;
3596 d->m_pLZ_flags = d->m_pLZ_code_buf++;
3597 }
3598
3599 s0 = s_tdefl_small_dist_sym[match_dist & 511];
3600 s1 = s_tdefl_large_dist_sym[(match_dist >> 8) & 127];
3601 d->m_huff_count[1][(match_dist < 512) ? s0 : s1]++;
3602
3603 if (match_len >= TDEFL_MIN_MATCH_LEN)
3604 d->m_huff_count[0][s_tdefl_len_sym[match_len - TDEFL_MIN_MATCH_LEN]]++;
3605}
3606
3607static mz_bool tdefl_compress_normal(tdefl_compressor *d) {
3608 const mz_uint8 *pSrc = d->m_pSrc;

Callers 1

tdefl_compress_normalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected