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

📄 tvqaudecode.c

📁 C写的MPEG4音频源代码(G.723/G.729)
💻 C
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************//* This software module was originally developed by                          *//*   Naoki Iwakami (NTT)                                                     *//* and edited by                                                             *//*   Naoki Iwakami and Satoshi Miki (NTT) on 1996-05-01,                     *//*   Naoki Iwakami (NTT) on 1996-08-27,                                      *//*   Naoki Iwakami (NTT) on 1996-12-06,                                      *//*   Naoki Iwakami (NTT) on 1997-04-18,                                      *//*   Takehiro Moriya (NTT) on 1997-08-01,                                    *//*   Naoki Iwakami (NTT) on 1997-08-25                                       *//*   Takehiro Moriya (NTT) on 1998-06-25,                                    *//*   Takehiro Moriya (NTT) on 1999-02-25,                                    *//* in the course of development of the                                       *//* MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3.        *//* This software module is an implementation of a part of one or more        *//* MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio *//* standard. ISO/IEC  gives users of the MPEG-2 NBC/MPEG-4 Audio standards   *//* free license to this software module or modifications thereof for use in  *//* hardware or software products claiming conformance to the MPEG-2 NBC/     *//* MPEG-4 Audio  standards. Those intending to use this software module in   *//* hardware or software products are advised that this use may infringe      *//* existing patents. The original developer of this software module and      *//* his/her company, the subsequent editors and their companies, and ISO/IEC  *//* have no liability for use of this software module or modifications        *//* thereof in an implementation. Copyright is not released for non           *//* MPEG-2 NBC/MPEG-4 Audio conforming products. The original developer       *//* retains full right to use the code for his/her  own purpose, assign or    *//* donate the code to a third party and to inhibit third party from using    *//* the code for non MPEG-2 NBC/MPEG-4 Audio conforming products.             *//* This copyright notice must be included in all copies or derivative works. *//* Copyright (c)1996.                                                        *//*****************************************************************************/#include <memory.h>#include <math.h>#include <string.h>#include <assert.h>#include <stdio.h>#include "block.h"               /* handler, defines, enums */#include "buffersHandle.h"       /* handler, defines, enums */#include "concealmentHandle.h"   /* handler, defines, enums */#include "interface.h"           /* handler, defines, enums */#include "mod_bufHandle.h"       /* handler, defines, enums */#include "monopredHandle.h"      /* handler, defines, enums */#include "reorderspecHandle.h"   /* handler, defines, enums */#include "resilienceHandle.h"    /* handler, defines, enums */#include "tf_mainHandle.h"       /* handler, defines, enums */#include "all.h"                 /* structs */#include "lpc_common.h"          /* structs */#include "monopredStruct.h"      /* structs */#include "nok_ltp_common.h"      /* structs */#include "nok_prediction.h"      /* structs */#include "obj_descr.h"           /* structs */#include "tf_mainStruct.h"       /* structs */#include "tns.h"                 /* structs */#include "allVariables.h"        /* variables */#include "bitstream.h"#include "common_m4a.h"#include "dec_tf.h"#include "flex_mux.h"#include "mod_buf.h"#include "tf_main.h"/* son_NBCpp */#include "sony_local.h"/* NTT VQ */ #include "ntt_conf.h"#include "ntt_scale_conf.h"#include "mat_def_ntt.h"/* Long term predictor */#include "nok_lt_prediction.h"#include "ntt_nok_lt_predict_dec.h"#include "ntt_nok_pred.h"#include "aac.h"#include "buffers.h"#include "statistics_aac.h"#include "port.h"#include "ntt_conf.h"#include "ntt_scale_conf.h"static void tvqCoreDec ( int                   numChannels,                         FRAME_DATA*           fd, /* config data , obj descr. etc. */                         TF_DATA*              tfData,                         HANDLE_FAULT_TOLERANT hFault,                         ntt_INDEX*            index,                         BsBitStream*          mat_layerStream,                         TNS_frame_info        tns_info[MAX_TIME_CHANNELS],                         QC_MOD_SELECT         qc_select,                         int                   *nextLayer)     /*--- base decoder ---*/{  float current_frame[ntt_T_FR_MAX];  /*    TNS_frame_info tns_info[MAX_TIME_CHANNELS];  */  int tomo_tmp, itmp, i, j, i_ch, decoded_bits;  int ntt_available_bits;  /* bit unpacking */  decoded_bits = tfData->decoded_bits;  index->ms_mask = 0;  index->group_code = 0x7F ; /*default */  index->last_max_sfb[0] = 0;  if ( index->mainDebugLevel>2 ) {    printf("____ windowSequence %d \n",tfData->windowSequence[MONO_CHAN]);    printf("____ decoded_bit %d \n",decoded_bits);    fprintf(stderr, "tfData->pred_type %5d \n", tfData->pred_type);   }  ntt_headerdec(-1, mat_layerStream,  index, tfData->sfbInfo,                 &decoded_bits, tns_info,                tfData->nok_lt_status,                 tfData->pred_type,                hFault->hResilience,                hFault->hVm,                 hFault->hEpInfo );  tomo_tmp=decoded_bits;  ntt_available_bits = index->nttDataBase->ntt_NBITS_FR - decoded_bits; /* T.Ishikawa980624 */  if ( index->mainDebugLevel>2 ) {    printf("____ ntt_available_bits %d %d %d\n",ntt_available_bits,           index->nttDataBase->ntt_NBITS_FR,decoded_bits);    printf("____ ntt_available_bits %ld %d \n",BsBufferNumBit(fd->layer[0].bitBuf), decoded_bits);  }    decoded_bits += ntt_BitUnPack ( mat_layerStream,                                  BsBufferNumBit(fd->layer[0].bitBuf)                                  - tomo_tmp,                                  tfData->windowSequence[MONO_CHAN],                                  index );  tfData->decoded_bits = decoded_bits;  if ( index->mainDebugLevel>2 ) {    printf("<<<< ntt_BitUnPack %d %d >>>>\n",           decoded_bits-tomo_tmp,decoded_bits);  }  /* decoding tools*/  ntt_vq_decoder(index,tfData->spectral_line_vector[0],                 tfData->sfbInfo);  if ( index->mainDebugLevel>2 ) {    printf("<<<< Base Layer Decoding Finished!!! >>>>\n");  }	      /* nok 990113 ... */  /*-- long term predictor --*/  if(tfData->pred_type == NOK_LTP)    {      Info *info = tfData->sfbInfo[tfData->windowSequence[MONO_CHAN]];      for(i_ch = 0; i_ch < numChannels; i_ch++)        {          for (itmp = 0; itmp < info->bins_per_bk; itmp++)            current_frame[itmp] =               tfData->spectral_line_vector[0][i_ch][itmp];          /*if(tfData->nok_lt_status[i_ch]->sbk_prediction_used[0])*/	            nok_lt_predict(tfData->sfbInfo[tfData->windowSequence[MONO_CHAN]],                            tfData->windowSequence[MONO_CHAN],                           tfData->windowShape[i_ch],                           tfData->windowShape[i_ch],                           tfData->nok_lt_status[i_ch]->sbk_prediction_used,                           tfData->nok_lt_status[i_ch]->sfb_prediction_used,                           tfData->nok_lt_status[i_ch],                           tfData->nok_lt_status[i_ch]->weight,                           tfData->nok_lt_status[i_ch]->delay,                           current_frame,                           info->bins_per_bk,                           info->bins_per_bk/2,                           info->bins_per_bk/8,                            /*(tvqTnsPresent) ?*/ &(tns_info[i_ch]) /*: NULL */,                           NTT_VQ_SYS);          /* This is passed to upper layers. */          for (i = 0; i < info->bins_per_bk; i++)            tfData->spectral_line_vector[0][i_ch][i] = current_frame[i];          {	            /* TNS synthesis filtering. */              for(i = j = 0; i <  tns_info[i_ch].n_subblocks; i++)              {                tns_decode_subblock(current_frame + j,                                    index->max_sfb[0],                                    info->sbk_sfb_top[i],                                    info->islong,                                    &(tns_info[i_ch].info[i]),                                     qc_select);		                  j += info->bins_per_sbk[i];              }          }	          nok_ltp_buf_update(tfData->windowSequence[MONO_CHAN],                             tfData->windowShape[MONO_CHAN],                              tfData->prev_windowShape[i_ch],                             tfData->nok_lt_status[i_ch],                             current_frame,                             info->bins_per_bk,                             info->bins_per_bk/2,                             info->bins_per_bk/8, 8);        }    }  /* ... nok */  fd->layer[*nextLayer].NoAUInBuffer--;  (*nextLayer)++;}static void tvqScalDec(                       FRAME_DATA*  fd, /* config data , obj descr. etc. */                       TF_DATA*     tfData,                       HANDLE_FAULT_TOLERANT hFault,                       ntt_INDEX*   index,                       ntt_INDEX*   index_scl,                                              TNS_frame_info tns_info[MAX_TIME_CHANNELS],                       int *nextLayer)     /*--- scalable decoders ---*/{  BsBitStream* mat_layerStream ;  /*    TNS_frame_info tns_info[MAX_TIME_CHANNELS];  */  int decoded_bits, iscl,tomo_tmp,tomo_tmp2;  int   ntt_available_bits;  int  iii, jjj, ntt_NSclLay, ntt_NSclLayDec;  /*ntt_NSclLay = fd->od->streamCount.value-1; */  ntt_NSclLay = index_scl->nttDataScl->ntt_NSclLay;  if (( fd->od->streamCount.value > ( unsigned int )*nextLayer )       && (fd->od->ESDescriptor[*nextLayer]->DecConfigDescr.audioSpecificConfig.specConf.TFSpecificConfig.TFCodingType.value == 2) ) {    ntt_NSclLayDec = tfData->output_select;  }  else {    ntt_NSclLayDec=0;  }  if(ntt_NSclLayDec > ntt_NSclLay) ntt_NSclLayDec = ntt_NSclLay;  if(tvq_debug_level > 5)    fprintf(stderr, "WWWWWW %5d %5d NSclLay\n", ntt_NSclLay, ntt_NSclLayDec);  for(iii=0; iii<8; iii++){    for(jjj=0; jjj<index->max_sfb[0]; jjj++){      index_scl->msMask[iii][jjj] =         index->msMask[iii][jjj];    }  }  index_scl->w_type = tfData->windowSequence[MONO_CHAN];  index_scl->max_sfb[0] = index->max_sfb[0];  index_scl->group_code = index->group_code ;  index_scl->pf = index->pf ;  for (iscl=0; iscl<ntt_NSclLayDec; iscl++){    index_scl->last_max_sfb[iscl+1] =       index_scl->max_sfb[iscl];

⌨️ 快捷键说明

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