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

net.sourceforge.jaad.aac.sbr.TFGrid Maven / Gradle / Ivy

There is a newer version: 0.2.5
Show newest version
package net.sourceforge.jaad.aac.sbr;

/**
 * This class is part of JAAD ( jaadec.sourceforge.net ) that is distributed
 * under the Public Domain license. Code changes provided by the JCodec project
 * are distributed under FreeBSD license. 
 *
 * @author in-somnia
 */
class TFGrid implements SBRConstants {


	/* function constructs new time border vector */
	/* first build into temp vector to be able to use previous vector on error */
	public static int envelope_time_border_vector(SBR sbr, int ch) {
		int l, border, temp;
		int[] t_E_temp = new int[6];

		t_E_temp[0] = sbr.rate*sbr.abs_bord_lead[ch];
		t_E_temp[sbr.L_E[ch]] = sbr.rate*sbr.abs_bord_trail[ch];

		switch(sbr.bs_frame_class[ch]) {
			case FIXFIX:
				switch(sbr.L_E[ch]) {
					case 4:
						temp = (sbr.numTimeSlots/4);
						t_E_temp[3] = sbr.rate*3*temp;
						t_E_temp[2] = sbr.rate*2*temp;
						t_E_temp[1] = sbr.rate*temp;
						break;
					case 2:
						t_E_temp[1] = sbr.rate*(sbr.numTimeSlots/2);
						break;
					default:
						break;
				}
				break;

			case FIXVAR:
				if(sbr.L_E[ch]>1) {
					int i = sbr.L_E[ch];
					border = sbr.abs_bord_trail[ch];

					for(l = 0; l<(sbr.L_E[ch]-1); l++) {
						if(border1) {
					int i = 1;
					border = sbr.abs_bord_lead[ch];

					for(l = 0; l<(sbr.L_E[ch]-1); l++) {
						border += sbr.bs_rel_bord[ch][l];

						if(sbr.rate*border+sbr.tHFAdj>sbr.numTimeSlotsRate+sbr.tHFGen)
							return 1;

						t_E_temp[i++] = sbr.rate*border;
					}
				}
				break;

			case VARVAR:
				if(sbr.bs_num_rel_0[ch]!=0) {
					int i = 1;
					border = sbr.abs_bord_lead[ch];

					for(l = 0; lsbr.numTimeSlotsRate+sbr.tHFGen)
							return 1;

						t_E_temp[i++] = sbr.rate*border;
					}
				}

				if(sbr.bs_num_rel_1[ch]!=0) {
					int i = sbr.L_E[ch];
					border = sbr.abs_bord_trail[ch];

					for(l = 0; l1)
					retval = sbr.L_E[ch]+1-sbr.bs_pointer[ch];
				else
					retval = sbr.L_E[ch]-1;
				break;
		}

		return (retval>0) ? retval : 0;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy