00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/oki_adpcm.h - Conversion routines between linear 16 bit PCM data 00005 * and OKI (Dialogic) ADPCM format. 00006 * 00007 * Written by Steve Underwood <steveu@coppice.org> 00008 * 00009 * Copyright (C) 2001 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 00027 /*! \file */ 00028 00029 #if !defined(_SPANDSP_PRIVATE_OKI_ADPCM_H_) 00030 #define _SPANDSP_PRIVATE_OKI_ADPCM_H_ 00031 00032 /*! 00033 Oki (Dialogic) ADPCM conversion state descriptor. This defines the state of 00034 a single working instance of the Oki ADPCM converter. This is used for 00035 either linear to ADPCM or ADPCM to linear conversion. 00036 */ 00037 struct oki_adpcm_state_s 00038 { 00039 /*! \brief The bit rate - 24000 or 32000. */ 00040 int bit_rate; 00041 /*! \brief The last state of the ADPCM algorithm. */ 00042 int16_t last; 00043 /*! \brief Current index into the step size table. */ 00044 int16_t step_index; 00045 /*! \brief The compressed data byte in progress. */ 00046 uint8_t oki_byte; 00047 /*! \brief The signal history for the sample rate converter. */ 00048 int16_t history[32]; 00049 /*! \brief Pointer into the history buffer. */ 00050 int ptr; 00051 /*! \brief Odd/even sample counter. */ 00052 int mark; 00053 /*! \brief Phase accumulator for the sample rate converter. */ 00054 int phase; 00055 }; 00056 00057 #endif 00058 /*- End of file ------------------------------------------------------------*/