A method and apparatus for image compression and restoration for terminal software

By generating a multi-dimensional retinal dwell probability matrix and adaptive frequency domain quantization, combined with real-time rendering frame rate adjustment on the terminal, the performance bottleneck of terminal devices under high-frequency interaction is solved, achieving efficient image compression and restoration, and ensuring a smooth user experience and high-definition image quality.

CN122269044APending Publication Date: 2026-06-23GUANGZHOU WENTIAN INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU WENTIAN INFORMATION TECH CO LTD
Filing Date
2026-03-23
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing image compression and restoration technologies cause performance bottlenecks in terminal devices under high-frequency interaction, failing to balance high-resolution visual experience with limited computing resources, resulting in dropped frames and device overheating.

Method used

By acquiring the local texture gradient features and window interaction state of the image, a multi-dimensional retinal dwell probability matrix is ​​generated, and adaptive frequency domain quantization and asymmetric coding are performed. Combined with the real-time rendering frame rate of the terminal, the detail compensation features are dynamically adjusted to achieve adaptive compression and restoration of image blocks.

Benefits of technology

It accurately preserves details in areas of interest at a high compression ratio, reduces transmission and storage overhead, solves the stuttering problem caused by performance fluctuations of terminal devices, and provides a smooth interactive experience and high-definition detail presentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122269044A_ABST
    Figure CN122269044A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of digital image processing, and discloses a terminal software-oriented image compression and restoration method and device, which comprises the following steps: acquiring an image to be processed and a window interaction state sequence of current terminal software; extracting local texture gradient features of the image to be processed; and extracting corresponding low-frequency basic residual errors and high-frequency directional residual errors; asymmetrically encoding the low-frequency basic residual errors and the high-frequency directional residual errors according to a frequency domain quantization step to generate a structured compression code stream; analyzing the structured compression code stream to acquire a basic reconstruction image and local detail compensation features; dynamically adjusting fusion weights of the local detail compensation features according to a real-time rendering frame rate of the current terminal software, and superimposing the local detail compensation features to the basic reconstruction image to generate a target restored image; and the application can improve the balance between high-resolution visual experience and limited terminal computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital image processing technology, and in particular to an image compression and restoration method and apparatus for terminal software. Background Technology

[0002] With the popularization of smart mobile terminals and the rapid development of mobile Internet technology, terminal software such as news reading, social media information flow, and high-definition image library have become the main carriers for users to obtain information. These terminal software contain a large number of high-resolution images. In order to reduce network transmission bandwidth and save device storage space, image compression algorithms such as JPEG and WebP are usually used to encode and transmit images, and then decode and restore them when the terminal software needs to display them.

[0003] However, existing image compression and restoration technologies have a very subtle engineering pain point: traditional image processing architectures completely separate the encoding and decoding process of static images from the dynamic interactive behavior of users on terminal software. In real-world applications, users are often in a state of rapid up and down scrolling when browsing information streams. Under this high-frequency interactive state, existing decoding engines will still perform full-volume high-precision decoding of all high-definition images on the screen and in the pre-loaded area according to predetermined logic. Due to the visual dynamic blurring characteristics of the human eye when observing fast-moving objects, the high-frequency image details that are forcibly rendered by consuming a large amount of CPU and GPU computing resources cannot be clearly perceived by users at all. Instead, the massive amount of computation that bursts in an instant will cause rendering thread congestion, resulting in severe frame drops, stuttering, and abnormal overheating of terminal devices. This static and blind full-volume decoding mechanism seriously disrupts the balance between high-resolution visual experience and limited terminal computing resources.

[0004] Therefore, how to balance improving the high-resolution visual experience with limited terminal computing resources has become an urgent problem to be solved. Summary of the Invention

[0005] This invention provides an image compression and restoration method and apparatus for terminal software to solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides an image compression and restoration method for terminal software, comprising: S101, Obtain the image to be processed and the current window interaction state sequence of the terminal software; S102, extract the local texture gradient features of the image to be processed, and calculate the multi-dimensional retinal dwell probability matrix in combination with the window interaction state sequence; S103, based on the multi-dimensional retinal dwell probability matrix, the image to be processed is spatially segmented to obtain several image blocks, an adaptive frequency domain quantization step size is assigned to different image blocks, and the corresponding low-frequency basic residual and high-frequency directional residual are extracted. S104, the low-frequency fundamental residual and the high-frequency directional residual are asymmetrically encoded according to the frequency domain quantization step size to generate a structured compressed bitstream; S105, when the image restoration command is triggered, the structured compressed bitstream is parsed to obtain the basic reconstruction image and local detail compensation features; S106, dynamically adjust the fusion weight of the local detail compensation features according to the real-time rendering frame rate of the current terminal software, and superimpose the local detail compensation features onto the base reconstruction map to generate the target restored image.

[0007] Optionally, the step of extracting local texture gradient features of the image to be processed and calculating a multi-dimensional retinal dwell probability matrix in conjunction with the window interaction state sequence includes: S1021, Perform multi-scale edge detection on the image to be processed to obtain the gradient magnitude and gradient direction of each pixel as the local texture gradient feature; S1022, Extract the sliding speed vector and touch hold coordinates from the window interaction state sequence; S1023, the local texture gradient features, the sliding speed vector, and the touch dwell coordinates are input into a pre-set attention decay function for spatial mapping to generate the corresponding multi-dimensional retinal dwell probability matrix.

[0008] Optionally, the step of spatially segmenting the image to be processed based on the multi-dimensional retinal dwell probability matrix to obtain several image blocks, assigning adaptive frequency domain quantization step sizes to different image blocks, and extracting the corresponding low-frequency fundamental residuals and high-frequency directional residuals includes: S1031, the image to be processed is spatially segmented according to a preset size to obtain several image blocks, and the average probability of each image block in the multi-dimensional retinal dwell probability matrix is ​​calculated. S1032, determine whether the average probability value is greater than a preset attention threshold; S1033, if the probability mean is greater than the attention threshold, then a fine quantization step size is allocated, and a discrete wavelet transform is performed on the image block to extract the first low-frequency sub-band as the low-frequency basic residual and to extract high-frequency sub-bands in multiple directions as the high-frequency directional residual. S1034, if the probability mean is not greater than the attention threshold, then a coarse quantization step size is allocated, and the image block is downsampled to extract the pixel mean as the low-frequency basic residual while discarding the high-frequency directional residual.

[0009] Optionally, the step of asymmetric encoding the low-frequency fundamental residual and the high-frequency directional residual according to the frequency domain quantization step size to generate a structured compressed bitstream includes: S1041, Extract the frequency domain quantization step size and convert it into quantization control flag bits, then write it into the bitstream header; S1042, The low-frequency basic residual is losslessly compressed using a run-length encoding algorithm to generate a basic code stream segment; S1043, a context-adaptive arithmetic coding algorithm is used to perform lossy compression on the high-frequency directional residual to generate detail bitstream segments; S1044, The quantization control flag, the basic bitstream segment, and the detail bitstream segment are sequentially concatenated to generate the structured compressed bitstream.

