00001 /* 00002 * Copyright (c) CMU 1993 Computer Science, Speech Group 00003 * Chengxiang Lu and Alex Hauptmann 00004 * Copyright (c) 2005 Steve Underwood <steveu at coppice.org> 00005 * Copyright (c) 2009 Kenan Gillet 00006 * Copyright (c) 2010 Martin Storsjo 00007 * 00008 * This file is part of Libav. 00009 * 00010 * Libav is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * Libav is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with Libav; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00023 */ 00024 00025 #ifndef AVCODEC_G722_H 00026 #define AVCODEC_G722_H 00027 00028 #include <stdint.h> 00029 #include "avcodec.h" 00030 00031 #define PREV_SAMPLES_BUF_SIZE 1024 00032 00033 typedef struct { 00034 const AVClass *class; 00035 AVFrame frame; 00036 int bits_per_codeword; 00037 int16_t prev_samples[PREV_SAMPLES_BUF_SIZE]; 00038 int prev_samples_pos; 00039 00043 struct G722Band { 00044 int16_t s_predictor; 00045 int32_t s_zero; 00046 int8_t part_reconst_mem[2]; 00047 int16_t prev_qtzd_reconst; 00048 int16_t pole_mem[2]; 00049 int32_t diff_mem[6]; 00050 int16_t zero_mem[6]; 00051 int16_t log_factor; 00052 int16_t scale_factor; 00053 } band[2]; 00054 00055 struct TrellisNode { 00056 struct G722Band state; 00057 uint32_t ssd; 00058 int path; 00059 } *node_buf[2], **nodep_buf[2]; 00060 00061 struct TrellisPath { 00062 int value; 00063 int prev; 00064 } *paths[2]; 00065 } G722Context; 00066 00067 extern const int16_t ff_g722_high_inv_quant[4]; 00068 extern const int16_t ff_g722_low_inv_quant4[16]; 00069 extern const int16_t ff_g722_low_inv_quant6[64]; 00070 00071 void ff_g722_update_low_predictor(struct G722Band *band, const int ilow); 00072 00073 void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh, 00074 const int ihigh); 00075 00076 void ff_g722_apply_qmf(const int16_t *prev_samples, int *xout1, int *xout2); 00077 00078 #endif /* AVCODEC_G722_H */