yading@10: /* yading@10: * Copyright (c) CMU 1993 Computer Science, Speech Group yading@10: * Chengxiang Lu and Alex Hauptmann yading@10: * Copyright (c) 2005 Steve Underwood yading@10: * Copyright (c) 2009 Kenan Gillet yading@10: * Copyright (c) 2010 Martin Storsjo yading@10: * yading@10: * This file is part of Libav. yading@10: * yading@10: * Libav is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * Libav is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with Libav; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: #ifndef AVCODEC_G722_H yading@10: #define AVCODEC_G722_H yading@10: yading@10: #include yading@10: #include "avcodec.h" yading@10: yading@10: #define PREV_SAMPLES_BUF_SIZE 1024 yading@10: yading@10: typedef struct G722Context { yading@10: const AVClass *class; yading@10: int bits_per_codeword; yading@10: int16_t prev_samples[PREV_SAMPLES_BUF_SIZE]; ///< memory of past decoded samples yading@10: int prev_samples_pos; ///< the number of values in prev_samples yading@10: yading@10: /** yading@10: * The band[0] and band[1] correspond respectively to the lower band and higher band. yading@10: */ yading@10: struct G722Band { yading@10: int16_t s_predictor; ///< predictor output value yading@10: int32_t s_zero; ///< previous output signal from zero predictor yading@10: int8_t part_reconst_mem[2]; ///< signs of previous partially reconstructed signals yading@10: int16_t prev_qtzd_reconst; ///< previous quantized reconstructed signal (internal value, using low_inv_quant4) yading@10: int16_t pole_mem[2]; ///< second-order pole section coefficient buffer yading@10: int32_t diff_mem[6]; ///< quantizer difference signal memory yading@10: int16_t zero_mem[6]; ///< Seventh-order zero section coefficient buffer yading@10: int16_t log_factor; ///< delayed 2-logarithmic quantizer factor yading@10: int16_t scale_factor; ///< delayed quantizer scale factor yading@10: } band[2]; yading@10: yading@10: struct TrellisNode { yading@10: struct G722Band state; yading@10: uint32_t ssd; yading@10: int path; yading@10: } *node_buf[2], **nodep_buf[2]; yading@10: yading@10: struct TrellisPath { yading@10: int value; yading@10: int prev; yading@10: } *paths[2]; yading@10: } G722Context; yading@10: yading@10: extern const int16_t ff_g722_high_inv_quant[4]; yading@10: extern const int16_t ff_g722_low_inv_quant4[16]; yading@10: extern const int16_t ff_g722_low_inv_quant6[64]; yading@10: yading@10: void ff_g722_update_low_predictor(struct G722Band *band, const int ilow); yading@10: yading@10: void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh, yading@10: const int ihigh); yading@10: yading@10: void ff_g722_apply_qmf(const int16_t *prev_samples, int *xout1, int *xout2); yading@10: yading@10: #endif /* AVCODEC_G722_H */