ns-allinone-2.35/rap/media-app.cc
double QA::bufOptScen1(int layer, int layers, double currrate, 
		       double slope, int backoffs)
{
	double smallt, larget, side, rate;
  
	if (backoffs < 0) {
		panic("# ERROR: backoff: %d in bufOptScen1\n", 
		      backoffs);
	}
	rate = currrate/pow(2,backoffs);
	side = LAYERBW_*layers - (rate + layer*LAYERBW_);
	if (side <= 0.0) 
		return(0.0);
	larget = BufNeed(side, slope);
	side = LAYERBW_*layers - (rate + (layer+1)*LAYERBW_);
	if (side < 0.0) 
		side = 0.0;
	smallt = BufNeed(side, slope);

	return (larget-smallt);
}
//
// This is optimal buffer distribution for scenario 1.
// NOTE: rate is the current rate before the backoff
// Jan 28, 99
//
// This routines performs buffer sharing by giveing max share
// to the lowest layer, i.e. it fills the triangle in a bottom-up
// starting from the base layer. We use this routine instead of bufOpt,
// for all cases during filling phase. Allocation based on diagonal strips
//
This is optimal buffer distribution for scenario 1.
NOTE: rate is the current rate before the backoff
Jan 28, 99

This routines performs buffer sharing by giveing max share
to the lowest layer, i.e. it fills the triangle in a bottom-up
starting from the base layer. We use this routine instead of bufOpt,
for all cases during filling phase. Allocation based on diagonal strips
This is optimal buffer distribution for scenario 1 . NOTE : rate is the current rate before the backoff Jan 28 99 This routines performs buffer sharing by giveing max share to the lowest layer i . e . it fills the triangle in a bottom - up starting from the base layer . We use this routine instead of bufOpt for all cases during filling phase . Allocation based on diagonal strips
double QA::bufOptScen1(int layer, int layers, double currrate, 
		       double slope, int backoffs)
{
	double smallt, larget, side, rate;
	if (backoffs < 0) {
		panic("# ERROR: backoff: %d in bufOptScen1\n", 
		      backoffs);
	}
	rate = currrate/pow(2,backoffs);
	side = LAYERBW_*layers - (rate + layer*LAYERBW_);
	if (side <= 0.0) 
		return(0.0);
	larget = BufNeed(side, slope);
	side = LAYERBW_*layers - (rate + (layer+1)*LAYERBW_);
	if (side < 0.0) 
		side = 0.0;
	smallt = BufNeed(side, slope);
	return (larget-smallt);
}
double QA :: bufOptScen1 ( int layer , int layers , double currrate , double slope , int backoffs ) { double smallt , larget , side , rate ; if ( backoffs < 0 ) { panic ( " \n " , backoffs ) ; } rate = currrate / pow ( 2 , backoffs ) ; side = LAYERBW_ * layers - ( rate + layer * LAYERBW_ ) ; if ( side <= 0.0 ) return ( 0.0 ) ; larget = BufNeed ( side , slope ) ; side = LAYERBW_ * layers - ( rate + ( layer + 1 ) * LAYERBW_ ) ; if ( side < 0.0 ) side = 0.0 ; smallt = BufNeed ( side , slope ) ; return ( larget - smallt ) ; }
This is optimal buffer distribution for scenario 1.
This is optimal buffer distribution for scenario 1 .