HTJ2K-oriented single-pass accurate rate control method and system, and storage medium
Patent Information
- Application Number
- CN202611297302.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-10-13
AI Technical Summary
然而,这种启发式妥协方案严重牺牲了码率分配的科学性与图像的全局保真度
第一,通过将全量熵编码计算转移至离线训练阶段的前置预估模型,彻底免除了在线编码时对冗余高频位平面的熵编码计算开销,实现了数量级的吞吐量提升,完全释放了HTJ2K标准FBCOT算法在现代多核CPU、GPU及ASIC架构上的并发算力红利。
Smart Images

Figure CN122909389A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of underlying algorithms and integrated circuit architecture design for digital image and video encoding and decoding, specifically to a single-pass precise bitrate control method, system, and storage medium for HTJ2K. Background Technology
[0002] With the booming development of industrial applications such as digital medical imaging (DICOM), digital cinema distribution (DCI), ultra-low latency satellite image downlink, and broadcast-grade 4K / 8K ultra-high-definition video streaming, digital image compression technology faces an unprecedented physical computing power bottleneck in balancing high-speed throughput and high-fidelity image quality.
[0003] The traditional JPEG 2000 Part 1 (i.e., the ISO / IEC 15444-1 standard) has long been the preferred encoding standard for the aforementioned demanding applications. The core encoding engine of traditional JPEG 2000 relies on a context-based adaptive MQ arithmetic encoder, namely the EBCOT (Embedded Block Coding with Optimized Truncation) algorithm. While the EBCOT algorithm provides extremely high compression ratios and fidelity through fine-grained bit-plane scanning and highly complex context modeling, it exhibits a high degree of serial data dependency when processing independent bit planes. This fine-grained embedding characteristic makes it difficult to achieve efficient hardware acceleration of traditional JPEG 2000 on modern multi-core CPUs or GPU architectures with large-scale concurrent instruction streams, resulting in extremely low computational efficiency.
[0004] To completely overcome this throughput bottleneck, the International Organization for Standardization (ISO) introduced the next-generation HTJ2K standard (ISO / IEC 15444-15). The core architectural breakthrough of HTJ2K lies in the introduction of the FBCOT (Fast Block Coding with Optimized Truncation) algorithm, which completely abandons the highly nonlinear and sequence-dependent MQ arithmetic encoder, instead employing variable-length coding (VLC) and adaptive run-length coding (MEL), which have extremely low computational complexity and are highly parallelizable, as the basic entropy coding engine. Because FBCOT eliminates the fine-grained embedding characteristics between bit planes and adopts an innovative design of byte streams growing in opposite directions, HTJ2K achieves an order-of-magnitude improvement in encoding and decoding throughput, fully unleashing the concurrent computing power of modern processors.
[0005] However, the HTJ2K standard left a significant technical gap in its engineering implementation: it primarily specifies the bitstream syntax and reverse parsing logic for the decoder, without providing any mandatory constraints or methodological guidance on how the encoder should perform Rate-Distortion Optimization (RDO) and rate control. In the traditional JPEG 2000 encoding pipeline, precise rate control heavily relies on the Post-Compression Rate-Distortion Optimization (PCRD-opt) mechanism. The PCRD-opt mechanism requires the encoder to first perform 100% full entropy encoding on the Discrete Wavelet Transform (DWT) and all quantized wavelet coefficients to exhaustively generate the true physical rate and true distortion reduction for each independent code block at each candidate truncation point. Subsequently, the system constructs a global Lagrange optimization model to find the globally optimal truncation slope threshold under the constraint of the target rate, ultimately physically discarding redundant encoded data below this threshold.
[0006] In the engineering context of HTJ2K, which pursues extreme speed and extremely low latency, this post-truncation mechanism of "compressing the entire bit first and then physically cutting off the redundant parts" is extremely inefficient and wasteful of computing power. A large amount of computational resources are consumed on high-frequency bit planes that are destined to be discarded, completely offsetting the computational advantage of the FBCOT algorithm in terms of underlying data throughput. Current industry compromises, such as the mainstream Kakadu software, typically employ an experience-based complexity prediction (CPLEX-EST) mechanism. This reduces the computational waste of full entropy encoding by artificially limiting the number of candidate high-throughput sets (HT-Sets) generated for each code block (e.g., forcing a maximum of two sets). However, this heuristic compromise severely sacrifices the scientific nature of bitrate allocation and the global fidelity of the image.
[0007] Therefore, there is an urgent need in this field for a single-pass rate control scheme that can determine the optimal truncated bit plane of each code block before entropy coding, so as to fundamentally eliminate the computational overhead of full entropy coding of redundant high-frequency bit planes while retaining the extreme throughput advantage of HTJ2K. Summary of the Invention
[0008] To address the aforementioned issues, this application provides a single-pass precise rate control method, system, and storage medium for HTJ2K. It obtains the spatial and frequency statistical features of each independent code block through vectorized feature extraction and inputs them into a prediction model to obtain rate distortion prediction data. Based on this, it determines the optimal truncation bit plane for each code block. Then, it forcibly clears the low-bit amplitude data below the optimal truncation bit plane in physical memory before sending it to an entropy encoder to perform single-pass entropy encoding and output the physical bit stream. This achieves single-pass precise rate control without requiring full entropy encoding, fundamentally eliminating the computational overhead of entropy encoding for redundant high-frequency bit planes while retaining the extreme throughput advantage of HTJ2K.
[0009] The technical solution adopted in this application is as follows: In a first aspect, this application provides a single-pass precise rate control method for HTJ2K, including discrete wavelet transform and quantization steps, characterized in that it further includes: Feature extraction steps: Extract the spatial and frequency statistical features of each independent code block; Rate-distortion prediction steps: Input spatial and frequency statistical features into the prediction model to obtain rate-distortion prediction data for each independent code block at the candidate truncation point; The truncation strategy determination steps are as follows: Based on rate-distortion prediction data, determine the optimal truncation bit plane for each independent code block; Physical pre-truncation step: Force the low-order amplitude data below the optimal truncation bit plane to be zeroed in physical memory; Single-pass entropy coding steps: The wavelet coefficients after physical zeroing are fed into the entropy encoder to perform single-pass entropy coding and output the physical bit stream.
[0010] Secondly, this application also provides a single-pass precise bitrate control system for HTJ2K, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the above-described single-pass precise bitrate control method for HTJ2K.
[0011] Thirdly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described single-pass precise bit rate control method for HTJ2K.
[0012] The above-mentioned technical solution adopted in this application can achieve the following beneficial effects: First, by transferring the full entropy encoding computation to the pre-prediction model in the offline training stage, the entropy encoding computation overhead of redundant high-frequency bit planes during online encoding is completely eliminated, achieving an order-of-magnitude throughput improvement and fully releasing the concurrent computing power dividend of the HTJ2K standard FBCOT algorithm on modern multi-core CPU, GPU and ASIC architectures.
[0013] Second, through data format consistency conversion and composite mask repair mechanism, it is perfectly compatible with the symbol-amplitude data representation specification of the underlying layer of JPEG 2000 standard (ISO / IEC 15444-1), eliminating the algebraic cliff change and high-frequency image tearing problem caused by direct masking operation of negative coefficients, and ensuring the mathematical consistency of the entire encoding and decoding link.
[0014] Third, by cleaning up mathematical barriers through convex hull estimation, the noise predicted by machine learning models or multidimensional probability lookup tables (LUTs) is eliminated, which disrupts the monotonically decreasing convexity of rate-distorted data. This ensures the absolute mathematical convergence of the Lagrange bisection method iteration and fundamentally avoids the image mosaic effect caused by algorithm collapse.
[0015] Fourth, by using a closed-loop CBR accuracy fallback fault-tolerance mechanism, and combining front-end open-loop prediction with back-end compliance fine-tuning, it achieves absolute precision constant bit rate control while maintaining maximum throughput per pass, thus meeting the rigid constraints on channel bandwidth required by demanding industrial scenarios such as digital cinemas and satellite downlinks. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating a single-pass precise bit rate control method for HTJ2K according to an embodiment of this application is shown. Figure 2 A schematic diagram of the structure of a single-pass precise bit rate control system for HTJ2K according to an embodiment of this application is shown. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] This application aims to completely circumvent the massive computational overhead caused by full entropy coding and post-truncation (PCRD-opt) in traditional JPEG 2000 and HTJ2K engineering implementations, and provides a single-pass precise bitrate control method. Simultaneously, this application systematically addresses engineering vulnerabilities in the feedforward prediction architecture regarding the underlying data flow, mathematical assumptions of the optimization algorithm, and industrial-grade fault tolerance mechanisms, ensuring that this single-pass coding system can be stably fabricated on modern hardware architectures and achieve absolute precision constant bitrate control.
[0019] Figure 1 A flowchart illustrating a single-pass precise rate control method for HTJ2K according to an embodiment of this application is shown. (Refer to...) Figure 1 As shown, the single-pass precise bit rate control method for HTJ2K proposed in this embodiment is implemented by the processor of a computer device, including discrete wavelet transform and quantization steps, and further includes steps S110 to S150: Step S110, Vectorized Feature Extraction Step: Extract the spatial and frequency statistical features of each independent code block.
[0020] After the original image has undergone Discrete Wavelet Transform (DWT) and scalar quantization, and before it enters entropy coding, a vectorized feature extraction step is performed to extract the spatial and frequency statistical features of each independent code block.
[0021] In some optional implementations, step S110, the vectorization feature extraction step, includes: extracting the spatial and frequency statistical features of each independent code block based on SIMD vectorization instructions; wherein, the spatial and frequency statistical features include: subband direction, absolute density of non-zero coefficients at each bit plane, maximum effective bit plane, and estimated subband energy distribution; wherein, the estimated subband energy distribution includes: L1 absolute norm or L2 Euclidean norm.
[0022] Specifically, the system utilizes the SIMD vectorized parallel instruction set (such as AVX2, AVX-512) of modern multi-core CPUs or GPUs to extract spatial and frequency statistical features in physical memory in parallel, on an independent code block basis. During this process, for incomplete code blocks of non-standard dimensions or unaligned memory strides, the system strictly implements boundary protection and zero-padding verification mechanisms to prevent the security risks of out-of-bounds memory reads.
[0023] This extraction process completely avoids complex contextual state modeling, focusing only on macroscopic statistics. This step forms the input feature vector. .
[0024] Spatial and frequency statistical characteristics include, but are not limited to: the sub-band direction to which the independent code block belongs (e.g., four orthogonal sub-band direction types: LL, HL, LH, HH), the absolute density of non-zero coefficients in each bit plane, and the maximum effective bit plane of the independent code block. The subband energy distribution estimate includes the L1 absolute norm or L2 Euclidean norm, which characterizes the visual complexity and energy concentration of the independent code block.
[0025] Because of the use of SIMD register-level concurrent operations, the time overhead of feature extraction is negligible in the entire encoding pipeline.
[0026] Step S120, Rate-distortion prediction step: Input spatial and frequency statistical features into the prediction model to obtain the rate-distortion prediction data of the corresponding independent code block at the candidate truncation point.
[0027] Input the spatial and frequency statistical features extracted in step S110 into the prediction model to obtain the rate-distortion prediction data of the corresponding independent code block at the candidate truncation point, namely the predicted code rate and the predicted distortion.
[0028] In some optional implementations, in step S120, the prediction model is constructed as follows: in an offline state, a sample dataset is obtained from the sample images through a full post-compression rate-distortion optimization process. The sample dataset contains the spatial and frequency statistical features of each independent code block at each candidate truncation point, as well as the true code rate and true distortion corresponding to the spatial and frequency statistical features. Based on the sample dataset, a supervised learning or statistical aggregation method is used to train or construct the prediction model to obtain the prediction model.
[0029] The core mechanism of this application is to transfer the extremely time-consuming exhaustive calculation of full entropy encoding to the "offline training stage", extract the implicit mapping relationship between spatial and frequency statistical features and rate distortion prediction data, thereby realizing "pre-physical truncation" and single-pass entropy encoding based on Lagrange multiplier iteration during online encoding.
[0030] Specifically, the prediction model is pre-built using an offline learning mechanism, as follows: In offline mode, the sample images were exhaustively traversed using HT-Tier-1 entropy encoding with a traditional full-scale post-compression rate-distortion optimization (PCRD-opt) process. The sample images (i.e., the dataset) covered medical images with complex texture distributions, natural landscape images with a large number of smooth gradients, and standard test images containing extreme high-frequency signals.
[0031] At each candidate cutoff point (i.e., the end of a valid channel), record the spatial and frequency statistical characteristics, and record the actual generated physical byte length. As a true bitrate label, it records the actual amount of distortion reduction. As a label for true distortion.
[0032] Based on these exhaustive methods, the spatial and frequency statistical features and the true bitrate label are obtained. and Real Distortion Labels The prediction model is obtained by training or building the model using supervised learning or statistical aggregation methods.
[0033] eigenvectors The data is fed into the offline-fixed prediction model, which instantly outputs the predicted bitrate of each independent code block at all candidate truncation points. And prediction distortion .
[0034] To address the computing power constraints of different hardware platforms, this application provides the following three strictly defined prediction model implementation examples (the core hyperparameter physical settings all inherit from the existing architecture).
[0035] (a) The prediction model is a multidimensional probability lookup table.
[0036] The address space of the multidimensional probabilistic lookup table is constructed as follows: the first-dimensional index maps the orthogonal subband direction type; the second-dimensional index uses uniform scalar quantization to partition the coefficient sparsity; the third-dimensional index uses a nonlinear logarithmic algorithm to quantize the subband energy norm characteristics; the indices of each dimension are concatenated into physical pointers; the physical pointers are used to directly address the block random access memory on the hardware chip; in the rate-distortion prediction step, the obtained subband direction, absolute density of non-zero coefficients, and estimated subband energy distribution values are discretized into the first-dimensional index, the second-dimensional index, and the third-dimensional index, respectively, and concatenated into physical pointers before the table is looked up to read the predicted bit rate and predicted distortion.
[0037] Multidimensional probabilistic lookup tables (LUTs) for FPGA / ASIC hardware construct a high-dimensional lookup space for pure hardware tape-out scenarios without branch prediction units: The first dimension (2 bits) index discretization map has four orthogonal subband direction types (e.g., LL, HL, LH, HH). The second dimension (4-bit) index uses uniform scalar quantization, which equally divides the floating-point range of coefficient sparsity into 16 gradients; The third dimension (6-bit) index uses a non-linear logarithmic quantization algorithm, which divides the low-energy range densely and the high-energy range sparsely, mapping the continuous sub-band energy norm features to 64 discrete gradients.
[0038] These three dimension indices are instantly concatenated into a 12-bit physical pointer in the register (e.g., total). =4096 address spaces), this physical pointer is used to directly address the on-chip block random access memory (BRAM) to achieve single-clock-cycle zero-delay table lookup to read the estimated code rate and estimated distortion.
[0039] During the online inference phase, the rate-distortion prediction step specifically performs the following operations: the subband direction, absolute density of non-zero coefficients, and estimated subband energy distribution values obtained in step S110 are discretized respectively: the subband direction is discretized into a first-dimensional index, the absolute density of non-zero coefficients is discretized into a second-dimensional index through uniform scalar quantization, and the estimated subband energy distribution values are discretized into a third-dimensional index through nonlinear logarithmic algorithm quantization; the above three-dimensional indices are concatenated into a physical pointer; the on-chip block random access memory (BRAM) is directly addressed using the physical pointer, and the pre-stored predicted code rate and predicted distortion are read in parallel from this address as the rate-distortion prediction data of the independent code block at the current truncation point.
[0040] (ii) The prediction model is support vector regression.
[0041] Support vector regression is configured as follows: high-dimensional spatial mapping is performed using a linear kernel function on the feature input of the low-frequency wavelet subband, and high-dimensional spatial mapping is performed using a radial basis function kernel function on the feature input of the high-frequency wavelet subband; the regularization penalty parameter and the insensitive loss band hyperparameter are set according to offline cross-validation; in the rate-distortion prediction step, the obtained spatial and frequency statistical features are input into support vector regression, and after kernel function mapping and regression calculation, the predicted code rate and predicted distortion of each independent code block at each candidate truncation point are output.
[0042] For general-purpose CPU scenarios, the system dynamically switches kernel functions to handle the non-stationary data distribution of different subbands. For low-frequency subbands (e.g., LL), since the number of physical bytes generated by HT-Tier-1 variable-length coding (VLC) exhibits a strong linear correlation with the density of non-zero coefficients, the system forces the use of a linear kernel to achieve extremely fast dot product operations. For high-frequency subbands (e.g., HL, LH, HH), whose texture distribution is highly nonlinear, the system uses a radial basis function (RBF) kernel for high-dimensional space fitting.
[0043] The system's regularization penalty parameter The hyperparameters of the insensitive loss band (Epsilon-tube) are strictly set according to offline K-fold cross-validation. Its core physical purpose is to suppress the overfitting of the prediction model to extreme high-frequency sensor noise (such as medical image noise) and ensure the robustness of online generalization.
[0044] During the online inference phase, the rate-distortion prediction step specifically performs the following operations: the spatial and frequency statistical features extracted in step S110 are assembled into an input feature vector, which is then input into the trained support vector regression; the support vector regression automatically selects the corresponding kernel function based on the subband type to which the current independent code block belongs—if it is a low-frequency subband, a linear kernel function is called for high-dimensional spatial mapping, and if it is a high-frequency subband, a radial basis function is called for high-dimensional spatial mapping; after kernel function mapping, the model performs regression calculations and outputs the predicted code rate and predicted distortion of the independent code block at each candidate cutoff point.
[0045] (iii) The prediction model is a shallow regression decision tree.
[0046] The shallow regression decision tree is configured as follows: the node feature splitting criterion adopts mean square error or mean absolute error; the maximum depth is less than 5 layers, so that the hardware clock cycle of a single tree inference traversal is less than the time consumption of discrete wavelet transform; in the rate-distortion prediction step, the obtained spatial and frequency statistical features are input into the shallow regression decision tree, and after feature judgment and branch traversal of each layer node, the leaf node outputs the predicted code rate and predicted distortion of each independent code block at each candidate truncation point.
[0047] When using shallow regression decision trees, the node feature splitting criterion is strictly locked to mean squared error (MSE) or mean absolute error (MAE), and the use of Gini impurity from classification tasks is absolutely prohibited. The key hyperparameter—the maximum depth of the tree—is strictly and rigidly thresholded to less than 5 layers. The mathematical basis for setting this threshold is directly linked to the underlying hardware pipeline: it must be guaranteed from the CPU instruction set level that the single inference traversal time of the decision tree (requiring at most 4-5 if-else branch clock cycles) is strictly less than and negligible compared to the pipeline stall penalty time caused by traditional DWT transformation and branch prediction failures, thus establishing the extreme speed advantage of Single-Pass on the basis of computing power.
[0048] During the online inference phase, the rate-distortion prediction step specifically performs the following operations: The spatial and frequency statistical features extracted in step S110 are assembled into an input feature vector, which is then input into the pre-trained shallow regression decision tree. Starting from the root node, the decision tree judges the corresponding features in the input feature vector according to the feature splitting criteria of the current node—if the splitting condition is met, it enters the left child node; otherwise, it enters the right child node. The above node feature judgment and branch traversal process is repeated until a leaf node is reached. The leaf node stores the pre-trained regression values, i.e., the predicted code rate and predicted distortion of the independent code block at each candidate truncation point. The system directly reads the stored values of the leaf node as the rate-distortion prediction data output for the current independent code block.
[0049] In a preferred embodiment, the shallow regression decision tree is trained through offline supervised learning. Its training dataset is collected from a standard test image set containing high-texture natural photographs, smooth grayscale medical images, and high-resolution digital masters. During the compilation phase, conditional compilation macros are enabled, and speculative coding loops are executed on each independent code block of each of the HL, LH, and HH high-frequency subbands within the encoder. Different candidate truncation bit planes are traversed, and spatial and frequency statistical features, true bitrate labels, and true distortion labels are collected. These are written to a structured data file through a multi-threaded thread-safe mechanism, resulting in approximately 926,000 valid samples. These samples are roughly evenly distributed among the HL, LH, and HH high-frequency subbands. Before training, invalid samples containing outliers are filtered out, and redundant samples with no bitrate output after full truncation can be removed as needed.
[0050] The input features used for training reuse spatial and frequency statistical features, namely subband direction, maximum effective bit plane, absolute density of non-zero coefficients at each bit plane, and estimated subband energy distribution, which are superimposed with candidate truncation bit plane indices to form a five-dimensional input feature vector. The high-frequency subbands are grouped into three categories: HL, LH, and HH. For each category of subbands, a rate prediction tree and a distortion prediction tree are trained separately, resulting in a total of 6 independent shallow regression decision trees. The decision trees are strictly configured with a maximum depth of 4 layers, and the mean squared error (MSE) is used as the node splitting criterion. A fixed random seed is set to ensure that the training process is reproducible. Each decision tree contains a maximum of 31 tree nodes.
[0051] After training, all node parameters of the six decision trees are exported as C++ constant structure arrays, compiled and linked into the encoder program in static constant form. During online inference, there is no need to read external model files, eliminating file I / O and dynamic loading overhead. The inference process follows the branch traversal logic of the aforementioned shallow regression decision tree, reaching a leaf node after at most four branch jumps. The predicted value stored in the leaf node is directly read as the predicted bitrate and predicted distortion corresponding to the candidate truncation point of that independent code block. The inference operation does not cause any interruption to the encoding pipeline.
[0052] After offline training, model accuracy was validated: the bitrate prediction tree achieved a coefficient of determination R0 under 5-fold cross-validation. 2 All are greater than 0.73, and the mean absolute error of bitrate prediction is 59. Within a 120-byte range, distortion prediction exhibits a certain estimation error, which is absorbed by convex hull cleaning and Lagrange iteration optimization mechanisms in subsequent steps, thus not degrading the overall bitrate control performance. End-to-end encoding verification shows that this prediction model, combined with the remaining processes of this application, can achieve accurate target bitrate hits; simultaneously, consistency unit tests were conducted between C++ inference and Python training outputs, and the numerical error between the two outputs is less than 1×10⁻⁶. -4 .
[0053] It should be noted that this application does not limit the use of the above-mentioned sample size. Those skilled in the art can adjust the training image set and sample size according to the image service scenario. As long as the aforementioned collection, training, and deployment process is followed, a shallow regression decision tree model that meets the bitrate prediction accuracy requirements can also be obtained. Multidimensional probability lookup tables and support vector regression are alternative implementation methods of this application.
[0054] Step S130, truncation strategy determination step: Based on rate-distortion prediction data, determine the optimal truncation bit plane for each independent code block.
[0055] Based on the rate-distortion prediction data obtained in step S120, the predicted convex hull cleaning is introduced, and combined with the Lagrange bisection method for iterative global optimization, the optimal truncation bit plane of each independent code block is determined.
[0056] In some optional implementations, step S130, the truncation strategy determination step, before determining the optimal truncation bit plane for each independent code block, further includes: performing non-convex cleaning on the candidate truncation points of each independent code block, eliminating invalid candidate truncation points that cause the rate distortion slope to be non-monotonically decreasing, and constructing a set of valid candidate truncation points with strictly monotonically decreasing rate distortion slope.
[0057] Specifically, for each independent code block, all candidate truncation points are extracted and sorted from high to low according to the truncation bit plane; an effective convex hull stack is initialized, and the starting candidate truncation point is pushed onto the stack as the top element; subsequent candidate truncation points are traversed sequentially, calculating the first rate-distortion slope between the current candidate truncation point and the current top candidate truncation point, and calculating the second rate-distortion slope between the current top candidate truncation point and the adjacent previous candidate truncation point; if the first rate-distortion slope is less than the second rate-distortion slope, the current candidate truncation point is selected as the top candidate truncation point. The new top element is pushed onto the stack; when the first rate distortion slope is not less than the second rate distortion slope, the current top candidate cutoff point is popped, and the adjacent previous candidate cutoff point is taken as the current top candidate cutoff point. The first rate distortion slope and the second rate distortion slope are recalculated until the first rate distortion slope is less than the second rate distortion slope. Then, the current candidate cutoff point is pushed onto the effective convex hull stack as the new top element. After traversal, the candidate cutoff points stored in the effective convex hull stack constitute the set of effective candidate cutoff points for this independent code block.
[0058] Because the prediction model inevitably contains generalization errors and local quantization noise, its rate-distorted prediction data often exhibits local slope increases or oscillations, violating the strict monotonically decreasing property. If this non-convex data is directly fed into the Lagrange optimization solution, the subsequent bisection method will fall into a global infinite loop due to the non-monotonic derivative, resulting in severe mosaic effects in some areas of the image. By automatically eliminating invalid candidate cutoff points that cause slope inversion due to generalization noise interference from the prediction model, the prediction data input to the bisection iterative engine is ensured to strictly satisfy the monotonically decreasing convex hull mathematical assumption, completely avoiding algorithm crashes or falling into local infinite loops.
[0059] Specifically, a linear traversal convex hull cleaning preprocessing step with extremely low complexity is inserted between the predicted model output rate distortion prediction data and the Lagrange bisection method iterative global optimization.
[0060] In obtaining the estimated code rate of each independent code block And prediction distortion Then, for each independent code block The system initiates a stack-based linear time complexity scanning mechanism: 1. Extracting independent code blocks All candidate cutoff points are sorted from high to low according to the cutoff bit plane (i.e., the amount of information retained gradually increases, and the bit rate gradually increases), and set as ,in Indicates the index of the candidate cutoff point.
[0061] 2. Initialize the valid convex hull stack and push the starting candidate cutoff point (i.e. the starting zero cutoff point) onto the bottom of the stack.
[0062] 3. Iterate through subsequent candidate cutoff points in turn, and calculate the unit distortion reduction rate between the current candidate cutoff point and the current top candidate cutoff point. (i.e., slope) ), calculate the unit distortion reduction rate between the current candidate cutoff point at the top of the stack and the adjacent previous candidate cutoff point. (i.e., slope) ). 4. Comparison and Under the strict convex hull assumption, the following must be satisfied: .
[0063] 5. If determined If the slope is inverted due to noise in the prediction model (more bitrate is consumed without a corresponding reduction in distortion), then the system will forcibly pop the current top candidate cutoff point from the stack and recalculate the slope using the adjacent previous candidate cutoff point as the current top candidate cutoff point, until the monotonically decreasing inequality is satisfied.
[0064] 6. Those that meet the requirements Push the required candidate cutoff points onto the stack and continue traversing.
[0065] After this linear scan traversal with extremely low time complexity (O(N)), each independent code block constructs a strictly monotonically decreasing set of valid candidate cutoff points in memory. This mathematical cleaning barrier fundamentally eliminates the hidden dangers of non-convex data, ensuring strict convergence of subsequent operations research optimizations.
[0066] In some optional implementations, step S130, determining the optimal truncation bit plane for each independent code block, includes: based on the set of valid candidate truncation points, introducing Lagrange multipliers and employing an iterative optimization algorithm to determine the optimal truncation bit plane for each independent code block.
[0067] Specifically, the rate-distortion slope at each candidate truncation point is calculated; a search interval for the Lagrange multiplier is defined, and the midpoint of the search interval is taken as the current Lagrange multiplier; in the set of valid candidate truncation points, the candidate truncation point where the rate-distortion slope first crosses the current Lagrange multiplier is searched, which is taken as the candidate truncation bit plane for that independent code block under the current Lagrange multiplier; the predicted code rate in the rate-distortion prediction data of each independent code block at the candidate truncation bit plane is accumulated to obtain the total predicted code rate of the whole graph; the total predicted code rate of the whole graph is compared with the target code rate, and the upper and lower bounds of the search interval are updated by halving according to the comparison result, and the midpoint of the new search interval is taken to continue iterating until the iteration converges, and the best truncation bit plane of each independent code block is output.
[0068] After the convex hull cleaning is completed, the system faces a constrained global nonlinear optimization problem: at a set target bitrate... Under constraints, we seek a truncation strategy that minimizes the total prediction distortion of the entire graph. To this end, the system introduces Lagrange multipliers. The total bandwidth constraint optimization of the entire graph is equivalently decomposed into an unconstrained optimization that finds the minimum value for each independent code block, i.e. The classic and extremely fast bisection method is employed to search for the globally optimal Lagrange multiplier on the set of valid candidate cutoff points. .
[0069] First, calculate the rate-distortion slope at each candidate cutoff point in the set of effective candidate cutoff points, and then set the search interval. Take the midpoint .
[0070] against The system iterates through the set of valid candidate cutoff points for independent code blocks, searching for the first time the rate-distortion slope crosses the threshold. The candidate cutoff point, as the independent code block in The candidate truncation plane below.
[0071] Then, the predicted code rates of each independent code block are summed from the rate-distortion prediction data at the candidate truncated bit plane to obtain the total predicted code rate for the entire map. .
[0072] according to and Based on the size relationship, the system continuously updates the upper and lower bounds of the search interval by halving. Since the input data is strictly protected (predicted convex hull cleaning), the bisection method can ensure absolute convergence to the global optimum within an extremely limited number of iterations, and output the exact optimal truncation bit plane indicator for each independent code block to the system bus.
[0073] Step S140, Physical pre-truncation step: Force the low-order amplitude data below the optimal truncation bit plane to be zeroed in physical memory.
[0074] After parsing the optimal truncation bit plane for each independent code block in step S130, a forced zeroing operation needs to be performed in physical memory using SIMD vectorization instructions to cut off the path for excess data to enter the entropy coding engine.
[0075] In some optional implementations, step S140, the physical pre-truncation step, includes: performing data format consistency processing on the wavelet coefficients after discrete wavelet transform and quantization to obtain a representation format with separated signs and amplitudes; generating a composite mask vector; wherein the composite mask vector is configured to retain the most significant sign bit and clear the low amplitude bits below the optimal truncation bit plane; performing a bitwise AND operation on the wavelet coefficients after format conversion using the composite mask vector to forcibly clear the low amplitude data below the optimal truncation bit plane in physical memory.
[0076] Modern processors default to storing signed integers in two's complement format. However, the underlying architecture of the JPEG 2000 standard (ISO / IEC 15444-1) strictly requires that wavelet coefficients be converted to a specific sign-magnitude representation before entering the Tier-1 encoder. If a bitwise AND operation is blindly applied to clear the lower bits directly in the native two's complement state, for negative coefficients, directly clearing the lower bits of their two's complement will completely destroy their algebraic consistency (e.g., truncating -5 to -8), causing a precipitous change in the decoded value, resulting in severe high-frequency tearing and noise in the image. Conversely, if a global mask is used directly, it is very easy to destroy the most significant sign bit of the data, leading to color inversion in the image.
[0077] To completely eliminate this data representation inconsistency crisis, this step forcibly introduces low-level format conversion and composite mask logic before physical memory operations: Before invoking the mask truncation instruction, the system uses register arithmetic right shift and logic gate operations to convert all wavelet coefficients from binary two's complement to a standard sign-amplitude format. In this format, the most significant bit (MSB) independently represents the sign polarity (positive / negative), and the remaining lower bits directly represent the absolute physical amplitude of the value.
[0078] The system dynamically generates a composite mask vector for the SIMD cell. This mask uses bitwise operations to force the "most significant sign bit to be retained, while clearing the specified low amplitude bits to zero".
[0079] The composite mask is used to perform a physical bitwise AND operation on the transformed wavelet coefficients. At this time, the absolute amplitude bits below the optimal truncation bit plane are physically zeroed with precise and lossless polarity.
[0080] Through the above precise point-to-point repair, the system not only achieves ultra-fast physical truncation, but also perfectly complies with the data stream specifications of the JPEG 2000 standard, eliminating the engineering risks of negative numbers being corrupted.
[0081] Step S150, Single-pass entropy coding step: The wavelet coefficients after physical zeroing are sent to the entropy encoder to perform single-pass entropy coding and output the physical bit stream.
[0082] The "clean" symbol-amplitude wavelet coefficient array after physical zeroing in step S140 is sent to the HT-Tier-1 encoder to perform variable length coding (VLC) and adaptive run-length coding (MEL) to output the physical bit stream.
[0083] In some optional implementations, after step S150, the single-pass entropy coding step, the method further includes: when the actual number of bytes in the physical bitstream exceeds the target bitrate constraint, selectively stripping some data with the complete data packet or encoding set as the smallest discard granularity; when the actual number of bytes in the physical bitstream is lower than the target bitrate constraint, injecting compliant padding bytes into the tail of the physical bitstream.
[0084] The encoder performs a single-pass variable-length coding (VLC) and adaptive run-length coding (MEL) on this data, from which redundant high-frequency bit planes have been removed. Although feedforward prediction greatly improves throughput, no prediction model can eliminate open-loop prediction residuals on the order of one percent when dealing with highly context-dependent VLC outputs. This physical residual, resulting from the pure feedforward mechanism, is highly susceptible to buffer overflow or system crashes due to small over-provisioning or significant bandwidth waste when facing the absolutely rigid constant bit rate (CBR) physical channel bandwidth limitations of digital cinemas or satellite transmissions.
[0085] Therefore, after the final physical bitstream is output by single-pass entropy coding, this application establishes a lightweight fault-tolerant fallback closed-loop module based on the HTJ2K specification to completely absorb the predicted residual.
[0086] When the actual total number of physical bytes generated by single-pass entropy encoding slightly exceeds the target bitrate constraint, the system leverages the flexible packet dropping and truncation features allowed by the HTJ2K specification to invoke the packet-level parsing module. Since the HTJ2K Cleanup Pass is actually interwoven with multiple byte streams growing in opposite directions, and the last byte is a variable-length coded (VLC) byte stream growing in reverse, the system absolutely prohibits blindly truncating packets byte-by-byte from the end of physical memory to prevent decoder deadlock and crashes. Instead, the system precisely locks onto packets belonging to the highest-frequency wavelet subband (e.g., high-resolution HH and HL subbands). While strictly maintaining the integrity of the underlying byte stream structure, it directly removes the entire invalid set with the least impact on visual fidelity using complete HT candidate truncation sets (HT-Sets, i.e., including the cleanup pass and optional propagation and refinement passes) or complete code blocks as the smallest granularity for dropping. This coarse-grained dropping forcibly reduces the excess bandwidth with zero risk.
[0087] If the actual generated bitrate is lower than the target lower limit, the system invokes a compliant bit playback protocol explicitly supported by the JPEG 2000 standard. The system safely injects padding bytes (e.g., specific hexadecimal standard padding bits) into the end of the generated bitstream. This mechanism causes zero interference to the physical reconstruction of the image, but strictly pads and aligns to the set constant bitrate total budget target at the link transmission layer.
[0088] By employing these two post-processing fine-tuning methods with extremely low computational overhead, this application successfully established an absolute precision CBR rate control boundary while maintaining the ultimate throughput of "single pass," truly achieving industrial-grade "precise" delivery.
[0089] Figure 2 This invention illustrates a schematic diagram of a single-pass precise bit rate control system for HTJ2K according to an embodiment of this application. Figure 2 As shown, the system includes a processor, internal memory, a network interface, and non-volatile storage media connected via a system bus. The processor provides computational and control capabilities. The system's memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The system's network interface is used for communication with external systems via a network connection. When executed by the processor, the computer program implements the functions or steps of a single-pass precise rate control method for HTJ2K.
[0090] In one embodiment, the single-pass precise bitrate control system for HTJ2K provided in this application includes a memory and a processor. The memory stores a database and a computer program that can run on the processor. When the processor executes the computer program, it implements the steps of the single-pass precise bitrate control method for HTJ2K.
[0091] In implementation, each step of the aforementioned method can be completed by integrated logic circuits in the processor hardware or by instructions in software. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the aforementioned method.
[0092] In one embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of a single-pass precise bitrate control method for HTJ2K.
[0093] It should be noted that the functions or steps that the system or computer-readable storage medium can achieve are described in the relevant descriptions in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0094] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink, DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0095] Those skilled in the art will understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.
[0096] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A single-pass precise rate control method for HTJ2K, comprising discrete wavelet transform and quantization steps, characterized in that, Also includes: Feature extraction steps: Extract the spatial and frequency statistical features of each independent code block; Rate-distortion prediction steps: Input spatial and frequency statistical features into the prediction model to obtain rate-distortion prediction data for each independent code block at the candidate truncation point; The truncation strategy determination steps are as follows: Based on rate-distortion prediction data, determine the optimal truncation bit plane for each independent code block; Physical pre-truncation step: Force the low-order amplitude data below the optimal truncation bit plane to be zeroed in physical memory; Single-pass entropy coding steps: The wavelet coefficients after physical zeroing are fed into the entropy encoder to perform single-pass entropy coding and output the physical bit stream.
2. The single-pass precise bitrate control method for HTJ2K according to claim 1, characterized in that, The prediction model is constructed in the following way: In offline mode, a sample dataset is obtained by performing a full post-compression rate-distortion optimization process on the sample images. The sample dataset contains the spatial and frequency statistical features of each independent code block at each candidate truncation point, as well as the true bit rate and true distortion corresponding to the spatial and frequency statistical features. Based on the sample dataset, supervised learning or statistical aggregation methods are used to train or build a predictive model.
3. The single-pass precise bitrate control method for HTJ2K according to claim 2, characterized in that, The prediction model is a multidimensional probability lookup table, and the address space of the multidimensional probability lookup table is constructed in the following way: The first-dimensional index maps the orthogonal sub-band direction type; The second-dimensional index uses a uniform scalar quantization to determine the sparsity of the partitioning coefficients. The third-dimensional index uses a non-linear logarithmic algorithm to quantize the subband energy norm features; The indexes of each dimension are concatenated into physical pointers; the physical pointers are used to directly address the block random access memory on the hardware chip. In the rate-distortion prediction step, the obtained spatial and frequency statistical features of subband direction, absolute density of non-zero coefficients and estimated subband energy distribution are discretized into first-dimensional index, second-dimensional index and third-dimensional index respectively, and then concatenated into physical pointers to look up the table to read the predicted bit rate and predicted distortion.
4. The single-pass precise bitrate control method for HTJ2K according to claim 2, characterized in that, The prediction model is support vector regression, which is configured as follows: For the feature input of the low-frequency wavelet subband, a linear kernel function is used for high-dimensional space mapping, and for the feature input of the high-frequency wavelet subband, a radial basis kernel function is used for high-dimensional space mapping. The regularization penalty parameter and the insensitive loss band hyperparameter are set based on offline cross-validation. In the rate-distortion prediction step, the obtained spatial and frequency statistical features are input into support vector regression. After kernel function mapping and regression calculation, the predicted code rate and predicted distortion of each independent code block at each candidate truncation point are output.
5. The single-pass precise bitrate control method for HTJ2K according to claim 2, characterized in that, The prediction model is a shallow regression decision tree, and the shallow regression decision tree is configured as follows: The node feature splitting criterion adopts the mean square error or the mean absolute error. The maximum depth is less than 5 layers, so that the hardware clock cycle of a single tree inference traversal is less than the time consumed by discrete wavelet transform. In the rate-distortion prediction step, the obtained spatial and frequency statistical features are input into the shallow regression decision tree. After feature judgment and branch traversal at each layer node, the leaf node outputs the predicted code rate and predicted distortion of each independent code block at each candidate truncation point.
6. The single-pass precise bitrate control method for HTJ2K according to claim 1, characterized in that, The truncation strategy determination step, before determining the optimal truncation bit plane for each independent code block, further includes: Non-convex cleaning is performed on the candidate cutoff points of each independent code block to remove invalid candidate cutoff points that cause the rate distortion slope to be non-monotonically decreasing, and a set of valid candidate cutoff points with strictly monotonically decreasing rate distortion slope is constructed. Determine the optimal truncation bit plane for each independent code block, including: Based on the set of effective candidate truncation points, Lagrange multipliers are introduced and an iterative optimization algorithm is used to determine the optimal truncation bit plane for each independent code block.
7. The single-pass precise bitrate control method for HTJ2K according to claim 1, characterized in that, The physical pre-truncation step includes: Data format consistency processing is performed on the wavelet coefficients after discrete wavelet transform and quantization to obtain a representation format in which the sign and amplitude are separated; Generate a composite mask vector, which is configured to retain the most significant sign bit and clear the low amplitude bits below the optimal truncation bit plane; By performing a bitwise AND operation on the wavelet coefficients after format conversion using a composite mask vector, the low-bit amplitude data below the optimal truncation bit plane is forcibly cleared to zero in physical memory.
8. The single-pass precise bitrate control method for HTJ2K according to claim 1, characterized in that, Following the single-pass entropy coding step, the method further includes: When the actual number of bytes in the physical bitstream exceeds the target bitrate constraint, some data is selectively stripped away with the complete data packet or encoding set as the smallest granularity for discarding. When the actual number of bytes in the physical bitstream is lower than the target bitrate constraint, compliant padding bytes are injected into the end of the physical bitstream.
9. A single-pass precise bit rate control system for HTJ2K, characterized in that, include: The memory, the processor, and the computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the single-pass precise bit rate control method for HTJ2K as described in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the single-pass precise bit rate control method for HTJ2K as described in any one of claims 1 to 8.