ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
compress.c File Reference
#include "bzlib_private.h"
Include dependency graph for compress.c:

Go to the source code of this file.

Macros

#define bsNEEDW(nz)
 
#define BZ_LESSER_ICOST   0
 
#define BZ_GREATER_ICOST   15
 
#define BZ_ITER(nn)
 
#define BZ_ITUR(nn)
 
#define BZ_ITAH(nn)
 

Functions

ABC_NAMESPACE_IMPL_START void BZ2_bsInitWrite (EState *s)
 
void BZ2_compressBlock (EState *s, Bool is_last_block)
 

Macro Definition Documentation

◆ bsNEEDW

#define bsNEEDW ( nz)
Value:
{ \
while (s->bsLive >= 8) { \
s->zbits[s->numZ] \
= (UChar)(s->bsBuff >> 24); \
s->numZ++; \
s->bsBuff <<= 8; \
s->bsLive -= 8; \
} \
}
unsigned char UChar

Definition at line 61 of file compress.c.

61#define bsNEEDW(nz) \
62{ \
63 while (s->bsLive >= 8) { \
64 s->zbits[s->numZ] \
65 = (UChar)(s->bsBuff >> 24); \
66 s->numZ++; \
67 s->bsBuff <<= 8; \
68 s->bsLive -= 8; \
69 } \
70}

◆ BZ_GREATER_ICOST

#define BZ_GREATER_ICOST   15

Definition at line 239 of file compress.c.

◆ BZ_ITAH

#define BZ_ITAH ( nn)
Value:
mtfv_i = mtfv[gs+(nn)]; \
bsW ( s, \
s_len_sel_selCtr[mtfv_i], \
s_code_sel_selCtr[mtfv_i] )

◆ BZ_ITER

#define BZ_ITER ( nn)
Value:
icv = mtfv[gs+(nn)]; \
cost01 += s->len_pack[icv][0]; \
cost23 += s->len_pack[icv][1]; \
cost45 += s->len_pack[icv][2]; \

◆ BZ_ITUR

#define BZ_ITUR ( nn)
Value:
s->rfreq[bt][ mtfv[gs+(nn)] ]++

◆ BZ_LESSER_ICOST

#define BZ_LESSER_ICOST   0

Definition at line 238 of file compress.c.

Function Documentation

◆ BZ2_bsInitWrite()

ABC_NAMESPACE_IMPL_START void BZ2_bsInitWrite ( EState * s)

Definition at line 40 of file compress.c.

41{
42 s->bsLive = 0;
43 s->bsBuff = 0;
44}
Int32 bsLive
UInt32 bsBuff
Here is the caller graph for this function:

◆ BZ2_compressBlock()

void BZ2_compressBlock ( EState * s,
Bool is_last_block )

Definition at line 605 of file compress.c.

606{
607 if (s->nblock > 0) {
608
610 s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31);
611 s->combinedCRC ^= s->blockCRC;
612 if (s->blockNo > 1) s->numZ = 0;
613
614 if (s->verbosity >= 2)
615 VPrintf4( " block %d: crc = 0x%08x, "
616 "combined CRC = 0x%08x, size = %d\n",
617 s->blockNo, s->blockCRC, s->combinedCRC, s->nblock );
618
619 BZ2_blockSort ( s );
620 }
621
622 s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]);
623
624 /*-- If this is the first block, create the stream header. --*/
625 if (s->blockNo == 1) {
626 BZ2_bsInitWrite ( s );
627 bsPutUChar ( s, BZ_HDR_B );
628 bsPutUChar ( s, BZ_HDR_Z );
629 bsPutUChar ( s, BZ_HDR_h );
630 bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) );
631 }
632
633 if (s->nblock > 0) {
634
635 bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 );
636 bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 );
637 bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 );
638
639 /*-- Now the block's CRC, so it is in a known place. --*/
640 bsPutUInt32 ( s, s->blockCRC );
641
642 /*--
643 Now a single bit indicating (non-)randomisation.
644 As of version 0.9.5, we use a better sorting algorithm
645 which makes randomisation unnecessary. So always set
646 the randomised bit to 'no'. Of course, the decoder
647 still needs to be able to handle randomised blocks
648 so as to maintain backwards compatibility with
649 older versions of bzip2.
650 --*/
651 bsW(s,1,0);
652
653 bsW ( s, 24, s->origPtr );
654 generateMTFValues ( s );
655 sendMTFValues ( s );
656 }
657
658
659 /*-- If this is the last block, add the stream trailer. --*/
660 if (is_last_block) {
661
662 bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 );
663 bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 );
664 bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 );
665 bsPutUInt32 ( s, s->combinedCRC );
666 if (s->verbosity >= 2)
667 VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC );
668 bsFinishWrite ( s );
669 }
670}
void BZ2_blockSort(EState *s)
Definition blocksort.c:1033
#define BZ_HDR_Z
#define BZ_HDR_B
#define VPrintf4(zf, za1, za2, za3, za4)
#define BZ_HDR_h
#define BZ_HDR_0
#define BZ_FINALISE_CRC(crcVar)
#define VPrintf1(zf, za1)
ABC_NAMESPACE_IMPL_START void BZ2_bsInitWrite(EState *s)
Definition compress.c:40
UInt32 combinedCRC
Int32 nblock
UInt32 blockCRC
Int32 numZ
Int32 blockSize100k
Int32 verbosity
Int32 blockNo
UChar * zbits
UInt32 * arr2
Int32 origPtr
Here is the call graph for this function: