1 /*---------------------------------------------------------------------------* 2 Project: Revolution DSPADPCM dynamic link library 3 File: dspadpcm.h 4 5 Copyright (C)1998-2006 Nintendo All Rights Reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: dspadpcm.h,v $ 14 Revision 1.2 2006/02/09 06:13:46 aka 15 Changed copyright. 16 17 18 *---------------------------------------------------------------------------*/ 19 20 #ifndef __DSPTOOL_H__ 21 #define __DSPTOOL_H__ 22 23 /*---------------------------------------------------------------------------* 24 ADPCM info passed to the caller 25 *---------------------------------------------------------------------------*/ 26 typedef struct 27 { 28 // start context 29 s16 coef[16]; 30 u16 gain; 31 u16 pred_scale; 32 s16 yn1; 33 s16 yn2; 34 35 // loop context 36 u16 loop_pred_scale; 37 s16 loop_yn1; 38 s16 loop_yn2; 39 40 } ADPCMINFO; 41 42 43 /*---------------------------------------------------------------------------* 44 exported functions pointers 45 *---------------------------------------------------------------------------*/ 46 u32 getBytesForAdpcmBuffer (u32 samples); 47 u32 getBytesForAdpcmSamples (u32 samples); 48 u32 getBytesForPcmBuffer (u32 samples); 49 u32 getBytesForPcmSamples (u32 samples); 50 u32 getNibbleAddress (u32 samples); 51 u32 getNibblesForNSamples (u32 samples); 52 u32 getSampleForAdpcmNibble (u32 nibble); 53 u32 getBytesForAdpcmInfo (void); 54 55 void encode 56 ( 57 s16 *src, // location of source samples (16bit PCM signed little endian) 58 u8 *dst, // location of destination buffer 59 ADPCMINFO *cxt, // location of adpcm info 60 u32 samples // number of samples to encode 61 ); 62 63 void decode 64 ( 65 u8 *src, // location of encoded source samples 66 s16 *dst, // location of destination buffer (16 bits / sample) 67 ADPCMINFO *cxt, // location of adpcm info 68 u32 samples // number of samples to decode 69 ); 70 71 void getLoopContext 72 ( 73 u8 *src, // location of ADPCM buffer in RAM 74 ADPCMINFO *cxt, // location of adpcminfo 75 u32 samples // samples to desired context 76 ); 77 78 79 typedef u32 (*dspToolFnType1)(u32); 80 typedef u32 (*dspToolFnType2)(void); 81 typedef void (*dspToolFnType3)(s16*, u8*, ADPCMINFO*, u32); 82 typedef void (*dspToolFnType4)(u8*, s16*, ADPCMINFO*, u32); 83 typedef void (*dspToolFnType5)(u8*, ADPCMINFO*, u32); 84 #endif 85