~ubuntu-branches/ubuntu/gutsy/audacity/gutsy-backports

« back to all changes in this revision

Viewing changes to lib-src/libsndfile/src/G72x/g72x.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-11-21 02:38:07 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20061121023807-flsqb0p8gb5a942v
Tags: 1.2.6-0ubuntu1
* New upstream release.
* debian/{control,rules}:
  - Use system portaudio 19 to gain native ALSA and JACK support,
  - Use system soundtouch and samplerate,
  - Suggest the LAME libs (Closes Ubuntu: #51063),
  - Disable resample support.
* {configure,lib-src/Makefile}.in: Build & link against system
  portaudio 19.
* Reinvoke autoconf to fix FTBFS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
** Copyright (C) 1999-2001 Erik de Castro Lopo <erikd@mega-nerd.com>
3
 
**  
 
2
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
 
3
**
4
4
** This program is free software; you can redistribute it and/or modify
5
5
** it under the terms of the GNU Lesser General Public License as published by
6
6
** the Free Software Foundation; either version 2.1 of the License, or
7
7
** (at your option) any later version.
8
 
** 
 
8
**
9
9
** This program is distributed in the hope that it will be useful,
10
10
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
12
** GNU Lesser General Public License for more details.
13
 
** 
 
13
**
14
14
** You should have received a copy of the GNU Lesser General Public License
15
 
** along with this program; if not, write to the Free Software 
 
15
** along with this program; if not, write to the Free Software
16
16
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
*/
18
18
 
19
19
/*
20
20
** This file is not the same as the original file from Sun Microsystems. Nearly
21
 
** all the original definitions and function prototypes that were in the file 
22
 
** of this name have been moved to private.h.
23
 
*/      
 
21
** all the original definitions and function prototypes that were in the file
 
22
** of this name have been moved to g72x_priv.h.
 
23
*/
24
24
 
25
25
#ifndef G72X_HEADER_FILE
26
26
#define G72X_HEADER_FILE
27
27
 
28
 
/* 
29
 
** Number of samples per block to process. 
 
28
/*
 
29
** Number of samples per block to process.
30
30
** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.
31
31
*/
32
 
#define G72x_BLOCK_SIZE         (3*5*8)  
 
32
#define G72x_BLOCK_SIZE         (3 * 5 * 8)
33
33
 
34
 
/*      
 
34
/*
35
35
**      Identifiers for the differing kinds of G72x ADPCM codecs.
36
36
**      The identifiers also define the number of encoded bits per sample.
37
37
*/
38
38
 
39
39
enum
40
40
{       G723_16_BITS_PER_SAMPLE = 2,
41
 
        G723_24_BITS_PER_SAMPLE = 3, 
42
 
        G723_40_BITS_PER_SAMPLE = 5, 
 
41
        G723_24_BITS_PER_SAMPLE = 3,
 
42
        G723_40_BITS_PER_SAMPLE = 5,
43
43
 
44
44
        G721_32_BITS_PER_SAMPLE = 4,
45
45
        G721_40_BITS_PER_SAMPLE = 5,
46
46
 
47
47
        G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
48
 
        G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE), 
49
 
        G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE), 
 
48
        G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE),
 
49
        G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
50
50
 
51
51
        G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
52
52
        G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE),
57
57
 
58
58
        G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
59
59
        G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8
60
 
} ; 
61
 
 
62
 
/* 
63
 
** This is the public structure for passing data between the caller and
64
 
** the G72x encoder and decoder. 
65
 
** The private array is used by the encoder and decoder for internal
66
 
** state information and should not be changed in any way by the caller.
67
 
** When decoding or encoding a stream, the same instance of this struct
68
 
** should be used for every call so that the decoder/encoder keeps the
69
 
** correct state data between calls.
70
 
*/
71
 
 
72
 
typedef struct 
73
 
{       /* Private data. Don't mess with it. */
74
 
        unsigned long   private [256 / sizeof (long)] ;  
75
 
 
76
 
        /* Public data. Read only. */
77
 
        int                             blocksize, max_bytes, samplesperblock, bytesperblock ;
78
 
 
79
 
        /* Public data. Read and write. */
80
 
        int                             blocks, blockcount, samplecount ;
81
 
        unsigned char   block   [G72x_BLOCK_SIZE] ;
82
 
        short                   samples [G72x_BLOCK_SIZE] ;
83
 
} G72x_DATA ;
 
60
} ;
 
61
 
 
62
/* Forward declaration of of g72x_state. */
 
63
 
 
64
struct g72x_state ;
84
65
 
85
66
/* External function definitions. */
86
67
 
87
 
int g72x_reader_init (G72x_DATA *data, int codec) ;
88
 
int g72x_writer_init (G72x_DATA *data, int codec) ;
 
68
struct g72x_state * g72x_reader_init (int codec, int *blocksize, int *samplesperblock) ;
 
69
struct g72x_state * g72x_writer_init (int codec, int *blocksize, int *samplesperblock) ;
89
70
/*
90
71
**      Initialize the ADPCM state table for the given codec.
91
72
**      Return 0 on success, 1 on fail.
92
73
*/
93
74
 
94
 
int g72x_decode_block (G72x_DATA *data) ;
 
75
int g72x_decode_block (struct g72x_state *pstate, const unsigned char *block, short *samples) ;
95
76
/*
96
 
**      The caller fills data->block with data->bytes bytes before calling the 
97
 
**      function. The value data->bytes must be an integer multiple of 
 
77
**      The caller fills data->block with data->bytes bytes before calling the
 
78
**      function. The value data->bytes must be an integer multiple of
98
79
**      data->blocksize and be <= data->max_bytes.
99
 
**      When it returns, the caller can read out data->samples samples. 
100
 
*/  
 
80
**      When it returns, the caller can read out data->samples samples.
 
81
*/
101
82
 
102
 
int g72x_encode_block (G72x_DATA *data) ;
103
 
/*      
 
83
int g72x_encode_block (struct g72x_state *pstate, short *samples, unsigned char *block) ;
 
84
/*
104
85
**      The caller fills state->samples some integer multiple data->samples_per_block
105
86
**      (up to G72x_BLOCK_SIZE) samples before calling the function.
106
 
**      When it returns, the caller can read out bytes encoded bytes. 
 
87
**      When it returns, the caller can read out bytes encoded bytes.
107
88
*/
108
89
 
109
90
#endif /* !G72X_HEADER_FILE */
 
91
 
110
92
/*
111
93
** Do not edit or modify anything in this comment block.
112
 
** The arch-tag line is a file identity tag for the GNU Arch 
 
94
** The arch-tag line is a file identity tag for the GNU Arch
113
95
** revision control system.
114
96
**
115
97
** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621