Anti-loss image processing method for digital media
By employing adaptive compression-resistant transmission processing, complex scene enhancement processing, and cross-device adaptive adaptation processing, the problems of high compression transmission loss, low restoration accuracy in complex scene processing, and poor cross-device display consistency in digital image processing are solved, achieving high-quality image processing results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WEIHAI OCEAN VOCATIONAL COLLEGE
- Filing Date
- 2026-02-14
- Publication Date
- 2026-05-26
Smart Images

Figure QLYQS_1
Abstract
Description
Technical Field
[0001] This invention is a loss-resistant image processing method for digital media, belonging to the field of digital media technology. Background Technology
[0002] With the rapid development of digital media technology, image processing is widely used in various scenarios such as short video creation, digital exhibitions, online dissemination, and printing reproduction. However, current digital image processing technology still faces significant problems of image quality distortion and technical limitations in practical applications. Among these, three major issues are particularly prominent: compression and transmission loss, defects in handling complex scenes, and poor cross-device compatibility, which seriously affect user experience and the quality of content dissemination.
[0003] In existing technologies, digital images need to be compressed using compression standards such as JPEG and H.265 to meet the requirements of storage efficiency and transmission speed. However, existing compression algorithms mostly adopt a uniform compression strategy, ignoring the feature differences of different regions of the image. This leads to problems such as loss of detail, increased noise, and color deviation during the compression process. In high compression ratio scenarios, obvious block effects and ringing effects will also occur, resulting in serious degradation of image quality.
[0004] In complex scene image processing, existing AI models have significant shortcomings in handling transparent objects, motion blur, complex lighting and shadows, and minute details such as hair and texture. The core reason is that the models fail to effectively extract deep contextual information and spatial detail features of the image, do not fully utilize feature correlation, and lack targeted feature extraction mechanisms. Even with optimization by increasing network depth, problems such as artifacts, edge blurring, and object distortion (such as misaligned fingers) still easily occur, failing to meet the requirements of high-quality image processing for detail restoration and scene realism.
[0005] Furthermore, when the same digital image is displayed on different display devices (such as mobile phones, computers, and printers), due to the differences in color space (such as sRGB and AdobeRGB), resolution, and color gamut range of each device, existing image processing technologies do not have an adaptive adaptation mechanism, resulting in problems such as color cast and distortion, and failing to guarantee consistency in cross-device display.
[0006] Currently, existing technologies mostly offer optimization solutions for individual problems, such as improving compression algorithms to reduce loss or upgrading AI models to enhance detail reproduction. However, they fail to form a comprehensive collaborative framework covering compression transmission, complex scene processing, and cross-device adaptation. This fragmented solution struggles to address all three core issues simultaneously, resulting in limited processing effectiveness. Furthermore, it is cumbersome to operate, requiring the addition of multiple independent modules, and cannot meet the diverse and demanding image processing needs of digital media across various scenarios. Summary of the Invention
[0007] To address the shortcomings of existing digital media image processing technologies, such as high compression and transmission losses, low accuracy in complex scene processing and restoration, poor consistency due to lack of cross-device display adaptation mechanisms, and limited processing effects due to the lack of a unified collaborative processing framework, this paper proposes a loss-resistant image processing method for digital media. This method effectively reduces compression and transmission losses, improves image detail restoration and realism in complex scenes, ensures consistent image display across different devices, and constructs a fully collaborative image processing system that balances compression efficiency and image quality preservation. It adapts to the diverse and demanding image processing requirements of digital media, thereby improving overall image processing quality and user experience.
[0008] To solve the above technical problems, the present invention adopts the following technical solution:
[0009] A lossless image processing method for digital media includes the following steps:
[0010] Step S1, image preprocessing, is carried out on short video frames using the Canny edge detection algorithm, gray-level co-occurrence matrix texture analysis algorithm, and Alpha channel separation algorithm, outputting a hierarchical feature cache library and a preprocessed feature map containing transition region information;
[0011] Step S2, adaptive anti-compression transmission processing, based on the hierarchical feature cache library and preprocessed feature map containing transition area information output in step S1, adopts a regionalized differentiated elastic compression strategy for the feature differences of four types of regions: smooth regions, detailed dense regions, dynamic blurred regions and transition connection regions, and constructs a two-level error correction system, supplemented by regional fusion softening processing.
[0012] Step S3, complex scene enhancement processing, in the image quality optimization and detail restoration of the compressed and corrected image, adopts the feature extraction and fusion strategy of attention codec and multi residual network collaboration, and at the same time corrects limb deformities and dynamic artifacts in the dynamic blur area through the neighborhood pixel association correction algorithm, and balances the brightness and contrast under complex lighting by the light and shadow feature adjustment module.
[0013] Step S4, cross-device adaptive adaptation processing, is image adaptation optimization for different terminal display needs. It automatically obtains the resolution and color space of the target display device and performs adaptive conversion of color space and intelligent scaling of resolution accordingly.
[0014] Step S5: Output the processed image. Verify the adapted short video frame image to confirm that there is no loss of detail, no artifacts, and no color deviation. Then, output the image to the user terminal to complete the image processing.
[0015] Furthermore, step S1 includes the following steps:
[0016] Step S11: Acquisition of the original image and confirmation of basic parameters;
[0017] Obtain the original image of the short video frame uploaded by the user, and simultaneously extract and confirm the basic image parameters: resolution 1080P, color space sRGB, pixel bit depth, to form an image basic parameter file;
[0018] Step S12, image normalization processing;
[0019] The original image is normalized to a uniform pixel density of 300 dpi. At the same time, the image size is calibrated to maintain the original 1080P resolution and only the pixel density deviation is corrected. The pixel grayscale values are mapped to the standard range of [0, 255] through pixel value normalization.
[0020] Step S13: Intelligent division of three basic regions;
[0021] Based on the dual analysis of edge and texture features, the image is divided into three basic regions: smooth regions, densely detailed regions, and dynamically blurred regions. Specific operations are as follows:
[0022] The Canny edge detection algorithm is used to extract edges from the normalized image. Through Gaussian filtering for noise reduction, gradient calculation, non-maximum suppression, double threshold detection and edge connection, the edge point distribution and edge gradient information of the image are obtained.
[0023] The gray-level co-occurrence matrix algorithm is used to calculate the texture feature parameters of the image, including contrast, entropy, correlation, and energy, and to quantify the texture density of each region of the image.
[0024] Region determination is performed by combining edge detection and texture density analysis results:
[0025] Smooth regions are those where the percentage of edge points is less than 5% and the texture density value is less than 0.2.
[0026] Areas with dense detail are defined as those where the percentage of edge points is greater than 20% and the texture density value is greater than 0.8.
[0027] The dynamic blur region is a region where the pixel gray value is continuously offset, the edge gradient is blurred, and the texture features have no obvious regularity. The output is a pixel coordinate range marking map of the three basic regions to clarify the spatial position of each region in the image.
[0028] Step S14: Marking and defining the transition area;
[0029] For the adjacent boundaries of three basic regions—smooth regions, densely detailed regions, and dynamically blurred regions—edge pixel neighborhood feature analysis is performed to achieve accurate marking of transition areas. Specific operations include:
[0030] Extract the pixels at the boundaries of the three basic regions, sample the 3×3 neighborhood pixels for each boundary pixel, and calculate the feature similarity of the pixels in the neighborhood, including color similarity and texture similarity;
[0031] The boundary neighborhood regions with feature similarity between 50% and 80% are marked as transition areas, and the width of the transition area is set to 3-5 pixels;
[0032] The transition area is marked with independent pixel coordinates and integrated with the marking information of the three basic areas to form a full-area spatial marking map including the transition area.
[0033] Furthermore, step S1 also includes the following steps:
[0034] Step S15: Extract multi-dimensional features across the entire region;
[0035] The Alpha channel separation algorithm is used to extract the three core features of color, edge, and texture from four types of regions in the image: smooth regions, dense detail regions, motion blur regions, and transition areas. The specific operation is as follows:
[0036] Color feature extraction: Separate the RGB color channels of the image, calculate the color mean, variance, and color gamut distribution range of pixels in each region, and form a color feature vector;
[0037] Edge feature extraction: Based on the detection results of the Canny algorithm, the edge point coordinates, edge gradient direction, and edge continuity of each region are extracted to form an edge feature vector;
[0038] Texture feature extraction: Based on the calculation results of the gray-level co-occurrence matrix, extract the texture parameters of contrast, entropy, and correlation of each region to form a texture feature vector;
[0039] Output feature datasets for smooth regions, densely detailed regions, dynamically blurred regions, and transitional areas, achieving a one-to-one correspondence between features and regions.
[0040] Step S16: Construct the hierarchical feature cache library;
[0041] Based on the full-region feature dataset extracted in step S15, a hierarchical feature cache library is constructed according to region type. The specific design is as follows:
[0042] The hierarchical feature cache library is divided into four independent storage units, corresponding to the smooth storage unit, the detail-intensive storage unit, the dynamic blur storage unit, and the transition area storage unit, respectively.
[0043] Each storage unit is classified into two levels according to color features, edge features, and texture features, and stores the corresponding feature vectors, parameter values, and pixel coordinate association information.
[0044] The hierarchical feature cache library adopts a read-write real-time data storage mode, which can be retrieved and compared at any time;
[0045] Step S17: Preprocessed feature map generation;
[0046] By integrating a full-region spatial label map containing pixel coordinates and boundary positions of four types of regions—smooth regions, densely detailed regions, motion-blurred regions, and transitional regions—with a full-region feature dataset containing color, edge, and texture features of the four types of regions, a preprocessed feature map containing transitional region information is generated.
[0047] Using the image pixel matrix as a basis, region labeling information and feature information are embedded into the corresponding pixel positions;
[0048] The feature map preserves the spatial topology of the image and contains quantized feature parameters of each region, achieving a dual representation of spatial location and feature attributes.
[0049] Furthermore, step S2 includes the following steps:
[0050] Step S21: Compress the smooth region;
[0051] Step S22: Compress areas with dense details;
[0052] Step S23: Compress the dynamic blur region and the transition area;
[0053] Step S24: Construct a two-level error correction system at the feature level and pixel level;
[0054] Step S25: Perform region fusion and softening processing on the image after compression and preliminary correction. Use convolution smoothing algorithm to interpolate and optimize the pixel values of each region and transition area to ensure the continuity of image quality and avoid boundary traces of compressed areas.
[0055] Furthermore, step S21 includes the following steps:
[0056] Step S211: Retrieve key features of the smooth region from the hierarchical feature cache library, including the global texture density value, the texture density value of the sub-region divided by a 16×16 pixel grid, and the average RGB / YUV color value, total pixel range, and boundary coordinates of the smooth region with the transition region.
[0057] Step S212: Set the basic compression ratio to 12:1 and the color deviation rate threshold to 5%. Initialize the core parameters of the improved JPEG compression algorithm. The improved JPEG compression algorithm uses adaptive block division, customized quantization table, and hybrid entropy coding.
[0058] Step S213, Feature fusion optimization, through multi-level residual fusion of global and local features, to achieve accurate fusion of global color consistency and local details in smooth areas, generating an optimized pixel matrix;
[0059] Step S214: Run the improved JPEG compression algorithm to complete the compression;
[0060] Step S215: Calculate the color deviation rate between the compressed data and the original data by real-time feature loss monitoring, calculate the deviation rate of a single block using weighted Euclidean distance, and perform area-weighted averaging of the deviation rates of all blocks to obtain the global deviation rate.
[0061] Step S216, dynamic adjustment judgment: If the global deviation rate is ≤5%, the color loss is deemed acceptable, and entropy encoding is continued to complete, and compressed data is output; if the global deviation rate is >5%, the compression ratio is reduced to 2:1, and steps S213-S216 are repeated to re-execute the improved JPEG compression algorithm process.
[0062] Step S217: Output the compressed smooth region pixel matrix and synchronously update the compressed feature data in the hierarchical feature cache library.
[0063] Furthermore, step S22 includes the following steps:
[0064] Step S221: Preprocess the densely detailed areas and initialize the core compression parameters;
[0065] The base compression ratio is set at 3:1, the dynamic adjustment range is ±1:1, and the threshold for the loss of detail features is defined as 3%. If this value is exceeded, it is considered that the loss of detail is excessive.
[0066] The core parameters for initializing the attention mechanism are: the focus area is the edge points of the detail-dense region and high-texture-density pixels, and the attention weight threshold is set to 0.7;
[0067] Lightweight operating parameters for initializing the multi-residual network: Simplified adaptation based on detailed region features, enabling 3-layer residual blocks, setting the multi-scale receptive field to 3×3 / 5×5, focusing on the capture and fusion of spatial detailed features;
[0068] Initialize noise suppression parameters: Set the high-frequency noise detection threshold and configure corresponding suppression strategies for salt-and-pepper noise and Gaussian noise in the detail area;
[0069] Step S222: Key detail features are anchored and individually retained under the guidance of the attention mechanism;
[0070] By calculating the texture density and edge gradient values of pixels in the pixel matrix of densely detailed regions, an attention weight value of 0~1 is assigned to each pixel to generate an attention weight map with the same size as the pixel matrix; among which, the core pixel weight of hair strands and clothing texture is ≥0.7, and the background transition pixel weight is <0.7.
[0071] Based on the attention weight map, core detail feature regions with weight ≥ 0.7 and ordinary detail feature regions with weight < 0.7 are segmented. The core detail features are encoded separately to generate an independent core feature code stream, which is then separated from the ordinary feature code stream.
[0072] The encoded core detail features are temporarily stored in the temporary retention unit of the hierarchical feature cache library;
[0073] Step S223: The multi-residual network captures spatial detail information and suppresses noise.
[0074] First, texture and edge features within the region are extracted and deeply fused using multi-scale receptive fields to repair minor feature deviations in the preprocessing stage, enhance the spatial continuity of details, and generate a feature-enhanced matrix. Then, a dedicated algorithm is used to accurately identify salt-and-pepper and Gaussian noise within the region, and a noise-suppressing-without-degradation-details combination strategy is adopted to correct noise pixels, ensuring that the original values of core detail pixels are not affected. Finally, a feature matrix with complete detail features and no noise interference is output.
[0075] Step S224: Layered implementation of the elastic compression strategy;
[0076] Compression ratio allocation by region: Core detail feature region: adopts a basic low compression ratio of 2:1 with no dynamic upward adjustment space to ensure the integrity of core details; Ordinary detail feature region: adopts a basic compression ratio of 3:1, which can be dynamically adjusted to 4:1 based on subsequent loss rate monitoring results to balance compression efficiency and detail preservation.
[0077] Small-block low-loss compression execution: Targeting the features of densely detailed areas, 8×8 fixed small blocks are used for compression. The compression algorithm adopts an improved lightweight compression strategy adapted to high-frequency details. Low-loss quantization is performed on the high-frequency components of the detailed areas to reduce the loss of detailed features during the quantization process. At the same time, 1-pixel overlap processing is performed on the block boundaries to avoid block breaks in the detailed areas.
[0078] Joint compression of separated bitstreams: The core feature bitstream and the ordinary feature bitstream are jointly compressed. The core feature bitstream is compressed without loss, and the ordinary feature bitstream is compressed using a region-based compression ratio strategy. Finally, they are merged into a complete compressed bitstream to ensure the integrity and decodeability of the data.
[0079] Step S225: Calculation and dynamic monitoring of real-time detail feature loss rate;
[0080] Real-time sampling during compression: During the quantization and encoding stages of compression, after each 8×8 block is compressed, the compressed features of that block are sampled to extract key parameters of texture and edge features, forming a compressed feature sampling set.
[0081] Quantitative calculation of detail feature loss rate: The compressed feature sampling set is compared with the original feature parameters of the dense detail region one by one, and the texture feature loss rate and edge feature loss rate are calculated separately. Then, a weighted average is performed with a texture weight of 0.6 and an edge weight of 0.4 to obtain the overall detail feature loss rate. The calculation formula is: Overall detail feature loss rate = Texture feature loss rate × 0.6 + Edge feature loss rate × 0.4. Where, the single feature loss rate = (Original feature parameter value - Compressed feature parameter value) / Original feature parameter value × 100%, only positive values are taken, and 0 is taken if there is no feature loss;
[0082] Full-area dynamic monitoring: After sampling and calculation of all blocks, the overall loss rate of all blocks is averaged by area weight to obtain the global detail feature loss rate of the dense detail area, and it is determined in real time whether the value exceeds the threshold of 3%.
[0083] Step S226: Dynamically adjust the compression ratio and complete detailed features to ensure that the loss rate of the final compression result is ≤3%;
[0084] Compression ratio dynamically reduced: If the global detail feature loss rate is >3%, the current compression process is stopped immediately, the compression ratio of ordinary detail regions is reduced to 1:1, the compression ratio of core detail feature regions remains unchanged at 2:1, and the compression process of step 224 is re-executed;
[0085] Original detail feature completion: If the global loss rate is still >3% after reducing the compression ratio, it is determined that the current compression strategy cannot preserve details. The original core detail features of the temporary retention unit in the hierarchical feature cache library and the original ordinary detail features of the detail-dense region are immediately called to perform feature interpolation to complete the features lost during the compression process. After completion, a new detail feature matrix is generated, and compression is re-executed based on a unified compression ratio of 2:1.
[0086] Termination Judgment: When the global detail feature loss rate is ≤3%, the compression is deemed qualified, the dynamic adjustment and completion process is terminated, and the core compression of the detail-dense area is completed.
[0087] Step S227: Compression results integration and cache data update;
[0088] First, the qualified compressed bitstream is decoded to generate a pixel matrix, and the block boundaries are softened to eliminate block artifacts and ensure visual continuity of detailed areas. Then, the compressed pixel matrix, the final compression ratio, and the feature loss rate are synchronously updated to the hierarchical feature cache library, overwriting the original preprocessed data. Finally, the compressed pixel matrix and the processing results of the smoothed areas are initially stitched together to achieve the initial integration of multi-region processing results.
[0089] Furthermore, step S23 includes the following steps:
[0090] Step S231: Preprocessing of dynamic blurred regions and transition areas, initialization of compression core parameters;
[0091] Dynamic blur region: Set the base compression ratio to 6:1, dynamically adjust the range to ±1:1, initialize the core parameters of the deformable offset prediction algorithm, set the motion trajectory fitting window to 3×3, the feature offset correction threshold to 0.05, and define the blur feature distortion rate threshold to 8%. If the threshold is exceeded, the blur is determined to be aggravated.
[0092] Transition zone: Initialize the core parameters of the softening compression, calculate the weight of the neighborhood compression ratio mean as 1:1, the standard deviation of Gaussian blur edge processing σ=0.4, and the blur range is the entire transition zone;
[0093] Step S232: Preprocess the pixel data of the dynamically blurred region and store the motion features separately;
[0094] Pixel data standardization calibration: Referring to the calibration logic of the smooth area in step S21, the original RGB pixel matrix of the dynamically blurred area is converted into the YUV color space. Offset calibration is performed based on the global YUV mean in the hierarchical feature cache library. The Y value [0,255] and Cb / Cr value [16,240] are checked for numerical range, invalid data is truncated, and the consistency of pixel data is ensured.
[0095] Motion feature extraction and encoding: Extract motion feature vectors of dynamically blurred regions containing pixel offset, motion direction angle, and inter-frame correlation parameters. Use lossless encoding to encode the motion features separately to avoid loss of motion features during compression.
[0096] Motion feature temporary cache: The encoded motion feature data is stored in the temporary retention unit of the hierarchical feature cache library, and stored separately from the pixel data;
[0097] Step 233: Implement the dynamic blur region elastic compression ratio.
[0098] Fixed block compression settings: Dynamic blur areas without clear detail boundaries are compressed using fixed 8×8 pixel blocks, with a 1-pixel overlap area set at the block boundaries to avoid breakage of the blur trajectory caused by the blocks.
[0099] Pixel data compression execution: Lightweight compression is performed on the pixel matrix of the calibrated dynamic blur region. A lightweight quantization strategy is adopted, with low-loss quantization for low-frequency components and moderate relaxation of quantization standards for high-frequency components to avoid excessive compression that would exacerbate blurring.
[0100] Separate bitstream joint compression: The lossless encoded motion feature bitstream and the pixel data compressed bitstream are jointly encapsulated to form a complete compressed bitstream of the dynamic blurred region, ensuring accurate matching of motion features and pixel data during decoding;
[0101] Step S234: The deformable offset prediction algorithm corrects the dynamic fuzzy feature offset;
[0102] Calculation of compressed feature offset: The compressed feature data of the dynamic blur region is compared with the original features of the dynamic blur region. The feature offset generated during the compression process is calculated pixel by pixel through the 3×3 motion trajectory fitting window of the deformable offset prediction algorithm, including spatial position offset and motion direction offset, and a feature offset matrix is generated.
[0103] Motion feature-guided offset correction: Retrieve the original motion feature data from the temporary cache, and correct the feature offset matrix point by point based on the motion trajectory. For pixels with offsets exceeding the correction threshold of 0.05, feature restoration is performed using neighboring pixel correlation interpolation to correct feature distortion in the dynamic blur region.
[0104] Blur level verification: After the correction is completed, the distortion rate of the blur feature in the dynamic blur region is calculated: Distortion rate = (compressed blur level - original blur level) / original blur level × 100%. If the distortion rate ≤ 8%, the correction is deemed qualified; if the distortion rate > 8%, the offset correction process is repeated until the distortion rate meets the threshold requirement.
[0105] Step S235: Dynamic adjustment of the elastic compression ratio of the dynamic blurred region;
[0106] Compression ratio reduction: If the distortion rate of blurred features is >8%, the current compression process will be stopped immediately, the compression ratio of the dynamic blurred area will be reduced by 1:1, the lower limit of the core compression ratio is 5:1, and the compression and correction process will be re-executed after the reduction.
[0107] Increase compression ratio: If the distortion rate of the blurred features is less than 3%, that is, there is no significant loss of blurred features, the compression ratio can be increased by 1:1 to improve compression efficiency. The upper limit of the core compression ratio is 7:1. After the increase, the distortion rate should be re-verified to ensure that the distortion rate is ≤8%.
[0108] Termination Judgment: When the distortion rate of the blurred feature is ≤8%, the compression and correction of the dynamic blurred region is deemed qualified, the elastic adjustment process is terminated, and the core compression processing of the region is completed.
[0109] Step S236: Softening and compression processing of the transition area between each region;
[0110] Neighborhood compression ratio mean calculation: Extract the compression ratio parameters of 1-2 adjacent basic regions in the transition zone, calculate the mean of the neighborhood compression ratio with equal weights at a 1:1 ratio, and use this mean as the exclusive compression ratio of the transition zone to achieve a smooth transition of compression ratio;
[0111] Lightweight compression of the transition zone: A compression strategy adapted to the basic region of the transition zone is adopted to perform lightweight compression on the transition zone. All feature data are retained during the compression process, and excessive quantization is not performed to ensure the feature continuity between the transition zone and the neighboring region.
[0112] Gaussian blur edge processing: Gaussian blur edge processing with σ=0.4 is applied to the compressed transition area, covering the entire transition area. Interpolation optimization is performed on the overlapping boundary pixels of the transition area and the neighboring base area to eliminate abrupt changes in image quality in areas with different compression ratios and achieve natural transition between areas.
[0113] Step S237: Integrate the dual-region compression results and update the cached data;
[0114] First, the compressed pixel matrix of the dynamic blur and transition areas is spatially and precisely stitched with the processing results of the smooth and detail-dense areas, and the overlapping boundaries are smoothed to ensure the pixel continuity of the whole image. Then, the motion features of the temporarily cached dynamic blur area are precisely fused with the stitched pixel data to generate a compressed image feature map containing motion features. Finally, the compressed pixel matrix of the two regions, the final compression ratio, and the distortion rate are synchronously updated to the corresponding units of the hierarchical feature cache library, covering the original preprocessed data. This achieves the integrated integration of the compression results of all partitions of the whole image, and at the same time completes the standardized retention of the full amount of compressed data.
[0115] Furthermore, step S24 includes the following steps:
[0116] Step S241, preparation for dual-level correction, retrieval of reference data and parsing of feature check codes;
[0117] The original and compressed feature and pixel data of smooth regions, dense detail regions, dynamic blur regions, and transition regions are retrieved from the hierarchical feature cache library along with preprocessed feature maps as the sole correction benchmark. Dedicated feature check codes are generated for each region and bound to the compressed bitstream for encapsulation and transmission, achieving accurate matching between check information and image data. At the same time, the receiving end decapsulates the transmitted bitstream, separates the check codes, features, and pixel data of smooth regions, dense detail regions, dynamic blur regions, and transition regions, and sorts them out.
[0118] Step S242, the first level of error correction is feature-level error correction, which involves checking the check code and completing the feature information to avoid subsequent pixel-level image quality degradation caused by feature loss from the root cause.
[0119] Cross-end check code region-by-region comparison: The receiving end compares the decapsulated feature check code with the original feature check code pre-stored in the hierarchical feature cache library of the sending end by region and feature type. The feature types are color, edge, texture and motion features. By the coding difference of the check code, the feature loss region, feature loss type and feature loss degree can be accurately identified.
[0120] Quantitative determination of feature loss degree: Set a feature loss quantification threshold. If the deviation of a single type of feature parameter is ≥10%, it is determined as feature loss. Quantify the features that are different after comparison, clarify the loss ratio of each type of feature in each region, and form a feature loss determination table.
[0121] Accurate completion of original feature data: Based on the feature loss judgment table, the original feature data of the corresponding region and type is retrieved from the hierarchical feature cache library. Differentiated completion strategies are adopted for different loss types: For color and texture feature loss, feature interpolation is used to restore the lost feature parameters based on the complete feature data of the neighborhood; For edge and motion feature loss, the original feature data is directly called for feature restoration to ensure the continuity of edges and the accuracy of motion features; For slight feature distortion with a deviation of <10%, the original feature data is used for calibration to correct the distorted feature parameters to the original baseline range.
[0122] Feature data update after completion: The completed feature data is fused with the compressed feature data at the receiving end to generate full-area feature data after feature-level correction, and synchronously updated to the hierarchical feature cache library to provide a complete feature benchmark for subsequent pixel-level correction;
[0123] Step S243, the second level of error correction is pixel-level error correction, which performs point-by-point verification and abnormal pixel correction to solve the image quality distortion problem at the pixel level;
[0124] Pixel matrix reconstruction and benchmark comparison preparation: Based on the complete feature data after feature-level correction, the compressed pixel matrix of the receiving end is reconstructed; the original pixel matrix of each region is retrieved from the hierarchical feature cache library, and the compressed pixel matrix and the original pixel matrix are spatially aligned according to pixel coordinates to ensure the accuracy of point-by-point comparison.
[0125] Pixel-by-pixel comparison and outlier identification: Pixel-by-pixel comparison is performed on the aligned pixel matrix. Pixel value deviation thresholds are set according to color space: YUV space: Y value deviation ±15, Cb / Cr value deviation ±10; RGB space: single channel value deviation ±20. Outlier pixels exceeding the thresholds are identified and classified according to distortion type: Block effect type is pixel value abrupt change points at block boundaries; Ringing effect type is pixel value oscillation points at image edges; Transmission error type is randomly occurring pixel value jump points; Distortion type is pixel distortion points caused by motion feature shift in dynamic blurred areas.
[0126] Differential correction of abnormal pixels: For different types of abnormal pixels, precise correction is performed using the original data from the hierarchical feature cache library to ensure continuous and distortion-free pixel values after correction. For block effect-type mutation points, a neighborhood pixel bilinear interpolation algorithm is used to smooth abnormal pixels at block boundaries and eliminate pixel value mutations. For ringing effect-type oscillation points, the original pixel values corresponding to the original edge feature data are used to replace the abnormal points, and then a lightweight Gaussian smoothing with σ=0.3 is applied to the edge region to ensure edge continuity. For transmission error-type random points, the original pixel values in the hierarchical feature cache library are directly used to replace the abnormal points to restore the true pixel values. For distortion points in dynamic blur regions, the original motion feature data separately retained in step S23 is used to perform position correction and value restoration on the distorted pixels to ensure the continuity of the dynamic blur trajectory.
[0127] Pixel-level correction matrix generation: After correcting all abnormal pixels, the corrected pixel data of each region is integrated to generate a pixel-level corrected full-image pixel matrix. This matrix has eliminated pixel distortion caused by transmission / compression, such as blockiness and ringing.
[0128] Step S244: Preliminary verification of the dual-level calibration results, quality assessment and data update;
[0129] The calibration result is quantified by two core quantification criteria to evaluate the quality of the calibrated image: feature integrity (the degree of matching between the calibrated and original feature data, which must be ≥99%) and pixel normality (the proportion of normal pixels in the calibrated pixel matrix, which must be ≥99.5%). Threshold judgment and secondary calibration: if the feature integrity of the entire image is ≥99% and the pixel normality is ≥99.5%, the dual-level calibration is deemed qualified.
[0130] Furthermore, the specific process for initializing the core parameters of the improved JPEG compression in step S212 is as follows:
[0131] Step A1: The smooth region is divided into two categories according to texture density: a pure smooth region with texture density < 0.1 and a weak texture smooth region with texture density 0.1 ≤ texture density < 0.2, and the pixel coordinate range and color characteristics of the two types of regions are recorded.
[0132] Step A2: Initialize the block segmentation strategy parameters. This improves upon the original JPEG compression algorithm's fixed 8×8 block division, defining focus block size adaptation and boundary overlap:
[0133] Block size parameter definition:
[0134] Set a large block size of 16×16 pixels for pure smooth areas and retain a standard block size of 8×8 pixels for weak texture smooth areas, and clarify the block size determination rules for the two types of areas.
[0135] Boundary overlap parameter definition:
[0136] The number of overlapping pixels at the boundaries of all blocks is uniformly set to 1 pixel. The top, bottom, left, and right boundaries of each block are extended outward by 1 pixel to form an overlapping area with adjacent blocks, thus avoiding block boundary breaks.
[0137] Establishment of block mapping relationships:
[0138] To label the block type of each pixel within the smooth area, generate a mapping table of block number-size-pixel coordinates-overlapping boundary, and clarify the specific parameter attributes of each block;
[0139] Step A3, custom quantization table parameter initialization, addresses the color loss caused by the general quantization table in the original JPEG compression algorithm. Custom quantization table parameter initialization is implemented to adjust the quantization step size and adapt the table structure.
[0140] Loading the baseline quantization table: First, load the standard luminance and chrominance quantization tables of the original JPEG compression algorithm as the basis for adjustment;
[0141] Quantization step size adjustment:
[0142] Brightness quantization table adjustment: Reduce all values to 80% of the original value, round down, and ensure that the value is ≥1 to avoid invalid quantization and reduce brightness information loss;
[0143] Colorimetric table adjustment: Reduce all values to 50% of their original values, round down, and ensure that the values are ≥1, with a focus on protecting the color consistency of smooth areas;
[0144] Confirm that the adjusted quantization table has no outliers, such as 0 or negative numbers, and meets the characteristics of low texture and high color consistency in smooth areas, ensuring that the quantization process only slightly compresses luminance and chromaticity information;
[0145] Table structure adaptation:
[0146] Numerical gradient structure adaptation: During initialization, based on reducing the values of the entire table, the numerical gradient difference within the 8×8 matrix is deliberately reduced, the original steep gradient is changed to a gradual gradient, and the gradient increase is controlled within 80% of the original. This is written into the quantization table parameter initialization rules.
[0147] Luminance / chromaticity table structure matching adaptation: During initialization, the numerical matching structure of luminance and chromaticity tables is reconstructed, reducing the numerical difference between the chromaticity table and luminance table by 1.5-3 times; uniformly lowering the values of the entire table; finally, during parameter initialization, it is determined that the maximum value of the chromaticity table is ≤ 3 times the maximum value of the luminance table, and this is written into the quantization table parameter set.
[0148] For visual weight structure adaptation, during initialization, the quantization table value structure is optimized for visual weights that prioritize color consistency in smooth areas over brightness stability over high-frequency details.
[0149] Colorimeter: Prioritize low and uniform values across the entire area, with no extreme high values, to match color consistency requirements;
[0150] Brightness meter: Only very small values are retained in the low-frequency range to match the need for stable brightness, and the values in the high-frequency range are moderately increased but not to an extreme degree;
[0151] Step A4, entropy coding strategy parameter initialization, is an improvement on the original JPEG compression algorithm's single Huffman coding. Entropy coding strategy parameter initialization addresses encoding type allocation and custom encoding table generation:
[0152] Encoding type allocation rules definition: Luminance components use arithmetic encoding, and chrominance components use custom Huffman encoding;
[0153] Custom Huffman coding table generation: Based on the obtained mean chromaticity value of the smooth region, the frequency of occurrence of chromaticity values is pre-statistically counted, and a Huffman coding table adapted to the smooth region is generated to improve coding efficiency;
[0154] Redundancy bit setting: Configure an additional 1-bit redundancy bit for the chroma component, specify the location for adding the redundancy bit, and prevent color deviation caused by excessive compression of chroma information.
[0155] Furthermore, step S213 performs improved JPEG pre-optimization on the smooth region, the specific process of which is as follows:
[0156] Step B1 involves benchmark calibration of the smoothed pixel data to eliminate acquisition bias in the original pixel data, unify color and brightness benchmarks, and provide a consistent data foundation for subsequent block segmentation and quantization.
[0157] Retrieve the original RGB pixel matrix of the smooth region from the hierarchical feature cache library and convert it to the YUV color space according to the JPEG standard;
[0158] Based on the global YUV mean of the smooth region in the cache library, offset calibration is performed on the YUV values of all pixels: 128 is the YUV luminance reference value; the same applies to Cb and Cr values.
[0159] The numerical range is checked, with the luminance component Y value limited to [0, 255] and the chromaticity component Cb / Cr value limited to [16, 240]. Any values exceeding these limits are truncated.
[0160] Step B2, the implementation of adaptive block division, physically divides the smooth area into blocks according to the rule of 16×16 for pure smooth areas and 8×8 for weak texture smooth areas, and handles boundary overlap:
[0161] Load the block mapping table generated during the initialization phase, which contains block numbers, sizes, pixel coordinates, and overlapping boundaries, and traverse all pixels in the smooth region;
[0162] The pure smooth area is divided into main blocks of 16×16 pixels. The upper, lower, left and right boundaries of each main block are extended by 1 pixel to form an overlapping area, which shares pixel data with the overlapping area of the adjacent main blocks. The weak texture smooth area is divided into blocks of 8×8 pixels, and also retains an overlapping boundary of 1 pixel.
[0163] Divide all 16×16 main blocks into 4 8×8 sub-blocks, and divide them into upper left, upper right, lower left, and lower right quadrants. Record the relationship between the sub-blocks and the main blocks.
[0164] Generate a block data list containing the pixel matrix, size type, overlapping boundary pixel values, and type of smoothing region for each sub-block and main block;
[0165] Step B3, Feature Pre-fusion: Before compression, global and local features are fused to correct local biases in the data blocks and avoid amplifying these biases during subsequent compression.
[0166] Retrieve the global feature vector of the smooth region and the local feature vectors of each sub-block and the main block from the hierarchical feature cache library; calculate the residual value of the local features minus the global features;
[0167] The pixel data in the sub-block is corrected based on the residual value. The Y value of each pixel in the sub-block and the main block is equal to the calibrated Y value minus the residual value. The Cb / Cr value is similarly corrected. This allows local features to converge with global features, ensuring the consistency of color / brightness in smooth areas. Lightweight Gaussian filtering is then applied to the corrected sub-block data.
[0168] Step B5, standardizing the output of the preprocessed data, converts the preprocessed chunked data into a standardized format that can be directly read by the improved JPEG compression:
[0169] Data format conversion: Convert the pixel data of all 8×8 sub-blocks into 16-bit signed integers and center them by subtracting 128 from the pixel values, so that the values are distributed in [-128, 127], which conforms to the numerical characteristics of DCT transformation; Label the attributes of each 8×8 sub-block, namely the type of smoothing region it belongs to, whether it is split from a 16×16 main block, and the overlapping boundary mark.
[0170] Arrange all 8×8 sub-block data in spatial order from left to right and top to bottom to generate the final input data matrix of the improved JPEG compression algorithm; and synchronously update the preprocessed sub-block data and feature correction records to the hierarchical feature cache library.
[0171] The present invention adopts the above technical solution and has the following technical effects compared with the prior art:
[0172] 1. Significantly reduces compression transmission loss, balancing compression efficiency and image quality integrity;
[0173] This invention designs differentiated hierarchical elastic compression strategies for different regions of an image. For smooth regions, it optimizes and improves the JPEG compression algorithm, combining multi-level residual fusion to achieve low-loss compression. For densely detailed regions, it anchors core details through an attention mechanism and dynamically adjusts the compression ratio at a low level. For dynamically blurred regions, it stores motion features separately and corrects feature offsets through algorithms. Simultaneously, it uses neighborhood mean compression to soften transition areas, avoiding detail loss, color deviation, and region transition discontinuity problems caused by uniform compression from the source. Furthermore, a dual-level error correction module at the feature level and pixel level provides double compensation for transmission loss, effectively suppressing image quality degradation problems such as blockiness and ringing. At an average compression ratio of 8:1, the image still retains complete minute details with no obvious noise or distortion. Compared to existing fixed hierarchical compression techniques, the processed image shows an 8-12dB improvement in PSNR and a 0.07-0.11 improvement in SSIM, achieving a balance between compression efficiency and image quality preservation.
[0174] 2. Accurately overcome the defects in processing complex scenes, and improve the restoration of image details and realism;
[0175] This invention utilizes the synergistic effect of an attention encoder-decoder and a multi-residual network to accurately extract global context and local features of an image. It focuses on enhancing the extraction accuracy of minute details such as hair and texture, as well as edge features, effectively repairing the detail information lost during compressed transmission and correcting edge blurring issues. For dynamic blurring scenes, it employs a neighborhood pixel correlation correction algorithm to correct artifacts such as limb deformities, and combines a light and shadow feature adjustment module to balance brightness and contrast under complex lighting conditions, solving the problem of insufficient processing capabilities for dynamic blur and complex lighting in existing technologies. At the same time, it stores and restores the motion features of dynamically blurred areas separately, avoiding the aggravation of blurring and making image restoration in complex scenes closer to reality. This completely solves the pain points of limited detail restoration accuracy and easy artifact and object distortion in existing technologies.
[0176] 3. Optimize cross-device adaptive adaptation to ensure consistent display across multiple devices;
[0177] This invention can automatically acquire core parameters such as resolution and color space of the target display device, supports adaptive conversion of mainstream color spaces such as sRGB and AdobeRGB, and adopts a resolution adaptive adjustment algorithm to perform scaling processing in combination with image feature distribution, focusing on preserving the subtle features of densely detailed areas and avoiding image distortion. It accurately corrects color deviations for parameter differences between different electronic display devices, fundamentally solving the image color cast and distortion problems caused by the lack of adaptive adaptation mechanism in existing technologies, ensuring the display consistency of the same image on different electronic devices such as mobile phones and computers, and improving the user's visual experience.
[0178] 4. Build a unified end-to-end collaborative processing framework to improve the practicality and adaptability of the technology;
[0179] This invention integrates image preprocessing, adaptive compression-resistant transmission, complex scene enhancement, cross-device adaptation, and quality verification into a unified collaborative processing framework. Each stage relies on a hierarchical feature cache library to achieve real-time retrieval and updating of raw and feature data, resulting in strong data interoperability. It eliminates the need for multiple independent processing modules, simplifying operation and increasing processing efficiency. Furthermore, the intelligent region division in the preprocessing stage, the dynamic parameter adjustment in each compression stage, and the targeted processing strategies in the enhancement stage enable this method to adapt to various digital media application scenarios such as short video creation, online dissemination, and digital exhibitions. It is compatible with different types of digital images and display devices, solving the problem that existing technologies can only optimize for single problems and have poor adaptability, thus significantly improving the practical application value of the technology.
[0180] 5. Establish a multi-dimensional quality verification and dynamic adjustment mechanism to ensure the stability and accuracy of image processing;
[0181] This invention sets quantitative quality judgment thresholds and dynamic adjustment strategies in each core processing stage, such as a color deviation rate threshold of 5% for smooth areas, a detail loss rate threshold of 3% for densely detailed areas, a distortion rate threshold of 8% for dynamically blurred areas, and feature integrity ≥99% and pixel normality rate ≥99.5% after dual-level correction. If the threshold is not reached, parameter adjustment or secondary processing is automatically triggered, preventing unqualified data from entering subsequent stages and ensuring the accuracy and stability of image processing from the process perspective. At the same time, all processing parameters are customized based on the actual image features and device parameters, eliminating blind processing steps and further improving the overall quality of image processing. Detailed Implementation
[0182] Example 1
[0183] A lossless image processing method for digital media includes the following steps:
[0184] Step S1, image preprocessing, is performed on short video frames. The entire process relies on the Canny edge detection algorithm, gray-level co-occurrence matrix texture analysis algorithm, and Alpha channel separation algorithm. The output is a hierarchical feature cache and a preprocessed feature map containing transition region information, providing full-dimensional raw data support for subsequent adaptive compression-resistant transmission processing. The specific process is as follows:
[0185] Step S11: Acquisition of the original image and confirmation of basic parameters;
[0186] The system acquires the original images of short video frames uploaded by users, and simultaneously extracts and confirms the basic image parameters: resolution 1080P, color space sRGB, and pixel bit depth, forming an image basic parameter file as the benchmark for all subsequent processing operations, ensuring that parameters are consistent and traceable during the processing.
[0187] Step S12, image normalization processing;
[0188] The original image is standardized and normalized to a uniform pixel density of 300 dpi. At the same time, the image size is calibrated to maintain the original 1080P resolution and only the pixel density deviation is corrected. The pixel grayscale value is mapped to the standard range of [0,255] through pixel value normalization operation to eliminate the differences in pixel density and pixel value range caused by different shooting devices and acquisition channels, and to ensure the accuracy and consistency of subsequent region division and feature extraction.
[0189] Step S13: Intelligent division of three basic regions;
[0190] Based on the dual analysis of edge and texture features, the image is divided into three basic regions: smooth regions, densely detailed regions, and dynamically blurred regions. Specific operations are as follows:
[0191] The Canny edge detection algorithm is used to extract edges from the normalized image. Through Gaussian filtering for noise reduction, gradient calculation, non-maximum suppression, double threshold detection and edge connection, the edge point distribution and edge gradient information of the image are obtained.
[0192] The gray-level co-occurrence matrix algorithm is used to calculate the texture feature parameters of the image, including contrast, entropy, correlation, and energy, and to quantify the texture density of each region of the image.
[0193] Region determination is performed by combining edge detection and texture density analysis results:
[0194] Smooth areas are those where the percentage of edge points is less than 5% and the texture density value is less than 0.2, such as solid color backgrounds;
[0195] Areas with dense details are those where the percentage of edge points is greater than 20% and the texture density value is greater than 0.8, such as human hair and clothing textures;
[0196] Dynamic blur regions are areas where pixel grayscale values are continuously offset, edge gradients are blurred, and texture features are not obvious, such as moving people or objects. The output is a pixel coordinate range map of the three basic regions to clarify the spatial position of each region in the image.
[0197] Step S14: Marking and defining the transition area;
[0198] For the adjacent boundaries of three basic regions—smooth regions, densely detailed regions, and dynamically blurred regions—edge pixel neighborhood feature analysis is performed to achieve accurate marking of transition areas. Specific operations include:
[0199] Extract the pixels at the boundaries of the three basic regions, sample the 3×3 neighborhood pixels for each boundary pixel, and calculate the feature similarity of the pixels in the neighborhood, including color similarity and texture similarity;
[0200] The boundary neighborhood regions with feature similarity between 50% and 80% are marked as transition areas, and the width of the transition areas is uniformly set to 3-5 pixels;
[0201] Independent pixel coordinates are marked for the transition area, and integrated with the marking information of the three basic areas to form a full-area spatial marking map containing the transition area, which solves the problem of abrupt changes in image quality at the junction of different areas during subsequent compression.
[0202] Step S15: Extract multi-dimensional features across the entire region;
[0203] The Alpha channel separation algorithm is used to extract the three core features of color, edge, and texture from four types of regions in the image: smooth regions, dense detail regions, motion blur regions, and transition areas. The specific operation is as follows:
[0204] Color feature extraction: Separate the RGB color channels of the image, calculate the color mean, variance, and color gamut distribution range of pixels in each region, and form a color feature vector;
[0205] Edge feature extraction: Based on the detection results of the Canny algorithm, the edge point coordinates, edge gradient direction, and edge continuity of each region are extracted to form an edge feature vector;
[0206] Texture feature extraction: Based on the calculation results of the gray-level co-occurrence matrix, extract texture parameters such as contrast, entropy, and correlation of each region to form a texture feature vector;
[0207] The final output includes feature datasets for smooth regions, densely detailed regions, dynamically blurred regions, and transitional areas, achieving a one-to-one correspondence between features and regions.
[0208] Step S16: Construct the hierarchical feature cache library;
[0209] Based on the full-region feature dataset extracted in step S15, a hierarchical feature cache library is constructed according to region type. The specific design is as follows:
[0210] The hierarchical feature cache library is divided into four independent storage units, corresponding to the smooth storage unit, the detail-intensive storage unit, the dynamic blur storage unit, and the transition area storage unit, respectively.
[0211] Each storage unit is classified into two levels according to color features, edge features, and texture features, and stores the corresponding feature vectors, parameter values, and pixel coordinate association information.
[0212] The hierarchical feature cache library adopts a read-write real-time data storage mode, providing original feature data support for elastic compression ratio adjustment, two-level error correction, and detail completion in subsequent adaptive anti-compression transmission, which can be retrieved and compared at any time.
[0213] Step S17: Preprocessed feature map generation;
[0214] By integrating a full-region spatial label map containing pixel coordinates and boundary positions of four types of regions—smooth regions, densely detailed regions, motion-blurred regions, and transitional regions—with a full-region feature dataset containing color, edge, and texture features of the four types of regions, a preprocessed feature map containing transitional region information is generated.
[0215] Using the image pixel matrix as a basis, region labeling information and feature information are embedded into the corresponding pixel positions;
[0216] The feature map preserves the spatial topology of the image and contains quantized feature parameters of each region, achieving a dual representation of spatial location and feature attributes.
[0217] The preprocessed feature map is a standardized digital feature map, which can be directly used as the core input for subsequent adaptive compression-resistant transmission, guiding the accurate execution of operations such as hierarchical elastic compression and error correction.
[0218] Step S2, adaptive anti-compression transmission processing, based on the hierarchical feature cache library and preprocessed feature map containing transition region information output in Step S1, adopts a regionalized differentiated elastic compression strategy for the feature differences of four types of regions: smooth regions, detailed dense regions, dynamically blurred regions, and transition connection regions. A two-level error correction system is constructed, supplemented by region fusion softening processing. Throughout the process, dynamic adjustment of compression parameters and accurate retention of feature data are achieved. While maintaining compression efficiency, it effectively suppresses image quality distortion problems such as blockiness and ringing effects, compensates for data errors during transmission, and solves the stitching discontinuity problem caused by differences in compression ratios in different regions. Finally, it outputs a compressed and corrected pixel matrix with natural transitions between regions and complete preservation of features and details, laying a high-quality data foundation for subsequent complex scene enhancement processing. The specific process is as follows:
[0219] Step S21: Compress the smooth region. The specific process is as follows;
[0220] Step S211: Retrieve key features of the smooth region from the hierarchical feature cache library, including the global texture density value, the texture density value of the sub-region divided by a 16×16 pixel grid, and the average RGB / YUV color value, total pixel range, and boundary coordinates of the smooth region with the transition region.
[0221] Step S212: Set the base compression ratio to 12:1 and the color deviation rate threshold to 5%. Initialize the core parameters of the improved JPEG compression algorithm. The improved JPEG compression algorithm solves the block effect and excessive color loss in smooth areas through adaptive block division, customized quantization table and hybrid entropy coding.
[0222] Step S213, Feature fusion optimization, through multi-level residual fusion of global and local features, achieves accurate fusion of global color consistency and local details in smooth areas, generating an optimized pixel matrix;
[0223] Step S214: Run the improved JPEG compression algorithm to complete the compression;
[0224] Step S215: Calculate the color deviation rate between the compressed data and the original data by real-time feature loss monitoring, calculate the deviation rate of a single block using weighted Euclidean distance, and perform area-weighted averaging of the deviation rates of all blocks to obtain the global deviation rate.
[0225] Step S216, dynamic adjustment judgment: If the global deviation rate is ≤5%, the color loss is deemed acceptable, and entropy encoding is continued to complete, and compressed data is output; if the global deviation rate is >5%, the compression ratio is reduced to 2:1, and steps S213-S216 are repeated to re-execute the improved JPEG compression algorithm process.
[0226] Step S217: Output the compressed smooth region pixel matrix and synchronously update the compressed feature data in the hierarchical feature cache library.
[0227] Step S22: Compress densely detailed areas. The specific process is as follows:
[0228] Step S221: Preprocess the densely detailed areas and initialize the core compression parameters;
[0229] The base compression ratio is set at 3:1, the dynamic adjustment range is ±1:1, and the threshold for the loss of detail features is defined as 3%. If this value is exceeded, it is considered that the loss of detail is excessive.
[0230] The core parameters for initializing the attention mechanism are: the focus area is the edge points of the detail-dense region and high-texture-density pixels, and the attention weight threshold is set to 0.7;
[0231] Lightweight operating parameters for initializing the multi-residual network: Simplified adaptation based on detailed region features, enabling 3-layer residual blocks, setting the multi-scale receptive field to 3×3 / 5×5, focusing on the capture and fusion of spatial detailed features;
[0232] Initialize noise suppression parameters: Set the high-frequency noise detection threshold and configure corresponding suppression strategies for salt-and-pepper noise and Gaussian noise in detailed areas.
[0233] Step S222: Key detail features are anchored and individually preserved under the guidance of the attention mechanism. The spatial attention mechanism is used to accurately locate the core details that cannot be lost, such as hair and texture, to avoid excessive loss of core details during the compression process.
[0234] By calculating the texture density and edge gradient values of pixels in the pixel matrix of densely detailed regions, an attention weight value of 0~1 is assigned to each pixel to generate an attention weight map with the same size as the pixel matrix; among which, the core pixel weight of hair strands and clothing texture is ≥0.7, and the background transition pixel weight is <0.7.
[0235] Based on the attention weight map, core detail feature regions with weights ≥ 0.7 and ordinary detail feature regions with weights < 0.7 are segmented. The core detail features are encoded separately to generate an independent core feature code stream, which is then separated from the ordinary feature code stream.
[0236] The encoded core detail features are temporarily stored in the temporary retention unit of the hierarchical feature cache library. A lossless encoding method is used to avoid feature loss during the caching process, providing the original core feature data for subsequent compression and completion.
[0237] Step S223: The multi-residual network captures spatial detail information and suppresses noise.
[0238] Multi-scale detail feature extraction involves inputting the pixel matrix of densely detailed regions into a lightweight multi-residual network. Texture and edge features under 3×3 / 5×5 receptive fields are extracted through 3 layers of residual blocks, and detail information at different scales is fused to repair minor feature deviations that may occur during preprocessing and enhance the spatial continuity of hair and texture.
[0239] Residual fusion and detail enhancement: Through the skip connection structure of the residual network, the edge features extracted from the shallow layer and the texture features extracted from the deep layer are fused to generate an enhanced detail feature matrix. This matrix retains all spatial feature information of the detail region and enhances the core detail features.
[0240] After residual fusion, noise suppression is performed in the detail region. First, a high-frequency noise detection algorithm is used to identify salt-and-pepper noise and Gaussian noise in the detail region. Then, a combination strategy of nonlocal mean denoising and Gaussian smoothing is used to correct the noise pixels while ensuring that the original values of the core detail pixels are not changed, thus achieving noise suppression without loss of detail.
[0241] Step S224: The elastic compression strategy is implemented in layers to avoid loss of details or low compression efficiency caused by a single compression strategy.
[0242] Compression ratio allocation by region: Core detail feature region: adopts a basic low compression ratio of 2:1 with no dynamic upward adjustment space to ensure the integrity of core details; Ordinary detail feature region: adopts a basic compression ratio of 3:1, which can be dynamically adjusted to 4:1 based on subsequent loss rate monitoring results to balance compression efficiency and detail preservation.
[0243] Small-block low-loss compression execution: Targeting the features of densely detailed areas, 8×8 fixed small blocks are used for compression. The compression algorithm adopts an improved lightweight compression strategy adapted to high-frequency details. Low-loss quantization is performed on the high-frequency components of the detailed areas to reduce the loss of detailed features during the quantization process. At the same time, 1-pixel overlap processing is performed on the block boundaries to avoid block breaks in the detailed areas.
[0244] Joint compression of separated bitstreams: The core feature bitstream and the ordinary feature bitstream are jointly compressed. The core feature bitstream is compressed without loss, while the ordinary feature bitstream is compressed using a regional compression ratio strategy. Finally, they are merged into a complete compressed bitstream to ensure the integrity and decodeability of the data.
[0245] Step S225: Calculate and dynamically monitor the real-time loss rate of detail features to avoid discovering excessive detail loss only after compression is complete;
[0246] Real-time sampling during compression: During the quantization and encoding stages of compression, after each 8×8 block is compressed, the compressed features of that block are sampled to extract key parameters of texture and edge features, forming a compressed feature sampling set.
[0247] Quantitative calculation of detail feature loss rate: The compressed feature sampling set is compared with the original feature parameters of the dense detail region one by one, and the texture feature loss rate and edge feature loss rate are calculated separately. Then, a weighted average is performed with a texture weight of 0.6 and an edge weight of 0.4 to obtain the overall detail feature loss rate. The calculation formula is: Overall detail feature loss rate = Texture feature loss rate × 0.6 + Edge feature loss rate × 0.4. Where, the single feature loss rate = (Original feature parameter value - Compressed feature parameter value) / Original feature parameter value × 100%, only positive values are taken, and 0 is taken if there is no feature loss.
[0248] Full-area dynamic monitoring: After sampling and calculation of all blocks, the overall loss rate of all blocks is averaged by area weight to obtain the global detail feature loss rate of the dense detail area, and it is determined in real time whether the value exceeds the 3% threshold.
[0249] Step S226: Dynamically adjust the compression ratio and complete detailed features to ensure that the loss rate of the final compression result is ≤3%;
[0250] Compression ratio dynamically reduced: If the global detail feature loss rate is >3%, the current compression process is stopped immediately, the compression ratio of ordinary detail regions is reduced to 1:1, the compression ratio of core detail feature regions remains unchanged at 2:1, and the compression process of step 224 is re-executed.
[0251] Original detail feature completion: If the global loss rate is still >3% after reducing the compression ratio, it is determined that the current compression strategy cannot preserve details. The original core detail features of the temporary retention unit in the hierarchical feature cache library and the original ordinary detail features of the detail-dense region are immediately called to perform feature interpolation to complete the features lost during the compression process. After completion, a new detail feature matrix is generated, and compression is re-executed based on a uniform compression ratio of 2:1.
[0252] Termination Judgment: When the global detail feature loss rate is ≤3%, the compression is deemed qualified, the dynamic adjustment and completion process is terminated, and the core compression of the detail-dense area is completed.
[0253] Step S227: Compression results integration and cache data update;
[0254] Post-compressed pixel matrix generation: The qualified compressed bitstream is decoded to generate a post-compressed pixel matrix of densely detailed areas. The block boundaries are lightly softened to avoid block artifacts and ensure the visual continuity of detailed areas.
[0255] Feature data and cache update: The compressed pixel matrix of dense detail regions, the final compression ratio, the global detail feature loss rate, and the core detail feature completion record are synchronously updated to the detail-dense storage unit of the hierarchical feature cache library, overwriting the original preprocessed feature data, and providing a compressed feature benchmark for subsequent complex scene enhancement processing and two-level error correction.
[0256] Output result: The compressed pixel matrix of the dense detail region is initially stitched together with the pixel matrix of the smooth region processed in step S21.
[0257] Step S23: Compress the dynamic blur region and transition area. The specific process is as follows:
[0258] Step S231: Preprocessing of dynamic blurred regions and transition areas, initialization of compression core parameters;
[0259] Dynamic blur region: Set the base compression ratio to 6:1, dynamically adjust the range to ±1:1, initialize the core parameters of the deformable offset prediction algorithm, set the motion trajectory fitting window to 3×3, the feature offset correction threshold to 0.05, and define the blur feature distortion rate threshold to 8%. If the threshold is exceeded, the blur is determined to be aggravated.
[0260] Transition zone: Initialize the core parameters of the softening compression, calculate the weight of the neighborhood compression ratio mean as 1:1, the standard deviation of Gaussian blur edge processing σ=0.4, and the blur range is the entire transition zone;
[0261] Step S232: Preprocess the pixel data of the dynamically blurred region and store the motion features separately;
[0262] Pixel data standardization calibration: Referring to the calibration logic of the smooth area in step S21, the original RGB pixel matrix of the dynamically blurred area is converted into the YUV color space. Offset calibration is performed based on the global YUV mean in the hierarchical feature cache library. The Y value [0,255] and Cb / Cr value [16,240] are checked for numerical range, invalid data is truncated, and the consistency of pixel data is ensured.
[0263] Motion feature extraction and encoding: Extract motion feature vectors of dynamically blurred regions containing pixel offset, motion direction angle, and inter-frame correlation parameters. Use lossless encoding to encode the motion features separately to avoid loss of motion features during compression.
[0264] Motion feature temporary cache: The encoded motion feature data is stored in the temporary retention unit of the hierarchical feature cache library, and stored separately from the pixel data, so as to provide the original motion feature benchmark for subsequent feature offset correction and blur region restoration.
[0265] Step 233: Implement the dynamic blur region elastic compression ratio.
[0266] Fixed block compression settings: Dynamic blur areas without clear detail boundaries are compressed using fixed 8×8 pixel blocks, with a 1-pixel overlap area set at the block boundaries to avoid breakage of the blur trajectory caused by the blocks.
[0267] Pixel data compression execution: Lightweight compression is performed on the pixel matrix of the calibrated dynamic blur region. A lightweight quantization strategy is adopted, with low-loss quantization for low-frequency components and moderate relaxation of quantization standards for high-frequency components to avoid excessive compression that would exacerbate blurring.
[0268] Separate bitstream joint compression: The lossless encoded motion feature bitstream and the pixel data compressed bitstream are jointly encapsulated to form a complete compressed bitstream of the dynamically blurred region, ensuring accurate matching of motion features and pixel data during decoding.
[0269] Step S234: The deformable offset prediction algorithm corrects the dynamic blur feature offset, thereby avoiding the aggravation of blur after compression and pixel distortion from the root, and achieving accurate preservation of dynamic blur features.
[0270] Calculation of compressed feature offset: The compressed feature data of the dynamic blur region is compared with the original features of the dynamic blur region. The feature offset generated during the compression process is calculated pixel by pixel through the 3×3 motion trajectory fitting window of the deformable offset prediction algorithm, including spatial position offset and motion direction offset, and a feature offset matrix is generated.
[0271] Motion feature-guided offset correction: Retrieve the original motion feature data from the temporary cache, and correct the feature offset matrix point by point based on the motion trajectory. For pixels with offsets exceeding the correction threshold of 0.05, feature restoration is performed using neighboring pixel correlation interpolation to correct feature distortion in the dynamic blur region.
[0272] Blur level verification: After the correction is completed, the distortion rate of the blur feature in the dynamic blur region is calculated: distortion rate = (compressed blur level - original blur level) / original blur level × 100%. If the distortion rate ≤ 8%, the correction is deemed qualified; if the distortion rate > 8%, the offset correction process is repeated until the distortion rate meets the threshold requirement.
[0273] Step S235: Dynamically adjust the elastic compression ratio of the dynamically blurred region to ensure that the compression of the dynamically blurred region is always carried out within a range of low loss and without aggravating the blur.
[0274] Compression ratio reduction: If the distortion rate of blurred features is >8%, the current compression process will be stopped immediately, the compression ratio of the dynamic blurred area will be reduced by 1:1, the lower limit of the core compression ratio is 5:1, and the compression and correction process will be re-executed after the reduction.
[0275] Increase compression ratio: If the distortion rate of the blurred features is less than 3%, that is, there is no significant loss of blurred features, the compression ratio can be increased by 1:1 to improve compression efficiency. The upper limit of the core compression ratio is 7:1. After the increase, the distortion rate should be re-verified to ensure that the distortion rate is ≤8%.
[0276] Termination Judgment: When the distortion rate of the fuzzy feature is ≤8%, the compression and correction of the dynamic fuzzy region is deemed qualified, the elastic adjustment process is terminated, and the core compression processing of the region is completed.
[0277] Step S236: Softening and compression processing of the transition area between different regions to eliminate splicing faults and sudden changes in image quality caused by differences in compression ratio between different regions;
[0278] Neighborhood compression ratio mean calculation: Extract the compression ratio parameters of 1-2 adjacent basic regions in the transition zone, calculate the mean of the neighborhood compression ratio with equal weights at a 1:1 ratio, and use this mean as the exclusive compression ratio of the transition zone to achieve a smooth transition of compression ratio;
[0279] Lightweight compression of the transition zone: A compression strategy adapted to the basic region of the transition zone is adopted to perform lightweight compression on the transition zone. All feature data are retained during the compression process, and excessive quantization is not performed to ensure the feature continuity between the transition zone and the neighboring region.
[0280] Gaussian blur edge processing: Gaussian blur edge processing with σ=0.4 is applied to the compressed transition area, covering the entire transition area. Interpolation optimization is performed on the overlapping boundary pixels of the transition area and the neighboring base area to eliminate abrupt changes in image quality in areas with different compression ratios and achieve natural transition between areas.
[0281] Step S237: Integrate the dual-region compression results and update the cached data;
[0282] Compressed pixel matrix stitching: The corrected dynamic blur region compressed pixel matrix and the softened compressed transition region pixel matrix are precisely stitched together with the compressed pixel matrix of the smooth region in step S21 and the detailed dense region in step S22. During the stitching process, the overlapping boundaries of each region are lightly smoothed to ensure the pixel continuity of the entire image.
[0283] Motion feature data fusion: The original motion feature data temporarily cached is precisely fused with the stitched image pixel data, and the motion feature information is embedded into the corresponding pixel position to generate a compressed image feature map containing motion features, which provides a basis for the subsequent restoration of dynamically blurred areas;
[0284] Cache data synchronization update: The compressed pixel matrix, final compression ratio, blur feature distortion rate, and average compression ratio of the neighborhood of the transition area in the dynamic blur region and transition area are synchronously updated to the corresponding storage unit of the hierarchical feature cache library, overwriting the original preprocessed feature data.
[0285] Step S24: Construct a two-level error correction system at the feature level and pixel level. Compared with the existing technology that only provides a single-level error correction, this achieves dual compensation for transmission loss. The specific process is as follows:
[0286] Step S241, preparation for dual-level correction, retrieval of reference data and parsing of feature check codes;
[0287] Reference data retrieval at the sending end: Retrieve the original feature data, compressed feature data, and original pixel matrix of the smoothed region, dense detail region, dynamic blur region, and transition region after processing in steps S21-S23 from the hierarchical feature cache library. At the same time, extract the full-area feature vector of the preprocessed feature map as the sole reference for correction.
[0288] Feature check code generation and transmission: Based on the preprocessed feature map, the sending end generates a unique feature check code according to the region type: smooth, detailed dense, dynamic blur, and transition area. The check code contains encrypted encoding of the region spatial location and core feature parameters. The check code is bound and encapsulated with the image compressed bitstream and transmitted together to ensure that the receiving end can achieve accurate matching of check code-region feature-pixel data.
[0289] Receiver stream parsing: After receiving the compressed stream, the receiver first decapsulates the stream, separates the feature check codes of each region, the compressed feature data, and the compressed pixel matrix, and sorts them according to region type to prepare data for subsequent two-level correction.
[0290] Step S242, the first level of error correction is feature-level error correction, which involves checking the check code and completing the feature information to avoid subsequent pixel-level image quality degradation caused by feature loss from the root cause.
[0291] Cross-end check code region-by-region comparison: The receiving end compares the decapsulated feature check code with the original feature check code pre-stored in the hierarchical feature cache library of the sending end by region and feature type. The feature types are color, edge, texture and motion features. By the coding difference of the check code, the feature loss region, feature loss type and feature loss degree can be accurately identified.
[0292] Quantitative determination of feature loss degree: Set a feature loss quantification threshold. If the deviation of a single type of feature parameter is ≥10%, it is determined as feature loss. Quantify the features that are different after comparison, clarify the loss ratio of each type of feature in each region, and form a feature loss determination table.
[0293] Accurate completion of original feature data: Based on the feature loss judgment table, the original feature data of the corresponding region and type is retrieved from the hierarchical feature cache library. Differentiated completion strategies are adopted for different loss types: For color and texture feature loss, feature interpolation is used to restore the lost feature parameters based on the complete feature data of the neighborhood; For edge and motion feature loss, the original feature data is directly called to restore the features, ensuring the continuity of the edges and the accuracy of the motion features; For slight feature distortion with a deviation of <10%, the original feature data is used for calibration to correct the distorted feature parameters to the original reference range.
[0294] Feature data update after completion: The completed feature data is fused with the compressed feature data at the receiving end to generate full-area feature data after feature-level correction, and synchronously updated to the hierarchical feature cache library to provide a complete feature benchmark for subsequent pixel-level correction.
[0295] Step S243, the second level of error correction is pixel-level error correction, which performs point-by-point verification and abnormal pixel correction to solve the image quality distortion problem at the pixel level;
[0296] Pixel matrix reconstruction and benchmark comparison preparation: Based on the complete feature data after feature-level correction, the compressed pixel matrix of the receiving end is reconstructed; the original pixel matrix of each region is retrieved from the hierarchical feature cache library, and the compressed pixel matrix and the original pixel matrix are spatially aligned according to pixel coordinates to ensure the accuracy of point-by-point comparison.
[0297] Pixel-by-pixel comparison and outlier identification: The aligned pixel matrix is compared pixel by pixel. Pixel value deviation thresholds are set according to color space: YUV space: Y value deviation ±15, Cb / Cr value deviation ±10; RGB space: single channel value deviation ±20. Outlier pixels exceeding the thresholds are identified and classified according to distortion type: block effect is abrupt pixel value changes at block boundaries; ringing effect is pixel value oscillations at image edges; transmission error is randomly occurring pixel value jumps; distortion is pixel deformities caused by motion feature shifts in dynamic blurred areas.
[0298] Abnormal pixel point differentiation correction: For different types of abnormal pixels, precise correction is performed using the original data from the hierarchical feature cache library to ensure continuous and distortion-free pixel values after correction. For block effect-type mutation points, a neighborhood pixel bilinear interpolation algorithm is used to smooth abnormal pixels at block boundaries and eliminate pixel value mutations. For ringing effect-type oscillation points, the original pixel values corresponding to the original edge feature data are used to replace the abnormal points, and then a lightweight Gaussian smoothing with σ=0.3 is applied to the edge region to ensure edge continuity. For transmission error-type random points, the original pixel values from the hierarchical feature cache library are directly used to replace the abnormal points to restore the true pixel values. For distortion points in dynamic blur regions, the original motion feature data separately retained in step S23 is used to perform position correction and value restoration on the distorted pixels to ensure the continuity of the dynamic blur trajectory.
[0299] Pixel-level correction matrix generation: After correcting all abnormal pixels, the corrected pixel data of each region is integrated to generate a pixel-level corrected full-image pixel matrix. This matrix has eliminated pixel distortions caused by transmission / compression, such as blockiness and ringing effects.
[0300] Step S244: Preliminary verification of the dual-level calibration results, quality assessment and data update;
[0301] The calibration result is quantified, and two core quantification criteria are set to evaluate the quality of the calibrated image:
[0302] Feature completeness, the degree of matching between the corrected feature data and the original feature data, must be ≥99%;
[0303] Pixel normality rate: The proportion of normal pixels in the corrected pixel matrix to the total number of pixels, which should be ≥99.5%;
[0304] Threshold determination and secondary correction: If the feature integrity of the whole image is ≥99% and the pixel normality rate is ≥99.5%, the dual-level correction is deemed qualified.
[0305] Step S25: Perform region fusion and softening processing on the image after compression and preliminary correction. Use convolution smoothing algorithm to interpolate and optimize the pixel values of each region and transition area to ensure the continuity of image quality and avoid boundary traces of compressed areas.
[0306] Step S3, complex scene enhancement processing, optimizes the image quality and restores details of the compressed and corrected image. It employs a feature extraction and fusion strategy combining an attention encoder / decoder and a multi-residual network, focusing on enhancing minute details and edge features such as hair and texture. Simultaneously, it corrects limb deformities and motion artifacts in dynamically blurred areas using a neighborhood pixel correlation correction algorithm. A lighting and shadow feature adjustment module balances brightness and contrast under complex lighting conditions, achieving precise restoration of image details, effective elimination of motion artifacts, and global balance of lighting and shadow effects. This significantly improves the visual realism and overall image quality in complex scenes, laying a high-quality image foundation for subsequent cross-device adaptation. The specific process is as follows:
[0307] Step S31: Extract global contextual information and local features of the image through attention encoder and decoder. The attention mechanism focuses on human hair, clothing texture and edge areas to enhance the extraction accuracy of small details and edge features.
[0308] Step S32: Use a multi-level residual network to perform deep fusion on the extracted features, repair the hair details and clothing textures lost during compression and transmission, and correct the problem of blurred edges of the character.
[0309] Step S33: For the dynamic blur area, a neighborhood pixel correlation correction algorithm is used to correct the limb deformities of the moving person and reduce dynamic artifacts; by adjusting the light and shadow features, the complex light and shadow in the short video frame is balanced, and the uniformity of image brightness and contrast is improved.
[0310] Step S4, cross-device adaptive adaptation processing, is an image adaptation optimization for different terminal display needs. By automatically obtaining core parameters such as the resolution and color space of the target display device, it performs adaptive conversion of the color space and intelligent scaling of the resolution to achieve accurate matching of the display parameters of the image with different terminal devices such as mobile phones and computers, ensuring the display consistency of the same image on different devices and improving the visual experience of different terminal users.
[0311] Step S41: Obtain the user terminal device parameters. If it is a mobile phone with an image resolution of 2400×1080 and a color space of sRGB, then perform the following adaptation operation; if it is a computer with an image resolution of 3840×2160 and a color space of AdobeRGB, then perform the corresponding conversion.
[0312] Step S42: Keep the image color space as sRGB to fit the mobile phone. If it is a computer terminal, convert the color space to AdobeRGB to correct the color deviation.
[0313] Step S43: Using a resolution adaptive adjustment algorithm, the 1080P image is scaled to 2400×1080 for mobile phones or 3840×2160 for computers. Combined with the distribution of image features, details such as human hair and clothing texture are preserved to avoid image distortion.
[0314] Step S5: Output the processed image. Verify the adapted short video frame image to confirm that there is no loss of detail, no artifacts, and no color deviation. Then, output the image to the user terminal to complete the image processing.
[0315] In this embodiment, after compressed transmission (average compression ratio 8:1), the processed short video frame images retain complete details such as hair and clothing texture, the compression areas are seamlessly connected, artifacts and limb deformities in dynamic blur areas are effectively corrected, and noise is significantly reduced. Compared with images compressed in fixed levels in the prior art, the PSNR value of the images processed in this embodiment is improved by 8-12dB, and the SSIM value is improved by 0.07-0.11. When displayed on mobile phones and computers, the colors are consistent and there is no distortion, resulting in a significantly improved user experience.
[0316] Example 2
[0317] Furthermore, the specific process for initializing the core parameters of the improved JPEG compression in step S212 is as follows:
[0318] Step A1: The smooth region is divided into two categories according to texture density: a pure smooth region with texture density < 0.1 and a weak texture smooth region with texture density 0.1 ≤ texture density < 0.2, and the pixel coordinate range and color characteristics of the two types of regions are recorded.
[0319] Step A2: Initialize the block segmentation strategy parameters. This improves upon the original JPEG compression algorithm's fixed 8×8 block division, defining focus block size adaptation and boundary overlap:
[0320] Block size parameter definition:
[0321] Set a large block size of 16×16 pixels for pure smooth areas and retain a standard block size of 8×8 pixels for weak texture smooth areas, and clarify the block size determination rules for the two types of areas.
[0322] Boundary overlap parameter definition:
[0323] The number of overlapping pixels at the boundaries of all blocks is uniformly set to 1 pixel. The top, bottom, left, and right boundaries of each block are extended outward by 1 pixel to form an overlapping area with adjacent blocks, thus avoiding block boundary breaks.
[0324] Establishment of block mapping relationships:
[0325] To label the block type of each pixel within the smooth area, generate a mapping table of block number, size, pixel coordinates, and overlapping boundaries, and clarify the specific parameter attributes of each block.
[0326] Step A3, custom quantization table parameter initialization, addresses the color loss caused by the general quantization table in the original JPEG compression algorithm. Custom quantization table parameter initialization is implemented to adjust the quantization step size and adapt the table structure.
[0327] Loading the baseline quantization table: First, load the standard luminance and chrominance quantization tables of the original JPEG compression algorithm as the basis for adjustment;
[0328] Quantization step size adjustment:
[0329] Brightness quantization table adjustment: Reduce all values to 80% of the original value, round down, and ensure that the value is ≥1 to avoid invalid quantization and reduce brightness information loss;
[0330] Colorimetric table adjustment: Reduce all values to 50% of their original values, round down, and ensure that the values are ≥1, with a focus on protecting the color consistency of smooth areas;
[0331] Confirm that the adjusted quantization table has no outliers, such as 0 or negative numbers, and conforms to the characteristics of low texture and high color consistency in smooth areas, ensuring that the quantization process only slightly compresses luminance and chromaticity information.
[0332] Table structure adaptation:
[0333] Adaptation of numerical gradient structure: The numerical gradient of the quantization table of the original general JPEG compression algorithm is that the low-frequency components of the image have small values and the high-frequency components have steeply increased values, which is suitable for general images containing a lot of high-frequency details; however, there are almost no high-frequency components in smooth regions, and this steeply increased gradient will lead to meaningless overquantization.
[0334] During initialization, based on reducing the values of the entire table, the numerical gradient difference within the 8×8 matrix is deliberately reduced, the original steep gradient is changed to a gradual gradient, and the gradient increase is controlled within 80% of the original. This is written into the quantization table parameter initialization rules.
[0335] Luminance / chromaticity table structure ratio adaptation: In the original JPEG compression algorithm quantization table, the chromaticity table values are much larger than the luminance table (the chromaticity step size is 2-5 times that of luminance), and the chromaticity is sacrificed for the compression rate by default; however, the visual perception in the smooth area is extremely sensitive to color deviation, and this ratio will lead to obvious color loss.
[0336] During initialization, the numerical ratio structure of the luminance and chromaticity tables is reconstructed, reducing the numerical difference between the chromaticity and luminance tables from the original 2-5 times to 1.5-3 times; the general structure where the second half of the chromaticity table is all 99 is canceled and replaced with a uniform downward adjustment of the values across the entire table, for example, changing the original 99 to 49, to avoid local extreme quantization step sizes; finally, during parameter initialization, it is clearly stated that the maximum value of the chromaticity table is ≤ 3 times the maximum value of the luminance table, and this is written into the quantization table parameter set.
[0337] For visual weight structure adaptation, during initialization, the quantization table value structure is optimized for visual weights that prioritize color consistency in smooth areas over brightness stability over high-frequency details.
[0338] Colorimeter: Prioritize low and uniform values across the entire area, with no extreme high values, to match color consistency requirements;
[0339] Luminance meter: Only retains extremely small values in the low-frequency range to match the need for stable brightness, and moderately increases the values in the high-frequency range without going to extremes; this structural rule of uniform low chromaticity values + extremely small low-frequency brightness values is solidified as the core parameter for initializing the quantization meter.
[0340] Step A4, entropy coding strategy parameter initialization, is an improvement on the original JPEG compression algorithm's single Huffman coding. Entropy coding strategy parameter initialization addresses encoding type allocation and custom encoding table generation:
[0341] Encoding type allocation rules definition: Luminance components use arithmetic encoding, and chrominance components use custom Huffman encoding;
[0342] Custom Huffman coding table generation: Based on the obtained mean chromaticity value of the smooth region, the frequency of occurrence of chromaticity values is pre-statistically counted, and a Huffman coding table adapted to the smooth region is generated to improve coding efficiency;
[0343] Redundancy bit setting: Configure an additional 1-bit redundancy bit for the chroma component, specify the location for adding the redundancy bit, and prevent color deviation caused by excessive compression of chroma information.
[0344] This embodiment performs a comprehensive customized optimization and reconstruction of the core parameters of existing JPEG compression algorithms based on the characteristics of smooth regions. It overcomes the limitations of existing JPEG algorithms with uniform parameters and no regional differentiation adaptation, perfectly meeting the core requirements of low texture and high color consistency in smooth regions. Compared with existing JPEG compression algorithms, it achieves comprehensive improvements in compression efficiency, image quality preservation, color consistency, and visual continuity in smooth regions. Simultaneously, it avoids the inherent defects of existing JPEG algorithms in smooth region compression from the parameter level. Specific beneficial effects are as follows:
[0345] I. Solve the problem of lack of regional differentiation processing in existing JPEGs and achieve accurate parameter adaptation for smooth regions;
[0346] Existing JPEG compression algorithms use globally uniform parameters to process the entire image indiscriminately, without considering the feature differences between different regions of the image. For the low texture and high color consistency characteristics of smooth regions, there are problems of poor parameter adaptability and ineffective compression loss. This embodiment divides the smooth region into pure smooth region and weak texture smooth region according to texture density, and records the coordinates and color features of each sub-region. This provides the core basis for the differentiated parameter settings of subsequent block segmentation, quantization and encoding, so that all parameter optimizations fit the characteristics of different sub-regions of the smooth region, completely abandoning the one-size-fits-all parameter logic and avoiding the ineffective compression loss caused by uniform parameters to the smooth region from the source.
[0347] 2. Solve the dual problems of block artifacts and low compression efficiency caused by the fixed 8×8 block division in existing JPEG files;
[0348] Existing JPEG algorithms use fixed 8×8 pixel blocks without boundary protection mechanisms. For purely smooth areas lacking detail, these 8×8 blocks generate a large amount of redundant computation, significantly reducing compression efficiency. Simultaneously, abrupt pixel value changes are prone to occur at block boundaries, creating noticeable block artifacts and disrupting the visual continuity of the image. This embodiment addresses this by designing a differentiated block strategy: purely smooth areas use large 16×16 blocks, significantly reducing redundant computation and improving compression efficiency in smooth areas; weakly textured smooth areas retain standard 8×8 blocks, while also preserving the features of local weak textures; and a 1-pixel overlap boundary is set for all blocks, completely avoiding block boundary discontinuities at the parameter level, eliminating block artifacts, ensuring visual continuity in compressed smooth areas, achieving precise matching between block size and regional features, and balancing compression efficiency with image integrity.
[0349] 3. Solve the problems of color loss and meaningless overquantization caused by the existing JPEG general quantization table;
[0350] The existing general quantization table in JPEG has two inherent defects: First, the numerical gradient is small at low frequencies and increases sharply at high frequencies. While suitable for general images containing a large amount of high-frequency details, it causes meaningless overquantization in smooth areas with almost no high-frequency components. Second, the chromaticity table values are much larger than the luminance table values (2-5 times), which by default sacrifices chromaticity for compression ratio. This leads to serious color deviation and loss of chromaticity information in smooth areas where color consistency is critical. This embodiment reconstructs the quantization table by reducing the quantization step size and adapting the table structure depth. The luminance table is reduced to 80% of its original size, and the chromaticity table is reduced to 50%, achieving lightweight quantization of luminance and chromaticity information, minimizing information loss, and focusing on protecting chromaticity information. The numerical gradient difference within the 8×8 matrix is reduced, and the steeply increasing gradient is changed to a gradually increasing gradient, completely avoiding meaningless overquantization in smooth areas.
[0351] The luminance / chromaticity table ratio was reconstructed, reducing the numerical difference between the two from 2-5 times to 1.5-3 times. Extreme values in the chromaticity table were eliminated, and the numerical structure was optimized according to the visual weighting of color consistency in smooth areas > stable luminance > high-frequency details, allowing the chromaticity table to maintain low and uniform numerical characteristics. This customized quantization table perfectly matches the characteristics of smooth areas, focusing on protecting color consistency at the quantization layer, completely solving the color deviation problem caused by existing general-purpose quantization tables, while avoiding the loss of luminance / chromaticity information caused by over-quantization.
[0352] 4. Solve the problems of poor adaptability and easy loss of chroma information in the existing JPEG single Huffman encoding;
[0353] Existing JPEG algorithms employ a single Huffman coding method and a universal coding table, resulting in poor adaptability to different image components (luminance / chrominance) and low coding efficiency. Furthermore, the lack of a dedicated chrominance information protection mechanism makes chrominance information loss during encoding prone to occur, further exacerbating color deviations in smooth areas. This embodiment implements a triple optimization of the entropy coding strategy: First, the luminance component uses arithmetic coding, while the chrominance component uses Huffman coding, achieving precise matching between coding type and component characteristics and improving coding accuracy. Second, a customized Huffman coding table is generated based on the actual chrominance mean of the smooth area, significantly improving coding efficiency and reducing coding redundancy compared to a universal coding table. Third, an additional 1-bit redundant bit is configured for the chrominance component, establishing a dedicated chrominance information protection mechanism at the coding layer to completely avoid chrominance information loss during encoding and further enhance color consistency in smooth areas.
[0354] 5. Overall synergistic effect: Achieves a dual balance of low-loss compression in smooth regions and high compression efficiency;
[0355] This embodiment optimizes parameters in the four aspects mentioned above to form a low-loss compression parameter system specifically for smooth regions. Compared with the existing JPEG algorithm's indiscriminate compression of smooth regions, it achieves the dual goals of image quality preservation and efficiency improvement.
[0356] It completely solves the four core problems of existing JPEG algorithms when compressing smooth regions: blockiness, excessive color loss, meaningless over-quantization, and poor coding adaptability. It ensures consistent color, visual continuity, and low information loss after compression of smooth regions, laying a precise and reliable parameter foundation for the entire patent's adaptive anti-compression transmission processing.
[0357] While preserving high-quality image quality, the compression efficiency of smooth areas is greatly improved through large block design and customized encoding table optimization, which meets the dual requirements of digital media image processing for storage, transmission efficiency and image quality preservation.
[0358] As a core component of the patented regionalized differentiated elastic compression strategy, it provides technical support for differentiated compression of smooth regions and detailed, dynamically blurred regions, promoting the realization of low-loss regional compression of the entire image. Compared with the existing JPEG global unified compression scheme, it significantly improves the compression quality of the entire image.
[0359] Example 3
[0360] Furthermore, step S213 performs improved JPEG pre-optimization on the smooth region, the specific process of which is as follows:
[0361] Step B1 involves benchmark calibration of the smoothed pixel data to eliminate acquisition bias in the original pixel data, unify color and brightness benchmarks, and provide a consistent data foundation for subsequent block segmentation and quantization.
[0362] Retrieve the original RGB pixel matrix of the smooth region from the hierarchical feature cache library and convert it to the YUV color space according to the JPEG standard;
[0363] Based on the global YUV mean (e.g., Y=220, Cb=128, Cr=128) of the smooth region in the cache library, the YUV values of all pixels are offset and calibrated: 128 is the YUV brightness reference value, and the Cb and Cr values are similarly determined to eliminate local brightness / color shifts caused by shooting equipment and ambient light, and ensure global color consistency in smooth areas.
[0364] The numerical range is checked, with the luminance component Y value limited to [0, 255] and the chrominance component Cb / Cr value limited to [16, 240]. Any values exceeding these ranges are truncated to prevent invalid data from entering the subsequent compression process.
[0365] Step B2, the implementation of adaptive block division, physically divides the smooth area into blocks according to the rule of 16×16 for pure smooth areas and 8×8 for weak texture smooth areas, and handles boundary overlap:
[0366] Load the block mapping table generated during the initialization phase, which contains block numbers, sizes, pixel coordinates, and overlapping boundaries, and traverse all pixels in the smooth region;
[0367] The pure smooth area is divided into main blocks of 16×16 pixels. The upper, lower, left and right boundaries of each main block are extended by 1 pixel to form an overlapping area, which shares pixel data with the overlapping area of the adjacent main blocks. The weak texture smooth area is divided into blocks of 8×8 pixels, and also retains an overlapping boundary of 1 pixel.
[0368] Divide all 16×16 main blocks into 4 8×8 sub-blocks, and divide them into upper left, upper right, lower left, and lower right quadrants. Record the relationship between the sub-blocks and the main blocks.
[0369] Generate a block data list containing the pixel matrix, size type, overlapping boundary pixel values, and the type of the smoothing region to which each sub-block and main block belong.
[0370] Step B3, Feature Pre-fusion: Before compression, global and local features are fused to correct local biases in the data blocks and avoid amplifying these biases during subsequent compression.
[0371] Retrieve the global feature vector of the smooth region and the local feature vectors of each sub-block and the main block from the hierarchical feature cache library; calculate the residual value of the local features minus the global features;
[0372] The pixel data in the sub-blocks is corrected based on the residual value. The Y value of each pixel in the sub-block and the main block is equal to the calibrated Y value minus the residual value. The Cb / Cr values are treated similarly. This allows local features to converge with global features, ensuring the consistency of color / brightness in smooth areas. A lightweight Gaussian filter is then applied to the corrected sub-blocks to reduce minor fluctuations in local pixels, adapt to the low-texture and low-detail features of smooth areas, and reduce the ineffective loss of subsequent quantization.
[0373] Step B5, standardizing the output of the preprocessed data, converts the preprocessed chunked data into a standardized format that can be directly read by the improved JPEG compression:
[0374] Data format conversion: Convert the pixel data of all 8×8 sub-blocks into 16-bit signed integers and center them by subtracting 128 from the pixel values, so that the values are distributed in [-128, 127], which conforms to the numerical characteristics of DCT transformation; Label the attributes of each 8×8 sub-block, namely the type of smoothing region it belongs to, whether it is split from a 16×16 main block, and the overlapping boundary mark.
[0375] All 8×8 sub-block data are arranged in spatial order from left to right and from top to bottom to generate the final input data matrix of the improved JPEG compression algorithm. The preprocessed block data and feature correction records are synchronously updated to the hierarchical feature cache library to provide baseline data before compression for subsequent real-time feature loss monitoring.
[0376] Example 3 presents a pre-process optimization scheme for improved JPEG compression in smooth regions. Addressing the problems of uneven color and brightness, amplified block deviations, poor data format compatibility, and block artifacts caused by the lack of targeted pre-processing in existing JPEG compression methods that directly compress raw pixel data, Example 3 refines the pre-compression process through four dimensions: pixel benchmark calibration, adaptive block implementation, global-local feature pre-fusion, and preprocessed data standardization. It translates the parameter optimizations from Example 2 into actual pixel-level operations. Compared to existing JPEG compression algorithms, this scheme improves data quality in smooth regions from the source, laying a standardized and consistent pixel data foundation for subsequent low-loss compression. The beneficial effects of each step and the overall synergy are as follows:
[0377] 1. Solve the problem of lacking pixel-specific calibration in existing JPEGs, achieve global uniformity of color brightness in smooth areas, and eliminate acquisition and conversion deviations;
[0378] Existing JPEG compression methods only perform simple color space conversion and numerical normalization on pixels, without global mean calibration or numerical range verification for smooth areas. Brightness / chromaticity deviations caused by shooting equipment and ambient light are directly retained, and local numerical overflow is prone to occur after color space conversion, leading to uneven color brightness and local distortion in smooth areas after compression. This embodiment uses pixel data benchmark calibration. First, it retrieves the original data from the hierarchical feature cache library to complete the standard RGB to YUV conversion. Then, it performs offset calibration based on the global YUV mean of the smooth area, completely eliminating local brightness / chromaticity shifts. Simultaneously, it performs strict numerical range verification on Y and Cb / Cr values and truncates invalid data, achieving standardization and unbiased uniformity of pixel data in smooth areas. This ensures that the pixel data before compression already has global color brightness consistency, avoiding the image quality imbalance problem caused by data deviations in existing JPEGs.
[0379] 2. To address the issue that existing JPEG block segmentation strategies only remain at the parameter level and lack practical implementation and adaptation, differentiated block segmentation is implemented at the pixel level to avoid block effects at the operational level;
[0380] Existing JPEG's 8×8 block division is a mechanical pixel segmentation, lacking block type labeling, adaptation processing for splitting large blocks into sub-blocks, and actual execution without boundary overlap, only completing simple pixel segmentation. Furthermore, the differentiated block strategy in Example 2, if only remaining at the parameter level, cannot be translated into actual compression processing effects. This example, through adaptive block execution, transforms the parameter-level block strategy into pixel-level actual operation: loading a block mapping table to complete precise pixel division of pure smooth areas (16×16) and weak texture areas (8×8), strictly enforcing the setting of a 1-pixel overlap boundary, and simultaneously standardizing and splitting the 16×16 large block into four 8×8 sub-blocks to adapt to JPEG's DCT transform, ultimately generating a complete data list containing block type, boundaries, and pixel matrix. This step transforms differentiated block division from parameter definition into actual executable pixel processing, achieving precise pixel-level matching between block size and regional features. Moreover, the actual execution of overlap boundaries avoids block effects at the operational level, solving the boundary discontinuity problem after compression caused by existing JPEG mechanical block division.
[0381] 3. To address the issues of lack of feature fusion processing before JPEG compression and amplified local block deviations, pre-correction of local feature deviations is implemented to reduce invalid quantization during compression;
[0382] Existing JPEG directly compresses block pixel data without any feature processing. The deviation between local blocks and global features is continuously amplified during quantization and encoding. For smooth areas with high color consistency requirements, this deviation leads to local brightness / chroma distortion. Furthermore, existing JPEG lacks low-texture adaptation processing for smooth areas, making it prone to invalid quantization of minute pixel fluctuations, increasing compression loss. This embodiment completes deviation correction and texture adaptation before compression through feature pre-fusion: global and local feature vectors are retrieved from a hierarchical feature cache library, residual values are calculated, and block pixel data is corrected based on the residuals, ensuring that local pixel blocks perfectly match the global feature benchmark and completely eliminating local feature deviations. Simultaneously, a lightweight Gaussian filter is applied to the corrected data to smooth minute pixel fluctuations in low-texture areas and adapt to the feature attributes of smooth areas. This step pre-corrects feature deviations at the source, preventing the deviations from being amplified during compression. The smoothed pixel data also reduces invalid quantization operations in subsequent compression, improving compression efficiency while reducing quantization loss.
[0383] 4. Solve the problem of existing JPEG input data lacking standardized format processing and benchmark retention, making the preprocessed data fully compatible with DCT transformation, and providing an accurate benchmark for subsequent loss monitoring;
[0384] Existing JPEG compression only performs simple numerical adjustments on the input data, lacking standardized format conversion and block attribute annotation. This easily leads to poor data compatibility with the DCT transform, resulting in data distortion after transformation. Furthermore, there is no data cache update before compression, and subsequent compression loss monitoring lacks a unified original benchmark, making accurate loss determination impossible. This embodiment achieves format adaptation and benchmark retention of pre-compression data through standardized output of pre-processed data: all 8×8 sub-block data are converted into 16-bit signed integers and centered, ensuring that the numerical distribution perfectly matches the numerical characteristics of the JPEG DCT transform, thus avoiding post-transformation distortion from a format perspective; unique attributes are annotated for each block, enabling accurate block-based processing during subsequent compression; simultaneously, all pre-processed data is synchronously updated to a hierarchical feature cache library, providing unified and traceable pre-compression benchmark data for subsequent real-time feature loss monitoring, solving the problem of ambiguous loss determination caused by the lack of a benchmark in existing JPEG systems.
[0385] 5. Overall collaborative benefits: Construct a complete pre-processing chain of smooth region compression pre-calibration - block segmentation - fusion - standardization, realizing the full-process implementation of improved JPEG compression;
[0386] This embodiment serves as the pixel-level implementation step for parameter optimization in Embodiment 2, and is also a pre-processing data optimization step for improved JPEG compression. Compared to the existing coarse-grained process of direct compression without pre-processing in JPEG, it constructs a refined and standardized pre-processing link for smooth areas, achieving a deep integration of parameter optimization and actual pixel processing.
[0387] The output pixel data has the characteristics of being unbiased, highly consistent, and format standardized, which fully meets the compression requirements of the improved JPEG, allowing the parameter optimization in Example 2 to fully exert its effect and avoiding the reduction in compression effect caused by poor data foundation despite parameter optimization.
[0388] It eliminates the root causes of problems such as uneven color, blockiness, bias amplification, and invalid quantization in existing JPEG compression, significantly improving the data quality before compression in smooth areas and providing a solid foundation for subsequent low-loss compression and dynamic loss monitoring.
[0389] All processing steps rely on a hierarchical feature cache library, enabling precise data retrieval, correction, and retention. This allows for data exchange between preprocessing and subsequent compression and monitoring stages, promoting the collaborative execution of the entire adaptive anti-compression transmission processing. Compared to the existing independent processing methods for each stage of JPEG, this improves the overall processing accuracy and consistency.
[0390] Example 4
[0391] Further, in step S213, feature fusion optimization is performed by fusing global and local features through multi-level residuals. The specific process is as follows:
[0392] Step C1, Global and Local Feature Retrieval and Dimension Alignment: Retrieve global and local feature vectors of the specified dimensions from the hierarchical feature cache library, convert them into 8×8 feature matrices of the same size through spatial pixel ratio mapping, and then perform normalization processing to eliminate the dimensional differences between parameters, so as to achieve accurate spatial matching of feature matrix and pixel matrix, and lay a standardized and consistent data foundation for subsequent residual calculation.
[0393] Step C2, First-level global-local residual construction: Calculate the difference between the global and local feature matrices pixel by pixel to generate a residual matrix, remove abnormal residual values and assign coefficients according to the visual weight of color / brightness priority to generate a weighted global-local residual matrix, accurately capture the feature deviation between local blocks and the global benchmark of smooth areas, and clarify the core correction direction.
[0394] Step C3, Second-level local-neighborhood residual construction: Match effective four-neighborhood blocks for each sub-block and calculate the mean value of neighborhood features. Generate local and neighborhood residual matrices pixel by pixel. Use the same weights as in step C2 to complete the weighting process. Supplement the capture of connection deviations between blocks and provide a compensation basis for solving the block discontinuity problem in subsequent compression. It is an effective supplement to the global-local residual.
[0395] Step C4, Third-level reconstruction and fusion residual construction: The two-level weighted residual matrices are concatenated into a fusion feature map along the channel dimension, input into a lightweight fusion network for deep fusion, output the reconstructed fusion residual matrix and scale it to the range of suitable pixel values, and convert it into a pixel compensation value matrix to achieve accurate comprehensive compensation for local-global and local-neighborhood dual biases, avoiding the one-sidedness of single residual correction.
[0396] Step C5, Feature Fusion and Pixel Matrix Correction: The pixel compensation value matrix is applied pixel by pixel to the preprocessed original pixel matrix to complete the basic correction. Then, a second calibration is performed by smoothing the global Y / U / V mean of the region to make the corrected pixels fit the global color / brightness tone. Finally, invalid pixel values that exceed the standard range are truncated to generate a preliminary optimized pixel matrix to ensure that it meets the DCT transform input requirements of JPEG.
[0397] Step C6, inter-block fusion, softening, and optimized pixel matrix output: Bilinear interpolation is applied to the overlapping boundary of block 1 pixels to soften it, and light Gaussian smoothing is applied to the sub-blocks split from the 16×16 main block to eliminate subtle block traces after feature fusion; then, the optimized pixel data of all sub-blocks are integrated in spatial order to generate the final optimized pixel matrix of the entire smooth area, and the relevant fusion data is updated to the hierarchical feature cache library simultaneously to provide fused benchmark data for subsequent real-time feature loss monitoring.
[0398] Compared to existing general feature fusion methods, this embodiment constructs a closed-loop process encompassing deviation capture, deep fusion, pixel correction, global calibration, block smoothing, and data retention. This achieves both precise and comprehensive feature fusion, completes the transformation from the feature layer to the pixel layer, and also considers format adaptation, visual continuity, and overall process coordination in subsequent compression. The output optimized pixel matrix perfectly matches the core visual requirements of smooth areas and the technical requirements of improved JPEG compression, providing a high-quality, highly consistent, and highly adaptable pixel data foundation for low-loss compression in smooth areas. Compared to existing methods, the fused pixel matrix significantly improves color brightness consistency, visual continuity, and format adaptability while also considering processing efficiency, perfectly meeting the real-time processing needs of digital media short video frames.
[0399] The description of this invention is given for illustrative and descriptive purposes only and is not intended to be exhaustive or to limit the invention to the forms disclosed. Many modifications and variations will be apparent to those skilled in the art. The embodiments were chosen and described in order to better illustrate the principles and practical application of the invention and to enable those skilled in the art to understand the invention and design various embodiments with various modifications suitable for a particular purpose.
Claims
1. A lossless image processing method for digital media, characterized in that: Includes the following steps: Step S1, image preprocessing, is carried out on short video frames using the Canny edge detection algorithm, gray-level co-occurrence matrix texture analysis algorithm, and Alpha channel separation algorithm, outputting a hierarchical feature cache library and a preprocessed feature map containing transition region information; Step S2, adaptive anti-compression transmission processing, based on the hierarchical feature cache library and preprocessed feature map containing transition area information output in step S1, adopts a regionalized differentiated elastic compression strategy for the feature differences of four types of regions: smooth regions, detailed dense regions, dynamic blurred regions and transition connection regions, and constructs a two-level error correction system, supplemented by regional fusion softening processing. Step S3, complex scene enhancement processing, in the image quality optimization and detail restoration of the compressed and corrected image, adopts the feature extraction and fusion strategy of attention codec and multi residual network collaboration, and at the same time corrects limb deformities and dynamic artifacts in the dynamic blur area through the neighborhood pixel association correction algorithm, and balances the brightness and contrast under complex lighting by the light and shadow feature adjustment module. Step S4, cross-device adaptive adaptation processing, is image adaptation optimization for different terminal display needs. It automatically obtains the resolution and color space of the target display device and performs adaptive conversion of color space and intelligent scaling of resolution accordingly. Step S5: Output the processed image. Verify the adapted short video frame image to confirm that there is no loss of detail, no artifacts, and no color deviation. Then, output the image to the user terminal to complete the image processing.
2. The loss-resistant image processing method for digital media as described in claim 1, characterized in that: Step S1 includes the following steps: Step S11: Acquisition of the original image and confirmation of basic parameters; Obtain the original image of the short video frame uploaded by the user, and simultaneously extract and confirm the basic image parameters: resolution 1080P, color space sRGB, pixel bit depth, to form an image basic parameter file; Step S12, image normalization processing; The original image is normalized to a uniform pixel density of 300 dpi. At the same time, the image size is calibrated to maintain the original 1080P resolution and only the pixel density deviation is corrected. The pixel grayscale values are mapped to the standard range of [0, 255] through pixel value normalization. Step S13: Intelligent division of three basic regions; Based on the dual analysis of edge and texture features, the image is divided into three basic regions: smooth regions, densely detailed regions, and dynamically blurred regions. Specific operations are as follows: The Canny edge detection algorithm is used to extract edges from the normalized image. Through Gaussian filtering for noise reduction, gradient calculation, non-maximum suppression, double threshold detection and edge connection, the edge point distribution and edge gradient information of the image are obtained. The gray-level co-occurrence matrix algorithm is used to calculate the texture feature parameters of the image, including contrast, entropy, correlation, and energy, and to quantify the texture density of each region of the image. Region determination is performed by combining edge detection and texture density analysis results: Smooth regions are those where the percentage of edge points is less than 5% and the texture density value is less than 0.
2. Areas with dense detail are defined as those where the percentage of edge points is greater than 20% and the texture density value is greater than 0.
8. The dynamic blur region is a region where the pixel gray value is continuously offset, the edge gradient is blurred, and the texture features have no obvious regularity. The output is a pixel coordinate range marking map of the three basic regions to clarify the spatial position of each region in the image. Step S14: Marking and defining the transition area; For the adjacent boundaries of three basic regions—smooth regions, densely detailed regions, and dynamically blurred regions—edge pixel neighborhood feature analysis is performed to achieve accurate marking of transition areas. Specific operations include: Extract the pixels at the boundaries of the three basic regions, sample the 3×3 neighborhood pixels for each boundary pixel, and calculate the feature similarity of the pixels in the neighborhood, including color similarity and texture similarity; The boundary neighborhood regions with feature similarity between 50% and 80% are marked as transition areas, and the width of the transition area is set to 3-5 pixels; The transition area is marked with independent pixel coordinates and integrated with the marking information of the three basic areas to form a full-area spatial marking map including the transition area.
3. The loss-resistant image processing method for digital media as described in claim 2, characterized in that: Step S1 further includes the following steps: Step S15: Extract multi-dimensional features across the entire region; The Alpha channel separation algorithm is used to extract the three core features of color, edge, and texture from four types of regions in the image: smooth regions, dense detail regions, motion blur regions, and transition areas. The specific operation is as follows: Color feature extraction: Separate the RGB color channels of the image, calculate the color mean, variance, and color gamut distribution range of pixels in each region, and form a color feature vector; Edge feature extraction: Based on the detection results of the Canny algorithm, the edge point coordinates, edge gradient direction, and edge continuity of each region are extracted to form an edge feature vector; Texture feature extraction: Based on the calculation results of the gray-level co-occurrence matrix, extract the texture parameters of contrast, entropy, and correlation of each region to form a texture feature vector; Output feature datasets for smooth regions, densely detailed regions, dynamically blurred regions, and transitional areas, achieving a one-to-one correspondence between features and regions. Step S16: Construct the hierarchical feature cache library; Based on the full-region feature dataset extracted in step S15, a hierarchical feature cache library is constructed according to region type. The specific design is as follows: The hierarchical feature cache library is divided into four independent storage units, corresponding to the smooth storage unit, the detail-intensive storage unit, the dynamic blur storage unit, and the transition area storage unit, respectively. Each storage unit is classified into two levels according to color features, edge features, and texture features, and stores the corresponding feature vectors, parameter values, and pixel coordinate association information. The hierarchical feature cache library adopts a read-write real-time data storage mode, which can be retrieved and compared at any time; Step S17: Preprocessed feature map generation; By integrating a full-region spatial label map containing pixel coordinates and boundary positions of four types of regions—smooth regions, densely detailed regions, motion-blurred regions, and transitional regions—with a full-region feature dataset containing color, edge, and texture features of the four types of regions, a preprocessed feature map containing transitional region information is generated. Using the image pixel matrix as a basis, region labeling information and feature information are embedded into the corresponding pixel positions; The feature map preserves the spatial topology of the image and contains quantized feature parameters of each region, achieving a dual representation of spatial location and feature attributes.
4. The loss-resistant image processing method for digital media as described in claim 1, characterized in that: Step S2 includes the following steps: Step S21: Compress the smooth region; Step S22: Compress areas with dense details; Step S23: Compress the dynamic blur region and the transition area; Step S24: Construct a two-level error correction system at the feature level and pixel level; Step S25: Perform region fusion and softening processing on the image after compression and preliminary correction. Use convolution smoothing algorithm to interpolate and optimize the pixel values of each region and transition area to ensure the continuity of image quality and avoid boundary traces of compressed areas.
5. The loss-resistant image processing method for digital media as described in claim 4, characterized in that: Step S21 includes the following steps: Step S211: Retrieve key features of the smooth region from the hierarchical feature cache library, including the global texture density value, the texture density value of the sub-region divided by a 16×16 pixel grid, and the average RGB / YUV color value, total pixel range, and boundary coordinates of the smooth region with the transition region. Step S212: Set the basic compression ratio to 12:1 and the color deviation rate threshold to 5%. Initialize the core parameters of the improved JPEG compression algorithm. The improved JPEG compression algorithm uses adaptive block division, customized quantization table, and hybrid entropy coding. Step S213, Feature fusion optimization, through multi-level residual fusion of global and local features, to achieve accurate fusion of global color consistency and local details in smooth areas, generating an optimized pixel matrix; Step S214: Run the improved JPEG compression algorithm to complete the compression; Step S215: Calculate the color deviation rate between the compressed data and the original data by real-time feature loss monitoring, calculate the deviation rate of a single block using weighted Euclidean distance, and perform area-weighted averaging of the deviation rates of all blocks to obtain the global deviation rate. Step S216, dynamic adjustment judgment: If the global deviation rate is ≤5%, the color loss is deemed acceptable, and entropy encoding is continued to complete, and compressed data is output; if the global deviation rate is >5%, the compression ratio is reduced to 2:1, and steps S213-S216 are repeated to re-execute the improved JPEG compression algorithm process. Step S217: Output the compressed smooth region pixel matrix and synchronously update the compressed feature data in the hierarchical feature cache library.
6. The loss-resistant image processing method for digital media as described in claim 4, characterized in that: Step S22 includes the following steps: Step S221: Preprocess the densely detailed areas and initialize the core compression parameters; The base compression ratio is set at 3:1, the dynamic adjustment range is ±1:1, and the threshold for the loss of detail features is defined as 3%. If this value is exceeded, it is considered that the loss of detail is excessive. The core parameters for initializing the attention mechanism are: the focus area is the edge points of the detail-dense region and high-texture-density pixels, and the attention weight threshold is set to 0.7; Lightweight operating parameters for initializing the multi-residual network: Simplified adaptation based on detailed region features, enabling 3-layer residual blocks, setting the multi-scale receptive field to 3×3 / 5×5, focusing on the capture and fusion of spatial detailed features; Initialize noise suppression parameters: Set the high-frequency noise detection threshold and configure corresponding suppression strategies for salt-and-pepper noise and Gaussian noise in the detail area; Step S222: Key detail features are anchored and individually retained under the guidance of the attention mechanism; By calculating the texture density and edge gradient values of pixels in the pixel matrix of densely detailed regions, an attention weight value of 0~1 is assigned to each pixel to generate an attention weight map with the same size as the pixel matrix; among which, the core pixel weight of hair strands and clothing texture is ≥0.7, and the background transition pixel weight is <0.
7. Based on the attention weight map, core detail feature regions with weight ≥ 0.7 and ordinary detail feature regions with weight < 0.7 are segmented. The core detail features are encoded separately to generate an independent core feature code stream, which is then separated from the ordinary feature code stream. The encoded core detail features are temporarily stored in the temporary retention unit of the hierarchical feature cache library; Step S223: The multi-residual network captures spatial detail information and suppresses noise. First, texture and edge features within the region are extracted and deeply fused using multi-scale receptive fields to repair minor feature deviations in the preprocessing stage, enhance the spatial continuity of details, and generate a feature-enhanced matrix. Then, a dedicated algorithm is used to accurately identify salt-and-pepper and Gaussian noise within the region, and a noise-suppressing-without-degradation-details combination strategy is adopted to correct noise pixels, ensuring that the original values of core detail pixels are not affected. Finally, a feature matrix with complete detail features and no noise interference is output. Step S224: Layered implementation of the elastic compression strategy; Compression ratio allocation by region: Core detail feature region: adopts a basic low compression ratio of 2:1 with no dynamic upward adjustment space to ensure the integrity of core details; Ordinary detail feature region: adopts a basic compression ratio of 3:1, which can be dynamically adjusted to 4:1 based on subsequent loss rate monitoring results to balance compression efficiency and detail preservation. Small-block low-loss compression execution: Targeting the features of densely detailed areas, 8×8 fixed small blocks are used for compression. The compression algorithm adopts an improved lightweight compression strategy adapted to high-frequency details. Low-loss quantization is performed on the high-frequency components of the detailed areas to reduce the loss of detailed features during the quantization process. At the same time, 1-pixel overlap processing is performed on the block boundaries to avoid block breaks in the detailed areas. Joint compression of separated bitstreams: The core feature bitstream and the ordinary feature bitstream are jointly compressed. The core feature bitstream is compressed without loss, and the ordinary feature bitstream is compressed using a region-based compression ratio strategy. Finally, they are merged into a complete compressed bitstream to ensure the integrity and decodeability of the data. Step S225: Calculation and dynamic monitoring of real-time detail feature loss rate; Real-time sampling during compression: During the quantization and encoding stages of compression, after each 8×8 block is compressed, the compressed features of that block are sampled to extract key parameters of texture and edge features, forming a compressed feature sampling set. Quantitative calculation of detail feature loss rate: The compressed feature sampling set is compared with the original feature parameters of the dense detail region one by one, and the texture feature loss rate and edge feature loss rate are calculated separately. Then, a weighted average is performed with a texture weight of 0.6 and an edge weight of 0.4 to obtain the overall detail feature loss rate. The calculation formula is: Overall detail feature loss rate = Texture feature loss rate × 0.6 + Edge feature loss rate × 0.
4. Where, the single feature loss rate = (Original feature parameter value - Compressed feature parameter value) / Original feature parameter value × 100%, only positive values are taken, and 0 is taken if there is no feature loss; Full-area dynamic monitoring: After sampling and calculation of all blocks, the overall loss rate of all blocks is averaged by area weight to obtain the global detail feature loss rate of the dense detail area, and it is determined in real time whether the value exceeds the threshold of 3%. Step S226: Dynamically adjust the compression ratio and complete detailed features to ensure that the loss rate of the final compression result is ≤3%; Compression ratio dynamically reduced: If the global detail feature loss rate is >3%, the current compression process is stopped immediately, the compression ratio of ordinary detail regions is reduced to 1:1, the compression ratio of core detail feature regions remains unchanged at 2:1, and the compression process of step 224 is re-executed; Original detail feature completion: If the global loss rate is still >3% after reducing the compression ratio, it is determined that the current compression strategy cannot preserve details. The original core detail features of the temporary retention unit in the hierarchical feature cache library and the original ordinary detail features of the detail-dense region are immediately called to perform feature interpolation to complete the features lost during the compression process. After completion, a new detail feature matrix is generated, and compression is re-executed based on a unified compression ratio of 2:
1. Termination Judgment: When the global detail feature loss rate is ≤3%, the compression is deemed qualified, the dynamic adjustment and completion process is terminated, and the core compression of the detail-dense area is completed. Step S227: Compression results integration and cache data update; First, the qualified compressed bitstream is decoded to generate a pixel matrix, and the block boundaries are softened to eliminate block artifacts and ensure visual continuity of detailed areas. Then, the compressed pixel matrix, the final compression ratio, and the feature loss rate are synchronously updated to the hierarchical feature cache library, overwriting the original preprocessed data. Finally, the compressed pixel matrix and the processing results of the smoothed areas are initially stitched together to achieve the initial integration of multi-region processing results.
7. The loss-resistant image processing method for digital media as described in claim 4, characterized in that: Step S23 includes the following steps: Step S231: Preprocessing of dynamic blurred regions and transition areas, initialization of compression core parameters; Dynamic blur region: Set the base compression ratio to 6:1, dynamically adjust the range to ±1:1, initialize the core parameters of the deformable offset prediction algorithm, set the motion trajectory fitting window to 3×3, the feature offset correction threshold to 0.05, and define the blur feature distortion rate threshold to 8%. If the threshold is exceeded, the blur is determined to be aggravated. Transition zone: Initialize the core parameters of the softening compression, calculate the weight of the neighborhood compression ratio mean as 1:1, the standard deviation of Gaussian blur edge processing σ=0.4, and the blur range is the entire transition zone; Step S232: Preprocess the pixel data of the dynamically blurred region and store the motion features separately; Pixel data standardization calibration: Referring to the calibration logic of the smooth area in step S21, the original RGB pixel matrix of the dynamically blurred area is converted into the YUV color space. Offset calibration is performed based on the global YUV mean in the hierarchical feature cache library. The Y value [0,255] and Cb / Cr value [16,240] are checked for numerical range, invalid data is truncated, and the consistency of pixel data is ensured. Motion feature extraction and encoding: Extract motion feature vectors of dynamically blurred regions containing pixel offset, motion direction angle, and inter-frame correlation parameters. Use lossless encoding to encode the motion features separately to avoid loss of motion features during compression. Motion feature temporary cache: The encoded motion feature data is stored in the temporary retention unit of the hierarchical feature cache library, and stored separately from the pixel data; Step 233: Implement the dynamic blur region elastic compression ratio. Fixed block compression settings: Dynamic blur areas without clear detail boundaries are compressed using fixed 8×8 pixel blocks, with a 1-pixel overlap area set at the block boundaries to avoid breakage of the blur trajectory caused by the blocks. Pixel data compression execution: Lightweight compression is performed on the pixel matrix of the calibrated dynamic blur region. A lightweight quantization strategy is adopted, with low-loss quantization for low-frequency components and moderate relaxation of quantization standards for high-frequency components to avoid excessive compression that would exacerbate blurring. Separate bitstream joint compression: The lossless encoded motion feature bitstream and the pixel data compressed bitstream are jointly encapsulated to form a complete compressed bitstream of the dynamic blurred region, ensuring accurate matching of motion features and pixel data during decoding; Step S234: The deformable offset prediction algorithm corrects the dynamic fuzzy feature offset; Calculation of compressed feature offset: The compressed feature data of the dynamic blur region is compared with the original features of the dynamic blur region. The feature offset generated during the compression process is calculated pixel by pixel through the 3×3 motion trajectory fitting window of the deformable offset prediction algorithm, including spatial position offset and motion direction offset, and a feature offset matrix is generated. Motion feature-guided offset correction: Retrieve the original motion feature data from the temporary cache, and correct the feature offset matrix point by point based on the motion trajectory. For pixels with offsets exceeding the correction threshold of 0.05, feature restoration is performed using neighboring pixel correlation interpolation to correct feature distortion in the dynamic blur region. Blur level verification: After the correction is completed, the distortion rate of the blur feature in the dynamic blur region is calculated: Distortion rate = (compressed blur level - original blur level) / original blur level × 100%. If the distortion rate ≤ 8%, the correction is deemed qualified; if the distortion rate > 8%, the offset correction process is repeated until the distortion rate meets the threshold requirement. Step S235: Dynamic adjustment of the elastic compression ratio of the dynamic blurred region; Compression ratio reduction: If the distortion rate of blurred features is >8%, the current compression process will be stopped immediately, the compression ratio of the dynamic blurred area will be reduced by 1:1, the lower limit of the core compression ratio is 5:1, and the compression and correction process will be re-executed after the reduction. Increase compression ratio: If the distortion rate of the blurred features is less than 3%, that is, there is no significant loss of blurred features, the compression ratio can be increased by 1:1 to improve compression efficiency. The upper limit of the core compression ratio is 7:
1. After the increase, the distortion rate should be re-verified to ensure that the distortion rate is ≤8%. Termination Judgment: When the distortion rate of the blurred feature is ≤8%, the compression and correction of the dynamic blurred region is deemed qualified, the elastic adjustment process is terminated, and the core compression processing of the region is completed. Step S236: Softening and compression processing of the transition area between each region; Neighborhood compression ratio mean calculation: Extract the compression ratio parameters of 1-2 adjacent basic regions in the transition zone, calculate the mean of the neighborhood compression ratio with equal weights at a 1:1 ratio, and use this mean as the exclusive compression ratio of the transition zone to achieve a smooth transition of compression ratio; Lightweight compression of the transition zone: A compression strategy adapted to the basic region of the transition zone is adopted to perform lightweight compression on the transition zone. All feature data are retained during the compression process, and excessive quantization is not performed to ensure the feature continuity between the transition zone and the neighboring region. Gaussian blur edge processing: Gaussian blur edge processing with σ=0.4 is applied to the compressed transition area, covering the entire transition area. Interpolation optimization is performed on the overlapping boundary pixels of the transition area and the neighboring base area to eliminate abrupt changes in image quality in areas with different compression ratios and achieve natural transition between areas. Step S237: Integrate the dual-region compression results and update the cached data; First, the compressed pixel matrix of the dynamic blur and transition areas is spatially and precisely stitched with the processing results of the smooth and detail-dense areas, and the overlapping boundaries are smoothed to ensure the pixel continuity of the whole image. Then, the motion features of the temporarily cached dynamic blur area are precisely fused with the stitched pixel data to generate a compressed image feature map containing motion features. Finally, the compressed pixel matrix of the two regions, the final compression ratio, and the distortion rate are synchronously updated to the corresponding units of the hierarchical feature cache library, covering the original preprocessed data. This achieves the integrated integration of the compression results of all partitions of the whole image, and at the same time completes the standardized retention of the full amount of compressed data.
8. The loss-resistant image processing method for digital media as described in claim 4, characterized in that: Step S24 includes the following steps: Step S241, preparation for dual-level correction, retrieval of reference data and parsing of feature check codes; The original and compressed feature and pixel data of smooth regions, dense detail regions, dynamic blur regions, and transition regions are retrieved from the hierarchical feature cache library along with preprocessed feature maps as the sole correction benchmark. Dedicated feature check codes are generated for each region and bound to the compressed bitstream for encapsulation and transmission, achieving accurate matching between check information and image data. At the same time, the receiving end decapsulates the transmitted bitstream, separates the check codes, features, and pixel data of smooth regions, dense detail regions, dynamic blur regions, and transition regions, and sorts them out. Step S242, the first level of error correction is feature-level error correction, which involves checking the check code and completing the feature information to avoid subsequent pixel-level image quality degradation caused by feature loss from the root cause. Cross-end check code region-by-region comparison: The receiving end compares the decapsulated feature check code with the original feature check code pre-stored in the hierarchical feature cache library of the sending end by region and feature type. The feature types are color, edge, texture and motion features. By the coding difference of the check code, the feature loss region, feature loss type and feature loss degree can be accurately identified. Quantitative determination of feature loss degree: Set a feature loss quantification threshold. If the deviation of a single type of feature parameter is ≥10%, it is determined as feature loss. Quantify the features that are different after comparison, clarify the loss ratio of each type of feature in each region, and form a feature loss determination table. Accurate completion of original feature data: Based on the feature loss judgment table, the original feature data of the corresponding region and type is retrieved from the hierarchical feature cache library. Differentiated completion strategies are adopted for different loss types: For color and texture feature loss, feature interpolation is used to restore the lost feature parameters based on the complete feature data of the neighborhood; For edge and motion feature loss, the original feature data is directly called for feature restoration to ensure the continuity of edges and the accuracy of motion features; For slight feature distortion with a deviation of <10%, the original feature data is used for calibration to correct the distorted feature parameters to the original baseline range. Feature data update after completion: The completed feature data is fused with the compressed feature data at the receiving end to generate full-area feature data after feature-level correction, and synchronously updated to the hierarchical feature cache library to provide a complete feature benchmark for subsequent pixel-level correction; Step S243, the second level of error correction is pixel-level error correction, which performs point-by-point verification and abnormal pixel correction to solve the image quality distortion problem at the pixel level; Pixel matrix reconstruction and benchmark comparison preparation: Based on the complete feature data after feature-level correction, the compressed pixel matrix of the receiving end is reconstructed; the original pixel matrix of each region is retrieved from the hierarchical feature cache library, and the compressed pixel matrix and the original pixel matrix are spatially aligned according to pixel coordinates to ensure the accuracy of point-by-point comparison. Pixel-by-pixel comparison and outlier identification: Pixel-by-pixel comparison is performed on the aligned pixel matrix. Pixel value deviation thresholds are set according to color space: YUV space: Y value deviation ±15, Cb / Cr value deviation ±10; RGB space: single channel value deviation ±20. Outlier pixels exceeding the thresholds are identified and classified according to distortion type: Block effect type is pixel value abrupt change points at block boundaries; Ringing effect type is pixel value oscillation points at image edges; Transmission error type is randomly occurring pixel value jump points; Distortion type is pixel distortion points caused by motion feature shift in dynamic blurred areas. Differential correction of abnormal pixels: For different types of abnormal pixels, precise correction is performed using the original data from the hierarchical feature cache library to ensure continuous and distortion-free pixel values after correction. For block effect-type mutation points, a neighborhood pixel bilinear interpolation algorithm is used to smooth abnormal pixels at block boundaries and eliminate pixel value mutations. For ringing effect-type oscillation points, the original pixel values corresponding to the original edge feature data are used to replace the abnormal points, and then a lightweight Gaussian smoothing with σ=0.3 is applied to the edge region to ensure edge continuity. For transmission error-type random points, the original pixel values in the hierarchical feature cache library are directly used to replace the abnormal points to restore the true pixel values. For distortion points in dynamic blur regions, the original motion feature data separately retained in step S23 is used to perform position correction and value restoration on the distorted pixels to ensure the continuity of the dynamic blur trajectory. Pixel-level correction matrix generation: After correcting all abnormal pixels, the corrected pixel data of each region is integrated to generate a pixel-level corrected full-image pixel matrix. This matrix has eliminated pixel distortion caused by transmission / compression, such as blockiness and ringing. Step S244: Preliminary verification of the dual-level calibration results, quality assessment and data update; The calibration result is quantified by two core quantification criteria to evaluate the quality of the calibrated image: feature integrity (the degree of matching between the calibrated and original feature data, which must be ≥99%) and pixel normality (the proportion of normal pixels in the calibrated pixel matrix, which must be ≥99.5%). Threshold judgment and secondary calibration: if the feature integrity of the entire image is ≥99% and the pixel normality is ≥99.5%, the dual-level calibration is deemed qualified.
9. The loss-resistant image processing method for digital media as described in claim 5, characterized in that: The specific process for initializing the core parameters of the improved JPEG compression in step S212 is as follows: Step A1: The smooth region is divided into two categories according to texture density: a pure smooth region with texture density < 0.1 and a weak texture smooth region with texture density 0.1 ≤ texture density < 0.2, and the pixel coordinate range and color characteristics of the two types of regions are recorded. Step A2: Initialize the block segmentation strategy parameters. This improves upon the original JPEG compression algorithm's fixed 8×8 block division, defining focus block size adaptation and boundary overlap: Block size parameter definition: Set a large block size of 16×16 pixels for pure smooth areas and retain a standard block size of 8×8 pixels for weak texture smooth areas, and clarify the block size determination rules for the two types of areas. Boundary overlap parameter definition: The number of overlapping pixels at the boundaries of all blocks is uniformly set to 1 pixel. The top, bottom, left, and right boundaries of each block are extended outward by 1 pixel to form an overlapping area with adjacent blocks, thus avoiding block boundary breaks. Establishment of block mapping relationships: To label the block type of each pixel within the smooth area, generate a mapping table of block number-size-pixel coordinates-overlapping boundary, and clarify the specific parameter attributes of each block; Step A3, custom quantization table parameter initialization, addresses the color loss caused by the general quantization table in the original JPEG compression algorithm. Custom quantization table parameter initialization is implemented to adjust the quantization step size and adapt the table structure. Loading the baseline quantization table: First, load the standard luminance and chrominance quantization tables of the original JPEG compression algorithm as the basis for adjustment; Quantization step size adjustment: Brightness quantization table adjustment: Reduce all values to 80% of the original value, round down, and ensure that the value is ≥1 to avoid invalid quantization and reduce brightness information loss; Colorimetric table adjustment: Reduce all values to 50% of their original values, round down, and ensure that the values are ≥1, with a focus on protecting the color consistency of smooth areas; Confirm that the adjusted quantization table has no outliers, such as 0 or negative numbers, and meets the characteristics of low texture and high color consistency in smooth areas, ensuring that the quantization process only slightly compresses luminance and chromaticity information; Table structure adaptation: Numerical gradient structure adaptation: During initialization, based on reducing the values of the entire table, the numerical gradient difference within the 8×8 matrix is deliberately reduced, the original steep gradient is changed to a gradual gradient, and the gradient increase is controlled within 80% of the original. This is written into the quantization table parameter initialization rules. Luminance / chromaticity table structure matching adaptation: During initialization, the numerical matching structure of luminance and chromaticity tables is reconstructed, reducing the numerical difference between the chromaticity table and luminance table by 1.5-3 times; uniformly lowering the values of the entire table; finally, during parameter initialization, it is determined that the maximum value of the chromaticity table is ≤ 3 times the maximum value of the luminance table, and this is written into the quantization table parameter set. For visual weight structure adaptation, during initialization, the quantization table value structure is optimized for visual weights that prioritize color consistency in smooth areas over brightness stability over high-frequency details. Colorimeter: Prioritize low and uniform values across the entire area, with no extreme high values, to match color consistency requirements; Brightness meter: Only very small values are retained in the low-frequency range to match the need for stable brightness, and the values in the high-frequency range are moderately increased but not to an extreme degree; Step A4, entropy coding strategy parameter initialization, is an improvement on the original JPEG compression algorithm's single Huffman coding. Entropy coding strategy parameter initialization addresses encoding type allocation and custom encoding table generation: Encoding type allocation rules definition: Luminance components use arithmetic encoding, and chrominance components use custom Huffman encoding; Custom Huffman coding table generation: Based on the obtained mean chromaticity value of the smooth region, the frequency of occurrence of chromaticity values is pre-statistically counted, and a Huffman coding table adapted to the smooth region is generated to improve coding efficiency; Redundancy bit setting: Configure an additional 1-bit redundancy bit for the chroma component, specify the location for adding the redundancy bit, and prevent color deviation caused by excessive compression of chroma information.
10. The loss-resistant image processing method for digital media as described in claim 5, characterized in that: Step S213 performs pre-optimization of the smooth region using improved JPEG, and the specific process is as follows: Step B1 involves benchmark calibration of the smoothed pixel data to eliminate acquisition bias in the original pixel data, unify color and brightness benchmarks, and provide a consistent data foundation for subsequent block segmentation and quantization. Retrieve the original RGB pixel matrix of the smooth region from the hierarchical feature cache library and convert it to the YUV color space according to the JPEG standard; Based on the global YUV mean of the smooth region in the cache library, offset calibration is performed on the YUV values of all pixels: 128 is the YUV luminance reference value; the same applies to Cb and Cr values. The numerical range is checked, with the luminance component Y value limited to [0, 255] and the chromaticity component Cb / Cr value limited to [16, 240]. Any values exceeding these limits are truncated. Step B2, the implementation of adaptive block division, physically divides the smooth area into blocks according to the rule of 16×16 for pure smooth areas and 8×8 for weak texture smooth areas, and handles boundary overlap: Load the block mapping table generated during the initialization phase, which contains block numbers, sizes, pixel coordinates, and overlapping boundaries, and traverse all pixels in the smooth region; The pure smooth area is divided into main blocks of 16×16 pixels. The upper, lower, left and right boundaries of each main block are extended by 1 pixel to form an overlapping area, which shares pixel data with the overlapping area of the adjacent main blocks. The weak texture smooth area is divided into blocks of 8×8 pixels, and also retains an overlapping boundary of 1 pixel. Divide all 16×16 main blocks into 4 8×8 sub-blocks, and divide them into upper left, upper right, lower left, and lower right quadrants. Record the relationship between the sub-blocks and the main blocks. Generate a block data list containing the pixel matrix, size type, overlapping boundary pixel values, and type of smoothing region for each sub-block and main block; Step B3, Feature Pre-fusion: Before compression, global and local features are fused to correct local biases in the data blocks and avoid amplifying these biases during subsequent compression. Retrieve the global feature vector of the smooth region and the local feature vectors of each sub-block and the main block from the hierarchical feature cache library; calculate the residual value of the local features minus the global features; The pixel data in the sub-block is corrected based on the residual value. The Y value of each pixel in the sub-block and the main block is equal to the calibrated Y value minus the residual value. The Cb / Cr value is similarly corrected. This allows local features to converge with global features, ensuring the consistency of color / brightness in smooth areas. Lightweight Gaussian filtering is then applied to the corrected sub-block data. Step B5, standardizing the output of the preprocessed data, converts the preprocessed chunked data into a standardized format that can be directly read by the improved JPEG compression: Data format conversion: Convert the pixel data of all 8×8 sub-blocks into 16-bit signed integers and center them by subtracting 128 from the pixel values, so that the values are distributed in [-128, 127], which conforms to the numerical characteristics of DCT transformation; Label the attributes of each 8×8 sub-block, namely the type of smoothing region it belongs to, whether it is split from a 16×16 main block, and the overlapping boundary mark. Arrange all 8×8 sub-block data in spatial order from left to right and top to bottom to generate the final input data matrix of the improved JPEG compression algorithm; and synchronously update the preprocessed sub-block data and feature correction records to the hierarchical feature cache library.