Lossy reshaping transcoding method, engine, device and medium for transform domain dynamic compensation

CN122909387APending Publication Date: 2026-10-13CHINA RES INST OF FILM SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611297307.1
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

Technical Problem

该问题严重制约了异构环境下有损码率整形方案的工程化部署

Benefits of technology

一、高吞吐量转码性能。本申请通过将源图像压缩码流的第一整数索引阵列在变换域内重构为浮点小波系数矩阵,并直接将重量化后的第二整数索引阵列转换为符合第二格式的缓冲结构进行熵编码输出,使全部转码运算闭环于离散小波变换系数域内,完全无需执行逆离散小波变换与正向离散小波变换。相比传统像素域有损转码方案,本申请在相同硬件环境下处理速度提升约4.5倍。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122909387A_ABST
    Figure CN122909387A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image compression, video coding and cross-network media transmission, and discloses a transform domain dynamic compensation lossy reshaping transcoding method, an engine, a device and a medium. Quantization parameters of a source image compression code stream are analyzed, and first integer index arrays are obtained through entropy decoding to be reconstructed into a floating-point wavelet coefficient matrix in a transform domain; a target quantization step is determined according to a target code rate, and non-overflowers are decomposed into target quantization parameters, and overflowers are marked and then zero-truncated; the quantization is re-performed to obtain second integer index arrays and the second integer index arrays are converted into a buffer structure conforming to a target format; the target quantization parameters are written into a target code stream header mark segment, and are output after being entropy encoded. The application is operated in a closed loop in the transform domain, does not need to perform forward / inverse discrete wavelet transform, has high throughput, cross-library numerical stability and dynamic code rate contraction capability, and supports ciphertext domain secure transcoding and differentiated fidelity control of regions of interest.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of image compression, video coding and cross-network media transmission technology, specifically to lossy shaping transcoding methods, engines, devices and media with transform domain dynamic compensation. Background Technology

[0002] The JPEG 2000 (J2K) standard is a classic image compression standard based on Discrete Wavelet Transform (DWT) and Embedded Block Coding with Optimized Truncation (EBCOT). It is widely used in professional fields such as medical imaging, remote sensing imagery, digital cinema, and geographic information systems.

[0003] In recent years, to address the problem of excessive computational complexity in EBCOT entropy coding in traditional J2K, the High Throughput JPEG 2000 (HTJ2K) standard was proposed. HTJ2K replaces traditional EBCOT with the FBCOT (Fast Block Coding with Optimized Truncation) algorithm, achieving an order-of-magnitude improvement in encoding and decoding throughput with only a minimal sacrifice in coding efficiency.

[0004] With the widespread adoption of HTJ2K technology, the demand for bidirectional transcoding between J2K and HTJ2K in heterogeneous networks has surged. Current transcoding technologies are mainly divided into two categories: Traditional pixel-domain lossy transcoding schemes require complete entropy decoding, inverse quantization, and inverse discrete wavelet transform (IDWT) to reconstruct the pixel-domain image from the source compressed bitstream. This is followed by forward discrete wavelet transform (FDWT), requantization, and entropy encoding. Due to the extremely time-consuming floating-point matrix operations involved in IDWT and FDWT, this scheme has extremely high computational complexity, consumes a large amount of memory, and inevitably introduces severe secondary quantization concatenation noise.

[0005] Existing lossless transcoding schemes in the transform domain intercept data in the coefficient domain, directly performing bit operations and format concatenation, skipping inverse quantization, forward / inverse wavelet transforms, and requantization. However, these schemes are strictly limited to "not performing inverse quantization and requantization," thus limiting their application to purely lossless transcoding. In bandwidth-constrained or fluctuating network distribution environments, gateway nodes often require lossy dynamic bitrate shaping, i.e., preserving the original video encoding format but forcibly reducing the bitrate. Existing lossless transcoding schemes completely fail to meet this core requirement of reducing bitstream size.

[0006] Furthermore, when performing cross-library lossy transcoding between heterogeneous codec libraries (such as OpenJPEG and OpenJPH), the different precision rounding strategies and dead-zone determination rules used by the two libraries for the floating-point coefficients of the Daubechies 9 / 7 biorthogonal wavelet transform can lead to systematic deviations in the actual reconstructed amplitude derived from the same set of quantization index values ​​through reverse derivation from different libraries. This deviation is amplified step-by-step during multiple concatenated transcodings or dynamic step size adjustments, ultimately manifesting as a global contrast collapse at the decoding end, a phenomenon known as stepsize mismatch. This problem severely restricts the engineering deployment of lossy bit rate shaping schemes in heterogeneous environments. Summary of the Invention

[0007] To address the aforementioned issues, this application provides a lossy bitrate dynamic shaping transcoding method, engine, device, and medium with dynamic compensation in the transform domain. By forcibly performing explicit floating-point dequantization and requantization at the physical layer within the discrete wavelet transform coefficient domain, and coordinating with end-to-end synchronous overwriting of quantization parameters, it achieves high throughput and high numerical stability lossy bitrate dynamic shaping while completely bypassing pixel-domain round-trip transformation. This simultaneously solves three major technical challenges: performance bottlenecks, functional deficiencies, and cross-library mismatch.

[0008] The technical solution adopted in this application is as follows: Firstly, this application provides a lossy integer transcoding method with dynamic compensation in the transform domain, comprising: The source quantization parameters corresponding to each wavelet subband are parsed from the source image compressed bitstream of the first format, and the source image compressed bitstream is entropy decoded to obtain the first integer index array. Based on the source quantization parameters, the first integer index array is reconstructed into a floating-point wavelet coefficient matrix in the transform domain; The target quantization step size corresponding to each wavelet subband is determined according to the target bit rate constraint. The target quantization step size that does not exceed the critical value is decomposed into target quantization parameters, and the wavelet subband whose target quantization step size exceeds the critical value is marked as overflow. Based on the target quantization step size, the floating-point wavelet coefficient matrix is ​​weighted into a second integer index array in the transform domain; where wavelet subbands marked as overflow are zero-trunculated. Convert the second integer index array into a buffer structure conforming to the second format; The target quantization parameter is written into the header marker segment of the target image compressed bitstream in the second format, and the target image compressed bitstream is output after entropy encoding of the buffer structure.

[0009] Secondly, this application provides another lossy shaping transcoding method with dynamic compensation in the transform domain, which includes the following when the source image compressed bitstream is an encrypted stream encrypted with a stream cipher: Identify the encryption boundaries of the first-format encrypted stream and perform entropy decoding on the encrypted stream to extract the code stream structure information; Disable the Lagrange rate distortion optimization model and prohibit floating-point wavelet coefficient matrix reconstruction and weighting of the encrypted stream; Based on the code stream structure information of the encryption stream, a truncation operation is performed on the low-priority data in the encryption stream to reduce the code stream length; Calculate the number of bytes of truncated data, correct the length marker segment of the target image compressed bitstream in the second format, and realign the pointer offset; The corrected length marker segment is concatenated with the compressed data that maintains the ciphertext state to output the target image compressed bitstream that maintains the ciphertext state.

[0010] Thirdly, this application also provides a lossy integer transcoding engine with dynamic compensation in the transform domain, comprising: The decoding module is used to parse the source quantization parameters corresponding to each wavelet subband from the source image compressed bitstream of the first format, and to perform entropy decoding on the source image compressed bitstream to obtain the first integer index array. The reconstruction module is used to reconstruct the first integer index array into a floating-point wavelet coefficient matrix in the transform domain based on the source quantization parameters. The generation module is used to determine the target quantization step size corresponding to each wavelet sub-band according to the target bit rate constraint, decompose the target quantization step size that does not exceed the critical value into target quantization parameters, and mark the wavelet sub-band whose target quantization step size exceeds the critical value as overflow. The weighting module is used to weight the floating-point wavelet coefficient matrix into a second integer index array in the transform domain according to the target quantization step size; wherein, the wavelet subbands marked as overflow are zero-truncated; A conversion module is used to convert the second integer index array into a buffer structure conforming to the second format; The encoding module is used to write the target quantization parameters into the main header marker segment of the target image compressed bitstream in the second format, and output the target image compressed bitstream after entropy encoding the buffer structure.

