00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/ima_adpcm.c - Conversion routines between linear 16 bit PCM data 00005 * and IMA/DVI/Intel ADPCM format. 00006 * 00007 * Written by Steve Underwood <steveu@coppice.org> 00008 * 00009 * Copyright (C) 2004 Steve Underwood 00010 * 00011 * All rights reserved. 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU Lesser General Public License version 2.1, 00015 * as published by the Free Software Foundation. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU Lesser General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00025 * 00026 * Based on a bit from here, a bit from there, eye of toad, 00027 * ear of bat, etc - plus, of course, my own 2 cents. 00028 * 00029 * $Id: ima_adpcm.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ 00030 */ 00031 00032 #if !defined(_SPANDSP_PRIVATE_IMA_ADPCM_H_) 00033 #define _SPANDSP_PRIVATE_IMA_ADPCM_H_ 00034 00035 /*! 00036 IMA (DVI/Intel) ADPCM conversion state descriptor. This defines the state of 00037 a single working instance of the IMA ADPCM converter. This is used for 00038 either linear to ADPCM or ADPCM to linear conversion. 00039 */ 00040 struct ima_adpcm_state_s 00041 { 00042 int variant; 00043 /*! \brief The size of a chunk, in samples. */ 00044 int chunk_size; 00045 /*! \brief The last state of the ADPCM algorithm. */ 00046 int last; 00047 /*! \brief Current index into the step size table. */ 00048 int step_index; 00049 /*! \brief The current IMA code byte in progress. */ 00050 uint16_t ima_byte; 00051 int bits; 00052 }; 00053 00054 #endif 00055 /*- End of file ------------------------------------------------------------*/