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

📄 thrdecode.c

📁 基于TI xdais算法标准的音频ADPCM算法
💻 C
字号:
#include <std.h>
#include <stdio.h>
#include <sys.h>
#include <scom.h>
#include <cassert>
#include <log.h>
#include <utl.h>
#include "adpcm.h"
#include "thrDecode.h"
#include "thrEncode.h"
#include "adpcmParam.h"
#include "evmdm642_echocfg.h"


static AdpcmState *audio_state_L1,*audio_state_L2;

Void thrDecodeInit()
{
    SCOM_Handle scomReceiveFromOutput,scomReceiveFromEncode;
    /* create named SCOM queues for receiving messages from other tasks */
    scomReceiveFromOutput = SCOM_create( "scomOutputToDecode", NULL );
    scomReceiveFromEncode = SCOM_create( "scomEncodeToDecode", NULL );
    UTL_assert( scomReceiveFromOutput != NULL );
    UTL_assert( scomReceiveFromEncode != NULL );
}

Void thrDecodeStartup()
{

}

Void thrDecodeRun()
{		

    char  *pDecodeInL1,*pDecodeInL2;    
    char  ch_L1=0,ch_L2=0;
    short sh_L1=0,sh_L2=0;
    short *outbufL1,*outbufL2;  
    MyMsg *msgFromOutput;
    ThrEncode *msgfromEncode;
	
	SCOM_Handle scomReceiveFromOutput = SCOM_open( "scomOutputToDecode");
	SCOM_Handle scomReceiveFromEncode = SCOM_open( "scomEncodeToDecode");
	SCOM_Handle scomSendToOutput      = SCOM_open( "scomDecodeToOutput" );
	
	audio_state_L1 = MEM_alloc(1, sizeof( MyMsg ), 0 );
    audio_state_L2 = MEM_alloc(1, sizeof( MyMsg ), 0 );	
	
		while(1)
		{
		    
		    msgfromEncode=(ThrEncode *)SCOM_getMsg( scomReceiveFromEncode,  SYS_FOREVER);
		    
		    msgFromOutput->ptr = SCOM_getMsg( scomReceiveFromOutput,  SYS_FOREVER);
		    
		    pDecodeInL1 = msgfromEncode->midbuf1;
		    pDecodeInL2 = msgfromEncode->midbuf2;
		    outbufL1    = msgFromOutput->ptr;
		    outbufL2	= outbufL1+1;
		    
		    audio_state_L1->index=ch_L1;
		    audio_state_L1->valprev=sh_L1;
		    audio_state_L2->index=ch_L2;
		    audio_state_L2->valprev=sh_L2;
		    
		    LOG_printf(&trace, "Decode alg start:%d", CLK_gethtime());
		    decode(pDecodeInL1, outbufL1,  NUM_PROCESS_CHAN , audio_state_L1);
		    decode(pDecodeInL2, outbufL2,  NUM_PROCESS_CHAN  , audio_state_L2);
		    LOG_printf(&trace, "Decode alg end:%d", CLK_gethtime());
		    
		    ch_L1 = audio_state_L1->index;
		    sh_L1 = audio_state_L1->valprev;
		    ch_L2 = audio_state_L2->index;
		    sh_L2 = audio_state_L2->valprev;
		    
		    SCOM_putMsg(scomSendToOutput,NULL);
		    LOG_printf(&trace, "end:%d", CLK_gethtime());
		}

}

⌨️ 快捷键说明

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