[0011] Fourthly, this application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the lossy integer transcoding method for dynamic compensation of the transform domain described above.

[0012] Fifthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the lossy integer transcoding method for dynamic compensation of the transform domain described above.

[0013] The above-mentioned technical solution adopted in this application can achieve the following beneficial effects: I. High-throughput transcoding performance. This application reconstructs the first integer index array of the source image compressed bitstream into a floating-point wavelet coefficient matrix in the transform domain, and directly converts the weighted second integer index array into a buffer structure conforming to the second format for entropy encoding output. This ensures that all transcoding operations are closed-loop within the discrete wavelet transform coefficient domain, completely eliminating the need for inverse and forward discrete wavelet transforms. Compared to traditional pixel-domain lossy transcoding schemes, this application achieves approximately 4.5 times faster processing speed under the same hardware conditions.

[0014] II. Cross-library numerical stability. This application decomposes the target quantization step size, determined according to the target bitrate constraint, into a target quantization exponent and a target quantization mantissa, and writes the target quantization exponent and target quantization mantissa into the header marker segment of the target image compressed bitstream. This ensures that the bitstream payload data and control metadata maintain strict consistency at the physical numerical level, fundamentally eliminating the risk of step size mismatch and global contrast collapse caused by differences in floating-point precision rounding between heterogeneous codec libraries.

[0015] III. Dynamic Network Adaptive Capability. This application calculates the target quantization step size for each wavelet subband based on the target bit rate constraint using a Lagrange rate-distortion optimization model. The target quantization step size for each wavelet subband is greater than the corresponding source quantization step size. This achieves dynamic shrinkage of the physical volume of the compressed bitstream in the transform domain, filling the functional gap in existing transform domain transcoding schemes that cannot perform lossy bit rate shaping.

[0016] IV. End-to-end secure distribution capability. When the source image compressed bitstream is a bitstream encrypted in stream cipher mode, this application identifies the encryption boundary and enters the ciphertext field transcoding mode. Based on the bitstream length metadata, it performs packet truncation or layer discarding, performs bit-plane physical stripping on the ciphertext, and synchronously corrects the length marker segment of the target bitstream. Thus, it directly completes bandwidth reduction transcoding without decryption or destroying the block cipher state, avoiding the key leakage risk in the traditional decryption-transcoding-re-encryption link.

[0017] V. Differentiated ROI Fidelity. This application detects and extracts displacement parameters used to identify regions of interest in the source compressed bitstream. Within the transform domain, it applies a lossless preservation mode to the core ROI coefficients and a lossy weighting mode to the background region based on amplitude threshold boundaries. This achieves differentiated quality control within a single bitstream under a unified transcoding task, ensuring that key regions achieve the highest fidelity while the background region bears the main bitrate compression cost. Attached Figure Description

[0018] 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 lossy integer transcoding method with dynamic compensation in the transform domain according to an embodiment of this application is shown. Figure 2 A flowchart illustrating a lossy integer transcoding method with dynamic compensation in the transform domain according to another embodiment of this application is shown. Figure 3 A schematic diagram of the structure of a lossy integer transcoding engine with dynamic compensation in the transform domain according to an embodiment of this application is shown. Figure 4 A schematic diagram of the structure of a lossy shaping transcoding engine with dynamic compensation in the transform domain according to another embodiment of this application is shown; Figure 5 A schematic diagram of the structure of a computer device according to an embodiment of this application is shown. Detailed Implementation

[0019] 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.

[0020] Figure 1 A flowchart illustrating a lossy integer transcoding method with dynamic compensation in the transform domain according to an embodiment of this application is shown. (Refer to...) Figure 1 As shown, the lossy shaping transcoding method with dynamic compensation in the transform domain proposed in this embodiment is implemented by the processor of a computer device, without the need to perform inverse discrete wavelet transform and forward discrete wavelet transform, including steps S110 to S160: Step S110: Parse the source quantization parameters corresponding to each wavelet subband from the source image compressed bitstream of the first format, and perform entropy decoding on the source image compressed bitstream to obtain the first integer index array.

[0021] The core objective of this step is to extract the following two key pieces of information from the source image compressed bitstream of the first format without performing inverse discrete wavelet transform: (1) the source quantization parameters used for subsequent explicit inverse quantization calculation; and (2) the first integer index array without inverse discrete wavelet transform.

[0022] In traditional pixel-domain decoding, the wavelet coefficients after entropy decoding continue to flow to the inverse discrete wavelet transform module to reconstruct the pixel-domain image. This application intercepts the decoded data stream by setting a callback function at the memory level, preventing it from flowing into the inverse discrete wavelet transform module. This allows the first integer index array to be directly intercepted in the transform domain, providing the data foundation for subsequent explicit dequantization and weighting in the transform domain. This interception mechanism enables all transcoding operations to be closed-loop within the coefficient domain, completely skipping the extremely time-consuming round-trip discrete wavelet transform process.

[0023] In some optional implementations, step S110, parsing the source quantization parameters corresponding to each wavelet subband from the source image compressed bitstream of the first format, and performing entropy decoding on the source image compressed bitstream to obtain the first integer index array, includes: parsing the main header marker segment of the source image compressed bitstream of the first format and locating the quantization default marker segment; extracting the source quantization index and source quantization mantissa corresponding to each wavelet subband from the quantization default marker segment of the source image compressed bitstream; calling the entropy decoder corresponding to the first format to perform entropy decoding on the compressed codewords of the source image compressed bitstream; and intercepting the decoded data stream at the memory level through a callback function to extract the first integer index array.

[0024] The J2K compressed bitstream begins with the SOC marker (0xFF4F) and ends with the EOC marker (0xFFD9). The main header marker segment is located at the very beginning of the compressed bitstream and contains all the core parameters required for entropy decoding. The quantization parameters in the Quantization Default (QCD) marker segment (0xFF5C) are stored in the form of "quantization exponent + quantization mantissa", with the exponent occupying 5 bits and the mantissa occupying 11 bits, which are jointly encoded into a 16-bit quantization parameter.

[0025] Therefore, the source quantization index and source quantization tail number corresponding to each wavelet subband can be extracted from the source quantization default marker segment of the source image compressed bitstream of the first format.

[0026] When the entropy decoder corresponding to the first format is invoked to entropy decode the compressed codewords of the source image compressed bitstream, the transcoding engine selects the corresponding decoding branch according to the type of the first format. When the first format is traditional J2K, the entropy decoder uses the EBCOT algorithm; when the first format is HTJ2K, the entropy decoder uses the FBCOT algorithm.

[0027] The transcoding engine sets up an intercept hook between the output of the entropy decoder and the input of the inverse discrete wavelet transform (IDR) module. After the entropy decoder completes decoding, it writes the first integer index array into a memory buffer. A callback function is triggered before the data is passed to the IDR module, obtaining a pointer to this memory buffer. The transcoding engine directly reads all the coefficient data of the first integer index array through this pointer, preventing data from flowing further to the IDR module and thus preventing the IDR from being executed.

[0028] It should be noted that the implementation of the above callback function interception mechanism is independent of the transcoding direction. Regardless of whether the first format is J2K or HTJ2K, and regardless of whether the second format corresponds to HTJ2K or J2K, the entropy decoding recovers the quantized wavelet coefficient integer grid values ​​(i.e., the first integer index array), which have the same data structure and interception method. Therefore, the above steps are equally applicable in both J2K→HTJ2K and HTJ2K→J2K transcoding directions.

[0029] Step S120: Based on the source quantization parameters, reconstruct the first integer index array into a floating-point wavelet coefficient matrix in the transform domain.

