⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 param.c

📁 These are all the utilities you need to generate MPEG-I movies on a UNIX box with full motion video
💻 C
📖 第 1 页 / 共 2 页
字号:
		    Fsize_Validate(&yuvWidth, &yuvHeight);		    optionSeen[OPTION_YUV_SIZE] = TRUE;		}		break;	    default:		break;	}    }    fclose(fpointer);    for ( index = FIRST_OPTION; index <= LAST_OPTION; index++ ) {	if ( ! optionSeen[index] ) {	    fprintf(stdout, "ERROR:  Missing option '%s'\n", optionText[index]);	    exit(1);	}    }    /* error checking */    if ( yuvUsed && (! optionSeen[OPTION_YUV_SIZE]) ) {        fprintf(stderr, "ERROR:  YUV format used but YUV_SIZE not given\n");	exit(1);    }    if ( optionSeen[OPTION_IO_CONVERT] != optionSeen[OPTION_SLAVE_CONVERT] ) {        fprintf(stderr, "ERROR:  must have either both IO_SERVER_CONVERT and SLAVE_CONVERT\n");        fprintf(stderr, "        or neither\n");	exit(1);    }    SetIOConvert(optionSeen[OPTION_IO_CONVERT]);    SetFCode();    if ( psearchAlg == PSEARCH_TWOLEVEL )	SetPixelSearch("HALF");    return TRUE;}/*===========================================================================* * * GetNthInputFileName * *	finds the nth input file name * * RETURNS:	name is placed in already allocated fileName string * * SIDE EFFECTS:    none * *===========================================================================*/voidGetNthInputFileName(fileName, n)    char *fileName;    int n;{    static int	lastN = 0, lastMapN = 0, lastSoFar = 0;    int	    mapN;    register int index;    int	    soFar;    int	    loop;    int	    numPadding;    char    numBuffer[33];    /* assumes n is within bounds 0...numInputFiles-1 */    if ( n >= lastN ) {	soFar = lastSoFar;	index = lastMapN;    } else {	soFar = 0;	index = 0;    }    while ( soFar + inputFileEntries[index]->numFiles <= n ) {	soFar +=  inputFileEntries[index]->numFiles;	index++;    }    mapN = index;    index = inputFileEntries[mapN]->startID +	    inputFileEntries[mapN]->skip*(n-soFar);    numPadding = inputFileEntries[mapN]->numPadding;    if ( numPadding != -1 ) {	sprintf(numBuffer, "%32d", index);	for ( loop = 32-numPadding; loop < 32; loop++ ) {	    if ( numBuffer[loop] != ' ' ) {		break;	    } else {		numBuffer[loop] = '0';	    }	}	sprintf(fileName, "%s%s%s",		inputFileEntries[mapN]->left,		&numBuffer[32-numPadding],		inputFileEntries[mapN]->right);    } else {	sprintf(fileName, "%s%d%s",		inputFileEntries[mapN]->left,		index,		inputFileEntries[mapN]->right);    }    lastN = n;    lastMapN = mapN;    lastSoFar = soFar;}/*=====================* * INTERNAL PROCEDURES * *=====================*//*===========================================================================* * * ReadMachineNames * *	read a list of machine names for parallel execution * * RETURNS:	nothing * * SIDE EFFECTS:    machine info updated * *===========================================================================*/static voidReadMachineNames(fpointer)    FILE *fpointer;{    char    input[256];    char    *charPtr;    while ( (fgets(input, 256, fpointer) != NULL) &&	    (strncmp(input, "END_PARALLEL", 12) != 0) ) {	if ( input[0] == '#' ) {	    continue;	}	if ( strncmp(input, "REMOTE", 6) == 0 ) {	    charPtr = SkipSpacesTabs(&input[6]);	    remote[numMachines] = TRUE;	    sscanf(charPtr, "%s %s %s %s", machineName[numMachines],		   userName[numMachines], executable[numMachines],		   remoteParamFile[numMachines]);	} else {	    remote[numMachines] = FALSE;	    sscanf(input, "%s %s %s", machineName[numMachines],		   userName[numMachines], executable[numMachines]);	}	numMachines++;    }}/*===========================================================================* * * ReadInputFileNames * *	read a list of input file names * * RETURNS:	nothing * * SIDE EFFECTS:    info stored for retrieval using GetNthInputFileName * *===========================================================================*/static voidReadInputFileNames(fpointer, endInput)    FILE *fpointer;    char *endInput;{    char    input[256];    char left[256], right[256];    char *globPtr, *charPtr;    char leftNumText[256], rightNumText[256];    char    skipNumText[256];    int	leftNum, rightNum;    int	    skipNum;    boolean padding;    int	    numPadding = 0;    int	    length;    inputFileEntries = (InputFileEntry **) malloc(INPUT_ENTRY_BLOCK_SIZE*						  sizeof(InputFileEntry *));    maxInputFileEntries = INPUT_ENTRY_BLOCK_SIZE;    length = strlen(endInput);    /* read input files up until endInput */    while ( (fgets(input, 256, fpointer) != NULL) &&	    (strncmp(input, endInput, length) != 0) ) {	if ( input[0] == '#' ) {	    continue;	}	input[strlen(input)-1] = '\0';	/* get rid of newline */	if ( numInputFileEntries == maxInputFileEntries ) {    /* more space */	    maxInputFileEntries += INPUT_ENTRY_BLOCK_SIZE;	    inputFileEntries = realloc(inputFileEntries,		((maxInputFileEntries)*(sizeof(InputFileEntry *))));	}	inputFileEntries[numInputFileEntries] = (InputFileEntry *)						malloc(sizeof(InputFileEntry));	if ( input[strlen(input)-1] == ']' ) {	    inputFileEntries[numInputFileEntries]->glob = TRUE;	    /* star expand */	    globPtr = input;	    charPtr = left;	    /* copy left of '*' */	    while ( (*globPtr != '\0') && (*globPtr != '*') ) {		*charPtr = *globPtr;		charPtr++;		globPtr++;	    }	    *charPtr = '\0';	    globPtr++;	    charPtr = right;	    /* copy right of '*' */	    while ( (*globPtr != '\0') && (*globPtr != ' ') &&		    (*globPtr != '\t') ) {		*charPtr = *globPtr;		charPtr++;		globPtr++;	    }	    *charPtr = '\0';	    globPtr = SkipSpacesTabs(globPtr);	    if ( *globPtr != '[' ) {		fprintf(stderr, "ERROR:  Invalid input file expansion expression (no '[')\n");		exit(1);	    }	    globPtr++;	    charPtr = leftNumText;	    /* copy left number */	    while ( isdigit(*globPtr) ) {		*charPtr = *globPtr;		charPtr++;		globPtr++;	    }	    *charPtr = '\0';	    if ( *globPtr != '-' ) {		fprintf(stderr, "ERROR:  Invalid input file expansion expression (no '-')\n");		exit(1);	    }	    globPtr++;	    charPtr = rightNumText;	    /* copy right number */	    while ( isdigit(*globPtr) ) {		*charPtr = *globPtr;		charPtr++;		globPtr++;	    }	    *charPtr = '\0';	    if ( *globPtr != ']' ) {		if ( *globPtr != '+' ) {		    fprintf(stderr, "ERROR:  Invalid input file expansion expression (no ']')\n");		    exit(1);		}		globPtr++;		charPtr = skipNumText;		/* copy skip number */		while ( isdigit(*globPtr) ) {		    *charPtr = *globPtr;		    charPtr++;		    globPtr++;		}		*charPtr = '\0';		if ( *globPtr != ']' ) {		    fprintf(stderr, "ERROR:  Invalid input file expansion expression (no ']')\n");		    exit(1);		}		skipNum = atoi(skipNumText);	    } else {		skipNum = 1;	    }	    leftNum = atoi(leftNumText);	    rightNum = atoi(rightNumText);	    if ( (leftNumText[0] == '0') && (leftNumText[1] != '\0') ) {		padding = TRUE;		numPadding = strlen(leftNumText);	    } else {		padding = FALSE;	    }	    inputFileEntries[numInputFileEntries]->startID = leftNum;	    inputFileEntries[numInputFileEntries]->endID = rightNum;	    inputFileEntries[numInputFileEntries]->skip = skipNum;	    inputFileEntries[numInputFileEntries]->numFiles = (rightNum-leftNum+1)/skipNum;	    strcpy(inputFileEntries[numInputFileEntries]->left, left);	    strcpy(inputFileEntries[numInputFileEntries]->right, right);	    if ( padding ) {		inputFileEntries[numInputFileEntries]->numPadding = numPadding;	    } else {		inputFileEntries[numInputFileEntries]->numPadding = -1;	    }	} else {	    strcpy(inputFileEntries[numInputFileEntries]->left, input);	    inputFileEntries[numInputFileEntries]->glob = FALSE;	    inputFileEntries[numInputFileEntries]->numFiles = 1;	}	numInputFiles += inputFileEntries[numInputFileEntries]->numFiles;	numInputFileEntries++;    }}/*===========================================================================* * * SkipSpacesTabs * *	skip all spaces and tabs * * RETURNS:	point to next character not a space or tab * * SIDE EFFECTS:    none * *===========================================================================*/static char *SkipSpacesTabs(start)    char *start;{    while ( (*start == ' ') || (*start == '\t') ) {	start++;    }    return start;}/***********************************************************************************************************************************/voidJM2JPEG(){ char full_path[MAXPATHLEN + 256]; char inter_file[MAXPATHLEN +256]; int ci; for(ci=0;ci<numInputFileEntries;ci++){ inter_file[0] = '\0'; full_path[0] = '\0'; strcpy(full_path, currentPath); strcat(full_path, "/"); strcat(full_path, inputFileEntries[ci]->left); strcpy(inter_file,full_path); strcat(full_path, inputFileEntries[ci]->right); fprintf(stderr, "%s\n",full_path);  JMovie2JPEG(full_path,     inter_file,     inputFileEntries[ci]->startID,inputFileEntries[ci]->endID);}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -