# Determining Thresholds for Optimal Adaptive Discrete Cosine Transformation
###### Abstract  
The discrete cosine transform (DCT) is widely used for image and video compression. Lossy algorithms such as JPEG, WebP, BPG and many others are based on it. Multiple modifications of DCT have been developed to improve its performance. One of them is adaptive DCT (ADCT) designed to deal with heterogeneous image structure and it may be found, for example, in the HEVC video codec. Adaptivity means that the image is divided into an uneven grid of squares: smaller ones retain information about details better, while larger squares are efficient for homogeneous backgrounds. The practical use of adaptive DCT algorithms is complicated by the lack of optimal threshold search algorithms for image partitioning procedures. In this paper, we propose a novel method for optimal threshold search in ADCT using a metric based on tonal distribution. We define two thresholds: \(pm\), the threshold defining solid mean coloring, and \(ps\), defining the quadtree fragment splitting. In our algorithm, the values of these thresholds are calculated via polynomial functions of the tonal distribution of a particular image or fragment. The polynomial coefficients are determined using the dedicated optimization procedure on the dataset containing images from the specific domain, urban road scenes in our case. In the experimental part of the study, we show that ADCT allows a higher compression ratio compared to non-adaptive DCT at the same level of quality loss, up to 66% for acceptable quality. The proposed algorithm may be used directly for image compression, or as a core of video compression framework in traffic-demanding applications, such as urban video surveillance systems. adaptive discrete cosine transform; optimization; adaptivity; tonal variance thresholds; transport images +
Footnote †: journal:  
020241766602024176660241766024176602417660241766024176602417660241766024176602417660241766024176602417660241766024176602417660241766024176024176024176 and other image information sources together with the improvement of video quality characteristics, problems arise associated with the need to transmit, store and process huge amounts of data. For example, in the overview observation mode, the camera generates an average video data stream at a rate of 6 Mbit/s. For 400 cameras, the rate of generated data is 300 MB/s, i.e., almost 18 GB per minute and over 1 TB per hour. With the need for transmitting, processing and storing such volumes of video data, it is important to apply efficient image and video compression methods. Various image compression and restoration algorithms have been extensively studied by scholars for the last few decades. Algorithms such as JPEG [2; 3], WebP [4; 5], BPG [6; 7] and FLIF [8] have been developed and enhanced in the last few decades. When performing compression of the video stream from CCTV cameras, the following features of video information should be taken into account:  
* Most of the frame is often occupied by a static background (sidewalk, buildings, advertisements, temporary banners, sky, etc. );
* The intensity and density of traffic flows change over time;
* In the absence of movement between frames, there is a high degree of correlation over time;
* The contrast between objects in video frames and the background is relatively low. Practical solutions in image compression algorithms suggest that the original image can be compressed into a power-2 square before applying DCT and then fragmented, typically into \(8\times 8\)-pixel squares. In standard DCT, after fragmentation, the transformation is applied separately to each fragment. The authors of [9; 10] provide alternative approaches to interpreting quadtree decomposition. They propose, instead of applying transformation to the blocks themselves, to take a pixel from each block to form sub-ranges of the original image and then transform the resulting sub-ranges.