[0030] The core objective of this step is to independently perform explicit dequantization of the first integer index array in the transform domain, recover the floating-point wavelet coefficient matrix with physical energy scaling, and thus provide a numerical basis for subsequent Lagrange rate distortion optimization objective step size calculation and weighting.

[0031] The essence of this step is to reconstruct the floating-point information lost during the quantization stage at the encoding end within the transform domain. This allows the subsequent forced weighting operation to be performed in a physically continuous numerical space, rather than performing coarse bitwise operations on discrete integer grid points. This step completes all floating-point operations within the processor's (CPU or GPU) memory buffer, without involving any pixel-domain read / write operations, thus ensuring the efficient closed-loop operation of the entire transcoding process within the transform domain.

[0032] In some optional implementations, step S120, reconstructing the first integer index array into a floating-point wavelet coefficient matrix in the transform domain according to the source quantization parameters, includes: using the source quantization exponent and source quantization mantissa corresponding to each wavelet sub-band, combined with the nominal dynamic range of each wavelet sub-band, to calculate the source quantization step size corresponding to each wavelet sub-band; performing explicit dequantization calculation on each coefficient in the first integer index array according to each source quantization step size, mapping the integer grid point values ​​in the first integer index array to floating-point amplitudes with physical energy scale, and obtaining the floating-point wavelet coefficient matrix.

[0033] Using the source quantization exponent and source quantization mantissa corresponding to each wavelet sub-band, and combining the nominal dynamic range of each wavelet sub-band, the source quantization step size corresponding to each wavelet sub-band is calculated according to the following formula: , formula (1); in, Indicates the wavelet subband index number. Indicates the first The source quantization step size corresponding to each wavelet subband. Indicates the first The nominal dynamic range of each wavelet subband Indicates the first The source quantization index corresponding to each wavelet subband. Indicates the first The source quantization mantissa corresponding to each wavelet subband This represents the bit width constant occupied by the source quantization mantissa.

[0034] Nominal dynamic range The physical meaning of is: the first The theoretical maximum amplitude range of wavelet coefficients within each wavelet subband is formed by the sum of the absolute bit depth of the input image and the filter gain parameters of each level of discrete wavelet transform.

[0035] Based on the quantization step size of each source, explicit dequantization calculation is performed on each coefficient in the first integer index array according to the following formula, mapping the integer grid point values ​​in the first integer index array to floating-point amplitudes with physical energy scale, and obtaining the floating-point wavelet coefficient matrix.

[0036] , formula (2); in, Indicates the coordinate position of the coefficient. Represents the coordinates in the first integer index array Integer grid point values, Represents the coordinates in the floating-point wavelet coefficient matrix The floating-point amplitude at that point, This represents the reconstruction bias factor. Represents a symbolic function. Indicates the first The source quantization step size corresponding to each wavelet subband.

[0037] Sign function The meaning is: return +1 when the independent variable is positive, return -1 when the independent variable is negative, and return 0 when the independent variable is zero.

[0038] Reconstruction bias factor The configuration strategy will be explained in detail.

[0039] Standard J2K entropy decoders typically employ The midpoint reconstruction strategy maps the quantized integer grid values ​​to the midpoint of the quantization interval to minimize the mean square error of a single decoding. However, in concatenated transcoding scenarios (i.e., a chain of multiple entropy encoding-entropy decoding-re-entropy encoding), each time... Every reconstruction introduces tiny numerical deviations, which are amplified step by step after multiple cascades, eventually causing nonlinear drift at the dead zone boundary and triggering a global contrast collapse at the decoding end.

[0040] To address this issue, in a preferred embodiment of this application, the reconstruction bias factor is configured as follows: This configuration ensures that integer grid values ​​are precisely mapped back to the origin of the physically continuous domain. hour , hour This fundamentally prevents nonlinear drift at the dead zone boundary. While this setting sacrifices the absolute peak signal-to-noise ratio of a single quantization, it gains numerical stability in transcoding concatenation, ensuring that image contrast does not collapse after multiple encoding and decoding operations across libraries.

[0041] At the same time, it still supports receiving the reconstruction bias factor. Dynamic configuration means that even in scenarios where cascaded stability guarantees are not required, reconstruction bias factors conforming to standard distribution models (such as...) can be applied. or This is to maximize the fidelity of high-frequency energy.

[0042] Step S130: Determine the target quantization step size corresponding to each wavelet sub-band according to the target bit rate constraint, decompose the target quantization step size that does not exceed the critical value into target quantization parameters, and mark the wavelet sub-band whose target quantization step size exceeds the critical value as overflow.

[0043] The core objective of this step is to take the reconstructed floating-point wavelet coefficient matrix with physical energy scale, calculate a new target quantization step size for each wavelet subband based on the externally input target code rate constraint, and decompose the legal target quantization step size into target quantization parameters that conform to the target format specification.

[0044] At the current stage of the transcoding process, although the transcoding engine possesses the complete floating-point wavelet coefficient matrix, it has not yet performed any entropy encoding for the target format. This means the transcoding engine currently does not have the actual bitrate data generated by the target format entropy encoder under different quantization parameters. However, it is necessary to determine an optimal quantization step size for each wavelet subband that allows the total bitrate to approach the target bitrate. This contradiction prevents this step from directly adopting the "encode first, truncate later" bitrate control strategy used in standard encoding. Instead, it must, at the stage before encoding, rely solely on the statistical distribution characteristics of the floating-point wavelet coefficient matrix itself to predict the bitrate and distortion under different quantization step sizes.

[0045] To address this, this step introduces a rate prediction and rate-distortion optimization mechanism based on the statistical distribution of coefficients. By fitting a generalized Gaussian distribution model of wavelet coefficients, the probability density function of the coefficients in each wavelet sub-band is approximated. This allows the derivation of the information entropy at a given quantization step size as the rate prediction, and the mean square expectation of the quantization error as the rate-distortion estimate. Finally, the optimal target step size is calculated under global rate constraints using the Lagrange multiplier method. Furthermore, to prevent the calculated quantization step size from exceeding the upper limit of the nominal dynamic range that can be legally encoded, this step also introduces boundary truncation overflow protection, marking out-of-bounds wavelet sub-bands as overflowing to prevent illegal quantization parameters from being written into the target image compressed bitstream.

[0046] In some optional implementations, step S130, determining the target quantization step size corresponding to each wavelet sub-band according to the target bit rate constraint, decomposing the target quantization step size that does not exceed the critical value into target quantization parameters, and marking wavelet sub-bands whose target quantization step size exceeds the critical value as overflow, includes: calculating the corresponding target quantization step size for each wavelet sub-band using a Lagrange rate-distortion optimization model according to the target bit rate constraint; wherein, the target quantization step size corresponding to each wavelet sub-band is greater than the corresponding source quantization step size; performing overflow judgment on each target quantization step size; when the target quantization step size exceeds the maximum physical energy critical value that the nominal dynamic range of the corresponding wavelet sub-band can accommodate, marking the corresponding wavelet sub-band as overflow; when the target quantization step size does not exceed the critical value, decomposing the target quantization step size into the target quantization exponent and the target quantization mantissa.

[0047] Since entropy encoding of the target format has not yet been performed at this stage, the transcoding engine cannot obtain the bitrate data fed back by the actual entropy encoder under different quantization parameters. Therefore, a bitrate prediction method based on coefficient statistical distribution is adopted. That is, according to the target bitrate constraint of the current transcoding task, the Lagrange rate distortion optimization (RDO) model is used to solve the corresponding target quantization step size for each wavelet subband.