[0010] Optionally, the step of parsing the structured compressed bitstream to obtain the basic reconstructed map and local detail compensation features includes: S1051, Extract the quantization control flag from the header of the structured compressed bitstream to determine the decoding mode of the current block; S1052, Based on the decoding mode, perform inverse run-length decoding and inverse wavelet transform on the basic code stream segment to generate the basic reconstruction map; S1053, perform inverse arithmetic decoding on the detail bitstream segment to generate the local detail compensation feature containing texture direction information.

[0011] Optionally, the step of dynamically adjusting the fusion weights of the local detail compensation features according to the real-time rendering frame rate of the current terminal software, and superimposing the local detail compensation features onto the base reconstruction map to generate the target restored image, includes: S1061, Real-time acquisition of the current video memory usage rate of the terminal software operating system and the real-time rendering frame rate of the screen refresh cycle; S1062, Construct a frame rate negative feedback adjustment mechanism. When the real-time rendering frame rate is lower than the preset smoothness threshold, the fusion weight of the local detail compensation feature is reduced proportionally. S1063, perform matrix addition on the pixel matrix of the basic reconstructed image and the local detail compensation feature matrix multiplied by the fusion weight to generate the target restored image and submit it to the rendering pipeline of the terminal software.

[0012] Optionally, the step of inputting the local texture gradient features, the sliding velocity vector, and the touch dwell coordinates into a pre-defined attention decay function for spatial mapping to generate the corresponding multi-dimensional retinal dwell probability matrix includes: S10231, decompose the sliding velocity vector into a horizontal translation component and a vertical translation component; S10232, A Gaussian attenuation mask centered on the touch stop coordinate is established based on the touch stop coordinate; S10233, Perform a dot product operation between the local texture gradient features and the Gaussian decay mask to obtain a static gaze feature matrix; S10234, a motion blur cancellation factor containing the horizontal translation component and the vertical translation component is introduced to dynamically compensate and map the static gaze feature matrix to generate the multi-dimensional retinal dwell probability matrix.

[0013] Optionally, after the step of proportionally reducing the fusion weight of the local detail compensation feature, the method further includes: S10621, Extract the pixel offset of the target image to be restored in the previous frame, and calculate the expected rendering delay time in combination with the real-time rendering frame rate; S10622, Determine whether the expected rendering delay time exceeds the vertical synchronization cycle of the screen hardware; S10623, if the vertical synchronization period is exceeded, the fusion weight is directly set to zero, and the smoothed image generated by the low-frequency basic residual is extracted as a temporary placeholder frame for display until the expected rendering delay time is restored to within the vertical synchronization period and the original fusion weight is restored.

[0014] Optionally, the step of extracting high-frequency sub-bands in multiple directions as the high-frequency directional residual includes: S10331, After extracting the first low-frequency sub-band, perform energy concentration verification and calculate the corresponding energy percentage for the high-frequency sub-bands in multiple directions; S10332, Select the dominant high-frequency subband whose energy percentage exceeds a preset energy threshold as the effective high-frequency directional residual; S10333, record the spatial direction index of the dominant high-frequency sub-band, and then logically bind the spatial direction index with the corresponding fine quantization step size and inject it into the extended field of the structured compressed bitstream.

[0015] To address the aforementioned problems, the present invention also provides an image compression and restoration apparatus for terminal software, the apparatus comprising: The first processing module is used to: acquire the image to be processed and the window interaction state sequence of the current terminal software, so as to provide basic data support for subsequent image compression processing; The second processing module is used to: perform multi-scale edge detection on the image to be processed to extract the gradient magnitude and gradient direction of the pixel points as local texture gradient features, extract the sliding speed vector and touch dwell coordinates in the window interaction state sequence, perform spatial mapping through the attention decay function, and generate a multi-dimensional retinal dwell probability matrix. The third processing module is used to: spatially segment the image to be processed according to a preset size to obtain several image blocks, calculate the probability mean corresponding to each block and compare it with the attention threshold, allocate a fine quantization step size to high attention blocks and extract low-frequency basic residuals and dominant high-frequency direction residuals, allocate a coarse quantization step size to low attention blocks and extract the pixel mean as low-frequency basic residuals. The fourth processing module is used to: convert the frequency domain quantization step size into quantization control flag bits and write them into the bitstream header; use run-length encoding to perform lossless compression of the low-frequency basic residual; use context-adaptive arithmetic encoding to perform lossy compression of the high-frequency directional residual; and time-sequentially concatenate the quantization control flag bits, the basic bitstream segment, and the detail bitstream segment to generate a structured compressed bitstream. The fifth processing module is used to: extract quantization control flags from the header of the structured compressed bitstream to determine the decoding mode; perform inverse run-length decoding and inverse wavelet transform on the basic bitstream segment to generate the basic reconstruction map; and perform inverse arithmetic decoding on the detail bitstream segment to generate local detail compensation features. The sixth processing module is used to: obtain the video memory usage and real-time rendering frame rate of the terminal software in real time, dynamically adjust the fusion weight of the local detail compensation features through the frame rate negative feedback adjustment mechanism, perform matrix addition operation on the compensation features after superimposed weights and the basic reconstruction map, generate the target restored image and submit it to the rendering pipeline, and switch to smooth placeholder frame display in extreme cases.

