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

📄 convertpar.cpp

📁 MPEG-4编解码的实现(包括MPEG4视音频编解码)
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			fatal_error("Conversion aborted");
		}
		/*************/
		fprintf(pfOut, "Alpha.QuantDecouple.Enable [%d] = %d\n", iObj, rgbNoGrayQuantUpdate [BASE_LAYER] [iObj]);
		/*************/
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &(rgbNoGrayQuantUpdate [ENHN_LAYER] [iObj])) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			/*************/
			fprintf(pfOut, "Alpha.QuantDecouple.Enable [%d] = %d\n", iObj + nVO, rgbNoGrayQuantUpdate [ENHN_LAYER] [iObj]);
			/*************/
		}
	}

	// number of P-VOP's between 2 I-VOP's; if there are B-VOPs, the no. of encode frames will multiply
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgiNumPbetweenIVOP [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		/*************/
		fprintf(pfOut, "Motion.PBetweenICount [%d] = %d\n", iObj, rgiNumPbetweenIVOP [iObj]);
		/*************/
	}

	// number of B-VOP's between 2 P-VOP's
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgiNumBbetweenPVOP [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgiNumBbetweenPVOP [iObj] >= 0);
		/*************/
		fprintf(pfOut, "Motion.BBetweenPCount [%d] = %d\n", iObj, rgiNumBbetweenPVOP [iObj]);
		/*************/
	}

	if(iVersion>814)
	{
		// rgbAllowSkippedPMBs
		nextValidLine (pfPara, pnLine);
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgbAllowSkippedPMBs [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rgbAllowSkippedPMBs [iObj] == 0 || rgbAllowSkippedPMBs[iObj]==1);
		}
	}
	else
		for (iObj = 0; iObj < nVO; iObj++)
			rgbAllowSkippedPMBs [iObj] = 1;

	for (iObj = 0; iObj < nVO; iObj++)
		/*************/
		fprintf(pfOut, "Motion.SkippedMB.Enable [%d] = %d\n", iObj, rgbAllowSkippedPMBs [iObj]);
		/*************/

	//added to encode GOV header by SONY 980212
	//number of VOP between GOV header
	//CAUTION:GOV period is not used in spatial scalable coding
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgiGOVperiod [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgiGOVperiod [iObj] >= 0);
		/*************/
		fprintf(pfOut, "GOV.Enable [%d] = %d\n", iObj, rgiGOVperiod [iObj] > 0);
		fprintf(pfOut, "GOV.Period [%d] = %d\n", iObj, rgiGOVperiod [iObj]);
		/*************/
	}
	//980212

	// deblocking filter disable
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgbDeblockFilterDisable [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		/*************/
		fprintf(pfOut, "Motion.DeblockingFilter.Enable [%d] = %d\n", iObj, !rgbDeblockFilterDisable [iObj]);
		/*************/
	}

	// Temporal sampling rate
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgiTSRate [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgiTSRate [iObj] >= 1);
		/*************/
		fprintf(pfOut, "Source.SamplingRate [%d] = %d\n", iObj, rgiTSRate [iObj]);
		/*************/
	}
	if ( bAnyScalability ){ // This part is added by Norio Ito
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgiEnhcTSRate [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rgiEnhcTSRate [iObj] >= 1);
			/*************/
			fprintf(pfOut, "Source.SamplingRate [%d] = %d\n", iObj + nVO, rgiEnhcTSRate [iObj]);
			/*************/
		}
	}

	// maximum displacement
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++) {
		if (fscanf (pfPara, "%d", &rguiSearchRange [BASE_LAYER] [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rguiSearchRange [BASE_LAYER] [iObj] >= 1);
		/*************/
		fprintf(pfOut, "Motion.SearchRange [%d] = %d\n", iObj, rguiSearchRange [BASE_LAYER] [iObj]);
		/*************/
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++) {
			if (fscanf (pfPara, "%d", &rguiSearchRange [ENHN_LAYER] [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rguiSearchRange [ENHN_LAYER] [iObj] >= 1);
			/*************/
			fprintf(pfOut, "Motion.SearchRange [%d] = %d\n", iObj + nVO, rguiSearchRange [ENHN_LAYER] [iObj]);
			/*************/
		}
	}

	// use original or reconstructed previous VO for ME
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgbOriginalME [BASE_LAYER] [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgbOriginalME [BASE_LAYER] [iObj] == 0 || rgbOriginalME [BASE_LAYER] [iObj] == 1);
		/*************/
		fprintf(pfOut, "Motion.UseSourceForME.Enable [%d] = %d\n", iObj, rgbOriginalME [BASE_LAYER] [iObj]);
		/*************/
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgbOriginalME [ENHN_LAYER] [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rgbOriginalME [ENHN_LAYER] [iObj] == 0 || rgbOriginalME [ENHN_LAYER] [iObj] == 1);
			/*************/
			fprintf(pfOut, "Motion.UseSourceForME.Enable [%d] = %d\n", iObj + nVO, rgbOriginalME [ENHN_LAYER] [iObj]);
			/*************/
		}
	}

	// disable advance prediction (obmc only)?
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgbAdvPredDisable [BASE_LAYER] [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgbAdvPredDisable [BASE_LAYER] [iObj] == 0 || rgbAdvPredDisable [BASE_LAYER] [iObj] == 1);
		/*************/
		fprintf(pfOut, "Motion.AdvancedPrediction.Enable [%d] = %d\n", iObj, !rgbAdvPredDisable [BASE_LAYER] [iObj]);
		/*************/
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgbAdvPredDisable [ENHN_LAYER] [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rgbAdvPredDisable [ENHN_LAYER] [iObj] == 0 || rgbAdvPredDisable [ENHN_LAYER] [iObj] == 1);
			/*************/
			fprintf(pfOut, "Motion.AdvancedPrediction.Enable [%d] = %d\n", iObj + nVO, !rgbAdvPredDisable [ENHN_LAYER] [iObj]);
			/*************/
		}
	}

	// START: Complexity Estimation syntax support - Marc Mongenet (EPFL) - 16 Jun 1998
	readBoolVOLFlag (rgbComplexityEstimationDisable, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbOpaque, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbTransparent, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbIntraCAE, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbInterCAE, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbNoUpdate, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbUpsampling, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbIntraBlocks, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbInterBlocks, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbInter4vBlocks, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbNotCodedBlocks, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbDCTCoefs, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbDCTLines, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbVLCSymbols, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbVLCBits, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbAPM, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbNPM, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbInterpolateMCQ, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbForwBackMCQ, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbHalfpel2, nVO, pfPara, pnLine, bAnyScalability);
	readBoolVOLFlag (rgbHalfpel4, nVO, pfPara, pnLine, bAnyScalability);
	// END: Complexity Estimation syntax support

	/*************/
	for(iObj = 0; iObj<nVO; iObj++)
	{
		fprintf(pfOut, "Complexity.Enable [%d] = %d\n", iObj, !rgbComplexityEstimationDisable [BASE_LAYER] [iObj]);
		if(!rgbComplexityEstimationDisable [BASE_LAYER] [iObj])
		{
			fprintf(pfOut, "Complexity.Opaque.Enable [%d] = %d\n", iObj, rgbOpaque [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.Transparent.Enable [%d] = %d\n", iObj, rgbTransparent [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.IntraCAE.Enable [%d] = %d\n", iObj, rgbIntraCAE [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.InterCAE.Enable [%d] = %d\n", iObj, rgbInterCAE [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.NoUpdate.Enable [%d] = %d\n", iObj, rgbNoUpdate [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.UpSampling.Enable [%d] = %d\n", iObj, rgbUpsampling [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.IntraBlocks.Enable [%d] = %d\n", iObj, rgbIntraBlocks [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.InterBlocks.Enable [%d] = %d\n", iObj, rgbInterBlocks [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.Inter4VBlocks.Enable [%d] = %d\n", iObj, rgbInter4vBlocks [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.NotCodedBlocks.Enable [%d] = %d\n", iObj, rgbNotCodedBlocks [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.DCTCoefs.Enable [%d] = %d\n", iObj, rgbDCTCoefs [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.DCTLines.Enable [%d] = %d\n", iObj, rgbDCTLines [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.VLCSymbols.Enable [%d] = %d\n", iObj, rgbVLCSymbols [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.VLCBits.Enable [%d] = %d\n", iObj, rgbVLCBits [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.APM.Enable [%d] = %d\n", iObj, rgbAPM [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.NPM.Enable [%d] = %d\n", iObj, rgbNPM [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.InterpMCQ.Enable [%d] = %d\n", iObj, rgbInterpolateMCQ [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.ForwBackMCQ.Enable [%d] = %d\n", iObj, rgbForwBackMCQ [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.HalfPel2.Enable [%d] = %d\n", iObj, rgbHalfpel2 [BASE_LAYER] [iObj]);
			fprintf(pfOut, "Complexity.HalfPel4.Enable [%d] = %d\n", iObj, rgbHalfpel4 [BASE_LAYER] [iObj]);
		}
		if(bAnyScalability)
		{
			fprintf(pfOut, "Complexity.Enable [%d] = %d\n", iObj + nVO, !rgbComplexityEstimationDisable [ENHN_LAYER] [iObj]);
			if(!rgbComplexityEstimationDisable [BASE_LAYER] [iObj])
			{
				fprintf(pfOut, "Complexity.Opaque.Enable [%d] = %d\n", iObj + nVO, rgbOpaque [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.Transparent.Enable [%d] = %d\n", iObj + nVO, rgbTransparent [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.IntraCAE.Enable [%d] = %d\n", iObj + nVO, rgbIntraCAE [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.InterCAE.Enable [%d] = %d\n", iObj + nVO, rgbInterCAE [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.NoUpdate.Enable [%d] = %d\n", iObj + nVO, rgbNoUpdate [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.UpSampling.Enable [%d] = %d\n", iObj + nVO, rgbUpsampling [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.IntraBlocks.Enable [%d] = %d\n", iObj + nVO, rgbIntraBlocks [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.InterBlocks.Enable [%d] = %d\n", iObj + nVO, rgbInterBlocks [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.Inter4VBlocks.Enable [%d] = %d\n", iObj + nVO, rgbInter4vBlocks [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.NotCodedBlocks.Enable [%d] = %d\n", iObj + nVO, rgbNotCodedBlocks [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.DCTCoefs.Enable [%d] = %d\n", iObj + nVO, rgbDCTCoefs [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.DCTLines.Enable [%d] = %d\n", iObj + nVO, rgbDCTLines [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.VLCSymbols.Enable [%d] = %d\n", iObj + nVO, rgbVLCSymbols [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.VLCBits.Enable [%d] = %d\n", iObj + nVO, rgbVLCBits [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.APM.Enable [%d] = %d\n", iObj + nVO, rgbAPM [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.NPM.Enable [%d] = %d\n", iObj + nVO, rgbNPM [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.InterpMCQ.Enable [%d] = %d\n", iObj + nVO, rgbInterpolateMCQ [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.ForwBackMCQ.Enable [%d] = %d\n", iObj + nVO, rgbForwBackMCQ [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.HalfPel2.Enable [%d] = %d\n", iObj + nVO, rgbHalfpel2 [ENHN_LAYER] [iObj]);
				fprintf(pfOut, "Complexity.HalfPel4.Enable [%d] = %d\n", iObj + nVO, rgbHalfpel4 [ENHN_LAYER] [iObj]);
			}
		}
	}
	/*************/

	// START: VOL Control Parameters
	if(iVersion>813)
	{
		readItem(rguiVolControlParameters, nVO, pfPara, pnLine, bAnyScalability);
		readItem(rguiChromaFormat, nVO, pfPara, pnLine, bAnyScalability);
		readItem(rguiLowDelay, nVO, pfPara, pnLine, bAnyScalability);
		readItem(rguiVBVParams, nVO, pfPara, pnLine, bAnyScalability);
		readItem(rguiBitRate, nVO, pfPara, pnLine, bAnyScalability);
		readItem(rguiVbvBufferSize, nVO, pfPara, pnLine, bAnyScalability);
		readItem(rguiVbvBufferOccupany, nVO, pfPara, pnLine, bAnyScalability);
	}
	else
	{
		for(iObj = 0; iObj<nVO; iObj++)
		{
			rguiVolControlParameters[BASE_LAYER][iObj] = 0;
			rguiVolControlParameters[ENHN_LAYER][iObj] = 0;
			rguiChromaFormat[BASE_LAYER][iObj] = 0;
			rguiChromaFormat[ENHN_LAYER][iObj] = 0;
			rguiLowDelay[BASE_LAYER][iObj] = 0;
			rguiLowDelay[ENHN_LAYER][iObj] = 0;
			rguiVBVParams[BASE_LAYER][iObj] = 0;
			rguiVBVParams[ENHN_LAYER][iObj] = 0;
			rguiBitRate[BASE_LAYER][iObj] = 0;
			rguiBitRate[ENHN_LAYER][iObj] = 0;
			rguiVbvBufferSize[BASE_LAYER][iObj] = 0;
			rguiVbvBufferSize[ENHN_LAYER][iObj] = 0;
			rguiVbvBufferOccupany[BASE_LAYER][iObj] = 0;
			rguiVbvBufferOccupany[ENHN_LAYER][iObj] = 0;
		}

	}

	for(iObj = 0; iObj<nVO; iObj++)
	{
		/*************/
		fprintf(pfOut, "VOLControl.Enable [%d] = %d\n", iObj, rguiVolControlParameters [BASE_LAYER] [iObj]);
		fprintf(pfOut, "VOLControl.ChromaFormat [%d] = %d\n", iObj, rguiChromaFormat [BASE_LAYER] [iObj]);
		fprintf(pfOut, "VOLControl.LowDelay [%d] = %d\n", iObj, rguiLowDelay [BASE_LAYER] [iObj]);
		fprintf(pfOut, "VOLControl.VBVParams.Enable [%d] = %d\n", iObj, rguiVBVParams [BASE_LAYER] [iObj]);
		fprintf(pfOut, "VOLControl.Bitrate [%d] = %d\n", iObj, rguiBitRate [BASE_LAYER] [iObj]);
		fprintf(pfOut, "VOLControl.VBVBuffer.Size [%d] = %d\n", iObj, rguiVbvBufferSize [BASE_LAYER] [iObj]);
		fprintf(pfOut, "VOLControl.VBVBuffer.Occupancy [%d] = %d\n", iObj, rguiVbvBufferOccupany [BASE_LAYER] [iObj]);
		/*************/
		if(bAnyScalability)
		{
			/*************/
			fprintf(pfOut, "VOLControl.Enable [%d] = %d\n", iObj + nVO, rguiVolControlParameters [ENHN_LAYER] [iObj]);
			fprintf(pfOut, "VOLCon

⌨️ 快捷键说明

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