xp_comm_proj/rd_dicom/Papyrus3/JpegDir/JpgLless/huffcoptimisebug.c
/*
 *--------------------------------------------------------------
 *
 * EmitBitsSum --
 *
 *	Find the number of bits emiting for a PSV (curCountTblNo+1).
 *	It includes the total bits of category symbols and additional
 *	bits.
 *
 * Results:
 *      Total "category symbol" and "additional bits" output bits
 *	for this PSV.
 *
 * Side effects:
 *	If in vervose mode, totalHuffSym and totalAddBits for
 *	this PSV is stored. These data are later output as statistics
 *	data.
 *
 *--------------------------------------------------------------
 */
EmitBitsSum
Find the number of bits emiting for a PSV (curCountTblNo+1).
It includes the total bits of category symbols and additional
bits.

Total "category symbol" and "additional bits" output bits
for this PSV.

Side effects:
If in vervose mode, totalHuffSym and totalAddBits for
this PSV is stored. These data are later output as statistics
data.
EmitBitsSum Find the number of bits emiting for a PSV ( curCountTblNo + 1 ) . It includes the total bits of category symbols and additional bits . Total " category symbol " and " additional bits " output bits for this PSV . Side effects : If in vervose mode totalHuffSym and totalAddBits for this PSV is stored . These data are later output as statistics data .
long
EmitBitsSum(int curCountTblNo, HuffmanTable **htblPtr)
{
    int i,tbl;
    long addBitSum,symLenSum,totalBits;
    addBitSum=0;
    symLenSum=0;
    for (tbl = 0; tbl < NUM_HUFF_TBLS; tbl++) {
        if (freqCountPtrs[curCountTblNo][tbl] != NULL) {
           for (i=1;i<17;i++) {
               addBitSum+=freqCountPtrs[curCountTblNo][tbl][i]*i;
           }
           for (i=0;i<17;i++) {
               symLenSum+=freqCountPtrs[curCountTblNo][tbl][i]*
                          htblPtr[tbl]->ehufsi[i];
           }
        }
    }
    totalBits=symLenSum+addBitSum;
    if (verbose) {
       totalHuffSym[curCountTblNo]=symLenSum; 
       totalAddBits[curCountTblNo]=addBitSum; 
    }
    return (totalBits);
}
long EmitBitsSum ( int curCountTblNo , HuffmanTable * * htblPtr ) { int i , tbl ; long addBitSum , symLenSum , totalBits ; addBitSum = 0 ; symLenSum = 0 ; for ( tbl = 0 ; tbl < NUM_HUFF_TBLS ; tbl ++ ) { if ( freqCountPtrs [ curCountTblNo ] [ tbl ] != NULL ) { for ( i = 1 ; i < 17 ; i ++ ) { addBitSum += freqCountPtrs [ curCountTblNo ] [ tbl ] [ i ] * i ; } for ( i = 0 ; i < 17 ; i ++ ) { symLenSum += freqCountPtrs [ curCountTblNo ] [ tbl ] [ i ] * htblPtr [ tbl ] -> ehufsi [ i ] ; } } } totalBits = symLenSum + addBitSum ; if ( verbose ) { totalHuffSym [ curCountTblNo ] = symLenSum ; totalAddBits [ curCountTblNo ] = addBitSum ; } return ( totalBits ) ; }
EmitBitsSum
      Find the number of bits emiting for a PSV (curCountTblNo+1).
EmitBitsSum Find the number of bits emiting for a PSV ( curCountTblNo + 1 ) .
/*    HuffmanTable *htblPtr[4]; */ /* 
     * Count additional bits and Huffman symbol size.
     */