[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention generates a multi-dimensional retinal dwell probability matrix by combining window interaction state sequences with local image texture gradient features, thereby achieving attention level classification and adaptive frequency domain quantization step size allocation for image blocks. This solves the problem of loss of key details or wasted bandwidth in non-interested areas caused by global uniform compression in traditional image compression. It accurately preserves details of core attention areas such as touch dwell and high texture at high compression ratios, while maximizing the simplification of non-interested area data, significantly reducing the transmission and storage overhead of terminal software.

[0017] 2. Based on the real-time rendering frame rate of the terminal software, the fusion weight of local detail compensation features is dynamically adjusted. Combined with the smooth placeholder frame mechanism in extreme scenarios, the problem of image restoration being prone to stuttering and tearing when the terminal performance fluctuates is solved. The compression restoration is dynamically adapted to the terminal's running state, which not only ensures a smooth interactive experience, but also presents high-definition details when the performance is sufficient. It is suitable for the image processing needs of various terminal software such as office software, short video applications, and games. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating an image compression and restoration method for terminal software according to an embodiment of the present invention. Figure 2 A functional block diagram of an image compression and restoration device for terminal software provided in an embodiment of the present invention; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0019] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0020] This application provides an image compression and restoration method for terminal software. The executing entity of this image compression and restoration method for terminal software includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the image compression and restoration method for terminal software can be executed by software or hardware installed on a terminal device or a server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content, Delivery, Network, CDN), and big data and artificial intelligence platforms.

[0021] Reference Figure 1 The diagram shown is a flowchart illustrating an image compression and restoration method for terminal software according to an embodiment of the present invention. In this embodiment, the image compression and restoration method for terminal software includes: S101, Obtain the image to be processed and the current window interaction state sequence of the terminal software; S102, extract the local texture gradient features of the image to be processed, and calculate the multi-dimensional retinal dwell probability matrix in combination with the window interaction state sequence; S103, based on the multi-dimensional retinal dwell probability matrix, the image to be processed is spatially segmented to obtain several image blocks, an adaptive frequency domain quantization step size is assigned to different image blocks, and the corresponding low-frequency basic residual and high-frequency directional residual are extracted. S104, the low-frequency fundamental residual and the high-frequency directional residual are asymmetrically encoded according to the frequency domain quantization step size to generate a structured compressed bitstream; S105, when the image restoration command is triggered, the structured compressed bitstream is parsed to obtain the basic reconstruction image and local detail compensation features; S106, dynamically adjust the fusion weight of the local detail compensation features according to the real-time rendering frame rate of the current terminal software, and superimpose the local detail compensation features onto the base reconstruction map to generate the target restored image.

[0022] In some embodiments, the image to be processed and the current window interaction state sequence of the terminal software are acquired.

[0023] Specifically, the process involves acquiring the image to be processed, which is the original bitmap data matrix that will be rendered and displayed on the terminal interface; calling the touch event listening interface and sensor status interface at the terminal software's underlying level to extract the current window interaction state sequence of the terminal software, which is a data set including a screen swiping speed vector with timestamps and a finger touch stop coordinate; storing the acquired image to be processed in the first video memory buffer, and converting the window interaction state sequence into a one-dimensional time series vector for subsequent matrix operation alignment; taking a mobile text and image streaming application as an example, when a user is browsing a high-definition photography article, a landscape image with a resolution of 4,000 by 3,000 pixels is extracted from the underlying data stream as the image to be processed. At the same time, the listening interface captures that the user is currently swiping the screen upwards at a speed of 120 pixels per second, and the touch stop coordinate is located in the scroll trigger area slightly below the center of the screen. These swiping and touch data with time stamps together constitute the window interaction state sequence at the current moment.

[0024] By using the acquired window interaction state sequence as the initial data foundation, highly real-time context parameters are provided for subsequent on-demand decoupling and dynamic weight allocation processing. This ensures that the image compression and restoration logic closely matches the user's actual operational intentions and visual physiological needs on the terminal software, eliminating blind processing from the source of information input.

[0025] In some embodiments, local texture gradient features of the image to be processed are extracted, and a multi-dimensional retinal dwell probability matrix is ​​calculated in combination with the window interaction state sequence.

[0026] Specifically, an edge detection operator is applied to the pixel matrix of the image to be processed to perform spatial convolution, calculating the degree of texture change at each pixel location, i.e., the local texture gradient feature. The window interaction state sequence is analyzed to extract the potential focal region and motion trend of the user's gaze. A mapping function is established to numerically fuse the local texture gradient feature with the potential focal region and motion trend of the gaze, generating a probability distribution matrix corresponding to the resolution of the image to be processed, i.e., a multi-dimensional retinal dwell probability matrix. Taking the image to be processed containing complex leaf textures and a solid-color sky background as an example, the Sobel operator is first used to scan the image to extract the high-value local texture gradient features of the leaf region. At the same time, the user's touch dwell coordinates in the window interaction state sequence are identified as being located in the leaf region in the lower left corner of the image. After these features are input into the mapping function for calculation, a matrix is ​​generated. In this matrix, the value corresponding to the lower left leaf region is mapped to a high dwell probability of 0.85, while the sky region and regions far from the touch point are mapped to a low dwell probability of 0.2, forming an accurate multi-dimensional retinal dwell probability matrix.

[0027] Based on the collaborative calculation of the dwell probability matrix using local texture gradient features and interaction state sequences, the objective image content complexity and the subjective user visual focus are deeply fused numerically. This mechanism can accurately locate the high-frequency detail areas that the human eye will actually pay attention to and can see clearly in the current interaction scene, providing a high-precision spatial navigation map for subsequent asymmetric frequency domain decoupling and quantization processing, avoiding a one-size-fits-all approach to processing the entire image.

[0028] In some embodiments, the image to be processed is spatially segmented based on the multi-dimensional retinal dwell probability matrix to obtain several image blocks, an adaptive frequency domain quantization step size is assigned to different image blocks, and the corresponding low-frequency basic residual and high-frequency directional residual are extracted.

[0029] Specifically, the image to be processed is uniformly cropped according to a fixed pixel grid size to generate multiple independent two-dimensional pixel subsets, i.e., image blocks. Each image block is traversed, and the probability value it covers in the multi-dimensional retinal persistence probability matrix is ​​retrieved and its average value is calculated. This average value is input into a stepped quantization mapping table to match a corresponding frequency domain quantization step size for the image block, which is used to control the subsequent frequency domain feature preservation accuracy. The allocated quantization step size controls the discrete frequency domain transformation algorithm to separate the low-frequency basic residual reflecting the basic color contour and the details from the image blocks. High-frequency directional residuals of texture undulations; taking the image to be processed as a 16x16 pixel grid segmentation as an example, for the first segmented image block, its probability mean is 0.8, which matches a fine frequency domain quantization step size with a very small step size. Then the algorithm extracts the smooth low-frequency basic residuals and rich edge high-frequency directional residuals of the block. For the second segmented image block, its probability mean is only 0.15, which maps to a coarse frequency domain quantization step size with a very large step size. At this time, the algorithm only extracts its basic color block mean as low-frequency basic residuals and directly discards its weak high-frequency directional residuals to zero.

[0030] By directly linking the dwell probability to the frequency domain quantization step size, fine-grained adaptive decoupling of the image space is achieved. For high-probability dwell areas, all high- and low-frequency residuals are retained to maintain image quality. For non-focal or dynamically blurred areas that users will not pay attention to, high-frequency directional residuals are decisively discarded. This asymmetric feature extraction logic greatly eliminates redundant information data in the image without causing a decline in the user's subjective visual quality, fundamentally reducing the pressure on subsequent encoding and transmission.

[0031] In some embodiments, the low-frequency fundamental residual and the high-frequency directional residual are asymmetrically encoded according to the frequency domain quantization step size to generate a structured compressed bitstream.

[0032] Specifically, the process involves reading the frequency domain quantization step size data set for each image block and converting it into a binary control command header; calling a lossless data compression algorithm to linearly sequence and package the low-frequency basic residuals of the basic contour to be reconstructed; calling a context-aware probabilistic lossy compression algorithm to perform dimensionality reduction and reconstruction for the high-frequency directional residuals, which have a large data volume and allow for some precision loss; and concatenating the command header, basic compressed package, and detail compressed package into a physical bitstream according to a unified transmission protocol format to output the final binary file, i.e., the structured compressed bitstream. Taking the generation of a complete data packet as an example, the quantization step size identified as fine quantization is first converted into an eight-bit width command header and written to the beginning of the file; then, the low-frequency basic residuals are fed into the encoder for linear packaging to eliminate consecutive repeated values, generating a basic compressed segment with a length of two thousand bytes; finally, the high-frequency directional residuals are fed into the probabilistic model to discard secondary features, generating a detail compressed segment with a length of five thousand bytes; and finally, the command header, basic compressed segment, and detail compressed segment are tightly concatenated to generate a highly structured compressed bitstream with a total length of approximately seven thousand bytes.

[0033] Through the aforementioned features, its technical advantages lie in: employing differentiated asymmetric coding strategies for the data characteristics of low-frequency fundamental residuals and high-frequency directional residuals; using lossless compression for the basic contours to ensure the absolute stability of the overall image structure; and using lossy probabilistic compression for the detail residuals to maximize data volume reduction. This structured bitstream organization not only significantly improves the overall compression ratio, but more importantly, its built-in quantization instruction header provides a clear decoding roadmap for the reconstruction end, supporting on-demand hierarchical decoding.

[0034] In some embodiments, when an image restoration command is triggered, the structured compressed bitstream is parsed to obtain the basic reconstruction map and local detail compensation features. Specifically, the view visibility callback function of the monitoring terminal software receives the image restoration command; the received structured compressed bitstream is decomposed at the bit level, and the compression status and mode markers corresponding to each image block are read; the separated basic compressed segment data is input into the reverse decoding pipeline for reverse data decompression and spatial domain reconstruction operations to generate an image matrix containing only smooth color transitions but without sharp edges, i.e., the basic reconstruction map; simultaneously, the separated detail compressed segment data is input into the corresponding reverse dimension reduction decoding pipeline to extract the high-frequency fluctuating numerical array, i.e., the local detail compensation features. In this asynchronous parallel processing, a double-buffered queue handover mechanism is established, allowing the basic bitstream decoding thread to write the generated basic reconstruction map into the read-only locked main rendering buffer. The decoding thread of the detail stream writes the parsed feature data into an independent feature compensation buffer. Then, it uses a spinlock semaphore to synchronize the state with the main rendering loop to prevent deadlock or screen tearing between the two independent threads during weight updates and image merging. Taking the user sliding to a new image on the terminal to trigger the rendering visibility instruction as an example, the decoding engine quickly peels off the header of the structured compressed stream and extracts the different mode markers for the background and core areas. Then, the pipeline first reverses the basic compressed segment to restore a blurry, smooth landscape image with a resolution of 1,000 by 1,000 but without any texture details as the basic reconstruction image and pushes it into the main rendering buffer. At the same time, the independent parallel pipeline quickly decompresses a set of high-frequency numerical arrays recording the direction of tree branches and the sharpness of leaf edges from the detail compressed segment as local detail compensation features and pushes them into an independent buffer pool, and releases a synchronization signal to the main loop to complete the safe handover.

[0035] By stripping and parsing the structured compressed bitstream, the basic skeleton and detailed details of the image are physically separated in the terminal memory. This decoupled data recovery mechanism, combined with the strict clock synchronization control of the underlying double-buffered queue and spinlock semaphore, enables the terminal software to have efficient control over image quality in a hierarchical and secure manner without deadlock. Unlike traditional decoders, it does not need to wait for the entire data to be decompressed before proceeding to the next step, greatly shortening the visible delay time of the first frame image.

[0036] In some embodiments, the fusion weight of the local detail compensation features is dynamically adjusted according to the real-time rendering frame rate of the current terminal software, and the local detail compensation features are superimposed on the base reconstruction map to generate the target restored image.

[0037] Specifically, in the main rendering loop of the terminal operating system, the screen refresh drawing time is periodically detected and the current frame refresh frequency, i.e., the real-time rendering frame rate, is calculated; the difference between the real-time rendering frame rate and the preset smoothness benchmark value is calculated; a floating-point multiplier factor between zero and one, i.e., the fusion weight, is generated using this difference; each value in the obtained local detail compensation feature matrix is ​​multiplied with the fusion weight, and then the coordinates are aligned and added to the corresponding pixel point of the basic reconstruction map, and finally merged to generate the target restored image that can be directly submitted to the graphics card buffer. Taking a terminal screen with a hardware refresh rate of 60 Hz as an example, when the user slowly swipes the screen, the real-time rendering frame rate is detected to be stable at 58 frames per second. The system calculates that the difference is minimal and sets the fusion weight to 1.0. At this time, all local detail compensation features are fully superimposed on the base reconstruction image to present a target restored image with perfect image quality. However, when the user suddenly accelerates and swipes the screen frantically, causing the CPU load to surge and the real-time rendering frame rate to plummet to 20 frames per second, the system quickly and dynamically adjusts the fusion weight to 0.1 or even 0. At this time, the local detail compensation features are greatly weakened or discarded, and the base reconstruction image is directly output as the target restored image. Because the complex high-frequency calculations are abandoned, the frame rate instantly rises to 60 frames per second to ensure the ultimate smoothness of the swipe.

[0038] Through the above features, its technical effects are as follows: it completely solves the performance deadlock problem of traditional terminal software when processing high-definition images and high-frequency UI interactions; by introducing the negative feedback indicator of real-time rendering frame rate to dynamically intervene in detail fusion weight, it establishes an elastic rendering mechanism that ensures smoothness when computing power is tight and maintains image quality when computing power is abundant; and it decisively reduces dimensions in the high-speed scrolling state where users cannot see details at all, which greatly alleviates the peak computing power pressure and heat generation of the terminal and achieves the optimal solution for resource allocation.

[0039] In some embodiments, multi-scale edge detection is performed on the image to be processed to obtain the gradient magnitude and gradient direction of each pixel as local texture gradient features; the sliding speed vector and touch dwell coordinates in the window interaction state sequence are extracted; the local texture gradient features, sliding speed vector and touch dwell coordinates are input into a pre-set attention decay function for spatial mapping to generate a corresponding multi-dimensional retinal dwell probability matrix.

[0040] Specifically, various convolutional kernels of different sizes are used to perform smoothing and difference operations on the image to be processed, and the derivatives of each coordinate pixel in the horizontal and vertical directions are calculated respectively. This is used to calculate the edge sharpness (gradient magnitude) and the edge tilt angle (gradient direction), which together constitute the local texture gradient features. The pixel displacement ratio of the current finger swipe (sliding velocity vector) and the absolute screen position of the last press (touch hold coordinates) are parsed from the touch event queue reported by the operating system. Using the orthogonal decomposition rule, the sliding velocity vector, which represents the overall direction and speed of the user's finger swipe, is decomposed into two independent physical quantities along the X and Y axes of the screen: a horizontal translation component and a vertical translation component. The obtained touch-hold coordinates are used as the core origin. A Gaussian attenuation mask, with the highest value at the center and decreasing in a bell-shaped pattern around the edges, is generated in memory based on a probability density function that attenuates inversely with distance. The extracted image texture complexity matrix, i.e., the local texture gradient features, is multiplied element-wise (dot multiplication) with the Gaussian attenuation mask in the same spatial coordinate system to generate a feature matrix reflecting the user's visual focus in a non-slip state (static gaze feature matrix). The velocity bias variable, i.e., the motion blur cancellation factor, containing the horizontal and vertical translation components, is substituted into this static gaze feature matrix for offset correction and motion blur filtering (dynamic compensation mapping). The specific application formula is as follows: The mathematical model, in which, For pixels ( The probability of retinal persistence; For touch center Center of the circle Gaussian decay function of standard deviation The directional attenuation coefficient; , The horizontal and vertical translation components of the swipe velocity vector are used to output a multi-dimensional retinal persistence probability matrix that integrates spatiotemporal states. Taking a user swiping from the center of the screen to the upper right corner as an example, the swipe velocity vector in the northeast direction is first precisely decomposed into a horizontal translation component of 30 pixels per second and a vertical translation component of 40 pixels per second. Then, a Gaussian attenuation mask with a center weight of 1 and a weight decreasing to 0.1 at the edges is constructed using the touch coordinates at the center of the screen. The local texture gradient features of the original image are multiplied by this mask to quickly filter out invalid background textures at the screen edges, resulting in a static gaze feature matrix. Finally, a motion blur cancellation factor pointing to the upper right is introduced and substituted into the attenuation probability mathematical model with defined parameters. The high-probability region of the static matrix is ​​forced to be deformed and extended towards the expected browsing path to the upper right, ultimately calculating a multi-dimensional retinal persistence probability matrix that accurately predicts the user's next gaze point. Through the above features, the technical effect is that a two-layer rigorous calculation logic of static spatial focusing followed by dynamic temporal compensation is designed for the generation process of the attention probability matrix. The complex sliding motion is precisely decomposed into orthogonal translation components, and a motion blur cancellation mechanism based on explicit mathematical expressions is creatively introduced to correct the deformation of the Gaussian attenuation mask. This mathematical processing method completely eliminates the focus shift lag caused by rapid sliding, giving the probability matrix a strong forward prediction capability and greatly improving the accuracy of image decoupling processing in the time dimension.

[0041] In some embodiments, the image to be processed is spatially segmented according to a preset size to obtain several image blocks, and the mean probability of each image block in the multi-dimensional retinal dwell probability matrix is ​​calculated; it is determined whether the mean probability is greater than a preset attention threshold; if the mean probability is greater than the attention threshold, a fine quantization step size is allocated, and a discrete wavelet transform is performed on the image block to extract the first low-frequency sub-band as the low-frequency basic residual and to extract high-frequency sub-bands in multiple directions as high-frequency directional residuals; if the mean probability is not greater than the attention threshold, a coarse quantization step size is allocated, and a downsampling operation is performed on the image block to extract the pixel mean as the low-frequency basic residual while discarding the high-frequency directional residuals.

[0042] Specifically, the original image is divided into independent grid units, or image blocks, according to a regular rectangular network. The sum of all probability matrix values ​​within each image block is then divided by the total number of pixels to obtain the average probability representing the overall attention level of that block. A logical comparison branch is established to compare this average probability with a pre-defined benchmark value, i.e., an attention threshold. When the average exceeds the threshold, a small rounding divisor (fine quantization step size) is specified, and a spatial frequency decomposition algorithm based on multi-scale filters (discrete wavelet transform) is initiated to extract the first low-frequency sub-band representing a smooth background and the high-frequency sub-band representing sharp edges in each direction, saving them as the low-frequency fundamental residual and the high-frequency directional residual, respectively. Conversely, when the average does not reach the threshold, a very large rounding divisor (coarse quantization step size) is specified, the energy-intensive transform algorithm is disabled, and a simple pixel-based approach is used instead. Pooling compression, or downsampling, obtains the average color block as the low-frequency baseline residual while thoroughly cleaning up all complex high-frequency directional residuals. Taking a high-resolution portrait image of 800x800 as an example, it is divided into many image blocks of size 32x32. The image block located in the eye features of the person is calculated to have a mean probability of 0.9, which is much greater than the attention threshold of 0.6. A fine quantization step size of 2 is then assigned, and discrete wavelet transform is used to perfectly separate the first low-frequency subband of smooth skin and the horizontal and vertical high-frequency subbands containing eyelash details. The image block located in the pure white background at the edge has a mean probability of only 0.1, which is less than the attention threshold. Therefore, a coarse quantization step size of 64 is directly assigned, and the block is flattened into a single white pixel mean by downsampling by four times, discarding all high-frequency residuals of background noise.

[0043] A rigorous dynamic triage mechanism for low-level feature extraction based on attention threshold feedback was established. Through strong verification of probability mean and attention threshold, dynamic start and stop of algorithm computing power was realized at the microscopic image block level. Complex discrete wavelet transform was used in high attention areas to ensure lossless detail, while low attention areas were directly reduced to a simplified mean downsampling, avoiding the huge waste of computing power caused by traditional global wavelet transform. The highly targeted differentiated feature processing logic was implemented at the underlying mathematical calculation level.

[0044] In some embodiments, the frequency domain quantization step size is extracted and converted into a quantization control flag bit, which is then written into the bitstream header. A run-length encoding algorithm is used to losslessly compress the low-frequency fundamental residual to generate a fundamental bitstream segment. A context-adaptive arithmetic coding algorithm is used to lossily compress the high-frequency directional residual to generate a detail bitstream segment. The quantization control flag bit, the fundamental bitstream segment, and the detail bitstream segment are then sequentially concatenated to generate a structured compressed bitstream.

[0045] Specifically, the frequency domain quantization step size value for determining the compression mode of each block is extracted, transcoded into compact flag register data (i.e., quantization control flag bits), and placed in the first byte region of the output file; for the low-frequency basic residual with a large amount of continuous and smooth data, a lossless compression technique that statistically calculates the length of continuous repeating data (i.e., run-length encoding algorithm) is called to fold the sequence and generate a small basic bitstream segment; for the high-frequency directional residual with uneven numerical distribution, a lossy compression technique that dynamically adjusts the probability interval according to the preceding and following data streams (i.e., context-adaptive arithmetic coding algorithm) is introduced to squeeze out the most detailed bitstream segment; according to the preceding and following dependencies of data transmission, the flag bits, basic code, and detailed code are linearly merged and recombined in memory into a single continuous bitstream (i.e., structured compressed bitstream). Taking the compression of an image block from which residuals have been extracted as an example, the quantization step size corresponding to the fine mode is extracted and converted to a quantization control flag of 10 and placed in the packet header; for one hundred consecutive pixel values ​​of 200 in the low-frequency basic residual, the run-length encoding algorithm losslessly folds and compresses them into a very simple basic bitstream segment of 100:200; for the messy texture values ​​in the high-frequency directional residual, the arithmetic encoding algorithm establishes a dynamic interval dictionary based on the context probability distribution and lossily compresses them into very short decimals as detail bitstream segments; finally, the 10, basic bitstream segment, and detail bitstream segment are concatenated according to strict byte alignment rules to generate a structured compressed bitstream that can be directly sent by the network protocol.

[0046] Based on the aforementioned features, its technical effectiveness lies in precisely matching two compression algorithms with completely different principles to the drastically different mathematical and statistical distribution characteristics exhibited by the extracted low-frequency and high-frequency data. Run-length encoding perfectly matches the continuous repetition characteristic of low-frequency data, achieving efficient folding while ensuring absolute losslessness; while adaptive arithmetic encoding maximizes the digestion of the discreteness of high-frequency data. This dual-engine asymmetric coding architecture, coupled with clear bitstream header identifiers, significantly breaks through the compression rate bottleneck of a single encoder when dealing with complex frequency domain data.

[0047] In some embodiments, quantization control flags are extracted from the header of the structured compressed bitstream to determine the decoding mode of the current block; based on the decoding mode, inverse run-length decoding and inverse wavelet transform are performed on the base bitstream segment to generate a base reconstruction map; and inverse arithmetic decoding is performed on the detail bitstream segment to generate local detail compensation features containing texture direction information.

[0048] Specifically, in the initial stage of file data reading, the blind loading of subsequent data is blocked. The quantization control flag is extracted from the starting memory address of the structured compressed bitstream first, and a lookup table operation is used to determine whether the current data block belongs to the coarse or fine decoding mode. According to the determined decoding mode routing instructions, the basic bitstream segment is sent to the reverse parsing pipeline to restore the continuous repeating sequence and the spatial pixel matrix is ​​restored using the reverse filter bank to generate the basic reconstruction map. Simultaneously, the detailed bitstream segment is sent to the decoder based on the probability back-inference mechanism to restore the edge with a specific angle. The high-frequency matrix of the fluctuation feature is the local detail compensation feature. Taking a data packet received by the decoding end as an example, the decoder first accurately intercepts the identifier bit 10 in the header, and determines from the table that the block needs to perform fine recovery mode. Then, according to the fixed pipeline of this mode, the basic bit stream segment 100:200 inverse run is expanded into one hundred real pixel values, and the inverse wavelet transform is used to construct a basic reconstruction map with soft color for the block. Then, the detail bit stream segment in the second half is sent to the inverse arithmetic decoder, and the feature matrix containing the fine leaf vein texture information in the diagonal direction is restored by the inverse mapping of the probability interval as the local detail compensation feature.

[0049] Through the above features, its technical effects are as follows: a conditional branch decoding pipeline strongly driven by header identifier bits is constructed; this parsing mechanism allows terminal software to deconstruct and process the bitstream on demand without destroying the overall file structure; the priority lossless generation of the basic reconstruction map ensures the basic usability of the picture, while the independent decoding of detail compensation features prepares for subsequent dynamic fusion, enabling the originally highly coupled compressed bitstream to achieve perfect logical dissection in the terminal device memory.

[0050] In some embodiments, after the step of proportionally reducing the fusion weight of the local detail compensation features, the pixel offset of the target restored image of the previous frame is extracted, and the expected rendering delay time is calculated in combination with the real-time rendering frame rate; it is determined whether the expected rendering delay time exceeds the vertical synchronization cycle of the screen hardware; if it exceeds the vertical synchronization cycle, the fusion weight is directly set to zero, and the smoothed image generated by the low-frequency basic residual is extracted as a temporary placeholder frame for display, until the expected rendering delay time is restored to within the vertical synchronization cycle and the original fusion weight is restored.

[0051] Specifically, the pixel offset of the target image in the previous frame is extracted by comparing the overall pixel difference between the current and previous frames in the screen coordinate system. This offset is then divided by the currently recorded real-time rendering frame rate to calculate the estimated time required for the rendering engine to process and output the next frame, i.e., the expected rendering delay time. The refresh interval signal parameters at the display hardware level are then queried to determine whether the estimated time breaks the fixed physical refresh rate, i.e., whether the expected rendering delay time exceeds the vertical synchronization cycle of the screen hardware. Once a timeout is detected, a circuit breaker mechanism is triggered, forcibly reducing the superposition density coefficient of the local detail compensation feature, i.e., the fusion weight, to zero. A Gaussian smooth style frame without any details, i.e., a smooth image, is directly rendered using the basic color matrix containing only the low-frequency basic residual as a transition frame, i.e., a temporary placeholder frame, and forcibly pushed into the video memory for display. This process continues until the system delay state is resolved, i.e., the expected rendering delay time is released. The system recovers to the vertical synchronization cycle after a delay, then cancels the circuit breaker and restores the original fusion weight parameters. Taking a terminal supporting a 120Hz high refresh rate screen as an example, its physical vertical synchronization cycle is fixed at approximately 8.3 milliseconds. When the system detects that the user is performing a rapid swipe operation to return to the top with one click, it extracts a huge offset of 100 pixels from the previous frame. Combined with the plummeting frame rate, it calculates that the expected rendering delay time is as high as 20 milliseconds, which seriously exceeds the 8.3 millisecond vertical synchronization cycle. The system immediately triggers the circuit breaker mechanism, forcibly reducing the fusion weight to zero to completely cut off the detailed feature calculation. It directly extracts the lowest-level low-frequency basic residual to generate a smooth image that only shows the outline of color blocks as a temporary placeholder frame, which is then inserted into the video memory and forced to refresh the display on time to ensure that the screen does not tear or freeze. After several frames, when the swiping stops and the estimated delay drops back to 5 milliseconds, the fusion weight is redistributed by 100%, instantly restoring the ultimate clarity of the screen.

[0052] Based on the conventional frame rate negative feedback adjustment mechanism, an extreme circuit breaker protection strategy based on pixel offset and vertical synchronization period is further introduced. Traditional negative feedback usually has a response time difference, while this feature predicts the expected rendering delay time in advance and decisively sets the weight of high-frequency features to zero before catastrophic frame drops and stuttering occur. By using extremely smooth low-frequency placeholder frames to forcibly maintain the hardware synchronization rhythm of the screen, the screen tearing and freezing problems of terminal software under extreme high load scrolling scenarios are completely eliminated.

[0053] In some embodiments, after extracting the first low-frequency sub-band, the energy concentration of the high-frequency sub-bands in multiple directions is checked and the corresponding energy ratio is calculated; the dominant high-frequency sub-bands with energy ratios exceeding a preset energy threshold are selected as valid high-frequency directional residuals; the spatial direction index of the dominant high-frequency sub-band is recorded, and the spatial direction index is logically bound to the corresponding fine quantization step size and injected into the extended field of the structured compressed bitstream.

[0054] Specifically, after completing the initial frequency separation and extracting the first low-frequency sub-band, wavelet coefficient root mean square summation is performed on the high-frequency domain matrices in multiple different directions, such as horizontal, vertical, and diagonal, to evaluate the density of the information carried, i.e., to perform energy concentration verification, based on the calculated expression. Calculate the energy value representing the proportion of a single subband coefficient; where, The energy percentage of a high-frequency subband in a certain direction; For the first High-frequency subbands in each direction ( Wavelet coefficients of position; × This refers to the dimensions of the high-frequency subband; The total number of directions in the high-frequency subbands is calculated. The energy ratio of each direction is compared with a predefined numerical baseline for filtering meaningless noise, i.e., a preset energy threshold. Directional matrices that exceed the baseline and truly contain obvious physical structure textures are extracted, i.e., the dominant high-frequency subbands with energy ratios exceeding the preset energy threshold are selected as effective high-frequency directional residuals that can participate in subsequent coding. Each extracted matrix is ​​assigned a numerical number representing its spatial orientation characteristics, i.e., a spatial direction index. Then, an association mapping dictionary is established, and these numbers are packaged and merged with the fine quantization step size data used to control compression accuracy. Finally, they are encapsulated into the custom additional information area, i.e., the extended field, at the end of the structured compressed bitstream. Taking the processing of an image block containing blinds as an example, after separating the first low-frequency sub-band, the algorithm performs energy concentration verification calculation on the three high-frequency sub-bands according to the formula. It finds that the sub-band representing the root mean square coefficient of the blind blades in the horizontal direction has an energy ratio as high as 80%, while the vertical and diagonal directions only contain fragmented noise, with an energy ratio of less than 10%. Since the preset energy threshold is set to 15%, the algorithm accurately selects the horizontal sub-band with an energy ratio of 80% as the dominant high-frequency sub-band, i.e., the effective high-frequency direction residual, and discards other sub-bands. Then, it adds a spatial direction index of horizontal 01, binds horizontal 01 with a fine quantization step size of 4, and injects it into the structured compressed bitstream extension field at the end of the data packet.

[0055] An extremely rigorous and mathematically sound energy concentration verification and screening mechanism was introduced for high-frequency directional residuals. The high-frequency signals of images are often mixed with a large number of meaningless sensor noise. Through powerful filtering with a preset energy threshold, only the dominant high-frequency sub-bands that can truly represent the clear edges of the image are retained. This strategy, while ensuring that the core texture details are not lost, removes invalid redundancy in the high-frequency data domain, greatly improves the bit efficiency of the final compressed bitstream, and uses extended fields to indicate the precise high-frequency reconstruction direction for the decoding end.

[0056] In some embodiments, during the generation of local detail compensation features, an edge-side dynamic texture dictionary is established in the terminal device memory; high-frequency directional residual feature blocks that frequently appear within three consecutive frames are stored in the edge-side dynamic texture dictionary and assigned short index tags; when parsing subsequent detail bitstream segments, if a matching short index tag is detected, the inverse arithmetic decoding step is skipped, and the corresponding feature block is directly extracted from the edge-side dynamic texture dictionary as a local detail compensation feature.

[0057] Specifically, during the runtime phase of reverse parsing to generate the local detail compensation features, a key-value pair mapping space is allocated in the high-speed cache area of ​​the terminal's physical memory, i.e., a dynamic texture dictionary is established on the terminal side. A sliding window mechanism is established to count the frequency of occurrence of a specific texture array on the time axis. Once a high-frequency directional residual data block that repeatedly hits within three consecutive image frame refresh cycles (i.e., three consecutive frames) is captured, it is immediately copied and stored in the dynamic texture dictionary on the terminal side, and a tiny one-dimensional hash value (i.e., a short index tag) is assigned to it. When the decoder reads and parses the subsequent input detail bitstream segment data, string pattern matching is performed first. When it is confirmed that the read data is consistent with the short index tag recorded in the dictionary, the high-energy-consuming floating-point operation is blocked and abandoned, i.e., the inverse arithmetic decoding step is skipped. Instead, a low-energy-consuming memory pointer addressing operation is used to directly retrieve the pre-stored data block completely from the dynamic texture dictionary on the terminal side to serve as the currently required local detail compensation feature. Taking a user browsing a long plain text code article as an example, since the text image contains a large number of extremely repetitive black high-frequency edge structures, when generating local detail compensation features for the first few frames, the algorithm initializes the on-side dynamic texture dictionary in the terminal memory; when it detects that the high-frequency directional residual feature block representing the edge features of the letter A appears more than ten times in three consecutive frames, it is immediately stored in the dictionary and assigned an extremely short 0x01 index label; when parsing the detailed code stream segment of the fourth frame that is several thousand bytes long, once the 0x01 short index label is detected, the decoder immediately melts down the complex inverse arithmetic decoding steps and directly retrieves the feature block of the letter A from the 0x01 address of the dictionary as the current local detail compensation feature.

[0058] A highly self-consistent dynamic dictionary memory mechanism is embedded in the terminal decoding and restoration end. Taking advantage of the inherent physical characteristic of terminal software having massive amounts of repetitive, high-frequency textures during scrolling, it cleverly transforms the extremely CPU-intensive complex inverse arithmetic decoding mathematical operations into a near-zero-overhead direct memory addressing and extraction operation through short index tag hit mapping. This strategy of trading minimal memory space for enormous decoding time further achieves a precipitous reduction in computational load during the decoding stage, pushing the restoration rendering response speed to the hardware limit.

[0059] like Figure 2The diagram shown is a functional block diagram of an image compression and restoration method for terminal software provided in an embodiment of the present invention.

[0060] The image compression and restoration device for terminal software described in this invention can be installed in an electronic device. Depending on the functions implemented, the image compression and restoration device for terminal software may include a first processing module, a second processing module, a third processing module, a fourth processing module, a fifth processing module, and a sixth processing module. The modules described in this invention can also be referred to as units, which are a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and are stored in the memory of the electronic device.

[0061] In this embodiment, the functions of each module / unit are as follows: The first processing module is used to: acquire the image to be processed and the window interaction state sequence of the current terminal software, so as to provide basic data support for subsequent image compression processing; The second processing module is used to: perform multi-scale edge detection on the image to be processed to extract the gradient magnitude and gradient direction of the pixel points as local texture gradient features, extract the sliding speed vector and touch dwell coordinates in the window interaction state sequence, perform spatial mapping through the attention decay function, and generate a multi-dimensional retinal dwell probability matrix. The third processing module is used to: spatially segment the image to be processed according to a preset size to obtain several image blocks, calculate the probability mean corresponding to each block and compare it with the attention threshold, allocate a fine quantization step size to high attention blocks and extract low-frequency basic residuals and dominant high-frequency direction residuals, allocate a coarse quantization step size to low attention blocks and extract the pixel mean as low-frequency basic residuals. The fourth processing module is used to: convert the frequency domain quantization step size into quantization control flag bits and write them into the bitstream header; use run-length encoding to perform lossless compression of the low-frequency basic residual; use context-adaptive arithmetic encoding to perform lossy compression of the high-frequency directional residual; and time-sequentially concatenate the quantization control flag bits, the basic bitstream segment, and the detail bitstream segment to generate a structured compressed bitstream. The fifth processing module is used to: extract quantization control flags from the header of the structured compressed bitstream to determine the decoding mode; perform inverse run-length decoding and inverse wavelet transform on the basic bitstream segment to generate the basic reconstruction map; and perform inverse arithmetic decoding on the detail bitstream segment to generate local detail compensation features. The sixth processing module is used to: obtain the video memory usage and real-time rendering frame rate of the terminal software in real time, dynamically adjust the fusion weight of the local detail compensation features through the frame rate negative feedback adjustment mechanism, perform matrix addition operation on the compensation features after superimposed weights and the basic reconstruction map, generate the target restored image and submit it to the rendering pipeline, and switch to smooth placeholder frame display in extreme cases.

[0062] In the several embodiments provided by this invention, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0063] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0064] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0065] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. An image compression and restoration method for terminal software, characterized in that, The method includes: S101, Obtain the image to be processed and the current window interaction state sequence of the terminal software; S102, extract the local texture gradient features of the image to be processed, and calculate the multi-dimensional retinal dwell probability matrix in combination with the window interaction state sequence; S103, based on the multi-dimensional retinal dwell probability matrix, the image to be processed is spatially segmented to obtain several image blocks, an adaptive frequency domain quantization step size is assigned to different image blocks, and the corresponding low-frequency basic residual and high-frequency directional residual are extracted. S104, the low-frequency fundamental residual and the high-frequency directional residual are asymmetrically encoded according to the frequency domain quantization step size to generate a structured compressed bitstream; S105, when the image restoration command is triggered, the structured compressed bitstream is parsed to obtain the basic reconstruction image and local detail compensation features; S106, dynamically adjust the fusion weight of the local detail compensation features according to the real-time rendering frame rate of the current terminal software, and superimpose the local detail compensation features onto the base reconstruction map to generate the target restored image.

