A computer-generated hologram (CGH) is the core component for an aspheric surface test. According to fabrication demands, it is necessary to convert the designed CGH phase compensation function into the processed pattern, that is, the fringe discretization process. In this paper, we propose a new discretization method for a CGH in a test of the freeform surface, and realized the encoding of processed fringes by MATLAB software. Furthermore, we designed the experiment to verify the accuracy of the new discretization method and compared the calculation efficiency between the new algorithm and the reported algorithm. Finally, based on the testing requirement of a freeform mirror in a camera optical system, we completed the design, encoding, and fabrication of the CGH sample, and analyzed the influence of various errors on wavefront accuracy of the CGH.