[0048] Specifically, the transcoding engine performs statistical analysis on the floating-point wavelet coefficients of each reconstructed wavelet subband, fitting their generalized Gaussian distribution model to approximately describe the probability density function of the floating-point wavelet coefficients of each wavelet subband. Based on this, for any candidate target quantization step size, the transcoding engine derives and estimates the bit rate overhead of the quantized symbol after the candidate target quantization step size using information entropy, and uses the mean square expectation of the quantization error as the rate-distortion estimate. Thus, the transcoding engine establishes a mapping relationship of "quantization step size → estimated bit rate + estimated distortion". Subsequently, the transcoding engine transforms the bit rate control problem into a Lagrange optimization problem. Under the global target bit rate constraint, the transcoding engine introduces Lagrange multipliers to coordinate the trade-off between bit rate and distortion, and uses multi-round iterative algorithms such as binary search to find the optimal Lagrange multipliers, thereby determining the target quantization step size that minimizes the rate-distortion cost for each wavelet subband.

[0049] To ensure that the size of the output target image compressed bitstream is indeed smaller than that of the source image compressed bitstream, the transcoding engine imposes a constraint during the decoding process: the target quantization step size corresponding to each wavelet subband must be greater than its corresponding source quantization step size.

[0050] Furthermore, when the target quantization step size exceeds the maximum physical energy threshold that the nominal dynamic range of the corresponding wavelet subband can accommodate, the target quantization step size cannot be legally decomposed into a 5-bit target quantization exponent and an 11-bit target quantization mantissa. To address this situation, the transcoding engine performs the following judgment for each target quantization step size: When the target quantization step size is greater than or equal to the maximum physical energy threshold that the nominal dynamic range of the corresponding wavelet subband can accommodate, it is determined that the wavelet subband has overflowed and the wavelet subband is marked as overflowing.

[0051] Conversely, if the target quantization step size is less than the critical value, it is determined that there is no overflow, and the target quantization step size is decomposed into the target quantization exponent and the target quantization tail.

[0052] During decomposition, the target quantization step size is decomposed into the target quantization exponent and the target quantization mantissa according to the following formula: , formula (3); in, Indicates the wavelet subband index number. Indicates the first The target quantization step size corresponding to each wavelet sub-band. Indicates the first The nominal dynamic range of each wavelet subband Indicates the first The target quantization index corresponding to each wavelet sub-band. Indicates the first The target quantization tail number corresponding to each wavelet subband This represents the bit width constant occupied by the target quantization mantissa.

[0053] The target quantization exponent and target quantization mantissa obtained from the decomposition are pushed to the shared memory pool as core metadata for directly updating the QCD / QCC marker segment in the header of the target image compressed bitstream in subsequent steps.

[0054] Step S140: Based on the target quantization step size, the floating-point wavelet coefficient matrix is ​​weighted into a second integer index array in the transform domain; wherein, the wavelet subbands marked as overflow are zero-truncated.

[0055] The core objective of this step is to refactor the floating-point wavelet coefficient matrix into a second integer index array in the transform domain, based on the generated target quantization step size (for unoverflowed wavelet subbands) or zero truncation instruction (for overflowed wavelet subbands).

[0056] The weighting operation in this step is essentially performing dead-zone scalar quantization again in the transform domain. That is, the floating-point wavelet coefficient matrix is ​​requantized using the target quantization step size instead of the source quantization step size. Since the target quantization step size is forcibly constrained to be larger than the source quantization step size, the width of the dead zone is expanded accordingly, and more floating-point coefficients with smaller amplitudes will be zeroed, thereby achieving physical reduction of the bit rate.

[0057] In some optional implementations, step S140 involves weighting the floating-point wavelet coefficient matrix into a second integer index array in the transform domain according to the target quantization step size; wherein, zero truncation is performed on wavelet subbands marked as overflow, including: performing dead-zone scalar quantization on the corresponding coefficients in the floating-point wavelet coefficient matrix according to the corresponding target quantization step size for each wavelet subband not marked as overflow; and setting the corresponding coefficients in the floating-point wavelet coefficient matrix to zero for each wavelet subband marked as overflow.

[0058] For each wavelet subband that does not trigger overflow protection, the transcoding engine performs dead-zone scalar quantization on the corresponding coefficients in the floating-point wavelet coefficient matrix according to the target quantization step size. The core operation rule of dead-zone scalar quantization is: divide the absolute value of the floating-point wavelet coefficient by the target quantization step size, round down, and then multiply by the sign bit of the floating-point wavelet coefficient. When the absolute value of the floating-point wavelet coefficient is less than the target quantization step size, the floating-point wavelet coefficient is quantized to zero (i.e., it falls into the dead zone and is returned to zero); when the absolute value of the floating-point wavelet coefficient is greater than or equal to the target quantization step size, the floating-point wavelet coefficient is quantized to a non-zero integer index value. In this way, at the physical level, it is ensured that tiny energy fluctuations falling into the dead zone are safely and completely forced to zero.

[0059] Specifically, dead-zone scalar quantization is performed on each coefficient according to the following formula: , formula (4); in, Indicates the coordinate position of the coefficient. Represents the coordinates in the second integer index array The coefficient value at that location, Represents the coordinates in the floating-point wavelet coefficient matrix The floating-point amplitude at that point, Represents a symbolic function. Indicates the first The target quantization step size corresponding to each wavelet sub-band. This indicates taking the absolute value. This indicates rounding down to the nearest integer.

[0060] For each wavelet subband marked as overflowing, the transcoding engine performs a zero-truncation operation, which means setting all the corresponding coefficients of that wavelet subband in the floating-point wavelet coefficient matrix to zero. Zero-truncation essentially discards all the frequency information carried by that wavelet subband.

[0061] Step S150: Convert the second integer index array into a buffer structure conforming to the second format.

[0062] The core objective of this step is to convert the weighted second integer index array into a dedicated buffer structure that conforms to the input specification of the second format entropy encoder.

[0063] The second integer index array exists in memory as a standard two-dimensional matrix, and its data organization differs from the continuous bitstream buffer structure desired by the target format entropy encoder. Specifically, the traditional J2K EBCOT encoder and the HTJ2K FBCOT encoder have different input format requirements in their underlying interface memory specifications, including the separation of amplitude and sign bits, bit packing order, and center alignment requirements for the least significant bit. If the original matrix form is directly input into the entropy encoder, it will cause the entropy encoder to be unable to correctly parse the coefficient data, ultimately producing an undecodeable compressed bitstream. Therefore, this step performs amplitude-sign splitting and reassembly and bit alignment operations on the second integer index array to complete the data format conversion between the underlying heterogeneous libraries without triggering additional memory copies, ensuring that the subsequent entropy encoder can directly read the correctly formatted data from memory for independent block encoding.

[0064] In some optional implementations, step S150, converting the second integer index array into a buffer structure conforming to the second format, includes: performing bitwise operations to split and recombine the absolute magnitude and sign bit of each coefficient in the second integer index array to convert it into a continuous magnitude-sign structure; and performing a shift operation on the magnitude-sign structure according to the center alignment requirement of the least significant bit of the entropy encoder corresponding to the second format to obtain the buffer structure.

[0065] For each non-zero coefficient in the second integer index array, the transcoding engine extracts its absolute magnitude (i.e., the absolute value of the coefficient) and sign bit (0 for positive numbers and 1 for negative numbers). For zero coefficients, their absolute magnitude is zero, and they do not contribute any valid data bits to the magnitude-sign (MagSgn) structure. Based on this, the transcoding engine writes the absolute magnitude and sign bit of each coefficient into a contiguous memory buffer according to the scan order and bit arrangement rules required by the target format entropy encoder, forming a MagSgn bitstream.

[0066] The MagSgn structure is constructed according to the following rules: the absolute magnitude and sign bit of each non-zero coefficient are jointly encoded into a MagSgn value, with the least significant bit carrying the sign information and the more significant bits carrying the binary representation of the absolute magnitude. All MagSgn values ​​of the coefficients are sequentially concatenated into the bitstream according to a predetermined scan order within the coded block. The transcoding engine independently performs splitting and reassembly operations on a block-by-block basis, generating an independent MagSgn structure for each block to match the block-independent encoding mechanism of the entropy encoder.

