1 /* 2 * SpanDSP - a series of DSP components for telephony 3 * 4 * private/oki_adpcm.h - Conversion routines between linear 16 bit PCM data 5 * and OKI (Dialogic) ADPCM format. 6 * 7 * Written by Steve Underwood <steveu@coppice.org> 8 * 9 * Copyright (C) 2001 Steve Underwood 10 * 11 * All rights reserved. 12 * 13 * This program is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU Lesser General Public License version 2.1, 15 * as published by the Free Software Foundation. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU Lesser General Public License for more details. 21 * 22 * You should have received a copy of the GNU Lesser General Public 23 * License along with this program; if not, write to the Free Software 24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 */ 26 27 /*! \file */ 28 29 #if !defined(_SPANDSP_PRIVATE_OKI_ADPCM_H_) 30 #define _SPANDSP_PRIVATE_OKI_ADPCM_H_ 31 32 /*! 33 Oki (Dialogic) ADPCM conversion state descriptor. This defines the state of 34 a single working instance of the Oki ADPCM converter. This is used for 35 either linear to ADPCM or ADPCM to linear conversion. 36 */ 37 struct oki_adpcm_state_s 38 { 39 /*! \brief The bit rate - 24000 or 32000. */ 40 int bit_rate; 41 /*! \brief The last state of the ADPCM algorithm. */ 42 int16_t last; 43 /*! \brief Current index into the step size table. */ 44 int16_t step_index; 45 /*! \brief The compressed data byte in progress. */ 46 uint8_t oki_byte; 47 /*! \brief The signal history for the sample rate converter. */ 48 int16_t history[32]; 49 /*! \brief Pointer into the history buffer. */ 50 int ptr; 51 /*! \brief Odd/even sample counter. */ 52 int mark; 53 /*! \brief Phase accumulator for the sample rate converter. */ 54 int phase; 55 }; 56 57 #endif 58 /*- End of file ------------------------------------------------------------*/ 59