private FrameData read_data(LayerIIIDecoder decoder){
//        sideinfo.read_side_info();
//        sideinfo.calc_parameters();
        int mdb = 0;
        decoder.decodeFrame(Constants.QUANTIZED_DOMAIN);

        FrameData fd = decoder.getFrameInfo();
        decoder.read_side_info(fd);
        header.copy_info(fd);
        
        byte [] buffer = bitstream.get_main_data();
        
        if( (mdb = fd.getMainDataBegin()) != 0 ){
            byte[] data_res = reserve.read_from_reserve(mdb);
            
            int totlen = fd.getMdLen() ;
            
            int main_data_beg = fd.getMainDataBegin();
            data_def = new byte[totlen];
            int end = (totlen > main_data_beg)? main_data_beg: totlen;
            
            for(int i = 0; i < end; i++){
                data_def[i] = data_res[i];
            }
            
            if(totlen > main_data_beg){
                int offset = end;
                for(int i = offset; i < totlen; i++){
                    data_def[i] = buffer[i - end];
                }
            }
            
            reserve.store_in_reserve(buffer);
            tot += totlen;
        } else {
            int totlen = fd.getMdLen();
            int end = ( totlen > buffer.length ) ? buffer.length: totlen;
            
            data_def = new byte[totlen];
            
            for(int i = 0; i < totlen; i++)
                data_def[i] = buffer[i];
            
            tot += totlen;
            reserve.store_in_reserve(buffer);
        }
        
        return fd;
    }