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

📄 sbl1_trulspk_turbodecoder.c

📁 lte系统物理信道turbo检码程序
💻 C
字号:
/* ================================================================================================
   Property of Freescale
   Freescale Confidential Proprietary
   Freescale Copyright (C) 2007 All rights reserved
   ------------------------------------------------------------------------------------------------
   $RCSfile: SBL1_TRULSPK_TurboDecoder.c.rca $  
   $Revision: 1.7 $
   $Date: Wed Mar 19 16:15:20 2008 $
==================================================================================================*/

/*------------------------------------------------------------------------------------------------*/
/**
 @file    SBL1_TRULSPK_TurboDecoder.c  
 
 @brief   C file for turbo decoder

*/
/*------------------------------------------------------------------------------------------------*/

#include <math.h>

#include "SBL1_TRULSPK_TurboDecoder.h"
#include "SBL1_TRUL_Common.h"
#include "SBL1_TRULSPK_QPPInterleaver.h"

#ifdef LINEAR_LOG_MAP
    #include "turboDecoderLinLOGMAP.h"
#else
    #include "SBL1_TRULSPK_TurboMaxLogMap.h"
#endif /* #ifdef LINEAR_LOG_MAP */



#include "SBL1_TRULSPK_scale.h"
#ifdef PACKED_BYTE_OUT
   #include "SBL1_TRULSPK_noCodingPacked.h"
#else
   #include "SBL1_TRULSPK_noCodingPacked.h"
#endif


/*------------------------------------------------------------------------------------------------*/
/*!  
 @fn       	void SBL1_TRULSPK_Channeldecoder(INT8 *input_data,  
                                 			INT8 *output_data,            
                                 			UINT16 codeblk_len,            
                                 			UINT16 inverse_rate,           
                                 			UINT16 num_codeblks,           
                                 			UINT16 coding_type,            
                                 			UINT16 num_decode_iter,        
                                 			UINT16 delay,                  
                                 			INT16  threshold,
                                 			INT32 *gamma,
                                 			INT16  alpha[][8],
                                 			UINT16 *ptr_turbo_interleaver
                                 		)

 	 
 @brief   This module will perform turbo de-coding of the code blocks. This called once per code block.
                                
 @param    input_data              Pointer to input data 
 @param    output_data             Pointer to output data.
 @param    codeblk_len             Code Block Length.
 @param    inverse_rate            Inverse Coding Rate (2 or 3)     
 @param    num_codeblks            Number of code blocks.
 @param    coding_type             Turbo Coder / Convolutional Coder
 @param    num_decode_iter         Number of iterations for turbo
 @param    delay                   Delay length   
 @param    threshold               Needed when Linear LOG MAP is used
 @param    gamma                   Pointer to Gamma Values
 @param    alpha                   Pointer to Alpha Values
 @param    ptr_turbo_interleaver   Pointer to turbo Interleaver table
   
 @return   	return value of the function
*/
/*-------------------------------------------------------------------------------------------------*/

void SBL1_TRULSPK_Channeldecoder(INT8 *input_data,             /* Pointer to input data */
                                 INT8 *output_data,            /* Pointer to output data */
                                 UINT16 codeblk_len,            /* Code Block Length */
                                 UINT16 inverse_rate,           /* Inverse Coding Rate (2 or 3) */
                                 UINT16 num_codeblks,           /* Number of code blocks */
                                 UINT16 coding_type,            /* Turbo Coder or Convolution Coder */
                                 UINT16 num_decode_iter,        /* Number of iterations for turbo */
                                 UINT16 delay,                  /* Delay Length for Turbo */
                                 INT16  threshold,
                                 INT32 *gamma,
                                 INT16  alpha[][8],
                                 UINT16 *ptr_turbo_interleaver)
{

    UINT16 input_block_length;                             /* Input to turbo decoder */
    UINT16 usiI; 
#ifdef  _CTCDEC_ASM
    UINT16 counter_2;                                    /* Loop variable */
#endif    
    //INT16 *ptr_turbo_interleaver;
    threshold = threshold;
	if (coding_type == TURBO_CODER)
    {
       input_block_length = (unsigned short)((codeblk_len*inverse_rate) + 12);
    }
    
    /* Call appropriate channel decoder Ci times. */
    for(usiI = 0; usiI < num_codeblks; usiI++)
    {
        if(coding_type == TURBO_CODER)
        {   
            SBL1_TRULSPK_QPPInterleaver(ptr_turbo_interleaver,
                                        codeblk_len);
            
			/*The Below portion of the Code is a workaround 
			  The reason is that the TurboInterleaver C and ASM 
			  version generate Factor of two over the C Interleaver Indexes
			  So this Work around is done
		     */
			
			#ifdef _CTCDEC_ASM
			for(counter_2=0;counter_2<codeblk_len;counter_2++)
			{
			 *(ptr_turbo_interleaver + counter_2)	= (UINT16)(2*(*(ptr_turbo_interleaver + counter_2)));
			}
			
			#endif
			

            #ifdef LINEAR_LOG_MAP
            
                    scaleLinLM(input_data, input_data, input_block_length);
                    TurboDecoderLinLM(
                            input_data,
                            codeblk_len,
                            inverse_rate,
                            output_data,
                            ptr_turbo_interleaver,
                            num_decode_iter,
                            delay,
                            threshold);

            #else /* !( #ifdef  LINEAR_LOG_MAP )*/

           			//ScaleMaxLM(input_data, input_data, input_block_length);
                    asm(" nop");
                    SBL1_TRULSPK_TurboDecMaxLM( input_data,
                                                codeblk_len,
                                                inverse_rate,
                                                output_data,
                                                ptr_turbo_interleaver,
                                                num_decode_iter,
                                                delay,
                                                gamma,
                                                alpha);

            #endif /* #ifdef  LINEAR_LOG_MAP */

        }
        input_data += input_block_length;
#ifdef PACKED_BYTE_OUT
        output_data += (codeblk_len+7)>>3;

#else
        output_data += codeblk_len;
#endif
    }

    return;
}



⌨️ 快捷键说明

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