2. The method according to claim 1, characterized in that, The step of extracting local texture gradient features of the image to be processed and calculating a multi-dimensional retinal dwell probability matrix in conjunction with the window interaction state sequence includes: S1021, Perform multi-scale edge detection on the image to be processed to obtain the gradient magnitude and gradient direction of each pixel as the local texture gradient feature; S1022, Extract the sliding speed vector and touch hold coordinates from the window interaction state sequence; S1023, the local texture gradient features, the sliding speed vector, and the touch dwell coordinates are input into a pre-set attention decay function for spatial mapping to generate the corresponding multi-dimensional retinal dwell probability matrix.

3. The method according to claim 1, characterized in that, The process involves spatially segmenting the image to be processed based on the multi-dimensional retinal dwell probability matrix to obtain several image blocks, assigning adaptive frequency domain quantization step sizes to different image blocks, and extracting the corresponding low-frequency fundamental residuals and high-frequency directional residuals, including: S1031, the image to be processed is spatially segmented according to a preset size to obtain several image blocks, and the average probability of each image block in the multi-dimensional retinal dwell probability matrix is ​​calculated. S1032, determine whether the average probability value is greater than a preset attention threshold; S1033, if the probability mean is greater than the attention threshold, then a fine quantization step size is allocated, and a discrete wavelet transform is performed on the image block to extract the first low-frequency sub-band as the low-frequency basic residual and to extract high-frequency sub-bands in multiple directions as the high-frequency directional residual. S1034, if the mean probability is not greater than the attention threshold, then a coarse quantization step size is allocated, and the image block is downsampled to extract the mean pixel value as the low-frequency basic residual while discarding the high-frequency directional residual.

