XilinxProcessorIPLib/drivers/v_warp_init/src/xv_warp_init_utils.c
unsigned int XVWarpInit_ExponentialFact(unsigned exp_value, short k_type,
		unsigned int Q_fact, char *Q_exp) {
	unsigned int fract, exp_factor;
	unsigned short part1, part2;
	unsigned long long ul_temp_64;
	unsigned short int_val;

	if (k_type < 0) {
		if (exp_value > 115762790) //6.9 * 2 ^ 24
			exp_value = 115762790; //e^6
		int_val = exp_value >> 24; //int part
		fract = exp_value & 0xffffff;
	}
	else {
		if (exp_value > 184549376) //11 * 2^24
			exp_value = 184549376;
		int_val = (exp_value >> 24) + 1; //int part
		fract = (int_val << 24) - exp_value;
	}

	exp_factor = fract >> 17;
	fract = ((fract & 0x1ffff) + 16) >> 5;

	part2 = exp_pos_fract_lut2[fract];
	part1 = exp_pos_fract_lut1[exp_factor];
	ul_temp_64 = ((part1 * part2) >> 6) + (((unsigned int)part1) << 16);//Q30

	if (k_type < 0) {
		ul_temp_64 *= exp_pos_int_lut[int_val];//Q30 * Q10 = Q40
		exp_factor = ul_temp_64 >> 18;//Q22
		exp_factor = exp_factor - Q_fact;
		*Q_exp = 22;
	}
	else {
		ul_temp_64 *= exp_neg_int_lut[int_val];//Q30 * Q17 = Q47
		exp_factor = ul_temp_64 >> 16;//Q31
		exp_factor = Q_fact - exp_factor;
		*Q_exp = 31;
	}

	return exp_factor;
}
/*****************************************************************************/
/**
* This function computes exponental of fractional number given in fixed point value
*
* @param  exp_value, integer value for calculating e^x. x is Q_fact fixed point format
* @param  k_type, exp_value type +ve or -ve.
* @param  Q_fact, fixed point format.
*
* @return Q_exp, return fixed point format.
* @return returns positive integer of fixed point format of Q_exp
*
******************************************************************************/
This function computes exponental of fractional number given in fixed point value
This function computes exponental of fractional number given in fixed point value
unsigned int XVWarpInit_ExponentialFact(unsigned exp_value, short k_type,
		unsigned int Q_fact, char *Q_exp) {
	unsigned int fract, exp_factor;
	unsigned short part1, part2;
	unsigned long long ul_temp_64;
	unsigned short int_val;
	if (k_type < 0) {
		if (exp_value > 115762790) 
			exp_value = 115762790; 
		int_val = exp_value >> 24; 
		fract = exp_value & 0xffffff;
	}
	else {
		if (exp_value > 184549376) 
			exp_value = 184549376;
		int_val = (exp_value >> 24) + 1; 
		fract = (int_val << 24) - exp_value;
	}
	exp_factor = fract >> 17;
	fract = ((fract & 0x1ffff) + 16) >> 5;
	part2 = exp_pos_fract_lut2[fract];
	part1 = exp_pos_fract_lut1[exp_factor];
	ul_temp_64 = ((part1 * part2) >> 6) + (((unsigned int)part1) << 16);
	if (k_type < 0) {
		ul_temp_64 *= exp_pos_int_lut[int_val]; * Q10 = Q40
		exp_factor = ul_temp_64 >> 18;
		exp_factor = exp_factor - Q_fact;
		*Q_exp = 22;
	}
	else {
		ul_temp_64 *= exp_neg_int_lut[int_val]; * Q17 = Q47
		exp_factor = ul_temp_64 >> 16;
		exp_factor = Q_fact - exp_factor;
		*Q_exp = 31;
	}
	return exp_factor;
}
unsigned int XVWarpInit_ExponentialFact ( unsigned exp_value , short k_type , unsigned int Q_fact , char * Q_exp ) { unsigned int fract , exp_factor ; unsigned short part1 , part2 ; unsigned long long ul_temp_64 ; unsigned short int_val ; if ( k_type < 0 ) { if ( exp_value > 115762790 ) exp_value = 115762790 ; int_val = exp_value >> 24 ; fract = exp_value & 0xffffff ; } else { if ( exp_value > 184549376 ) exp_value = 184549376 ; int_val = ( exp_value >> 24 ) + 1 ; fract = ( int_val << 24 ) - exp_value ; } exp_factor = fract >> 17 ; fract = ( ( fract & 0x1ffff ) + 16 ) >> 5 ; part2 = exp_pos_fract_lut2 [ fract ] ; part1 = exp_pos_fract_lut1 [ exp_factor ] ; ul_temp_64 = ( ( part1 * part2 ) >> 6 ) + ( ( ( unsigned int ) part1 ) << 16 ) ; if ( k_type < 0 ) { ul_temp_64 *= exp_pos_int_lut [ int_val ] ; exp_factor = ul_temp_64 >> 18 ; exp_factor = exp_factor - Q_fact ; * Q_exp = 22 ; } else { ul_temp_64 *= exp_neg_int_lut [ int_val ] ; exp_factor = ul_temp_64 >> 16 ; exp_factor = Q_fact - exp_factor ; * Q_exp = 31 ; } return exp_factor ; }
This function computes exponental of fractional number given in fixed point value
This function computes exponental of fractional number given in fixed point value
//6.9 * 2 ^ 24 //e^6 //int part //11 * 2^24 //int part //Q30 //Q30 * Q10 = Q40 //Q22 //Q30 * Q17 = Q47 //Q31