[0067] Different entropy encoders employ underlying differences in their bit packing methods for the MagSgn bitstream. For example, the HTJ2K FBCOT encoder uses little-endian bit packing, meaning that the significant bits within each byte are filled starting from the least significant bit; while the traditional J2K EBCOT encoder uses big-endian, filling the significant bits starting from the most significant bit. Furthermore, the FBCOT encoder introduces a specific padding avoidance mechanism during byte assembly: when a byte is fully assembled and its value is 0xFF, padding bits are inserted into the most significant bit of the next byte to avoid conflicts with the marker code. These differences necessitate that the bit arrangement of the MagSgn structure strictly conforms to the expected behavior of the target entropy encoder.

[0068] The transcoding engine first determines the starting position of the bits expected by the target format entropy encoder, calculates the required shift step size, and then performs the shift operation directly on the memory space of the MagSgn structure without triggering an additional memory copy, aligning the bit arrangement of the entire MagSgn structure to the bit boundary expected by the target format entropy encoder.

[0069] Step S160: Write the target quantization parameter into the header marker segment of the target image compressed bitstream in the second format, and output the target image compressed bitstream after entropy encoding the buffer structure.

[0070] The core objective of this step is to write the target quantization parameters into the header marker segment of the target image compressed bitstream, perform entropy encoding on the buffer structure, and finally output a second-format lossy target compressed bitstream that achieves physical bitrate reduction.

[0071] This step specifically comprises two logically tightly coupled yet independent operations: deep consistency overwriting of metadata and high-speed entropy delivery and stream encapsulation. The target quantization parameters currently exist only in the transcoding engine's memory variables and have not yet been physically associated with the target image compressed bitstream's payload data. This step requires writing these target quantization parameters into the Quantization Default (QCD) or Quantization Component (QCC) marker segment of the main header marker segment of the target image compressed bitstream. After the metadata overwriting is complete, the entropy encoder corresponding to the second format is called to directly read the buffer structure from memory for independent block encoding. This completely bypasses the inverse discrete wavelet transform, inverse color component conversion, and the corresponding forward pixel domain operations. After entropy encoding is complete, the compressed codewords of the generated target image compressed bitstream are concatenated with the updated header marker segment to encapsulate a complete target image compressed bitstream, outputting a lossy target compressed bitstream in the second format that achieves physical bitrate reduction.

[0072] In some optional implementations, step S160, writing the target quantization parameter into the header marker segment of the target image compressed bitstream of the second format, and outputting the target image compressed bitstream after entropy encoding of the buffer structure, includes: writing the target quantization index and the target quantization mantissa into the quantization default marker segment or quantization component marker segment of the header marker segment of the target image compressed bitstream; calling the entropy encoder corresponding to the second format to entropy entropy encode the buffer structure to generate the compressed codeword of the target image compressed bitstream; concatenating the compressed codeword of the target image compressed bitstream with the header marker segment to output the target image compressed bitstream.

[0073] The transcoding engine locates the Quantization Default (QCD) marker segment in the main header marker segment of the target image compressed bitstream, and writes the target quantization exponent and target quantization mantissa for each wavelet subband into the data field of the QCD marker segment one by one. For scenarios with component-level differential quantization requirements (i.e., when the source image compressed bitstream contains a QCC marker segment), the transcoding engine simultaneously generates or updates the Quantization Component (QCC) marker segment at the corresponding position in the target image compressed bitstream, and writes the target quantization exponent and target quantization mantissa for the specific component into the QCC marker segment.

[0074] The transcoding engine selects the corresponding entropy encoder branch based on the type of the second format: when the second format is J2K, the EBCOT encoder is called; when the second format is HTJ2K, the FBCOT fast block encoder is called. The entropy encoder directly reads the buffer structure from memory for independent block coding. All coding operations are closed within the transform domain, eliminating the need to reconstruct the pixel-domain image from the transform domain coefficients or perform a forward discrete wavelet transform again. The entropy encoder independently outputs compressed block bitstream segments for each coded block, which are then encapsulated into compressed codewords by a packing tool.

[0075] After the compressed codewords are generated, the transcoding engine performs the final bitstream concatenation operation: concatenating the updated header marker segment with the encoded compressed codewords to encapsulate a complete target image compressed bitstream.

[0076] At this point, the entire transcoding process has been efficiently completed within the transform domain.

[0077] Furthermore, J2K or HTJ2K, through region-of-interest (ROI) coding techniques, allow for high-quality encoding of user-specified key regions in an image during compression, while background regions receive a higher compression ratio. In transcoding scenarios, how to maintain the original fidelity of the ROI within the transform domain while effectively compressing the background region remains a problem that current technologies have not fully solved.

[0078] To address this, this application introduces a dual-track quantization strategy: using the amplitude threshold boundary defined by the displacement parameter, the coefficients of the region of interest and the background region are directly determined within the coefficient domain, and lossless preservation and lossy compression are performed on the two types of coefficients respectively, thereby achieving differentiated quality control within a single bitstream.

[0079] In some optional implementations, the method further includes: extracting the identification information of the region of interest from the compressed bitstream of the source image to distinguish the floating-point wavelet coefficients into region of interest coefficients and background region coefficients; During weighting, coefficients in the region of interest are weighted using the source quantization step size, while coefficients in the background region are weighted using the target quantization parameter.

[0080] The identification information can be displacement parameters, which are recorded in the RGN marker segment. During the bitstream parsing stage, the transcoding engine checks for the presence of the RGN marker segment; if it exists, it extracts the displacement parameters from it. And calculate the amplitude threshold boundary. .

[0081] During the weighting stage, the transcoding engine scans each coefficient in the floating-point wavelet coefficient matrix within the transform domain. Coefficients whose bit-plane distribution exceeds the amplitude threshold boundary are identified as region of interest coefficients, while coefficients whose bit-plane distribution does not exceed the amplitude threshold boundary are identified as background region coefficients. This determination is based entirely on the amplitude threshold boundary, achieving accurate classification within the coefficient domain.

[0082] For all wavelet coefficients identified as region of interest (ROI) coefficients, the transcoding engine forces weighting by the source quantization step size (i.e., the target quantization step size equals the source quantization step size), ensuring that the ROI coefficient values ​​remain unchanged before and after transcoding and preventing the introduction of additional quantization errors. In an alternative implementation, the target quantization step size for the ROI coefficients can also be directly set to... .

