All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.restcomm.media.codec.g729.LD8KConstants Maven / Gradle / Ivy

There is a newer version: 7.0.16
Show newest version
/*
 * JBoss, Home of Professional Open Source
 * Copyright 2011, Red Hat, Inc. and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.restcomm.media.codec.g729;

public class LD8KConstants {

	public static final float PI             = (float)3.14159265358979323846;
	public static final float PI2            = (float)6.283185307;
	public static final float FLT_MAX_G729   =      (float)1.e38 ;  /* largest floating point number             */
	public static final float FLT_MIN_G729   =      -FLT_MAX_G729;    /* largest floating point number             */

	public static final short L_TOTAL       =  240  ;   /* Total size of speech buffer               */
	public static final short L_FRAME       =  80  ;    /* LPC update frame size                     */
	public static final short L_SUBFR       =  40  ;    /* Sub-frame size                            */

	/*---------------------------------------------------------------------------*
	 * constants for bitstream packing                                           *
	 *---------------------------------------------------------------------------*/
	public static final short BIT_1  =   (short)0x0081; /* definition of one-bit in bit-stream      */
	public static final short BIT_0   =  (short)0x007f; /* definition of zero-bit in bit-stream      */
	public static final short SYNC_WORD= (short)0x6b21; /* definition of frame erasure flag          */
	public static final short SIZE_WORD  =     80 ; /* size of bitstream frame */
	public static final short PRM_SIZE   =     11 ;     /* number of parameters per 10 ms frame      */
	public static final short SERIAL_SIZE=     82 ;     /* bits per frame                            */

	/*---------------------------------------------------------------------------*
	 * constants for lpc analysis and lsp quantizer                              *
	 *---------------------------------------------------------------------------*/
	public static final short L_WINDOW   =     240   ;  /* LPC analysis window size                  */
	public static final short L_NEXT      =    40    ;  /* Samples of next frame needed for LPC ana. */

	public static final short M          =     10    ;  /* LPC order                                 */
	public static final short MP1        =    (M+1)  ;  /* LPC order+1                               */
	public static final short GRID_POINTS =    60    ;  /* resolution of lsp search                  */

	public static final short MA_NP      =     4     ;  /* MA prediction order for LSP               */
	public static final short MODE       =     2     ;  /* number of modes for MA prediction         */
	public static final short NC0_B      =     7     ;  /* number of bits in first stage             */
	public static final short NC0        =  (1<0        */
	public static final float GAMMA3_MINUS  =  (float)0.9  ;   /* tilt weighting factor when k1<0        */

	/* long term pst parameters :   */
	public static final short L_SUBFRP1= (L_SUBFR + 1); /* Sub-frame size + 1                        */
	public static final short F_UP_PST  =      8  ;     /* resolution for fractionnal delay          */
	public static final short LH2_S      =     4   ;    /* length of INT16 interp. subfilters        */
	public static final short LH2_L      =     16   ;   /* length of long interp. subfilters         */
	public static final float THRESCRIT   =    (float)0.5 ;    /* threshold LT pst switch off            */
	public static final float GAMMA_G     =    (float)0.5  ;   /* LT weighting factor                    */
	public static final float AGC_FAC     =    (float)0.9875 ; /* gain adjustment factor                 */

	public static final float AGC_FAC1     =    ((float)1. - AGC_FAC);    /* gain adjustment factor                 */
	public static final short LH_UP_S     =    (LH2_S/2);
	public static final short LH_UP_L    =     (LH2_L/2);
	public static final short LH2_L_P1  =  (LH2_L + 1);
	public static final float MIN_GPLT  =  ((float)1. / ((float)1. + GAMMA_G));  /* LT gain minimum          */

	/* Array sizes */
	public static final short MEM_RES2 =(PIT_MAX + 1 + LH_UP_L);
	public static final short SIZ_RES2 =(MEM_RES2 + L_SUBFR);
	public static final short SIZ_Y_UP  =((F_UP_PST-1) * L_SUBFRP1);
	public static final short SIZ_TAB_HUP_L =((F_UP_PST-1) * LH2_L);
	public static final short SIZ_TAB_HUP_S =((F_UP_PST-1) * LH2_S);


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy