1 /******************************************************************************\
2  * Technische Universitaet Darmstadt, Institut fuer Nachrichtentechnik
3  * Copyright (c) 2001
4  *
5  * Author(s):
6  *	Volker Fischer
7  *
8  * Description:
9  *	See MLC.cpp
10  *
11  ******************************************************************************
12  *
13  * This program is free software; you can redistribute it and/or modify it under
14  * the terms of the GNU General Public License as published by the Free Software
15  * Foundation; either version 2 of the License, or (at your option) any later
16  * version.
17  *
18  * This program is distributed in the hope that it will be useful, but WITHOUT
19  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  * details.
22  *
23  * You should have received a copy of the GNU General Public License along with
24  * this program; if not, write to the Free Software Foundation, Inc.,
25  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27 \******************************************************************************/
28 
29 #if !defined(MLC_H__3B0BA660_CA63_4344_BB2B_23E7A0D31912__INCLUDED_)
30 #define MLC_H__3B0BA660_CA63_4344_BB2B_23E7A0D31912__INCLUDED_
31 
32 #include "../GlobalDefinitions.h"
33 #include "../util/Modul.h"
34 #include "../Parameter.h"
35 #include "../tables/TableMLC.h"
36 #include "../tables/TableCarMap.h"
37 #include "ConvEncoder.h"
38 //#include "ViterbiDecoder.h"
39 //#include "Metric.h"
40 #include "BitInterleaver.h"
41 #include "QAMMapping.h"
42 #include "EnergyDispersal.h"
43 
44 
45 /* Classes ********************************************************************/
46 class CMLC
47 {
48 public:
CMLC()49 	CMLC() : iN_mux(0), eChannelType(CT_MSC) {}
~CMLC()50 	virtual ~CMLC() {}
51 
52 	void CalculateParam(CParameter& Parameter, int iNewChannelType);
53 
54 protected:
55 	int	iLevels;
56 	/* No input bits for each level. First index: Level, second index:
57 	   Protection level.
58 	   For three levels: [M_0,l  M_1,l  M2,l]
59 	   For six levels: [M_0,lRe  M_0,lIm  M_1,lRe  M_1,lIm  M_2,lRe  ...  ] */
60 	int	iM[MC_MAX_NUM_LEVELS][2];
61 	int iN[2];
62 	int iL[3];
63 	int iN_mux;
64 	int iCodeRate[MC_MAX_NUM_LEVELS][2];
65 
66 	const int* piInterlSequ;
67 
68 	int	iNumEncBits;
69 
70 	EChanType	eChannelType;
71 	ECodScheme	eCodingScheme;
72 };
73 
74 class CMLCEncoder : public CTransmitterModul<_BINARY, _COMPLEX>,
75 					public CMLC
76 {
77 public:
CMLCEncoder()78 	CMLCEncoder() {}
~CMLCEncoder()79 	virtual ~CMLCEncoder() {}
80 
81 protected:
82 	CConvEncoder		ConvEncoder[MC_MAX_NUM_LEVELS];
83 	/* Two different types of interleaver table */
84 	CBitInterleaver		BitInterleaver[2];
85 	CQAMMapping			QAMMapping;
86 	CEngergyDispersal	EnergyDisp;
87 
88 	/* Internal buffers */
89 	CVector<_DECISION>	vecEncInBuffer[MC_MAX_NUM_LEVELS];
90 	CVector<_DECISION>	vecEncOutBuffer[MC_MAX_NUM_LEVELS];
91 
92 	virtual void InitInternal(CParameter& TransmParam);
93 	virtual void ProcessDataInternal(CParameter& Parameter);
94 };
95 
96 
97 /******************************************************************************\
98 * Customized channel (de-)coders											   *
99 \******************************************************************************/
100 class CMSCMLCEncoder : public CMLCEncoder
101 {
102 protected:
InitInternal(CParameter & TransmParam)103 	virtual void InitInternal(CParameter& TransmParam)
104 	{
105 		/* Set corresponding type */
106 		eChannelType = CT_MSC;
107 
108 		/* Call init in encoder */
109 		CMLCEncoder::InitInternal(TransmParam);
110 	};
111 };
112 
113 class CSDCMLCEncoder : public CMLCEncoder
114 {
115 protected:
InitInternal(CParameter & TransmParam)116 	virtual void InitInternal(CParameter& TransmParam)
117 	{
118 		/* Set corresponding type */
119 		eChannelType = CT_SDC;
120 
121 		/* Call init in encoder */
122 		CMLCEncoder::InitInternal(TransmParam);
123 	};
124 };
125 
126 class CFACMLCEncoder : public CMLCEncoder
127 {
128 protected:
InitInternal(CParameter & TransmParam)129 	virtual void InitInternal(CParameter& TransmParam)
130 	{
131 		/* Set corresponding type */
132 		eChannelType = CT_FAC;
133 
134 		/* Call init in encoder */
135 		CMLCEncoder::InitInternal(TransmParam);
136 	};
137 };
138 
139 
140 
141 
142 #endif // !defined(MLC_H__3B0BA660_CA63_4344_BB2B_23E7A0D31912__INCLUDED_)
143