private void calculateFramesize() {
        frameSize = (144 * Constants.BITRATES[version][bitrateIndex])
                / frequency();
        if (version == VERSION_MPEG2_LSF || version == VERSION_MPEG25_LSF) {
            frameSize >>= 1;
        }
        if (paddingBit) {
            frameSize++;
        }
        // subtract header size
        frameSize -= 4;
        // side info size, crc size, header sidze
        if (version == VERSION_MPEG1) {
            slots = (mode == MODE_SINGLE_CHANNEL) ? 17 : 32;
        } else {
            slots = (mode == MODE_SINGLE_CHANNEL) ? 9 : 17;
        }
        slots = frameSize - slots - (protectionBit ? 0 : 2);
    }