📄 codec.h
字号:
/* ================================================================
S5H5002
Developed by Optical Player P/J, DSP Application
Copyright (c) 2003 Samsung Electronics
All Rights Reserved.
DESCRIPTION:
================================================================= */
#ifndef _CODEC_H_
#define _CODEC_H_
#ifdef CODEC_GLOBALS
#define CODEC_EXT
#else
#define CODEC_EXT extern
#endif
/* ===============================================================================
D E F I N E S
=============================================================================== */
/* ===============================================================================
T Y P E S
=============================================================================== */
typedef struct{
/* 0x00 */ unsigned char CodecStartFlag; // 1B
/* 0x01 */ unsigned char AudioMode; // 1B
/* 0x02 */ unsigned char *pParameter; // 4B
/* 0x06 */ unsigned int NumberOfSample; // 2B
/* 0x08 */ unsigned char PCMResolution; // 1B
/* 0x09 */ unsigned char DecodeErrFlag; // 1B
/* 0x0A */ unsigned long SamplingRate; // 4B
/* 0x0E */ unsigned long BitRate; // 4B
/* 0x12 */ unsigned long InputBufferOffset; // 4B
/* 0x16 */ unsigned long InputBufferSize; // 4B
/* 0x1A */ unsigned long OutputBufferOffset; // 4B
/* 0x1E */ unsigned long ExtInputBufferOffset; // 4B
/* 0x22 */ unsigned int FrameSize; // 2B
/* 0x24 */ unsigned long StreamBufOffset; // 4B
} MainCodecShared_t;
typedef enum {
MPEG_1_AUDIO =0, /* mpeg audio stereo decoder */
MPEG_2_AUDIO =1, /* mpeg audio 5.1-ch decoder */
MPEG_2_AUG_AUDIO =2 /* mpeg audio 7.1-ch decoder */
} MPA_Version_t;
typedef enum {
AUDIO_NULL =0,
MPEG1_MONO =1,
MPEG1_STEREO =2,
MPEG2_5CH =3, /* 5.1-ch output and downmix 2-ch */
MPEG2_7CH =4, /* 7.1-ch output and downmix 2-ch */
MPEG2_DOWNMIX =5, /* downmix channel only */
CHANNEL_TEST =6 /* Test channels, output test tone */
} MPA_Output_t;
typedef struct {
unsigned char Version; /* MPEG version */
unsigned char OUT_Mode; /* output channel configuration */
unsigned char LFE_Enable; /* LFE channel On/Off */
unsigned char DRC_Mode; /* dynamic range control On/Off */
unsigned char CRC_Option; /* CRC check option of ext/mc streams */
unsigned char EXT_Present; /* CRC check option of ext/mc streams */
unsigned char CH_Content; /* 0: L->R, 1: R->L */
} MPA_Param_t;
typedef enum {
/* decoding message */
DECODE_OK = 0,
MPG_SYNC_NOT_FOUND,
EXT_SYNC_NOT_FOUND,
BASE_CRC_ERROR,
MC_CRC_ERROR,
EXT_CRC_ERROR,
CRC_CHECK_YES,
CRC_RECOVERED,
ILLEGAL_LAYER,
ILLEGAL_DOWNMIX_MODE,
ILLEGAL_MATRIX_MODE,
MC_PRED_MODE,
/* stream information */
NO_MAIN_AUDIO_DATA,
NO_EXT_AUDIO_DATA,
END_OF_BITSTREAM,
END_OF_FILE,
/* decoder status information */
MPEG_DECODE_READY,
MPEG_DECODE_SUSPEND,
MPEG_DECODE_STARTED,
MPEG_DECODE_END,
/* system flags */
FAIL_MEM_ALLOC,
UNKNOWN_ERROR = -1
} ErrCode;
typedef struct{
UCHAR MP3_MpegMode;
UCHAR MP3_ChannelLoop;
UCHAR MP3_GL2Done;
UCHAR MP3_Present;
UCHAR MP3_CHSelect; /* Select Mono Output, 0: L->R, 1: R->L, 2: STEREO */
}MP3_Param_t;
/* ===============================================================================
F U N C T I O N P R O T O T Y P E S
=============================================================================== */
/*
CODEC_EXT void (*CodecHandler)(void);
CODEC_EXT void (*AudioDecodeFnct)(MainCodecShared_t *);
CODEC_EXT void DecodeHandler(void);
CODEC_EXT void SwitchCodec(Object_t);
CODEC_EXT void NULLDecoder(MainCodecShared_t *Shared);
*/
#ifdef _MPADEC
extern int MPADecoder(MainCodecShared_t *);
#else
#define MPADecoder NULLDecoder
#endif
#ifdef _MP3DEC
extern void MP3Decoder(MainCodecShared_t *);
#endif
/* ===============================================================================
V A R I A B L E S
=============================================================================== */
CODEC_EXT MainCodecShared_t MainCodecShared;
CODEC_EXT MPA_Param_t MPA_Param;
CODEC_EXT MP3_Param_t MP3_Param;
#if _AUDIO_POST_PROCESS_
typedef struct{
/* 0x00 */ unsigned int CodecStartFlag; // 2B
/* 0x02 */ unsigned char *pParameter; // 4B
/* 0x06 */ unsigned int NumberOfSample; // 2B
/* 0x08 */ unsigned char PCMResolution; // 1B
/* 0x09 */ unsigned char DecodeErrFlag; // 1B
/* 0x0A */ unsigned long SamplingRate; // 4B
/* 0x0E */ unsigned long InputBufferOffset; // 4B
/* 0x12 */ unsigned long OutputBufferOffset; // 4B
#if _AUDIO_KARAOKE_
/* 0x16 */ unsigned int AudioMode; // 2B
/* 0x18 */ unsigned long MicInBufStartPtr; /* 4B input buffer start pointer of Mic Echo */
/* 0x1C */ unsigned long MicInBufEndPtr; /* 4B input buffer end pointer of Mic Echo */
/* 0x20 */ unsigned long MicInBufRDPtr; /* 4B input buffer read pointer of Mic Echo */
// Add EJY===============================================================
/* 0x24 */ unsigned int MicCenter;
/* 0x26 */ unsigned int MicUnusedOut;
/* 0x28 */ unsigned int MicVariation;
/* 0x2A */ unsigned int MicNoiseThres;
//Add EJY ===============================================================
#else /* _AUDIO_KARAOKE_ */
/* 0x16 */ unsigned char AudioMode; // 1B
/* 0x17 */ unsigned char Dummy; // 1B
#endif /* _AUDIO_KARAOKE_ */
}PostCodecShared_t;
/* Bit Map of PostCodecShared.CodecStartFlag
0 - Start Flag
1 - Update Parameter Flag
Bit[1:0] - Equalizer[1:0]
Bit[3:2] - Hall[1:0]
Bit[5:4] - Prologic2[1:0]
Bit[7:6] - Spatializer[1:0]
Bit[9:8] - Reserved[1:0]
Bit[11:10] - Reserved[1:0]
Bit[13:12] - Reserved[1:0]
Bit[15:14] - Reserved[1:0]
*/
#if _AUDIO_3D_
extern void Spatializer(PostCodecShared_t *);
CODEC_EXT PostCodecShared_t SpatializerShared;
#endif
typedef struct{
ULONG InBufferSize;
UCHAR PCMResolution;
UCHAR Mute_Flag;
UCHAR PSD_stop;
#if _AUDIO_3D_
UCHAR SPTL_Flag;
#endif /* _AUDIO_3D_ */
#if _AUDIO_EQ_
UCHAR EQ_Flag;
#endif /* _AUDIO_EQ_ */
#if _AUDIO_KARAOKE_
UCHAR KARA_Flag;
UCHAR Parse_Flag;
ULONG MicInOffset;
#endif /* _AUDIO_KARAOKE_ */
#if _AUDIO_TONE_CTRL_
UCHAR PSCON_Flag;
#endif /* _AUDIO_TONE_CTRL_ */
#if _SW_VOLUME_
UCHAR Volume;
#endif
// UCHAR ChSel_Flag;
}SystemInfo_t;
#if _AUDIO_EQ_
//============ For EQUALIZER =======================
typedef enum
{
EQUALIZER_OFF = 0,
// EQUALIZER_3D, //don't support 3D
EQUALIZER_JAZZ,
EQUALIZER_ROCK,
EQUALIZER_POP,
EQUALIZER_CLASSIC
}SET_EQUAL_ID;
extern void Equalizer(PostCodecShared_t *);
typedef enum{
EQ_Normal,
EQ_Rock,
EQ_Classic,
EQ_Jazz,
EQ_Pop
}EQ_Mode;
typedef struct{
unsigned char EQ_Mode; // 1B
}EQ_Param_t;
CODEC_EXT PostCodecShared_t EQ_Shared;
CODEC_EXT EQ_Param_t EQ_Param;
#endif
#if _AUDIO_TONE_CTRL_
typedef enum {
KEY_FLAT_6,
KEY_FLAT_5,
KEY_FLAT_4,
KEY_FLAT_3,
KEY_FLAT_2,
KEY_FLAT_1,
KEY_NORMAL,
KEY_SHARP_1,
KEY_SHARP_2,
KEY_SHARP_3,
KEY_SHARP_4,
KEY_SHARP_5,
KEY_SHARP_6
} S5H_KeyControl_t;
typedef enum {
#if 1
PSC_PIDX_6_F = 12,
PSC_PIDX_5_F = 14,
PSC_PIDX_4_F = 16,
PSC_PIDX_3_F = 18,
PSC_PIDX_2_F = 20,
PSC_PIDX_1_F = 22,
PSC_PIDX_NORMAL = 24,
PSC_PIDX_1_S = 26,
PSC_PIDX_2_S = 28,
PSC_PIDX_3_S = 30,
PSC_PIDX_4_S = 32,
PSC_PIDX_5_S = 34,
PSC_PIDX_6_S = 36,
#else
PSC_PIDX_6_F = 18,
PSC_PIDX_5_F = 19,
PSC_PIDX_4_F = 20,
PSC_PIDX_3_F = 21,
PSC_PIDX_2_F = 22,
PSC_PIDX_1_F = 23,
PSC_PIDX_NORMAL = 24,
PSC_PIDX_1_S = 25,
PSC_PIDX_2_S = 26,
PSC_PIDX_3_S = 27,
PSC_PIDX_4_S = 28,
PSC_PIDX_5_S = 29,
PSC_PIDX_6_S = 30,
#endif
} PSC_Pidx_t;
typedef enum{
PSCON_MONO,
PSCON_STEREO
}PSCON_Chidx;
typedef enum{
PSCON_Fs_48 = 3,
PSCON_Fs_44,
PSCON_Fs_32,
PSCON_Fs_24,
PSCON_Fs_22,
PSCON_Fs_16,
PSCON_Fs_12,
PSCON_Fs_11,
PSCON_Fs_08
}PSCON_Fsidx;
typedef enum{
PSCON_FN_256,
PSCON_FN_288,
PSCON_FN_384,
PSCON_FN_512,
PSCON_FN_576,
PSCON_FN_768,
PSCON_FN_1024,
PSCON_FN_1152,
PSCON_FN_1536
}PSC_FrameNo;
typedef struct {
/* Pitch and Speed Control module */
unsigned char PSC_Pidx;
unsigned char PSC_Sidx;
unsigned char PSC_Chidx;
unsigned char PSC_Fsidx;
unsigned long PSC_FrameNo;
unsigned long PSC_Samples;
} Pscon_Param_t;
CODEC_EXT PostCodecShared_t PSCON_Shared;
CODEC_EXT Pscon_Param_t PSCON_Param;
extern void PSControl(PostCodecShared_t *);
#endif /*_AUDIO_TONE_CTRL_*/
//for 3D
#if _AUDIO_3D_
typedef enum{
SPTL_N22_NHP,
SPTL_N22_TV,
SPTL_N22_SP,
SPTL_VBX,
SPTL_VLFE
}SPTL_Algorithm;
#endif
#if _AUDIO_KARAOKE_
typedef enum {
ECHO_LEVEL_0,
ECHO_LEVEL_1,
ECHO_LEVEL_2,
ECHO_LEVEL_3,
ECHO_LEVEL_4,
ECHO_LEVEL_5,
ECHO_LEVEL_6,
ECHO_LEVEL_7,
ECHO_LEVEL_8
} S5H_EchoLevel_t;
typedef enum {
ME_Delay0, //Lumin20051121
ME_Delay1,
ME_Delay2,
ME_Delay3,
ME_Delay4,
ME_Delay5,
ME_Delay6,
ME_Delay7,
ME_Delay8
} ME_Delay_t;
typedef enum {
ME_Decay0,//Lumin20051121
ME_Decay1,
ME_Decay2,
ME_Decay3,
ME_Decay4,
ME_Decay5,
ME_Decay6,
ME_Decay7,
ME_Decay8
} ME_Decay_t;
typedef enum {
ME_EchoGain1,
ME_EchoGain2,
ME_EchoGain3,
ME_EchoGain4,
ME_EchoGain5,
ME_EchoGain6,
ME_EchoGain7,
ME_EchoGain8
} ME_Gain_t;
typedef struct {
#if 0//(!_AUDIO_TONE_CTRL_)
/* Pitch and Speed Control module */
unsigned char PSC_Pidx;
unsigned char PSC_Sidx;
unsigned char PSC_Chidx;
unsigned char PSC_Fsidx;
unsigned long PSC_FrameNo;
unsigned long PSC_Samples;
#endif /* __PSCON */
/* Mic Echo module */
unsigned char ME_Onoff;
unsigned char ME_Init;
unsigned char ME_delay;
unsigned char ME_decay;
#if 1//2005.06.04
unsigned char ME_gain;
unsigned char ME_dummy; //if 0: mixed ; if 1: not mixed
#endif
unsigned int ME_samples; /* ADC 9.45kHz input samples */
/* ADC total buffer size (ME_samples * # of buffer * 16bit * ch) */
/* Upsampler and mixer module */
unsigned int MX_MicBufSize; /* 189 samples x 2 ch x 8 bits x 10 chunk = 3,780 bytes (0xEC4) */
unsigned int MX_PSConBufSize; /* (EX MP3) 576 x 2 x 2 x 2 = 4,608 bytes (0x1200) */
unsigned int Mic_Volume; /* 0:small, 40:max */
} Karaoke_Param_t;
CODEC_EXT PostCodecShared_t KARA_Shared;
CODEC_EXT Karaoke_Param_t KARA_Param;
#define MIC_BUF_LENGTH (110*4*10)
#define MIC_NOISE_RANGE 0x900//0x800 //Lumin20051025/* noise range before mixing(16bit) */
#define MIC_NOISE_SAMPLE 5000//10000 /* noise count after upsample *///Lumin20051025//Lumin20051110
//CONST ULONG gADM_ReqOfAdc = 0x4;
extern void Karaoke( PostCodecShared_t * );
#endif
extern void OutputChannelSelect(PostCodecShared_t *codec_shared, USHORT sel);
CODEC_EXT PostCodecShared_t ChSel_Shared;
#endif /* _AUDIO_POST_PROCESS_ */
#if _SW_VOLUME_
typedef struct {
unsigned long S0_Base;
unsigned long S1_Base;
} aud_buf_t;
#endif
/*
CODEC_EXT UINT sb0_off_h;
CODEC_EXT UINT sb0_off_l;
CODEC_EXT ULONG s1_base;
*/
#endif //_CODEC_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -