diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-06-26 18:15:09 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-06-26 18:15:09 +0000 |
commit | aab4792db8e0adcaf63cf57a1f5e0b18666dae47 (patch) | |
tree | bbfa9c4e12783d2dfd785c4e10964366550e9a60 /converter/ppm/ppmtompeg | |
parent | fe14f983ade44baa0794e4ce58a1a5334e46cf68 (diff) | |
download | netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.tar.gz netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.tar.xz netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.zip |
Promote Development to Advanced as Release 10.75.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2803 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ppmtompeg')
-rw-r--r-- | converter/ppm/ppmtompeg/frame.c | 18 | ||||
-rw-r--r-- | converter/ppm/ppmtompeg/frametype.c | 3 | ||||
-rw-r--r-- | converter/ppm/ppmtompeg/parallel.c | 2 | ||||
-rw-r--r-- | converter/ppm/ppmtompeg/ppmtompeg.c | 15 | ||||
-rw-r--r-- | converter/ppm/ppmtompeg/rate.c | 46 | ||||
-rw-r--r-- | converter/ppm/ppmtompeg/specifics.c | 242 |
6 files changed, 183 insertions, 143 deletions
diff --git a/converter/ppm/ppmtompeg/frame.c b/converter/ppm/ppmtompeg/frame.c index 75b209f8..f91f2cc6 100644 --- a/converter/ppm/ppmtompeg/frame.c +++ b/converter/ppm/ppmtompeg/frame.c @@ -82,8 +82,10 @@ Resize_Array_Width(uint8 ** const inarray, int out_total; uint8 *inptr; uint8 *outptr; +#ifdef DOING_INTERPOLATION uint8 pointA,pointB; - /* double slope,diff; */ + double slope,diff; +#endif for (i = 0; i < in_y; ++i) { /* For each row */ unsigned int j; @@ -105,11 +107,15 @@ Resize_Array_Width(uint8 ** const inarray, --inptr; } } else { +#ifdef DOING_INTERPOLATION pointA = *inptr; +#endif ++inptr; +#ifdef DOING_INTERPOLATION pointB = *inptr; +#endif --inptr; -#if 0 +#ifdef DOING_INTERPOLATION /*Interpolative solution */ slope = ((double)(pointB -pointA))/((double)(out_x)); diff = (((double)(out_total - in_total))); @@ -159,8 +165,10 @@ Resize_Array_Height(uint8 ** const inarray, for(i=0; i < in_x; ++i){ /* for each column */ int in_total; int out_total; +#ifdef DOING_INTERPOLATION uint8 pointA, pointB; double slope, diff; +#endif unsigned int j; int k; @@ -180,15 +188,17 @@ Resize_Array_Height(uint8 ** const inarray, --k; } } else { +#ifdef DOING_INTERPOLATION pointA = inarray[k][i]; - if (k != (in_y -1)) { + if (k != (in_y - 1)) { pointB = inarray[k+1][i]; } else pointB = pointA; /* Interpolative case */ slope = ((double)(pointB -pointA))/(double)(out_y); diff = (double)(out_total - in_total); - /* outarray[j][i] = (inarray[k][i] + (uint8)(slope*diff)); */ + outarray[j][i] = (inarray[k][i] + (uint8)(slope*diff)); +#endif /* Non-Interpolative case */ outarray[j][i] = inarray[k][i]; out_total = out_total + in_y; diff --git a/converter/ppm/ppmtompeg/frametype.c b/converter/ppm/ppmtompeg/frametype.c index b7daacc9..09afa403 100644 --- a/converter/ppm/ppmtompeg/frametype.c +++ b/converter/ppm/ppmtompeg/frametype.c @@ -264,7 +264,7 @@ ComputeFrameTable(unsigned int const numFramesArg) { 'numFrames' == 0 means number of frames is not known at this time. -----------------------------------------------------------------------------*/ int index; - FrameTable *lastI, *lastIP, *firstB, *secondIP; + FrameTable *lastIP, *firstB, *secondIP; FrameTable *ptr; char typ; int table_size; @@ -278,7 +278,6 @@ ComputeFrameTable(unsigned int const numFramesArg) { MALLOCARRAY_NOFAIL(frameTable, 1 + table_size); - lastI = NULL; lastIP = NULL; firstB = NULL; secondIP = NULL; diff --git a/converter/ppm/ppmtompeg/parallel.c b/converter/ppm/ppmtompeg/parallel.c index 2835c67c..e3bcec1a 100644 --- a/converter/ppm/ppmtompeg/parallel.c +++ b/converter/ppm/ppmtompeg/parallel.c @@ -2149,7 +2149,6 @@ DecodeServer(int const numInputFiles, int otherSock; int decodePortNum; int frameReady; - boolean *ready; int *waitMachine; int *waitPort; int *waitList; @@ -2162,7 +2161,6 @@ DecodeServer(int const numInputFiles, /* should keep list of port numbers to notify when frames become ready */ - ready = (boolean *) calloc(numInputFiles, sizeof(boolean)); waitMachine = (int *) calloc(numInputFiles, sizeof(int)); waitPort = (int *) malloc(numMachines*sizeof(int)); waitList = (int *) calloc(numMachines, sizeof(int)); diff --git a/converter/ppm/ppmtompeg/ppmtompeg.c b/converter/ppm/ppmtompeg/ppmtompeg.c index cd94db39..46224e84 100644 --- a/converter/ppm/ppmtompeg/ppmtompeg.c +++ b/converter/ppm/ppmtompeg/ppmtompeg.c @@ -190,16 +190,17 @@ parseArgs(int const argc, ++idx; } else if (streq(argv[idx], "-child")) { if (idx+7 < argc-1) { - int combinePortNumber; - /* This used to be important information, when the child - notified the combine server. Now the master notifies - the combine server after the child notifies the master - it is done. So this value is unused. - */ cmdlineP->masterHostname = argv[idx+1]; cmdlineP->masterPortNumber = atoi(argv[idx+2]); ioPortNumber = atoi(argv[idx+3]); - combinePortNumber = atoi(argv[idx+4]); + /* + combinePortNumber = atoi(argv[idx+4]); + + This used to be important information, when the child + notified the combine server. Now the master notifies + the combine server after the child notifies the master + it is done. So this value is unused. + */ decodePortNumber = atoi(argv[idx+5]); machineNumber = atoi(argv[idx+6]); remoteIO = atoi(argv[idx+7]); diff --git a/converter/ppm/ppmtompeg/rate.c b/converter/ppm/ppmtompeg/rate.c index c775e055..6ec330cf 100644 --- a/converter/ppm/ppmtompeg/rate.c +++ b/converter/ppm/ppmtompeg/rate.c @@ -389,7 +389,6 @@ targetRateControl(MpegFrame * const frame) { float tempX, tempY, tempZ; int result; int frameType; - const char *strPtr; minimumBits = (bit_rate / (8 * frameRateRounded)); @@ -445,14 +444,18 @@ targetRateControl(MpegFrame * const frame) { Qscale = (mquant > 31 ? 31 : mquant); Qscale = (Qscale < 1 ? 1 : Qscale); - /* Print headers for Frame info */ - strPtr = Frame_header1; - DBG_PRINT(("%s\n",strPtr)); - strPtr = Frame_header2; - DBG_PRINT(("%s\n",strPtr)); - strPtr = Frame_header3; - DBG_PRINT(("%s\n",strPtr)); - +#ifdef HEINOUS_DEBUG_MODE + { + const char * strPtr; + /* Print headers for Frame info */ + strPtr = Frame_header1; + DBG_PRINT(("%s\n",strPtr)); + strPtr = Frame_header2; + DBG_PRINT(("%s\n",strPtr)); + strPtr = Frame_header3; + DBG_PRINT(("%s\n",strPtr)); + } +#endif /* Print Frame info */ sprintf(rc_buffer, "%4d %1c %4d %6d %7d " "%2d %2d %2d %2.2f %6d %4d %3d", @@ -467,10 +470,13 @@ targetRateControl(MpegFrame * const frame) { /* Print headers for Macroblock info */ if (RC_MB_SAMPLE_RATE) { +#ifdef HEINOUS_DEBUG_MODE + const char * strPtr; strPtr = MB_header1; DBG_PRINT(("%s\n",strPtr)); strPtr = MB_header2; DBG_PRINT(("%s\n",strPtr)); +#endif } } @@ -519,7 +525,6 @@ void updateRateControl(int const type) { int totalBits, frameComplexity, pctAllocUsed, pctGOPUsed; float avgQuant; - const char *strPtr; totalBits = rc_totalFrameBits; avgQuant = ((float) rc_totalQuant / (float) rc_numBlocks); @@ -559,15 +564,18 @@ updateRateControl(int const type) { break; } - - /* Print Frame info */ - strPtr = Frame_trailer1; - DBG_PRINT(("%s\n",strPtr)); - strPtr = Frame_trailer2; - DBG_PRINT(("%s\n",strPtr)); - strPtr = Frame_trailer3; - DBG_PRINT(("%s\n",strPtr)); - +#ifdef HEINOUS_DEBUG_MODE + { + /* Print Frame info */ + const char * strPtr; + strPtr = Frame_trailer1; + DBG_PRINT(("%s\n",strPtr)); + strPtr = Frame_trailer2; + DBG_PRINT(("%s\n",strPtr)); + strPtr = Frame_trailer3; + DBG_PRINT(("%s\n",strPtr)); + } +#endif sprintf(rc_buffer, "%6d %2.2f %6d %3d %2.2f %7d " "%3d %7d %3d %6d %6d", totalBits, avgQuant, frameComplexity, avg_act, N_act, diff --git a/converter/ppm/ppmtompeg/specifics.c b/converter/ppm/ppmtompeg/specifics.c index fb5e3649..1a1fda44 100644 --- a/converter/ppm/ppmtompeg/specifics.c +++ b/converter/ppm/ppmtompeg/specifics.c @@ -36,6 +36,7 @@ * HEADER FILES * *==============*/ +#include "netpbm/mallocvar.h" #include "all.h" #include "mtypes.h" #include "frames.h" @@ -239,7 +240,6 @@ FILE *fp; FrameSpecList *current, *new; char typ; int fnum,snum, bnum, qs, newqs; - int num_scanned; fsl = MakeFslEntry(); current = fsl; @@ -274,7 +274,7 @@ FILE *fp; break; case 'B': lp += 6; - num_scanned = sscanf(lp, "%d %d", &bnum, &newqs); + sscanf(lp, "%d %d", &bnum, &newqs); if (qs == newqs) break; qs = newqs; AddBs(current, bnum, FALSE, qs); @@ -289,116 +289,140 @@ FILE *fp; } -/* Version 2 */ -void Parse_Specifics_File_v2(fp) -FILE *fp; -{ - char line[1024], *lp; - FrameSpecList *current, *new; - char typ; - int fnum, snum, bnum, qs, newqs; - int num_scanned, fx=0, fy=0, sx=0, sy=0; - char kind[100]; - Block_Specifics *new_blk; - boolean relative; - fsl = MakeFslEntry(); - current = fsl; - while ((fgets(line,1023,fp))!=NULL) { - lp = &line[0]; - while ((*lp == ' ') || (*lp == '\t')) lp++; - if (( *lp == '#' ) || (*lp=='\n')) { - continue; +void +Parse_Specifics_File_v2(FILE * const fP) { +/*---------------------------------------------------------------------------- + Parse Version 2 specific file. +-----------------------------------------------------------------------------*/ + char line[1024]; + FrameSpecList * current; + int qs; + int numScanned; + int fx, fy, sx, sy; + char kind[100]; + Block_Specifics *new_blk; + boolean relative; + + fx = fy = sx = sy = 0; /* initial value */ + + fsl = MakeFslEntry(); + current = fsl; + + while ((fgets(line,1023, fP))!=NULL) { + const char * lp; + + lp = &line[0]; /* initial value */ + + while ((*lp == ' ') || (*lp == '\t')) + ++lp; + if (*lp == '#' || *lp == '\n') { + /* comment or blank line */ + } else { + switch (my_upper(*lp)) { + case 'F': { + char typ; + FrameSpecList * new; + int fnum; + + lp += 6; + sscanf(lp,"%d %c %d", &fnum, &typ, &qs); + new = MakeFslEntry(); + if (current->framenum != -1) { + current->next = new; + current = new; + } + current->framenum = fnum; + current->frametype = CvtType(typ); + if (qs <= 0) + qs = -1; + current->qscale = qs; + } break; + case 'S': { + int snum; + int newqs; + lp += 6; + sscanf(lp,"%d %d", &snum, &newqs); + if (qs == newqs) + break; + qs = newqs; + AddSlc(current, snum, qs); + } break; + case 'B': { + int bnum; + int newqs; + lp += 6; + numScanned = 0; + bnum = atoi(lp); + SkipToSpace(lp); + while ((*lp != '-') && (*lp != '+') && + ((*lp < '0') || (*lp > '9'))) + ++lp; + relative = (*lp == '-' || *lp == '+'); + newqs = atoi(lp); + SkipToSpace(lp); + if (EndString(lp)) { + numScanned = 2; + } else { + numScanned = + 2 + sscanf(lp, "%s %d %d %d %d", + kind, &fx, &fy, &sx, &sy); + } + + qs = newqs; + new_blk = AddBs(current, bnum, relative, qs); + if (numScanned > 2) { + BlockMV * tmp; + + MALLOCVAR(tmp); + + switch (numScanned) { + case 7: + tmp->typ = TYP_BOTH; + tmp->fx = fx; + tmp->fy = fy; + tmp->bx = sx; + tmp->by = sy; + new_blk->mv = tmp; + break; + case 3: + tmp->typ = TYP_SKIP; + new_blk->mv = tmp; + break; + case 5: + if (my_upper(kind[0]) == 'B') { + tmp->typ = TYP_BACK; + tmp->bx = fx; + tmp->by = fy; + } else { + tmp->typ = TYP_FORW; + tmp->fx = fx; + tmp->fy = fy; + } + new_blk->mv = tmp; + break; + default: + fprintf(stderr, + "Bug in specifics file! " + "Skipping short/long entry: %s\n",line); + break; + } + } else + new_blk->mv = NULL; + + } break; + case 'V': + fprintf(stderr, + "Cannot specify version twice! Taking first (%d).\n", + version); + break; + default: + printf("What? *%s*\n",line); + break; + } + } } - - switch (my_upper(*lp)) { - case 'F': - lp += 6; - sscanf(lp,"%d %c %d", &fnum, &typ, &qs); - new = MakeFslEntry(); - if (current->framenum != -1) { - current->next = new; - current = new; - } - current->framenum = fnum; - current->frametype = CvtType(typ); - if (qs <= 0) qs = -1; - current->qscale = qs; - break; - case 'S': - lp += 6; - sscanf(lp,"%d %d", &snum, &newqs); - if (qs == newqs) break; - qs = newqs; - AddSlc(current, snum, qs); - break; - case 'B': - lp += 6; - num_scanned = 0; - bnum = atoi(lp); - SkipToSpace(lp); - while ((*lp != '-') && (*lp != '+') && - ((*lp < '0') || (*lp > '9'))) lp++; - relative = ((*lp == '-') || (*lp == '+')); - newqs = atoi(lp); - SkipToSpace(lp); - if (EndString(lp)) { - num_scanned = 2; - } else { - num_scanned = 2+sscanf(lp, "%s %d %d %d %d", kind, &fx, &fy, &sx, &sy); - } - - qs = newqs; - new_blk = AddBs(current, bnum, relative, qs); - if (num_scanned > 2) { - BlockMV *tmp; - tmp = (BlockMV *) malloc(sizeof(BlockMV)); - switch (num_scanned) { - case 7: - tmp->typ = TYP_BOTH; - tmp->fx = fx; - tmp->fy = fy; - tmp->bx = sx; - tmp->by = sy; - new_blk->mv = tmp; - break; - case 3: - tmp->typ = TYP_SKIP; - new_blk->mv = tmp; - break; - case 5: - if (my_upper(kind[0]) == 'B') { - tmp->typ = TYP_BACK; - tmp->bx = fx; - tmp->by = fy; - } else { - tmp->typ = TYP_FORW; - tmp->fx = fx; - tmp->fy = fy; - } - new_blk->mv = tmp; - break; - default: - fprintf(stderr, - "Bug in specifics file! Skipping short/long entry: %s\n",line); - break; - } - } else { - new_blk->mv = (BlockMV *) NULL; - } - - break; - case 'V': - fprintf(stderr, - "Cannot specify version twice! Taking first (%d).\n", - version); - break; - default: - printf("What? *%s*\n",line); - break; - }} - } |