diff options
Diffstat (limited to 'converter/ppm/ppmtompeg/block.c')
-rw-r--r-- | converter/ppm/ppmtompeg/block.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/converter/ppm/ppmtompeg/block.c b/converter/ppm/ppmtompeg/block.c index 913518c4..db8dc277 100644 --- a/converter/ppm/ppmtompeg/block.c +++ b/converter/ppm/ppmtompeg/block.c @@ -42,6 +42,8 @@ halfVector(vector const v) { return half; } + + /*===========================* * COMPUTE DCT OF DIFFERENCE * *===========================*/ @@ -106,7 +108,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 +205,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 +265,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 +280,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]); @@ -361,6 +363,7 @@ ComputeMotionLumBlock(MpegFrame * const prevFrame, } + /*=======================* * BASIC ERROR FUNCTIONS * *=======================*/ @@ -410,7 +413,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 +455,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 +464,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 +492,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 +513,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 +601,7 @@ LumAddMotionError(const LumBlock * const currentBlockP, if (diff > bestSoFar) return diff; } - + /* This is what's happening: * * ComputeMotionLumBlock(prevFrame, by, bx, my, mx, lumMotionBlock); @@ -691,6 +694,7 @@ AddMotionBlock(Block block, } + /*===========================================================================* * * adds the motion-compensated B-frame block to the given block @@ -734,6 +738,7 @@ AddBMotionBlock(Block block, } + /*===========================================================================* * * copies the given block into the appropriate data area @@ -764,6 +769,7 @@ BlockToData(uint8 ** const data, } + /*===========================================================================* * * copies data into appropriate blocks @@ -834,6 +840,7 @@ BlockifyFrame(MpegFrame * const frameP) { } + /*===========================================================================* * * * UNUSED PROCEDURES * @@ -855,7 +862,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 +896,7 @@ ComputeSubSampledMotionLumBlock(MpegFrame * const prevFrame, if ( my < 0 ) { fy--; } - + prev = prevFrame->halfBoth; } else { prev = prevFrame->halfX; @@ -925,6 +932,7 @@ ComputeSubSampledMotionLumBlock(MpegFrame * const prevFrame, } + /*===========================================================================* * * return the MAD of the currentBlock and the motion-compensated block, @@ -974,7 +982,7 @@ LumMotionErrorSubSampled(LumBlock const currentBlock, if ( my < 0 ) { fy--; } - + prev = prevFrame->halfBoth; } else { prev = prevFrame->halfX; @@ -1021,6 +1029,7 @@ LumMotionErrorSubSampled(LumBlock const currentBlock, } + #endif /* UNUSED_PROCEDURES */ /* * Copyright (c) 1995 The Regents of the University of California. |