xp_comm_proj/rd_dicom/Papyrus3/JpegDir/JpgLless/huffcoptimisebug.c
/*
 *--------------------------------------------------------------
 *
 * FreqCountAllSelValue --
 *
 *      Count the times each category symbol occurs in this
 *      image for all seven PSV.
 *      To do this all together is even faster than to use
 *      a loop to go through 4 only PSVs. 
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      The freqCountPtrs[i] has counted all category symbols
 *      appeared in the image, where i goes from 0 to 6. 
 *
 *--------------------------------------------------------------
 */
FreqCountAllSelValue
Count the times each category symbol occurs in this
image for all seven PSV.
To do this all together is even faster than to use
a loop to go through 4 only PSVs.

None.

Side effects:
The freqCountPtrs[i] has counted all category symbols
appeared in the image, where i goes from 0 to 6.
FreqCountAllSelValue Count the times each category symbol occurs in this image for all seven PSV . To do this all together is even faster than to use a loop to go through 4 only PSVs . None . Side effects : The freqCountPtrs [ i ] has counted all category symbols appeared in the image where i goes from 0 to 6 .
void
FreqCountAllSelValue(CompressInfo *cPtr)
{
    register short curComp, ci;
    register int col,row;
    register JpegComponentInfo *compptr;
    register int r;
    int numCOL,numROW,compsInScan;
    int Pr,Pt,Ss; 
    MCU *prevRowBuf,*curRowBuf;
    numCOL=cPtr->imageWidth;
    numROW=cPtr->imageHeight;
    compsInScan=cPtr->compsInScan;
    Pr=cPtr->dataPrecision;
    Pt=cPtr->Pt;
    Ss=cPtr->Ss;
    prevRowBuf=NULL;
    curRowBuf=mcuTable;
    for (curComp = 0; curComp < compsInScan; curComp++) {
        ci = cPtr->MCUmembership[curComp];
        compptr = cPtr->curCompInfo[ci];
        r = curRowBuf[0][curComp] - (1<<(Pr-Pt-1));
        AllPredCountOneDiff(r,compptr->dcTblNo);
    }
    for (col=1; col<numCOL; col++) {
        for (curComp = 0; curComp < compsInScan; curComp++) {
            ci = cPtr->MCUmembership[curComp];
            compptr = cPtr->curCompInfo[ci];
            r = curRowBuf[col][curComp]-curRowBuf[col-1][curComp];
            AllPredCountOneDiff(r,compptr->dcTblNo);
        }
    }
    prevRowBuf=curRowBuf;
    curRowBuf+=numCOL;
    for (row=1; row<numROW; row++) {
        for (curComp = 0; curComp < compsInScan; curComp++) {
            ci = cPtr->MCUmembership[curComp];
            compptr = cPtr->curCompInfo[ci];
            r = curRowBuf[0][curComp]-prevRowBuf[0][curComp];
            AllPredCountOneDiff(r,compptr->dcTblNo);
        }
        for (col=1; col<numCOL; col++) {
            for (curComp = 0; curComp < compsInScan; curComp++) {
                ci = cPtr->MCUmembership[curComp];
                compptr = cPtr->curCompInfo[ci];
                AllPredCountOneComp(col,curComp,compptr->dcTblNo,
                                    curRowBuf,prevRowBuf);
            }
        }
        prevRowBuf=curRowBuf;
        curRowBuf+=numCOL;
    }
}
void FreqCountAllSelValue ( CompressInfo * cPtr ) { register short curComp , ci ; register int col , row ; register JpegComponentInfo * compptr ; register int r ; int numCOL , numROW , compsInScan ; int Pr , Pt , Ss ; MCU * prevRowBuf , * curRowBuf ; numCOL = cPtr -> imageWidth ; numROW = cPtr -> imageHeight ; compsInScan = cPtr -> compsInScan ; Pr = cPtr -> dataPrecision ; Pt = cPtr -> Pt ; Ss = cPtr -> Ss ; prevRowBuf = NULL ; curRowBuf = mcuTable ; for ( curComp = 0 ; curComp < compsInScan ; curComp ++ ) { ci = cPtr -> MCUmembership [ curComp ] ; compptr = cPtr -> curCompInfo [ ci ] ; r = curRowBuf [ 0 ] [ curComp ] - ( 1 << ( Pr - Pt - 1 ) ) ; AllPredCountOneDiff ( r , compptr -> dcTblNo ) ; } for ( col = 1 ; col < numCOL ; col ++ ) { for ( curComp = 0 ; curComp < compsInScan ; curComp ++ ) { ci = cPtr -> MCUmembership [ curComp ] ; compptr = cPtr -> curCompInfo [ ci ] ; r = curRowBuf [ col ] [ curComp ] - curRowBuf [ col - 1 ] [ curComp ] ; AllPredCountOneDiff ( r , compptr -> dcTblNo ) ; } } prevRowBuf = curRowBuf ; curRowBuf += numCOL ; for ( row = 1 ; row < numROW ; row ++ ) { for ( curComp = 0 ; curComp < compsInScan ; curComp ++ ) { ci = cPtr -> MCUmembership [ curComp ] ; compptr = cPtr -> curCompInfo [ ci ] ; r = curRowBuf [ 0 ] [ curComp ] - prevRowBuf [ 0 ] [ curComp ] ; AllPredCountOneDiff ( r , compptr -> dcTblNo ) ; } for ( col = 1 ; col < numCOL ; col ++ ) { for ( curComp = 0 ; curComp < compsInScan ; curComp ++ ) { ci = cPtr -> MCUmembership [ curComp ] ; compptr = cPtr -> curCompInfo [ ci ] ; AllPredCountOneComp ( col , curComp , compptr -> dcTblNo , curRowBuf , prevRowBuf ) ; } } prevRowBuf = curRowBuf ; curRowBuf += numCOL ; } }
FreqCountAllSelValue
      Count the times each category symbol occurs in this
      image for all seven PSV.
FreqCountAllSelValue Count the times each category symbol occurs in this image for all seven PSV .
/*j;
    int predictor;*/ /*
     * Do some specical case checking such that we can reduce the
     * computations in the main loop.
     */ /*
     * For the very first mcu in the scan, predictor is 1<<(Pr-Pt-1). 
     */ /*
     * In rest of the first row, left neighboring pixel is the predictor. 
     */ /*
         * For the first column, upper neighbor is the predictor. 
         */ /*
         * Call AllPredCountOneComp to count the rest samples on this row.  
         */