/// <summary> /// * /// </summary> protected internal virtual void prepare_sample_reading(Header header, int allocation, int channel, float[] factor, int[] codelength, float[] c, float[] d) { int channel_bitrate = header.bitrate_index(); // calculate bitrate per channel: if (header.mode() != Header.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]; } } } }
/// <summary> /// * /// </summary> protected internal virtual int get_allocationlength(Header header) { if (header.version() == Header.MPEG1) { int channel_bitrate = header.bitrate_index(); // calculate bitrate per channel: if (header.mode() != Header.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; // tables 3-B.2a or 3-B.2b if (subbandnumber <= 10) return 4; if (subbandnumber <= 22) return 3; return 2; } // MPEG-2 LSF -- Jeff // table B.1 of ISO/IEC 13818-3 if (subbandnumber <= 3) return 4; if (subbandnumber <= 10) return 3; return 2; }