A lossless compression method applied to hardware video decoding, sequentially comprising a video decoding step, a compression step, a storage step and a decompression step, wherein: the video decoding step comprises a step of decoding a video code stream and outputting decoded YUV data; the compression step comprises a step of performing lossless compression on the YUV data output by the video decoding step; the storage step comprises a step of storing losslessly compressed data; and the decompression step comprises a step of decompressing the losslessly compressed data and recovering original YUV data, wherein, in the compression step, lossless compression is performed by taking a 16x4 Y luma block and a corresponding 8x2 U chroma block and 8x2 V chroma block as a compression unit; in the storage step, compact compression and storage is performed on a complete frame of image by taking four pixel lines as a unit, and a starting address of every four pixel lines is fixed; and the decoding step comprises a reference frame reading step, a two-level Cache structure is adopted in the reference frame reading step, and in the two-level Cache structure, the first level is a Compress-Cache which caches the compressed data, and the other level is a 2D-Cache which caches decompressed original YUV data; characterized in that the compression step comprises a prediction step, a grouping step and an entropy coding step, the entropy coding step comprises a step of calculating bit numbers of the Y luma blocks, the U chroma blocks or the V chroma blocks under each prediction mode according to the prediction mode and the residuals and a step of finding the prediction mode making smallest bit numbers of the Y luma blocks, the U chroma blocks or the V chroma blocks after prediction, and judging whether the smallest bit numbers exceed original bit numbers of the Y luma blocks, the U chroma blocks and the V chroma blocks or not, wherein, if the smallest bit numbers exceed original bit numbers, the original data is directly used instead. the video decoding step comprises a step of decoding a video code stream and outputting decoded YUV data; the compression step comprises a step of performing lossless compression on the YUV data output by the video decoding step; the storage step comprises a step of storing losslessly compressed data; and the decompression step comprises a step of decompressing the losslessly compressed data and recovering original YUV data, wherein, in the compression step, lossless compression is performed by taking a 16x4 Y luma block and a corresponding 8x2 U chroma block and 8x2 V chroma block as a compression unit; in the storage step, compact compression and storage is performed on a complete frame of image by taking four pixel lines as a unit, and a starting address of every four pixel lines is fixed; and the decoding step comprises a reference frame reading step, a two-level Cache structure is adopted in the reference frame reading step, and in the two-level Cache structure, the first level is a Compress-Cache which caches the compressed data, and the other level is a 2D-Cache which caches decompressed original YUV data; characterized in that the compression step comprises a prediction step, a grouping step and an entropy coding step, the entropy coding step comprises a step of calculating bit numbers of the Y luma blocks, the U chroma blocks or the V chroma blocks under each prediction mode according to the prediction mode and the residuals and a step of finding the prediction mode making smallest bit numbers of the Y luma blocks, the U chroma blocks or the V chroma blocks after prediction, and judging whether the smallest bit numbers exceed original bit numbers of the Y luma blocks, the U chroma blocks and the V chroma blocks or not, wherein, if the smallest bit numbers exceed original bit numbers, the original data is directly used instead.