[0083] For all wavelet coefficients identified as background regions, the transcoding engine uses the target quantization step size determined in step S130. ( The standard dead zone scalar weighting is performed. Because the target quantization step size is larger than the source quantization step size, the dead zone width of the background region is significantly expanded, and a large number of background coefficients with small amplitudes are reduced to zero, bearing the main cost of bit rate compression.

[0084] Through the aforementioned dual-track quantization mechanism, this application achieves differentiated quality control within a single bitstream.

[0085] Furthermore, in distribution scenarios with extremely high digital rights management requirements, such as digital cinema packages or distribution chains with interoperable master formats, the source image compressed bitstream often exists in the form of a JPSEC encrypted stream protected by a specific stream cipher mode. In traditional lossy transcoding processes, if the transcoding engine at the intermediate distribution node needs to perform bitrate reduction, it must first decrypt, transcode, and then re-encrypt the encrypted stream. This "decryption → transcoding → re-encryption" chain not only incurs additional computational overhead, but more seriously, the intermediate node, holding the decryption key, is highly susceptible to key leakage, thereby compromising the security of the entire distribution chain.

[0086] To address this issue, this application provides a ciphertext field blind-state secure transcoding mechanism. Figure 2 A flowchart illustrating a lossy integer transcoding method with dynamic compensation in the transform domain according to another embodiment of this application is shown. (Refer to...) Figure 2 As shown, the lossy shaping transcoding method with dynamic compensation in the transform domain proposed in this embodiment is implemented by the processor of a computer device, without the need to perform inverse discrete wavelet transform and forward discrete wavelet transform, including steps S210 to S250: Step S210: Identify the encryption boundary of the first format encryption stream and perform entropy decoding on the encryption stream to extract the code stream structure information.

[0087] Security-related information is identified through one or more SEC marker segments located within the main header marker segment. The SEC marker segment, following the SIZ marker segment, records parameters such as the security tools used for encryption, the encryption algorithm, the key identifier, and the processing domain and granularity. When parsing the main header marker segment of the encrypted stream, the transcoding engine identifies whether the stream is a protected encrypted stream by detecting the presence of SEC marker segments and extracts encryption boundary information from them. Encryption boundaries can include: which parts are encrypted, the granularity of encryption, and the encryption mode used.

[0088] After identifying the encryption boundaries, the transcoding engine performs entropy decoding on the encrypted stream. It's important to note that this entropy decoding differs in purpose from the entropy decoding in the main process described above: in the main process, entropy decoding aims to obtain the first integer index array for subsequent explicit dequantization and weighting; however, in ciphertext mode, since the compressed data portion of the encrypted stream is already encrypted, the entropy decoder cannot correctly parse out the valid wavelet coefficient data. Therefore, the purpose of entropy decoding in this step is limited to extracting the code stream structure information (length metadata) to provide a positional reference for subsequent bit-plane stripping operations.

[0089] Step S220: Turn off the Lagrange rate distortion optimization model and prohibit the reconstruction and weighting of the floating-point wavelet coefficient matrix on the encrypted stream.

[0090] In ciphertext transcoding mode, the compressed data of the encrypted stream is in an encrypted state, and its bit distribution is completely different from the statistical characteristics of the original wavelet coefficients. If explicit dequantization or weighting is performed in this state, the following problems will occur: First, the encrypted data cannot be correctly parsed into valid wavelet coefficient values, and any floating-point operations will produce meaningless random numbers; Second, performing division operations in the ciphertext state may destroy the ciphertext structure of the stream cipher, triggering an avalanche effect during decryption.

[0091] Therefore, after detecting the encrypted stream, the transcoding engine explicitly disables the Lagrange rate distortion optimization model. At the same time, the transcoding engine prohibits the reconstruction and weighting of the floating-point wavelet coefficient matrix of the encrypted stream and instead enters the pure-space plane truncation bypass.

[0092] Step S230: Based on the code stream structure information of the encryption stream, perform a truncation operation on the low-priority data in the encryption stream to reduce the code stream length.

[0093] The transcoding engine performs heuristic packet truncation or layer dropping based on the bitstream length metadata. The PLM and PLT segments record the length information of each data packet in the encrypted stream. By reading these segments, the transcoding engine can accurately locate the start position and length of each data packet in the encrypted stream.

[0094] Based on this location information, the engine performs physical stripping of the lowest priority bit planes on the corresponding ciphertext data in the encryption stream according to a predetermined truncation strategy (starting from the low-priority resolution level or high-frequency subband). Specifically, the transcoding engine operates directly on the ciphertext bit stream without decrypting the ciphertext content: identifying bit segments belonging to the low-priority resolution level or high-frequency subband, and physically deleting the least significant bit planes from these segments. Since stream cipher encryption belongs to the stream cipher mode of homomorphism and XOR operation, the ciphertext and plaintext maintain a one-to-one correspondence at the bit level. Therefore, performing bit plane stripping on the ciphertext is equivalent to performing the same bit plane stripping on the plaintext. The decrypted image is completely consistent with the result of directly performing bit plane stripping on the plaintext. This characteristic allows the transcoding engine to securely complete lossy bit rate reduction without decryption.

[0095] Step S240: Calculate the number of bytes of truncated data, correct the length marker segment of the target image compressed bitstream in the second format, and realign the pointer offset.

[0096] After the bit-plane physical stripping is completed, the payload data length of the target image compressed bitstream is reduced. At this point, if the target image compressed bitstream is directly output without correcting the length information, the decoding end will be unable to correctly parse the bitstream structure.

[0097] To this end, after completing bit-plane stripping, the transcoding engine accurately calculates the number of bytes of the truncated payload (i.e., the number of bytes corresponding to the stripped bit-plane), and then corrects the PLM marker segment (or the PLT marker segment in the block header) of the target image compressed bitstream. The original length value of each data packet is updated by subtracting the number of truncated bytes. Simultaneously, the transcoding engine recalculates the pointer offsets of all subsequent data packets to ensure that the position information of each data packet in the target image compressed bitstream remains consistent with the corrected length value, thereby achieving global realignment of the pointer offsets.

[0098] Step S250: The corrected length marker segment is concatenated with the compressed data that maintains the ciphertext state, and the target image compressed bitstream that maintains the ciphertext state is output.

[0099] After completing the length marker correction and pointer realignment, the transcoding engine performs the final bitstream splicing operation: splicing the corrected length marker with the compressed data portion that still retains its ciphertext state after bit-plane stripping, and encapsulating it into a complete second-format target image compressed bitstream.

[0100] It is important to emphasize that throughout the entire ciphertext transcoding process, the transcoding engine never performs any decryption operation on the payload data of the encrypted stream (i.e., the encrypted compressed data). Bit-plane stripping is performed directly on the ciphertext, and the stripped compressed data remains encrypted—its ciphertext format is fully compatible with the original encrypted stream, only its length has been reduced. Therefore, the output target image compressed stream remains in ciphertext, and only a terminal playback device with a valid decryption key can decrypt it and correctly reconstruct the image.

[0101] Three specific implementation methods are given below.

[0102] Example 1: High-throughput lossy bit rate shaping transcoding from J2K to HTJ2K.

[0103] The transcoding engine relies on the OpenJPEG library for J2K parsing and the OpenJPH library for HTJ2K encoding. The engine loads the input file input.j2k (bitrate 150 Mbps). During header parsing, it locates the QCD marker segment, extracts the source quantization exponent and mantissa, and intercepts the first integer index array without inverse transformation in the callback function. Explicit dequantization is performed in memory. Upon receiving an instruction for an output bitrate of 50 Mbps, the engine iteratively searches for the target step size using RDO. After dead-zone weighting and truncating within the coefficient domain and centering, the QCD marker segment is overwritten to prevent luminance shift, and finally, FBCOT encoding is performed.

[0104] Performance Benchmark Testing: Quantitative testing under the same CPU environment showed that traditional pixel-domain lossy transcoding took approximately 450ms, while this transform-domain transcoding scheme only took approximately 100ms, demonstrating a significant throughput improvement. Experimental data confirms that although the direct bit-plane truncation and bias settings in the transform domain cause a slight decrease in objective PSNR of approximately 0.3dB compared to the complete pixel-domain scheme, this minor image quality loss is a reasonable "technical compromise" made to achieve a 4.5x increase in throughput for heterogeneous libraries, demonstrating excellent performance in engineering scenarios such as massive multimedia asset processing.

[0105] Example 2: Secure transcoding of ciphertext fields in commercial digital cinema / medical confidential networks.

[0106] In a digital cinema distribution chain with extremely high Digital Rights Management (DRM) requirements, the source code stream input.j2k distributed by the central server is encrypted using a specific JPSEC stream cipher mode (such as AES-CTR). Edge nodes, without obtaining the decryption key, directly run their transcoding engine. After parsing the header security identifier, the engine directly reads the ciphertext wavelet coefficients. The transcoding engine abandons floating-point division, directly physically truncating the low-priority bit planes of the ciphertext coefficients and simultaneously correcting the packet header length pointer (PLM / PLT). The encapsulated output.jph remains ciphertext, but its size is reduced by 30%. Ultimately, only cinema playback terminals with the valid key can decrypt it. This process avoids the ciphertext avalanche effect and achieves secure end-to-end high-throughput transcoding.

[0107] Example 3: ROI differential transcoding of DICOM medical panoramic tissue sections (WSI).

[0108] In remote digital pathology consultation scenarios, the source file is an extremely high-resolution DICOM tissue slice, where only the central 5% area is manually marked as a "potential lesion" (ROI). The transcoding engine initiates a differential control mechanism here. After the parsing engine extracts the MAXSHIFT shift parameters of the ROI, the coefficient pool weighting engine distributes two instructions based on an amplitude threshold: for wavelet coefficients belonging to the lesion region (amplitude exceeding the threshold), a target quantization step size of 1.0 is forcibly set; for the background region occupying 95% of the image, an extremely large target quantization step size is allocated to perform dead-zone division. The final output HTJ2K bitstream size is drastically reduced, yet doctors can still obtain the highest diagnostic accuracy when examining lesions.

[0109] The specific code implementations and library names described in this application are merely illustrative examples and are not intended to limit the scope of this application. The core of this application lies in the coefficient logic mapping and injection method within the transformation domain. Those skilled in the art can implement this method using any equivalent programming language, library, or hardware architecture based on the principles of this application, without departing from the protection scope of this application.

[0110] Figure 3 A schematic diagram of a lossy shaping transcoding engine with transform domain dynamic compensation according to an embodiment of this application is shown. (Refer to...) Figure 3 As shown, the lossy integer transcoding engine 300 with dynamic compensation in the transform domain proposed in this embodiment includes: The decoding module 310 is used to parse the source quantization parameters corresponding to each wavelet subband from the source image compressed bitstream of the first format, and to perform entropy decoding on the source image compressed bitstream to obtain the first integer index array. The reconstruction module 320 is used to reconstruct the first integer index array into a floating-point wavelet coefficient matrix in the transform domain based on the source quantization parameters. The generation module 330 is used to determine the target quantization step size corresponding to each wavelet sub-band according to the target bit rate constraint, decompose the target quantization step size that does not exceed the critical value into target quantization parameters, and mark the wavelet sub-band whose target quantization step size exceeds the critical value as overflow. The weighting module 340 is used to weight the floating-point wavelet coefficient matrix into a second integer index array in the transform domain according to the target quantization step size; wherein, the wavelet subbands marked as overflow are zero-truncated. The conversion module 350 is used to convert the second integer index array into a buffer structure conforming to the second format; The encoding module 360 ​​is used to write the target quantization parameters into the main header marker segment of the target image compressed bitstream in the second format, and output the target image compressed bitstream after entropy encoding the buffer structure.

[0111] In some optional implementations, the decoding module 310 is configured to: parse the main header marker segment of the source image compressed bitstream of the first format and locate the quantization default marker segment; extract the source quantization index and source quantization mantissa corresponding to each wavelet subband from the quantization default marker segment of the source image compressed bitstream; call the entropy decoder corresponding to the first format to perform entropy decoding on the compressed codewords of the source image compressed bitstream; and intercept the decoded data stream at the memory level through a callback function to extract the first integer index array.

[0112] In some optional implementations, the reconstruction module 320 is configured to: calculate the source quantization step size corresponding to each wavelet sub-band using the source quantization exponent and source quantization mantissa corresponding to each wavelet sub-band, combined with the nominal dynamic range of each wavelet sub-band; and perform explicit dequantization calculation on each coefficient in the first integer index array according to each source quantization step size, mapping the integer grid point values ​​in the first integer index array to floating-point amplitudes with physical energy scale, thereby obtaining a floating-point wavelet coefficient matrix.

[0113] In some optional implementations, the generation module 330 is configured to: calculate the target quantization step size for each wavelet subband using a Lagrange rate-distortion optimization model based on the target bit rate constraint; wherein the target quantization step size for each wavelet subband is greater than the corresponding source quantization step size; perform overflow judgment on each target quantization step size; when the target quantization step size exceeds the maximum physical energy threshold that the nominal dynamic range of the corresponding wavelet subband can accommodate, mark the corresponding wavelet subband as overflow; when the target quantization step size does not exceed the threshold, decompose the target quantization step size into the target quantization exponent and the target quantization mantissa.

[0114] In some alternative implementations, the weighting module 340 is configured to: perform dead-zone scalar quantization on the corresponding coefficients in the floating-point wavelet coefficient matrix according to the corresponding target quantization step size for each wavelet subband that is not marked as overflow; and set the corresponding coefficients in the floating-point wavelet coefficient matrix to zero for each wavelet subband that is marked as overflow.

[0115] In some optional implementations, the conversion module 350 is configured to: perform bitwise operations to split and recombine the absolute magnitude and sign bit of each coefficient in the second integer index array to convert it into a continuous magnitude-sign structure; and perform a shift operation on the magnitude-sign structure according to the center alignment requirement of the least significant bit of the entropy encoder corresponding to the second format to obtain a buffer structure.

[0116] In some optional implementations, the encoding module 360 ​​is configured to: write the target quantization index and the target quantization mantissa into the quantization default marker segment or quantization component marker segment of the header marker segment of the target image compressed bitstream; call the entropy encoder corresponding to the second format to entropy encode the buffer structure to generate the compressed codeword of the target image compressed bitstream; and concatenate the compressed codeword of the target image compressed bitstream with the header marker segment to output the target image compressed bitstream.

[0117] In some optional implementations, the decoding module 310 is configured to extract the identification information of the region of interest from the source image compressed bitstream to distinguish the floating-point wavelet coefficients into region of interest coefficients and background region coefficients; the weighting module 340 is configured to perform weighting on the region of interest coefficients with the source quantization step size and on the background region coefficients with the target quantization parameter when performing weighting.

[0118] It should be noted that the lossy integer transcoding engine 300 with dynamic compensation in the transform domain proposed above can implement the aforementioned lossy integer transcoding method with dynamic compensation in the transform domain (non-encrypted stream), which will not be elaborated further.

[0119] Figure 4 A schematic diagram of the structure of a lossy shaping transcoding engine with dynamic compensation in the transform domain according to another embodiment of this application is shown. (Refer to...) Figure 4 As shown, the lossy integer transcoding engine 400 with dynamic compensation in the transform domain proposed in this embodiment includes: The decoding unit 410 is used to identify the encryption boundary of the first format encryption stream and perform entropy decoding on the encryption stream to extract the code stream structure information. Disable unit 420 to turn off the Lagrange rate distortion optimization model and prevent floating-point wavelet coefficient matrix reconstruction and weighting of the encrypted stream; The stripping unit 430 is used to perform a truncation operation on low-priority data in the encrypted stream based on the code stream structure information of the encrypted stream, so as to reduce the code stream length; Correction unit 440 is used to calculate the number of bytes of truncated data, correct the length marker segment of the target image compressed bitstream in the second format, and realign the pointer offset. The splicing unit 450 is used to splice the corrected length marker segment with the compressed data that maintains the ciphertext state, and output the target image compressed bitstream that maintains the ciphertext state.

[0120] It should be noted that the lossy integer transcoding engine with dynamic compensation in the transform domain proposed above can implement the aforementioned lossy integer transcoding method with dynamic compensation in the transform domain (encryption stream), which will not be elaborated further.

[0121] Figure 5 This application shows a schematic diagram of the structure of a computer device according to one embodiment of the present application. Figure 5 As shown, the computer device includes a processor, internal memory, a network interface, and a non-volatile storage medium connected via a system bus. The processor provides computational and control capabilities. The 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 an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used for communication with external devices via a network connection. When executed by the processor, the computer program implements the functions or steps of a lossy integer transcoding method with dynamic compensation in the transform domain.

[0122] In one embodiment, the computer device 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 a lossy integer transcoding method with dynamic compensation in the transform domain.

[0123] The above is as stated in this application. Figure 3 or Figure 4The lossy shaping transcoding engine execution method for dynamic compensation in the transform domain disclosed in the illustrated embodiments can be applied to a processor or implemented by a processor. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. 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 embodied as being executed by a hardware decoding processor, or executed 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, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0124] In one embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, wherein the steps of a lossy integer transcoding method for dynamic compensation of the transform domain are implemented when the computer program is executed by a processor.