4. The method according to claim 1, characterized in that, The step of asymmetric encoding the low-frequency fundamental residual and the high-frequency directional residual according to the frequency domain quantization step size to generate a structured compressed bitstream includes: S1041, Extract the frequency domain quantization step size and convert it into quantization control flag bits, then write it into the bitstream header; S1042, The low-frequency basic residual is losslessly compressed using a run-length encoding algorithm to generate a basic code stream segment; S1043, a context-adaptive arithmetic coding algorithm is used to perform lossy compression on the high-frequency directional residual to generate detail bitstream segments; S1044, The quantization control flag, the basic bitstream segment, and the detail bitstream segment are sequentially concatenated to generate the structured compressed bitstream.

5. The method according to claim 4, characterized in that, The process of parsing the structured compressed bitstream to obtain the basic reconstruction map and local detail compensation features includes: S1051, Extract the quantization control flag from the header of the structured compressed bitstream to determine the decoding mode of the current block; S1052, Based on the decoding mode, perform inverse run-length decoding and inverse wavelet transform on the basic code stream segment to generate the basic reconstruction map; S1053, perform inverse arithmetic decoding on the detail bitstream segment to generate the local detail compensation feature containing texture direction information.

6. The method according to claim 1, characterized in that, The step of dynamically adjusting the fusion weights of the local detail compensation features based on the real-time rendering frame rate of the current terminal software, and superimposing the local detail compensation features onto the base reconstruction map to generate the target restored image, includes: S1061, Real-time acquisition of the current video memory usage rate of the terminal software operating system and the real-time rendering frame rate of the screen refresh cycle; S1062, Construct a frame rate negative feedback adjustment mechanism. When the real-time rendering frame rate is lower than the preset smoothness threshold, the fusion weight of the local detail compensation feature is reduced proportionally. S1063, perform matrix addition on the pixel matrix of the basic reconstructed image and the local detail compensation feature matrix multiplied by the fusion weight to generate the target restored image and submit it to the rendering pipeline of the terminal software.

