⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 phi_axit.c

📁 MPEG2/MPEG4编解码参考程序(实现了MPEG4的部分功能)
💻 C
📖 第 1 页 / 共 2 页
字号:
/*====================================================================*//*         MPEG-4 Audio (ISO/IEC 14496-3) Copyright Header            *//*====================================================================*//*This software module was originally developed by Rakesh Taori and AndyGerrits (Philips Research Laboratories, Eindhoven, The Netherlands) inthe course of development of the MPEG-4 Audio (ISO/IEC 14496-3). Thissoftware module is an implementation of a part of one or more MPEG-4Audio (ISO/IEC 14496-3) tools as specified by the MPEG-4 Audio(ISO/IEC 14496-3). ISO/IEC gives users of the MPEG-4 Audio (ISO/IEC14496-3) free license to this software module or modifications thereoffor use in hardware or software products claiming conformance to theMPEG-4 Audio (ISO/IEC 14496-3). Those intending to use this softwaremodule in hardware or software products are advised that its use mayinfringe existing patents. The original developer of this softwaremodule and his/her company, the subsequent editors and theircompanies, and ISO/IEC have no liability for use of this softwaremodule or modifications thereof in an implementation. Copyright is notreleased for non MPEG-4 Audio (ISO/IEC 14496-3) conforming products.CN1 retains full right to use the code for his/her own purpose, assignor donate the code to a third party and to inhibit third parties fromusing the code for non MPEG-4 Audio (ISO/IEC 14496-3) conformingproducts.  This copyright notice must be included in all copies orderivative works. Copyright 1996.*//*====================================================================*//*======================================================================*//*                                                                      *//*      SOURCE_FILE:    PHI_AXIT.C                                      *//*      PACKAGE:        WDBxx                                           *//*      COMPONENT:      Excitation Analysis Modules                     *//*                                                                      *//*======================================================================*//*======================================================================*//*      I N C L U D E S                                                 *//*======================================================================*/#include <stdio.h>#include <stdlib.h>#include <math.h>#include <malloc.h> #include <float.h>#include <assert.h>  #include "buffersHandle.h"       /* handler, defines, enums */#include "lpc_common.h"               /* Prototype definitions          */      #include "phi_cons.h"                 /* Prototype definitions          */      #include "phi_apre.h"                 /* Prototype definitions          */      #include "phi_xits.h"                 /* Prototype definitions          */      #include "phi_axit.h"                 /* Prototype definitions          */      /*======================================================================*//*       L O C A L    D A T A   D E C L A R A T I O N                   *//*======================================================================*/static float *PHI_s_state;     /* Synthesis filter states during search */static float *PHI_Wden_states; /* Synthesis filter states for decoder   */static float *PHI_cba_codebook;/* Adaptive Codebook                     */static float PHI_afp = (float)0.0;/* First-order LPC parameter(previous)*/static long  PHI_sbfrm_ctr = 0;/* Local counter: current subframe       */ static long  PHI_D;static long  PHI_Np;static long  PHI_Nz;static long  PHI_Nf;/*======================================================================*//* Function Definition: PHI_init_excitation_analysis                    *//*======================================================================*/void PHI_init_excitation_analysis(const long max_lag,   /* In:Maximum permitted lag in the adaptive cbk */ const long lpc_order, /* In:The LPC order                             */const long sbfrm_size,/* In:Size of subframe in samples               */const long RPE_configuration /* In:Confguration                        */){    int i;     /* -----------------------------------------------------------------*/    /* Allocate memory for the local-decoder synthesis filter-states    */    /* -----------------------------------------------------------------*/    if(( PHI_s_state = (float *)malloc((unsigned int)lpc_order * sizeof(float))) == NULL )    {        printf("MALLOC FAILURE in init_abs_excitation_analysis \n");        exit(1);    }        /* -----------------------------------------------------------------*/    /* Allocate memory for the encoder perceptual wighting filter-states*/    /* -----------------------------------------------------------------*/    if(( PHI_Wden_states = (float *)malloc((unsigned int)lpc_order * sizeof(float))) == NULL )    {        printf("MALLOC FAILURE in init_abs_excitation_analysis \n");        exit(1);    }        /* -----------------------------------------------------------------*/    /* Allocate memory for the adaptive Codebook                        */    /* -----------------------------------------------------------------*/    if(( PHI_cba_codebook = (float *)malloc((unsigned int)max_lag * sizeof(float))) == NULL )    {        printf("MALLOC FAILURE in init_abs_excitation_analysis \n");        exit(1);    }        /* -----------------------------------------------------------------*/    /* Initialise the adaptive codebook                                 */    /* -----------------------------------------------------------------*/    for (i = 0; i < (int)max_lag; i ++)    {        PHI_cba_codebook[i] = (float)0.0;    }    /* -----------------------------------------------------------------*/    /* Initialise the filter states                                     */    /* -----------------------------------------------------------------*/    for (i = 0; i < (int)lpc_order; i ++)    {        PHI_s_state[i]  = PHI_Wden_states[i] = (float)0.0;    }        /* -----------------------------------------------------------------*/    /* Set the excitation Parameters                                    */    /* -----------------------------------------------------------------*/        PHI_D = 1;    if ((RPE_configuration == 0) || (RPE_configuration == 1))    {         PHI_D = 8;    }    if (RPE_configuration == 2)    {         PHI_D = 5;    }    if (RPE_configuration == 3)    {         PHI_D = 4;    }        PHI_Np = sbfrm_size/PHI_D;    PHI_Nz = PHI_Np - 4;    PHI_Nf = (long)1 << (PHI_Np - PHI_Nz);    if (PHI_Nf != 16)    {         fprintf(stderr, "ERROR:Incorrect parameters in excitation analysis \n");         exit(1);    }}/*======================================================================*//* Function Definition: celp_excitation_analysis                        *//*======================================================================*/void celp_excitation_analysis(                                  /* -----------------------------------*/                                  /* INPUT PARAMETERS                   */                                  /* -----------------------------------*/float PP_InputSignal[],           /* Preprocessed Input signal          */float lpc_residual[],             /* Inverse Filtered Signal            */float int_Qlpc_coefficients[],    /* Interpolated LPC Coeffs            */long  lpc_order,                  /* Order of LPC                       */        float Wnum_coeff[],               /* Weighting Filter: Numerator        */float Wden_coeff[],               /* Weighting Filter: Denominator      */float first_order_lpc_par,        /* apar corresponding to 1st-order fit*/long  lag_candidates[],           /* Array of Lag candidates            */long  n_lag_candidates,           /* Number of lag candidates           */long  frame_size,                 /* Number of samples in the frame     */long  sbfrm_size,                 /* Number of samples in the subframe  */long  n_subframes,                /* Number of subframes                */long  signal_mode,                /* Configuration Input                */long  frame_bit_allocation[],     /* Configuration Input                */                                  /* -----------------------------------*/                                  /* OUTPUT PARAMETERS                  */                                  /* -----------------------------------*/long  shape_indices[],            /* Adaptive and Fixed codebook lags   */long  gain_indices[],             /* Adaptive and Fixed codebook gains  */long  num_shape_cbks,             /* Number of shape codebooks          */long  num_gain_cbks,              /* Number of gain codebooks           */long  *rms_index,                 /* RMS Value ????                     */float decoded_excitation[]        /* Synthesised Signal                 */){    /*==================================================================*/    /*  Volatile Variables for this subroutine                          */    /*==================================================================*/    long  *amp;         /* Amplitude Array for the RPE sequence         */    long  *pos;         /* Position of fixed amplitude in RPE codebook  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -