00001 /* 00002 * MPEG-4 Parametric Stereo definitions and declarations 00003 * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> 00004 * 00005 * This file is part of FFmpeg. 00006 * 00007 * FFmpeg is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * FFmpeg is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with FFmpeg; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef AVCODEC_PS_H 00023 #define AVCODEC_PS_H 00024 00025 #include <stdint.h> 00026 00027 #include "avcodec.h" 00028 #include "get_bits.h" 00029 00030 #define PS_MAX_NUM_ENV 5 00031 #define PS_MAX_NR_IIDICC 34 00032 #define PS_MAX_NR_IPDOPD 17 00033 #define PS_MAX_SSB 91 00034 #define PS_MAX_AP_BANDS 50 00035 #define PS_QMF_TIME_SLOTS 32 00036 #define PS_MAX_DELAY 14 00037 #define PS_AP_LINKS 3 00038 #define PS_MAX_AP_DELAY 5 00039 00040 typedef struct { 00041 int start; 00042 int enable_iid; 00043 int iid_quant; 00044 int nr_iid_par; 00045 int nr_ipdopd_par; 00046 int enable_icc; 00047 int icc_mode; 00048 int nr_icc_par; 00049 int enable_ext; 00050 int frame_class; 00051 int num_env_old; 00052 int num_env; 00053 int enable_ipdopd; 00054 int border_position[PS_MAX_NUM_ENV+1]; 00055 int8_t iid_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; 00056 int8_t icc_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; 00057 /* ipd/opd is iid/icc sized so that the same functions can handle both */ 00058 int8_t ipd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; 00059 int8_t opd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; 00060 int is34bands; 00061 int is34bands_old; 00062 00063 float in_buf[5][44][2]; 00064 float delay[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2]; 00065 float ap_delay[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2]; 00066 float peak_decay_nrg[34]; 00067 float power_smooth[34]; 00068 float peak_decay_diff_smooth[34]; 00069 float H11[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; 00070 float H12[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; 00071 float H21[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; 00072 float H22[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; 00073 int8_t opd_hist[PS_MAX_NR_IIDICC]; 00074 int8_t ipd_hist[PS_MAX_NR_IIDICC]; 00075 } PSContext; 00076 00077 void ff_ps_init(void); 00078 void ff_ps_ctx_init(PSContext *ps); 00079 int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int bits_left); 00080 int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top); 00081 00082 #endif /* AVCODEC_PS_H */