7. The method according to claim 2, characterized in that, The step of inputting the local texture gradient features, the sliding velocity vector, and the touch dwell coordinates into a pre-defined attention decay function for spatial mapping to generate the corresponding multi-dimensional retinal dwell probability matrix includes: S10231, decompose the sliding velocity vector into a horizontal translation component and a vertical translation component; S10232, A Gaussian attenuation mask centered on the touch stop coordinate is established based on the touch stop coordinate; S10233, Perform a dot product operation between the local texture gradient features and the Gaussian decay mask to obtain a static gaze feature matrix; S10234, a motion blur cancellation factor containing the horizontal translation component and the vertical translation component is introduced to dynamically compensate and map the static gaze feature matrix to generate the multi-dimensional retinal dwell probability matrix.

8. The method according to claim 6, characterized in that, After the step of proportionally reducing the fusion weights of the local detail compensation features, the method further includes: S10621, Extract the pixel offset of the target image to be restored in the previous frame, and calculate the expected rendering delay time in combination with the real-time rendering frame rate; S10622, Determine whether the expected rendering delay time exceeds the vertical synchronization cycle of the screen hardware; S10623, if the vertical synchronization period is exceeded, the fusion weight is directly set to zero, and the smoothed image generated by the low-frequency basic residual is extracted as a temporary placeholder frame for display until the expected rendering delay time is restored to within the vertical synchronization period and the original fusion weight is restored.

