annotate src/libSAD/dither.h @ 4234:b293ce14a01a

partially works...
author Eugene Zagidullin <e.asphyx@gmail.com>
date Thu, 31 Jan 2008 12:04:13 +0300
parents 74c6f3d3cf1d
children 9a55e8237988
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4233
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
1 /* Scale & Dither library (libSAD)
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
2 * High-precision bit depth converter with ReplayGain support
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
3 *
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
4 * Copyright (c) 2007-2008 Eugene Zagidullin (e.asphyx@gmail.com)
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
5 *
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
6 * This program is free software; you can redistribute it and/or modify
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
7 * it under the terms of the GNU General Public License as published by
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
9 * (at your option) any later version.
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
10 *
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
11 * This program is distributed in the hope that it will be useful,
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
14 * GNU General Public License for more details.
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
15 * You should have received a copy of the GNU General Public License
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
16 * along with this program; if not, write to the Free Software
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
18 */
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
19
4232
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
20 #ifndef DITHER_H
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
21 #define DITHER_H
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
22
4234
b293ce14a01a partially works...
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4233
diff changeset
23 #include "common.h"
4232
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
24
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
25 #define SAD_ERROR_INCORRECT_INPUT_SAMPLEFORMAT -2
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
26 #define SAD_ERROR_INCORRECT_OUTPUT_SAMPLEFORMAT -3
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
27 #define SAD_ERROR_CORRUPTED_PRIVATE_DATA -4
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
28
4233
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
29 typedef int32_t (*SAD_get_sample_proc) (void *buf, int nch, int ch, int i);
74c6f3d3cf1d it buids successfully :)
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
30 typedef void (*SAD_put_sample_proc) (void *buf, int32_t sample, int nch, int ch, int i);
4232
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
31
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
32 typedef struct {
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
33 SAD_get_sample_proc get_sample;
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
34 SAD_put_sample_proc put_sample;
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
35 } SAD_buffer_ops;
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
36
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
37 /* private data */
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
38 typedef struct {} SAD_dither_t;
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
39
4234
b293ce14a01a partially works...
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4233
diff changeset
40 void SAD_dither_init_rand(uint32_t seed);
b293ce14a01a partially works...
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4233
diff changeset
41
4232
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
42 SAD_dither_t* SAD_dither_init(SAD_buffer_format *inbuf_format, SAD_buffer_format *outbuf_format, int *error);
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
43 int SAD_dither_free(SAD_dither_t* state);
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
44 int SAD_dither_process_buffer (SAD_dither_t *state, void *inbuf, void *outbuf, int frames);
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
45 int SAD_dither_apply_replaygain (SAD_dither_t *state, SAD_replaygain_info *rg_info, SAD_replaygain_mode *mode);
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
46 int SAD_dither_set_scale (SAD_dither_t *state, float scale);
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
47 int SAD_dither_set_dither (SAD_dither_t *state, int dither);
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
48
704607c1f858 1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
49 #endif