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 * $Id: oki_adpcm.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ 00027 */ 00028 00029 /*! \file */ 00030 00031 #if !defined(_SPANDSP_PRIVATE_OKI_ADPCM_H_) 00032 #define _SPANDSP_PRIVATE_OKI_ADPCM_H_ 00033 00034 /*! 00035 Oki (Dialogic) ADPCM conversion state descriptor. This defines the state of 00036 a single working instance of the Oki ADPCM converter. This is used for 00037 either linear to ADPCM or ADPCM to linear conversion. 00038 */ 00039 struct oki_adpcm_state_s 00040 { 00041 /*! \brief The bit rate - 24000 or 32000. */ 00042 int bit_rate; 00043 /*! \brief The last state of the ADPCM algorithm. */ 00044 int16_t last; 00045 /*! \brief Current index into the step size table. */ 00046 int16_t step_index; 00047 /*! \brief The compressed data byte in progress. */ 00048 uint8_t oki_byte; 00049 /*! \brief The signal history for the sample rate converter. */ 00050 int16_t history[32]; 00051 /*! \brief Pointer into the history buffer. */ 00052 int ptr; 00053 /*! \brief Odd/even sample counter. */ 00054 int mark; 00055 /*! \brief Phase accumulator for the sample rate converter. */ 00056 int phase; 00057 }; 00058 00059 #endif 00060 /*- End of file ------------------------------------------------------------*/