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

📄 encoder.cpp

📁 网络MPEG4IP流媒体开发源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			{				if (fscanf (pfPara, "%d", &rgiInitialRoundingType [iObj]) != 1)	{					fprintf	(stderr, "wrong parameter file format on line %d\n", *pnLine);					exit (1);				}			}			else				rgiInitialRoundingType [iObj] = 0;			assert (rgiInitialRoundingType [iObj] == 0 || rgiInitialRoundingType [iObj] == 1);		}		// 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);				exit (1);			}			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;		}		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);					exit (1);				}				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;			}		}		// 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);				exit (1);			}			if (rgbErrorResilientDisable [BASE_LAYER] [iObj])				rgiVPBitTh [BASE_LAYER] [iObj] = -1;	// set VPBitTh to negative value		}		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);					exit (1);				}				rgiVPBitTh [ENHN_LAYER] [iObj] = -1;			}		}		// 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);				exit (1);			}			assert (rgbInterlacedCoding [BASE_LAYER] [iObj] == 0 || rgbInterlacedCoding [BASE_LAYER] [iObj] == 1);		}		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);					exit (1);				}				assert (rgbInterlacedCoding [ENHN_LAYER] [iObj] == 0 || rgbInterlacedCoding [ENHN_LAYER] [iObj] == 1);			}		}				// 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);				exit (1);			}		  rgfQuant [BASE_LAYER] [iObj] = (Quantizer)read;		  assert (rgfQuant [BASE_LAYER] [iObj] ==0 || rgfQuant [BASE_LAYER] [iObj] == 1);		}		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);					exit (1);			  }			  rgfQuant [ENHN_LAYER] [iObj] = (Quantizer)read;				assert (rgfQuant [ENHN_LAYER] [iObj] ==0 || rgfQuant [ENHN_LAYER] [iObj] == 1);			}		}		// 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);				exit (1);			}			assert (rgbLoadIntraMatrix [BASE_LAYER] [iObj] ==0 || 					rgbLoadIntraMatrix [BASE_LAYER] [iObj] == 1);			if (rgbLoadIntraMatrix [BASE_LAYER] [iObj]) {				UInt i = 0;				do {					if (fscanf (pfPara, "%d", &rgppiIntraQuantizerMatrix [BASE_LAYER] [iObj] [i]) != 1)	{						fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);						exit (1);					}				} while (rgppiIntraQuantizerMatrix [BASE_LAYER] [iObj] [i] != 0 && ++i < BLOCK_SQUARE_SIZE);			}			else				memcpy (rgppiIntraQuantizerMatrix [BASE_LAYER] [iObj], rgiDefaultIntraQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));		}		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);					exit (1);				}				assert (rgbLoadIntraMatrix [ENHN_LAYER] [iObj] ==0 || 						rgbLoadIntraMatrix [ENHN_LAYER] [iObj] == 1);				if (rgbLoadIntraMatrix [ENHN_LAYER] [iObj]) {					UInt i = 0;					do {						if (fscanf (pfPara, "%d", &rgppiIntraQuantizerMatrix [ENHN_LAYER] [iObj] [i]) != 1)	{							fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);							exit (1);						}					} while (rgppiIntraQuantizerMatrix [ENHN_LAYER] [iObj] [i] != 0 && ++i < BLOCK_SQUARE_SIZE);				}				else					memcpy (rgppiIntraQuantizerMatrix [ENHN_LAYER] [iObj], rgiDefaultIntraQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));			}		}		// 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);				exit (1);			}			assert (rgbLoadInterMatrix [BASE_LAYER] [iObj] ==0 || 					rgbLoadInterMatrix [BASE_LAYER] [iObj] == 1);			if (rgbLoadInterMatrix [BASE_LAYER] [iObj]) {				UInt i = 0;				do {					if (fscanf (pfPara, "%d", &rgppiInterQuantizerMatrix [BASE_LAYER] [iObj] [i]) != 1)	{						fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);						exit (1);					}				} while (rgppiInterQuantizerMatrix [BASE_LAYER] [iObj] [i] != 0 && ++i < BLOCK_SQUARE_SIZE);			}			else				memcpy (rgppiInterQuantizerMatrix [BASE_LAYER] [iObj], rgiDefaultInterQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));		}		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);					exit (1);				}				assert (rgbLoadInterMatrix [ENHN_LAYER] [iObj] ==0 || 						rgbLoadInterMatrix [ENHN_LAYER] [iObj] == 1);				if (rgbLoadInterMatrix [ENHN_LAYER] [iObj]) {					UInt i = 0;					do {						if (fscanf (pfPara, "%d", &rgppiInterQuantizerMatrix [ENHN_LAYER] [iObj] [i]) != 1)	{							fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);							exit (1);						}					} while (rgppiInterQuantizerMatrix [ENHN_LAYER] [iObj] [i] != 0 && ++i < BLOCK_SQUARE_SIZE);				}				else					memcpy (rgppiInterQuantizerMatrix [ENHN_LAYER] [iObj], rgiDefaultInterQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));			}		}		// threhold to code Intra-DC as AC		nextValidLine (pfPara, pnLine);		for (iObj = 0; iObj < nVO; iObj++)	{			if (fscanf (pfPara, "%d", &(rgiIntraDCSwitchingThr [BASE_LAYER] [iObj])) != 1)	{				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);				exit (1);			}			assert (rgiIntraDCSwitchingThr [BASE_LAYER] [iObj] >= 0 && 					rgiIntraDCSwitchingThr [BASE_LAYER] [iObj] <= 7);		}		if (bAnyScalability)	{			for (iObj = 0; iObj < nVO; iObj++)	{				if (fscanf (pfPara, "%d", &(rgiIntraDCSwitchingThr [ENHN_LAYER] [iObj])) != 1)	{					fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);					exit (1);				}				assert (rgiIntraDCSwitchingThr [ENHN_LAYER] [iObj] >= 0 && 						rgiIntraDCSwitchingThr [ENHN_LAYER] [iObj] <= 7);			}		}		// I-VO quantization stepsize		nextValidLine (pfPara, pnLine);		for (iObj = 0; iObj < nVO; iObj++)	{			if (fscanf (pfPara, "%d", &(rgiIStep [BASE_LAYER] [iObj])) != 1)	{				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);				exit (1);			}			assert (rgiIStep [BASE_LAYER] [iObj] > 0 && rgiIStep [BASE_LAYER] [iObj] < (1<<uiQuantPrecision));		}		if (bAnyScalability)	{			for (iObj = 0; iObj < nVO; iObj++)	{				if (fscanf (pfPara, "%d", &(rgiIStep [ENHN_LAYER] [iObj])) != 1)	{					fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);					exit (1);				}				assert (rgiIStep [ENHN_LAYER] [iObj] > 0 && rgiIStep [ENHN_LAYER] [iObj] < (1<<uiQuantPrecision));			}		}		// P-VO quantization stepsize		nextValidLine (pfPara, pnLine);		for (iObj = 0; iObj < nVO; iObj++)	{			if (fscanf (pfPara, "%d", &(rgiPStep [BASE_LAYER] [iObj])) != 1)	{				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);				exit (1);			}			assert (rgiPStep [BASE_LAYER] [iObj] > 0 && rgiPStep [BASE_LAYER] [iObj] < (1<<uiQuantPrecision));		}		if (bAnyScalability)	{			for (iObj = 0; iObj < nVO; iObj++)	{				if (fscanf (pfPara, "%d", &(rgiPStep [ENHN_LAYER] [iObj])) != 1)	{					fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);					exit (1);				}				assert (rgiPStep [ENHN_LAYER] [iObj] > 0 && rgiPStep [ENHN_LAYER] [iObj] < (1<<uiQuantPrecision));			}		}		// quantization stepsize for B-VOP		nextValidLine (pfPara, pnLine);		for (iObj = 0; iObj < nVO; iObj++)	{			if (fscanf (pfPara, "%d", &(rgiStepBCode [BASE_LAYER] [iObj])) != 1)	{				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);				exit (1);			}			assert (rgiStepBCode [BASE_LAYER] [iObj] > 0 && rgiStepBCode [BASE_LAYER] [iObj] < (1<<uiQuantPrecision));		}		if (bAnyScalability)	{			for (iObj = 0; iObj < nVO; iObj++)	{				if (fscanf (pfPara, "%d", &(rgiStepBCode [ENHN_LAYER] [iObj])) != 1)	{					fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);					exit (1);				}				assert (rgiStepBCode [ENHN_LAYER] [iObj] > 0 && rgiStepBCode [ENHN_LAYER] [iObj] < (1<<uiQuantPrecision));			}		}		// load non-default gray alpha intra Q-Matrix, 0 -- FALSE, 1 -- TRUE		nextValidLine (pfPara, pnLine);		for (iObj = 0; iObj < nVO; iObj++)	{			if (fscanf (pfPara, "%d", &rgbLoadIntraMatrixAlpha [BASE_LAYER] [iObj]) != 1)	{				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);				exit (1);			}			assert (rgbLoadIntraMatrixAlpha [BASE_LAYER] [iObj] ==0 || 					rgbLoadIntraMatrixAlpha [BASE_LAYER] [iObj] == 1);			if (rgbLoadIntraMatrixAlpha [BASE_LAYER] [iObj]) {				for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++) {					if (fscanf (pfPara, "%d", &rgppiIntraQuantizerMatrixAlpha [BASE_LAYER] [iObj] [i]) != 1)	{						fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);						exit (1);					}				}			}			else				memcpy (rgppiIntraQuantizerMatrixAlpha [BASE_LAYER] [iObj], rgiDefaultIntraQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof (Int));		}		if (bAnyScalability)	{			for (iObj = 0; iObj < nVO; iObj++)	{				if (fscanf (pfPara, "%d", &rgbLoadIntraMatrixAlpha [ENHN_LAYER] [iObj]) != 1)	{					fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);					exit (1);				}				assert (rgbLoadIntraMatrixAlpha [ENHN_LAYER] [iObj] ==0 || 						rgbLoadIntraMatrixAlpha [ENHN_LAYER] [iObj] == 1);				if (rgbLoadIntraMatrixAlpha [ENHN_LAYER] [iObj]) {					for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++) {						if (fscanf (pfPara, "%d", &rgppiIntraQuantizerMatrixAlpha [ENHN_LAYER] [iObj] [i]) != 1)	{							fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);							exit (1);						}					}				}				else					memcpy (rgppiIntraQuantizerMatrixAlpha [ENHN_LAYER] [iObj], rgiDefaultIntraQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof (Int));			}		}		// load non-default  gray alpha inter Q-Matrix, 0 -- FALSE, 1 -- TRUE		nextValidLine (pfPara, pnLine);		for (iObj = 0; iObj < nVO; iObj++)	{			if (fscanf (pfPara, "%d", &rgbLoadInterMatrixAlpha [BASE_LAYER] [iObj]) != 1)	{				fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);				exit (1);			}			assert (rgbLoadInterMatrixAlpha [BASE_LAYER] [iObj] ==0 || 					rgbLoadInterMatrixAlpha [BASE_LAYER] [iObj] == 1);			if (rgbLoadInterMatrixAlpha [BASE_LAYER] [iObj]) {				for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++) {					if (fscanf (pfPara, "%d", &rgppiInterQuantizerMatrixAlpha [BASE_LAYER] [iObj] [i]) != 1)	{						fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);						exit (1);					}				}			}			else				memcpy (rgppiInterQuantizerMatrixAlpha [BASE_LAYER] [iObj], rgiDefaultInterQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof (Int));		}		if (bAnyScalability)	{			for (iObj = 0; iObj < nVO; iObj++)	{				if (fscanf (pfPara, "%d", &rgbLoadInterMatrixAlpha [ENHN_LAYER] [iObj]) != 1)	{					fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);					exit (1);				}				assert (rgbLoadInterMatrixAlpha [ENHN_LAYER] [iObj] ==0 || 						rgbLoadInterMatrixAlpha [ENHN_LAYER] [iObj] == 1);				if (rgbLoadInterMatrixAlpha [ENHN_LAYER] [iObj]) {					for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++) {						if (fscanf (pfPara, "%d", &rgppiInterQuantizerMatrixAlpha [ENHN_LAYER] [iObj] [i]) != 1)	{							fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);							exit (1);						}					}				}				else					memcpy (rgppiInterQuantizerMatrixAlpha [ENHN_LAYER] [iObj], rgiDefaultInterQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof (Int));			}		}		// I-VO quantization stepsize for Alpha		nextValidLine (pfPara, pnLine);		for (iObj = 0; iObj < nVO; iObj++)	{			if (fscanf (pfPara, "%d", &(rgiIStepAlpha [BASE_LAYER] [iObj])) != 1)	{				fprintf(stderr, 

⌨️ 快捷键说明

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