|
Packit Service |
17f94a |
/*
|
|
Packit Service |
17f94a |
** Copyright (C) 2007-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
|
Packit Service |
17f94a |
** Copyright (c) 2007 <robs@users.sourceforge.net>
|
|
Packit Service |
17f94a |
**
|
|
Packit Service |
17f94a |
** This library is free software; you can redistribute it and/or modify it
|
|
Packit Service |
17f94a |
** under the terms of the GNU Lesser General Public License as published by
|
|
Packit Service |
17f94a |
** the Free Software Foundation; either version 2 of the License, or (at
|
|
Packit Service |
17f94a |
** your option) any later version.
|
|
Packit Service |
17f94a |
**
|
|
Packit Service |
17f94a |
** This library is distributed in the hope that it will be useful, but
|
|
Packit Service |
17f94a |
** WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
17f94a |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
|
|
Packit Service |
17f94a |
** General Public License for more details.
|
|
Packit Service |
17f94a |
**
|
|
Packit Service |
17f94a |
** You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
17f94a |
** along with this library. If not, write to the Free Software Foundation,
|
|
Packit Service |
17f94a |
** Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301, USA.
|
|
Packit Service |
17f94a |
*/
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
/* ADPCM: IMA, OKI <==> 16-bit PCM. */
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
#define IMA_OKI_ADPCM_CODE_LEN 256
|
|
Packit Service |
17f94a |
#define IMA_OKI_ADPCM_PCM_LEN (IMA_OKI_ADPCM_CODE_LEN *2)
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
typedef struct
|
|
Packit Service |
17f94a |
{
|
|
Packit Service |
17f94a |
/* private: */
|
|
Packit Service |
17f94a |
int mask ;
|
|
Packit Service |
17f94a |
int last_output ;
|
|
Packit Service |
17f94a |
int step_index ;
|
|
Packit Service |
17f94a |
int max_step_index ;
|
|
Packit Service |
17f94a |
int const * steps ;
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
/* public: */
|
|
Packit Service |
17f94a |
int errors ;
|
|
Packit Service |
17f94a |
int code_count, pcm_count ;
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
unsigned char codes [IMA_OKI_ADPCM_CODE_LEN] ;
|
|
Packit Service |
17f94a |
short pcm [IMA_OKI_ADPCM_PCM_LEN] ;
|
|
Packit Service |
17f94a |
} IMA_OKI_ADPCM ;
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
typedef enum
|
|
Packit Service |
17f94a |
{ IMA_OKI_ADPCM_TYPE_IMA,
|
|
Packit Service |
17f94a |
IMA_OKI_ADPCM_TYPE_OKI
|
|
Packit Service |
17f94a |
} IMA_OKI_ADPCM_TYPE ;
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
void ima_oki_adpcm_init (IMA_OKI_ADPCM * state, IMA_OKI_ADPCM_TYPE type) ;
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
int adpcm_decode (IMA_OKI_ADPCM * state, int /* 0..15 */ code) ;
|
|
Packit Service |
17f94a |
int adpcm_encode (IMA_OKI_ADPCM * state, int /* -32768..32767 */ sample) ;
|
|
Packit Service |
17f94a |
|
|
Packit Service |
17f94a |
void ima_oki_adpcm_decode_block (IMA_OKI_ADPCM * state) ;
|
|
Packit Service |
17f94a |
void ima_oki_adpcm_encode_block (IMA_OKI_ADPCM * state) ;
|