From 6e6126925ecb9f12f4d9ee36e1f4f1a465477b9d Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 23 Sep 2023 17:16:40 +0000 Subject: whitespace git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4681 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/ppm/ppmtompeg/bframe.c | 122 +- converter/ppm/ppmtompeg/bitio.c | 24 +- converter/ppm/ppmtompeg/block.c | 32 +- converter/ppm/ppmtompeg/combine.c | 28 +- converter/ppm/ppmtompeg/file.c | 6 +- converter/ppm/ppmtompeg/frametype.c | 66 +- converter/ppm/ppmtompeg/fsize.c | 50 +- converter/ppm/ppmtompeg/gethostname_win32.c | 18 +- converter/ppm/ppmtompeg/headers/all.h | 10 +- converter/ppm/ppmtompeg/headers/bitio.h | 32 +- converter/ppm/ppmtompeg/headers/byteorder.h | 20 +- converter/ppm/ppmtompeg/headers/combine.h | 4 +- converter/ppm/ppmtompeg/headers/dct.h | 10 +- converter/ppm/ppmtompeg/headers/frame.h | 28 +- converter/ppm/ppmtompeg/headers/frames.h | 20 +- converter/ppm/ppmtompeg/headers/frametype.h | 2 +- converter/ppm/ppmtompeg/headers/fsize.h | 8 +- converter/ppm/ppmtompeg/headers/general.h | 20 +- converter/ppm/ppmtompeg/headers/huff.h | 8 +- converter/ppm/ppmtompeg/headers/iframe.h | 6 +- converter/ppm/ppmtompeg/headers/mheaders.h | 52 +- converter/ppm/ppmtompeg/headers/motion_search.h | 12 +- converter/ppm/ppmtompeg/headers/mpeg.h | 48 +- converter/ppm/ppmtompeg/headers/mproto.h | 26 +- converter/ppm/ppmtompeg/headers/mtypes.h | 18 +- converter/ppm/ppmtompeg/headers/opts.h | 10 +- converter/ppm/ppmtompeg/headers/parallel.h | 40 +- converter/ppm/ppmtompeg/headers/param.h | 2 +- converter/ppm/ppmtompeg/headers/postdct.h | 14 +- converter/ppm/ppmtompeg/headers/psocket.h | 4 +- converter/ppm/ppmtompeg/headers/rate.h | 30 +- converter/ppm/ppmtompeg/headers/readframe.h | 34 +- converter/ppm/ppmtompeg/headers/rgbtoycc.h | 8 +- converter/ppm/ppmtompeg/headers/specifics.h | 8 +- converter/ppm/ppmtompeg/iframe.c | 106 +- converter/ppm/ppmtompeg/input.c | 92 +- converter/ppm/ppmtompeg/jrevdct.c | 1772 +++++++++++------------ converter/ppm/ppmtompeg/memory.c | 12 +- converter/ppm/ppmtompeg/mfwddct.c | 171 ++- converter/ppm/ppmtompeg/mheaders.c | 286 ++-- converter/ppm/ppmtompeg/moutput.c | 400 ++--- converter/ppm/ppmtompeg/mquant.c | 24 +- converter/ppm/ppmtompeg/nojpeg.c | 16 +- converter/ppm/ppmtompeg/noparallel.c | 22 +- converter/ppm/ppmtompeg/pframe.c | 164 +-- converter/ppm/ppmtompeg/postdct.c | 502 +++---- converter/ppm/ppmtompeg/ppmtompeg.c | 90 +- converter/ppm/ppmtompeg/psearch.c | 110 +- converter/ppm/ppmtompeg/qtest.c | 10 +- converter/ppm/ppmtompeg/rate.c | 104 +- converter/ppm/ppmtompeg/rgbtoycc.c | 22 +- converter/ppm/ppmtompeg/specifics.c | 136 +- converter/ppm/ppmtompeg/subsample.c | 8 +- 53 files changed, 2432 insertions(+), 2435 deletions(-) diff --git a/converter/ppm/ppmtompeg/bframe.c b/converter/ppm/ppmtompeg/bframe.c index f5009d6c..fb546cc0 100644 --- a/converter/ppm/ppmtompeg/bframe.c +++ b/converter/ppm/ppmtompeg/bframe.c @@ -94,7 +94,7 @@ extern Block **dct, **dctr, **dctb; static void zeroMotion(motion * const motionP) { - + motionP->fwd.y = motionP->fwd.x = motionP->bwd.y = motionP->bwd.x = 0; } @@ -218,14 +218,14 @@ ComputeBDiffDCTs(MpegFrame * const current, int * const patternP) { Block motionBlock; - + if (*patternP & 0x20) { boolean significantDiff; ComputeBMotionBlock(prev, next, by, bx, mode, motion, &motionBlock, LUM_BLOCK); ComputeDiffDCTBlock(current->y_blocks[by][bx], dct[by][bx], motionBlock, &significantDiff); - if (!significantDiff) + if (!significantDiff) *patternP ^= 0x20; } @@ -235,7 +235,7 @@ ComputeBDiffDCTs(MpegFrame * const current, &motionBlock, LUM_BLOCK); ComputeDiffDCTBlock(current->y_blocks[by][bx+1], dct[by][bx+1], motionBlock, &significantDiff); - if (!significantDiff) + if (!significantDiff) *patternP ^= 0x10; } @@ -348,7 +348,7 @@ ComputeBlockColorDiff(Block current, unsigned int y; int diffTotal; - + diffTotal = 0; for (y = 0; y < 8; ++y) { @@ -433,7 +433,7 @@ MotionSufficient(MpegFrame * const curr, &mColorBlock, CB_BLOCK); colorErr += ComputeBlockColorDiff(curr->cr_blocks[by/2][bx/2], mColorBlock); - + return (colorErr < 256); /* lumErr checked above */ } @@ -464,7 +464,7 @@ initializeStats(struct stats * const statsP) { static void -checkSpecifics(MpegFrame * const curr, +checkSpecifics(MpegFrame * const curr, int const mbAddress, int const QScale, boolean * const skipItP, @@ -519,9 +519,9 @@ checkSpecifics(MpegFrame * const curr, static void makeNonSkipBlock(int const y, - int const x, - MpegFrame * const curr, - MpegFrame * const prev, + int const x, + MpegFrame * const curr, + MpegFrame * const prev, MpegFrame * const next, bool const specificsOn, int const mbAddress, @@ -556,7 +556,7 @@ makeNonSkipBlock(int const y, &motion, mode); } /* STEP 2: INTRA OR NON-INTRA CODING */ - if (IntraPBAllowed && + if (IntraPBAllowed && DoBIntraCode(curr, prev, next, y, x, mode, motion)) { /* output I-block inside a B-frame */ ++statsP->IBlocks; @@ -565,7 +565,7 @@ makeNonSkipBlock(int const y, dct_data[y][x].useMotion = NO_MOTION; *oldModeP = MOTION_FORWARD; /* calculate forward dct's */ - if (collect_quant && (collect_quant_detailed & 1)) + if (collect_quant && (collect_quant_detailed & 1)) fprintf(collect_quant_fp, "l\n"); mp_fwd_dct_block2(curr->y_blocks[y][x], dct[y][x]); mp_fwd_dct_block2(curr->y_blocks[y][x+1], dct[y][x+1]); @@ -574,9 +574,9 @@ makeNonSkipBlock(int const y, if (collect_quant && (collect_quant_detailed & 1)) { fprintf(collect_quant_fp, "c\n"); } - mp_fwd_dct_block2(curr->cb_blocks[y>>1][x>>1], + mp_fwd_dct_block2(curr->cb_blocks[y>>1][x>>1], dctb[y>>1][x>>1]); - mp_fwd_dct_block2(curr->cr_blocks[y>>1][x>>1], + mp_fwd_dct_block2(curr->cr_blocks[y>>1][x>>1], dctr[y>>1][x>>1]); } else { /* dct P/Bi/B block */ @@ -608,9 +608,9 @@ makeNonSkipBlock(int const y, default: pm_error("INTERNAL ERROR: Illegal mode: %d", mode); } - + ComputeBDiffDCTs(curr, prev, next, y, x, mode, motion, &pattern); - + dct_data[y][x].pattern = pattern; dct_data[y][x].useMotion = MOTION; if ( computeMVHist ) { @@ -622,7 +622,7 @@ makeNonSkipBlock(int const y, assert(motion.bwd.y + searchRangeB + 1 >= 0); assert(motion.bwd.x + searchRangeB + 1 <= 2*searchRangeB + 2); assert(motion.bwd.y + searchRangeB + 1 <= 2*searchRangeB + 2); - + ++bfmvHistogram[motion.fwd.x + searchRangeB + 1] [motion.fwd.y + searchRangeB + 1]; ++bbmvHistogram[motion.bwd.x + searchRangeB + 1] @@ -649,9 +649,9 @@ makeNonSkipBlock(int const y, * *===========================================================================*/ void -GenBFrame(BitBucket * const bb, - MpegFrame * const curr, - MpegFrame * const prev, +GenBFrame(BitBucket * const bb, + MpegFrame * const curr, + MpegFrame * const prev, MpegFrame * const next) { FlatBlock fba[6], fb[6]; @@ -704,7 +704,7 @@ GenBFrame(BitBucket * const bb, if (bitstreamMode == FIXED_RATE) { targetRateControl(curr); } - + QScale = GetBQScale(); Mhead_GenPictureHeader(bb, B_FRAME, curr->id, fCodeB); /* Check for Qscale change */ @@ -751,7 +751,7 @@ GenBFrame(BitBucket * const bb, mbAddress = 0; /* Start with zero motion assumption */ - zeroMotion(&motion); + zeroMotion(&motion); zeroMotion(&oldMotion); zeroMotion(&motionRem); zeroMotion(&motionQuot); @@ -759,7 +759,7 @@ GenBFrame(BitBucket * const bb, /* find motion vectors and do dcts */ /* In this first loop, all MVs are in half-pixel scope, (if FULL is set then they will be multiples of 2). This is not true in - the second loop. + the second loop. */ for (y = 0; y < lastBlockY; y += 2) { for (x = 0; x < lastBlockX; x += 2) { @@ -772,14 +772,14 @@ GenBFrame(BitBucket * const bb, currentBlock.l[iy][ix] = (int16)curr->orig_y[fy+iy][fx+ix]; } } - + if (slicePos == 0) { zeroMotion(&oldMotion); oldMode = MOTION_FORWARD; lastIntra = TRUE; } - /* STEP 1: Select Forward, Backward, or Interpolated motion + /* STEP 1: Select Forward, Backward, or Interpolated motion vectors */ /* see if old motion is good enough */ /* but force last block to be non-skipped */ @@ -795,7 +795,7 @@ GenBFrame(BitBucket * const bb, (! lastIntra) && (BSkipBlocks) ) { make_skip_block = - MotionSufficient(curr, ¤tBlock, + MotionSufficient(curr, ¤tBlock, prev, next, y, x, oldMode, oldMotion); } else make_skip_block = FALSE; @@ -830,7 +830,7 @@ GenBFrame(BitBucket * const bb, if ( (slicePos == 0) && (mbAddress != 0) ) { if (specificsOn) { /* Make sure no slice Qscale change */ - newQScale = + newQScale = SpecLookup(curr->id,1,mbAddress/blocksPerSlice, &info, QScale); if (newQScale != -1) QScale = newQScale; } @@ -858,7 +858,7 @@ GenBFrame(BitBucket * const bb, QScale = newQScale; } } - + if (specificsOn) { newQScale = SpecLookup(curr->id, 2, mbAddress, &info, QScale); if (newQScale != -1) { @@ -871,12 +871,12 @@ GenBFrame(BitBucket * const bb, mbAddrInc = 1; stats.IBits += (bb->cumulativeBits - stats.totalBits); stats.totalBits = bb->cumulativeBits; - + /* reset because intra-coded */ zeroMotion(&oldMotion); oldMode = MOTION_FORWARD; lastIntra = TRUE; - + if ( printSNR ) { /* need to decode block we just encoded */ /* and reverse the DCT transform */ @@ -896,14 +896,14 @@ GenBFrame(BitBucket * const bb, } else if (dct_data[y][x].useMotion == SKIP) { ++stats.Skipped; mbAddrInc++; - + /* decode skipped block */ if (printSNR) { struct motion motion; - + for (idx = 0; idx < 6; ++idx) - memset((char *)dec[idx], 0, sizeof(Block)); - + memset((char *)dec[idx], 0, sizeof(Block)); + if (pixelFullSearch) { motion.fwd.y = 2 * oldMotion.fwd.y; motion.fwd.x = 2 * oldMotion.fwd.x; @@ -911,7 +911,7 @@ GenBFrame(BitBucket * const bb, motion.bwd.x = 2 * oldMotion.bwd.x; } else motion = oldMotion; - + /* now add the motion block */ AddBMotionBlock(dec[0], prev->decoded_y, next->decoded_y, y, x, mode, motion); @@ -927,7 +927,7 @@ GenBFrame(BitBucket * const bb, AddBMotionBlock(dec[5], prev->decoded_cr, next->decoded_cr, y/2, x/2, mode, halfMotion(motion)); - + /* now, unblockify */ BlockToData(curr->decoded_y, dec[0], y, x); BlockToData(curr->decoded_y, dec[1], y, x+1); @@ -937,9 +937,9 @@ GenBFrame(BitBucket * const bb, BlockToData(curr->decoded_cr, dec[5], y/2, x/2); } } else /* B block */ { - int const fCode = fCodeB; + int const fCode = fCodeB; int pattern; - + pattern = dct_data[y][x].pattern; motion.fwd.y = dct_data[y][x].fmotionY; motion.fwd.x = dct_data[y][x].fmotionX; @@ -948,7 +948,7 @@ GenBFrame(BitBucket * const bb, if (pixelFullSearch) motion = halfMotion(motion); - + /* create flat blocks and update pattern if necessary */ calc_blocks: /* Note DoQuant references QScale, overflowChange, overflowValue, @@ -962,7 +962,7 @@ GenBFrame(BitBucket * const bb, motionForward = (dct_data[y][x].mode != MOTION_BACKWARD); motionBackward = (dct_data[y][x].mode != MOTION_FORWARD); - + /* Encode Vectors */ if (motionForward) { /* transform the fMotion vector into the appropriate values */ @@ -974,7 +974,7 @@ GenBFrame(BitBucket * const bb, FORW_F, fCode); oldMotion.fwd = motion.fwd; } - + if (motionBackward) { /* transform the bMotion vector into the appropriate values */ offsetY = motion.bwd.y - oldMotion.bwd.y; @@ -984,9 +984,9 @@ GenBFrame(BitBucket * const bb, BACK_F, fCode); oldMotion.bwd = motion.bwd; } - + oldMode = dct_data[y][x].mode; - + if (printSNR) { /* Need to decode */ if (pixelFullSearch) { motion.fwd.x *= 2; motion.fwd.y *= 2; @@ -1030,7 +1030,7 @@ GenBFrame(BitBucket * const bb, y_dc_pred = cr_dc_pred = cb_dc_pred = 128; lastIntra = FALSE; mode = dct_data[y][x].mode; - + /* DBG_PRINT(("MB Header(%d,%d)\n", x, y)); */ Mhead_GenMBHeader( bb, 3 /* pict_code_type */, mbAddrInc /* addr_incr */, @@ -1049,7 +1049,7 @@ GenBFrame(BitBucket * const bb, pattern /* mb_pattern */, FALSE /* mb_intra */); mbAddrInc = 1; - + /* now output the difference */ { unsigned int x; @@ -1058,7 +1058,7 @@ GenBFrame(BitBucket * const bb, Mpost_RLEHuffPBlock(fba[x], bb); } } - + switch (mode) { case MOTION_FORWARD: bframeStats.BFOBits += (bb->cumulativeBits - stats.totalBits); @@ -1072,10 +1072,10 @@ GenBFrame(BitBucket * const bb, default: pm_error("PROGRAMMER ERROR: Illegal mode: %d", mode); } - + stats.BBits += (bb->cumulativeBits - stats.totalBits); stats.totalBits = bb->cumulativeBits; - + if (overflowChange) { /* undo an overflow-caused Qscale change */ overflowChange = FALSE; @@ -1091,7 +1091,7 @@ GenBFrame(BitBucket * const bb, rc_blockStart = bb->cumulativeBits; MB_RateOut(TYPE_BFRAME); } - + } } @@ -1100,22 +1100,22 @@ GenBFrame(BitBucket * const bb, totalSNR += snr[0]; totalPSNR += psnr[0]; } - + Mhead_GenSliceEnder(bb); /* Rate Control */ if (bitstreamMode == FIXED_RATE) { updateRateControl(TYPE_BFRAME); } - + endTime = time_elapsed(); totalTime += (endTime-startTime); - + if ( showBitRatePerFrame ) { /* ASSUMES 30 FRAMES PER SECOND */ fprintf(bitRateFile, "%5d\t%8d\n", curr->id, 30*(bb->cumulativeBits-totalFrameBits)); } - + if ( frameSummary && !realQuiet) { fprintf(stdout, "FRAME %d (B): " "I BLOCKS: %5d; B BLOCKS: %5d SKIPPED: %5d (%ld seconds)\n", @@ -1127,7 +1127,7 @@ GenBFrame(BitBucket * const bb, curr->id, snr[0], snr[1], snr[2], psnr[0], psnr[1], psnr[2]); } - + bframeStats.FrameBits += (bb->cumulativeBits-totalFrameBits); bframeStats.BIBlocks += stats.IBlocks; bframeStats.BBBlocks += stats.BBlocks; @@ -1208,8 +1208,8 @@ BFrameTotalTime(void) { void -ShowBFrameSummary(unsigned int const inputFrameBits, - unsigned int const totalBits, +ShowBFrameSummary(unsigned int const inputFrameBits, + unsigned int const totalBits, FILE * const fpointer) { if (bframeStats.Frames > 0) { @@ -1234,13 +1234,13 @@ ShowBFrameSummary(unsigned int const inputFrameBits, " B types: %5d (%4d bpb) " "forw %5d (%4d bpb) back %5d (%4d bpb) bi\n", bframeStats.BFOBlocks, - (bframeStats.BFOBlocks==0) ? + (bframeStats.BFOBlocks==0) ? 0 : bframeStats.BFOBits/bframeStats.BFOBlocks, bframeStats.BBABlocks, - (bframeStats.BBABlocks==0) ? + (bframeStats.BBABlocks==0) ? 0 : bframeStats.BBABits/bframeStats.BBABlocks, bframeStats.BINBlocks, - (bframeStats.BINBlocks==0) ? + (bframeStats.BINBlocks==0) ? 0 : bframeStats.BINBits/bframeStats.BINBlocks); } else fprintf(fpointer, " B Blocks: %5d\n", 0); @@ -1251,7 +1251,7 @@ ShowBFrameSummary(unsigned int const inputFrameBits, "(%5d bpf) (%2.1f%% of total)\n", bframeStats.Frames, bframeStats.FrameBits, bframeStats.FrameBits/bframeStats.Frames, - 100.0*(float)bframeStats.FrameBits/(float)totalBits); + 100.0*(float)bframeStats.FrameBits/(float)totalBits); fprintf(fpointer, " Compression: %3d:1 (%9.4f bpp)\n", bframeStats.Frames*inputFrameBits/bframeStats.FrameBits, 24.0*(float)bframeStats.FrameBits/ @@ -1312,7 +1312,7 @@ ComputeBMotionLumBlock(MpegFrame * const prev, ComputeMotionLumBlock(prev, by, bx, motion.fwd, &prevBlock); ComputeMotionLumBlock(next, by, bx, motion.bwd, &nextBlock); - + for (y = 0; y < 16; ++y) { unsigned int x; for (x = 0; x < 16; ++x) diff --git a/converter/ppm/ppmtompeg/bitio.c b/converter/ppm/ppmtompeg/bitio.c index 3812bc39..79c9f36f 100644 --- a/converter/ppm/ppmtompeg/bitio.c +++ b/converter/ppm/ppmtompeg/bitio.c @@ -106,10 +106,10 @@ Dump(BitBucket * const bbPtr) { for (i = 0; i <= ptr->currword; ++i) buffer[i] = pm_bigendFromUint32(ptr->bits[i]); - nitems = fwrite(buffer, sizeof(buffer[0]), ptr->currword + 1, + nitems = fwrite(buffer, sizeof(buffer[0]), ptr->currword + 1, bbPtr->filePtr); if (nitems != ptr->currword+1) { - fprintf(stderr, + fprintf(stderr, "Whoa! Trouble writing %u words (wrote %u words)! " "Game over, dude!\n", ptr->currword+1, nitems); @@ -170,7 +170,7 @@ Bitio_New(FILE * const filePtr) { bbPtr->firstPtr->bitsleft = MAXBITS_PER_BUCKET; bbPtr->firstPtr->bitsleftcur = 32; bbPtr->firstPtr->currword = 0; - memset((char *)bbPtr->firstPtr->bits, 0, + memset((char *)bbPtr->firstPtr->bits, 0, sizeof(uint32) * WORDS_PER_BUCKET); return bbPtr; @@ -182,7 +182,7 @@ BitBucket * Bitio_New_Filename(const char * const fileName) { FILE * outputFile; - + outputFile = fopen(fileName, "wb"); if (outputFile == NULL) pm_error("Could not open output file '%s'. " @@ -232,14 +232,14 @@ Bitio_Free(BitBucket * const bbPtr) { * *===========================================================================*/ void -Bitio_Write(BitBucket * const bbPtr, - uint32 const bits_arg, +Bitio_Write(BitBucket * const bbPtr, + uint32 const bits_arg, int const nbits) { register struct bitBucket *lastPtr, *newPtr; register int delta; uint32 bits; - + bits=bits_arg; assert(nbits <= 32 && nbits >= 0); @@ -261,7 +261,7 @@ Bitio_Write(BitBucket * const bbPtr, * there's not enough room in the current bucket, so we're * going to have to allocate another bucket */ - newPtr = lastPtr->nextPtr = (struct bitBucket *) + newPtr = lastPtr->nextPtr = (struct bitBucket *) malloc(sizeof(struct bitBucket)); ERRCHK(newPtr, "malloc"); newPtr->nextPtr = NULL; @@ -302,7 +302,7 @@ Bitio_Write(BitBucket * const bbPtr, */ lastPtr->bits[lastPtr->currword] |= (bits >> delta); lastPtr->currword++; - lastPtr->bits[lastPtr->currword] = + lastPtr->bits[lastPtr->currword] = (bits & lower_mask[delta]) << (32 - delta); lastPtr->bitsleftcur = 32 - delta; } else { @@ -371,12 +371,12 @@ Bitio_Flush(BitBucket * const bbPtr) { if (nitems != numWords) { if (ferror(bbPtr->filePtr)) pm_error("Error writing %u words to flush a bit bucket. " - "fwrite() gives errno %d (%s)", + "fwrite() gives errno %d (%s)", numWords, errno, strerror(errno)); else pm_error("Problem writing %u words " "to flush a bit bucket. " - "Only %d words transferred.", + "Only %d words transferred.", numWords, nitems); } @@ -439,7 +439,7 @@ Bitio_Close(BitBucket * const bbPtr) { * *===========================================================================*/ void -Bitio_WriteToSocket(BitBucket * const bbPtr, +Bitio_WriteToSocket(BitBucket * const bbPtr, int const socket) { struct bitBucket *ptr, *tempPtr; diff --git a/converter/ppm/ppmtompeg/block.c b/converter/ppm/ppmtompeg/block.c index 913518c4..23396b4c 100644 --- a/converter/ppm/ppmtompeg/block.c +++ b/converter/ppm/ppmtompeg/block.c @@ -106,7 +106,7 @@ ComputeDiffDCTs(MpegFrame * const current, int const bx, vector const m, int * const patternP) { - + Block motionBlock; if (collect_quant && (collect_quant_detailed & 1)) @@ -203,14 +203,14 @@ computePrevFyFx(MpegFrame * const prevFrame, if (yHalf) { if (m.y < 0) --*fyP; - + *prevP = prevFrame->halfBoth; } else *prevP = prevFrame->halfX; } else if (yHalf) { if (m.y < 0) --*fyP; - + *prevP = prevFrame->halfY; } else *prevP = prevFrame->ref_y; @@ -263,7 +263,7 @@ ComputeMotionBlock(uint8 ** const prev, if (m.x < 0) --fx; - + for (y = 0; y < 8; ++y) { int16 * const destPtr = (*motionBlockP)[y]; uint8 * const srcPtr = &(prev[fy+y][fx]); @@ -278,7 +278,7 @@ ComputeMotionBlock(uint8 ** const prev, unsigned int y; if (m.x < 0) --fx; - + for (y = 0; y < 8; ++y) { int16 * const destPtr = (*motionBlockP)[y]; uint8 * const srcPtr = &(prev[fy+y][fx]); @@ -410,7 +410,7 @@ LumBlockMAD(const LumBlock * const currentBlockP, * return the MAD of the currentBlock and the motion-compensated block * (without TUNEing) * - * (by, bx) is the location of the block in the frame + * (by, bx) is the location of the block in the frame * (block number coordinates). 'm' is the motion of the block in pixels. * The moved block must be wholly within the frame. * @@ -452,7 +452,7 @@ LumMotionError(const LumBlock * const currentBlockP, const int32 * const cacross = currentBlockP->l[y]; uint8 * const across = &prev[fy+y][fx]; unsigned int x; - + for (x = 0; x < 16; ++x) { int32 const localDiff = across[x]-cacross[x]; diff += ABS(localDiff); @@ -461,14 +461,14 @@ LumMotionError(const LumBlock * const currentBlockP, return diff; } break; - + case LOCAL_DCT: { Block dctdiff[4], dctquant[4]; FlatBlock quant; int x, i, tmp; int distortion=0, datarate=0; int pq = GetPQScale(); - + for (y = 0; y < 16; ++y) { const int32 * const cacross = currentBlockP->l[y]; uint8 * const across = &(prev[fy+y][fx]); @@ -489,7 +489,7 @@ LumMotionError(const LumBlock * const currentBlockP, datarate += CalcRLEHuffLength(quant); } } - + /* Calculate distortion */ for (y = 0; y < 16; ++y) { const int32 * const cacross = currentBlockP->l[y]; @@ -510,12 +510,12 @@ LumMotionError(const LumBlock * const currentBlockP, extern int32 niqtable[]; int pq = niqtable[0]*GetPQScale(); unsigned int y; - + for (y = 0; y < 16; ++y) { const int32 * const cacross = currentBlockP->l[y]; uint8 * const across = &(prev[fy+y][fx]); unsigned int x; - + for (x = 0; x < 16; ++x) { int32 const localDiff = across[x]-cacross[x]; diff += localDiff; @@ -598,7 +598,7 @@ LumAddMotionError(const LumBlock * const currentBlockP, if (diff > bestSoFar) return diff; } - + /* This is what's happening: * * ComputeMotionLumBlock(prevFrame, by, bx, my, mx, lumMotionBlock); @@ -855,7 +855,7 @@ BlockifyFrame(MpegFrame * const frameP) { * but leave it here anyway for clarity * * (startY, startX) = (0,0) for A....(0,1) for B...(1,0) for C...(1,1) for D - * + * */ void ComputeSubSampledMotionLumBlock(MpegFrame * const prevFrame, @@ -889,7 +889,7 @@ ComputeSubSampledMotionLumBlock(MpegFrame * const prevFrame, if ( my < 0 ) { fy--; } - + prev = prevFrame->halfBoth; } else { prev = prevFrame->halfX; @@ -974,7 +974,7 @@ LumMotionErrorSubSampled(LumBlock const currentBlock, if ( my < 0 ) { fy--; } - + prev = prevFrame->halfBoth; } else { prev = prevFrame->halfX; diff --git a/converter/ppm/ppmtompeg/combine.c b/converter/ppm/ppmtompeg/combine.c index c00f9c71..afc3572d 100644 --- a/converter/ppm/ppmtompeg/combine.c +++ b/converter/ppm/ppmtompeg/combine.c @@ -112,7 +112,7 @@ appendSpecifiedGopFiles(struct inputSource * const inputSourceP, ifP = fopen(fileName, "rb"); if (ifP == NULL) - pm_message("ERROR: Couldn't read file '%s'. retry %u", + pm_message("ERROR: Couldn't read file '%s'. retry %u", fileName, nAttempts); } if (ifP) { @@ -125,7 +125,7 @@ appendSpecifiedGopFiles(struct inputSource * const inputSourceP, pm_strfree(fileName); pm_strfree(inputFileName); } -} +} @@ -135,20 +135,20 @@ appendDefaultGopFiles(const char * const outputFileName, unsigned int fileSeq; bool endOfFiles; - + for (fileSeq = 0, endOfFiles = FALSE; !endOfFiles; ++fileSeq) { const char * fileName; FILE * ifP; pm_asprintf(&fileName, "%s.gop.%u", outputFileName, fileSeq); - + ifP = fopen(fileName, "rb"); if (ifP == NULL) endOfFiles = TRUE; else { if (!realQuiet) pm_message("appending file: %s", fileName); - + AppendFile(ofP, ifP); } pm_strfree(fileName); @@ -159,7 +159,7 @@ appendDefaultGopFiles(const char * const outputFileName, void GOPsToMPEG(struct inputSource * const inputSourceP, - const char * const outputFileName, + const char * const outputFileName, FILE * const ofP) { /*---------------------------------------------------------------------------- Combine individual GOPs (one per file) into a single MPEG sequence file. @@ -174,13 +174,13 @@ GOPsToMPEG(struct inputSource * const inputSourceP, if (Fsize_x == 0 || Fsize_y == 0) Fsize_Note(0, x, y); } - + bb = Bitio_New(ofP); Mhead_GenSequenceHeader(bb, Fsize_x, Fsize_y, /* pratio */ aspectRatio, /* pict_rate */ frameRate, /* bit_rate */ -1, /* buf_size */ -1, /*c_param_flag */ 1, - /* iq_matrix */ customQtable, + /* iq_matrix */ customQtable, /* niq_matrix */ customNIQtable, /* ext_data */ NULL, /* ext_data_size */ 0, /* user_data */ NULL, /* user_data_size */ 0); @@ -228,16 +228,16 @@ makeGOPHeader(FILE * const outputFileP, tc_hrs, tc_min, tc_sec, tc_pict, closed, /* broken_link */ 0, /* ext_data */ NULL, /* ext_data_size */ 0, - /* user_data */ NULL, + /* user_data */ NULL, /* user_data_size */ 0); Bitio_Flush(bbP); SetGOPStartTime(frameNumber); -} +} void -FramesToMPEG(FILE * const outputFile, +FramesToMPEG(FILE * const outputFile, void * const inputHandle, fileAcquisitionFn acquireInputFile, fileDispositionFn disposeInputFile) { @@ -292,7 +292,7 @@ FramesToMPEG(FILE * const outputFile, frameNumber = 0; makeGOPHeader(outputFile, totalFramesSent, frameNumber, seqWithinGop); - + while (inputLeft) { if (FType_Type(frameNumber) != 'b') { pastRefNum = futureRefNum; @@ -318,7 +318,7 @@ FramesToMPEG(FILE * const outputFile, /* now, output the B-frames */ if (pastRefNum != -1) { unsigned int bNum; - + for (bNum = pastRefNum+1; bNum < futureRefNum; ++bNum) { acquireInputFile(inputHandle, bNum, &inputFile); @@ -326,7 +326,7 @@ FramesToMPEG(FILE * const outputFile, AppendFile(outputFile, inputFile); disposeInputFile(inputHandle, bNum); - + ++seqWithinGop; IncrementTCTime(); } diff --git a/converter/ppm/ppmtompeg/file.c b/converter/ppm/ppmtompeg/file.c index 223170a4..b81e8077 100644 --- a/converter/ppm/ppmtompeg/file.c +++ b/converter/ppm/ppmtompeg/file.c @@ -121,7 +121,7 @@ ChangeDirectory(ClientData nulldata, Tcl_Interp *interp, int argc, fprintf(stderr, "can't open '%s'\n", currentPath); return TCL_OK; /* shouldn't, really */ } - + return TCL_OK; } @@ -164,7 +164,7 @@ ListDirectory(ClientData nulldata, Tcl_Interp *interp, int argc, while ((dp = readdir(dfd)) != NULL) { strcpy(restPtr, dp->d_name); stat(fullName, &stbuf); - + if (dp->d_name[0] != '.') { if (S_ISDIR(stbuf.st_mode)) { sprintf(fileName[fileCount], "%s/", dp->d_name); @@ -263,7 +263,7 @@ SetBrowseGlob(ClientData nulldata, Tcl_Interp *interp, return TCL_OK; } - Tcl_AppendResult(interp, + Tcl_AppendResult(interp, "wrong args: should be \"", argv[0]," string\"", NULL); return TCL_ERROR; diff --git a/converter/ppm/ppmtompeg/frametype.c b/converter/ppm/ppmtompeg/frametype.c index debefcdc..78e324d0 100644 --- a/converter/ppm/ppmtompeg/frametype.c +++ b/converter/ppm/ppmtompeg/frametype.c @@ -1,18 +1,18 @@ /*===========================================================================* - * frametype.c * - * * - * procedures to keep track of frame types (I, P, B) * - * * - * EXPORTED PROCEDURES: * - * FType_Type * - * FType_FutureRef * - * FType_PastRef * - * * - * SYNOPSIS * - * FType_Type returns the type of the given numbered frame * - * FType_FutureRef returns the number of the future reference frame * - * FType_PastRef returns the number of the past reference frame * - * * + * frametype.c * + * * + * procedures to keep track of frame types (I, P, B) * + * * + * EXPORTED PROCEDURES: * + * FType_Type * + * FType_FutureRef * + * FType_PastRef * + * * + * SYNOPSIS * + * FType_Type returns the type of the given numbered frame * + * FType_FutureRef returns the number of the future reference frame * + * FType_PastRef returns the number of the past reference frame * + * * * 00.12.07 change malloc from frameTable to calloc to fix bug *===========================================================================*/ @@ -72,9 +72,9 @@ extern char * framePattern; * * FType_Type * - * returns the type of the given numbered frame + * returns the type of the given numbered frame * - * RETURNS: the type + * RETURNS: the type * * SIDE EFFECTS: none * @@ -161,9 +161,9 @@ FType_FutureRef(unsigned int const currFrameNum) { * * FType_PastRef * - * returns the number of the past reference frame + * returns the number of the past reference frame * - * RETURNS: the number + * RETURNS: the number * * SIDE EFFECTS: none * @@ -172,8 +172,8 @@ int FType_PastRef(currFrameNum) int currFrameNum; { - int index; - int pastIndex; + int index; + int pastIndex; if (use_cache) { return frameTable[currFrameNum].prev->number; @@ -182,7 +182,7 @@ FType_PastRef(currFrameNum) pastIndex = frameTable[index].prev->number; return currFrameNum - - (((index-pastIndex)+framePatternLen) % framePatternLen); + (((index-pastIndex)+framePatternLen) % framePatternLen); } } @@ -191,9 +191,9 @@ FType_PastRef(currFrameNum) * * SetFramePattern * - * set the IPB pattern; calls ComputeFrameTable to set up table + * set the IPB pattern; calls ComputeFrameTable to set up table * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: framePattern, framePatternLen, frameTable * @@ -264,8 +264,8 @@ ComputeFrameTable(unsigned int const numFramesArg) { 'numFrames' == 0 means number of frames is not known at this time. -----------------------------------------------------------------------------*/ int index; - FrameTable *lastIP, *firstB, *secondIP; - FrameTable *ptr; + FrameTable *lastIP, *firstB, *secondIP; + FrameTable *ptr; char typ; int table_size; @@ -286,14 +286,14 @@ ComputeFrameTable(unsigned int const numFramesArg) { typ = FType_Type(index); frameTable[index].typ = typ; switch( typ ) { - case 'i': + case 'i': ptr = firstB; while ( ptr != NULL ) { ptr->next = &(frameTable[index]); ptr = ptr->nextOutput; } frameTable[index].nextOutput = firstB; - frameTable[index].prev = lastIP; /* for freeing */ + frameTable[index].prev = lastIP; /* for freeing */ if ( lastIP != NULL ) { lastIP->next = &(frameTable[index]); if ( secondIP == NULL ) { @@ -303,7 +303,7 @@ ComputeFrameTable(unsigned int const numFramesArg) { lastIP = &(frameTable[index]); firstB = NULL; break; - case 'p': + case 'p': ptr = firstB; while ( ptr != NULL ) { ptr->next = &(frameTable[index]); @@ -320,7 +320,7 @@ ComputeFrameTable(unsigned int const numFramesArg) { lastIP = &(frameTable[index]); firstB = NULL; break; - case 'b': + case 'b': if ( (index+1 == framePatternLen) || (FType_Type(index+1) != 'b') ) { frameTable[index].nextOutput = NULL; @@ -332,11 +332,11 @@ ComputeFrameTable(unsigned int const numFramesArg) { firstB = &(frameTable[index]); } break; - default: - fprintf(stderr, "Programmer Error in ComputeFrameTable (%d)\n", + default: + fprintf(stderr, "Programmer Error in ComputeFrameTable (%d)\n", framePattern[index]); - exit(1); - break; + exit(1); + break; } } diff --git a/converter/ppm/ppmtompeg/fsize.c b/converter/ppm/ppmtompeg/fsize.c index 3808405c..84772719 100644 --- a/converter/ppm/ppmtompeg/fsize.c +++ b/converter/ppm/ppmtompeg/fsize.c @@ -1,17 +1,17 @@ /*===========================================================================* - * fsize.c * - * * - * procedures to keep track of frame size * - * * - * EXPORTED PROCEDURES: * - * Fsize_Reset * - * Fsize_Note * - * Fsize_Validate * - * * - * EXPORTED VARIABLES: * - * Fsize_x * - * Fsize_y * - * * + * fsize.c * + * * + * procedures to keep track of frame size * + * * + * EXPORTED PROCEDURES: * + * Fsize_Reset * + * Fsize_Note * + * Fsize_Validate * + * * + * EXPORTED VARIABLES: * + * Fsize_x * + * Fsize_y * + * * *===========================================================================*/ /* @@ -60,9 +60,9 @@ int Fsize_y = 0; * * Fsize_Reset * - * reset the frame size to 0 + * reset the frame size to 0 * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: Fsize_x, Fsize_y * @@ -78,9 +78,9 @@ Fsize_Reset(void) { * * Fsize_Validate * - * make sure that the x, y values are 16-pixel aligned + * make sure that the x, y values are 16-pixel aligned * - * RETURNS: modifies the x, y values to 16-pixel alignment + * RETURNS: modifies the x, y values to 16-pixel alignment * * SIDE EFFECTS: none * @@ -98,9 +98,9 @@ Fsize_Validate(int * const xP, * * Fsize_Note * - * note the given frame size and modify the global values as appropriate + * note the given frame size and modify the global values as appropriate * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: Fsize_x, Fsize_y * @@ -122,13 +122,13 @@ Fsize_Note(int const id, #ifdef BLEAH if (Fsize_x == 0) { - Fsize_x = width; - Fsize_y = height; - Fsize_Validate(&Fsize_x, &Fsize_y); + Fsize_x = width; + Fsize_y = height; + Fsize_Validate(&Fsize_x, &Fsize_y); } else if (width < Fsize_x || height < Fsize_y) { - fprintf(stderr, "Frame %d: wrong size: (%d,%d). Should be greater or equal to: (%d,%d)\n", - id, width, height, Fsize_x, Fsize_y); - exit(1); + fprintf(stderr, "Frame %d: wrong size: (%d,%d). Should be greater or equal to: (%d,%d)\n", + id, width, height, Fsize_x, Fsize_y); + exit(1); } #endif } diff --git a/converter/ppm/ppmtompeg/gethostname_win32.c b/converter/ppm/ppmtompeg/gethostname_win32.c index e37fbb37..b831e22d 100644 --- a/converter/ppm/ppmtompeg/gethostname_win32.c +++ b/converter/ppm/ppmtompeg/gethostname_win32.c @@ -90,13 +90,13 @@ get_string_version(push_string_t *str) if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) { osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) + if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) return FALSE; } /* Call GetNativeSystemInfo if available; GetSystemInfo otherwise. */ pGNSI = (PGNSI) - GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), + GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); if (NULL != pGNSI) pGNSI(&si); @@ -254,7 +254,7 @@ get_string_version(push_string_t *str) pushString(str, "Microsoft Windows 2000 "); if (osvi.wProductType == VER_NT_WORKSTATION) pushString(str, "Professional "); - else + else if (osvi.wSuiteMask & VER_SUITE_DATACENTER) pushString(str, "Datacenter Server "); else @@ -288,7 +288,7 @@ get_string_version(push_string_t *str) } } /* Test for specific product on Windows NT 4.0 SP5 and earlier */ - else + else { HKEY hKey; TCHAR szProductType[BUFSIZE]; @@ -321,9 +321,9 @@ get_string_version(push_string_t *str) } /* Display service pack (if any) and build number. */ - if (osvi.dwMajorVersion == 4 && + if (osvi.dwMajorVersion == 4 && lstrcmpi(osvi.szCSDVersion, TEXT("Service Pack 6")) == 0) - { + { HKEY hKey; LONG lRet; @@ -332,7 +332,7 @@ get_string_version(push_string_t *str) TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"), 0, KEY_QUERY_VALUE, &hKey ); if( lRet == ERROR_SUCCESS ) - pushString(str, "Service Pack 6a (Build %d)\n", osvi.dwBuildNumber & 0xFFFF ); + pushString(str, "Service Pack 6a (Build %d)\n", osvi.dwBuildNumber & 0xFFFF ); else /* Windows NT 4.0 prior to SP6a */ pushString(str, "%s (Build %d)\n", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); @@ -358,7 +358,7 @@ get_string_version(push_string_t *str) pushString(str, "Microsoft Windows 98"); if (osvi.szCSDVersion[1]=='A' || osvi.szCSDVersion[1]=='B') pushString(str, " SE"); - } + } else if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) pushString(str, "Microsoft Windows Millennium Edition\n"); @@ -368,7 +368,7 @@ get_string_version(push_string_t *str) pushString(str, "Microsoft Win32s\n"); break; } - return TRUE; + return TRUE; } const char * diff --git a/converter/ppm/ppmtompeg/headers/all.h b/converter/ppm/ppmtompeg/headers/all.h index 8f095d8e..242ffe98 100644 --- a/converter/ppm/ppmtompeg/headers/all.h +++ b/converter/ppm/ppmtompeg/headers/all.h @@ -1,8 +1,8 @@ /*===========================================================================* - * all.h * - * * - * stuff included from ALL source files * - * * + * all.h * + * * + * stuff included from ALL source files * + * * *===========================================================================*/ /* @@ -26,7 +26,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /u/smoot/md/mpeg_encode/headers/RCS/all.h,v 1.9 1995/06/05 21:11:06 smoot Exp $ * $Log: all.h,v $ * Revision 1.9 1995/06/05 21:11:06 smoot diff --git a/converter/ppm/ppmtompeg/headers/bitio.h b/converter/ppm/ppmtompeg/headers/bitio.h index 931bcdd9..c74116f5 100644 --- a/converter/ppm/ppmtompeg/headers/bitio.h +++ b/converter/ppm/ppmtompeg/headers/bitio.h @@ -1,8 +1,8 @@ /*===========================================================================* - * bitio.h * - * * - * bitwise input/output * - * * + * bitio.h * + * * + * bitwise input/output * + * * *===========================================================================*/ /* @@ -26,7 +26,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/charlie-brown/project/mm/mpeg/mpeg_dist/mpeg_encode/headers/RCS/bitio.h,v 1.8 1995/01/19 23:54:37 eyhung Exp $ * $Log: bitio.h,v $ * Revision 1.8 1995/01/19 23:54:37 eyhung @@ -70,9 +70,9 @@ *===========*/ #define WORDS_PER_BUCKET 128 -#define MAXBITS_PER_BUCKET (WORDS_PER_BUCKET * 32) -#define MAX_BUCKETS 128 -#define MAX_BITS MAX_BUCKETS*MAXBITS_PER_BUCKET +#define MAXBITS_PER_BUCKET (WORDS_PER_BUCKET * 32) +#define MAX_BUCKETS 128 +#define MAX_BITS MAX_BUCKETS*MAXBITS_PER_BUCKET /*=======================* @@ -87,8 +87,8 @@ typedef struct bitBucket { typedef struct _BitBucket { int totalbits; - int cumulativeBits; - int bitsWritten; + int cumulativeBits; + int bitsWritten; FILE *filePtr; ActualBucket *firstPtr; ActualBucket *lastPtr; @@ -99,20 +99,20 @@ typedef struct _BitBucket { * MACROS * *========*/ -#define SET_ITH_BIT(bits, i) (bits |= (1 << (i))) -#define GET_ITH_BIT(bits, i) (bits & (1 << (i))) +#define SET_ITH_BIT(bits, i) (bits |= (1 << (i))) +#define GET_ITH_BIT(bits, i) (bits & (1 << (i))) /*===============================* * EXTERNAL PROCEDURE prototypes * *===============================*/ -void +void Bitio_Free(BitBucket * const bbPtr); void -Bitio_Write(BitBucket * const bbPtr, - uint32 const bits, +Bitio_Write(BitBucket * const bbPtr, + uint32 const bits, int const nbits); void @@ -131,7 +131,7 @@ void Bitio_Close(BitBucket * const bbPtr); void -Bitio_WriteToSocket(BitBucket * const bbPtr, +Bitio_WriteToSocket(BitBucket * const bbPtr, int const socket); #endif /* BIT_IO_INCLUDED */ diff --git a/converter/ppm/ppmtompeg/headers/byteorder.h b/converter/ppm/ppmtompeg/headers/byteorder.h index e2d8030c..9376b576 100644 --- a/converter/ppm/ppmtompeg/headers/byteorder.h +++ b/converter/ppm/ppmtompeg/headers/byteorder.h @@ -1,8 +1,8 @@ /*===========================================================================* - * byteorder.h * - * * - * stuff to handle different byte order * - * * + * byteorder.h * + * * + * stuff to handle different byte order * + * * *===========================================================================*/ /* @@ -26,7 +26,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /u/smoot/md/mpeg_encode/headers/RCS/byteorder.h,v 1.3 1995/01/19 23:54:39 eyhung Exp $ * $Log: byteorder.h,v $ * Revision 1.3 1995/01/19 23:54:39 eyhung @@ -60,17 +60,17 @@ * constant; thus, this is not for general use, but works with bitio.c */ #define htonl(x) \ - ((((unsigned char *)(&x))[0] << 24) | \ - (((unsigned char *)(&x))[1] << 16) | \ - (((unsigned char *)(&x))[2] << 8) | \ + ((((unsigned char *)(&x))[0] << 24) | \ + (((unsigned char *)(&x))[1] << 16) | \ + (((unsigned char *)(&x))[2] << 8) | \ (((unsigned char *)(&x))[3])) #define ntohl(x) htonl(x) #define htons(x) \ - ((((unsigned char *)(&x))[0] << 8) | \ + ((((unsigned char *)(&x))[0] << 8) | \ ((unsigned char *)(&x))[1]) #define ntohs(x) htons(x) #else - /* let in.h handle it, if possible */ + /* let in.h handle it, if possible */ #include #if !defined(WIN32) || defined(__CYGWIN__) #include diff --git a/converter/ppm/ppmtompeg/headers/combine.h b/converter/ppm/ppmtompeg/headers/combine.h index e28c6dee..c99d9dbe 100644 --- a/converter/ppm/ppmtompeg/headers/combine.h +++ b/converter/ppm/ppmtompeg/headers/combine.h @@ -2,7 +2,7 @@ struct inputSource; void GOPsToMPEG(struct inputSource * const inputSourceP, - const char * const outputFileName, + const char * const outputFileName, FILE * const outputFilePtr); typedef void (*fileAcquisitionFn)(void * const handle, @@ -14,7 +14,7 @@ typedef void (*fileDispositionFn)(void * const handle, unsigned int const frameNumber); void -FramesToMPEG(FILE * const outputFile, +FramesToMPEG(FILE * const outputFile, void * const inputHandle, fileAcquisitionFn acquireInputFile, fileDispositionFn disposeInputFile); diff --git a/converter/ppm/ppmtompeg/headers/dct.h b/converter/ppm/ppmtompeg/headers/dct.h index 3b824cf0..3c4780cd 100644 --- a/converter/ppm/ppmtompeg/headers/dct.h +++ b/converter/ppm/ppmtompeg/headers/dct.h @@ -1,8 +1,8 @@ /*===========================================================================* - * dct.h * - * * - * DCT procedures * - * * + * dct.h * + * * + * DCT procedures * + * * *===========================================================================*/ /* @@ -43,7 +43,7 @@ typedef DCTELEM DCTBLOCK[DCTSIZE2]; typedef DCTELEM DCTBLOCK_2D[DCTSIZE][DCTSIZE]; -/* +/* * from mfwddct.c: */ void init_fdct (void); diff --git a/converter/ppm/ppmtompeg/headers/frame.h b/converter/ppm/ppmtompeg/headers/frame.h index e1f587a2..993359bc 100644 --- a/converter/ppm/ppmtompeg/headers/frame.h +++ b/converter/ppm/ppmtompeg/headers/frame.h @@ -1,8 +1,8 @@ /*===========================================================================* - * frame.h * - * * - * basic frames procedures * - * * + * frame.h * + * * + * basic frames procedures * + * * *===========================================================================*/ /* @@ -40,9 +40,9 @@ /*===========* * CONSTANTS * *===========*/ -#define TYPE_IFRAME 2 -#define TYPE_PFRAME 3 -#define TYPE_BFRAME 4 +#define TYPE_IFRAME 2 +#define TYPE_PFRAME 3 +#define TYPE_BFRAME 4 /*=======================* @@ -54,11 +54,11 @@ typedef struct mpegFrame { char inputFileName[256]; int id; /* the frame number -- starts at 0 */ bool inUse; - /* this frame is currently being used (if not, any data here can be + /* this frame is currently being used (if not, any data here can be thrashed) */ - /* + /* * now, the YCrCb data. All pixel information is stored in unsigned * 8-bit pieces. We separate y, cr, and cb because cr and cb are * subsampled by a factor of 2. @@ -68,16 +68,16 @@ typedef struct mpegFrame { uint8_t **orig_y, **orig_cr, **orig_cb; /* now, the decoded data -- relevant only if - * referenceFrame == DECODED_FRAME + * referenceFrame == DECODED_FRAME * - * if decoded_y is NULL, then decoded_cr, decoded_cb are undefined + * if decoded_y is NULL, then decoded_cr, decoded_cb are undefined */ uint8_t **decoded_y, **decoded_cr, **decoded_cb; /* reference data */ uint8_t **ref_y, **ref_cr, **ref_cb; - /* + /* * these are the Blocks which will ultimately compose MacroBlocks. * A Block is in a format that mp_fwddct() can crunch. * if y_blocks is NULL, then cr_blocks, cb_blocks are undefined @@ -92,8 +92,8 @@ typedef struct mpegFrame { bool halfComputed; /* TRUE iff half-pixels already computed */ struct mpegFrame *next; /* points to the next B-frame to be encoded, if - * stdin is used as the input. - */ + * stdin is used as the input. + */ } MpegFrame; diff --git a/converter/ppm/ppmtompeg/headers/frames.h b/converter/ppm/ppmtompeg/headers/frames.h index 2ec11d69..9108ac21 100644 --- a/converter/ppm/ppmtompeg/headers/frames.h +++ b/converter/ppm/ppmtompeg/headers/frames.h @@ -1,8 +1,8 @@ /*===========================================================================* - * frames.h - * - * stuff dealing with frames - * + * frames.h + * + * stuff dealing with frames + * *===========================================================================*/ #ifndef FRAMES_INCLUDED @@ -72,7 +72,7 @@ typedef struct FrameTableStruct { int number; int bFrameNumber; /* actual frame number, if a b-frame */ - + } FrameTable; @@ -234,13 +234,13 @@ float BFrameTotalTime(void); void -ShowPFrameSummary(unsigned int const inputFrameBits, - unsigned int const totalBits, +ShowPFrameSummary(unsigned int const inputFrameBits, + unsigned int const totalBits, FILE * const fpointer); void -ShowBFrameSummary(unsigned int const inputFrameBits, - unsigned int const totalBits, +ShowBFrameSummary(unsigned int const inputFrameBits, + unsigned int const totalBits, FILE * const fpointer); /*==================* @@ -291,7 +291,7 @@ extern int TIME_RATE; * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/picasso/project/mpeg/mpeg_dist/mpeg_encode/headers/RCS/frames.h,v 1.13 1995/08/15 23:43:04 smoot Exp $ * $Log: frames.h,v $ * Revision 1.13 1995/08/15 23:43:04 smoot diff --git a/converter/ppm/ppmtompeg/headers/frametype.h b/converter/ppm/ppmtompeg/headers/frametype.h index 33b604e6..3e319c40 100644 --- a/converter/ppm/ppmtompeg/headers/frametype.h +++ b/converter/ppm/ppmtompeg/headers/frametype.h @@ -7,7 +7,7 @@ FType_Type(unsigned int const frameNum); unsigned int FType_FutureRef(unsigned int const currFrameNum); -int FType_PastRef (int currFrameNum); +int FType_PastRef (int currFrameNum); void SetFramePattern(const char * const pattern); diff --git a/converter/ppm/ppmtompeg/headers/fsize.h b/converter/ppm/ppmtompeg/headers/fsize.h index 6a1c910e..5f57e4f2 100644 --- a/converter/ppm/ppmtompeg/headers/fsize.h +++ b/converter/ppm/ppmtompeg/headers/fsize.h @@ -1,8 +1,8 @@ /*===========================================================================* - * fsize.h * - * * - * procedures to deal with frame size * - * * + * fsize.h * + * * + * procedures to deal with frame size * + * * *===========================================================================*/ /* diff --git a/converter/ppm/ppmtompeg/headers/general.h b/converter/ppm/ppmtompeg/headers/general.h index 59c33c73..45d3db17 100644 --- a/converter/ppm/ppmtompeg/headers/general.h +++ b/converter/ppm/ppmtompeg/headers/general.h @@ -1,8 +1,8 @@ /*===========================================================================* - * general.h * - * * - * very general stuff * - * * + * general.h * + * * + * very general stuff * + * * *===========================================================================*/ /* @@ -26,7 +26,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/picasso/project/mpeg/mpeg_dist/mpeg_encode/headers/RCS/general.h,v 1.7 1995/08/04 23:34:13 smoot Exp $ * $Log: general.h,v $ * Revision 1.7 1995/08/04 23:34:13 smoot @@ -62,7 +62,7 @@ * if your /usr/include headers do not have these, then pass -DMISSING_PROTOS * to your compiler * - */ + */ #ifdef MISSING_PROTOS int fprintf(); int fwrite(); @@ -114,7 +114,7 @@ int pclose(); typedef int boolean; /* In the following, we need the "signed" in order to make these typedefs - match those in AIX system header files. Otherwise, compile fails on + match those in AIX system header files. Otherwise, compile fails on AIX. 2000.09.11. */ typedef unsigned char uint8; @@ -139,10 +139,10 @@ typedef signed short int16; */ /* LONG_32 should only be defined iff - * 1) long's are 32 bits and - * 2) int's are not + * 1) long's are 32 bits and + * 2) int's are not */ -#ifdef LONG_32 +#ifdef LONG_32 typedef unsigned long uint32; typedef long int32; #else diff --git a/converter/ppm/ppmtompeg/headers/huff.h b/converter/ppm/ppmtompeg/headers/huff.h index a6379248..8b46a8b8 100644 --- a/converter/ppm/ppmtompeg/headers/huff.h +++ b/converter/ppm/ppmtompeg/headers/huff.h @@ -19,18 +19,18 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/charlie-brown/project/mm/mpeg/mpeg_dist/mpeg_encode/headers/RCS/huff.h,v 1.3 1995/01/19 23:54:51 eyhung Exp $ */ -/* +/* * THIS FILE WAS ORIGINALLY MACHINE GENERATED */ #include "general.h" -#define HUFF_MAXRUN 32 -#define HUFF_MAXLEVEL 41 +#define HUFF_MAXRUN 32 +#define HUFF_MAXLEVEL 41 extern int huff_maxlevel[]; extern uint32 *huff_table[]; diff --git a/converter/ppm/ppmtompeg/headers/iframe.h b/converter/ppm/ppmtompeg/headers/iframe.h index c4f77c74..fb8d508c 100644 --- a/converter/ppm/ppmtompeg/headers/iframe.h +++ b/converter/ppm/ppmtompeg/headers/iframe.h @@ -19,7 +19,7 @@ int GetIQScale(void); void -GenIFrame(BitBucket * const bb, +GenIFrame(BitBucket * const bb, MpegFrame * const current); void @@ -30,8 +30,8 @@ IFrameTotalTime(void); void -ShowIFrameSummary(unsigned int const inputFrameBits, - unsigned int const totalBits, +ShowIFrameSummary(unsigned int const inputFrameBits, + unsigned int const totalBits, FILE * const fpointer); void diff --git a/converter/ppm/ppmtompeg/headers/mheaders.h b/converter/ppm/ppmtompeg/headers/mheaders.h index edd9552d..43df26a5 100644 --- a/converter/ppm/ppmtompeg/headers/mheaders.h +++ b/converter/ppm/ppmtompeg/headers/mheaders.h @@ -1,8 +1,8 @@ /*===========================================================================* - * mheaders.h * - * * - * MPEG headers * - * * + * mheaders.h * + * * + * MPEG headers * + * * *===========================================================================*/ /* @@ -26,7 +26,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/picasso/project/mm/mpeg/mpeg_dist/mpeg_encode/headers/RCS/mheaders.h,v 1.4 1995/03/27 19:29:24 smoot Exp $ * $Log: mheaders.h,v $ * Revision 1.4 1995/03/27 19:29:24 smoot @@ -61,40 +61,40 @@ * EXTERNAL PROCEDURE prototypes * *===============================*/ -void SetGOPStartTime (int index); +void SetGOPStartTime (int index); void -Mhead_GenSequenceHeader(BitBucket * const bbPtr, - uint32 const hsize, +Mhead_GenSequenceHeader(BitBucket * const bbPtr, + uint32 const hsize, uint32 const vsize, - int32 const pratio, - int32 const pict_rate, + int32 const pratio, + int32 const pict_rate, int32 const bit_rate_arg, - int32 const buf_size_arg, - int32 const c_param_flag_arg, - const int32 * const iq_matrix, + int32 const buf_size_arg, + int32 const c_param_flag_arg, + const int32 * const iq_matrix, const int32 * const niq_matrix, - uint8 * const ext_data, - int32 const ext_data_size, + uint8 * const ext_data, + int32 const ext_data_size, uint8 * const user_data, int32 const user_data_size); -void Mhead_GenSequenceEnder (BitBucket *bbPtr); -void Mhead_GenGOPHeader (BitBucket *bbPtr, - int32 drop_frame_flag, +void Mhead_GenSequenceEnder (BitBucket *bbPtr); +void Mhead_GenGOPHeader (BitBucket *bbPtr, + int32 drop_frame_flag, int32 tc_hrs, int32 tc_min, int32 tc_sec, int32 tc_pict, int32 closed_gop, int32 broken_link, uint8 *ext_data, int32 ext_data_size, uint8 *user_data, int32 user_data_size); -void Mhead_GenPictureHeader (BitBucket *bbPtr, int frameType, - int pictCount, int f_code); -void Mhead_GenSliceHeader (BitBucket *bbPtr, uint32 slicenum, - uint32 qscale, uint8 *extra_info, - uint32 extra_info_size); -void Mhead_GenSliceEnder (BitBucket *bbPtr); -void Mhead_GenMBHeader (BitBucket *bbPtr, - uint32 pict_code_type, uint32 addr_incr, +void Mhead_GenPictureHeader (BitBucket *bbPtr, int frameType, + int pictCount, int f_code); +void Mhead_GenSliceHeader (BitBucket *bbPtr, uint32 slicenum, + uint32 qscale, uint8 *extra_info, + uint32 extra_info_size); +void Mhead_GenSliceEnder (BitBucket *bbPtr); +void Mhead_GenMBHeader (BitBucket *bbPtr, + uint32 pict_code_type, uint32 addr_incr, uint32 q_scale, uint32 forw_f_code, uint32 back_f_code, uint32 horiz_forw_r, uint32 vert_forw_r, diff --git a/converter/ppm/ppmtompeg/headers/motion_search.h b/converter/ppm/ppmtompeg/headers/motion_search.h index d00509c4..0cb5370b 100644 --- a/converter/ppm/ppmtompeg/headers/motion_search.h +++ b/converter/ppm/ppmtompeg/headers/motion_search.h @@ -40,7 +40,7 @@ if ( stepSize == 2 ) { \ rightMY++; \ rightMX++; \ } - + #define VALID_MOTION(m) \ (((m).y >= leftMY) && ((m).y < rightMY) && \ ((m).x >= leftMX) && ((m).x < rightMX) ) @@ -50,9 +50,9 @@ if ( stepSize == 2 ) { \ * EXTERNAL PROCEDURE prototypes * *===============================*/ -void +void SetPSearchAlg(const char * const alg); -void +void SetBSearchAlg(const char * const alg); const char * BSearchName(void); @@ -94,9 +94,9 @@ PTwoLevelSearch(const LumBlock * const currentBlockP, int const searchRange); void PMotionSearch(const LumBlock * const currentBlockP, - MpegFrame * const prev, + MpegFrame * const prev, int const by, - int const bx, + int const bx, vector * const motionP); void @@ -129,7 +129,7 @@ extern int psearchAlg; * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/picasso/project/mpeg/mpeg_dist/mpeg_encode/headers/RCS/search.h,v 1.6 1995/08/15 23:43:36 smoot Exp $ * $Log: search.h,v $ * Revision 1.6 1995/08/15 23:43:36 smoot diff --git a/converter/ppm/ppmtompeg/headers/mpeg.h b/converter/ppm/ppmtompeg/headers/mpeg.h index fbfaaf2c..d258cde4 100644 --- a/converter/ppm/ppmtompeg/headers/mpeg.h +++ b/converter/ppm/ppmtompeg/headers/mpeg.h @@ -1,8 +1,8 @@ /*===========================================================================* - * mpeg.h * - * * - * no comment * - * * + * mpeg.h * + * * + * no comment * + * * *===========================================================================*/ /* @@ -47,13 +47,13 @@ enum frameContext {CONTEXT_WHOLESTREAM, CONTEXT_GOP, CONTEXT_JUSTFRAMES}; void GenMPEGStream(struct inputSource * const inputSourceP, - enum frameContext const context, - unsigned int const frameStart, - unsigned int const frameEnd, - int32 const qtable[], - int32 const niqtable[], + enum frameContext const context, + unsigned int const frameStart, + unsigned int const frameEnd, + int32 const qtable[], + int32 const niqtable[], bool const childProcess, - FILE * const ofp, + FILE * const ofp, const char * const outputFileName, bool const wantVbvUnderflowWarning, bool const wantVbvOverflowWarning, @@ -61,38 +61,38 @@ GenMPEGStream(struct inputSource * const inputSourceP, unsigned int * const totalBitsP); void -PrintStartStats(time_t const startTime, +PrintStartStats(time_t const startTime, bool const specificFrames, - unsigned int const firstFrame, + unsigned int const firstFrame, unsigned int const lastFrame, struct inputSource * const inputSourceP); void PrintEndStats(time_t const startTime, time_t const endTime, - unsigned int const inputFrameBits, + unsigned int const inputFrameBits, unsigned int const totalBits); void -ComputeGOPFrames(int const whichGOP, - unsigned int * const firstFrameP, - unsigned int * const lastFrameP, +ComputeGOPFrames(int const whichGOP, + unsigned int * const firstFrameP, + unsigned int * const lastFrameP, unsigned int const numFrames); -extern void IncrementTCTime (void); +extern void IncrementTCTime (void); void SetReferenceFrameType(const char * const type); boolean NonLocalRefFrame(int const id); void -ReadDecodedRefFrame(MpegFrame * const frameP, +ReadDecodedRefFrame(MpegFrame * const frameP, unsigned int const frameNumber); void SetBitRateFileName(const char * const fileName); -extern void SetFrameRate (void); +extern void SetFrameRate (void); /*==================* @@ -100,11 +100,11 @@ extern void SetFrameRate (void); *==================*/ extern MpegFrame *frameMemory[3]; -extern int32 tc_hrs, tc_min, tc_sec, tc_pict, tc_extra; -extern int totalFramesSent; -extern int gopSize; -extern char *framePattern; -extern int framePatternLen; +extern int32 tc_hrs, tc_min, tc_sec, tc_pict, tc_extra; +extern int totalFramesSent; +extern int gopSize; +extern char *framePattern; +extern int framePatternLen; extern int32 qtable[]; extern int32 niqtable[]; extern int32 *customQtable; diff --git a/converter/ppm/ppmtompeg/headers/mproto.h b/converter/ppm/ppmtompeg/headers/mproto.h index 5b003b2e..22b3ba2b 100644 --- a/converter/ppm/ppmtompeg/headers/mproto.h +++ b/converter/ppm/ppmtompeg/headers/mproto.h @@ -1,8 +1,8 @@ /*===========================================================================* - * mproto.h * - * * - * basically a lot of miscellaneous prototypes * - * * + * mproto.h * + * * + * basically a lot of miscellaneous prototypes * + * * *===========================================================================*/ /* @@ -26,7 +26,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/picasso/project/mm/mpeg/mpeg_dist/mpeg_encode/headers/RCS/mproto.h,v 1.12 1995/03/29 20:14:29 smoot Exp $ * $Log: mproto.h,v $ * Revision 1.12 1995/03/29 20:14:29 smoot @@ -82,7 +82,7 @@ typedef DCTELEM DCTBLOCK[DCTSIZE2]; * EXTERNAL PROCEDURE prototypes * *===============================*/ -/* +/* * from mbasic.c: */ void mp_reset (void); @@ -90,13 +90,13 @@ void mp_free (MpegFrame *mf); MpegFrame *mp_new (int fnumber, char type, MpegFrame *oldFrame); void mp_ycc_calc (MpegFrame *mf); void mp_dct_blocks (MpegFrame *mf); -void AllocDecoded (MpegFrame *frame); +void AllocDecoded (MpegFrame *frame); -/* +/* * from moutput.c: */ boolean mp_quant_zig_block (Block in, FlatBlock out, int qscale, int iblock); -void UnQuantZig (FlatBlock in, Block out, int qscale, boolean iblock); +void UnQuantZig (FlatBlock in, Block out, int qscale, boolean iblock); void mp_rle_huff_block (FlatBlock in, BitBucket *out); void mp_rle_huff_pblock (FlatBlock in, BitBucket *out); void mp_create_blocks (MpegFrame *mf); @@ -104,12 +104,12 @@ void mp_create_blocks (MpegFrame *mf); -void ReadEYUV (MpegFrame * mf, FILE *fpointer, int width, - int height); -boolean ReadPPM (MpegFrame *mf, FILE *fpointer); +void ReadEYUV (MpegFrame * mf, FILE *fpointer, int width, + int height); +boolean ReadPPM (MpegFrame *mf, FILE *fpointer); void PPMtoYCC (MpegFrame * mf); -void ComputeHalfPixelData (MpegFrame *frame); +void ComputeHalfPixelData (MpegFrame *frame); void mp_validate_size (int *x, int *y); void AllocYCC (MpegFrame * mf); diff --git a/converter/ppm/ppmtompeg/headers/mtypes.h b/converter/ppm/ppmtompeg/headers/mtypes.h index a44ce680..bf56a110 100644 --- a/converter/ppm/ppmtompeg/headers/mtypes.h +++ b/converter/ppm/ppmtompeg/headers/mtypes.h @@ -1,7 +1,7 @@ /*===========================================================================* * mtypes.h * - * MPEG data types + * MPEG data types * *===========================================================================*/ @@ -18,12 +18,12 @@ * CONSTANTS * *===========*/ -#define TYPE_BOGUS 0 /* for the header of the circular list */ -#define TYPE_VIRGIN 1 +#define TYPE_BOGUS 0 /* for the header of the circular list */ +#define TYPE_VIRGIN 1 -#define STATUS_EMPTY 0 -#define STATUS_LOADED 1 -#define STATUS_WRITTEN 2 +#define STATUS_EMPTY 0 +#define STATUS_LOADED 1 +#define STATUS_WRITTEN 2 typedef struct vector { @@ -40,15 +40,15 @@ typedef struct motion { * TYPE DEFINITIONS * *==================*/ -/* +/* * your basic Block type */ typedef int16_t Block[DCTSIZE][DCTSIZE]; typedef int16_t FlatBlock[DCTSIZE_SQ]; -typedef struct { +typedef struct { int32_t l[2*DCTSIZE][2*DCTSIZE]; } LumBlock; -typedef int32_t ChromBlock[DCTSIZE][DCTSIZE]; +typedef int32_t ChromBlock[DCTSIZE][DCTSIZE]; /*========* * MACROS * diff --git a/converter/ppm/ppmtompeg/headers/opts.h b/converter/ppm/ppmtompeg/headers/opts.h index 1756334e..887c9723 100644 --- a/converter/ppm/ppmtompeg/headers/opts.h +++ b/converter/ppm/ppmtompeg/headers/opts.h @@ -23,7 +23,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/picasso/project/mpeg/mpeg_dist/mpeg_encode/headers/RCS/opts.h,v 1.3 1995/08/15 23:43:43 smoot Exp $ * $Log: opts.h,v $ * Revision 1.3 1995/08/15 23:43:43 smoot @@ -109,10 +109,10 @@ extern int LaplaceNum, LaplaceCnum; extern boolean BSkipBlocks; /* Procedures Prototypes */ -int GetIQScale (void); -int GetPQScale (void); -int GetBQScale (void); -void Tune_Init (void); +int GetIQScale (void); +int GetPQScale (void); +int GetBQScale (void); +void Tune_Init (void); int CalcRLEHuffLength (FlatBlock in); void ParseTuneParam(const char * const charPtr); int mse (Block blk1, Block blk2); diff --git a/converter/ppm/ppmtompeg/headers/parallel.h b/converter/ppm/ppmtompeg/headers/parallel.h index 0a31fac2..b5407cea 100644 --- a/converter/ppm/ppmtompeg/headers/parallel.h +++ b/converter/ppm/ppmtompeg/headers/parallel.h @@ -1,8 +1,8 @@ /*===========================================================================* - * parallel.h - * - * parallel encoding - * + * parallel.h + * + * parallel encoding + * *===========================================================================*/ /* @@ -42,33 +42,33 @@ struct inputSource; void MasterServer(struct inputSource * const inputSourceP, - const char * const paramFileName, + const char * const paramFileName, const char * const outputFileName); void -NotifyMasterDone(const char * const hostName, - int const portNum, - int const machineNumber, - unsigned int const seconds, +NotifyMasterDone(const char * const hostName, + int const portNum, + int const machineNumber, + unsigned int const seconds, boolean * const moreWorkToDoP, int * const frameStartP, int * const frameEndP); void IoServer(struct inputSource * const inputSourceP, - const char * const parallelHostName, + const char * const parallelHostName, int const portNum); void -CombineServer(int const numInputFiles, - const char * const masterHostName, +CombineServer(int const numInputFiles, + const char * const masterHostName, int const masterPortNum, const char* const outputFileName); void -DecodeServer(int const numInputFiles, - const char * const decodeFileName, - const char * const parallelHostName, +DecodeServer(int const numInputFiles, + const char * const decodeFileName, + const char * const parallelHostName, int const portNum); void @@ -91,20 +91,20 @@ SetIOConvert(boolean const separate); void SetRemoteShell(const char * const shell); -void +void NotifyDecodeServerReady(int const id); -void +void WaitForDecodedFrame(int id); -void +void SendDecodedFrame(MpegFrame * const frameP); -void +void GetRemoteDecodedRefFrame(MpegFrame * const frameP, int const frameNumber); -void +void SetParallelPerfect(boolean val); diff --git a/converter/ppm/ppmtompeg/headers/param.h b/converter/ppm/ppmtompeg/headers/param.h index 46a544b3..103f03b5 100644 --- a/converter/ppm/ppmtompeg/headers/param.h +++ b/converter/ppm/ppmtompeg/headers/param.h @@ -33,7 +33,7 @@ struct params { void -ReadParamFile(const char * const fileName, +ReadParamFile(const char * const fileName, majorProgramFunction const function, struct params * const paramP); diff --git a/converter/ppm/ppmtompeg/headers/postdct.h b/converter/ppm/ppmtompeg/headers/postdct.h index 3f3b51fe..e426f05a 100644 --- a/converter/ppm/ppmtompeg/headers/postdct.h +++ b/converter/ppm/ppmtompeg/headers/postdct.h @@ -1,8 +1,8 @@ /*===========================================================================* - * postdct.h * - * * - * MPEG post-DCT processing * - * * + * postdct.h * + * * + * MPEG post-DCT processing * + * * *===========================================================================*/ /* @@ -30,10 +30,10 @@ int Mpost_QuantZigBlock (Block in, FlatBlock out, int qscale, int iblock); -void Mpost_UnQuantZigBlock (FlatBlock in, Block out, +void Mpost_UnQuantZigBlock (FlatBlock in, Block out, int qscale, boolean iblock); -void Mpost_RLEHuffIBlock (FlatBlock in, BitBucket *out); -void Mpost_RLEHuffPBlock (FlatBlock in, BitBucket *out); +void Mpost_RLEHuffIBlock (FlatBlock in, BitBucket *out); +void Mpost_RLEHuffPBlock (FlatBlock in, BitBucket *out); #define MPOST_ZERO 0 #define MPOST_NON_ZERO 1 diff --git a/converter/ppm/ppmtompeg/headers/psocket.h b/converter/ppm/ppmtompeg/headers/psocket.h index 214f5dce..26e11db2 100644 --- a/converter/ppm/ppmtompeg/headers/psocket.h +++ b/converter/ppm/ppmtompeg/headers/psocket.h @@ -22,8 +22,8 @@ WriteBytes(int const fd, unsigned int const nbyte); void -ConnectToSocket(const char * const machineName, - int const portNum, +ConnectToSocket(const char * const machineName, + int const portNum, struct hostent ** const hostEnt, int * const socketFdP, const char ** const errorP); diff --git a/converter/ppm/ppmtompeg/headers/rate.h b/converter/ppm/ppmtompeg/headers/rate.h index a5f5076f..d11a4b77 100644 --- a/converter/ppm/ppmtompeg/headers/rate.h +++ b/converter/ppm/ppmtompeg/headers/rate.h @@ -1,22 +1,22 @@ /*===========================================================================* - * rate.h * - * * - * Procedures concerned with rate control - * * - * EXPORTED PROCEDURES: * + * rate.h * + * * + * Procedures concerned with rate control + * * + * EXPORTED PROCEDURES: * * getRateMode() * setBitRate() * getBitRate() * setBufferSize() * getBufferSize() - * initRateControl() - * targetRateControl() - * updateRateControl() - * MB_RateOut() - * * + * initRateControl() + * targetRateControl() + * updateRateControl() + * MB_RateOut() + * * *===========================================================================*/ -/* COPYRIGHT INFO HERE */ +/* COPYRIGHT INFO HERE */ #define VARIABLE_RATE 0 #define FIXED_RATE 1 @@ -41,7 +41,7 @@ extern int rc_quantOverride; * * initRateControl * - * initialize the allocation parameters. + * initialize the allocation parameters. *===========================================================================*/ int initRateControl(bool const wantUnderflowWarning, @@ -64,7 +64,7 @@ targetRateControl(MpegFrame * const frameP); * MB_RateOut * * Prints out sampling of MB rate control data. Every "nth" block - * stats are printed, with "n" controlled by global RC_MB_SAMPLE_RATE + * stats are printed, with "n" controlled by global RC_MB_SAMPLE_RATE * * RETURNS: nothing *===========================================================================*/ @@ -137,7 +137,7 @@ extern void SetRateControl (char *charPtr); * * RETURNS: nothing *===========================================================================*/ -extern void +extern void setBufferSize(const char * const charPtr); @@ -164,7 +164,7 @@ extern int getBufferSize (void); * * SIDE EFFECTS: global variables *===========================================================================*/ -extern void +extern void setBitRate(const char * const charPtr); diff --git a/converter/ppm/ppmtompeg/headers/readframe.h b/converter/ppm/ppmtompeg/headers/readframe.h index 3a6876b1..3c203e8a 100644 --- a/converter/ppm/ppmtompeg/headers/readframe.h +++ b/converter/ppm/ppmtompeg/headers/readframe.h @@ -1,8 +1,8 @@ /*===========================================================================* - * readframe.h * - * * - * stuff dealing with reading frames * - * * + * readframe.h * + * * + * stuff dealing with reading frames * + * * *===========================================================================*/ /* @@ -32,15 +32,15 @@ * CONSTANTS * *===========*/ -#define PPM_FILE_TYPE 0 -#define YUV_FILE_TYPE 2 -#define ANY_FILE_TYPE 3 -#define BASE_FILE_TYPE 4 -#define PNM_FILE_TYPE 5 -#define SUB4_FILE_TYPE 6 -#define JPEG_FILE_TYPE 7 +#define PPM_FILE_TYPE 0 +#define YUV_FILE_TYPE 2 +#define ANY_FILE_TYPE 3 +#define BASE_FILE_TYPE 4 +#define PNM_FILE_TYPE 5 +#define SUB4_FILE_TYPE 6 +#define JPEG_FILE_TYPE 7 #define JMOVIE_FILE_TYPE 8 -#define Y_FILE_TYPE 9 +#define Y_FILE_TYPE 9 struct inputSource; @@ -52,7 +52,7 @@ ReadFrameFile(MpegFrame * const frameP, bool * const eofP); void -ReadFrame(MpegFrame * const frameP, +ReadFrame(MpegFrame * const frameP, struct inputSource * const inputSourceP, unsigned int const frameNumber, const char * const conversion, @@ -62,8 +62,8 @@ FILE * ReadIOConvert(struct inputSource * const inputSourceP, unsigned int const frameNumber); -extern void SetFileType(const char * const conversion); -extern void SetFileFormat(const char * const format); -extern void SetResize(bool const set); +extern void SetFileType(const char * const conversion); +extern void SetFileFormat(const char * const format); +extern void SetResize(bool const set); -extern int baseFormat; +extern int baseFormat; diff --git a/converter/ppm/ppmtompeg/headers/rgbtoycc.h b/converter/ppm/ppmtompeg/headers/rgbtoycc.h index 52159963..d7aa017c 100644 --- a/converter/ppm/ppmtompeg/headers/rgbtoycc.h +++ b/converter/ppm/ppmtompeg/headers/rgbtoycc.h @@ -1,8 +1,8 @@ /*===========================================================================* - * rgbtoycc.h * - * * - * Procedures to convert from RGB space to YUV space * - * * + * rgbtoycc.h * + * * + * Procedures to convert from RGB space to YUV space * + * * *===========================================================================*/ /* diff --git a/converter/ppm/ppmtompeg/headers/specifics.h b/converter/ppm/ppmtompeg/headers/specifics.h index 4f5c7074..552193d8 100644 --- a/converter/ppm/ppmtompeg/headers/specifics.h +++ b/converter/ppm/ppmtompeg/headers/specifics.h @@ -1,5 +1,3 @@ - - /*===========* * TYPES * *===========*/ @@ -19,7 +17,7 @@ typedef struct detail_def { } Slice_Specifics; typedef struct fsl_def { - int framenum; + int framenum; int frametype; char qscale; Slice_Specifics *slc; @@ -28,8 +26,8 @@ typedef struct fsl_def { } FrameSpecList; -void Specifics_Init (void); +void Specifics_Init (void); int SpecLookup (int fn, int typ, int num, - BlockMV **info, int start_qs); + BlockMV **info, int start_qs); int SpecTypeLookup (int fn); diff --git a/converter/ppm/ppmtompeg/iframe.c b/converter/ppm/ppmtompeg/iframe.c index 66f5ea3b..81ff0ec0 100644 --- a/converter/ppm/ppmtompeg/iframe.c +++ b/converter/ppm/ppmtompeg/iframe.c @@ -239,7 +239,7 @@ void SetBlocksPerSlice(void) { int totalBlocks; - + totalBlocks = (Fsize_y>>4)*(Fsize_x>>4); if ( slicesPerFrame > totalBlocks ) { @@ -296,7 +296,7 @@ CalcDistortion(MpegFrame * const current, Block decblk; FlatBlock fblk; int datarate = 0; - + for (qscale = 1; qscale < 32; qscale ++) { distort = 0; datarate = 0; @@ -361,7 +361,7 @@ CalcDistortion(MpegFrame * const current, * *===========================================================================*/ void -GenIFrame(BitBucket * const bb, +GenIFrame(BitBucket * const bb, MpegFrame * const current) { int x, y; @@ -391,25 +391,25 @@ GenIFrame(BitBucket * const bb, lastIFrame = current->id; } else { /* ASSUMES 30 FRAMES PER SECOND */ - + if (! realQuiet) { fprintf(stdout, "I-to-I (frames %5d to %5d) bitrate: %8d\n", lastIFrame, current->id-1, ((bb->cumulativeBits-lastNumBits)*30)/ (current->id-lastIFrame)); } - + fprintf(bitRateFile, "I-to-I (frames %5d to %5d) bitrate: %8d\n", lastIFrame, current->id-1, ((bb->cumulativeBits-lastNumBits)*30)/ (current->id-lastIFrame)); - lastNumBits = bb->cumulativeBits; + lastNumBits = bb->cumulativeBits; lastIFrame = current->id; } } - + startTime = time_elapsed(); - + Frame_AllocBlocks(current); BlockifyFrame(current); @@ -435,13 +435,13 @@ GenIFrame(BitBucket * const bb, } } Mhead_GenSliceHeader(bb, 1, QScale, NULL, 0); - + if ( referenceFrame == DECODED_FRAME ) { Frame_AllocDecoded(current, TRUE); } else if ( printSNR ) { Frame_AllocDecoded(current, FALSE); } - + y_dc_pred = cr_dc_pred = cb_dc_pred = 128; totalBits = bb->cumulativeBits; mbAddress = 0; @@ -449,24 +449,24 @@ GenIFrame(BitBucket * const bb, /* DCT the macroblocks */ for (y = 0; y < (Fsize_y >> 3); y += 2) { for (x = 0; x < (Fsize_x >> 3); x += 2) { - if (collect_quant && (collect_quant_detailed & 1)) + if (collect_quant && (collect_quant_detailed & 1)) fprintf(collect_quant_fp, "l\n"); if (DoLaplace) {LaplaceCnum = 0;} mp_fwd_dct_block2(current->y_blocks[y][x], dct[y][x]); mp_fwd_dct_block2(current->y_blocks[y][x+1], dct[y][x+1]); mp_fwd_dct_block2(current->y_blocks[y+1][x], dct[y+1][x]); mp_fwd_dct_block2(current->y_blocks[y+1][x+1], dct[y+1][x+1]); - if (collect_quant && (collect_quant_detailed & 1)) + if (collect_quant && (collect_quant_detailed & 1)) fprintf(collect_quant_fp, "c\n"); if (DoLaplace) {LaplaceCnum = 1;} - mp_fwd_dct_block2(current->cb_blocks[y>>1][x>>1], + mp_fwd_dct_block2(current->cb_blocks[y>>1][x>>1], dctb[y>>1][x>>1]); if (DoLaplace) {LaplaceCnum = 2;} - mp_fwd_dct_block2(current->cr_blocks[y>>1][x>>1], + mp_fwd_dct_block2(current->cr_blocks[y>>1][x>>1], dctr[y>>1][x>>1]); } } - + if (DoLaplace) CalcLambdas(); @@ -474,13 +474,13 @@ GenIFrame(BitBucket * const bb, for (x = 0; x < (Fsize_x >> 3); x += 2) { /* Check for Qscale change */ if (specificsOn) { - newQScale = + newQScale = SpecLookup(current->id, 2, mbAddress, &info, QScale); if (newQScale != -1) { QScale = newQScale; } } - + /* Determine if new Qscale needed for Rate Control purposes */ if (bitstreamMode == FIXED_RATE) { rc_blockStart = bb->cumulativeBits; @@ -493,20 +493,20 @@ GenIFrame(BitBucket * const bb, QScale = newQScale; } } - + if ( (mbAddress % blocksPerSlice == 0) && (mbAddress != 0) ) { /* create a new slice */ if (specificsOn) { /* Make sure no slice Qscale change */ newQScale = SpecLookup(current->id, 1, - mbAddress/blocksPerSlice, &info, + mbAddress/blocksPerSlice, &info, QScale); if (newQScale != -1) QScale = newQScale; } Mhead_GenSliceEnder(bb); Mhead_GenSliceHeader(bb, 1+(y>>1), QScale, NULL, 0); y_dc_pred = cr_dc_pred = cb_dc_pred = 128; - + GEN_I_BLOCK(I_FRAME, current, bb, 1+(x>>1), QScale); } else { GEN_I_BLOCK(I_FRAME, current, bb, 1, QScale); @@ -515,23 +515,23 @@ GenIFrame(BitBucket * const bb, if (WriteDistortionNumbers) { CalcDistortion(current, y, x); } - + if ( decodeRefFrames ) { /* now, reverse the DCT transform */ LaplaceCnum = 0; for ( index = 0; index < 6; index++ ) { if (!DoLaplace) { - Mpost_UnQuantZigBlock(fb[index], dec[index], QScale, + Mpost_UnQuantZigBlock(fb[index], dec[index], QScale, TRUE); } else { if (index == 4) {LaplaceCnum = 1;} if (index == 5) {LaplaceCnum = 2;} - Mpost_UnQuantZigBlockLaplace(fb[index], dec[index], + Mpost_UnQuantZigBlockLaplace(fb[index], dec[index], QScale, TRUE); } - mpeg_jrevdct((int16 *)dec[index]); + mpeg_jrevdct((int16 *)dec[index]); } - + /* now, unblockify */ BlockToData(current->decoded_y, dec[0], y, x); BlockToData(current->decoded_y, dec[1], y, x+1); @@ -540,7 +540,7 @@ GenIFrame(BitBucket * const bb, BlockToData(current->decoded_cb, dec[4], y>>1, x>>1); BlockToData(current->decoded_cr, dec[5], y>>1, x>>1); } - + numBlocks++; mbAddress++; /* Rate Control */ @@ -551,43 +551,43 @@ GenIFrame(BitBucket * const bb, } } } - + if ( printSNR ) { BlockComputeSNR(current,snr,psnr); totalSNR += snr[0]; totalPSNR += psnr[0]; } - + numBits += (bb->cumulativeBits-totalBits); - + DBG_PRINT(("End of frame\n")); - + Mhead_GenSliceEnder(bb); /* Rate Control */ if (bitstreamMode == FIXED_RATE) { updateRateControl(TYPE_IFRAME); } - + endTime = time_elapsed(); totalTime += (endTime-startTime); - + numFrameBits += (bb->cumulativeBits-totalFrameBits); - + if ( showBitRatePerFrame ) { /* ASSUMES 30 FRAMES PER SECOND */ fprintf(bitRateFile, "%5d\t%8d\n", current->id, 30*(bb->cumulativeBits-totalFrameBits)); } - + if ( frameSummary && !realQuiet ) { - + /* ASSUMES 30 FRAMES PER SECOND */ - fprintf(stdout, - "FRAME %d (I): %ld seconds (%d bits/s output)\n", + fprintf(stdout, + "FRAME %d (I): %ld seconds (%d bits/s output)\n", current->id, (long)((endTime-startTime)/TIME_RATE), 30*(bb->cumulativeBits-totalFrameBits)); if ( printSNR ) { - fprintf(stdout, + fprintf(stdout, "FRAME %d: SNR: %.1f\t%.1f\t%.1f\t" "PSNR: %.1f\t%.1f\t%.1f\n", current->id, snr[0], snr[1], snr[2], @@ -628,8 +628,8 @@ IFrameTotalTime(void) { void -ShowIFrameSummary(unsigned int const inputFrameBits, - unsigned int const totalBits, +ShowIFrameSummary(unsigned int const inputFrameBits, + unsigned int const totalBits, FILE * const fpointer) { /*---------------------------------------------------------------------------- Print out statistics on all I frames. @@ -697,12 +697,12 @@ EncodeYDC(int32 const dc_term, ydiff = (dc_term - (*pred_term)); if (ydiff > 255) { -#ifdef BLEAH +#ifdef BLEAH fprintf(stdout, "TRUNCATED\n"); #endif ydiff = 255; } else if (ydiff < -255) { -#ifdef BLEAH +#ifdef BLEAH fprintf(stdout, "TRUNCATED\n"); #endif ydiff = -255; @@ -753,12 +753,12 @@ EncodeCDC(int32 const dc_term, cdiff = (dc_term - (*pred_term)); if (cdiff > 255) { #ifdef BLEAH - fprintf(stdout, "TRUNCATED\n"); + fprintf(stdout, "TRUNCATED\n"); #endif cdiff = 255; } else if (cdiff < -255) { #ifdef BLEAH - fprintf(stdout, "TRUNCATED\n"); + fprintf(stdout, "TRUNCATED\n"); #endif cdiff = -255; } @@ -789,21 +789,21 @@ BlockComputeSNR(MpegFrame * const current, int32 varDiff[3]; double ratio[3]; double total[3]; - uint8 **origY=current->orig_y, **origCr=current->orig_cr, + uint8 **origY=current->orig_y, **origCr=current->orig_cr, **origCb=current->orig_cb; - uint8 **newY=current->decoded_y, **newCr=current->decoded_cr, + uint8 **newY=current->decoded_y, **newCr=current->decoded_cr, **newCb=current->decoded_cb; static int32 **SignalY, **NoiseY; static int32 **SignalCb, **NoiseCb; static int32 **SignalCr, **NoiseCr; static short ySize[3], xSize[3]; static boolean needs_init=TRUE; - + /* Init */ if (needs_init) { int ysz = (Fsize_y>>3) * sizeof(int32 *); int xsz = (Fsize_x>>3); - + needs_init = FALSE; for (y=0; y<3; y++) { varDiff[y] = ratio[y] = total[y] = 0.0; @@ -817,7 +817,7 @@ BlockComputeSNR(MpegFrame * const current, NoiseCb = (int32 **) malloc(ysz); SignalCr = (int32 **) malloc(ysz); NoiseCr = (int32 **) malloc(ysz); - if (SignalY == NULL || NoiseY == NULL || SignalCr == NULL || + if (SignalY == NULL || NoiseY == NULL || SignalCr == NULL || NoiseCb == NULL || SignalCb == NULL || NoiseCr == NULL) { fprintf(stderr, "Out of memory in BlockComputeSNR\n"); exit(-1); @@ -840,7 +840,7 @@ BlockComputeSNR(MpegFrame * const current, memset((char *) &SignalCr[y][0], 0, (xSize[0]>>3) * 4); } } - + /* find all the signal and noise */ for (y = 0; y < ySize[0]; y++) { for (x = 0; x < xSize[0]; x++) { @@ -863,7 +863,7 @@ BlockComputeSNR(MpegFrame * const current, tempInt = origCr[y][x]; SignalCr[y>>3][x>>3] += tempInt*tempInt; }} - + /* Now sum up that noise */ for(y=0; y>4; y++){ for(x=0; x>4; x++){ @@ -874,7 +874,7 @@ BlockComputeSNR(MpegFrame * const current, } if (printMSE) puts(""); } - + /* Now look at those ratios! */ for(y=0; y>4; y++){ for(x=0; x>4; x++){ @@ -882,7 +882,7 @@ BlockComputeSNR(MpegFrame * const current, ratio[1] += (double)SignalCb[y][x]/(double)varDiff[1]; ratio[2] += (double)SignalCr[y][x]/(double)varDiff[2]; }} - + for (x=0; x<3; x++) { snr[x] = 10.0 * log10(ratio[x]); psnr[x] = 20.0 * log10(255.0/sqrt((double)varDiff[x]/ diff --git a/converter/ppm/ppmtompeg/input.c b/converter/ppm/ppmtompeg/input.c index 4266d39b..e12b0d4c 100644 --- a/converter/ppm/ppmtompeg/input.c +++ b/converter/ppm/ppmtompeg/input.c @@ -1,16 +1,16 @@ /*===========================================================================* - * input.c - * + * input.c + * * Stuff for getting the raw frame input for the program - * + * *===========================================================================*/ /* COPYRIGHT INFORMATION IS AT THE END OF THIS FILE */ #define _XOPEN_SOURCE 1 - /* This makes sure popen() is in stdio.h. In GNU libc 2.1.3, + /* This makes sure popen() is in stdio.h. In GNU libc 2.1.3, _POSIX_C_SOURCE = 2 is sufficient, but on AIX 4.3, the higher level - _XOPEN_SOURCE is required. 2000.09.09 + _XOPEN_SOURCE is required. 2000.09.09 */ @@ -31,7 +31,7 @@ #include "jpeg.h" #include "input.h" -extern boolean realQuiet; /* TRUE = no messages to stdout */ +extern boolean realQuiet; /* TRUE = no messages to stdout */ struct InputFileEntry { char left[256]; @@ -57,11 +57,11 @@ GetNthInputFileName(struct inputSource * const inputSourceP, /*---------------------------------------------------------------------------- Return the file name of the Nth input file. -----------------------------------------------------------------------------*/ - static int lastN = 0, lastMapN = 0, lastSoFar = 0; - int mapN; + static int lastN = 0, lastMapN = 0, lastSoFar = 0; + int mapN; int index; - int soFar; - int numPadding; + int soFar; + int numPadding; struct InputFileEntry * mapNEntryP; assert(!inputSourceP->stdinUsed); @@ -84,7 +84,7 @@ GetNthInputFileName(struct inputSource * const inputSourceP, } mapN = index; - + mapNEntryP = inputSourceP->inputFileEntries[mapN]; index = mapNEntryP->startID + mapNEntryP->skip*(n - soFar); @@ -93,7 +93,7 @@ GetNthInputFileName(struct inputSource * const inputSourceP, if (numPadding != -1) { char numBuffer[33]; - int loop; + int loop; sprintf(numBuffer, "%32d", index); for (loop = 32-numPadding; loop < 32; ++loop) { @@ -159,26 +159,26 @@ ReadNthFrame(struct inputSource * const inputSourceP, void JM2JPEG(struct inputSource * const inputSourceP) { char full_path[1024]; - char inter_file[1024]; + char inter_file[1024]; int ci; - + for(ci = 0; ci < inputSourceP->numInputFileEntries; ci++) { inter_file[0] = '\0'; full_path[0] = '\0'; strcpy(full_path, currentPath); - + if (!inputSource.stdinUsed) { strcat(full_path, "/"); strcat(full_path, inputSourceP->inputFileEntries[ci]->left); strcpy(inter_file,full_path); - + if (!realQuiet) fprintf(stdout, "Extracting JPEG's in the JMOVIE from %s\n", full_path); - + JMovie2JPEG(full_path, inter_file, - inputSourceP->inputFileEntries[ci]->startID, + inputSourceP->inputFileEntries[ci]->startID, inputSourceP->inputFileEntries[ci]->endID); } else pm_error("ERROR: Cannot use JMovie format on Standard Input"); @@ -200,7 +200,7 @@ SkipSpacesTabs(const char * const start) { static void -processGlob(const char * const input, +processGlob(const char * const input, struct InputFileEntry * const inputFileEntryP) { const char *globPtr; @@ -208,10 +208,10 @@ processGlob(const char * const input, char left[256], right[256]; char leftNumText[256], rightNumText[256]; char skipNumText[256]; - int leftNum, rightNum; - int skipNum; + int leftNum, rightNum; + int skipNum; boolean padding; - int numPadding = 0; + int numPadding = 0; inputFileEntryP->glob = TRUE; inputFileEntryP->repeat = FALSE; @@ -229,13 +229,13 @@ processGlob(const char * const input, *charPtr = '\0'; if (*globPtr == '\0') { - fprintf(stderr, + fprintf(stderr, "WARNING: expanding non-star regular expression\n"); inputFileEntryP->repeat = TRUE; globPtr = input; charPtr = left; /* recopy left of whitespace */ - while ( (*globPtr != '\0') && (*globPtr != '*') && + while ( (*globPtr != '\0') && (*globPtr != '*') && (*globPtr != ' ') && (*globPtr != '\t')) { *charPtr = *globPtr; charPtr++; @@ -256,11 +256,11 @@ processGlob(const char * const input, } *charPtr = '\0'; } - + globPtr = SkipSpacesTabs(globPtr); if ( *globPtr != '[' ) { - fprintf(stderr, + fprintf(stderr, "ERROR: " "Invalid input file expansion expression (no '[')\n"); exit(1); @@ -277,7 +277,7 @@ processGlob(const char * const input, *charPtr = '\0'; if ( *globPtr != '-' ) { - fprintf(stderr, + fprintf(stderr, "ERROR: " "Invalid input file expansion expression (no '-')\n"); exit(1); @@ -293,7 +293,7 @@ processGlob(const char * const input, } *charPtr = '\0'; if ( atoi(rightNumText) < atoi(leftNumText) ) { - fprintf(stderr, + fprintf(stderr, "ERROR: " "Beginning of input range is higher than end.\n"); exit(1); @@ -302,7 +302,7 @@ processGlob(const char * const input, if ( *globPtr != ']' ) { if ( *globPtr != '+' ) { - fprintf(stderr, + fprintf(stderr, "ERROR: " "Invalid input file expansion expression " "(no ']')\n"); @@ -320,7 +320,7 @@ processGlob(const char * const input, *charPtr = '\0'; if ( *globPtr != ']' ) { - fprintf(stderr, + fprintf(stderr, "ERROR: Invalid input file expansion expression " "(no ']')\n"); exit(1); @@ -344,7 +344,7 @@ processGlob(const char * const input, inputFileEntryP->startID = leftNum; inputFileEntryP->endID = rightNum; inputFileEntryP->skip = skipNum; - inputFileEntryP->numFiles = + inputFileEntryP->numFiles = (rightNum-leftNum+1)/skipNum; strcpy(inputFileEntryP->left, left); strcpy(inputFileEntryP->right, right); @@ -357,7 +357,7 @@ processGlob(const char * const input, -static void processJmovie(const char * const input, +static void processJmovie(const char * const input, struct InputFileEntry * const inputFileEntryP) { FILE *jmovie; char full_path[1024]; @@ -365,19 +365,19 @@ static void processJmovie(const char * const input, inputFileEntryP->glob = TRUE; full_path[0] = '\0'; strcpy(full_path, currentPath); - + strcat(full_path, "/"); strcat(full_path, input); - jmovie = fopen(input, "rb"); - + jmovie = fopen(input, "rb"); + if (jmovie == NULL) { - perror (input); + perror (input); exit (1); } - + fseek (jmovie, (8*sizeof(char)), 0); fseek (jmovie, (2*sizeof(int)), 1); - + if (fread(&(inputFileEntryP->numFiles), sizeof(int), 1, jmovie) != 1) { perror ("Error in reading number of frames in JMOVIE"); @@ -391,11 +391,11 @@ static void processJmovie(const char * const input, inputFileEntryP->endID = (inputFileEntryP->numFiles-1); inputFileEntryP->skip = 1; if (! realQuiet) { - fprintf (stdout, - "Encoding all %d frames from JMOVIE.\n", + fprintf (stdout, + "Encoding all %d frames from JMOVIE.\n", inputFileEntryP->endID); } -} +} @@ -428,19 +428,19 @@ AddInputFiles(struct inputSource * const inputSourceP, if (currentIndex >= inputSourceP->ifArraySize) { /* Get more space */ inputSourceP->ifArraySize += INPUT_ENTRY_BLOCK_SIZE; - REALLOCARRAY_NOFAIL(inputSourceP->inputFileEntries, + REALLOCARRAY_NOFAIL(inputSourceP->inputFileEntries, inputSourceP->ifArraySize); } MALLOCVAR_NOFAIL(inputSourceP->inputFileEntries[currentIndex]); currentEntryP = inputSourceP->inputFileEntries[currentIndex]; - if (input[strlen(input)-1] == ']') + if (input[strlen(input)-1] == ']') processGlob(input, currentEntryP); else { strcpy(currentEntryP->left, input); - if (baseFormat == JMOVIE_FILE_TYPE) + if (baseFormat == JMOVIE_FILE_TYPE) processJmovie(input, currentEntryP); - else + else processSimpleFileName(input, currentEntryP); } inputSourceP->numInputFiles += currentEntryP->numFiles; @@ -472,7 +472,7 @@ CreateInputSource(struct inputSource ** const inputSourcePP) { inputSourceP->ifArraySize = 1; inputSourceP->numInputFiles = 0; MALLOCARRAY_NOFAIL(inputSourceP->inputFileEntries, 1); - + *inputSourcePP = inputSourceP; } diff --git a/converter/ppm/ppmtompeg/jrevdct.c b/converter/ppm/ppmtompeg/jrevdct.c index dd1f9fff..ebadb997 100644 --- a/converter/ppm/ppmtompeg/jrevdct.c +++ b/converter/ppm/ppmtompeg/jrevdct.c @@ -16,7 +16,7 @@ * The advantage of this method is that no data path contains more than one * multiplication; this allows a very simple and accurate implementation in * scaled fixed-point arithmetic, with a minimal number of shifts. - * + * * I've made lots of modifications to attempt to take advantage of the * sparse nature of the DCT matrices we're getting. Although the logic * is cumbersome, it's straightforward and the resulting code is much @@ -85,10 +85,10 @@ #ifdef EIGHT_BIT_SAMPLES #define PASS1_BITS 2 #else -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif -#define ONE ((int32) 1) +#define ONE ((int32) 1) #define CONST_SCALE (ONE << CONST_BITS) @@ -99,7 +99,7 @@ */ /* Actually FIX is no longer used, we precomputed them all */ -#define FIX(x) ((int32) ((x) * CONST_SCALE + 0.5)) +#define FIX(x) ((int32) ((x) * CONST_SCALE + 0.5)) /* Descale and correctly round an int32 value that's scaled by N bits. * We assume RIGHT_SHIFT rounds towards minus infinity, so adding @@ -120,22 +120,22 @@ */ #ifdef EIGHT_BIT_SAMPLES -#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ +#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const))) #endif -#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ +#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ #define MULTIPLY(var,const) (((INT16) (var)) * ((int32) (const))) #endif #endif -#ifndef MULTIPLY /* default definition */ +#ifndef MULTIPLY /* default definition */ #define MULTIPLY(var,const) ((var) * (const)) #endif -/* +/* Unlike our decoder where we approximate the FIXes, we need to use exact -ones here or successive P-frames will drift too much with Reference frame coding +ones here or successive P-frames will drift too much with Reference frame coding */ #define FIX_0_211164243 1730 #define FIX_0_275899380 2260 @@ -194,7 +194,7 @@ mpeg_jrevdct_quick(data) register DCTELEM *dataptr; int rowctr; SHIFT_TEMPS - + /* Pass 1: process rows. */ /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ /* furthermore, we scale the results by 2**PASS1_BITS. */ @@ -217,17 +217,17 @@ mpeg_jrevdct_quick(data) if ((d1 == 0) && (idataptr[1] | idataptr[2] | idataptr[3]) == 0) { /* AC terms all zero */ if (d0) { - /* Compute a 32 bit value to assign. */ - DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS); - register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); - - idataptr[0] = v; - idataptr[1] = v; - idataptr[2] = v; - idataptr[3] = v; + /* Compute a 32 bit value to assign. */ + DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS); + register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); + + idataptr[0] = v; + idataptr[1] = v; + idataptr[2] = v; + idataptr[3] = v; } - - dataptr += DCTSIZE; /* advance pointer to next row */ + + dataptr += DCTSIZE; /* advance pointer to next row */ continue; } d2 = dataptr[2]; @@ -241,180 +241,180 @@ mpeg_jrevdct_quick(data) /* The rotator is sqrt(2)*c(-6). */ { if (d6) { - if (d4) { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } - } else { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } - } + if (d4) { + if (d2) { + if (d0) { + /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ + z1 = MULTIPLY(d2 + d6, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); + tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); + + tmp0 = (d0 + d4) << CONST_BITS; + tmp1 = (d0 - d4) << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + } else { + /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */ + z1 = MULTIPLY(d2 + d6, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); + tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); + + tmp0 = d4 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp2 - tmp0; + tmp12 = -(tmp0 + tmp2); + } + } else { + if (d0) { + /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ + tmp2 = MULTIPLY(-d6, FIX_1_306562965); + tmp3 = MULTIPLY(d6, FIX_0_541196100); + + tmp0 = (d0 + d4) << CONST_BITS; + tmp1 = (d0 - d4) << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + } else { + /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */ + tmp2 = MULTIPLY(-d6, FIX_1_306562965); + tmp3 = MULTIPLY(d6, FIX_0_541196100); + + tmp0 = d4 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp2 - tmp0; + tmp12 = -(tmp0 + tmp2); + } + } + } else { + if (d2) { + if (d0) { + /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */ + z1 = MULTIPLY(d2 + d6, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); + tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); + + tmp0 = d0 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp0 + tmp2; + tmp12 = tmp0 - tmp2; + } else { + /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */ + z1 = MULTIPLY(d2 + d6, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); + tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); + + tmp10 = tmp3; + tmp13 = -tmp3; + tmp11 = tmp2; + tmp12 = -tmp2; + } + } else { + if (d0) { + /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */ + tmp2 = MULTIPLY(-d6, FIX_1_306562965); + tmp3 = MULTIPLY(d6, FIX_0_541196100); + + tmp0 = d0 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp0 + tmp2; + tmp12 = tmp0 - tmp2; + } else { + /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */ + tmp2 = MULTIPLY(-d6, FIX_1_306562965); + tmp3 = MULTIPLY(d6, FIX_0_541196100); + + tmp10 = tmp3; + tmp13 = -tmp3; + tmp11 = tmp2; + tmp12 = -tmp2; + } + } + } } else { - if (d4) { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = (d0 + d4) << CONST_BITS; - tmp11 = tmp12 = (d0 - d4) << CONST_BITS; - } else { - /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = d4 << CONST_BITS; - tmp11 = tmp12 = -tmp10; - } - } - } else { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */ - tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS; - } else { - /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */ - tmp10 = tmp13 = tmp11 = tmp12 = 0; - } - } - } + if (d4) { + if (d2) { + if (d0) { + /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ + tmp2 = MULTIPLY(d2, FIX_0_541196100); + tmp3 = MULTIPLY(d2, FIX_1_306562965); + + tmp0 = (d0 + d4) << CONST_BITS; + tmp1 = (d0 - d4) << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + } else { + /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */ + tmp2 = MULTIPLY(d2, FIX_0_541196100); + tmp3 = MULTIPLY(d2, FIX_1_306562965); + + tmp0 = d4 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp2 - tmp0; + tmp12 = -(tmp0 + tmp2); + } + } else { + if (d0) { + /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ + tmp10 = tmp13 = (d0 + d4) << CONST_BITS; + tmp11 = tmp12 = (d0 - d4) << CONST_BITS; + } else { + /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */ + tmp10 = tmp13 = d4 << CONST_BITS; + tmp11 = tmp12 = -tmp10; + } + } + } else { + if (d2) { + if (d0) { + /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */ + tmp2 = MULTIPLY(d2, FIX_0_541196100); + tmp3 = MULTIPLY(d2, FIX_1_306562965); + + tmp0 = d0 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp0 + tmp2; + tmp12 = tmp0 - tmp2; + } else { + /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */ + tmp2 = MULTIPLY(d2, FIX_0_541196100); + tmp3 = MULTIPLY(d2, FIX_1_306562965); + + tmp10 = tmp3; + tmp13 = -tmp3; + tmp11 = tmp2; + tmp12 = -tmp2; + } + } else { + if (d0) { + /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */ + tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS; + } else { + /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */ + tmp10 = tmp13 = tmp11 = tmp12 = 0; + } + } + } } /* Odd part per figure 8; the matrix is unitary and hence its @@ -422,259 +422,259 @@ mpeg_jrevdct_quick(data) */ if (d7) { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5 + d3; - z3 = d7 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ - z2 = d5 + d3; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d5, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - z1 = MULTIPLY(-d7, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-d5, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 = z1 + z4; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z4 = d5 + d1; - z5 = MULTIPLY(d7 + z4, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z3 = MULTIPLY(-d7, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 = z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ - tmp0 = MULTIPLY(-d7, FIX_0_601344887); - z1 = MULTIPLY(-d7, FIX_0_899976223); - z3 = MULTIPLY(-d7, FIX_1_961570560); - tmp1 = MULTIPLY(-d5, FIX_0_509795579); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z4 = MULTIPLY(-d5, FIX_0_390180644); - z5 = MULTIPLY(d5 + d7, FIX_1_175875602); - - z3 += z5; - z4 += z5; - - tmp0 += z3; - tmp1 += z4; - tmp2 = z2 + z3; - tmp3 = z1 + z4; - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d1, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-d3, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-d1, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 = z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ - z3 = d7 + d3; - - tmp0 = MULTIPLY(-d7, FIX_0_601344887); - z1 = MULTIPLY(-d7, FIX_0_899976223); - tmp2 = MULTIPLY(d3, FIX_0_509795579); - z2 = MULTIPLY(-d3, FIX_2_562915447); - z5 = MULTIPLY(z3, FIX_1_175875602); - z3 = MULTIPLY(-z3, FIX_0_785694958); - - tmp0 += z3; - tmp1 = z2 + z5; - tmp2 += z3; - tmp3 = z1 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z5 = MULTIPLY(z1, FIX_1_175875602); - - z1 = MULTIPLY(z1, FIX_0_275899380); - z3 = MULTIPLY(-d7, FIX_1_961570560); - tmp0 = MULTIPLY(-d7, FIX_1_662939225); - z4 = MULTIPLY(-d1, FIX_0_390180644); - tmp3 = MULTIPLY(d1, FIX_1_111140466); - - tmp0 += z1; - tmp1 = z4 + z5; - tmp2 = z3 + z5; - tmp3 += z1; - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ - tmp0 = MULTIPLY(-d7, FIX_1_387039845); - tmp1 = MULTIPLY(d7, FIX_1_175875602); - tmp2 = MULTIPLY(-d7, FIX_0_785694958); - tmp3 = MULTIPLY(d7, FIX_0_275899380); - } - } - } + if (d5) { + if (d3) { + if (d1) { + /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ + z1 = d7 + d1; + z2 = d5 + d3; + z3 = d7 + d3; + z4 = d5 + d1; + z5 = MULTIPLY(z3 + z4, FIX_1_175875602); + + tmp0 = MULTIPLY(d7, FIX_0_298631336); + tmp1 = MULTIPLY(d5, FIX_2_053119869); + tmp2 = MULTIPLY(d3, FIX_3_072711026); + tmp3 = MULTIPLY(d1, FIX_1_501321110); + z1 = MULTIPLY(-z1, FIX_0_899976223); + z2 = MULTIPLY(-z2, FIX_2_562915447); + z3 = MULTIPLY(-z3, FIX_1_961570560); + z4 = MULTIPLY(-z4, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 += z2 + z4; + tmp2 += z2 + z3; + tmp3 += z1 + z4; + } else { + /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ + z2 = d5 + d3; + z3 = d7 + d3; + z5 = MULTIPLY(z3 + d5, FIX_1_175875602); + + tmp0 = MULTIPLY(d7, FIX_0_298631336); + tmp1 = MULTIPLY(d5, FIX_2_053119869); + tmp2 = MULTIPLY(d3, FIX_3_072711026); + z1 = MULTIPLY(-d7, FIX_0_899976223); + z2 = MULTIPLY(-z2, FIX_2_562915447); + z3 = MULTIPLY(-z3, FIX_1_961570560); + z4 = MULTIPLY(-d5, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 += z2 + z4; + tmp2 += z2 + z3; + tmp3 = z1 + z4; + } + } else { + if (d1) { + /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ + z1 = d7 + d1; + z4 = d5 + d1; + z5 = MULTIPLY(d7 + z4, FIX_1_175875602); + + tmp0 = MULTIPLY(d7, FIX_0_298631336); + tmp1 = MULTIPLY(d5, FIX_2_053119869); + tmp3 = MULTIPLY(d1, FIX_1_501321110); + z1 = MULTIPLY(-z1, FIX_0_899976223); + z2 = MULTIPLY(-d5, FIX_2_562915447); + z3 = MULTIPLY(-d7, FIX_1_961570560); + z4 = MULTIPLY(-z4, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 += z2 + z4; + tmp2 = z2 + z3; + tmp3 += z1 + z4; + } else { + /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ + tmp0 = MULTIPLY(-d7, FIX_0_601344887); + z1 = MULTIPLY(-d7, FIX_0_899976223); + z3 = MULTIPLY(-d7, FIX_1_961570560); + tmp1 = MULTIPLY(-d5, FIX_0_509795579); + z2 = MULTIPLY(-d5, FIX_2_562915447); + z4 = MULTIPLY(-d5, FIX_0_390180644); + z5 = MULTIPLY(d5 + d7, FIX_1_175875602); + + z3 += z5; + z4 += z5; + + tmp0 += z3; + tmp1 += z4; + tmp2 = z2 + z3; + tmp3 = z1 + z4; + } + } + } else { + if (d3) { + if (d1) { + /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ + z1 = d7 + d1; + z3 = d7 + d3; + z5 = MULTIPLY(z3 + d1, FIX_1_175875602); + + tmp0 = MULTIPLY(d7, FIX_0_298631336); + tmp2 = MULTIPLY(d3, FIX_3_072711026); + tmp3 = MULTIPLY(d1, FIX_1_501321110); + z1 = MULTIPLY(-z1, FIX_0_899976223); + z2 = MULTIPLY(-d3, FIX_2_562915447); + z3 = MULTIPLY(-z3, FIX_1_961570560); + z4 = MULTIPLY(-d1, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 = z2 + z4; + tmp2 += z2 + z3; + tmp3 += z1 + z4; + } else { + /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ + z3 = d7 + d3; + + tmp0 = MULTIPLY(-d7, FIX_0_601344887); + z1 = MULTIPLY(-d7, FIX_0_899976223); + tmp2 = MULTIPLY(d3, FIX_0_509795579); + z2 = MULTIPLY(-d3, FIX_2_562915447); + z5 = MULTIPLY(z3, FIX_1_175875602); + z3 = MULTIPLY(-z3, FIX_0_785694958); + + tmp0 += z3; + tmp1 = z2 + z5; + tmp2 += z3; + tmp3 = z1 + z5; + } + } else { + if (d1) { + /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ + z1 = d7 + d1; + z5 = MULTIPLY(z1, FIX_1_175875602); + + z1 = MULTIPLY(z1, FIX_0_275899380); + z3 = MULTIPLY(-d7, FIX_1_961570560); + tmp0 = MULTIPLY(-d7, FIX_1_662939225); + z4 = MULTIPLY(-d1, FIX_0_390180644); + tmp3 = MULTIPLY(d1, FIX_1_111140466); + + tmp0 += z1; + tmp1 = z4 + z5; + tmp2 = z3 + z5; + tmp3 += z1; + } else { + /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ + tmp0 = MULTIPLY(-d7, FIX_1_387039845); + tmp1 = MULTIPLY(d7, FIX_1_175875602); + tmp2 = MULTIPLY(-d7, FIX_0_785694958); + tmp3 = MULTIPLY(d7, FIX_0_275899380); + } + } + } } else { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(d3 + z4, FIX_1_175875602); - - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-d1, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-d3, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 = z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - - z5 = MULTIPLY(z2, FIX_1_175875602); - tmp1 = MULTIPLY(d5, FIX_1_662939225); - z4 = MULTIPLY(-d5, FIX_0_390180644); - z2 = MULTIPLY(-z2, FIX_1_387039845); - tmp2 = MULTIPLY(d3, FIX_1_111140466); - z3 = MULTIPLY(-d3, FIX_1_961570560); - - tmp0 = z3 + z5; - tmp1 += z2; - tmp2 += z2; - tmp3 = z4 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ - z4 = d5 + d1; - - z5 = MULTIPLY(z4, FIX_1_175875602); - z1 = MULTIPLY(-d1, FIX_0_899976223); - tmp3 = MULTIPLY(d1, FIX_0_601344887); - tmp1 = MULTIPLY(-d5, FIX_0_509795579); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z4 = MULTIPLY(z4, FIX_0_785694958); - - tmp0 = z1 + z5; - tmp1 += z4; - tmp2 = z2 + z5; - tmp3 += z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ - tmp0 = MULTIPLY(d5, FIX_1_175875602); - tmp1 = MULTIPLY(d5, FIX_0_275899380); - tmp2 = MULTIPLY(-d5, FIX_1_387039845); - tmp3 = MULTIPLY(d5, FIX_0_785694958); - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ - z5 = d1 + d3; - tmp3 = MULTIPLY(d1, FIX_0_211164243); - tmp2 = MULTIPLY(-d3, FIX_1_451774981); - z1 = MULTIPLY(d1, FIX_1_061594337); - z2 = MULTIPLY(-d3, FIX_2_172734803); - z4 = MULTIPLY(z5, FIX_0_785694958); - z5 = MULTIPLY(z5, FIX_1_175875602); - - tmp0 = z1 - z4; - tmp1 = z2 + z4; - tmp2 += z5; - tmp3 += z5; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(-d3, FIX_0_785694958); - tmp1 = MULTIPLY(-d3, FIX_1_387039845); - tmp2 = MULTIPLY(-d3, FIX_0_275899380); - tmp3 = MULTIPLY(d3, FIX_1_175875602); - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(d1, FIX_0_275899380); - tmp1 = MULTIPLY(d1, FIX_0_785694958); - tmp2 = MULTIPLY(d1, FIX_1_175875602); - tmp3 = MULTIPLY(d1, FIX_1_387039845); - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = tmp1 = tmp2 = tmp3 = 0; - } - } - } + if (d5) { + if (d3) { + if (d1) { + /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ + z2 = d5 + d3; + z4 = d5 + d1; + z5 = MULTIPLY(d3 + z4, FIX_1_175875602); + + tmp1 = MULTIPLY(d5, FIX_2_053119869); + tmp2 = MULTIPLY(d3, FIX_3_072711026); + tmp3 = MULTIPLY(d1, FIX_1_501321110); + z1 = MULTIPLY(-d1, FIX_0_899976223); + z2 = MULTIPLY(-z2, FIX_2_562915447); + z3 = MULTIPLY(-d3, FIX_1_961570560); + z4 = MULTIPLY(-z4, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 = z1 + z3; + tmp1 += z2 + z4; + tmp2 += z2 + z3; + tmp3 += z1 + z4; + } else { + /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ + z2 = d5 + d3; + + z5 = MULTIPLY(z2, FIX_1_175875602); + tmp1 = MULTIPLY(d5, FIX_1_662939225); + z4 = MULTIPLY(-d5, FIX_0_390180644); + z2 = MULTIPLY(-z2, FIX_1_387039845); + tmp2 = MULTIPLY(d3, FIX_1_111140466); + z3 = MULTIPLY(-d3, FIX_1_961570560); + + tmp0 = z3 + z5; + tmp1 += z2; + tmp2 += z2; + tmp3 = z4 + z5; + } + } else { + if (d1) { + /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ + z4 = d5 + d1; + + z5 = MULTIPLY(z4, FIX_1_175875602); + z1 = MULTIPLY(-d1, FIX_0_899976223); + tmp3 = MULTIPLY(d1, FIX_0_601344887); + tmp1 = MULTIPLY(-d5, FIX_0_509795579); + z2 = MULTIPLY(-d5, FIX_2_562915447); + z4 = MULTIPLY(z4, FIX_0_785694958); + + tmp0 = z1 + z5; + tmp1 += z4; + tmp2 = z2 + z5; + tmp3 += z4; + } else { + /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ + tmp0 = MULTIPLY(d5, FIX_1_175875602); + tmp1 = MULTIPLY(d5, FIX_0_275899380); + tmp2 = MULTIPLY(-d5, FIX_1_387039845); + tmp3 = MULTIPLY(d5, FIX_0_785694958); + } + } + } else { + if (d3) { + if (d1) { + /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ + z5 = d1 + d3; + tmp3 = MULTIPLY(d1, FIX_0_211164243); + tmp2 = MULTIPLY(-d3, FIX_1_451774981); + z1 = MULTIPLY(d1, FIX_1_061594337); + z2 = MULTIPLY(-d3, FIX_2_172734803); + z4 = MULTIPLY(z5, FIX_0_785694958); + z5 = MULTIPLY(z5, FIX_1_175875602); + + tmp0 = z1 - z4; + tmp1 = z2 + z4; + tmp2 += z5; + tmp3 += z5; + } else { + /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ + tmp0 = MULTIPLY(-d3, FIX_0_785694958); + tmp1 = MULTIPLY(-d3, FIX_1_387039845); + tmp2 = MULTIPLY(-d3, FIX_0_275899380); + tmp3 = MULTIPLY(d3, FIX_1_175875602); + } + } else { + if (d1) { + /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ + tmp0 = MULTIPLY(d1, FIX_0_275899380); + tmp1 = MULTIPLY(d1, FIX_0_785694958); + tmp2 = MULTIPLY(d1, FIX_1_175875602); + tmp3 = MULTIPLY(d1, FIX_1_387039845); + } else { + /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ + tmp0 = tmp1 = tmp2 = tmp3 = 0; + } + } + } } } /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ @@ -688,7 +688,7 @@ mpeg_jrevdct_quick(data) dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); - dataptr += DCTSIZE; /* advance pointer to next row */ + dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. */ @@ -717,464 +717,464 @@ mpeg_jrevdct_quick(data) /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ if (d6) { - if (d4) { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } - } else { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } - } + if (d4) { + if (d2) { + if (d0) { + /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ + z1 = MULTIPLY(d2 + d6, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); + tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); + + tmp0 = (d0 + d4) << CONST_BITS; + tmp1 = (d0 - d4) << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + } else { + /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */ + z1 = MULTIPLY(d2 + d6, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); + tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); + + tmp0 = d4 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp2 - tmp0; + tmp12 = -(tmp0 + tmp2); + } + } else { + if (d0) { + /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ + tmp2 = MULTIPLY(-d6, FIX_1_306562965); + tmp3 = MULTIPLY(d6, FIX_0_541196100); + + tmp0 = (d0 + d4) << CONST_BITS; + tmp1 = (d0 - d4) << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + } else { + /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */ + tmp2 = MULTIPLY(-d6, FIX_1_306562965); + tmp3 = MULTIPLY(d6, FIX_0_541196100); + + tmp0 = d4 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp2 - tmp0; + tmp12 = -(tmp0 + tmp2); + } + } + } else { + if (d2) { + if (d0) { + /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */ + z1 = MULTIPLY(d2 + d6, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); + tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); + + tmp0 = d0 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp0 + tmp2; + tmp12 = tmp0 - tmp2; + } else { + /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */ + z1 = MULTIPLY(d2 + d6, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); + tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); + + tmp10 = tmp3; + tmp13 = -tmp3; + tmp11 = tmp2; + tmp12 = -tmp2; + } + } else { + if (d0) { + /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */ + tmp2 = MULTIPLY(-d6, FIX_1_306562965); + tmp3 = MULTIPLY(d6, FIX_0_541196100); + + tmp0 = d0 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp0 + tmp2; + tmp12 = tmp0 - tmp2; + } else { + /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */ + tmp2 = MULTIPLY(-d6, FIX_1_306562965); + tmp3 = MULTIPLY(d6, FIX_0_541196100); + + tmp10 = tmp3; + tmp13 = -tmp3; + tmp11 = tmp2; + tmp12 = -tmp2; + } + } + } } else { - if (d4) { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = (d0 + d4) << CONST_BITS; - tmp11 = tmp12 = (d0 - d4) << CONST_BITS; - } else { - /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = d4 << CONST_BITS; - tmp11 = tmp12 = -tmp10; - } - } - } else { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */ - tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS; - } else { - /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */ - tmp10 = tmp13 = tmp11 = tmp12 = 0; - } - } - } + if (d4) { + if (d2) { + if (d0) { + /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ + tmp2 = MULTIPLY(d2, FIX_0_541196100); + tmp3 = MULTIPLY(d2, FIX_1_306562965); + + tmp0 = (d0 + d4) << CONST_BITS; + tmp1 = (d0 - d4) << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + } else { + /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */ + tmp2 = MULTIPLY(d2, FIX_0_541196100); + tmp3 = MULTIPLY(d2, FIX_1_306562965); + + tmp0 = d4 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp2 - tmp0; + tmp12 = -(tmp0 + tmp2); + } + } else { + if (d0) { + /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ + tmp10 = tmp13 = (d0 + d4) << CONST_BITS; + tmp11 = tmp12 = (d0 - d4) << CONST_BITS; + } else { + /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */ + tmp10 = tmp13 = d4 << CONST_BITS; + tmp11 = tmp12 = -tmp10; + } + } + } else { + if (d2) { + if (d0) { + /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */ + tmp2 = MULTIPLY(d2, FIX_0_541196100); + tmp3 = MULTIPLY(d2, FIX_1_306562965); + + tmp0 = d0 << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp0 + tmp2; + tmp12 = tmp0 - tmp2; + } else { + /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */ + tmp2 = MULTIPLY(d2, FIX_0_541196100); + tmp3 = MULTIPLY(d2, FIX_1_306562965); + + tmp10 = tmp3; + tmp13 = -tmp3; + tmp11 = tmp2; + tmp12 = -tmp2; + } + } else { + if (d0) { + /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */ + tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS; + } else { + /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */ + tmp10 = tmp13 = tmp11 = tmp12 = 0; + } + } + } } /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ if (d7) { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5 + d3; - z3 = d7 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7; - z2 = d5 + d3; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d5, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - z1 = MULTIPLY(-d7, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-d5, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 = z1 + z4; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5; - z3 = d7; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z3 = MULTIPLY(-d7, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 = z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ - tmp0 = MULTIPLY(-d7, FIX_0_601344887); - z1 = MULTIPLY(-d7, FIX_0_899976223); - z3 = MULTIPLY(-d7, FIX_1_961570560); - tmp1 = MULTIPLY(-d5, FIX_0_509795579); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z4 = MULTIPLY(-d5, FIX_0_390180644); - z5 = MULTIPLY(d5 + d7, FIX_1_175875602); - - z3 += z5; - z4 += z5; - - tmp0 += z3; - tmp1 += z4; - tmp2 = z2 + z3; - tmp3 = z1 + z4; - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d1, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-d3, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-d1, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 = z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ - z3 = d7 + d3; - - tmp0 = MULTIPLY(-d7, FIX_0_601344887); - z1 = MULTIPLY(-d7, FIX_0_899976223); - tmp2 = MULTIPLY(d3, FIX_0_509795579); - z2 = MULTIPLY(-d3, FIX_2_562915447); - z5 = MULTIPLY(z3, FIX_1_175875602); - z3 = MULTIPLY(-z3, FIX_0_785694958); - - tmp0 += z3; - tmp1 = z2 + z5; - tmp2 += z3; - tmp3 = z1 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z5 = MULTIPLY(z1, FIX_1_175875602); - - z1 = MULTIPLY(z1, FIX_0_275899380); - z3 = MULTIPLY(-d7, FIX_1_961570560); - tmp0 = MULTIPLY(-d7, FIX_1_662939225); - z4 = MULTIPLY(-d1, FIX_0_390180644); - tmp3 = MULTIPLY(d1, FIX_1_111140466); - - tmp0 += z1; - tmp1 = z4 + z5; - tmp2 = z3 + z5; - tmp3 += z1; - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ - tmp0 = MULTIPLY(-d7, FIX_1_387039845); - tmp1 = MULTIPLY(d7, FIX_1_175875602); - tmp2 = MULTIPLY(-d7, FIX_0_785694958); - tmp3 = MULTIPLY(d7, FIX_0_275899380); - } - } - } + if (d5) { + if (d3) { + if (d1) { + /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ + z1 = d7 + d1; + z2 = d5 + d3; + z3 = d7 + d3; + z4 = d5 + d1; + z5 = MULTIPLY(z3 + z4, FIX_1_175875602); + + tmp0 = MULTIPLY(d7, FIX_0_298631336); + tmp1 = MULTIPLY(d5, FIX_2_053119869); + tmp2 = MULTIPLY(d3, FIX_3_072711026); + tmp3 = MULTIPLY(d1, FIX_1_501321110); + z1 = MULTIPLY(-z1, FIX_0_899976223); + z2 = MULTIPLY(-z2, FIX_2_562915447); + z3 = MULTIPLY(-z3, FIX_1_961570560); + z4 = MULTIPLY(-z4, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 += z2 + z4; + tmp2 += z2 + z3; + tmp3 += z1 + z4; + } else { + /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ + z1 = d7; + z2 = d5 + d3; + z3 = d7 + d3; + z5 = MULTIPLY(z3 + d5, FIX_1_175875602); + + tmp0 = MULTIPLY(d7, FIX_0_298631336); + tmp1 = MULTIPLY(d5, FIX_2_053119869); + tmp2 = MULTIPLY(d3, FIX_3_072711026); + z1 = MULTIPLY(-d7, FIX_0_899976223); + z2 = MULTIPLY(-z2, FIX_2_562915447); + z3 = MULTIPLY(-z3, FIX_1_961570560); + z4 = MULTIPLY(-d5, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 += z2 + z4; + tmp2 += z2 + z3; + tmp3 = z1 + z4; + } + } else { + if (d1) { + /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ + z1 = d7 + d1; + z2 = d5; + z3 = d7; + z4 = d5 + d1; + z5 = MULTIPLY(z3 + z4, FIX_1_175875602); + + tmp0 = MULTIPLY(d7, FIX_0_298631336); + tmp1 = MULTIPLY(d5, FIX_2_053119869); + tmp3 = MULTIPLY(d1, FIX_1_501321110); + z1 = MULTIPLY(-z1, FIX_0_899976223); + z2 = MULTIPLY(-d5, FIX_2_562915447); + z3 = MULTIPLY(-d7, FIX_1_961570560); + z4 = MULTIPLY(-z4, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 += z2 + z4; + tmp2 = z2 + z3; + tmp3 += z1 + z4; + } else { + /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ + tmp0 = MULTIPLY(-d7, FIX_0_601344887); + z1 = MULTIPLY(-d7, FIX_0_899976223); + z3 = MULTIPLY(-d7, FIX_1_961570560); + tmp1 = MULTIPLY(-d5, FIX_0_509795579); + z2 = MULTIPLY(-d5, FIX_2_562915447); + z4 = MULTIPLY(-d5, FIX_0_390180644); + z5 = MULTIPLY(d5 + d7, FIX_1_175875602); + + z3 += z5; + z4 += z5; + + tmp0 += z3; + tmp1 += z4; + tmp2 = z2 + z3; + tmp3 = z1 + z4; + } + } + } else { + if (d3) { + if (d1) { + /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ + z1 = d7 + d1; + z3 = d7 + d3; + z5 = MULTIPLY(z3 + d1, FIX_1_175875602); + + tmp0 = MULTIPLY(d7, FIX_0_298631336); + tmp2 = MULTIPLY(d3, FIX_3_072711026); + tmp3 = MULTIPLY(d1, FIX_1_501321110); + z1 = MULTIPLY(-z1, FIX_0_899976223); + z2 = MULTIPLY(-d3, FIX_2_562915447); + z3 = MULTIPLY(-z3, FIX_1_961570560); + z4 = MULTIPLY(-d1, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 = z2 + z4; + tmp2 += z2 + z3; + tmp3 += z1 + z4; + } else { + /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ + z3 = d7 + d3; + + tmp0 = MULTIPLY(-d7, FIX_0_601344887); + z1 = MULTIPLY(-d7, FIX_0_899976223); + tmp2 = MULTIPLY(d3, FIX_0_509795579); + z2 = MULTIPLY(-d3, FIX_2_562915447); + z5 = MULTIPLY(z3, FIX_1_175875602); + z3 = MULTIPLY(-z3, FIX_0_785694958); + + tmp0 += z3; + tmp1 = z2 + z5; + tmp2 += z3; + tmp3 = z1 + z5; + } + } else { + if (d1) { + /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ + z1 = d7 + d1; + z5 = MULTIPLY(z1, FIX_1_175875602); + + z1 = MULTIPLY(z1, FIX_0_275899380); + z3 = MULTIPLY(-d7, FIX_1_961570560); + tmp0 = MULTIPLY(-d7, FIX_1_662939225); + z4 = MULTIPLY(-d1, FIX_0_390180644); + tmp3 = MULTIPLY(d1, FIX_1_111140466); + + tmp0 += z1; + tmp1 = z4 + z5; + tmp2 = z3 + z5; + tmp3 += z1; + } else { + /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ + tmp0 = MULTIPLY(-d7, FIX_1_387039845); + tmp1 = MULTIPLY(d7, FIX_1_175875602); + tmp2 = MULTIPLY(-d7, FIX_0_785694958); + tmp3 = MULTIPLY(d7, FIX_0_275899380); + } + } + } } else { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(d3 + z4, FIX_1_175875602); - - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-d1, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-d3, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 = z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - - z5 = MULTIPLY(z2, FIX_1_175875602); - tmp1 = MULTIPLY(d5, FIX_1_662939225); - z4 = MULTIPLY(-d5, FIX_0_390180644); - z2 = MULTIPLY(-z2, FIX_1_387039845); - tmp2 = MULTIPLY(d3, FIX_1_111140466); - z3 = MULTIPLY(-d3, FIX_1_961570560); - - tmp0 = z3 + z5; - tmp1 += z2; - tmp2 += z2; - tmp3 = z4 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ - z4 = d5 + d1; - - z5 = MULTIPLY(z4, FIX_1_175875602); - z1 = MULTIPLY(-d1, FIX_0_899976223); - tmp3 = MULTIPLY(d1, FIX_0_601344887); - tmp1 = MULTIPLY(-d5, FIX_0_509795579); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z4 = MULTIPLY(z4, FIX_0_785694958); - - tmp0 = z1 + z5; - tmp1 += z4; - tmp2 = z2 + z5; - tmp3 += z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ - tmp0 = MULTIPLY(d5, FIX_1_175875602); - tmp1 = MULTIPLY(d5, FIX_0_275899380); - tmp2 = MULTIPLY(-d5, FIX_1_387039845); - tmp3 = MULTIPLY(d5, FIX_0_785694958); - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ - z5 = d1 + d3; - tmp3 = MULTIPLY(d1, FIX_0_211164243); - tmp2 = MULTIPLY(-d3, FIX_1_451774981); - z1 = MULTIPLY(d1, FIX_1_061594337); - z2 = MULTIPLY(-d3, FIX_2_172734803); - z4 = MULTIPLY(z5, FIX_0_785694958); - z5 = MULTIPLY(z5, FIX_1_175875602); - - tmp0 = z1 - z4; - tmp1 = z2 + z4; - tmp2 += z5; - tmp3 += z5; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(-d3, FIX_0_785694958); - tmp1 = MULTIPLY(-d3, FIX_1_387039845); - tmp2 = MULTIPLY(-d3, FIX_0_275899380); - tmp3 = MULTIPLY(d3, FIX_1_175875602); - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(d1, FIX_0_275899380); - tmp1 = MULTIPLY(d1, FIX_0_785694958); - tmp2 = MULTIPLY(d1, FIX_1_175875602); - tmp3 = MULTIPLY(d1, FIX_1_387039845); - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = tmp1 = tmp2 = tmp3 = 0; - } - } - } + if (d5) { + if (d3) { + if (d1) { + /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ + z2 = d5 + d3; + z4 = d5 + d1; + z5 = MULTIPLY(d3 + z4, FIX_1_175875602); + + tmp1 = MULTIPLY(d5, FIX_2_053119869); + tmp2 = MULTIPLY(d3, FIX_3_072711026); + tmp3 = MULTIPLY(d1, FIX_1_501321110); + z1 = MULTIPLY(-d1, FIX_0_899976223); + z2 = MULTIPLY(-z2, FIX_2_562915447); + z3 = MULTIPLY(-d3, FIX_1_961570560); + z4 = MULTIPLY(-z4, FIX_0_390180644); + + z3 += z5; + z4 += z5; + + tmp0 = z1 + z3; + tmp1 += z2 + z4; + tmp2 += z2 + z3; + tmp3 += z1 + z4; + } else { + /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ + z2 = d5 + d3; + + z5 = MULTIPLY(z2, FIX_1_175875602); + tmp1 = MULTIPLY(d5, FIX_1_662939225); + z4 = MULTIPLY(-d5, FIX_0_390180644); + z2 = MULTIPLY(-z2, FIX_1_387039845); + tmp2 = MULTIPLY(d3, FIX_1_111140466); + z3 = MULTIPLY(-d3, FIX_1_961570560); + + tmp0 = z3 + z5; + tmp1 += z2; + tmp2 += z2; + tmp3 = z4 + z5; + } + } else { + if (d1) { + /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ + z4 = d5 + d1; + + z5 = MULTIPLY(z4, FIX_1_175875602); + z1 = MULTIPLY(-d1, FIX_0_899976223); + tmp3 = MULTIPLY(d1, FIX_0_601344887); + tmp1 = MULTIPLY(-d5, FIX_0_509795579); + z2 = MULTIPLY(-d5, FIX_2_562915447); + z4 = MULTIPLY(z4, FIX_0_785694958); + + tmp0 = z1 + z5; + tmp1 += z4; + tmp2 = z2 + z5; + tmp3 += z4; + } else { + /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ + tmp0 = MULTIPLY(d5, FIX_1_175875602); + tmp1 = MULTIPLY(d5, FIX_0_275899380); + tmp2 = MULTIPLY(-d5, FIX_1_387039845); + tmp3 = MULTIPLY(d5, FIX_0_785694958); + } + } + } else { + if (d3) { + if (d1) { + /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ + z5 = d1 + d3; + tmp3 = MULTIPLY(d1, FIX_0_211164243); + tmp2 = MULTIPLY(-d3, FIX_1_451774981); + z1 = MULTIPLY(d1, FIX_1_061594337); + z2 = MULTIPLY(-d3, FIX_2_172734803); + z4 = MULTIPLY(z5, FIX_0_785694958); + z5 = MULTIPLY(z5, FIX_1_175875602); + + tmp0 = z1 - z4; + tmp1 = z2 + z4; + tmp2 += z5; + tmp3 += z5; + } else { + /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ + tmp0 = MULTIPLY(-d3, FIX_0_785694958); + tmp1 = MULTIPLY(-d3, FIX_1_387039845); + tmp2 = MULTIPLY(-d3, FIX_0_275899380); + tmp3 = MULTIPLY(d3, FIX_1_175875602); + } + } else { + if (d1) { + /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ + tmp0 = MULTIPLY(d1, FIX_0_275899380); + tmp1 = MULTIPLY(d1, FIX_0_785694958); + tmp2 = MULTIPLY(d1, FIX_1_175875602); + tmp3 = MULTIPLY(d1, FIX_1_387039845); + } else { + /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ + tmp0 = tmp1 = tmp2 = tmp3 = 0; + } + } + } } /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3, - CONST_BITS+PASS1_BITS+3); + CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3, - CONST_BITS+PASS1_BITS+3); + CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2, - CONST_BITS+PASS1_BITS+3); + CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2, - CONST_BITS+PASS1_BITS+3); + CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1, - CONST_BITS+PASS1_BITS+3); + CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1, - CONST_BITS+PASS1_BITS+3); + CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0, - CONST_BITS+PASS1_BITS+3); + CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0, - CONST_BITS+PASS1_BITS+3); - - dataptr++; /* advance pointer to next column */ + CONST_BITS+PASS1_BITS+3); + + dataptr++; /* advance pointer to next column */ } } @@ -1222,7 +1222,7 @@ static double itrans_coef[8][8]; void init_idctref() { /*---------------------------------------------------------------------------- - initialize DCT coefficient matrix + initialize DCT coefficient matrix -----------------------------------------------------------------------------*/ unsigned int freq; @@ -1258,7 +1258,7 @@ int16 *block; tmp[8*i+j] = partial_product; } - /* Transpose operation is integrated into address mapping by switching + /* Transpose operation is integrated into address mapping by switching loop order of i and j */ for (j=0; j<8; j++) diff --git a/converter/ppm/ppmtompeg/memory.c b/converter/ppm/ppmtompeg/memory.c index f117994a..0ebe4686 100644 --- a/converter/ppm/ppmtompeg/memory.c +++ b/converter/ppm/ppmtompeg/memory.c @@ -44,28 +44,28 @@ * */ -long totalMemory = 0; -long maxMemory = 0; +long totalMemory = 0; +long maxMemory = 0; -char *MemAlloc(size_t size) +char *MemAlloc(size_t size) { totalMemory += (long)size; if ( totalMemory > maxMemory ) { - maxMemory = totalMemory; + maxMemory = totalMemory; } return malloc(size); } -void MemFree(char *ptr, long bytes) +void MemFree(char *ptr, long bytes) { totalMemory -= bytes; free(ptr); } -void PrintMaxMemory(void) +void PrintMaxMemory(void) { fprintf(stdout, "MMMMM-----MAX MEMORY-----MMMMM = %ld\n", maxMemory); } diff --git a/converter/ppm/ppmtompeg/mfwddct.c b/converter/ppm/ppmtompeg/mfwddct.c index 9381e51c..8b379cd8 100644 --- a/converter/ppm/ppmtompeg/mfwddct.c +++ b/converter/ppm/ppmtompeg/mfwddct.c @@ -1,4 +1,3 @@ - /* * mfwddct.c (derived from jfwddct.c, which carries the following info) * @@ -51,10 +50,10 @@ #ifdef EIGHT_BIT_SAMPLES #define LG2_DCT_SCALE 16 #else -#define LG2_DCT_SCALE 15 /* lose a little precision to avoid overflow */ +#define LG2_DCT_SCALE 15 /* lose a little precision to avoid overflow */ #endif -#define ONE ((int32) 1) +#define ONE ((int32) 1) #define DCT_SCALE (ONE << LG2_DCT_SCALE) @@ -66,7 +65,7 @@ #define OVERSHIFT(x) ((x) <<= LG2_OVERSCALE) /* Scale a fractional constant by DCT_SCALE */ -#define FIX(x) ((int32) ((x) * DCT_SCALE + 0.5)) +#define FIX(x) ((int32) ((x) * DCT_SCALE + 0.5)) /* Scale a fractional constant by DCT_SCALE/OVERSCALE */ /* Such a constant can be multiplied with an overscaled input */ @@ -81,7 +80,7 @@ /* Take a value scaled by DCT_SCALE and round to integer scaled by OVERSCALE */ #define UNFIXO(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1-LG2_OVERSCALE)),\ - LG2_DCT_SCALE-LG2_OVERSCALE) + LG2_DCT_SCALE-LG2_OVERSCALE) /* Here are the constants we need */ /* SIN_i_j is sine of i*pi/j, scaled by DCT_SCALE */ @@ -162,11 +161,11 @@ Block block, dest; s += trans_coef[i][k] * tmp[8*k+j]; if (collect_quant) { - fprintf(collect_quant_fp, "%d %f\n", 8*i+j, s); - } + fprintf(collect_quant_fp, "%d %f\n", 8*i+j, s); + } if (DoLaplace) { - L1[LaplaceCnum][i*8+j] += s*s; - L2[LaplaceCnum][i*8+j] += s; + L1[LaplaceCnum][i*8+j] += s*s; + L2[LaplaceCnum][i*8+j] += s; } @@ -206,8 +205,8 @@ mp_fwd_dct_fast(data2d, dest2d) */ { - int16 *data = (int16 *) data2d; /* this algorithm wants - * a 1-d array */ + int16 *data = (int16 *) data2d; /* this algorithm wants + * a 1-d array */ int16 *dest = (int16 *) dest2d; int pass, rowctr; register int16 *inptr, *outptr; @@ -216,15 +215,15 @@ mp_fwd_dct_fast(data2d, dest2d) #ifdef ndef { - int y; - - printf("fwd_dct (beforehand):\n"); - for (y = 0; y < 8; y++) - printf("%4d %4d %4d %4d %4d %4d %4d %4d\n", - data2d[y][0], data2d[y][1], - data2d[y][2], data2d[y][3], - data2d[y][4], data2d[y][5], - data2d[y][6], data2d[y][7]); + int y; + + printf("fwd_dct (beforehand):\n"); + for (y = 0; y < 8; y++) + printf("%4d %4d %4d %4d %4d %4d %4d %4d\n", + data2d[y][0], data2d[y][1], + data2d[y][2], data2d[y][3], + data2d[y][4], data2d[y][5], + data2d[y][6], data2d[y][7]); } #endif @@ -238,90 +237,90 @@ mp_fwd_dct_fast(data2d, dest2d) * array indexing. */ - inptr = data; /* initialize pointers for first pass */ + inptr = data; /* initialize pointers for first pass */ outptr = workspace; for (pass = 1; pass >= 0; pass--) { - for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) { - /* - * many tmps have nonoverlapping lifetime -- flashy - * register colorers should be able to do this lot - * very well - */ - int32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - int32 tmp10, tmp11, tmp12, tmp13; - int32 tmp14, tmp15, tmp16, tmp17; - int32 tmp25, tmp26; - /* SHIFT_TEMPS */ - - /* temp0 through tmp7: -512 to +512 */ - /* if I-block, then -256 to +256 */ - tmp0 = inptr[7] + inptr[0]; - tmp1 = inptr[6] + inptr[1]; - tmp2 = inptr[5] + inptr[2]; - tmp3 = inptr[4] + inptr[3]; - tmp4 = inptr[3] - inptr[4]; - tmp5 = inptr[2] - inptr[5]; - tmp6 = inptr[1] - inptr[6]; - tmp7 = inptr[0] - inptr[7]; - - /* tmp10 through tmp13: -1024 to +1024 */ - /* if I-block, then -512 to +512 */ - tmp10 = tmp3 + tmp0; - tmp11 = tmp2 + tmp1; - tmp12 = tmp1 - tmp2; - tmp13 = tmp0 - tmp3; - - outptr[0] = (int16) UNFIXH((tmp10 + tmp11) * SIN_1_4); - outptr[DCTSIZE * 4] = + for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) { + /* + * many tmps have nonoverlapping lifetime -- flashy + * register colorers should be able to do this lot + * very well + */ + int32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + int32 tmp10, tmp11, tmp12, tmp13; + int32 tmp14, tmp15, tmp16, tmp17; + int32 tmp25, tmp26; + /* SHIFT_TEMPS */ + + /* temp0 through tmp7: -512 to +512 */ + /* if I-block, then -256 to +256 */ + tmp0 = inptr[7] + inptr[0]; + tmp1 = inptr[6] + inptr[1]; + tmp2 = inptr[5] + inptr[2]; + tmp3 = inptr[4] + inptr[3]; + tmp4 = inptr[3] - inptr[4]; + tmp5 = inptr[2] - inptr[5]; + tmp6 = inptr[1] - inptr[6]; + tmp7 = inptr[0] - inptr[7]; + + /* tmp10 through tmp13: -1024 to +1024 */ + /* if I-block, then -512 to +512 */ + tmp10 = tmp3 + tmp0; + tmp11 = tmp2 + tmp1; + tmp12 = tmp1 - tmp2; + tmp13 = tmp0 - tmp3; + + outptr[0] = (int16) UNFIXH((tmp10 + tmp11) * SIN_1_4); + outptr[DCTSIZE * 4] = (int16) UNFIXH((tmp10 - tmp11) * COS_1_4); - outptr[DCTSIZE * 2] = + outptr[DCTSIZE * 2] = (int16) UNFIXH(tmp13 * COS_1_8 + tmp12 * SIN_1_8); - outptr[DCTSIZE * 6] = + outptr[DCTSIZE * 6] = (int16) UNFIXH(tmp13 * SIN_1_8 - tmp12 * COS_1_8); - tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4); - tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4); + tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4); + tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4); - OVERSHIFT(tmp4); - OVERSHIFT(tmp7); + OVERSHIFT(tmp4); + OVERSHIFT(tmp7); - /* - * tmp4, tmp7, tmp15, tmp16 are overscaled by - * OVERSCALE - */ + /* + * tmp4, tmp7, tmp15, tmp16 are overscaled by + * OVERSCALE + */ - tmp14 = tmp4 + tmp15; - tmp25 = tmp4 - tmp15; - tmp26 = tmp7 - tmp16; - tmp17 = tmp7 + tmp16; + tmp14 = tmp4 + tmp15; + tmp25 = tmp4 - tmp15; + tmp26 = tmp7 - tmp16; + tmp17 = tmp7 + tmp16; - outptr[DCTSIZE] = + outptr[DCTSIZE] = (int16) UNFIXH(tmp17 * OCOS_1_16 + tmp14 * OSIN_1_16); - outptr[DCTSIZE * 7] = + outptr[DCTSIZE * 7] = (int16) UNFIXH(tmp17 * OCOS_7_16 - tmp14 * OSIN_7_16); - outptr[DCTSIZE * 5] = + outptr[DCTSIZE * 5] = (int16) UNFIXH(tmp26 * OCOS_5_16 + tmp25 * OSIN_5_16); - outptr[DCTSIZE * 3] = + outptr[DCTSIZE * 3] = (int16) UNFIXH(tmp26 * OCOS_3_16 - tmp25 * OSIN_3_16); - inptr += DCTSIZE; /* advance inptr to next row */ - outptr++; /* advance outptr to next column */ - } - /* end of pass; in case it was pass 1, set up for pass 2 */ - inptr = workspace; - outptr = dest; + inptr += DCTSIZE; /* advance inptr to next row */ + outptr++; /* advance outptr to next column */ + } + /* end of pass; in case it was pass 1, set up for pass 2 */ + inptr = workspace; + outptr = dest; } #ifdef ndef { - int y; - - printf("fwd_dct (afterward):\n"); - for (y = 0; y < 8; y++) - printf("%4d %4d %4d %4d %4d %4d %4d %4d\n", - dest2d[y][0], dest2d[y][1], - dest2d[y][2], dest2d[y][3], - dest2d[y][4], dest2d[y][5], - dest2d[y][6], dest2d[y][7]); + int y; + + printf("fwd_dct (afterward):\n"); + for (y = 0; y < 8; y++) + printf("%4d %4d %4d %4d %4d %4d %4d %4d\n", + dest2d[y][0], dest2d[y][1], + dest2d[y][2], dest2d[y][3], + dest2d[y][4], dest2d[y][5], + dest2d[y][6], dest2d[y][7]); } #endif } diff --git a/converter/ppm/ppmtompeg/mheaders.c b/converter/ppm/ppmtompeg/mheaders.c index 98e1b063..7e5db6c1 100644 --- a/converter/ppm/ppmtompeg/mheaders.c +++ b/converter/ppm/ppmtompeg/mheaders.c @@ -1,17 +1,17 @@ /*===========================================================================* - * mheaders.c * - * * - * Procedures to generate MPEG headers * - * * - * EXPORTED PROCEDURES: * - * Mhead_GenPictureHeader * - * Mhead_GenSequenceHeader * - * Mhead_GenSequenceEnder * - * Mhead_GenGOPHeader * - * Mhead_GenSliceHeader * - * Mhead_GenSliceEnder * - * Mhead_GenMBHeader * - * * + * mheaders.c * + * * + * Procedures to generate MPEG headers * + * * + * EXPORTED PROCEDURES: * + * Mhead_GenPictureHeader * + * Mhead_GenSequenceHeader * + * Mhead_GenSequenceEnder * + * Mhead_GenGOPHeader * + * Mhead_GenSliceHeader * + * Mhead_GenSliceEnder * + * Mhead_GenMBHeader * + * * *===========================================================================*/ /* @@ -254,7 +254,7 @@ static uint32 mbPatTable[][2] = { {0x4, 8}, {0x4, 9}, {0x7, 3}, - {0xa, 5}, /* grrr... 61, 62, 63 added - Kevin */ + {0xa, 5}, /* grrr... 61, 62, 63 added - Kevin */ {0x8, 5}, {0xc, 6} }; @@ -270,9 +270,9 @@ static uint32 mbPatTable[][2] = { #define PICT_START_CODE 0x00000100 #define SLICE_BASE_CODE 0x00000100 -#define SEQ_END_CODE 0x000001b7 +#define SEQ_END_CODE 0x000001b7 -/* not static anymore because information is used for computing frame rate +/* not static anymore because information is used for computing frame rate * and for statistics */ const double VidRateNum[9]={1.0, 23.976, 24.0, 25.0, 29.97, 30.0, 50.0 ,59.94, 60.0}; @@ -286,10 +286,10 @@ const double VidRateNum[9]={1.0, 23.976, 24.0, 25.0, 29.97, 30.0, * * GenMBType * - * generate macroblock type with given attributes - * append result to the specified bitstream + * generate macroblock type with given attributes + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -433,10 +433,10 @@ GenMBType(bbPtr, pict_code_type, mb_quant, motion_forw, motion_back, * * GenMotionCode * - * generate motion vector output with given value - * append result to the specified bitstream + * generate motion vector output with given value + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -463,10 +463,10 @@ GenMotionCode(BitBucket * const bbPtr, * * GenBlockPattern * - * generate macroblock pattern output - * append result to the specified bitstream + * generate macroblock pattern output + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -489,10 +489,10 @@ GenBlockPattern(bbPtr, mb_pattern) * * GenMBAddrIncr * - * generate macroblock address increment output - * append result to the specified bitstream + * generate macroblock address increment output + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -516,10 +516,10 @@ GenMBAddrIncr(bbPtr, addr_incr) * * GenPictHead * - * generate picture header with given attributes - * append result to the specified bitstream + * generate picture header with given attributes + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -557,7 +557,7 @@ GenPictHead(bbPtr, temp_ref, code_type, vbv_delay, full_pel_forw_flag, Bitio_Write(bbPtr, code_type, 3); /* vbv_delay. */ - vbv_delay = 0xffff; /* see page 36 (section 2.4.3.4) */ + vbv_delay = 0xffff; /* see page 36 (section 2.4.3.4) */ Bitio_Write(bbPtr, vbv_delay, 16); if ((code_type == 2) || (code_type == 3)) { @@ -633,9 +633,9 @@ GenPictHead(bbPtr, temp_ref, code_type, vbv_delay, full_pel_forw_flag, * * SetGOPStartTime * - * sets the start frame of the GOP; to be used with GenPictureHeader + * sets the start frame of the GOP; to be used with GenPictureHeader * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -653,10 +653,10 @@ SetGOPStartTime(index) * * Mhead_GenPictureHeader * - * generate picture header with given frame type and picture count - * append result to the specified bitstream + * generate picture header with given frame type and picture count + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -668,23 +668,23 @@ Mhead_GenPictureHeader(bbPtr, frameType, pictCount, f_code) int pictCount; int f_code; { - int temporalRef; + int temporalRef; if ( pictCount >= gopStartFrame ) { - temporalRef = (pictCount-gopStartFrame); + temporalRef = (pictCount-gopStartFrame); } else { - temporalRef = (pictCount-lastGOPStart); + temporalRef = (pictCount-lastGOPStart); } temporalRef = (temporalRef % 1024); - + DBG_PRINT(("Picture Header\n")); GenPictHead(bbPtr, temporalRef, frameType, - 0 /* vbv_delay */, - pixelFullSearch /* full_pel_forw_flag */, - f_code /* forw_f_code */, - pixelFullSearch /* full_pel_back_flag */, - f_code /* back_f_code */, - NULL, 0, NULL, 0, NULL, 0); + 0 /* vbv_delay */, + pixelFullSearch /* full_pel_forw_flag */, + f_code /* forw_f_code */, + pixelFullSearch /* full_pel_back_flag */, + f_code /* back_f_code */, + NULL, 0, NULL, 0, NULL, 0); } @@ -692,27 +692,27 @@ Mhead_GenPictureHeader(bbPtr, frameType, pictCount, f_code) * * Mhead_GenSequenceHeader * - * generate sequence header with given attributes - * append result to the specified bitstream + * generate sequence header with given attributes + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * *===========================================================================*/ void -Mhead_GenSequenceHeader(BitBucket * const bbPtr, - uint32 const hsize, +Mhead_GenSequenceHeader(BitBucket * const bbPtr, + uint32 const hsize, uint32 const vsize, - int32 const pratio, - int32 const pict_rate, + int32 const pratio, + int32 const pict_rate, int32 const bit_rate_arg, - int32 const buf_size_arg, - int32 const c_param_flag_arg, - const int32 * const iq_matrix, + int32 const buf_size_arg, + int32 const c_param_flag_arg, + const int32 * const iq_matrix, const int32 * const niq_matrix, - uint8 * const ext_data, - int32 const ext_data_size, + uint8 * const ext_data, + int32 const ext_data_size, uint8 * const user_data, int32 const user_data_size) { @@ -774,7 +774,7 @@ Mhead_GenSequenceHeader(BitBucket * const bbPtr, buf_size = buf_size_arg; buf_size = (buf_size + (16*1024 - 1)) / (16*1024); - if (buf_size>=0x400) + if (buf_size>=0x400) buf_size=0x3ff; Bitio_Write(bbPtr, buf_size, 10); @@ -853,10 +853,10 @@ Mhead_GenSequenceHeader(BitBucket * const bbPtr, * * Mhead_GenSequenceEnder * - * generate sequence ender - * append result to the specified bitstream + * generate sequence ender + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -873,18 +873,18 @@ Mhead_GenSequenceEnder(bbPtr) * * Mhead_GenGOPHeader * - * generate GOP header with specified attributes - * append result to the specified bitstream + * generate GOP header with specified attributes + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * *===========================================================================*/ void Mhead_GenGOPHeader(bbPtr, drop_frame_flag, tc_hrs, tc_min, tc_sec, tc_pict, - closed_gop, broken_link, ext_data, ext_data_size, - user_data, user_data_size) + closed_gop, broken_link, ext_data, ext_data_size, + user_data, user_data_size) BitBucket *bbPtr; int32 drop_frame_flag; int32 tc_hrs; @@ -903,13 +903,13 @@ Mhead_GenGOPHeader(bbPtr, drop_frame_flag, tc_hrs, tc_min, tc_sec, tc_pict, /* Write gop start code. */ Bitio_Write(bbPtr, GOP_START_CODE, 32); - /* Construct and write timecode. */ + /* Construct and write timecode. */ /* Drop frame flag. */ if (drop_frame_flag) { - Bitio_Write(bbPtr, 0x01, 1); + Bitio_Write(bbPtr, 0x01, 1); } else { - Bitio_Write(bbPtr, 0x00, 1); + Bitio_Write(bbPtr, 0x00, 1); } /* Time code hours. */ @@ -930,16 +930,16 @@ Mhead_GenGOPHeader(bbPtr, drop_frame_flag, tc_hrs, tc_min, tc_sec, tc_pict, /* Closed gop flag. */ if (closed_gop) { - Bitio_Write(bbPtr, 0x01, 1); + Bitio_Write(bbPtr, 0x01, 1); } else { - Bitio_Write(bbPtr, 0x00, 1); + Bitio_Write(bbPtr, 0x00, 1); } /* Broken link flag. */ if (broken_link) { - Bitio_Write(bbPtr, 0x01, 1); + Bitio_Write(bbPtr, 0x01, 1); } else { - Bitio_Write(bbPtr, 0x00, 1); + Bitio_Write(bbPtr, 0x00, 1); } /* next start code */ @@ -948,21 +948,21 @@ Mhead_GenGOPHeader(bbPtr, drop_frame_flag, tc_hrs, tc_min, tc_sec, tc_pict, /* Write ext data if present. */ if (ext_data != NULL) { - Bitio_Write(bbPtr, EXT_START_CODE, 32); + Bitio_Write(bbPtr, EXT_START_CODE, 32); - for (i = 0; i < ext_data_size; i++) { - Bitio_Write(bbPtr, ext_data[i], 8); - } - Bitio_BytePad(bbPtr); + for (i = 0; i < ext_data_size; i++) { + Bitio_Write(bbPtr, ext_data[i], 8); + } + Bitio_BytePad(bbPtr); } /* Write user data if present. */ if (user_data != NULL) { - Bitio_Write(bbPtr, USER_START_CODE, 32); + Bitio_Write(bbPtr, USER_START_CODE, 32); - for (i = 0; i < user_data_size; i++) { - Bitio_Write(bbPtr, user_data[i], 8); - } - Bitio_BytePad(bbPtr); + for (i = 0; i < user_data_size; i++) { + Bitio_Write(bbPtr, user_data[i], 8); + } + Bitio_BytePad(bbPtr); } } @@ -971,10 +971,10 @@ Mhead_GenGOPHeader(bbPtr, drop_frame_flag, tc_hrs, tc_min, tc_sec, tc_pict, * * Mhead_GenSliceHeader * - * generate slice header with specified attributes - * append result to the specified bitstream + * generate slice header with specified attributes + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -999,10 +999,10 @@ Mhead_GenSliceHeader(bbPtr, verticalPos, qscale, extra_info, extra_info_size) /* Extra bit slice info. */ if (extra_info != NULL) { - for (i = 0; i < extra_info_size; i++) { - Bitio_Write(bbPtr, 0x01, 1); - Bitio_Write(bbPtr, extra_info[i], 8); - } + for (i = 0; i < extra_info_size; i++) { + Bitio_Write(bbPtr, 0x01, 1); + Bitio_Write(bbPtr, extra_info[i], 8); + } } /* extra_bit_slice */ @@ -1014,10 +1014,10 @@ Mhead_GenSliceHeader(bbPtr, verticalPos, qscale, extra_info, extra_info_size) * * Mhead_GenSliceEnder * - * generate slice ender - * append result to the specified bitstream + * generate slice ender + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -1034,20 +1034,20 @@ Mhead_GenSliceEnder(bbPtr) * * Mhead_GenMBHeader * - * generate macroblock header with given attributes - * append result to the specified bitstream + * generate macroblock header with given attributes + * append result to the specified bitstream * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * *===========================================================================*/ void Mhead_GenMBHeader(bbPtr, pict_code_type, addr_incr, q_scale, - forw_f_code, back_f_code, horiz_forw_r, vert_forw_r, - horiz_back_r, vert_back_r, motion_forw, m_horiz_forw, - m_vert_forw, motion_back, m_horiz_back, m_vert_back, - mb_pattern, mb_intra) + forw_f_code, back_f_code, horiz_forw_r, vert_forw_r, + horiz_back_r, vert_back_r, motion_forw, m_horiz_forw, + m_vert_forw, motion_back, m_horiz_back, m_vert_back, + mb_pattern, mb_intra) BitBucket *bbPtr; uint32 pict_code_type; uint32 addr_incr; @@ -1077,8 +1077,8 @@ if ( addr_incr != 1 ) #endif while (addr_incr > 33) { - Bitio_Write(bbPtr, 0x008, 11); - addr_incr -= 33; + Bitio_Write(bbPtr, 0x008, 11); + addr_incr -= 33; } /* Generate addr incr code. */ @@ -1098,62 +1098,62 @@ if ( addr_incr != 1 ) /* MB quant. */ if (mb_quant) { - Bitio_Write(bbPtr, q_scale, 5); + Bitio_Write(bbPtr, q_scale, 5); } /* Forward predictive vector stuff. */ if (motion_forw) { - int forw_f, forw_r_size; - - forw_r_size = forw_f_code - 1; - forw_f = 1 << forw_r_size; /* 1 > 0 */ - if ((m_horiz_forw > 16*forw_f-1) || (m_horiz_forw < -16*forw_f)) { - fprintf(stderr, "Illegal motion? %d %d\n", m_horiz_forw, 16*forw_f); - } - if ((m_vert_forw > 16*forw_f-1) || (m_vert_forw < -16*forw_f)) { - fprintf(stderr, "Illegal motion? %d %d\n", m_vert_forw, 16*forw_f); - } - GenMotionCode(bbPtr, m_horiz_forw); - - if ((forw_f != 1) && (m_horiz_forw != 0)) { - Bitio_Write(bbPtr, horiz_forw_r, forw_r_size); - } - GenMotionCode(bbPtr, m_vert_forw); - - if ((forw_f != 1) && (m_vert_forw != 0)) { - Bitio_Write(bbPtr, vert_forw_r, forw_r_size); - } + int forw_f, forw_r_size; + + forw_r_size = forw_f_code - 1; + forw_f = 1 << forw_r_size; /* 1 > 0 */ + if ((m_horiz_forw > 16*forw_f-1) || (m_horiz_forw < -16*forw_f)) { + fprintf(stderr, "Illegal motion? %d %d\n", m_horiz_forw, 16*forw_f); + } + if ((m_vert_forw > 16*forw_f-1) || (m_vert_forw < -16*forw_f)) { + fprintf(stderr, "Illegal motion? %d %d\n", m_vert_forw, 16*forw_f); + } + GenMotionCode(bbPtr, m_horiz_forw); + + if ((forw_f != 1) && (m_horiz_forw != 0)) { + Bitio_Write(bbPtr, horiz_forw_r, forw_r_size); + } + GenMotionCode(bbPtr, m_vert_forw); + + if ((forw_f != 1) && (m_vert_forw != 0)) { + Bitio_Write(bbPtr, vert_forw_r, forw_r_size); + } } /* Back predicted vector stuff. */ if (motion_back) { - int back_f, back_r_size; + int back_f, back_r_size; - back_r_size = back_f_code - 1; - back_f = 1 << back_r_size; /* 1 > 0 */ + back_r_size = back_f_code - 1; + back_f = 1 << back_r_size; /* 1 > 0 */ - if ((m_horiz_back > 16*back_f-1) || (m_horiz_back < -16*back_f)) { - fprintf(stderr, "Illegal motion? %d %d\n", m_horiz_back, 16*back_f); - } - if ((m_vert_back > 16*back_f-1) || (m_vert_back < -16*back_f)) { - fprintf(stderr, "Illegal motion? %d %d\n", m_vert_back, 16*back_f); - } + if ((m_horiz_back > 16*back_f-1) || (m_horiz_back < -16*back_f)) { + fprintf(stderr, "Illegal motion? %d %d\n", m_horiz_back, 16*back_f); + } + if ((m_vert_back > 16*back_f-1) || (m_vert_back < -16*back_f)) { + fprintf(stderr, "Illegal motion? %d %d\n", m_vert_back, 16*back_f); + } - GenMotionCode(bbPtr, m_horiz_back); + GenMotionCode(bbPtr, m_horiz_back); - if ((back_f != 1) && (m_horiz_back != 0)) { - Bitio_Write(bbPtr, horiz_back_r, back_r_size); - } - GenMotionCode(bbPtr, m_vert_back); + if ((back_f != 1) && (m_horiz_back != 0)) { + Bitio_Write(bbPtr, horiz_back_r, back_r_size); + } + GenMotionCode(bbPtr, m_vert_back); - if ((back_f != 1) && (m_vert_back != 0)) { - Bitio_Write(bbPtr, vert_back_r, back_r_size); - } + if ((back_f != 1) && (m_vert_back != 0)) { + Bitio_Write(bbPtr, vert_back_r, back_r_size); + } } /* MB pattern. */ if (mb_pattern) { - GenBlockPattern(bbPtr, mb_pattern); + GenBlockPattern(bbPtr, mb_pattern); } } diff --git a/converter/ppm/ppmtompeg/moutput.c b/converter/ppm/ppmtompeg/moutput.c index b682efab..765a2b6f 100644 --- a/converter/ppm/ppmtompeg/moutput.c +++ b/converter/ppm/ppmtompeg/moutput.c @@ -1,13 +1,13 @@ /*===========================================================================* - * moutput.c * - * * - * Procedures concerned with quantization and RLE * - * * - * EXPORTED PROCEDURES: * - * mp_quant_zig_block * - * mp_rle_huff_block * - * mp_rle_huff_pblock * - * * + * moutput.c * + * * + * Procedures concerned with quantization and RLE * + * * + * EXPORTED PROCEDURES: * + * mp_quant_zig_block * + * mp_rle_huff_block * + * mp_rle_huff_pblock * + * * *===========================================================================*/ /* @@ -121,48 +121,48 @@ static int qtable[] = *=====================*/ -void UnQuantZig(FlatBlock in, Block out, int qscale, boolean iblock) +void UnQuantZig(FlatBlock in, Block out, int qscale, boolean iblock) { register int index; - int start; - int position; - register int qentry; - int level, coeff; + int start; + int position; + register int qentry; + int level, coeff; register int16 temp; if ( iblock ) { - ((int16 *)out)[0] = (int16)(in[0]*qtable[0]); + ((int16 *)out)[0] = (int16)(in[0]*qtable[0]); - start = 1; + start = 1; } else - start = 0; + start = 0; for ( index = start; index < DCTSIZE_SQ; index++ ) { - position = ZAG[index]; + position = ZAG[index]; - if (iblock) - qentry = qtable[position] * qscale; - else - qentry = 16 * qscale; + if (iblock) + qentry = qtable[position] * qscale; + else + qentry = 16 * qscale; - level = in[index]; + level = in[index]; coeff = (level * qentry) >> 3; if (level < 0) { coeff += (coeff & 1); - } else { + } else { coeff -= (coeff & 1); - } + } - ((int16 *)out)[position] = coeff; + ((int16 *)out)[position] = coeff; } #ifdef BLEAH for ( index = 0; index < 64; index++ ) - fprintf(stdout, "DCT[%d] = %d\n", index, - ((int16 *)out)[index]); + fprintf(stdout, "DCT[%d] = %d\n", index, + ((int16 *)out)[index]); #endif } @@ -175,7 +175,7 @@ void UnQuantZig(FlatBlock in, Block out, int qscale, boolean iblock) * Quantizes and zigzags a block -- removing information * * Results: TRUE iff resulting 'out' is non-zero, FALSE if all - * zero + * zero * * Side effects: Modifies the out block. * @@ -192,56 +192,56 @@ boolean mp_quant_zig_block(Block in, FlatBlock out, int qscale, int iblock) DBG_PRINT(("mp_quant_zig_block...\n")); if (iblock) { - /* - * the DC coefficient is handled specially -- it's not - * sensitive to qscale, but everything else is - */ - temp = ((int16 *) in)[ZAG[0]]; - qentry = qtable[ZAG[0]]; - if (temp < 0) { - temp = -temp; - temp += qentry >> 1; - temp /= qentry; - temp = -temp; - } else { - temp += qentry >> 1; - temp /= qentry; - } - if ( temp != 0 ) - nonZero = TRUE; - out[0] = temp; - start = 1; + /* + * the DC coefficient is handled specially -- it's not + * sensitive to qscale, but everything else is + */ + temp = ((int16 *) in)[ZAG[0]]; + qentry = qtable[ZAG[0]]; + if (temp < 0) { + temp = -temp; + temp += qentry >> 1; + temp /= qentry; + temp = -temp; + } else { + temp += qentry >> 1; + temp /= qentry; + } + if ( temp != 0 ) + nonZero = TRUE; + out[0] = temp; + start = 1; } else - start = 0; + start = 0; for (i = start; i < DCTSIZE_SQ; i++) { - x = ZAG[i] % 8; - y = ZAG[i] / 8; - temp = in[y][x]; - DBG_PRINT((" in[%d][%d] = %d; ", y, x, temp)); - - if (iblock) - qentry = qtable[ZAG[i]] * qscale; - else - qentry = 16 * qscale; - - DBG_PRINT(("quantized with %d = ", qentry)); - - if (temp < 0) { - temp = -temp; - temp *= 8; - temp += qentry >> 1; - temp /= qentry; - temp = -temp; - } else { - temp *= 8; - temp += qentry >> 1; - temp /= qentry; - } - if ( temp != 0 ) - nonZero = TRUE; - out[i] = temp; - DBG_PRINT(("%d\n", temp)); + x = ZAG[i] % 8; + y = ZAG[i] / 8; + temp = in[y][x]; + DBG_PRINT((" in[%d][%d] = %d; ", y, x, temp)); + + if (iblock) + qentry = qtable[ZAG[i]] * qscale; + else + qentry = 16 * qscale; + + DBG_PRINT(("quantized with %d = ", qentry)); + + if (temp < 0) { + temp = -temp; + temp *= 8; + temp += qentry >> 1; + temp /= qentry; + temp = -temp; + } else { + temp *= 8; + temp += qentry >> 1; + temp /= qentry; + } + if ( temp != 0 ) + nonZero = TRUE; + out[i] = temp; + DBG_PRINT(("%d\n", temp)); } return nonZero; @@ -263,7 +263,7 @@ boolean mp_quant_zig_block(Block in, FlatBlock out, int qscale, int iblock) * -------------------------------------------------------------- */ -void mp_rle_huff_block(FlatBlock in, BitBucket *out) +void mp_rle_huff_block(FlatBlock in, BitBucket *out) { register int i; register int nzeros = 0; @@ -277,61 +277,61 @@ void mp_rle_huff_block(FlatBlock in, BitBucket *out) * specially, elsewhere. Not here. */ for (i = 1; i < DCTSIZE_SQ; i++) { - cur = in[i]; - acur = ABS(cur); - if (cur) { - if (nzeros < HUFF_MAXRUN && acur < huff_maxlevel[nzeros]) { - /* - * encode using the Huffman tables - */ - - DBG_PRINT(("rle_huff %02d: Run %02d, Level %02d\n", i, nzeros, cur)); - assert(cur); - - code = (huff_table[nzeros])[acur]; - nbits = (huff_bits[nzeros])[acur]; - - assert(nbits); - - if (cur < 0) - code |= 1; /* the sign bit */ - Bitio_Write(out, code, nbits); - } else { - /* - * encode using the escape code - */ - DBG_PRINT(("Escape\n")); - Bitio_Write(out, 0x1, 6); /* ESCAPE */ - DBG_PRINT(("Run Length\n")); - Bitio_Write(out, nzeros, 6); /* Run-Length */ - - assert(cur != 0); - - /* - * this shouldn't happen, but the other - * choice is to bomb out and dump core... - */ - if (cur < -255) - cur = -255; - else if (cur > 255) - cur = 255; - - DBG_PRINT(("Level\n")); - if (acur < 128) { - Bitio_Write(out, cur, 8); - } else { - if (cur < 0) { - Bitio_Write(out, 0x8001 + cur + 255, 16); - } else - Bitio_Write(out, cur, 16); - } - } - nzeros = 0; - } else - nzeros++; + cur = in[i]; + acur = ABS(cur); + if (cur) { + if (nzeros < HUFF_MAXRUN && acur < huff_maxlevel[nzeros]) { + /* + * encode using the Huffman tables + */ + + DBG_PRINT(("rle_huff %02d: Run %02d, Level %02d\n", i, nzeros, cur)); + assert(cur); + + code = (huff_table[nzeros])[acur]; + nbits = (huff_bits[nzeros])[acur]; + + assert(nbits); + + if (cur < 0) + code |= 1; /* the sign bit */ + Bitio_Write(out, code, nbits); + } else { + /* + * encode using the escape code + */ + DBG_PRINT(("Escape\n")); + Bitio_Write(out, 0x1, 6); /* ESCAPE */ + DBG_PRINT(("Run Length\n")); + Bitio_Write(out, nzeros, 6); /* Run-Length */ + + assert(cur != 0); + + /* + * this shouldn't happen, but the other + * choice is to bomb out and dump core... + */ + if (cur < -255) + cur = -255; + else if (cur > 255) + cur = 255; + + DBG_PRINT(("Level\n")); + if (acur < 128) { + Bitio_Write(out, cur, 8); + } else { + if (cur < 0) { + Bitio_Write(out, 0x8001 + cur + 255, 16); + } else + Bitio_Write(out, cur, 16); + } + } + nzeros = 0; + } else + nzeros++; } DBG_PRINT(("End of block\n")); - Bitio_Write(out, 0x2, 2); /* end of block marker */ + Bitio_Write(out, 0x2, 2); /* end of block marker */ } @@ -349,7 +349,7 @@ void mp_rle_huff_block(FlatBlock in, BitBucket *out) * -------------------------------------------------------------- */ -void mp_rle_huff_pblock(FlatBlock in, BitBucket *out) +void mp_rle_huff_pblock(FlatBlock in, BitBucket *out) { register int i; register int nzeros = 0; @@ -363,80 +363,80 @@ void mp_rle_huff_pblock(FlatBlock in, BitBucket *out) * yes, Virginia, we start at 0. */ for (i = 0; i < DCTSIZE_SQ; i++) { - cur = in[i]; - acur = ABS(cur); - if (cur) { - if (nzeros < HUFF_MAXRUN && acur < huff_maxlevel[nzeros]) { - /* - * encode using the Huffman tables - */ - - DBG_PRINT(("rle_huff %02d: Run %02d, Level %02d\n", i, nzeros, cur)); - assert(cur); - - if ( first_dct && (nzeros == 0) && (acur == 1) ) - { - /* actually, only needs = 0x2 */ - code = (cur == 1) ? 0x2 : 0x3; - nbits = 2; - } - else - { - code = (huff_table[nzeros])[acur]; - nbits = (huff_bits[nzeros])[acur]; - } - - assert(nbits); - - if (cur < 0) - code |= 1; /* the sign bit */ - Bitio_Write(out, code, nbits); - first_dct = FALSE; - } else { - /* - * encode using the escape code - */ - DBG_PRINT(("Escape\n")); - Bitio_Write(out, 0x1, 6); /* ESCAPE */ - DBG_PRINT(("Run Length\n")); - Bitio_Write(out, nzeros, 6); /* Run-Length */ - - assert(cur != 0); - - /* - * this shouldn't happen, but the other - * choice is to bomb out and dump core... - */ - if (cur < -255) - cur = -255; - else if (cur > 255) - cur = 255; - - DBG_PRINT(("Level\n")); - if (acur < 128) { - Bitio_Write(out, cur, 8); - } else { - if (cur < 0) { - Bitio_Write(out, 0x8001 + cur + 255, 16); - } else - Bitio_Write(out, cur, 16); - } - - first_dct = FALSE; - } - nzeros = 0; - } else - nzeros++; + cur = in[i]; + acur = ABS(cur); + if (cur) { + if (nzeros < HUFF_MAXRUN && acur < huff_maxlevel[nzeros]) { + /* + * encode using the Huffman tables + */ + + DBG_PRINT(("rle_huff %02d: Run %02d, Level %02d\n", i, nzeros, cur)); + assert(cur); + + if ( first_dct && (nzeros == 0) && (acur == 1) ) + { + /* actually, only needs = 0x2 */ + code = (cur == 1) ? 0x2 : 0x3; + nbits = 2; + } + else + { + code = (huff_table[nzeros])[acur]; + nbits = (huff_bits[nzeros])[acur]; + } + + assert(nbits); + + if (cur < 0) + code |= 1; /* the sign bit */ + Bitio_Write(out, code, nbits); + first_dct = FALSE; + } else { + /* + * encode using the escape code + */ + DBG_PRINT(("Escape\n")); + Bitio_Write(out, 0x1, 6); /* ESCAPE */ + DBG_PRINT(("Run Length\n")); + Bitio_Write(out, nzeros, 6); /* Run-Length */ + + assert(cur != 0); + + /* + * this shouldn't happen, but the other + * choice is to bomb out and dump core... + */ + if (cur < -255) + cur = -255; + else if (cur > 255) + cur = 255; + + DBG_PRINT(("Level\n")); + if (acur < 128) { + Bitio_Write(out, cur, 8); + } else { + if (cur < 0) { + Bitio_Write(out, 0x8001 + cur + 255, 16); + } else + Bitio_Write(out, cur, 16); + } + + first_dct = FALSE; + } + nzeros = 0; + } else + nzeros++; } /* actually, should REALLY return FALSE and not use this! */ - if ( first_dct ) /* have to give a first_dct even if all 0's */ + if ( first_dct ) /* have to give a first_dct even if all 0's */ { - fprintf(stdout, "HUFF called with all-zero coefficients\n"); - fprintf(stdout, "exiting...\n"); - exit(1); + fprintf(stdout, "HUFF called with all-zero coefficients\n"); + fprintf(stdout, "exiting...\n"); + exit(1); } DBG_PRINT(("End of block\n")); - Bitio_Write(out, 0x2, 2); /* end of block marker */ + Bitio_Write(out, 0x2, 2); /* end of block marker */ } diff --git a/converter/ppm/ppmtompeg/mquant.c b/converter/ppm/ppmtompeg/mquant.c index 1f8ca63a..99b1cb8e 100644 --- a/converter/ppm/ppmtompeg/mquant.c +++ b/converter/ppm/ppmtompeg/mquant.c @@ -17,14 +17,14 @@ static int qtable[][8] = { * * mp_quant_block -- * - * Quantizes a block -- removing information - * It's safe for out == in. + * Quantizes a block -- removing information + * It's safe for out == in. * * Results: - * None. + * None. * * Side effects: - * Modifies the out block. + * Modifies the out block. * *-------------------------------------------------------------- */ @@ -32,13 +32,13 @@ void mp_quant_block(Block in, Block out) { int i; for(i=0;i<8;i++) { - out[i][0] = in[i][0] / qtable[i][0]; - out[i][1] = in[i][1] / qtable[i][1]; - out[i][2] = in[i][2] / qtable[i][2]; - out[i][3] = in[i][3] / qtable[i][3]; - out[i][4] = in[i][4] / qtable[i][4]; - out[i][5] = in[i][5] / qtable[i][5]; - out[i][6] = in[i][6] / qtable[i][6]; - out[i][7] = in[i][7] / qtable[i][7]; + out[i][0] = in[i][0] / qtable[i][0]; + out[i][1] = in[i][1] / qtable[i][1]; + out[i][2] = in[i][2] / qtable[i][2]; + out[i][3] = in[i][3] / qtable[i][3]; + out[i][4] = in[i][4] / qtable[i][4]; + out[i][5] = in[i][5] / qtable[i][5]; + out[i][6] = in[i][6] / qtable[i][6]; + out[i][7] = in[i][7] / qtable[i][7]; } } diff --git a/converter/ppm/ppmtompeg/nojpeg.c b/converter/ppm/ppmtompeg/nojpeg.c index 38c05a9e..5b86ab56 100644 --- a/converter/ppm/ppmtompeg/nojpeg.c +++ b/converter/ppm/ppmtompeg/nojpeg.c @@ -1,12 +1,12 @@ /*===========================================================================* - * nojpeg.c * - * * - * procedures to deal with JPEG files * - * * - * EXPORTED PROCEDURES: * - * JMovie2JPEG * - * ReadJPEG * - * * + * nojpeg.c * + * * + * procedures to deal with JPEG files * + * * + * EXPORTED PROCEDURES: * + * JMovie2JPEG * + * ReadJPEG * + * * *===========================================================================*/ /* diff --git a/converter/ppm/ppmtompeg/noparallel.c b/converter/ppm/ppmtompeg/noparallel.c index 6e6449a4..02c46a58 100644 --- a/converter/ppm/ppmtompeg/noparallel.c +++ b/converter/ppm/ppmtompeg/noparallel.c @@ -70,7 +70,7 @@ time_t IOtime = 0; void IoServer(struct inputSource * const inputSourceP, - const char * const parallelHostName, + const char * const parallelHostName, int const portNum) { pm_error("This version of Ppmtompeg cannot run an I/O server because " @@ -102,7 +102,7 @@ SetRemoteShell(const char * const shell) { void NoteFrameDone(int const frameStart, int const frameEnd) { - fprintf(stdout, + fprintf(stdout, "ERROR: (NoteFrameDone) " "This machine can NOT run parallel version\n"); exit(1); @@ -151,7 +151,7 @@ WaitForOutputFile(int const number) { void MasterServer(struct inputSource * const inputSourceP, - const char * const paramFileName, + const char * const paramFileName, const char * const outputFileName) { pm_error("This version of Ppmtompeg cannot run a master server because " @@ -161,8 +161,8 @@ MasterServer(struct inputSource * const inputSourceP, void -CombineServer(int const numFrames, - const char * const masterHostName, +CombineServer(int const numFrames, + const char * const masterHostName, int const masterPortNum, const char* const outputFileName) { @@ -173,9 +173,9 @@ CombineServer(int const numFrames, void -DecodeServer(int const numInputFiles, - const char * const decodeFileName, - const char * const masterHostName, +DecodeServer(int const numInputFiles, + const char * const decodeFileName, + const char * const masterHostName, int const masterPortNum) { pm_error("This version of Ppmtompeg cannot run a decode server because " @@ -185,9 +185,9 @@ DecodeServer(int const numInputFiles, void -NotifyMasterDone(const char * const hostName, - int const portNum, - int const machineNumber, +NotifyMasterDone(const char * const hostName, + int const portNum, + int const machineNumber, unsigned int const seconds, boolean * const moreWorkToDoP, int * const frameStartP, diff --git a/converter/ppm/ppmtompeg/pframe.c b/converter/ppm/ppmtompeg/pframe.c index de91e32c..d61848b1 100644 --- a/converter/ppm/ppmtompeg/pframe.c +++ b/converter/ppm/ppmtompeg/pframe.c @@ -1,22 +1,22 @@ /*===========================================================================* - * pframe.c - * - * Procedures concerned with generation of P-frames - * - * EXPORTED PROCEDURES: - * GenPFrame - * ResetPFrameStats - * ShowPFrameSummary - * EstimateSecondsPerPFrame - * ComputeHalfPixelData - * SetPQScale - * GetPQScale - * - * NOTE: when motion vectors are passed as arguments, they are passed as - * twice their value. In other words, a motion vector of (3,4) will - * be passed as (6,8). This allows half-pixel motion vectors to be - * passed as integers. This is true throughout the program. - * + * pframe.c + * + * Procedures concerned with generation of P-frames + * + * EXPORTED PROCEDURES: + * GenPFrame + * ResetPFrameStats + * ShowPFrameSummary + * EstimateSecondsPerPFrame + * ComputeHalfPixelData + * SetPQScale + * GetPQScale + * + * NOTE: when motion vectors are passed as arguments, they are passed as + * twice their value. In other words, a motion vector of (3,4) will + * be passed as (6,8). This allows half-pixel motion vectors to be + * passed as integers. This is true throughout the program. + * *===========================================================================*/ /*==============* @@ -101,7 +101,7 @@ ZeroMotionBetter(const LumBlock * const currentBlockP, int bestDiff; int CompareMode; - /* Junk needed to adapt for TUNEing */ + /* Junk needed to adapt for TUNEing */ CompareMode = SearchCompareMode; SearchCompareMode = DEFAULT_SEARCH; bestDiff = LumMotionError(currentBlockP, prev, by, bx, m, 0x7fffffff); @@ -158,14 +158,14 @@ DoIntraCode(const LumBlock * const currentBlockP, for (x = 0; x < 16; ++x) { currPixel = currentBlockP->l[y][x]; prevPixel = motionBlock.l[y][x]; - + sum += currPixel; varc += currPixel*currPixel; - + vard += SQR(currPixel - prevPixel); } } - + vard /= 256; /* divide by 256; assumes mean is close to zero */ varc = (varc/256) - (sum/256) * (sum/256); @@ -217,11 +217,11 @@ ZeroMotionSufficient(const LumBlock * const currentBlockP, return (zeroDiff <= 256); } - -static void -computeCurrentBlock(MpegFrame * const current, + +static void +computeCurrentBlock(MpegFrame * const current, int const y, int const x, LumBlock * const currentBlockP) { @@ -232,7 +232,7 @@ computeCurrentBlock(MpegFrame * const current, for ( iy = 0; iy < 16; iy++ ) { int ix; for ( ix = 0; ix < 16; ix++ ) { - currentBlockP->l[iy][ix] = + currentBlockP->l[iy][ix] = (int16)current->orig_y[fy+iy][fx+ix]; } } @@ -241,17 +241,17 @@ computeCurrentBlock(MpegFrame * const current, static void -computeMotionVectors(bool const specificsOn, +computeMotionVectors(bool const specificsOn, bool const IntraPBAllowed, - MpegFrame * const current, + MpegFrame * const current, MpegFrame * const prev, int const mbAddress, BlockMV ** const infoP, - int const QScale, + int const QScale, const LumBlock * const currentBlockP, - int const y, + int const y, int const x, - bool * const useMotionP, + bool * const useMotionP, vector * const motionP) { bool useCached; @@ -260,7 +260,7 @@ computeMotionVectors(bool const specificsOn, /* See if we have a cached answer */ if (specificsOn) { SpecLookup(current->id, 2, mbAddress, &info, QScale); - if (info != (BlockMV*)NULL) + if (info != (BlockMV*)NULL) useCached = TRUE; else useCached = FALSE; @@ -293,7 +293,7 @@ computeMotionVectors(bool const specificsOn, motionP->x = 0; } else *motionP = motion; - if (IntraPBAllowed) + if (IntraPBAllowed) *useMotionP = !DoIntraCode(currentBlockP, prev, y, x, motion); else *useMotionP = TRUE; @@ -305,12 +305,12 @@ computeMotionVectors(bool const specificsOn, static void -calculateForwardDcts(MpegFrame * const current, +calculateForwardDcts(MpegFrame * const current, int const y, int const x, Block ** const dct) { /* calculate forward dct's */ - if (collect_quant && (collect_quant_detailed & 1)) + if (collect_quant && (collect_quant_detailed & 1)) fprintf(collect_quant_fp, "l\n"); mp_fwd_dct_block2(current->y_blocks[y][x], dct[y][x]); @@ -318,7 +318,7 @@ calculateForwardDcts(MpegFrame * const current, mp_fwd_dct_block2(current->y_blocks[y+1][x], dct[y+1][x]); mp_fwd_dct_block2(current->y_blocks[y+1][x+1], dct[y+1][x+1]); - if (collect_quant && (collect_quant_detailed & 1)) + if (collect_quant && (collect_quant_detailed & 1)) fprintf(collect_quant_fp, "c\n"); mp_fwd_dct_block2(current->cb_blocks[y/2][x/2], dctb[y/2][x/2]); @@ -348,7 +348,7 @@ computeMotionAndDct(int const lastBlockY, int mbAddress; int y; - mbAddress = 0; + mbAddress = 0; for (y = 0; y < lastBlockY; y += 2) { int x; @@ -416,7 +416,7 @@ computeMotionAndDct(int const lastBlockY, *===========================================================================*/ void GenPFrame(BitBucket * const bb, - MpegFrame * const current, + MpegFrame * const current, MpegFrame * const prev) { extern int **pmvHistogram; @@ -469,12 +469,12 @@ GenPFrame(BitBucket * const bb, if (bitstreamMode == FIXED_RATE) { targetRateControl(current); } - + Mhead_GenPictureHeader(bb, P_FRAME, current->id, fCodeP); - /* Check for Qscale change */ + /* Check for Qscale change */ if (specificsOn) { /* Set a Qscale for this frame? */ - newQScale = + newQScale = SpecLookup(current->id, 0, 0 /* junk */, &info /*junk*/, QScale); if (newQScale != -1) { QScale = newQScale; @@ -515,9 +515,9 @@ GenPFrame(BitBucket * const bb, computeMotionAndDct(lastBlockY, lastBlockX, specificsOn, IntraPBAllowed, current, prev, - &info, QScale, searchRangeP, dct, + &info, QScale, searchRangeP, dct, &numPBlocks, &numIBlocks, pmvHistogram); - + mbAddress = 0; for (y = 0; y < lastBlockY; y += 2) { for (x = 0; x < lastBlockX; x += 2) { @@ -526,7 +526,7 @@ GenPFrame(BitBucket * const bb, if ( (slicePos == 0) && (mbAddress != 0) ) { if (specificsOn) { /* Make sure no slice Qscale change */ - newQScale = + newQScale = SpecLookup(current->id, 1, mbAddress/blocksPerSlice, &info /*junk*/, QScale); if (newQScale != -1) QScale = newQScale; @@ -541,7 +541,7 @@ GenPFrame(BitBucket * const bb, mbAddrInc = 1+(x>>1); } - + /* Determine if new Qscale needed for Rate Control purposes */ if (bitstreamMode == FIXED_RATE) { rc_blockStart = bb->cumulativeBits; @@ -554,10 +554,10 @@ GenPFrame(BitBucket * const bb, QScale = newQScale; } } - + /* Check for Qscale change */ if (specificsOn) { - newQScale = + newQScale = SpecLookup(current->id, 2, mbAddress, &info, QScale); if (newQScale != -1) { QScale = newQScale; @@ -607,7 +607,7 @@ GenPFrame(BitBucket * const bb, motion.y = dct_data[y][x].fmotionY; #ifdef BLEAH - ComputeAndPrintPframeMAD(currentBlock, prev, y, x, motion, + ComputeAndPrintPframeMAD(currentBlock, prev, y, x, motion, mbAddress); #endif @@ -625,11 +625,11 @@ GenPFrame(BitBucket * const bb, #ifdef BLEAH if ( (motion.x != 0) || (motion.y != 0) ) { - fprintf(stdout, "FRAME (y, x) %d, %d (block %d)\n", + fprintf(stdout, "FRAME (y, x) %d, %d (block %d)\n", y, x, mbAddress); - fprintf(stdout, "motion.x = %d, motion.y = %d\n", + fprintf(stdout, "motion.x = %d, motion.y = %d\n", motion.x, motion.y); - fprintf(stdout, + fprintf(stdout, " mxq, mxr = %d, %d myq, myr = %d, %d\n", motionQuot.x, motionRem.x, motionQuot.y, motionRem.y); @@ -656,7 +656,7 @@ GenPFrame(BitBucket * const bb, if ( decodeRefFrames) { for ( index = 0; index < 6; index++ ) { if ( pattern & (1 << (5-index))) { - Mpost_UnQuantZigBlock(fba[index], dec[index], + Mpost_UnQuantZigBlock(fba[index], dec[index], QScale, FALSE); mpeg_jrevdct((int16 *)dec[index]); } else { @@ -671,7 +671,7 @@ GenPFrame(BitBucket * const bb, AddMotionBlock(dec[3], prev->decoded_y, y+1, x+1, motion); AddMotionBlock(dec[4], prev->decoded_cb, y/2, x/2, halfVector(motion)); - AddMotionBlock(dec[5], prev->decoded_cr, y/2, x/2, + AddMotionBlock(dec[5], prev->decoded_cr, y/2, x/2, halfVector(motion)); /* now, unblockify */ @@ -681,7 +681,7 @@ GenPFrame(BitBucket * const bb, BlockToData(current->decoded_y, dec[3], y+1, x+1); BlockToData(current->decoded_cb, dec[4], y/2, x/2); BlockToData(current->decoded_cr, dec[5], y/2, x/2); - } + } if ((motion.x == 0) && (motion.y == 0)) { if ( pattern == 0 ) { @@ -698,65 +698,65 @@ GenPFrame(BitBucket * const bb, numSkipped++; numPBlocks--; } else { /* first/last macroblock */ - Mhead_GenMBHeader(bb, 2 /* pict_code_type */, + Mhead_GenMBHeader(bb, 2 /* pict_code_type */, mbAddrInc /* addr_incr */, QScale /* q_scale */, - fCode /* forw_f_code */, + fCode /* forw_f_code */, 1 /* back_f_code */, - motionRem.x /* horiz_forw_r */, + motionRem.x /* horiz_forw_r */, motionRem.y /* vert_forw_r */, - 0 /* horiz_back_r */, + 0 /* horiz_back_r */, 0 /* vert_back_r */, - 1 /* motion_forw */, + 1 /* motion_forw */, motionQuot.x /* m_horiz_forw */, - motionQuot.y /* m_vert_forw */, + motionQuot.y /* m_vert_forw */, 0 /* motion_back */, - 0 /* m_horiz_back */, + 0 /* m_horiz_back */, 0 /* m_vert_back */, - 0 /* mb_pattern */, + 0 /* mb_pattern */, 0 /* mb_intra */); mbAddrInc = 1; } } else { DBG_PRINT(("MB Header(%d,%d)\n", x, y)); - Mhead_GenMBHeader(bb, 2 /* pict_code_type */, + Mhead_GenMBHeader(bb, 2 /* pict_code_type */, mbAddrInc /* addr_incr */, QScale /* q_scale */, - fCode /* forw_f_code */, + fCode /* forw_f_code */, 1 /* back_f_code */, - 0 /* horiz_forw_r */, + 0 /* horiz_forw_r */, 0 /* vert_forw_r */, - 0 /* horiz_back_r */, + 0 /* horiz_back_r */, 0 /* vert_back_r */, - 0 /* motion_forw */, + 0 /* motion_forw */, 0 /* m_horiz_forw */, - 0 /* m_vert_forw */, + 0 /* m_vert_forw */, 0 /* motion_back */, - 0 /* m_horiz_back */, + 0 /* m_horiz_back */, 0 /* m_vert_back */, - pattern /* mb_pattern */, + pattern /* mb_pattern */, 0 /* mb_intra */); mbAddrInc = 1; } } else { /* DBG_PRINT(("MB Header(%d,%d)\n", x, y)); */ - - Mhead_GenMBHeader(bb, 2 /* pict_code_type */, + + Mhead_GenMBHeader(bb, 2 /* pict_code_type */, mbAddrInc /* addr_incr */, QScale /* q_scale */, - fCode /* forw_f_code */, + fCode /* forw_f_code */, 1 /* back_f_code */, - motionRem.x /* horiz_forw_r */, + motionRem.x /* horiz_forw_r */, motionRem.y /* vert_forw_r */, - 0 /* horiz_back_r */, + 0 /* horiz_back_r */, 0 /* vert_back_r */, - 1 /* motion_forw */, + 1 /* motion_forw */, motionQuot.x /* m_horiz_forw */, - motionQuot.y /* m_vert_forw */, + motionQuot.y /* m_vert_forw */, 0 /* motion_back */, - 0 /* m_horiz_back */, + 0 /* m_horiz_back */, 0 /* m_vert_back */, - pattern /* mb_pattern */, + pattern /* mb_pattern */, 0 /* mb_intra */); mbAddrInc = 1; } @@ -832,7 +832,7 @@ GenPFrame(BitBucket * const bb, if ( frameSummary && (! realQuiet) ) { fprintf(stdout, "FRAME %d (P): I BLOCKS: %d; " "P BLOCKS: %d SKIPPED: %d (%ld seconds)\n", - current->id, numIBlocks, numPBlocks, numSkipped, + current->id, numIBlocks, numPBlocks, numSkipped, (long)(endTime-startTime)/TIME_RATE); if ( printSNR ) { fprintf(stdout, "FRAME %d: SNR: %.1f\t%.1f\t%.1f\t" @@ -921,8 +921,8 @@ PFrameTotalTime(void) { void -ShowPFrameSummary(unsigned int const inputFrameBits, - unsigned int const totalBits, +ShowPFrameSummary(unsigned int const inputFrameBits, + unsigned int const totalBits, FILE * const fpointer) { if (numFrames > 0) { diff --git a/converter/ppm/ppmtompeg/postdct.c b/converter/ppm/ppmtompeg/postdct.c index 56a23de9..68712963 100644 --- a/converter/ppm/ppmtompeg/postdct.c +++ b/converter/ppm/ppmtompeg/postdct.c @@ -1,15 +1,15 @@ /*===========================================================================* - * postdct.c * - * * - * Procedures concerned with MPEG post-DCT processing: * - * quantization and RLE Huffman encoding * - * * - * EXPORTED PROCEDURES: * - * Mpost_QuantZigBlock * - * Mpost_RLEHuffIBlock * - * Mpost_RLEHuffPBlock * - * Mpost_UnQuantZigBlock * - * * + * postdct.c * + * * + * Procedures concerned with MPEG post-DCT processing: * + * quantization and RLE Huffman encoding * + * * + * EXPORTED PROCEDURES: * + * Mpost_QuantZigBlock * + * Mpost_RLEHuffIBlock * + * Mpost_RLEHuffPBlock * + * Mpost_UnQuantZigBlock * + * * *===========================================================================*/ /* @@ -164,8 +164,8 @@ int32 niqtable[] = { 16, 16, 16, 16, 16, 16, 16, 16 }; -int32 *customQtable = NULL; -int32 *customNIQtable = NULL; +int32 *customQtable = NULL; +int32 *customNIQtable = NULL; /*==================* * GLOBAL VARIABLES * @@ -181,10 +181,10 @@ extern boolean realQuiet; * * Mpost_UnQuantZigBlock * - * unquantize and zig-zag (decode) a single block - * see section 2.4.4.1 of MPEG standard + * unquantize and zig-zag (decode) a single block + * see section 2.4.4.1 of MPEG standard * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -197,66 +197,66 @@ Mpost_UnQuantZigBlock(in, out, qscale, iblock) boolean iblock; { register int index; - int start; - int position; - register int qentry; - int level, coeff; - + int start; + int position; + register int qentry; + int level, coeff; + if ( iblock ) { - /* qtable[0] must be 8 */ - out[0][0] = (int16)(in[0] * 8); + /* qtable[0] must be 8 */ + out[0][0] = (int16)(in[0] * 8); - /* don't need to do anything fancy here, because we saved orig - value, not encoded dc value */ - start = 1; + /* don't need to do anything fancy here, because we saved orig + value, not encoded dc value */ + start = 1; } else { - start = 0; + start = 0; } for ( index = start; index < DCTSIZE_SQ; index++ ) { - position = ZAG[index]; - level = in[index]; - - if (level == 0) { - ((int16 *)out)[position] = 0; - continue; - } - - - if ( iblock ) { - qentry = qtable[position] * qscale; - coeff = (level*qentry)/8; - if ( (coeff & 1) == 0 ) { - if ( coeff < 0 ) { - coeff++; - } else if ( coeff > 0 ) { - coeff--; - } - } - } else { - qentry = niqtable[position] * qscale; - if ( level == 0 ) { - coeff = 0; - } else if ( level < 0 ) { - coeff = (((2*level)-1)*qentry) / 16; - if ( (coeff & 1) == 0 ) { - coeff++; - } - } else { - coeff = (((2*level)+1)*qentry) >> 4; - if ( (coeff & 1) == 0 ) { - coeff--; - } - } - - if ( coeff > 2047 ) { - coeff = 2047; - } else if ( coeff < -2048 ) { - coeff = -2048; - } + position = ZAG[index]; + level = in[index]; + + if (level == 0) { + ((int16 *)out)[position] = 0; + continue; + } + + + if ( iblock ) { + qentry = qtable[position] * qscale; + coeff = (level*qentry)/8; + if ( (coeff & 1) == 0 ) { + if ( coeff < 0 ) { + coeff++; + } else if ( coeff > 0 ) { + coeff--; + } + } + } else { + qentry = niqtable[position] * qscale; + if ( level == 0 ) { + coeff = 0; + } else if ( level < 0 ) { + coeff = (((2*level)-1)*qentry) / 16; + if ( (coeff & 1) == 0 ) { + coeff++; + } + } else { + coeff = (((2*level)+1)*qentry) >> 4; + if ( (coeff & 1) == 0 ) { + coeff--; + } + } + + if ( coeff > 2047 ) { + coeff = 2047; + } else if ( coeff < -2048 ) { + coeff = -2048; + } } - ((int16 *)out)[position] = coeff; + ((int16 *)out)[position] = coeff; } } @@ -265,9 +265,9 @@ Mpost_UnQuantZigBlock(in, out, qscale, iblock) * * Mpost_QuantZigBlock * - * quantize and zigzags a block + * quantize and zigzags a block * - * RETURNS: MPOST_OVERFLOW if a generated value is outside |255| + * RETURNS: MPOST_OVERFLOW if a generated value is outside |255| * MPOST_ZERO if all coeffs are zero * MPOST_NON_ZERO otherwisw * @@ -287,7 +287,7 @@ Mpost_QuantZigBlock(in, out, qscale, iblock) register int position; boolean nonZero = FALSE; boolean overflow = FALSE; - + DBG_PRINT(("Mpost_QuantZigBlock...\n")); if (iblock) { /* @@ -296,7 +296,7 @@ Mpost_QuantZigBlock(in, out, qscale, iblock) */ temp = ((int16 *) in)[ZAG[0]]; qentry = qtable[ZAG[0]]; - + if (temp < 0) { temp = -temp; temp += (qentry >> 1); @@ -310,60 +310,60 @@ Mpost_QuantZigBlock(in, out, qscale, iblock) nonZero = TRUE; } out[0] = temp; - + for (i = 1; i < DCTSIZE_SQ; i++) { position = ZAG[i]; temp = ((int16 *) in)[position]; qentry = qtable[position] * qscale; - + /* see 1993 MPEG doc, section D.6.3.4 */ if (temp < 0) { - temp = -temp; - temp = (temp << 3); /* temp > 0 */ - temp += (qentry >> 1); - temp /= qentry; - temp = -temp; + temp = -temp; + temp = (temp << 3); /* temp > 0 */ + temp += (qentry >> 1); + temp /= qentry; + temp = -temp; } else { - temp = (temp << 3); /* temp > 0 */ - temp += (qentry >> 1); - temp /= qentry; + temp = (temp << 3); /* temp > 0 */ + temp += (qentry >> 1); + temp /= qentry; } - + if ( temp != 0 ) { - nonZero = TRUE; - out[i] = temp; - if (temp < -255) { - temp = -255; - overflow = TRUE; - } else if (temp > 255) { - temp = 255; - overflow = TRUE; - } + nonZero = TRUE; + out[i] = temp; + if (temp < -255) { + temp = -255; + overflow = TRUE; + } else if (temp > 255) { + temp = 255; + overflow = TRUE; + } } else out[i]=0; } } else { for (i = 0; i < DCTSIZE_SQ; i++) { position = ZAG[i]; temp = ((int16 *) in)[position]; - + /* multiply by non-intra qtable */ qentry = qscale * niqtable[position]; - + /* see 1993 MPEG doc, D.6.4.5 */ temp *= 8; - temp /= qentry; /* truncation toward 0 -- correct */ - + temp /= qentry; /* truncation toward 0 -- correct */ + if ( temp != 0 ) { - nonZero = TRUE; - out[i] = temp; - if (temp < -255) { - temp = -255; - overflow = TRUE; - } else if (temp > 255) { - temp = 255; - overflow = TRUE; - } - + nonZero = TRUE; + out[i] = temp; + if (temp < -255) { + temp = -255; + overflow = TRUE; + } else if (temp > 255) { + temp = 255; + overflow = TRUE; + } + } else out[i]=0; } } @@ -379,9 +379,9 @@ Mpost_QuantZigBlock(in, out, qscale, iblock) * * Mpost_RLEHuffIBlock * - * generate the huffman bits from an I-block + * generate the huffman bits from an I-block * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -403,60 +403,60 @@ Mpost_RLEHuffIBlock(in, out) * specially, elsewhere. Not here. */ for (i = 1; i < DCTSIZE_SQ; i++) { - cur = in[i]; - acur = ABS(cur); - if (cur) { - if ( (nzeros < HUFF_MAXRUN) && (acur < huff_maxlevel[nzeros])) { - /* - * encode using the Huffman tables - */ - - DBG_PRINT(("rle_huff %02d.%02d: Run %02d, Level %4d\n", i, ZAG[i], nzeros, cur)); - code = (huff_table[nzeros])[acur]; - nbits = (huff_bits[nzeros])[acur]; - - if (cur < 0) { - code |= 1; /* the sign bit */ - } - Bitio_Write(out, code, nbits); - } else { - /* - * encode using the escape code - */ - DBG_PRINT(("Escape\n")); - Bitio_Write(out, 0x1, 6); /* ESCAPE */ - DBG_PRINT(("Run Length\n")); - Bitio_Write(out, nzeros, 6); /* Run-Length */ - - /* - * this shouldn't happen, but the other - * choice is to bomb out and dump core... - * Hmmm, seems to happen with small Qtable entries (1) -srs - */ - if (cur < -255) { - cur = -255; - } else if (cur > 255) { - cur = 255; - } - - DBG_PRINT(("Level\n")); - if (acur < 128) { - Bitio_Write(out, cur, 8); - } else { - if (cur < 0) { - Bitio_Write(out, 0x8001 + cur + 255, 16); - } else { - Bitio_Write(out, cur, 16); - } - } - } - nzeros = 0; - } else { - nzeros++; - } + cur = in[i]; + acur = ABS(cur); + if (cur) { + if ( (nzeros < HUFF_MAXRUN) && (acur < huff_maxlevel[nzeros])) { + /* + * encode using the Huffman tables + */ + + DBG_PRINT(("rle_huff %02d.%02d: Run %02d, Level %4d\n", i, ZAG[i], nzeros, cur)); + code = (huff_table[nzeros])[acur]; + nbits = (huff_bits[nzeros])[acur]; + + if (cur < 0) { + code |= 1; /* the sign bit */ + } + Bitio_Write(out, code, nbits); + } else { + /* + * encode using the escape code + */ + DBG_PRINT(("Escape\n")); + Bitio_Write(out, 0x1, 6); /* ESCAPE */ + DBG_PRINT(("Run Length\n")); + Bitio_Write(out, nzeros, 6); /* Run-Length */ + + /* + * this shouldn't happen, but the other + * choice is to bomb out and dump core... + * Hmmm, seems to happen with small Qtable entries (1) -srs + */ + if (cur < -255) { + cur = -255; + } else if (cur > 255) { + cur = 255; + } + + DBG_PRINT(("Level\n")); + if (acur < 128) { + Bitio_Write(out, cur, 8); + } else { + if (cur < 0) { + Bitio_Write(out, 0x8001 + cur + 255, 16); + } else { + Bitio_Write(out, cur, 16); + } + } + } + nzeros = 0; + } else { + nzeros++; + } } DBG_PRINT(("End of block\n")); - Bitio_Write(out, 0x2, 2); /* end of block marker */ + Bitio_Write(out, 0x2, 2); /* end of block marker */ } @@ -464,9 +464,9 @@ Mpost_RLEHuffIBlock(in, out) * * Mpost_RLEHuffPBlock * - * generate the huffman bits from an P-block + * generate the huffman bits from an P-block * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: none * @@ -488,80 +488,80 @@ Mpost_RLEHuffPBlock(in, out) * yes, Virginia, we start at 0. */ for (i = 0; i < DCTSIZE_SQ; i++) { - cur = in[i]; - acur = ABS(cur); - if (cur) { - if ((nzeros < HUFF_MAXRUN) && (acur < huff_maxlevel[nzeros])) { - /* - * encode using the Huffman tables - */ - - DBG_PRINT(("rle_huff %02d.%02d: Run %02d, Level %4d\n", i, ZAG[i], nzeros, cur)); - if ( first_dct && (nzeros == 0) && (acur == 1) ) { - /* actually, only needs = 0x2 */ - code = (cur == 1) ? 0x2 : 0x3; - nbits = 2; - } else { - code = (huff_table[nzeros])[acur]; - nbits = (huff_bits[nzeros])[acur]; - } - - assert(nbits); - - if (cur < 0) { - code |= 1; /* the sign bit */ - } - Bitio_Write(out, code, nbits); - first_dct = FALSE; - } else { - /* - * encode using the escape code - */ - DBG_PRINT(("Escape\n")); - Bitio_Write(out, 0x1, 6); /* ESCAPE */ - DBG_PRINT(("Run Length\n")); - Bitio_Write(out, nzeros, 6); /* Run-Length */ - - /* - * this shouldn't happen, but the other - * choice is to bomb out and dump core... - * Hmmm, seems to happen with small Qtable entries (1) -srs - */ - if (cur < -255) { - cur = -255; - } else if (cur > 255) { - cur = 255; - } - - DBG_PRINT(("Level\n")); - if (acur < 128) { - Bitio_Write(out, cur, 8); - } else { - if (cur < 0) { - Bitio_Write(out, 0x8001 + cur + 255, 16); - } else { - Bitio_Write(out, cur, 16); - } - } - - first_dct = FALSE; - } - nzeros = 0; - } else { - nzeros++; - } + cur = in[i]; + acur = ABS(cur); + if (cur) { + if ((nzeros < HUFF_MAXRUN) && (acur < huff_maxlevel[nzeros])) { + /* + * encode using the Huffman tables + */ + + DBG_PRINT(("rle_huff %02d.%02d: Run %02d, Level %4d\n", i, ZAG[i], nzeros, cur)); + if ( first_dct && (nzeros == 0) && (acur == 1) ) { + /* actually, only needs = 0x2 */ + code = (cur == 1) ? 0x2 : 0x3; + nbits = 2; + } else { + code = (huff_table[nzeros])[acur]; + nbits = (huff_bits[nzeros])[acur]; + } + + assert(nbits); + + if (cur < 0) { + code |= 1; /* the sign bit */ + } + Bitio_Write(out, code, nbits); + first_dct = FALSE; + } else { + /* + * encode using the escape code + */ + DBG_PRINT(("Escape\n")); + Bitio_Write(out, 0x1, 6); /* ESCAPE */ + DBG_PRINT(("Run Length\n")); + Bitio_Write(out, nzeros, 6); /* Run-Length */ + + /* + * this shouldn't happen, but the other + * choice is to bomb out and dump core... + * Hmmm, seems to happen with small Qtable entries (1) -srs + */ + if (cur < -255) { + cur = -255; + } else if (cur > 255) { + cur = 255; + } + + DBG_PRINT(("Level\n")); + if (acur < 128) { + Bitio_Write(out, cur, 8); + } else { + if (cur < 0) { + Bitio_Write(out, 0x8001 + cur + 255, 16); + } else { + Bitio_Write(out, cur, 16); + } + } + + first_dct = FALSE; + } + nzeros = 0; + } else { + nzeros++; + } } /* actually, should REALLY return FALSE and not use this! */ - if ( first_dct ) { /* have to give a first_dct even if all 0's */ - fprintf(stderr, "HUFF called with all-zero coefficients\n"); - fprintf(stderr, "exiting...\n"); - exit(1); + if ( first_dct ) { /* have to give a first_dct even if all 0's */ + fprintf(stderr, "HUFF called with all-zero coefficients\n"); + fprintf(stderr, "exiting...\n"); + exit(1); } DBG_PRINT(("End of block\n")); - Bitio_Write(out, 0x2, 2); /* end of block marker */ + Bitio_Write(out, 0x2, 2); /* end of block marker */ } @@ -569,9 +569,9 @@ Mpost_RLEHuffPBlock(in, out) * * CalcRLEHuffLength * - * count the huffman bits for an P-block + * count the huffman bits for an P-block * - * RETURNS: number of bits + * RETURNS: number of bits * * SIDE EFFECTS: none * @@ -587,40 +587,40 @@ CalcRLEHuffLength(in) register int nbits; register int countbits=0; boolean first_dct = TRUE; - + for (i = 0; i < DCTSIZE_SQ; i++) { cur = in[i]; acur = ABS(cur); if (cur) { if ((nzeros < HUFF_MAXRUN) && (acur < huff_maxlevel[nzeros])) { - /* - * encode using the Huffman tables - */ - - if ( first_dct && (nzeros == 0) && (acur == 1) ) { - nbits = 2; - } else { - nbits = (huff_bits[nzeros])[acur]; - } - countbits += nbits; - first_dct = FALSE; + /* + * encode using the Huffman tables + */ + + if ( first_dct && (nzeros == 0) && (acur == 1) ) { + nbits = 2; + } else { + nbits = (huff_bits[nzeros])[acur]; + } + countbits += nbits; + first_dct = FALSE; } else { - countbits += 12; /* ESCAPE + runlength */ + countbits += 12; /* ESCAPE + runlength */ - if (acur < 128) { - countbits += 8; - } else { - countbits += 16; - } + if (acur < 128) { + countbits += 8; + } else { + countbits += 16; + } - first_dct = FALSE; + first_dct = FALSE; } nzeros = 0; } else { nzeros++; } } - + countbits += 2; /* end of block marker */ return countbits; } diff --git a/converter/ppm/ppmtompeg/ppmtompeg.c b/converter/ppm/ppmtompeg/ppmtompeg.c index 837b1b9d..cc2cb27e 100644 --- a/converter/ppm/ppmtompeg/ppmtompeg.c +++ b/converter/ppm/ppmtompeg/ppmtompeg.c @@ -127,7 +127,7 @@ parseArgs(int const argc, cmdlineP->outputFrames = 0; cmdlineP->maxMachines = MAXINT; cmdlineP->specificFrames = FALSE; - + /* parse the arguments */ idx = 1; while (idx < argc-1) { @@ -143,10 +143,10 @@ parseArgs(int const argc, } else pm_error("Invalid -stat option"); } else if (streq(argv[idx], "-gop")) { - if (cmdlineP->function != ENCODE_FRAMES || + if (cmdlineP->function != ENCODE_FRAMES || cmdlineP->specificFrames) pm_error("Invalid -gop option"); - + if (idx+1 < argc-1) { whichGOP = atoi(argv[idx+1]); idx += 2; @@ -170,12 +170,12 @@ parseArgs(int const argc, cmdlineP->specificFrames = TRUE; cmdlineP->frameStart = frameStart; cmdlineP->frameEnd = frameEnd; - + idx += 3; } else pm_error("-frames needs to be followed by two values"); } else if (streq(argv[idx], "-combine_gops")) { - if (cmdlineP->function != ENCODE_FRAMES || whichGOP != -1 || + if (cmdlineP->function != ENCODE_FRAMES || whichGOP != -1 || cmdlineP->specificFrames) { pm_error("Invalid -combine_gops option"); } @@ -345,7 +345,7 @@ announceJob(enum frameContext const context, combineDest = strdup("for delivery to combine server"); else combineDest = strdup(""); - + pm_message("%s: ENCODING FRAMES %u-%u to %s %s", hostname, frameStart, frameEnd, outputDest, combineDest); @@ -359,7 +359,7 @@ announceJob(enum frameContext const context, static void encodeSomeFrames(struct inputSource * const inputSourceP, boolean const childProcess, - enum frameContext const context, + enum frameContext const context, unsigned int const frameStart, unsigned int const frameEnd, int32 const qtable[], @@ -370,7 +370,7 @@ encodeSomeFrames(struct inputSource * const inputSourceP, bool const wantVbvOverflowWarning, boolean const printStats, unsigned int * const encodeTimeP) { - + time_t framesTimeStart, framesTimeEnd; unsigned int inputFrameBits; unsigned int totalBits; @@ -383,7 +383,7 @@ encodeSomeFrames(struct inputSource * const inputSourceP, frameStart, frameEnd, inputSourceP); GenMPEGStream(inputSourceP, context, frameStart, frameEnd, - qtable, niqtable, childProcess, ofp, outputFileName, + qtable, niqtable, childProcess, ofp, outputFileName, wantVbvUnderflowWarning, wantVbvOverflowWarning, &inputFrameBits, &totalBits); @@ -396,7 +396,7 @@ encodeSomeFrames(struct inputSource * const inputSourceP, hostname, frameStart, frameEnd, *encodeTimeP); if (printStats) - PrintEndStats(framesTimeStart, framesTimeEnd, + PrintEndStats(framesTimeStart, framesTimeEnd, inputFrameBits, totalBits); } @@ -422,14 +422,14 @@ encodeFrames(struct inputSource * const inputSourceP, Encode the stream. If 'specificFrames' is true, then encode frames 'whichFrameStart' through 'whichFrameEnd' individually. Otherwise, encode the entire input stream as a complete MPEG stream. - + 'childProcess' means to do it as a child process that is under the supervision of a master process and is possibly doing only part of a larger batch. - + (If we had proper modularity, we wouldn't care, but parallel operation was glued on to this program after it was complete). - + One thing we don't do when running as a child process is print statistics; our master will do that for the whole job. ----------------------------------------------------------------------------*/ @@ -442,7 +442,7 @@ encodeFrames(struct inputSource * const inputSourceP, if (whichGOP != -1) { /* He wants just one particular GOP from the middle of the movie. */ - ComputeGOPFrames(whichGOP, &frameStart, &frameEnd, + ComputeGOPFrames(whichGOP, &frameStart, &frameEnd, inputSourceP->numInputFiles); context = CONTEXT_GOP; } else if (specificFrames) { @@ -465,36 +465,36 @@ encodeFrames(struct inputSource * const inputSourceP, frameEnd = inputSourceP->numInputFiles - 1; context = CONTEXT_WHOLESTREAM; } - + printStats = !childProcess; - + encodeSomeFrames(inputSourceP, childProcess, context, frameStart, frameEnd, customQtable, customNIQtable, - ofp, outputFileName, + ofp, outputFileName, wantVbvUnderflowWarning, wantVbvOverflowWarning, printStats, &lastEncodeTime); if (childProcess) { boolean moreWorkToDo; - + /* A child is not capable of generating GOP or stream headers */ assert(context == CONTEXT_JUSTFRAMES); - + moreWorkToDo = TRUE; /* initial assumption */ while (moreWorkToDo) { int nextFrameStart, nextFrameEnd; - NotifyMasterDone(masterHostname, masterPortNumber, machineNumber, + NotifyMasterDone(masterHostname, masterPortNumber, machineNumber, lastEncodeTime, &moreWorkToDo, &nextFrameStart, &nextFrameEnd); if (moreWorkToDo) - encodeSomeFrames(inputSourceP, childProcess, - CONTEXT_JUSTFRAMES, + encodeSomeFrames(inputSourceP, childProcess, + CONTEXT_JUSTFRAMES, nextFrameStart, nextFrameEnd, customQtable, customNIQtable, - NULL, outputFileName, - wantVbvUnderflowWarning, + NULL, outputFileName, + wantVbvUnderflowWarning, wantVbvOverflowWarning, FALSE, &lastEncodeTime); @@ -527,13 +527,13 @@ static void getUserFrameFile(void * const handle, unsigned int const frameNumber, FILE ** const ifPP) { - + struct inputSource * const inputSourceP = (struct inputSource *) handle; if (inputSourceP->stdinUsed) pm_error("You cannot combine frames from Standard Input."); /* Because Caller detects end of frames by EOF */ - + if (frameNumber >= inputSourceP->numInputFiles) *ifPP = NULL; else { @@ -541,14 +541,14 @@ getUserFrameFile(void * const handle, const char * inputFileName; GetNthInputFileName(inputSourceP, frameNumber, &inputFileName); - + pm_asprintf(&fileName, "%s/%s", currentFramePath, inputFileName); - + *ifPP = fopen(fileName, "rb"); if (*ifPP == NULL) pm_error("Unable to open file '%s'. Errno = %d (%s)", fileName, errno, strerror(errno)); - + pm_strfree(inputFileName); pm_strfree(fileName); } @@ -585,11 +585,11 @@ framePoolSize(bool const sequentialInput) { for ( idx = 0, bcount = 0; idx < strlen(framePattern); idx++) { /* counts the maximum number of B frames between two reference - * frames. + * frames. */ - + switch( framePattern[idx] ) { - case 'b': + case 'b': bcount++; break; case 'i': @@ -599,12 +599,12 @@ framePoolSize(bool const sequentialInput) { bcount = 0; break; } - + /* add 2 to hold the forward and past reference frames in addition - * to the maximum number of B's + * to the maximum number of B's */ } - + numOfFrames += 2; } else { @@ -656,22 +656,22 @@ main(int argc, char **argv) { Tune_Init(); Frame_Init(framePoolSize(params.inputSourceP->stdinUsed)); - if (specificsOn) + if (specificsOn) Specifics_Init(); - ComputeFrameTable(params.inputSourceP->stdinUsed ? + ComputeFrameTable(params.inputSourceP->stdinUsed ? 0 : params.inputSourceP->numInputFiles); if (ioServer) { - IoServer(params.inputSourceP, cmdline.masterHostname, + IoServer(params.inputSourceP, cmdline.masterHostname, cmdline.masterPortNumber); return 0; } else if (outputServer) { - CombineServer(cmdline.outputFrames, + CombineServer(cmdline.outputFrames, cmdline.masterHostname, cmdline.masterPortNumber, outputFileName); } else if (decodeServer) { - DecodeServer(cmdline.outputFrames, outputFileName, + DecodeServer(cmdline.outputFrames, outputFileName, cmdline.masterHostname, cmdline.masterPortNumber); } else { if (!cmdline.specificFrames && @@ -681,18 +681,18 @@ main(int argc, char **argv) { pm_error("Could not open output file!"); } else ofP = NULL; - + if (cmdline.function == ENCODE_FRAMES) { if (numMachines == 0 || cmdline.specificFrames) { encodeFrames(params.inputSourceP, - cmdline.childProcess, + cmdline.childProcess, cmdline.masterHostname, cmdline.masterPortNumber, whichGOP, cmdline.specificFrames, cmdline.frameStart, cmdline.frameEnd, customQtable, customNIQtable, ofP, outputFileName, params.warnUnderflow, params.warnOverflow); - + } else runMaster(params.inputSourceP, cmdline.paramFileName, outputFileName); @@ -701,9 +701,9 @@ main(int argc, char **argv) { else if (cmdline.function == COMBINE_FRAMES) FramesToMPEG(ofP, params.inputSourceP, &getUserFrameFile, &nullDisposeFile); - } + } Frame_Exit(); - + pm_strfree(hostname); return 0; diff --git a/converter/ppm/ppmtompeg/psearch.c b/converter/ppm/ppmtompeg/psearch.c index e350137e..de3d3e26 100644 --- a/converter/ppm/ppmtompeg/psearch.c +++ b/converter/ppm/ppmtompeg/psearch.c @@ -1,8 +1,8 @@ /*===========================================================================* - * psearch.c - * - * Procedures concerned with the P-frame motion search - * + * psearch.c + * + * Procedures concerned with the P-frame motion search + * *===========================================================================*/ /*==============* @@ -79,10 +79,10 @@ int psearchAlg; * *===========================================================================*/ void -PMotionSearch(const LumBlock * const currentBlockP, - MpegFrame * const prev, +PMotionSearch(const LumBlock * const currentBlockP, + MpegFrame * const prev, int const by, - int const bx, + int const bx, vector * const motionP) { /* CALL SEARCH PROCEDURE */ @@ -92,14 +92,14 @@ PMotionSearch(const LumBlock * const currentBlockP, PSubSampleSearch(currentBlockP, prev, by, bx, motionP, searchRangeP); break; case PSEARCH_EXHAUSTIVE: - PLocalSearch(currentBlockP, prev, by, bx, + PLocalSearch(currentBlockP, prev, by, bx, motionP, INT_MAX, searchRangeP); break; case PSEARCH_LOGARITHMIC: PLogarithmicSearch(currentBlockP, prev, by, bx, motionP, searchRangeP); break; case PSEARCH_TWOLEVEL: - PTwoLevelSearch(currentBlockP, prev, by, bx, + PTwoLevelSearch(currentBlockP, prev, by, bx, motionP, INT_MAX, searchRangeP); break; default: @@ -122,7 +122,7 @@ PMotionSearch(const LumBlock * const currentBlockP, *===========================================================================*/ void SetPixelSearch(const char * const searchType) { - if ( (strcmp(searchType, "FULL") == 0 ) || + if ( (strcmp(searchType, "FULL") == 0 ) || ( strcmp(searchType, "WHOLE") == 0 )) { pixelFullSearch = TRUE; } else if ( strcmp(searchType, "HALF") == 0 ) { @@ -216,16 +216,16 @@ SetSearchRange(int const pixelsP, int const pixelsB) { int const max_search = max(searchRangeP, searchRangeB); int index; - + pmvHistogram = (int **) malloc((2*searchRangeP+3)*sizeof(int *)); bbmvHistogram = (int **) malloc((2*searchRangeB+3)*sizeof(int *)); bfmvHistogram = (int **) malloc((2*searchRangeB+3)*sizeof(int *)); for ( index = 0; index < 2*max_search+3; index++ ) { - pmvHistogram[index] = + pmvHistogram[index] = (int *) calloc(2*searchRangeP+3, sizeof(int)); - bbmvHistogram[index] = + bbmvHistogram[index] = (int *) calloc(2*searchRangeB+3, sizeof(int)); - bfmvHistogram[index] = + bfmvHistogram[index] = (int *) calloc(2*searchRangeB+3, sizeof(int)); } } @@ -269,12 +269,12 @@ MotionSearchPreComputation(MpegFrame * const frameP) { *===========================================================================*/ int PSubSampleSearch(const LumBlock * const currentBlockP, - MpegFrame * const prev, + MpegFrame * const prev, int const by, int const bx, vector * const motionP, int const searchRange) { - + int my, mx; int bestBestDiff; int stepSize; @@ -311,7 +311,7 @@ PSubSampleSearch(const LumBlock * const currentBlockP, m.y = my; m.x = mx; diff = LumMotionErrorA(currentBlockP, prev, by, bx, m, bestDiff[0]); - + if (diff < bestDiff[0]) { bestMY[0] = my; bestMX[0] = mx; @@ -330,9 +330,9 @@ PSubSampleSearch(const LumBlock * const currentBlockP, int diff; vector m; m.y = my; m.x = mx; - diff = LumMotionErrorB(currentBlockP, prev, by, bx, m, + diff = LumMotionErrorB(currentBlockP, prev, by, bx, m, bestDiff[1]); - + if (diff < bestDiff[1]) { bestMY[1] = my; bestMX[1] = mx; @@ -353,7 +353,7 @@ PSubSampleSearch(const LumBlock * const currentBlockP, m.y = my; m.x = mx; diff = LumMotionErrorC(currentBlockP, prev, by, bx, m, bestDiff[2]); - + if (diff < bestDiff[2]) { bestMY[2] = my; bestMX[2] = mx; @@ -374,7 +374,7 @@ PSubSampleSearch(const LumBlock * const currentBlockP, m.y = my; m.x = mx; diff = LumMotionErrorD(currentBlockP, prev, by, bx, m, bestDiff[3]); - + if (diff < bestDiff[3]) { bestMY[3] = my; bestMX[3] = mx; @@ -388,7 +388,7 @@ PSubSampleSearch(const LumBlock * const currentBlockP, /* first check old motion */ if ((motionP->y >= leftMY) && (motionP->y < rightMY) && (motionP->x >= leftMX) && (motionP->x < rightMX)) { - bestBestDiff = LumMotionError(currentBlockP, prev, by, bx, + bestBestDiff = LumMotionError(currentBlockP, prev, by, bx, *motionP, INT_MAX); } else bestBestDiff = INT_MAX; @@ -417,15 +417,15 @@ findBestSpaced(int const minMY, int const maxMY, int const maxMX, int const spacing, - const LumBlock * const currentBlockP, + const LumBlock * const currentBlockP, MpegFrame * const prev, int const by, int const bx, - int * const bestDiffP, + int * const bestDiffP, vector * const centerP) { /*---------------------------------------------------------------------------- - Examine every 'spacing'th half-pixel within the rectangle - ('minBoundX', 'minBoundY', 'maxBoundX', 'maxBoundY'), + Examine every 'spacing'th half-pixel within the rectangle + ('minBoundX', 'minBoundY', 'maxBoundX', 'maxBoundY'), If one of the half-pixels examined has a lower "LumMotionError" value than *bestDiffP, update *bestDiffP to that value and update @@ -446,9 +446,9 @@ findBestSpaced(int const minMY, vector m; m.y = my; m.x = mx; - + diff = LumMotionError(currentBlockP, prev, by, bx, m, *bestDiffP); - + if (diff < *bestDiffP) { *centerP = m; *bestDiffP = diff; @@ -474,9 +474,9 @@ findBestSpaced(int const minMY, *===========================================================================*/ int PLogarithmicSearch(const LumBlock * const currentBlockP, - MpegFrame * const prev, + MpegFrame * const prev, int const by, - int const bx, + int const bx, vector * const motionP, int const searchRange) { @@ -493,7 +493,7 @@ PLogarithmicSearch(const LumBlock * const currentBlockP, /* The difference between the current block and the block offset 'motion' from it. */ - + COMPUTE_MOTION_BOUNDARY(by, bx, stepSize, minMY, minMX, maxMY, maxMX); minMX = max(minMX, - searchRange); minMY = max(minMY, - searchRange); @@ -510,20 +510,20 @@ PLogarithmicSearch(const LumBlock * const currentBlockP, for (spacing = searchRange; spacing >= stepSize;) { if (stepSize == 2) { /* make sure spacing is even */ - if (spacing == 2) + if (spacing == 2) spacing = 0; else { spacing = (spacing+1)/2; - if (spacing % 2 != 0) + if (spacing % 2 != 0) --spacing; } } else { if (spacing == 1) { spacing = 0; - } else + } else spacing = (spacing + 1) / 2; } - if (spacing >= stepSize) + if (spacing >= stepSize) findBestSpaced(minMY, minMX, maxMY, maxMX, spacing, currentBlockP, prev, by, bx, &bestDiff, &motion); @@ -534,14 +534,14 @@ PLogarithmicSearch(const LumBlock * const currentBlockP, /* check old motion -- see if it's better */ if ((motionP->y >= minMY) && (motionP->y < maxMY) && (motionP->x >= minMX) && (motionP->x < maxMX)) { - diff = LumMotionError(currentBlockP, prev, by, bx, + diff = LumMotionError(currentBlockP, prev, by, bx, *motionP, bestDiff); - } else + } else diff = INT_MAX; - + if (bestDiff < diff) *motionP = motion; - else + else bestDiff = diff; } @@ -563,7 +563,7 @@ PLogarithmicSearch(const LumBlock * const currentBlockP, *===========================================================================*/ int PLocalSearch(const LumBlock * const currentBlockP, - MpegFrame * const prev, + MpegFrame * const prev, int const by, int const bx, vector * const motionP, @@ -584,7 +584,7 @@ PLocalSearch(const LumBlock * const currentBlockP, /* try old motion vector first */ if (VALID_MOTION(*motionP)) { - bestDiff = LumMotionError(currentBlockP, prev, by, bx, + bestDiff = LumMotionError(currentBlockP, prev, by, bx, *motionP, bestSoFar); if (bestSoFar < bestDiff) @@ -594,7 +594,7 @@ PLocalSearch(const LumBlock * const currentBlockP, bestDiff = bestSoFar; } - /* try a spiral pattern */ + /* try a spiral pattern */ for (distance = stepSize; distance <= searchRange; distance += stepSize) { tempRightMY = MIN(distance, rightMY); tempRightMX = MIN(distance, rightMX); @@ -607,11 +607,11 @@ PLocalSearch(const LumBlock * const currentBlockP, if (mx >= leftMX) { int diff; vector m; - + m.y = my; m.x = mx; - diff = LumMotionError(currentBlockP, prev, by, bx, m, + diff = LumMotionError(currentBlockP, prev, by, bx, m, bestDiff); - + if (diff < bestDiff) { *motionP = m; bestDiff = diff; @@ -635,7 +635,7 @@ PLocalSearch(const LumBlock * const currentBlockP, m.y = my; m.x = mx; diff = LumMotionError(currentBlockP, prev, by, bx, m, bestDiff); - + if (diff < bestDiff) { *motionP = m; bestDiff = diff; @@ -664,9 +664,9 @@ PLocalSearch(const LumBlock * const currentBlockP, *===========================================================================*/ int PTwoLevelSearch(const LumBlock * const currentBlockP, - MpegFrame * const prev, + MpegFrame * const prev, int const by, - int const bx, + int const bx, vector * const motionP, int const bestSoFar, int const searchRange) { @@ -702,7 +702,7 @@ PTwoLevelSearch(const LumBlock * const currentBlockP, /* try old motion vector first */ if (VALID_MOTION(*motionP)) { - bestDiff = LumMotionError(currentBlockP, prev, by, bx, + bestDiff = LumMotionError(currentBlockP, prev, by, bx, *motionP, bestSoFar); if ( bestSoFar < bestDiff ) { @@ -716,7 +716,7 @@ PTwoLevelSearch(const LumBlock * const currentBlockP, ++rightMY; ++rightMX; - /* try a spiral pattern */ + /* try a spiral pattern */ for ( distance = 2; distance <= searchRange; distance += 2 ) { tempRightMY = MIN(distance, rightMY); tempRightMX = MIN(distance, rightMX); @@ -729,9 +729,9 @@ PTwoLevelSearch(const LumBlock * const currentBlockP, if (mx >= leftMX) { vector m; m.y = my; m.x = mx; - diff = LumMotionError(currentBlockP, prev, by, bx, m, + diff = LumMotionError(currentBlockP, prev, by, bx, m, bestDiff); - + if (diff < bestDiff) { *motionP = m; bestDiff = diff; @@ -750,9 +750,9 @@ PTwoLevelSearch(const LumBlock * const currentBlockP, int diff; vector m; m.y = my; m.x = mx; - diff = LumMotionError(currentBlockP, prev, by, bx, m, + diff = LumMotionError(currentBlockP, prev, by, bx, m, bestDiff); - + if ( diff < bestDiff ) { *motionP = m; bestDiff = diff; @@ -952,7 +952,7 @@ ShowBFMVHistogram(fpointer) * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /u/smoot/md/mpeg_encode/RCS/psearch.c,v 1.9 1995/01/19 23:09:12 eyhung Exp $ * $Log: psearch.c,v $ * Revision 1.9 1995/01/19 23:09:12 eyhung diff --git a/converter/ppm/ppmtompeg/qtest.c b/converter/ppm/ppmtompeg/qtest.c index b3d26593..85eda2c8 100644 --- a/converter/ppm/ppmtompeg/qtest.c +++ b/converter/ppm/ppmtompeg/qtest.c @@ -19,7 +19,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* +/* * $Header: /n/charlie-brown/project/mm/mpeg/mpeg_dist/mpeg_encode/RCS/qtest.c,v 1.5 1995/01/19 23:09:15 eyhung Exp $ * $Log: qtest.c,v $ * Revision 1.5 1995/01/19 23:09:15 eyhung @@ -50,14 +50,14 @@ main() bb = new_bitbucket(); for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - a[i][j] = rand() % 100; + for (j = 0; j < 8; j++) + a[i][j] = rand() % 100; mp_quant_zig_block(a, b, 1, 1); for (i = 0; i < 64; i++) - printf("%6d ", b[i]); + printf("%6d ", b[i]); printf("\n"); - mp_rle_huff_block(b, bb); /* intuititve names, huh? */ + mp_rle_huff_block(b, bb); /* intuititve names, huh? */ printf("Huffman output is %d bits\n", bb->totalbits); } diff --git a/converter/ppm/ppmtompeg/rate.c b/converter/ppm/ppmtompeg/rate.c index 3fa41102..26c30ffe 100644 --- a/converter/ppm/ppmtompeg/rate.c +++ b/converter/ppm/ppmtompeg/rate.c @@ -1,9 +1,9 @@ /*============================================================================* - * rate.c * - * * - * Procedures concerned with rate control * - * * - * EXPORTED PROCEDURES: * + * rate.c * + * * + * Procedures concerned with rate control * + * * + * EXPORTED PROCEDURES: * * initRatecontrol() * * targetRateControl() * * updateRateControl() * @@ -11,7 +11,7 @@ * needQScaleChange() * * incNumBlocks() * * incQuant() * - * incMacroBlockBits() * + * incMacroBlockBits() * * setPictureRate() * * setBitRate() * * getBitRate() * @@ -19,7 +19,7 @@ * getBufferSize() * * * * NOTES: * - * Naming conventions follow those of MPEG-2 draft algorithm (chap. 10) * + * Naming conventions follow those of MPEG-2 draft algorithm (chap. 10) * *============================================================================*/ @@ -73,7 +73,7 @@ * GLOBAL VARIABLES * *==================*/ -#define MAX_BIT_RATE 104857600 /* 18 digit number in units of 400 */ +#define MAX_BIT_RATE 104857600 /* 18 digit number in units of 400 */ #define MAX_BUFFER_SIZE 16760832 /* 10 digit number in units of 16k */ #define DEFAULT_BUFFER_SIZE 327680 /* maximum for "constrained" bitstream */ #define DEFAULT_VBV_FULLNESS 3 /* wait till 1/3 full */ @@ -82,9 +82,9 @@ #define MAX_VBV_DELAY 32768 /* 16 digits */ -/* Variables from Parameter File */ +/* Variables from Parameter File */ -static int RateControlMode = VARIABLE_RATE; +static int RateControlMode = VARIABLE_RATE; static int32 buffer_size = DEFAULT_BUFFER_SIZE; static int32 bit_rate = -1; @@ -94,9 +94,9 @@ static bool wantVbvOverflowWarning; /* Variables for the VBV buffer defined in MPEG specs */ static unsigned int VBV_remainingDelay; /* delay in units of 1/90000 seconds */ -static int32 VBV_buffer = 0; /* fullness of the theoretical VBV buffer */ +static int32 VBV_buffer = 0; /* fullness of the theoretical VBV buffer */ static int32 bufferFillRate = 0; /* constant rate at which buffer filled */ -static int32 frameDelayIncrement = 0; /* number of "delay" units/Frame */ +static int32 frameDelayIncrement = 0; /* number of "delay" units/Frame */ /* Global complexity measure variables */ static int Xi, Xp, Xb; /* Global complexity measure */ @@ -108,7 +108,7 @@ static float Qi, Qp, Qb; /* avg quantizaton for last picture of type */ /* Target bit allocations for each type of picture*/ int Ti, Tp, Tb; -int current_Tx; /* allocation for current frame */ +int current_Tx; /* allocation for current frame */ /* Count of number of pictures of each type remaining */ int GOP_X; @@ -131,7 +131,7 @@ int rc_totalFrameBits; int rc_totalOverheadBits = 0; -/* Want to print out Macroblock info every Nth MB */ +/* Want to print out Macroblock info every Nth MB */ int RC_MB_SAMPLE_RATE = 0; static float Ki = .7; @@ -150,23 +150,23 @@ static int d0_b; static int lastFrameVirtBuf; /* fullness after last frame of this type */ static int currentVirtBuf; /* fullness during current encoding*/ -static int MB_cnt = -1; /* Number of MB's in picture */ +static int MB_cnt = -1; /* Number of MB's in picture */ static int rc_Q; /* reference quantization parameter */ static int reactionParameter; /* Reaction parameter */ -/* Adaptive Quantization variables */ +/* Adaptive Quantization variables */ static int act_j; /* spatial activity measure */ static float N_act; /* Normalized spacial activity */ -static int avg_act; /* average activity value in last picture encoded */ -static int total_act_j; /* Sum of activity values in current frame */ +static int avg_act; /* average activity value in last picture encoded */ +static int total_act_j; /* Sum of activity values in current frame */ -static int var_sblk; /* sub-block activity */ -static int P_mean; /* Mean value of pixels in 8x8 sub-block */ +static int var_sblk; /* sub-block activity */ +static int P_mean; /* Mean value of pixels in 8x8 sub-block */ -static int mquant; /* Raw Quantization value */ -static int Qscale; /* Clipped, truncated quantization value */ +static int mquant; /* Raw Quantization value */ +static int Qscale; /* Clipped, truncated quantization value */ @@ -177,7 +177,7 @@ static FILE *RC_FILE; static char rc_buffer[101]; -/* EXTERNAL Variables */ +/* EXTERNAL Variables */ extern char *framePattern; extern int framePatternLen; @@ -230,9 +230,9 @@ analyzePattern(const char * const framePattern, * * initRateControl * - * initialize the allocation parameters. + * initialize the allocation parameters. * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: many global variables * @@ -292,11 +292,11 @@ initRateControl(bool const wantUnderflowWarning, d0_p = (Kp * d0_i); d0_b = (Kb * d0_i); - lastFrameVirtBuf = d0_i; /* start with I Frame */ + lastFrameVirtBuf = d0_i; /* start with I Frame */ rc_Q = lastFrameVirtBuf * 31 / reactionParameter; /* init spatial activity measures */ - avg_act = 400; /* Suggested initial value */ + avg_act = 400; /* Suggested initial value */ N_act = 1; mquant = rc_Q * N_act; @@ -320,10 +320,10 @@ initRateControl(bool const wantUnderflowWarning, * * initGOPRateControl * - * (re)-initialize the RC for the a new Group of Pictures. - * New bit allocation, but carry over complexity measures. + * (re)-initialize the RC for the a new Group of Pictures. + * New bit allocation, but carry over complexity measures. * - * RETURNS: nothing + * RETURNS: nothing * * SIDE EFFECTS: many global variables * @@ -585,9 +585,9 @@ updateRateControl(int const type) { * MB_RateOut * * Prints out sampling of MB rate control data. Every "nth" block - * stats are printed, with "n" controlled by global RC_MB_SAMPLE_RATE - * (NB. "skipped" blocks do not go through this function and thus do not - * show up in the sample ) + * stats are printed, with "n" controlled by global RC_MB_SAMPLE_RATE + * (NB. "skipped" blocks do not go through this function and thus do not + * show up in the sample ) * * RETURNS: nothing * @@ -612,8 +612,8 @@ int type; pctUsed = (totalBits *100/current_Tx); sprintf(rc_buffer, "%3d %5d %2d %3d %6d %3d %6d %2.2f %6d %4d %3d %3d\n", - (rc_numBlocks - 1), bitsThisMB, Qscale, mquant, currentVirtBuf, - rc_Q, act_j, N_act, totalBits, bitsPerMB, pctUsed, pctDone); + (rc_numBlocks - 1), bitsThisMB, Qscale, mquant, currentVirtBuf, + rc_Q, act_j, N_act, totalBits, bitsPerMB, pctUsed, pctDone); #ifdef RC_STATS_FILE fprintf(RC_FILE, "%s", rc_buffer); fflush(RC_FILE); @@ -651,7 +651,7 @@ void incNumBlocks(num) * * incMacroBlockBits() * - * Increments the number of Macro Block bits and the total of Frame + * Increments the number of Macro Block bits and the total of Frame * bits by the number passed. * * RETURNS: nothing @@ -672,7 +672,7 @@ void incMacroBlockBits(num) /*===========================================================================* * - * needQScaleChange(current Q scale, 4 luminance blocks) + * needQScaleChange(current Q scale, 4 luminance blocks) * * * RETURNS: new Qscale @@ -689,7 +689,7 @@ int needQScaleChange(oldQScale, blk0, blk1, blk2, blk3) { /* One more MacroBlock seen */ - rc_numBlocks++; /* this notes each block num in MB */ + rc_numBlocks++; /* this notes each block num in MB */ checkBufferFullness(oldQScale); @@ -712,7 +712,7 @@ int needQScaleChange(oldQScale, blk0, blk1, blk2, blk3) * determineMBCount() * * Determines number of Macro Blocks in frame from the frame sizes - * passed. + * passed. * * RETURNS: nothing * @@ -766,7 +766,7 @@ void checkBufferFullness (oldQScale) * void checkSpatialActivity() * * Calculates the spatial activity for the four luminance blocks of the - * macroblock. Along with the normalized reference quantization parameter + * macroblock. Along with the normalized reference quantization parameter * (rc_Q) , it determines the quantization factor for the next macroblock. * * RETURNS: nothing @@ -796,18 +796,18 @@ void checkSpatialActivity(blk0, blk1, blk2, blk3) blkArray[3] = (int16 *) blk3; - for (i =0; i < 4; i++) { /* Compute the activity in each block */ + for (i =0; i < 4; i++) { /* Compute the activity in each block */ curBlock = blkArray[i]; blk_ptr = curBlock; P_mean = 0; /* Find the mean pixel value */ for (j=0; j < DCTSIZE_SQ; j ++) { P_mean += *(blk_ptr++); - /* P_mean += curBlock[j]; - if (curBlock[j] != *(blk_ptr++)) { - printf("ARRAY ERROR: block %d\n", j); - } - */ + /* P_mean += curBlock[j]; + if (curBlock[j] != *(blk_ptr++)) { + printf("ARRAY ERROR: block %d\n", j); + } + */ } P_mean /= DCTSIZE_SQ; @@ -818,7 +818,7 @@ void checkSpatialActivity(blk0, blk1, blk2, blk3) for (j=0; j < DCTSIZE_SQ; j++) { #ifdef notdef if (curBlock[j] != *(blk_ptr++)) { - printf("ARRAY ERROR: block %d\n", j); + printf("ARRAY ERROR: block %d\n", j); } temp = curBlock[j] - P_mean; #endif @@ -870,13 +870,13 @@ int getRateMode() * * Checks the string parsed from the parameter file. Verifies * number and sets global values. MPEG standard specifies that bit rate - * be rounded up to nearest 400 bits/sec. + * be rounded up to nearest 400 bits/sec. * * RETURNS: nothing * * SIDE EFFECTS: global variables * - * NOTES: Should this be in the 400-bit units used in sequence header? + * NOTES: Should this be in the 400-bit units used in sequence header? * *===========================================================================*/ void setBitRate (const char * const charPtr) @@ -888,7 +888,7 @@ void setBitRate (const char * const charPtr) RateControlMode = FIXED_RATE; } else { printf("Parameter File Error: invalid BIT_RATE: \"%s\", defaults to Variable ratemode\n", - charPtr); + charPtr); RateControlMode = VARIABLE_RATE; bit_rate = -1; } @@ -933,7 +933,7 @@ int getBitRate () * * SIDE EFFECTS: buffer_size global variable. * - * NOTES: The global is in bits, NOT the 16kb units used in sequence header + * NOTES: The global is in bits, NOT the 16kb units used in sequence header * *===========================================================================*/ void setBufferSize (const char * const charPtr) @@ -948,7 +948,7 @@ void setBufferSize (const char * const charPtr) } else { buffer_size = DEFAULT_BUFFER_SIZE; printf("Parameter File Error: invalid BUFFER_SIZE: \"%s\", defaults to : %d\n", - charPtr, buffer_size); + charPtr, buffer_size); } DBG_PRINT(("Buffer size is: %d\n", buffer_size)); } diff --git a/converter/ppm/ppmtompeg/rgbtoycc.c b/converter/ppm/ppmtompeg/rgbtoycc.c index 2dd1899a..9357c8d8 100644 --- a/converter/ppm/ppmtompeg/rgbtoycc.c +++ b/converter/ppm/ppmtompeg/rgbtoycc.c @@ -53,23 +53,23 @@ compute_mult_tables(const pixval maxval) { /* For speed, we do the arithmetic with eight tables that reduce a bunch of multiplications and divisions to a simple table lookup. - + Because a large maxval could require a significant amount of table space, we allocate the space dynamically. - If we had to compute the tables for every frame, it wouldn't be + If we had to compute the tables for every frame, it wouldn't be fast at all, but since all the frames normally have the same maxval, we only need to compute them once. But just in case, we check each frame to see if it has a different maxval and recompute the tables if so. */ - + if (table_maxval != maxval) { /* We need to compute or re-compute the multiplication tables */ if (table_maxval != 0) { free(mult299); free(mult587); free(mult114); free(mult16874); - free(mult33126); free(mult5); free(mult41869); free(mult08131); - } + free(mult33126); free(mult5); free(mult41869); free(mult08131); + } table_maxval = maxval; mult299 = malloc((table_maxval+1)*sizeof(float)); @@ -83,18 +83,18 @@ compute_mult_tables(const pixval maxval) { if (mult299 == NULL || mult587 == NULL || mult114 == NULL || mult16874 == NULL || mult33126 == NULL || mult5 == NULL || - mult41869 == NULL || mult08131 == NULL) + mult41869 == NULL || mult08131 == NULL) pm_error("Unable to allocate storage for arithmetic tables. " "We need %d bytes, which is the maxval of the input " "image, plus 1, " - "times the storage size of a floating point value.", + "times the storage size of a floating point value.", (unsigned)(8 * (table_maxval+1)*sizeof(float))); { int index; for (index = 0; index <= table_maxval; index++ ) { - mult299[index] = index*0.29900 * 255 / table_maxval; + mult299[index] = index*0.29900 * 255 / table_maxval; mult587[index] = index*0.58700 * 255 / table_maxval; mult114[index] = index*0.11400 * 255 / table_maxval; mult16874[index] = -0.16874*index * 255 / table_maxval; @@ -195,9 +195,9 @@ PNMtoYUV(MpegFrame * const frameP, mult41869[PPM_GETG(src1[1])] + mult08131[PPM_GETB(src1[1])]) / 4) + 128; - DBG_PRINT(("%3d,%3d: (%3d,%3d,%3d) --> (%3d,%3d,%3d)\n", - x, y, - PPM_GETR(*src0), PPM_GETG(*src0), PPM_GETB(*src0), + DBG_PRINT(("%3d,%3d: (%3d,%3d,%3d) --> (%3d,%3d,%3d)\n", + x, y, + PPM_GETR(*src0), PPM_GETG(*src0), PPM_GETB(*src0), *dy0, *dcb, *dcr)); } } diff --git a/converter/ppm/ppmtompeg/specifics.c b/converter/ppm/ppmtompeg/specifics.c index bd74e805..e8597978 100644 --- a/converter/ppm/ppmtompeg/specifics.c +++ b/converter/ppm/ppmtompeg/specifics.c @@ -1,13 +1,13 @@ /*===========================================================================* - * specifics.c * - * * - * basic procedures to deal with the specifics file * - * * - * EXPORTED PROCEDURES: * - * Specifics_Init * + * specifics.c * + * * + * basic procedures to deal with the specifics file * + * * + * EXPORTED PROCEDURES: * + * Specifics_Init * * Spec_Lookup * * SpecTypeLookup * - * * + * * *===========================================================================*/ /* @@ -69,7 +69,7 @@ void Parse_Specifics_File_v2 (FILE *fp); FrameSpecList *MakeFslEntry (void); void AddSlc (FrameSpecList *c,int snum, int qs); Block_Specifics *AddBs (FrameSpecList *c,int bnum, - boolean rel, int qs); + boolean rel, int qs); FrameSpecList *MakeFslEntry (void); #define my_upper(c) (((c>='a') && (c<='z')) ? (c-'a'+'A') : c) #define CvtType(x) ReallyCvt(my_upper(x)) @@ -221,24 +221,24 @@ FILE *fp; case 'V': lp += 7; if (1 != sscanf(lp, "%d", &vers)) { - fprintf(stderr," Improper version line in specs file: %s\n", line); + fprintf(stderr," Improper version line in specs file: %s\n", line); } else { - switch (vers) { - case 1: - version = vers; - Parse_Specifics_File_v1(fp); - break; - case 2: - version = vers; - Parse_Specifics_File_v2(fp); - break; - default: - fprintf(stderr, "Improper version line in specs file: %s\n", line); - fprintf(stderr, "\tSpecifics file will be IGNORED.\n"); - specificsOn = FALSE; - return; - break; - }} + switch (vers) { + case 1: + version = vers; + Parse_Specifics_File_v1(fp); + break; + case 2: + version = vers; + Parse_Specifics_File_v2(fp); + break; + default: + fprintf(stderr, "Improper version line in specs file: %s\n", line); + fprintf(stderr, "\tSpecifics file will be IGNORED.\n"); + specificsOn = FALSE; + return; + break; + }} break; default: fprintf(stderr, "Specifics file: What? *%s*\n", line); @@ -271,9 +271,9 @@ FILE *fp; lp += 6; sscanf(lp, "%d %c %d", &fnum, &typ, &qs); if (current->framenum != -1) { - new=MakeFslEntry(); - current->next = new; - current = new; + new=MakeFslEntry(); + current->next = new; + current = new; } current->framenum = fnum; current->frametype = CvtType(typ); @@ -581,8 +581,8 @@ int start_qs; found_it = FALSE; while (tmp != (FrameSpecList *) NULL) { if (tmp->framenum == fn) { - found_it = TRUE; - break; + found_it = TRUE; + break; } else tmp = tmp->next; } if (!found_it) return -1; @@ -591,20 +591,20 @@ int start_qs; if (last->framenum != fn) { /* cache miss! */ /* first check if it is next */ if ((last->next != (FrameSpecList *) NULL) && - (last->next->framenum == fn)) { - last = last->next; + (last->next->framenum == fn)) { + last = last->next; } else { - /* if not next, check from the start. - (this allows people to put frames out of order,even - though the spec doesn't allow it.) */ - tmp = fsl; - found_it = FALSE; - while (tmp != (FrameSpecList *) NULL) { - if (tmp->framenum==fn) {found_it = TRUE; break;} - tmp = tmp->next; - } - if (!found_it) return -1; - last = tmp; + /* if not next, check from the start. + (this allows people to put frames out of order,even + though the spec doesn't allow it.) */ + tmp = fsl; + found_it = FALSE; + while (tmp != (FrameSpecList *) NULL) { + if (tmp->framenum==fn) {found_it = TRUE; break;} + tmp = tmp->next; + } + if (!found_it) return -1; + last = tmp; } } } @@ -634,10 +634,10 @@ int start_qs; for (sptr = last->slc; sptr != (Slice_Specifics *) NULL; sptr = sptr->next) { if (sptr->num == num) { #ifdef BLEAH - printf("QSchange Slice %d.%d to %d\n", fn, num, sptr->qscale); + printf("QSchange Slice %d.%d to %d\n", fn, num, sptr->qscale); #endif - if (sptr->qscale == 0) return -1; - return sptr->qscale; + if (sptr->qscale == 0) return -1; + return sptr->qscale; } } break; @@ -649,30 +649,30 @@ int start_qs; } for (bptr=last->bs; bptr != (Block_Specifics *) NULL; bptr=bptr->next) { if (bptr->num == num) { - int new_one; + int new_one; #ifdef BLEAH - printf("QSchange Block %d.%d to %d\n", fn, num, bptr->qscale); + printf("QSchange Block %d.%d to %d\n", fn, num, bptr->qscale); #endif - *info = bptr->mv; - if (bptr->relative) { - if (bptr->qscale == 0) { - /* Do nothing! */ - new_one = start_qs; - } else { - new_one = start_qs + bptr->qscale + leftovers; - if (new_one < 1) { - leftovers = new_one - 1; - new_one = 1; - } else if (new_one > 31) { - leftovers = new_one - 31; - new_one = 31; - } else leftovers = 0; - }} - else { - new_one = bptr->qscale; - leftovers = 0; - } - return new_one; + *info = bptr->mv; + if (bptr->relative) { + if (bptr->qscale == 0) { + /* Do nothing! */ + new_one = start_qs; + } else { + new_one = start_qs + bptr->qscale + leftovers; + if (new_one < 1) { + leftovers = new_one - 1; + new_one = 1; + } else if (new_one > 31) { + leftovers = new_one - 31; + new_one = 31; + } else leftovers = 0; + }} + else { + new_one = bptr->qscale; + leftovers = 0; + } + return new_one; } } break; diff --git a/converter/ppm/ppmtompeg/subsample.c b/converter/ppm/ppmtompeg/subsample.c index 69401a1d..93b76db0 100644 --- a/converter/ppm/ppmtompeg/subsample.c +++ b/converter/ppm/ppmtompeg/subsample.c @@ -67,14 +67,14 @@ computePrevFyFx(MpegFrame * const prevFrame, if (yHalf) { if (m.y < 0) --*fyP; - + *prevP = prevFrame->halfBoth; } else *prevP = prevFrame->halfX; } else if (yHalf) { if (m.y < 0) --*fyP; - + *prevP = prevFrame->halfY; } else *prevP = prevFrame->ref_y; @@ -185,7 +185,7 @@ LumMotionErrorB(const LumBlock * const currentBlockP, computePrevFyFx(prevFrame, by, bx, m, &prev, &fy, &fx); diff = 0; /* initial value */ - + for (rowNumber = 0; rowNumber < 16; rowNumber +=2) { uint8 * const macross = &(prev[fy + rowNumber][fx]); const int32 * const currentRow = currentBlockP->l[rowNumber]; @@ -226,7 +226,7 @@ LumMotionErrorC(const LumBlock * const currentBlockP, computePrevFyFx(prevFrame, by, bx, m, &prev, &fy, &fx); diff = 0; /* initial value */ - + for (rowNumber = 1; rowNumber < 16; rowNumber +=2) { uint8 * const macross = &(prev[fy + rowNumber][fx]); const int32 * const currentRow = currentBlockP->l[rowNumber]; -- cgit 1.4.1