protected void prepare_sample_reading(Frame header, int allocation,
											 //float[][] groupingtable,
											   int channel,
	                                         float[] factor, int[] codelength,
	                                         float[] c, float[] d)
	   {
	 	 	int channel_bitrate = header.bitrate_index();
	  		// calculate bitrate per channel:
		  	if (header.mode() != Frame.SINGLE_CHANNEL)
		 		if (channel_bitrate == 4)
					channel_bitrate = 1;
		 		else
					channel_bitrate -= 4;
			
	 		 if (channel_bitrate == 1 || channel_bitrate == 2)
	 		 {
				 // table 3-B.2c or 3-B.2d
				 groupingtable[channel] = table_cd_groupingtables[allocation];
				 factor[0] = table_cd_factor[allocation];
				 codelength[0] = table_cd_codelength[allocation];
				 c[0] = table_cd_c[allocation];
				 d[0] = table_cd_d[allocation];
	 		 }
	 		 else
	 		 {
				 // tables 3-B.2a or 3-B.2b
				 if (subbandnumber <= 2)
				 {
					groupingtable[channel] = table_ab1_groupingtables[allocation];
					factor[0] = table_ab1_factor[allocation];
					codelength[0] = table_ab1_codelength[allocation];
	 		     	c[0] = table_ab1_c[allocation];
	 		     	d[0] = table_ab1_d[allocation];
	 		     }
				 else
				 {
	 		     	groupingtable[channel] = table_ab234_groupingtables[allocation];
					if (subbandnumber <= 10)
					{
						factor[0] = table_ab2_factor[allocation];
						codelength[0] = table_ab2_codelength[allocation];
						c[0] = table_ab2_c[allocation];
						d[0] = table_ab2_d[allocation];
	 		     	}
	 		     	else if (subbandnumber <= 22)
	 		     	{
						factor[0] = table_ab3_factor[allocation];
						codelength[0] = table_ab3_codelength[allocation];
						c[0] = table_ab3_c[allocation];
						d[0] = table_ab3_d[allocation];
	 		     	}
					else
	 		     	{
						factor[0] = table_ab4_factor[allocation];
						codelength[0] = table_ab4_codelength[allocation];
						c[0] = table_ab4_c[allocation];
						d[0] = table_ab4_d[allocation];
	 		     	}
	 		   	 }
	 		 }   
	   }