9. The method according to claim 3, characterized in that, The extraction of high-frequency sub-bands in multiple directions as the high-frequency directional residuals includes: S10331, After extracting the first low-frequency sub-band, perform energy concentration verification and calculate the corresponding energy percentage for the high-frequency sub-bands in multiple directions; S10332, Select the dominant high-frequency subband whose energy percentage exceeds a preset energy threshold as the effective high-frequency directional residual; S10333, record the spatial direction index of the dominant high-frequency sub-band, and then logically bind the spatial direction index with the corresponding fine quantization step size and inject it into the extended field of the structured compressed bitstream.

10. An image compression and restoration device for terminal software, characterized in that, The apparatus for implementing the image compression and restoration method for terminal software as described in claim 1 includes: The first processing module is used to: acquire the image to be processed and the window interaction state sequence of the current terminal software, so as to provide basic data support for subsequent image compression processing; The second processing module is used to: perform multi-scale edge detection on the image to be processed to extract the gradient magnitude and gradient direction of the pixel points as local texture gradient features, extract the sliding speed vector and touch dwell coordinates in the window interaction state sequence, perform spatial mapping through the attention decay function, and generate a multi-dimensional retinal dwell probability matrix. The third processing module is used to: spatially segment the image to be processed according to a preset size to obtain several image blocks, calculate the probability mean corresponding to each block and compare it with the attention threshold, allocate a fine quantization step size to high attention blocks and extract low-frequency basic residuals and dominant high-frequency direction residuals, allocate a coarse quantization step size to low attention blocks and extract the pixel mean as low-frequency basic residuals. The fourth processing module is used to: convert the frequency domain quantization step size into quantization control flag bits and write them into the bitstream header; use run-length encoding to perform lossless compression of the low-frequency basic residual; use context-adaptive arithmetic encoding to perform lossy compression of the high-frequency directional residual; and time-sequentially concatenate the quantization control flag bits, the basic bitstream segment, and the detail bitstream segment to generate a structured compressed bitstream. The fifth processing module is used to: extract quantization control flags from the header of the structured compressed bitstream to determine the decoding mode; perform inverse run-length decoding and inverse wavelet transform on the basic bitstream segment to generate the basic reconstruction map; and perform inverse arithmetic decoding on the detail bitstream segment to generate local detail compensation features. The sixth processing module is used to: obtain the video memory usage and real-time rendering frame rate of the terminal software in real time, dynamically adjust the fusion weight of the local detail compensation features through the frame rate negative feedback adjustment mechanism, perform matrix addition operation on the compensation features after superimposed weights and the basic reconstruction map, generate the target restored image and submit it to the rendering pipeline, and switch to smooth placeholder frame display in extreme cases.