protected int get_allocationlength (Frame header)
	  {
	 	if (header.version() == Frame.MPEG1)
		{
		  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
			 if (subbandnumber <= 1)
				return 4;
			 else
				return 3;
		  else
			 // tables 3-B.2a or 3-B.2b
			 if (subbandnumber <= 10)
				return 4;
			 else if (subbandnumber <= 22)
				return 3;
			 else
				return 2;
	    }
		else
		{ // MPEG-2 LSF -- Jeff

		 // table B.1 of ISO/IEC 13818-3
	     if (subbandnumber <= 3)
	     		return 4;
	     else if (subbandnumber <= 10)
	     		return 3;
	     else
	     		return 2;
	    }
	  }