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

📄 mlc.cpp

📁 Dream.exe soft source (Visual C++)
💻 CPP
📖 第 1 页 / 共 2 页
字号:
		/* Very strong protected part (VSPP) */
		iL[2] = 0;
		break;


	/* SDC ********************************************************************/
	case CParameter::CT_SDC:
		eCodingScheme = Parameter.eSDCCodingScheme;
		iN_mux = Parameter.iNumSDCCellsPerSFrame;

		iNumEncBits = iN_mux * 2;

		switch (eCodingScheme)
		{
		case CParameter::CS_1_SM:
			iLevels = 1;

			/* Code rates for prot.-Level A and B for each level */
			/* Protection Level A */
			iCodeRate[0][0] = 0;

			/* Protection Level B */
			iCodeRate[0][1] = iCodRateCombSDC4SM;

			/* Define interleaver sequence for all levels */
			piInterlSequ = iInterlSequ4SM;


			/* iN: Number of OFDM-cells of each protection level ------------ */
			iN[0] = 0;
			iN[1] = iN_mux;


			/* iM: Number of bits each level -------------------------------- */
			iM[0][0] = 0;

			/* M_0,2 = RX_0 * floor((2 * N_SDC - 12) / RY_0) */
			iM[0][1] = iPuncturingPatterns[iCodRateCombSDC4SM][0] *
				(int) ((_REAL) (2 * iN_mux - 12) /
				iPuncturingPatterns[iCodRateCombSDC4SM][1]);


			/* iL: Number of bits each protection level --------------------- */
			/* Higher protected part */
			iL[0] = 0;

			/* Lower protected part */
			iL[1] = iM[0][1];

			/* Very strong protected part (VSPP) */
			iL[2] = 0;
			break;

		case CParameter::CS_2_SM:
			iLevels = 2;

			/* Code rates for prot.-Level A and B for each level */
			for (i = 0; i < 2; i++)
			{
				/* Protection Level A */
				iCodeRate[i][0] = 0;

				/* Protection Level B */
				iCodeRate[i][1] = iCodRateCombSDC16SM[i];
			}

			/* Define interleaver sequence for all levels */
			piInterlSequ = iInterlSequ16SM;


			/* iN: Number of OFDM-cells of each protection level ------------ */
			iN[0] = 0;
			iN[1] = iN_mux;


			/* iM: Number of bits each level -------------------------------- */
			/* M_p,2 = RX_p * floor((N_2 - 6) / RY_p) */
			for (i = 0; i < 2; i++)
			{
				iM[i][0] = 0;

				/* M_p,2 = RX_p * floor((2 * N_SDC - 12) / RY_p) */
				iM[i][1] = iPuncturingPatterns[iCodRateCombSDC16SM[i]][0] *
					(int) ((_REAL) (2 * iN[1] - 12) /
					iPuncturingPatterns[iCodRateCombSDC16SM[i]][1]);
			}
			

			/* iL: Number of bits each protection level --------------------- */
			/* Higher protected part */
			iL[0] = 0;

			/* Lower protected part */
			iL[1] = iM[0][1] + iM[1][1];

			/* Very strong protected part (VSPP) */
			iL[2] = 0;
			break;
		}

		/* Set number of bits for one SDC-block */
		Parameter.SetNumDecodedBitsSDC(iL[1]);
		break;


	/* MSC ********************************************************************/
	case CParameter::CT_MSC:
		eCodingScheme = Parameter.eMSCCodingScheme;
		iN_mux = Parameter.iNumUsefMSCCellsPerFrame;

		/* Data length for part A is the sum of all lengths of the streams */
		iMSCDataLenPartA = Parameter.Stream[0].iLenPartA +
						   Parameter.Stream[1].iLenPartA +
						   Parameter.Stream[2].iLenPartA +
						   Parameter.Stream[3].iLenPartA;

		switch (eCodingScheme)
		{
		case CParameter::CS_2_SM:
			iLevels = 2;

			/* Code rates for prot.-Level A and B for each level */
			for (i = 0; i < 2; i++)
			{
				/* Protection Level A */
				iCodeRate[i][0] =
					iCodRateCombMSC16SM[Parameter.MSCPrLe.iPartA][i];

				/* Protection Level B */
				iCodeRate[i][1] =
					iCodRateCombMSC16SM[Parameter.MSCPrLe.iPartB][i];
			}

			/* Define interleaver sequence for all levels */
			piInterlSequ = iInterlSequ16SM;

			iNumEncBits = iN_mux * 2;


			/* iN: Number of OFDM-cells of each protection level ------------ */
			/* N_1 = ceil(8 * X / (2 * RY_Icm * sum(R_p)) * RY_Icm */
			iN[0] = (int) ceil(8 * (_REAL) iMSCDataLenPartA / (2 *
				/* RY_Icm */
				(_REAL) iCodRateCombMSC16SM[Parameter.MSCPrLe.iPartA][2] *
				(
				/* R_0 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC16SM[
					Parameter.MSCPrLe.iPartA][0]][0] /
					iPuncturingPatterns[iCodRateCombMSC16SM[
					Parameter.MSCPrLe.iPartA][0]][1] +
				/* R_1 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC16SM[
					Parameter.MSCPrLe.iPartA][1]][0] /
					iPuncturingPatterns[iCodRateCombMSC16SM[
					Parameter.MSCPrLe.iPartA][1]][1]))) *
				/* RY_Icm */
				iCodRateCombMSC16SM[Parameter.MSCPrLe.iPartA][2];

			/* Check if result can be possible, if not -> correct. This can
			   happen, if a wrong number is in "Param.Stream[x].iLenPartA" */
			if (iN[0] > iN_mux)
				iN[0] = 0;

			iN[1] = iN_mux - iN[0];


			/* iM: Number of bits each level -------------------------------- */
			for (i = 0; i < 2; i++)
			{
				/* M_p,1 = 2 * N_1 * R_p */
				iM[i][0] = (int) (2 * iN[0] *
					(_REAL) iPuncturingPatterns[iCodRateCombMSC16SM[
					Parameter.MSCPrLe.iPartA][i]][0] /
					iPuncturingPatterns[iCodRateCombMSC16SM[
					Parameter.MSCPrLe.iPartA][i]][1]);

				/* M_p,2 = RX_p * floor((2 * N_2 - 12) / RY_p) */
				iM[i][1] = 
					iPuncturingPatterns[iCodRateCombMSC16SM[
					Parameter.MSCPrLe.iPartB][i]][0] *
					(int) ((_REAL) (2 * iN[1] - 12) /
					iPuncturingPatterns[iCodRateCombMSC16SM[
					Parameter.MSCPrLe.iPartB][i]][1]);
			}


			/* iL: Number of bits each protection level --------------------- */
			/* Higher protected part */
			iL[0] = iM[0][0] + iM[1][0];

			/* Lower protected part */
			iL[1] = iM[0][1] + iM[1][1];

			/* Very strong protected part (VSPP) */
			iL[2] = 0;
			break;

		case CParameter::CS_3_SM:
			iLevels = 3;

			/* Code rates for prot.-Level A and B for each level */
			for (i = 0; i < 3; i++)
			{
				/* Protection Level A */
				iCodeRate[i][0] =
					iCodRateCombMSC64SM[Parameter.MSCPrLe.iPartA][i];

				/* Protection Level B */
				iCodeRate[i][1] =
					iCodRateCombMSC64SM[Parameter.MSCPrLe.iPartB][i];
			}

			/* Define interleaver sequence for all levels */
			piInterlSequ = iInterlSequ64SM;

			iNumEncBits = iN_mux * 2;


			/* iN: Number of OFDM-cells of each protection level ------------ */
			/* N_1 = ceil(8 * X / (2 * RY_Icm * sum(R_p)) * RY_Icm */
			iN[0] = (int) ceil(8 * (_REAL) iMSCDataLenPartA / (2 *
				/* RY_Icm */
				(_REAL) iCodRateCombMSC64SM[Parameter.MSCPrLe.iPartA][3] *
				(
				/* R_0 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartA][0]][0] /
					iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartA][0]][1] +
				/* R_1 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartA][1]][0] /
					iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartA][1]][1] +
				/* R_2 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartA][2]][0] /
					iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartA][2]][1]))) *
				/* RY_Icm */
				iCodRateCombMSC64SM[Parameter.MSCPrLe.iPartA][3];

			/* Check if result can be possible, if not -> correct. This can
			   happen, if a wrong number is in "Param.Stream[x].iLenPartA" */
			if (iN[0] > iN_mux)
				iN[0] = 0;

			iN[1] = iN_mux - iN[0];


			/* iM: Number of bits each level -------------------------------- */
			for (i = 0; i < 3; i++)
			{
				/* M_p,1 = 2 * N_1 * R_p */
				iM[i][0] = (int) (2 * iN[0] *
					(_REAL) iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartA][i]][0] /
					iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartA][i]][1]);

				/* M_p,2 = RX_p * floor((2 * N_2 - 12) / RY_p) */
				iM[i][1] = 
					iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartB][i]][0] *
					(int) ((_REAL) (2 * iN[1] - 12) /
					iPuncturingPatterns[iCodRateCombMSC64SM[
					Parameter.MSCPrLe.iPartB][i]][1]);
			}


			/* iL: Number of bits each protection level --------------------- */
			/* Higher protected part */
			iL[0] = iM[0][0] + iM[1][0] + iM[2][0];

			/* Lower protected part */
			iL[1] = iM[0][1] + iM[1][1] + iM[2][1];

			/* Very strong protected part (VSPP) */
			iL[2] = 0;
			break;

		case CParameter::CS_3_HMSYM:
			iLevels = 3;
	
			/* Code rates for prot.-Level A and B for each level */
			/* VSPP (Hierachical) */
			iCodeRate[0][0] = 0;
			iCodeRate[0][1] =
				iCodRateCombMSC64HMsym[Parameter.MSCPrLe.iHierarch][0];

			for (i = 1; i < 3; i++)
			{
				/* Protection Level A */
				iCodeRate[i][0] =
					iCodRateCombMSC64HMsym[Parameter.MSCPrLe.iPartA][i];

				/* Protection Level B */
				iCodeRate[i][1] =
					iCodRateCombMSC64HMsym[Parameter.MSCPrLe.iPartB][i];
			}

			/* Define interleaver sequence for all levels */
			piInterlSequ = iInterlSequ64HMsym;

			iNumEncBits = iN_mux * 2;


			/* iN: Number of OFDM-cells of each protection level ------------ */
			/* N_1 = ceil(8 * X / (2 * RY_Icm * sum(R_p)) * RY_Icm */
			iN[0] = (int) ceil(8 * (_REAL) iMSCDataLenPartA / (2 *
				/* RY_Icm */
				(_REAL) iCodRateCombMSC64HMsym[Parameter.MSCPrLe.iPartA][3] *
				(
				/* R_1 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMsym[
					Parameter.MSCPrLe.iPartA][1]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMsym[
					Parameter.MSCPrLe.iPartA][1]][1] +
				/* R_2 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMsym[
					Parameter.MSCPrLe.iPartA][2]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMsym[
					Parameter.MSCPrLe.iPartA][2]][1]))) *
				/* RY_Icm */
				iCodRateCombMSC64HMsym[Parameter.MSCPrLe.iPartA][3];

			/* Check if result can be possible, if not -> correct. This can
			   happen, if a wrong number is in "Param.Stream[x].iLenPartA" */
			if (iN[0] > iN_mux)
				iN[0] = 0;

			iN[1] = iN_mux - iN[0];


			/* iM: Number of bits each level -------------------------------- */
			/* Level 0, contains the VSPP, treated differently */
			/* M_0,1 */
			iM[0][0] = 0;

			/* M_0,2 = RX_0 * floor((2 * (N_1 + N_2) - 12) / RY_0) */
			iM[0][1] =
				iPuncturingPatterns[iCodRateCombMSC64HMsym[
				Parameter.MSCPrLe.iHierarch][0]][0] *
				(int) ((_REAL) (2 * (iN[0] + iN[1]) - 12) /
				iPuncturingPatterns[iCodRateCombMSC64HMsym[
				Parameter.MSCPrLe.iHierarch][0]][1]);

			for (i = 1; i < 3; i++)
			{
				/* M_p,1 = 2 * N_1 * R_p */
				iM[i][0] = (int) (2 * iN[0] *
					(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMsym[
					Parameter.MSCPrLe.iPartA][i]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMsym[
					Parameter.MSCPrLe.iPartA][i]][1]);

				/* M_p,2 = RX_p * floor((2 * N_2 - 12) / RY_p) */
				iM[i][1] =
					iPuncturingPatterns[iCodRateCombMSC64HMsym[
					Parameter.MSCPrLe.iPartB][i]][0] *
					(int) ((_REAL) (2 * iN[1] - 12) /
					iPuncturingPatterns[iCodRateCombMSC64HMsym[
					Parameter.MSCPrLe.iPartB][i]][1]);
			}


			/* iL: Number of bits each protection level --------------------- */
			/* Higher protected part */
			iL[0] = iM[1][0] + iM[2][0];

			/* Lower protected part */
			iL[1] = iM[1][1] + iM[2][1];

			/* Very strong protected part (VSPP) */
			iL[2] = iM[0][1];
			break;

		case CParameter::CS_3_HMMIX:
			iLevels = 6;

			/* Code rates for prot.-Level A and B for each level */
			/* VSPP (Hierachical) */
			iCodeRate[0][0] = 0;
			iCodeRate[0][1] =
				iCodRateCombMSC64HMmix[Parameter.MSCPrLe.iHierarch][0];

			for (i = 1; i < 6; i++)
			{
				/* Protection Level A */
				iCodeRate[i][0] =
					iCodRateCombMSC64HMmix[Parameter.MSCPrLe.iPartA][i];

				/* Protection Level B */
				iCodeRate[i][1] =
					iCodRateCombMSC64HMmix[Parameter.MSCPrLe.iPartB][i];
			}

			/* Define interleaver sequence for all levels */
			piInterlSequ = iInterlSequ64HMmix;

			iNumEncBits = iN_mux;


			/* iN: Number of OFDM-cells of each protection level ------------ */
			/* N_1 = ceil(8 * X / (RY_Icm * sum(R_p)) * RY_Icm */
			iN[0] = (int) ceil(8 * (_REAL) iMSCDataLenPartA / (
				/* RY_Icm */
				(_REAL) iCodRateCombMSC64HMmix[Parameter.MSCPrLe.iPartA][6] *
				(
				/* R_1 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][1]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][1]][1] +
				/* R_2 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][2]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][2]][1] +
				/* R_3 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][3]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][3]][1] +
				/* R_4 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][4]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][4]][1] +
				/* R_5 */
				(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][5]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][5]][1]))) *
				/* RY_Icm */
				iCodRateCombMSC64HMmix[Parameter.MSCPrLe.iPartA][6];

			/* Check if result can be possible, if not -> correct. This can
			   happen, if a wrong number is in "Param.Stream[x].iLenPartA" */
			if (iN[0] > iN_mux)
				iN[0] = 0;

			iN[1] = iN_mux - iN[0];


			/* iM: Number of bits each level -------------------------------- */
			/* Real-parts of level 0, they contain the VSPP and treated
			   differently */
			/* M_0,1Re */
			iM[0][0] = 0;

			/* M_0,2Re = RX_0Re * floor((N_1 + N_2 - 12) / RY_0Re) */
			iM[0][1] =
				iPuncturingPatterns[iCodRateCombMSC64HMmix[
				Parameter.MSCPrLe.iHierarch][0]][0] *
				(int) ((_REAL) (iN[0] + iN[1] - 12) /
				iPuncturingPatterns[iCodRateCombMSC64HMmix[
				Parameter.MSCPrLe.iHierarch][0]][1]);

			for (i = 1; i < 6; i++)
			{
				/* M_p,1Re;Im = 2 * N_1 * R_pRe;Im */
				iM[i][0] = (int) (iN[0] *
					(_REAL) iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][i]][0] /
					iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartA][i]][1]);

				/* M_p,2Re;Im =
				   RX_pRe;Im * floor((2 * N_2 - 12) / RY_pRe;Im) */
				iM[i][1] =
					iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartB][i]][0] *
					(int) ((_REAL) (iN[1] - 12) /
					iPuncturingPatterns[iCodRateCombMSC64HMmix[
					Parameter.MSCPrLe.iPartB][i]][1]);
			}
	

			/* iL: Number of bits each protection level --------------------- */
			/* Higher protected part */
			iL[0] = iM[1][0] + iM[2][0] + iM[3][0] + iM[4][0] + iM[5][0];

			/* Lower protected part */
			iL[1] = iM[1][1] + iM[2][1] + iM[3][1] + iM[4][1] + iM[5][1];

			/* Very strong protected part (VSPP) */
			iL[2] = iM[0][1];
			break;
		}

		/* Set number of output bits for next module */
		Parameter.SetNumDecodedBitsMSC(iL[0] + iL[1] + iL[2]);

		/* Set total number of bits for hiearchical frame (needed for MSC
		   demultiplexer module) */
		Parameter.SetNumBitsHieraFrTot(iL[2]);
		break;
	}
}

⌨️ 快捷键说明

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