## 2 Proposed Algorithm
### Network Training Program Improvement  
A fundamental concept in the transmission process of video codecs is the quantization parameter (QP). The QP determines the fineness of the quantization. A higher QP value corresponds to a lower level of quantization precision; conversely, a lower QP value corresponds to a higher level of quantization precision. However, the amount of data is reduced in accordance with the QP value, which helps to reduce the bandwidth required for storage and transmission. Conversely, a reduction in the QP value will result in an increase in the precision of quantization, accompanied by an increase in the amount of data. However, this will lead to an improvement in the quality of the video. In essence, the QP allows for the calibration of video clarity and data consumption. Accordingly, in the context of training schemes for video coding, the dataset is typically partitioned based on the QP values observed prior to and following the coding process. Even if the images are encoded with the same QP, the degradation will be different for each image. As a result, CycleGAN did not converge on every QP. For coded images, PSNR and image frequency distribution are related. For low-frequency images, the number of quantized frequencies is small. Therefore, the quantization error and the PSNR are also high. Conversely, for high-frequency images, the number of valid frequencies increases, and the quantization error increases. Thus, PSNR is related to the characteristics of the image. Therefore, the optimal image restoration effect can be obtained by matching the image degradation with the image restoration strength. In the restoration of the coded image, it is difficult to determine the optimal CycleGAN network because the input QP and training QP do not match. In this article, the network is trained to emphasize the improvement of the image distortion part of the coding and decoding process. Consequently, the Peak Signal-to-Noise Ratio (PSNR) value is chosen as a criterion for image segmentation. The PSNR is a measure of image quality and is widely used in the field of image processing, such as image compression, denoising, and super-resolution. The PSNR value is used to evaluate the quality of an image by comparing the difference between the original image and the image after processing (e.g., compression, enhancement, etc.). A higher PSNR value indicates a superior image quality with minimal distortion. The PSNR is defined in terms of the Mean Squared Error (MSE), which is calculated using the following formula:  
\[MSE=\frac{1}{mn}\sum_{i=0}^{m-1}\sum_{j=0}^{n-1}\biggl{|}I(i,j)-K(i,j)\biggr{|} _{2}, \tag{6}\]  
where I and K represent the original image and the processed image, respectively, and m and n are the number of rows and columns of the image, respectively. The PSNR is calculated in accordance with the following formula:  
\[PSNR=10\times\log_{10}(\frac{MAX_{I}^{2}}{MSE}) \tag{7}\]  
The objective of this study is to classify the datasets based on the PSNR values and to train a modified CycleGAN on each dataset within the specified PSNR range. This approach guarantees the uniformity of dataset degradation and facilitates the reduction process to align with the image features. Specifically, during the training phase, as illustrated in Figure 7, the datasets are classified at intervals of 2 dB, with each classified dataset subsequently employed for training purposes. Given that the coded images comprise numerous flat regions, it was deemed appropriate to set a larger image block size, thus facilitating the capture of the aforementioned features. The datasets are then cropped into image blocks of 128 \(\times\) 128 pixels. In the inference phase, the PSNR values of each original and encoded image block are calculated, and the corresponding network weights are selected based on the PSNR values of each image block. To illustrate, if the PSNR value of the input-output image block is 35 dB, the network weights corresponding to the '34-37 dB PSNR range' will be selected.