diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-24 01:25:21 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-03-18 12:00:39 +0100 |
commit | b5716df4cb2837bbbc42195cf1aefcf03e21d6a6 (patch) | |
tree | 130cd712e2e00893b6df9959a375a8d9523a1aca /lib/rbcodec/dsp/dsp.h | |
parent | 24bd9d5393dbe39a5c6194877bc00ede669b1d5d (diff) | |
download | rockbox-b5716df4cb2837bbbc42195cf1aefcf03e21d6a6.tar.gz rockbox-b5716df4cb2837bbbc42195cf1aefcf03e21d6a6.zip |
Build librbcodec with DSP and metadata.
All associated files are moved to /lib/rbcodec.
Change-Id: I572ddd2b8a996aae1e98c081d06b1ed356dce222
Diffstat (limited to 'lib/rbcodec/dsp/dsp.h')
-rw-r--r-- | lib/rbcodec/dsp/dsp.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/lib/rbcodec/dsp/dsp.h b/lib/rbcodec/dsp/dsp.h new file mode 100644 index 0000000000..2a00f649f8 --- /dev/null +++ b/lib/rbcodec/dsp/dsp.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 Miika Pekkarinen | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef _DSP_H | ||
23 | #define _DSP_H | ||
24 | |||
25 | #include <stdlib.h> | ||
26 | #include <stdbool.h> | ||
27 | |||
28 | #define NATIVE_FREQUENCY 44100 | ||
29 | |||
30 | enum | ||
31 | { | ||
32 | STEREO_INTERLEAVED = 0, | ||
33 | STEREO_NONINTERLEAVED, | ||
34 | STEREO_MONO, | ||
35 | STEREO_NUM_MODES, | ||
36 | }; | ||
37 | |||
38 | enum | ||
39 | { | ||
40 | CODEC_IDX_AUDIO = 0, | ||
41 | CODEC_IDX_VOICE, | ||
42 | }; | ||
43 | |||
44 | enum | ||
45 | { | ||
46 | DSP_MYDSP = 1, | ||
47 | DSP_SET_FREQUENCY, | ||
48 | DSP_SWITCH_FREQUENCY, | ||
49 | DSP_SET_SAMPLE_DEPTH, | ||
50 | DSP_SET_STEREO_MODE, | ||
51 | DSP_RESET, | ||
52 | DSP_FLUSH, | ||
53 | DSP_SET_TRACK_GAIN, | ||
54 | DSP_SET_ALBUM_GAIN, | ||
55 | DSP_SET_TRACK_PEAK, | ||
56 | DSP_SET_ALBUM_PEAK, | ||
57 | DSP_CROSSFEED | ||
58 | }; | ||
59 | |||
60 | |||
61 | /**************************************************************************** | ||
62 | * NOTE: Any assembly routines that use these structures must be updated | ||
63 | * if current data members are moved or changed. | ||
64 | */ | ||
65 | struct resample_data | ||
66 | { | ||
67 | uint32_t delta; /* 00h */ | ||
68 | uint32_t phase; /* 04h */ | ||
69 | int32_t last_sample[2]; /* 08h */ | ||
70 | /* 10h */ | ||
71 | }; | ||
72 | |||
73 | /* This is for passing needed data to external dsp routines. If another | ||
74 | * dsp parameter needs to be passed, add to the end of the structure | ||
75 | * and remove from dsp_config. | ||
76 | * If another function type becomes assembly/external and requires dsp | ||
77 | * config info, add a pointer paramter of type "struct dsp_data *". | ||
78 | * If removing something from other than the end, reserve the spot or | ||
79 | * else update every implementation for every target. | ||
80 | * Be sure to add the offset of the new member for easy viewing as well. :) | ||
81 | * It is the first member of dsp_config and all members can be accessesed | ||
82 | * through the main aggregate but this is intended to make a safe haven | ||
83 | * for these items whereas the c part can be rearranged at will. dsp_data | ||
84 | * could even moved within dsp_config without disurbing the order. | ||
85 | */ | ||
86 | struct dsp_data | ||
87 | { | ||
88 | int output_scale; /* 00h */ | ||
89 | int num_channels; /* 04h */ | ||
90 | struct resample_data resample_data; /* 08h */ | ||
91 | int32_t clip_min; /* 18h */ | ||
92 | int32_t clip_max; /* 1ch */ | ||
93 | int32_t gain; /* 20h - Note that this is in S8.23 format. */ | ||
94 | int frac_bits; /* 24h */ | ||
95 | /* 28h */ | ||
96 | }; | ||
97 | |||
98 | struct dsp_config; | ||
99 | |||
100 | int dsp_process(struct dsp_config *dsp, char *dest, | ||
101 | const char *src[], int count); | ||
102 | int dsp_input_count(struct dsp_config *dsp, int count); | ||
103 | int dsp_output_count(struct dsp_config *dsp, int count); | ||
104 | intptr_t dsp_configure(struct dsp_config *dsp, int setting, | ||
105 | intptr_t value); | ||
106 | int get_replaygain_mode(bool have_track_gain, bool have_album_gain); | ||
107 | void dsp_set_replaygain(void); | ||
108 | void dsp_set_crossfeed(bool enable); | ||
109 | void dsp_set_crossfeed_direct_gain(int gain); | ||
110 | void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain, | ||
111 | long cutoff); | ||
112 | void dsp_set_eq(bool enable); | ||
113 | void dsp_set_eq_precut(int precut); | ||
114 | void dsp_set_eq_coefs(int band); | ||
115 | void dsp_dither_enable(bool enable); | ||
116 | void dsp_timestretch_enable(bool enable); | ||
117 | bool dsp_timestretch_available(void); | ||
118 | void sound_set_pitch(int32_t r); | ||
119 | int32_t sound_get_pitch(void); | ||
120 | void dsp_set_timestretch(int32_t percent); | ||
121 | int32_t dsp_get_timestretch(void); | ||
122 | int dsp_callback(int msg, intptr_t param); | ||
123 | void dsp_set_compressor(void); | ||
124 | |||
125 | #endif | ||