📄 csl_tcp2.c
字号:
tailData [11]);
tail3 = 0;
}
tail4 = 0;
tail5 = 0;
tail6 = 0;
break;
}
case TCP2_RATE_1_4: {
/* SP MAP1 non interleaved data */
/* tail1 = (x10 + x10)/2, (x10 + x10)/2, (x10 + x10)/2 */
/* tail2 = p10, p10, p10 */
/* tail3 = p11, p11, p11 */
/* SP MAP2 interleaved data */
/* tail1 = (x20 + x20)/2, (x20 + x20)/2, (x20 + x20)/2 */
/* tail2 = p20, p20, p20 */
/* tail3 = p21, p21, p21 */
if (TCP2_MAP_MAP1 == map) {
tail1 = TCP2_makeTailArgs((tailData [8] + tailData [9]) / 2,
(tailData [4] + tailData [5]) / 2,
(tailData [0] + tailData [1]) / 2);
tail2 = TCP2_makeTailArgs(tailData [10], tailData [6],
tailData [2]);
tail3 = TCP2_makeTailArgs(tailData [11], tailData [7],
tailData [3]);
}
else {
tail1 = TCP2_makeTailArgs(
(tailData [20] + tailData [21]) / 2,
(tailData [17] + tailData [16]) / 2,
(tailData [12] + tailData [13]) / 2
);
tail2 = TCP2_makeTailArgs(tailData [22], tailData [18],
tailData [14]);
tail3 = TCP2_makeTailArgs(tailData [23], tailData [19],
tailData [15]);
}
tail4 = 0;
tail5 = 0;
tail6 = 0;
break;
}
case TCP2_RATE_1_5: {
/* SP MAP1 non interleaved data */
/* tail1 = (x10 + x10 + x10)/3, (x10 + x10 + x10)/3,
(x10 + x10 + x10)/3 */
/* tail2 = p10, p10, p10 */
/* tail3 = p11, p11, p11 */
/* SP MAP2 interleaved data */
/* tail4 = (x20 + x20 + x20)/3, (x20 + x20 + x20)/3,
(x20 + x20 + x20)/3 */
/* tail5 = p20, p20, p20 */
/* tail6 = p21, p21, p21 */
if (TCP2_MAP_MAP1 == map) {
tail1 = TCP2_makeTailArgs(
(tailData [10] + tailData [11] + tailData [12]) / 3,
(tailData [5] + tailData [6] + tailData [7]) / 3,
(tailData [0] + tailData [1] + tailData [2]) / 3
);
tail2 = TCP2_makeTailArgs(tailData [13], tailData [8],
tailData [3]);
tail3 = TCP2_makeTailArgs(tailData [14], tailData [9],
tailData [4]);
}
else {
tail1 = TCP2_makeTailArgs(
(tailData [25] + tailData [26] + tailData [27]) / 3,
(tailData [20] + tailData [21] + tailData [22]) / 3,
(tailData [15] + tailData [16] + tailData [17]) / 3
);
tail2 = TCP2_makeTailArgs(tailData [28], tailData [23],
tailData [18]);
tail3 = TCP2_makeTailArgs(tailData [29], tailData [24],
tailData [19]);
}
tail4 = 0;
tail5 = 0;
tail6 = 0;
break;
}
default:
break;
}
} /* end of else */
/* Assign the tail data values */
gie = _disable_interrupts ();
configIc->ic6 = tail1;
configIc->ic7 = tail2;
configIc->ic8 = tail3;
configIc->ic9 = tail4;
configIc->ic10 = tail5;
configIc->ic11 = tail6;
_restore_interrupts (gie);
return;
} /* end TCP2_tailConfigIs2000 */
/** ============================================================================
* @n@b TCP2_calculateHd
*
* @b Description
* @n This function calculates the hard decisions following multiple MAP
* decodings in shared processing mode.
*
* @b Arguments
@verbatim
extrinsicsMap1 Extrinsics data following MAP1 decode
apriori Apriori data following MAP2 decode
channelData Input channel data
hardDecisions Hard decisions
numExt Number of extrinsics
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The hardDecisions will contain the calculated hard decisions.
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
void TCP2_calculateHd(extrinsicsMap1, apriori,
channelData, hardDecisions, numExt);
@endverbatim
* ===========================================================================
*/
void TCP2_calculateHd (
const TCP2_ExtrinsicData *extrinsicsMap1,
const TCP2_ExtrinsicData *apriori,
const TCP2_UserData *channelData,
Uint32 *hardDecisions,
Uint16 numExt
)
{
Uint32 i;
Int32 extInt;
Int32 apInt;
Int32 inputInt;
Int32 softDecision;
Uint32 wordCount = 0;
Uint32 hdCount = 0;
hardDecisions[0] = 0;
for (i = 0; i < numExt; i++) {
if((extrinsicsMap1[i]<<1)&0x80)
extInt = (extrinsicsMap1[i]<<1) | 0xffffff00;
else
extInt = (Int32)(extrinsicsMap1[i]<<1);
if((apriori[i]<<1)&0x80)
apInt = (apriori[i]<<1) | 0xffffff00;
else
apInt = (Int32)(apriori[i]<<1);
inputInt = (Int32)channelData[i / 5]; /* i * rate( = 1/5) */
if(inputInt & 0x80) inputInt |= 0xFFFFFF00;
softDecision = inputInt + extInt + apInt;
if(hdCount == 32) {
hdCount = 0;
wordCount++;
hardDecisions[wordCount] = 0;
}
if((softDecision & 0x200) == 0)
hardDecisions[wordCount] |= 1 << hdCount;
hdCount++;
}
return;
}
/** ============================================================================
* @n@b TCP2_deinterleaveExt
*
* @b Description
* @n This function de-interleaves the MAP2 extrinsics data to generate
* apriori data for the MAP1 decode. This function is for use in
* performing shared processing.
*
* @b Arguments
@verbatim
aprioriMap1 Apriori data for MAP1 decode
extrinsicsMap2 Extrinsics data
interleaverTable Interleaver data table
numExt Number of Extrinsics
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The aprioriMap1 will contain the deinterleaved data.
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
<...MAP 2 decode...>
TCP2_deinterleaveExt(aprioriMap1, extrinsicsMap2,
interleaverTable, numExt);
<...MAP 1 decode...>
@endverbatim
* ===========================================================================
*/
void TCP2_deinterleaveExt (
TCP2_ExtrinsicData *aprioriMap1,
const TCP2_ExtrinsicData *extrinsicsMap2,
const Uint16 *interleaverTable,
Uint32 numExt
)
{
Uint32 cnt;
/* deinterleave extrinsics */
for (cnt = 0; cnt < numExt; cnt++) {
aprioriMap1[interleaverTable[cnt]] = *(extrinsicsMap2 + cnt);
}
return;
}
/** ============================================================================
* @n@b TCP2_interleaveExt
*
* @b Description
* @n This function interleaves the MAP1 extrinsics data to generate
* apriori data for the MAP2 decode. This function is for used in
* performing shared processing.
*
* @b Arguments
@verbatim
aprioriMap2 Apriori data for MAP2 decode
extrinsicsMap1 Extrinsics data
interleaverTable Interleaver data table
numExt Number of Extrinsics
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The aprioriMap2 will contain the interleaved data.
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
<...MAP 1 decode...>
TCP2_interleaveExt(aprioriMap2, extrinsicsMap1,
interleaverTable, numExt);
<...MAP 2 decode...>
@endverbatim
* ===========================================================================
*/
void TCP2_interleaveExt (
TCP2_ExtrinsicData *aprioriMap2,
const TCP2_ExtrinsicData *extrinsicsMap1,
const Uint16 *interleaverTable,
Uint32 numExt
)
{
Uint32 cnt;
/* interleaving extrinsics */
for (cnt=0; cnt < numExt; cnt++) {
aprioriMap2[cnt] = *(extrinsicsMap1 + interleaverTable[cnt]);
}
return;
}
/** ============================================================================
* @n@b TCP2_demuxInput
*
* @b Description
* @n This function splits the input data into two working sets. One set
* contains the non-interleaved input data and is used with the MAP 1
* decoding. The other contains the interleaved input data and is used
* with the MAP2 decoding. This function is used in shared processing mode.
*
* @b Arguments
@verbatim
rate TCP data code rate
frameLen Frame length
input Input channel data
interleaver Interleaver data table
nonInterleaved Non Interleaved data for SP MAP0
interleaved Interleaved data for SP MAP1
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The nonInterleaved will contain the non-interleaved
* data and the interleaved will contain the interleaved data.
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
TCP2_demuxInput (frameLen, input,
interleaver, interleaved, nonInterleaved);
@endverbatim
* ===========================================================================
*/
void TCP2_demuxInput (
Uint32 rate,
Uint32 frameLen,
const TCP2_UserData *input,
const Uint16 *interleaver,
TCP2_ExtrinsicData *nonInterleaved,
TCP2_ExtrinsicData *interleaved
)
{
Uint32 inCnt;
Uint32 outCnt;
Uint32 cnt;
Uint16 iter;
Uint32 *output0 = (Uint32 *)nonInterleaved;
Uint32 *output1 = (Uint32 *)interleaved;
Uint16 *deInterleaveTbl;
Uint16 dataIndex;
Uint16 tableIndex;
Uint16 numPar;
/* allocate memory for deinterleave table */
deInterleaveTbl = (Uint16*) malloc (sizeof (Uint16) * frameLen);
/*
'interleaver' is a buffer of frameLen 16-bit indices
'input' is a buffer of frameLen * rate 8-bit elements
'output[2]' is the 2 de-multiplexed buffers :
.out[0] buffer which is the TCP input buffer for LOG-MAP 1 decoding
.out[1] buffer which is the TCP input buffer for LOG-MAP 2 decoding
*/
/* For shared processing, TCP2 only executes the non-interleaved MAP
* decoder. Therefore, p20 and p21 are not used in the input data. When
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -