A computer-implemented method for generating a reference line for operating an autonomous driving vehicle, the method comprising: controlling an autonomous driving vehicle according to a first trajectory that was generated based on a first reference line starting at a first location; concurrently generating a second reference line based on a second location of the first trajectory that the autonomous driving vehicle will likely reach within a predetermined period of time in future, wherein the second reference line refers to an ideal route or path without any interference from other vehicles, obstacles or traffic condition, and if there is no other vehicle, pedestrian, or obstacle on a road, the autonomous driving vehicle exactly or closely follows the second reference line; in response to determining that the autonomous driving vehicle is within a predetermined proximity of the second location, generating a second trajectory based on the second reference line without having to calculate the second reference line at the second location; and controlling the autonomous driving vehicle according to the second trajectory starting from the second location, characterized in that the controlling the autonomous driving vehicle according to the first trajectory is performed via a first processing thread; the generating the second reference line is performed via a second processing thread; the second location is one of a plurality of third locations selected from the first trajectory that the autonomous driving vehicle would likely reach in future, and for each of the third locations, a third reference line is calculated and smoothed; the generating the second reference line comprises: for each of the third locations, via a separate processing thread, concurrently generating the third reference line for the third location, wherein each third reference line starts from a different one of the third locations; storing the third reference lines in a storage area while the autonomous driving vehicle is moving according to the first trajectory; determining a current location of the autonomous driving vehicle; searching in the storage area based on the current location of the autonomous driving vehicle to obtain one of the third reference lines whose associated location matches the current location; and generating a next trajectory based on the obtained third reference line to control the autonomous driving vehicle for a next planning cycle. controlling an autonomous driving vehicle according to a first trajectory that was generated based on a first reference line starting at a first location; concurrently generating a second reference line based on a second location of the first trajectory that the autonomous driving vehicle will likely reach within a predetermined period of time in future, wherein the second reference line refers to an ideal route or path without any interference from other vehicles, obstacles or traffic condition, and if there is no other vehicle, pedestrian, or obstacle on a road, the autonomous driving vehicle exactly or closely follows the second reference line; in response to determining that the autonomous driving vehicle is within a predetermined proximity of the second location, generating a second trajectory based on the second reference line without having to calculate the second reference line at the second location; and controlling the autonomous driving vehicle according to the second trajectory starting from the second location, characterized in that the controlling the autonomous driving vehicle according to the first trajectory is performed via a first processing thread; the generating the second reference line is performed via a second processing thread; the second location is one of a plurality of third locations selected from the first trajectory that the autonomous driving vehicle would likely reach in future, and for each of the third locations, a third reference line is calculated and smoothed; the generating the second reference line comprises: for each of the third locations, via a separate processing thread, concurrently generating the third reference line for the third location, wherein each third reference line starts from a different one of the third locations; storing the third reference lines in a storage area while the autonomous driving vehicle is moving according to the first trajectory; determining a current location of the autonomous driving vehicle; searching in the storage area based on the current location of the autonomous driving vehicle to obtain one of the third reference lines whose associated location matches the current location; and generating a next trajectory based on the obtained third reference line to control the autonomous driving vehicle for a next planning cycle. for each of the third locations, via a separate processing thread, concurrently generating the third reference line for the third location, wherein each third reference line starts from a different one of the third locations; storing the third reference lines in a storage area while the autonomous driving vehicle is moving according to the first trajectory; determining a current location of the autonomous driving vehicle; searching in the storage area based on the current location of the autonomous driving vehicle to obtain one of the third reference lines whose associated location matches the current location; and generating a next trajectory based on the obtained third reference line to control the autonomous driving vehicle for a next planning cycle.