📄 nec_bws_module.c
字号:
/*This software module was originally developed byToshiyuki Nomura (NEC Corporation)and edited byin the course of development of theMPEG-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 moreMPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audiostandard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standardsfree license to this software module or modifications thereof for use inhardware or software products claiming conformance to the MPEG-2 NBC/MPEG-4 Audio standards. Those intending to use this software module inhardware or software products are advised that this use may infringeexisting patents. The original developer of this software module andhis/her company, the subsequent editors and their companies, and ISO/IEChave no liability for use of this software module or modificationsthereof in an implementation. Copyright is not released for nonMPEG-2 NBC/MPEG-4 Audio conforming products. The original developerretains full right to use the code for his/her own purpose, assign ordonate the code to a third party and to inhibit third party from usingthe 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.*//* * MPEG-4 Audio Verification Model (LPC-ABS Core) * * Excitation Other Subroutines * * Ver1.0 97.09.08 T.Nomura(NEC) */#include <stdio.h>#include <stdlib.h>#include <math.h>#include "nec_exc_proto.h"#include "nec_abs_const.h"#include "fix_acb_int.tbl"long nec_acb_generation_16(long idx, long len_sf, float mem_ac[], float exci[], float exco[], float ga, long type ){ long i, k, kk, sample; long F_part, I_part, F_part0, I_part0; float dum_dbl; float *P_FILm; long pitch_max, pitch_limit; /*--- INITIALIZATION ---*/ P_FILm = wb_FIL; pitch_max = NEC_PITCH_MAX_FRQ16; pitch_limit = NEC_PITCH_LIMIT_FRQ16; if ( idx == pitch_limit ) { I_part = 0; F_part = 0; } else if(idx < 2){ I_part = 32; F_part = (2 * (idx+1)) % NEC_PITCH_RSLTN; } else if (2 <= idx && idx <= 777){ I_part = 32 + 2 * (idx - 2)/ NEC_PITCH_RSLTN; F_part = ( 2 * (idx - 2)) % NEC_PITCH_RSLTN; } else { printf("Error %ld\n", idx); } /*--- EXCITATION GENERATION ---*/ if ( idx == pitch_limit ) { for (i = 0; i < len_sf; i++) exco[i] = exci[i]; return I_part; } F_part0 = 0; if ( type == 0 ) { for (sample = 0; sample < len_sf; ) { F_part0 += F_part; I_part0 = I_part + (F_part0/NEC_PITCH_RSLTN); F_part0 = F_part0 % NEC_PITCH_RSLTN; for ( i = 0; i < I_part0 && sample < len_sf; i++, sample++ ) { dum_dbl = 0.0; for (k = -NEC_PITCH_IFTAP16; k <= NEC_PITCH_IFTAP16; k++) { kk = (k+1) * NEC_PITCH_RSLTN - F_part0; dum_dbl += P_FILm[abs(kk)]*mem_ac[pitch_max+NEC_PITCH_IFTAP16+1-(I_part0-i+k+1)]; } dum_dbl = exci[sample] + ga * dum_dbl; exco[sample] = dum_dbl; mem_ac[pitch_max+NEC_PITCH_IFTAP16+1+sample] = dum_dbl; } } } else { for (sample = 0; sample < len_sf; sample++) { dum_dbl = 0.0; for (k = -NEC_PITCH_IFTAP16; k <= NEC_PITCH_IFTAP16; k++) { kk = (k+1) * NEC_PITCH_RSLTN - F_part; dum_dbl += P_FILm[abs(kk)]*mem_ac[pitch_max+NEC_PITCH_IFTAP16+1-(I_part+k+1)+sample]; } exco[sample] = dum_dbl; mem_ac[pitch_max+NEC_PITCH_IFTAP16+1+sample] = exci[sample]; } } return I_part;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -