/******************************************************************************\
* Technische Universitaet Darmstadt, Institut fuer Nachrichtentechnik
* Copyright (c) 2001
*
* Author(s):
* Volker Fischer
*
* Description:
* Multi-level-channel (de)coder (MLC)
*
******************************************************************************
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
\******************************************************************************/
#include "MLC.h"
/* Implementation *************************************************************/
/******************************************************************************\
* MLC-encoder *
\******************************************************************************/
void CMLCEncoder::ProcessDataInternal(CParameter& Parameter)
{
int i, j;
int iNoBitsOutDec;
int iElementCounter;
/* Energy dispersal ----------------------------------------------------- */
/* VSPP is treated as a separate part for energy dispersal */
EnergyDisp.ProcessData(pvecInputData);
/* Partitioning of input-stream ----------------------------------------- */
iElementCounter = 0;
if (iL[2] == 0)
{
/* Standard departitioning */
/* Protection level A */
for (j = 0; j < iLevels; j++)
{
/* Bits */
for (i = 0; i < iM[j][0]; i++)
{
vecbiEncInBuffer[j][i] = (*pvecInputData)[iElementCounter];
iElementCounter++;
}
}
/* Protection level B */
for (j = 0; j < iLevels; j++)
{
/* Bits */
for (i = 0; i < iM[j][1]; i++)
{
vecbiEncInBuffer[j][iM[j][0] + i] =
(*pvecInputData)[iElementCounter];
iElementCounter++;
}
}
}
else
{
/* Special departitioning with hierarchical modulation. First set
hierarchical bits at the beginning, then append the rest */
/* Hierarchical frame (always "iM[0][1]"). "iM[0][0]" is always "0" in
this case */
for (i = 0; i < iM[0][1]; i++)
{
vecbiEncInBuffer[0][i] = (*pvecInputData)[iElementCounter];
iElementCounter++;
}
/* Protection level A (higher protected part) */
for (j = 1; j < iLevels; j++)
{
/* Bits */
for (i = 0; i < iM[j][0]; i++)
{
vecbiEncInBuffer[j][i] = (*pvecInputData)[iElementCounter];
iElementCounter++;
}
}
/* Protection level B (lower protected part) */
for (j = 1; j < iLevels; j++)
{
/* Bits */
for (i = 0; i < iM[j][1]; i++)
{
vecbiEncInBuffer[j][iM[j][0] + i] =
(*pvecInputData)[iElementCounter];
iElementCounter++;
}
}
}
/* Convolutional encoder ------------------------------------------------ */
for (j = 0; j < iLevels; j++)
{
iNoBitsOutDec =
ConvEncoder[j].Encode(vecbiEncInBuffer[j], vecbiEncOutBuffer[j]);
#ifdef _DEBUG_
if (iNoBitsOutDec != iNoEncBits)
{
DebugError("MLC decoded bits test", "No bits decoder out",
iNoBitsOutDec, "No encoded bits", iNoEncBits);
}
#endif
}
/* Bit interleaver ------------------------------------------------------ */
for (j = 0; j < iLevels; j++)
if (piInterlSequ[j] != -1)
BitInterleaver[piInterlSequ[j]].Interleave(vecbiEncOutBuffer[j]);
/* QAM mapping ---------------------------------------------------------- */
QAMMapping.Map(vecbiEncOutBuffer[0],
vecbiEncOutBuffer[1],
vecbiEncOutBuffer[2],
vecbiEncOutBuffer[3],
vecbiEncOutBuffer[4],
vecbiEncOutBuffer[5], pvecOutputData);
}
void CMLCEncoder::InitInternal(CParameter& TransmParam)
{
int i;
CalculateParam(TransmParam, eChannelType);
iNoInBits = iL[0] + iL[1] + iL[2];
/* Init modules --------------------------------------------------------- */
/* Energy dispersal */
EnergyDisp.Init(iNoInBits, iL[2]);
/* Encoder */
for (i = 0; i < iLevels; i++)
ConvEncoder[i].Init(eCodingScheme, eChannelType, iN[0], iN[1],
iM[i][0], iM[i][1], iCodeRate[i][0], iCodeRate[i][1], i);
/* Bit interleaver */
/* First init all possible interleaver (According table "TableMLC.h" ->
"Interleaver sequence") */
if (eCodingScheme == CParameter::CS_3_HMMIX)
{
BitInterleaver[0].Init(iN[0], iN[1], 13);
BitInterleaver[1].Init(iN[0], iN[1], 21);
}
else
{
BitInterleaver[0].Init(2 * iN[0], 2 * iN[1], 13);
BitInterleaver[1].Init(2 * iN[0], 2 * iN[1], 21);
}
/* QAM-mapping */
QAMMapping.Init(iN_mux, eCodingScheme);
/* Allocate memory for internal bit-buffers ----------------------------- */
for (i = 0; i < iLevels; i++)
{
/* Buffers for each encoder on all different levels */
/* Add bits from higher protected and lower protected part */
vecbiEncInBuffer[i].Init(iM[i][0] + iM[i][1]);
/* Encoder output buffers for all levels. Must have the same length */
vecbiEncOutBuffer[i].Init(iNoEncBits);
}
/* Define block-size for input and output */
iInputBlockSize = iNoInBits;
iOutputBlockSize = iN_mux;
}
/******************************************************************************\
* MLC-decoder *
\******************************************************************************/
void CMLCDecoder::ProcessDataInternal(CParameter& ReceiverParam)
{
int i, j, k;
int iElementCounter;
_BOOLEAN bIteration;
/* Save input signal for signal constellation. We cannot use the copy
operator of vector because the input vector is not of the same size as
our intermediate buffer, therefore the "for"-loop */
for (i = 0; i < iInputBlockSize; i++)
vecSigSpacBuf[i] = (*pvecInputData)[i].cSig;
#if 0
// TEST
static FILE* pFile = fopen("test/constellation.dat", "w");
if (eChannelType == CParameter::CT_MSC) {
for (i = 0; i < iInputBlockSize; i++)
fprintf(pFile, "%e %e\n", vecSigSpacBuf[i].real(), vecSigSpacBuf[i].imag());
fflush(pFile);
}
// close all;load constellation.dat;constellation=complex(constellation(:,1),constellation(:,2));plot(constellation,'.')
#endif
/* Iteration loop */
for (k = 0; k < iNoIterations + 1; k++)
{
for (j = 0; j < iLevels; j++)
{
/* Metric ------------------------------------------------------- */
if (k > 0)
bIteration = TRUE;
else
bIteration = FALSE;
MLCMetric.CalculateMetric(pvecInputData, vecMetric,
vecbiSubsetDef[0], vecbiSubsetDef[1], vecbiSubsetDef[2],
vecbiSubsetDef[3], vecbiSubsetDef[4], vecbiSubsetDef[5],
j, bIteration);
/* Bit deinterleaver -------------------------------------------- */
if (piInterlSequ[j] != -1)
BitDeinterleaver[piInterlSequ[j]].Deinterleave(vecMetric);
/* Viterbi decoder ---------------------------------------------- */
rAccMetric =
ViterbiDecoder[j].Decode(vecMetric, vecbiDecOutBits[j]);
/* The last branch of encoding and interleaving must not be used at
the very last loop */
/* "iLevels - 1" for iLevels = 1, 2, 3
"iLevels - 2" for iLevels = 6 */
if ((k < iNoIterations) ||
((k == iNoIterations) && !(j >= iIndexLastBranch)))
{
/* Convolutional encoder ------------------------------------ */
ConvEncoder[j].Encode(vecbiDecOutBits[j], vecbiSubsetDef[j]);
/* Bit interleaver ------------------------------------------ */
if (piInterlSequ[j] != -1)
BitInterleaver[piInterlSequ[j]].
Interleave(vecbiSubsetDef[j]);
}
}
}
/* De-partitioning of input-stream ---------------------------------
没有合适的资源?快使用搜索试试~ 我知道了~
Dream是一个数字收音机Digital Radio Mondiale (DRM) 的软件实现。
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 192 浏览量
2023-04-13
18:11:19
上传
评论
收藏 284KB GZ 举报
温馨提示
共129个文件
h:56个
cpp:47个
in:5个
Dream是一个数字收音机Digital Radio Mondiale (DRM) 的软件实现。你所要做的就是有一个带有声卡的计算机,通过它可以实现中波、短波s....gz
资源推荐
资源详情
资源评论
收起资源包目录
Dream是一个数字收音机Digital Radio Mondiale (DRM) 的软件实现。 (129个子文件)
Makefile.am 6KB
Makefile.am 125B
AUTHORS 102B
ChangeLog 307B
configure 176KB
COPYING 15KB
MLC.cpp 28KB
Metric.cpp 26KB
TimeSync.cpp 23KB
CellMappingTable.cpp 21KB
ChannelEstimation.cpp 19KB
sound.cpp 17KB
systemevalDlg.cpp 17KB
OFDM.cpp 16KB
Data.cpp 16KB
fdrmdialog.cpp 16KB
ViterbiDecoder.cpp 15KB
SDCReceive.cpp 14KB
FreqSyncAcq.cpp 14KB
TimeWiener.cpp 13KB
ChannelSimulation.cpp 13KB
DrmReceiver.cpp 13KB
AudioSourceDecoder.cpp 13KB
DRMPlot.cpp 13KB
Parameter.cpp 13KB
TimeSyncTrack.cpp 12KB
SDCTransmit.cpp 12KB
SyncUsingPil.cpp 11KB
MatlibStdToolbox.cpp 11KB
FAC.cpp 10KB
MatlibSigProToolbox.cpp 10KB
DrmSimulation.cpp 9KB
OFDMCellMapping.cpp 9KB
TextMessage.cpp 8KB
DRMSignalIO.cpp 7KB
ConvEncoder.cpp 7KB
MSCMultiplexer.cpp 7KB
SimulationParameters.cpp 7KB
QAMMapping.cpp 6KB
SymbolInterleaver.cpp 6KB
TimeLinear.cpp 5KB
DrmTransmitter.cpp 5KB
BitInterleaver.cpp 5KB
main.cpp 4KB
MultColorLED.cpp 4KB
Resample.cpp 4KB
TimeDecDir.cpp 4KB
InputResample.cpp 3KB
CRC.cpp 3KB
EnergyDispersal.cpp 3KB
BlockInterleaver.cpp 2KB
ChanEstTime.cpp 2KB
DataDecoder.cpp 2KB
depcomp 12KB
config.guess 38KB
Modul.h 29KB
Matlib.h 22KB
TableMLC.h 13KB
Parameter.h 12KB
TableCarMap.h 10KB
Vector.h 10KB
Buffer.h 9KB
MatlibStdToolbox.h 8KB
Data.h 7KB
MLC.h 6KB
GlobalDefinitions.h 6KB
DrmReceiver.h 5KB
TimeWiener.h 5KB
ChannelEstimation.h 5KB
TimeSync.h 5KB
CellMappingTable.h 5KB
DrmSimulation.h 4KB
ResampleFilter.h 4KB
ViterbiDecoder.h 4KB
TableDRMGlobal.h 4KB
OFDM.h 4KB
FreqSyncAcq.h 4KB
ChannelSimulation.h 4KB
MatlibSigProToolbox.h 3KB
Metric.h 3KB
TimeSyncTrack.h 3KB
SyncUsingPil.h 3KB
DRMPlot.h 3KB
DRMSignalIO.h 3KB
systemevalDlg.h 3KB
TableQAMMapping.h 3KB
AudioSourceDecoder.h 3KB
TextMessage.h 3KB
sound.h 3KB
SymbolInterleaver.h 3KB
TableFAC.h 3KB
DrmTransmitter.h 3KB
SDC.h 3KB
TimeSyncFilter.h 2KB
fdrmdialog.h 2KB
MultColorLED.h 2KB
OFDMCellMapping.h 2KB
ChanEstTime.h 2KB
BitInterleaver.h 2KB
TimeLinear.h 2KB
共 129 条
- 1
- 2
资源评论
N201871643
- 粉丝: 798
- 资源: 2292
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功