1 /*---------------------------------------------------------------------------*
2   Project:  Revolution DSP ADPCM win32 DLL
3   File:     dsptool.h
4 
5   Copyright (C)2002-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: dsptool.h,v $
14   Revision 1.1  02/08/2006 02:52:42  aka
15   Imported from Dolphin Tree.
16 
17 
18     8     03/07/01 3:05p Akagi
19     Copied build/libraries/dsptool/src/dspadpcm.h.
20 
21     7     03/07/01 2:59p Akagi
22     Moved from build/tools/THPConv/include.
23 
24     6     03/07/01 9:19a Akagi
25     Moved from securebuild/tools.
26 
27     5     02/05/08 2:30p Akagi
28     modified [-trk] option By Tsuji (IRD)
29 
30     1     02/01/16 4:55p Akagi
31     Initial revision made by Tsuji-san (IRD).
32 
33   $NoKeywords: $
34 
35  *---------------------------------------------------------------------------*/
36 
37 #ifndef __DSPTOOL_H__
38 #define __DSPTOOL_H__
39 
40 
41 #ifdef MAKE_A_DLL
42 #define LINKDLL __declspec(dllexport)
43 #else
44 #define LINKDLL __declspec(dllimport)
45 #endif
46 
47 
48 /*---------------------------------------------------------------------------*
49     ADPCM info passed to the caller
50  *---------------------------------------------------------------------------*/
51 typedef struct
52 {
53     // start context
54     s16 coef[16];
55     u16 gain;
56     u16 pred_scale;
57     s16 yn1;
58     s16 yn2;
59 
60     // loop context
61     u16 loop_pred_scale;
62     s16 loop_yn1;
63     s16 loop_yn2;
64 
65 } ADPCMINFO;
66 
67 
68 /*---------------------------------------------------------------------------*
69     exported functions
70  *---------------------------------------------------------------------------*/
71 LINKDLL u32 getBytesForAdpcmBuffer      (u32 samples);
72 LINKDLL u32 getBytesForAdpcmSamples     (u32 samples);
73 LINKDLL u32 getBytesForPcmBuffer        (u32 samples);
74 LINKDLL u32 getBytesForPcmSamples       (u32 samples);
75 LINKDLL u32 getNibbleAddress            (u32 samples);
76 LINKDLL u32 getNibblesForNSamples       (u32 samples);
77 LINKDLL u32 getSampleForAdpcmNibble     (u32 nibble);
78 LINKDLL u32 getBytesForAdpcmInfo        (void);
79 
80 LINKDLL void encode
81 (
82     s16         *src,   // location of source samples (16bit PCM signed little endian)
83     u8          *dst,   // location of destination buffer
84     ADPCMINFO   *cxt,   // location of adpcm info
85     u32         samples // number of samples to encode
86 );
87 
88 LINKDLL void decode
89 (
90     u8          *src,   // location of encoded source samples
91     s16         *dst,   // location of destination buffer (16 bits / sample)
92     ADPCMINFO   *cxt,   // location of adpcm info
93     u32         samples // number of samples to decode
94 );
95 
96 LINKDLL void getLoopContext
97 (
98     u8          *src,      // location of ADPCM buffer in RAM
99     ADPCMINFO   *cxt,      // location of adpcminfo
100     u32         samples    // samples to desired context
101 );
102 
103 
104 #endif // __DSPTOOL_H__
105