[0125] It should be noted that the functions or steps that can be implemented by the computer device or computer-readable storage medium described above can be referred to the relevant descriptions in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0126] 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.

[0127] 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.

[0128] 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 lossy integer transcoding method with dynamic compensation in the transform domain, characterized in that, include: The source quantization parameters corresponding to each wavelet subband are parsed from the source image compressed bitstream of the first format, and the source image compressed bitstream is entropy decoded to obtain the first integer index array. Based on the source quantization parameters, the first integer index array is reconstructed into a floating-point wavelet coefficient matrix in the transform domain; The target quantization step size corresponding to each wavelet subband is determined according to the target bit rate constraint. The target quantization step size that does not exceed the critical value is decomposed into target quantization parameters, and the wavelet subband whose target quantization step size exceeds the critical value is marked as overflow. Based on the target quantization step size, the floating-point wavelet coefficient matrix is ​​weighted into a second integer index array in the transform domain; where wavelet subbands marked as overflow are zero-trunculated. Convert the second integer index array into a buffer structure conforming to the second format; The target quantization parameters are written into the main header marker segment of the target image compressed bitstream in the second format, and the target image compressed bitstream is output after entropy encoding of the buffer structure.

2. The lossy integer transcoding method with dynamic compensation in the transform domain according to claim 1, characterized in that, The step of parsing the source quantization parameters corresponding to each wavelet subband from the source image compressed bitstream of the first format, and performing entropy decoding on the source image compressed bitstream to obtain the first integer index array, includes: Parse the main header marker segment of the first format source image compressed bitstream and locate the quantization default marker segment; Extract the source quantization exponent and source quantization mantissa corresponding to each wavelet subband from the quantization default marker segment of the source image compressed bitstream; Call the entropy decoder corresponding to the first format to perform entropy decoding on the compressed codewords of the source image compressed bitstream; At the memory level, the decoded data stream is intercepted through a callback function, thereby extracting the first integer index array.

