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

📄 convertpar.cpp

📁 MPEG-4编解码的实现(包括MPEG4视音频编解码)
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		}
		my_assert (rgiBinaryAlphaTH [iObj] >= 0);
		/*************/
		fprintf(pfOut, "Alpha.Binary.RoundingThreshold [%d] = %d\n", iObj, rgiBinaryAlphaTH [iObj]);
		/*************/
	}

	// binary shape size conversion flag
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgbNoCrChange [iObj]) != 1)	{
			fprintf	(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgbNoCrChange [iObj] == TRUE || rgbNoCrChange [iObj] == FALSE); //boolean value
		if (rgiBinaryAlphaTH [iObj] == 0)
			my_assert (rgbNoCrChange [iObj] == TRUE); //MB-level size conversion of shape is off in lossless mode\n");
		/*************/
		fprintf(pfOut, "Alpha.Binary.SizeConversion.Enable [%d] = %d\n", iObj, !rgbNoCrChange [iObj]);
		/*************/
	}

	//	Added for error resilient mode by Toshiba(1997-11-14)
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgiBinaryAlphaRR [iObj]) != 1)	{
			fprintf	(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgiBinaryAlphaRR [iObj] >= 0);
		/*************/
		fprintf(pfOut, "ErrorResil.AlphaRefreshRate [%d] = %d\n", iObj, rgiBinaryAlphaRR [iObj]);
		/*************/
	}
	// End Toshiba(1997-11-14)

	// rounding control disable
	if(iVersion > 812)
		nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if(iVersion > 812)
		{
			if (fscanf (pfPara, "%d", &rgbRoundingControlDisable [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
		}
		else
			rgbRoundingControlDisable [iObj] = 0;
		my_assert (rgbRoundingControlDisable [iObj]  == 0 || rgbRoundingControlDisable [iObj] == 1);
		/*************/
		fprintf(pfOut, "Motion.RoundingControl.Enable [%d] = %d\n", iObj, !rgbRoundingControlDisable [iObj]);
		/*************/
	}
	if(iVersion > 812)
		nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if(iVersion > 812)
		{
			if (fscanf (pfPara, "%d", &rgiInitialRoundingType [iObj]) != 1)	{
				fprintf	(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
		}
		else
			rgiInitialRoundingType [iObj] = 0;
		my_assert (rgiInitialRoundingType [iObj] == 0 || rgiInitialRoundingType [iObj] == 1);
		/*************/
		fprintf(pfOut, "Motion.RoundingControl.StartValue [%d] = %d\n", iObj, rgiInitialRoundingType [iObj]);
		/*************/
	}

	// error resilient coding disable
	nextValidLine (pfPara, pnLine);
	Int iErrorResilientFlags;
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &iErrorResilientFlags) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		rgbErrorResilientDisable [BASE_LAYER] [iObj] = iErrorResilientFlags & 0x1;
//	Modified for error resilient mode by Toshiba(1998-1-16)
		rgbDataPartitioning [BASE_LAYER] [iObj]		 = (iErrorResilientFlags & 0x2) ? TRUE : FALSE;
		rgbReversibleVlc [BASE_LAYER] [iObj]		 = (iErrorResilientFlags & 0x4) ? TRUE : FALSE;
//	End Toshiba(1998-1-16)
		if( rgbErrorResilientDisable [BASE_LAYER] [iObj])
			rgiBinaryAlphaRR [iObj] = -1;

		/*************/
		fprintf(pfOut, "ErrorResil.RVLC.Enable [%d] = %d\n", iObj, rgbReversibleVlc [BASE_LAYER] [iObj]);
		fprintf(pfOut, "ErrorResil.DataPartition.Enable [%d] = %d\n", iObj, rgbDataPartitioning [BASE_LAYER] [iObj]);
		fprintf(pfOut, "ErrorResil.VideoPacket.Enable [%d] = %d\n", iObj, !rgbErrorResilientDisable [BASE_LAYER] [iObj]);
		/*************/
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgbErrorResilientDisable [ENHN_LAYER] [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rgbErrorResilientDisable [ENHN_LAYER] [iObj] == TRUE); //error resilient coding not supported as for now
			rgbErrorResilientDisable [ENHN_LAYER] [iObj] = TRUE;
			rgbDataPartitioning [ENHN_LAYER] [iObj] = FALSE;
			rgbReversibleVlc [ENHN_LAYER] [iObj] = FALSE;
			/*************/
			fprintf(pfOut, "ErrorResil.RVLC.Enable [%d] = %d\n", iObj + nVO, rgbReversibleVlc [ENHN_LAYER] [iObj]);
			fprintf(pfOut, "ErrorResil.DataPartition.Enable [%d] = %d\n", iObj + nVO, rgbDataPartitioning [ENHN_LAYER] [iObj]);
			fprintf(pfOut, "ErrorResil.VideoPacket.Enable [%d] = %d\n", iObj + nVO, !rgbErrorResilientDisable [ENHN_LAYER] [iObj]);
			/*************/
		}
	}

	// Bit threshold for video packet spacing control
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgiVPBitTh [BASE_LAYER] [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		if (rgbErrorResilientDisable [BASE_LAYER] [iObj])
			rgiVPBitTh [BASE_LAYER] [iObj] = -1;	// set VPBitTh to negative value
		/*************/
		fprintf(pfOut, "ErrorResil.VideoPacket.Length [%d] = %d\n", iObj, rgiVPBitTh [BASE_LAYER] [iObj]);
		/*************/
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgiVPBitTh [ENHN_LAYER] [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			rgiVPBitTh [ENHN_LAYER] [iObj] = -1;
			/*************/
			fprintf(pfOut, "ErrorResil.VideoPacket.Length [%d] = %d\n", iObj + nVO, rgiVPBitTh [ENHN_LAYER] [iObj]);
			/*************/
		}
	}

	// Interlaced coding
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgbInterlacedCoding [BASE_LAYER] [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgbInterlacedCoding [BASE_LAYER] [iObj] == 0 || rgbInterlacedCoding [BASE_LAYER] [iObj] == 1);
		/*************/
		fprintf(pfOut, "Motion.Interlaced.Enable [%d] = %d\n", iObj, rgbInterlacedCoding [BASE_LAYER] [iObj]);
		/*************/
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgbInterlacedCoding [ENHN_LAYER] [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rgbInterlacedCoding [ENHN_LAYER] [iObj] == 0 || rgbInterlacedCoding [ENHN_LAYER] [iObj] == 1);
			/*************/
			fprintf(pfOut, "Motion.Interlaced.Enable [%d] = %d\n", iObj + nVO, rgbInterlacedCoding [ENHN_LAYER] [iObj]);
			/*************/
		}
	}
	
	// quantizer selection: 0 -- H.263, 1 -- MPEG
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
	  int read;
		if (fscanf (pfPara, "%d", &read) != 1) {
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		rgfQuant [BASE_LAYER] [iObj] = (Quantizer)read;
		my_assert (rgfQuant [BASE_LAYER] [iObj] ==0 || rgfQuant [BASE_LAYER] [iObj] == 1);
		/*************/
		fprintf(pfOut, "Quant.Type [%d] = \"%s\"\n", iObj, rgfQuant [BASE_LAYER] [iObj]==0 ? "H263" : "MPEG");
		/*************/
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
		  int read;
			if (fscanf (pfPara, "%d", &read) != 1) {
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			rgfQuant [ENHN_LAYER] [iObj] = (Quantizer)read;
			my_assert (rgfQuant [ENHN_LAYER] [iObj] ==0 || rgfQuant [ENHN_LAYER] [iObj] == 1);
			/*************/
			fprintf(pfOut, "Quant.Type [%d] = \"%s\"\n", iObj + nVO, rgfQuant [ENHN_LAYER] [iObj]==0 ? "H263" : "MPEG");
			/*************/
		}
	}

	// load non-default intra Q-Matrix, 0 -- FALSE, 1 -- TRUE
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgbLoadIntraMatrix [BASE_LAYER] [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgbLoadIntraMatrix [BASE_LAYER] [iObj] ==0 || 
				rgbLoadIntraMatrix [BASE_LAYER] [iObj] == 1);
		/*************/
		fprintf(pfOut, "Texture.QuantMatrix.Intra.Enable [%d] = %d\n", iObj, rgbLoadIntraMatrix [BASE_LAYER] [iObj]);
		/*************/
		if (rgbLoadIntraMatrix [BASE_LAYER] [iObj]) {
			/*************/
			fprintf(pfOut, "Texture.QuantMatrix.Intra [%d] = {", iObj);
			/*************/
			UInt i = 0;
			do {
				if(i>0)
					/*************/
					fprintf(pfOut, ", ");
					/*************/
				if (fscanf (pfPara, "%d", &rgppiIntraQuantizerMatrix [BASE_LAYER] [iObj] [i]) != 1)	{
					fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
					fatal_error("Conversion aborted");
				}
				/*************/
				fprintf(pfOut, "%d", rgppiIntraQuantizerMatrix [BASE_LAYER] [iObj] [i]);
				/*************/
			} while (rgppiIntraQuantizerMatrix [BASE_LAYER] [iObj] [i] != 0 && ++i < BLOCK_SQUARE_SIZE);
			/*************/
			fprintf(pfOut, "}\n");
			/*************/
		}
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgbLoadIntraMatrix [ENHN_LAYER] [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rgbLoadIntraMatrix [ENHN_LAYER] [iObj] ==0 || 
					rgbLoadIntraMatrix [ENHN_LAYER] [iObj] == 1);
			/*************/
			fprintf(pfOut, "Texture.QuantMatrix.Intra.Enable [%d] = %d\n", iObj + nVO, rgbLoadIntraMatrix [ENHN_LAYER] [iObj]);
			/*************/
			if (rgbLoadIntraMatrix [ENHN_LAYER] [iObj]) {
				/*************/
				fprintf(pfOut, "Texture.QuantMatrix.Intra [%d] = {", iObj + nVO);
				/*************/
				UInt i = 0;
				do {
					if(i>0)
						/*************/
						fprintf(pfOut, ", ");
						/*************/
					if (fscanf (pfPara, "%d", &rgppiIntraQuantizerMatrix [ENHN_LAYER] [iObj] [i]) != 1)	{
						fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
						fatal_error("Conversion aborted");
					}
					/*************/
					fprintf(pfOut, "%d", rgppiIntraQuantizerMatrix [ENHN_LAYER] [iObj] [i]);
					/*************/
				} while (rgppiIntraQuantizerMatrix [ENHN_LAYER] [iObj] [i] != 0 && ++i < BLOCK_SQUARE_SIZE);
				/*************/
				fprintf(pfOut, "}\n");
				/*************/
			}
		}
	}

	// load non-default inter Q-Matrix, 0 -- FALSE, 1 -- TRUE
	nextValidLine (pfPara, pnLine);
	for (iObj = 0; iObj < nVO; iObj++)	{
		if (fscanf (pfPara, "%d", &rgbLoadInterMatrix [BASE_LAYER] [iObj]) != 1)	{
			fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
			fatal_error("Conversion aborted");
		}
		my_assert (rgbLoadInterMatrix [BASE_LAYER] [iObj] ==0 || 
				rgbLoadInterMatrix [BASE_LAYER] [iObj] == 1);
		/*************/
		fprintf(pfOut, "Texture.QuantMatrix.Inter.Enable [%d] = %d\n", iObj, rgbLoadInterMatrix [BASE_LAYER] [iObj]);
		/*************/
		if (rgbLoadInterMatrix [BASE_LAYER] [iObj]) {
			/*************/
			fprintf(pfOut, "Texture.QuantMatrix.Inter [%d] = {", iObj);
			/*************/
			UInt i = 0;
			do {
				if(i>0)
					/*************/
					fprintf(pfOut, ", ");
					/*************/
				if (fscanf (pfPara, "%d", &rgppiInterQuantizerMatrix [BASE_LAYER] [iObj] [i]) != 1)	{
					fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
					fatal_error("Conversion aborted");
				}
				/*************/
				fprintf(pfOut, "%d", rgppiInterQuantizerMatrix [BASE_LAYER] [iObj] [i]);
				/*************/
			} while (rgppiInterQuantizerMatrix [BASE_LAYER] [iObj] [i] != 0 && ++i < BLOCK_SQUARE_SIZE);
			/*************/
			fprintf(pfOut, "}\n");
			/*************/
		}
	}
	if (bAnyScalability)	{
		for (iObj = 0; iObj < nVO; iObj++)	{
			if (fscanf (pfPara, "%d", &rgbLoadInterMatrix [ENHN_LAYER] [iObj]) != 1)	{
				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
				fatal_error("Conversion aborted");
			}
			my_assert (rgbLoadInterMatrix [ENHN_LAYER] [iObj] ==0 || 
					rgbLoadInterMatrix [ENHN_LAYER] [iObj] == 1);
			/*************/
			fprintf(pfOut, "Texture.QuantMatrix.Inter.Enable [%d] = %d\n", iObj + nVO, rgbLoadInterMatrix [ENHN_LAYER] [iObj]);
			/*************/
			if (rgbLoadInterMatrix [ENHN_LAYER] [iObj]) {
				/*************/
				fprintf(pfOut, "Texture.QuantMatrix.Inter [%d] = {", iObj + nVO);
				/*************/
				UInt i = 0;
				do {
					if(i>0)
						/*************/
						fprintf(pfOut, ", ");
						/*************/
					if (fscanf (pfPara, "%d", &rgppiInterQuantizerMatrix [ENHN_LAYER] [iObj] [i]) != 1)	{
						fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
						fatal_error("Conversion aborted");
					}
					/*************/
					fprintf(pfOut, "%d", rgppiInterQuantizerMatrix [ENHN_LAYER] [iObj] [i]);
					/*************/
				} while (rgppiInterQuantizerMatrix [ENHN_LAYER] [iObj] [i] != 0 && ++i < BLOCK_SQUARE_SIZE);

⌨️ 快捷键说明

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