xp_comm_proj/rd_dicom/Papyrus3/JpegDir/JpgLless/huffcoptimisebug.c
/*
 *--------------------------------------------------------------
 *
 * AllPredCountOneDiff --
 *
 *      Count this difference value in all 7 frequency counting 
 *	tables. This function is called when processing the first
 *      row and first column of the image. Pixels in the first row
 *	always use the left neighbors or (1<Pr-Pt-1) as predictors;  
 *      and pixels in the first column always use the upper neighbors.
 *      So, these pixels's difference values are the same for all 
 *	seven PSVs. Thus, we compute this value once and count it
 *	for all PSVs.  
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      value is counted in all global counting tables,
 *	i.e. freqCountPtrs.
 *
 *--------------------------------------------------------------
 */
AllPredCountOneDiff
Count this difference value in all 7 frequency counting
tables. This function is called when processing the first
row and first column of the image. Pixels in the first row
always use the left neighbors or (1<Pr-Pt-1) as predictors;
and pixels in the first column always use the upper neighbors.
So, these pixels's difference values are the same for all
seven PSVs. Thus, we compute this value once and count it
for all PSVs.

None.

Side effects:
value is counted in all global counting tables,
i.e.
AllPredCountOneDiff Count this difference value in all 7 frequency counting tables . This function is called when processing the first row and first column of the image . Pixels in the first row always use the left neighbors or ( 1<Pr - Pt - 1 ) as predictors ; and pixels in the first column always use the upper neighbors . So these pixels ' s difference values are the same for all seven PSVs . Thus we compute this value once and count it for all PSVs . None . Side effects : value is counted in all global counting tables i . e .
void
AllPredCountOneDiff(int value, int tblNo)
{
    register int temp, temp2;
    register short nbits; 
    temp = temp2 = value;
    if (temp < 0) {
        temp = -temp;
        temp2--;
    }
    nbits=0;
    if (temp) {
        while (temp >= 256) {
            nbits += 8;
            temp >>= 8;
        }
        nbits += numBitsTable[temp&0xff];
    }
    freqCountPtrs[0][tblNo][nbits]++;
    freqCountPtrs[1][tblNo][nbits]++;
    freqCountPtrs[2][tblNo][nbits]++;
    freqCountPtrs[3][tblNo][nbits]++;
    freqCountPtrs[4][tblNo][nbits]++;
    freqCountPtrs[5][tblNo][nbits]++;
    freqCountPtrs[6][tblNo][nbits]++;
}
void AllPredCountOneDiff ( int value , int tblNo ) { register int temp , temp2 ; register short nbits ; temp = temp2 = value ; if ( temp < 0 ) { temp = - temp ; temp2 -- ; } nbits = 0 ; if ( temp ) { while ( temp >= 256 ) { nbits += 8 ; temp >>= 8 ; } nbits += numBitsTable [ temp & 0xff ] ; } freqCountPtrs [ 0 ] [ tblNo ] [ nbits ] ++ ; freqCountPtrs [ 1 ] [ tblNo ] [ nbits ] ++ ; freqCountPtrs [ 2 ] [ tblNo ] [ nbits ] ++ ; freqCountPtrs [ 3 ] [ tblNo ] [ nbits ] ++ ; freqCountPtrs [ 4 ] [ tblNo ] [ nbits ] ++ ; freqCountPtrs [ 5 ] [ tblNo ] [ nbits ] ++ ; freqCountPtrs [ 6 ] [ tblNo ] [ nbits ] ++ ; }
AllPredCountOneDiff
      Count this difference value in all 7 frequency counting
      tables.
AllPredCountOneDiff Count this difference value in all 7 frequency counting tables .
/*i;*/ /*
     * Encode the DC coefficient difference per section F.1.2.1
     */ /*
         * For a negative input, want temp2 = bitwise complement of
         * abs(input).  This code assumes we are on a two's complement
         * machine.
         */ /*
     * Find the number of bits needed for the magnitude of the coefficient
     */