mirror of
https://github.com/fadden/nulib2.git
synced 2024-07-05 12:28:55 +00:00
Removed C++-style comments, and fixed up some other comments.
This commit is contained in:
parent
809f26783f
commit
105c85fcd6
@ -6,9 +6,9 @@
|
|||||||
*
|
*
|
||||||
* Huffman/RLE "squeeze" compression, based on SQ/USQ. This format is
|
* Huffman/RLE "squeeze" compression, based on SQ/USQ. This format is
|
||||||
* listed in the NuFX documentation, but to my knowledge has never
|
* listed in the NuFX documentation, but to my knowledge has never
|
||||||
* actually been used (until now). Not surprisingly, P8 ShrinkIt v3.2
|
* actually been used (until now). Neither P8 ShrinkIt v3.4 nor II Unshrink
|
||||||
* doesn't handle the format correctly, so this is really only useful
|
* handle the format correctly, so this is really only useful as an
|
||||||
* as an experiment.
|
* experiment.
|
||||||
*
|
*
|
||||||
* The algorithm appears to date back to the CP/M days. This implementation
|
* The algorithm appears to date back to the CP/M days. This implementation
|
||||||
* is based on "xsq"/"xusq" v1.7u by Richard Greenlaw (from December 1982).
|
* is based on "xsq"/"xusq" v1.7u by Richard Greenlaw (from December 1982).
|
||||||
@ -483,7 +483,7 @@ Nu_SQScale(SQState* pSqState, int ceiling)
|
|||||||
sum += pSqState->node[i].weight;
|
sum += pSqState->node[i].weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
divisor = ovflw + 1;
|
divisor = ovflw + 1; /* use the high 16 bits of the sum */
|
||||||
|
|
||||||
/* Ensure no non-zero values are lost */
|
/* Ensure no non-zero values are lost */
|
||||||
increased = false;
|
increased = false;
|
||||||
@ -497,7 +497,7 @@ Nu_SQScale(SQState* pSqState, int ceiling)
|
|||||||
}
|
}
|
||||||
} while(increased);
|
} while(increased);
|
||||||
|
|
||||||
/* Scaling factor choosen, now scale */
|
/* scaling factor choosen and minimums are set; now do the downscale */
|
||||||
if (divisor > 1) {
|
if (divisor > 1) {
|
||||||
for (i = 0; i < kNuSQNumVals; i++)
|
for (i = 0; i < kNuSQNumVals; i++)
|
||||||
pSqState->node[i].weight /= divisor;
|
pSqState->node[i].weight /= divisor;
|
||||||
@ -789,7 +789,7 @@ Nu_CompressHuffmanSQ(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
|
|||||||
BailError(err);
|
BailError(err);
|
||||||
compressedLen += 4;
|
compressedLen += 4;
|
||||||
|
|
||||||
//DBUG(("TREE %d: %d %d\n", j, l, r));
|
/*DBUG(("TREE %d: %d %d\n", j, l, r));*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -943,8 +943,10 @@ Nu_ExpandHuffmanSQ(NuArchive* pArchive, const NuRecord* pRecord,
|
|||||||
/*
|
/*
|
||||||
* Read the header. We assume that the header is less than
|
* Read the header. We assume that the header is less than
|
||||||
* kNuGenCompBufSize bytes, which is pretty fair since the buffer is
|
* kNuGenCompBufSize bytes, which is pretty fair since the buffer is
|
||||||
* currently a hundred times larger than the longest possible header.
|
* currently 20x larger than the longest possible header (sq allowed
|
||||||
|
* 300+ for the filename, plus 257*2 for the tree, plus misc).
|
||||||
*/
|
*/
|
||||||
|
Assert(kNuGenCompBufSize > 1200);
|
||||||
#ifdef FULL_SQ_HEADER
|
#ifdef FULL_SQ_HEADER
|
||||||
err = Nu_USQReadShort(&usqState, &magic);
|
err = Nu_USQReadShort(&usqState, &magic);
|
||||||
BailError(err);
|
BailError(err);
|
||||||
@ -1008,7 +1010,6 @@ Nu_ExpandHuffmanSQ(NuArchive* pArchive, const NuRecord* pRecord,
|
|||||||
int val;
|
int val;
|
||||||
uchar lastc;
|
uchar lastc;
|
||||||
|
|
||||||
// printf("dib=%ld cr=%ld\n", usqState.dataInBuffer, compRemaining);
|
|
||||||
if (usqState.dataInBuffer < 65 && compRemaining) {
|
if (usqState.dataInBuffer < 65 && compRemaining) {
|
||||||
/*
|
/*
|
||||||
* Less than 256 bits, but there's more in the file.
|
* Less than 256 bits, but there's more in the file.
|
||||||
|
Loading…
Reference in New Issue
Block a user