3. The lossy integer transcoding method with dynamic compensation in the transform domain according to claim 1, characterized in that, The step of reconstructing the first integer index array into a floating-point wavelet coefficient matrix in the transform domain based on the source quantization parameters includes: By using the source quantization exponent and source quantization mantissa corresponding to each wavelet subband, and combining the nominal dynamic range of each wavelet subband, the source quantization step size corresponding to each wavelet subband is calculated. Based on the quantization step size of each source, explicit dequantization is performed on each coefficient in the first integer index array to map the integer grid point values ​​in the first integer index array to floating-point amplitudes with physical energy scale, thereby obtaining the floating-point wavelet coefficient matrix.

4. The lossy shaping transcoding method with dynamic compensation in the transform domain according to claim 1, characterized in that, The step of determining the target quantization step size corresponding to each wavelet sub-band based on the target bit rate constraint, decomposing the target quantization step size that does not exceed the critical value into target quantization parameters, and marking the wavelet sub-bands whose target quantization step size exceeds the critical value as overflow includes: Based on the target bit rate constraint, the Lagrange rate-distortion optimization model is used to calculate the target quantization step size for each wavelet subband; wherein, the target quantization step size for each wavelet subband is greater than the corresponding source quantization step size; Perform overflow detection on the quantization step size of each target; When the target quantization step size exceeds the maximum physical energy threshold that the nominal dynamic range of the corresponding wavelet subband can accommodate, the corresponding wavelet subband is marked as overflow. When the target quantization step size does not exceed the critical value, the target quantization step size is decomposed into the target quantization exponent and the target quantization tail.

5. The lossy integer transcoding method with dynamic compensation in the transform domain according to claim 1, characterized in that, The step of refactoring the floating-point wavelet coefficient matrix into a second integer index array in the transform domain according to the target quantization step size; wherein, the wavelet subbands marked as overflow are subjected to zero truncation, including: For each wavelet subband not marked as overflow, dead-zone scalar quantization is performed on the corresponding coefficients in the floating-point wavelet coefficient matrix according to the corresponding target quantization step size; For each wavelet subband marked as overflow, set the corresponding coefficient in the floating-point wavelet coefficient matrix to zero.

6. The lossy shaping transcoding method with dynamic compensation in the transform domain according to claim 1, characterized in that, The step of converting the second integer index array into a buffer structure conforming to the second format includes: The absolute magnitude and sign bit of each coefficient in the second integer index array are split and recombined by bit operations to convert them into a continuous magnitude-sign structure; Based on the center alignment requirements of the least significant bit of the entropy encoder corresponding to the second format, a shift operation is performed on the amplitude-sign structure to obtain a buffer structure.

7. The lossy integer transcoding method with dynamic compensation in the transform domain according to claim 1, characterized in that, The step of writing the target quantization parameters into the main header marker segment of the target image compressed bitstream in the second format, and outputting the target image compressed bitstream after entropy encoding of the buffer structure, includes: Write the target quantization exponent and target quantization mantissa into the quantization default marker segment or quantization component marker segment of the main header marker segment of the target image compressed bitstream; The entropy encoder corresponding to the second format is invoked to entropy encode the buffer structure, generating compressed codewords for the target image compressed bitstream; The compressed codewords of the target image compressed bitstream are concatenated with the main header marker segment to output the target image compressed bitstream.

8. The lossy shaping transcoding method with dynamic compensation in the transform domain according to claim 1, characterized in that, Also includes: The region of interest (ROI) identification information is extracted from the compressed bitstream of the source image to distinguish the floating-point wavelet coefficients into ROI coefficients and background coefficients. During weighting, coefficients in the region of interest are weighted using the source quantization step size, while coefficients in the background region are weighted using the target quantization parameter.

9. A lossy integer transcoding method with dynamic compensation in the transform domain, characterized in that, When the source image compressed bitstream is an encrypted stream encrypted with a stream cipher, it includes: Identify the encryption boundaries of the first-format encrypted stream and perform entropy decoding on the encrypted stream to extract the code stream structure information; Disable the Lagrange rate distortion optimization model and prohibit floating-point wavelet coefficient matrix reconstruction and weighting of the encrypted stream; Based on the code stream structure information of the encryption stream, a truncation operation is performed on the low-priority data in the encryption stream to reduce the code stream length; Calculate the number of bytes of truncated data, correct the length marker segment of the target image compressed bitstream in the second format, and realign the pointer offset; The corrected length marker segment is concatenated with the compressed data that maintains the ciphertext state to output the target image compressed bitstream that maintains the ciphertext state.

10. A lossy integer transcoding engine with dynamic compensation in the transform domain, characterized in that, include: The decoding module is used to parse the source quantization parameters corresponding to each wavelet subband from the source image compressed bitstream of the first format, and to perform entropy decoding on the source image compressed bitstream to obtain the first integer index array. The reconstruction module is used to reconstruct the first integer index array into a floating-point wavelet coefficient matrix in the transform domain based on the source quantization parameters. The generation module is used to determine the target quantization step size corresponding to each wavelet sub-band according to the target bit rate constraint, decompose the target quantization step size that does not exceed the critical value into target quantization parameters, and mark the wavelet sub-band whose target quantization step size exceeds the critical value as overflow. The weighting module is used to weight the floating-point wavelet coefficient matrix into a second integer index array in the transform domain according to the target quantization step size; wherein, the wavelet subbands marked as overflow are zero-truncated; A conversion module is used to convert the second integer index array into a buffer structure conforming to the second format; The encoding module is used to write the target quantization parameters into the main header marker segment of the target image compressed bitstream in the second format, and output the target image compressed bitstream after entropy encoding the buffer structure.

11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the lossy integer transcoding method with dynamic compensation in the transform domain as described in any one of claims 1 to 8 or claim 9.

12. 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 lossy integer transcoding method with dynamic compensation in the transform domain as described in any one of claims 1 to 8 or claim 9.