WO2022252222A1 - Encoding method and encoding device - Google Patents

Encoding method and encoding device Download PDF

Info

Publication number
WO2022252222A1
WO2022252222A1 PCT/CN2021/098383 CN2021098383W WO2022252222A1 WO 2022252222 A1 WO2022252222 A1 WO 2022252222A1 CN 2021098383 W CN2021098383 W CN 2021098383W WO 2022252222 A1 WO2022252222 A1 WO 2022252222A1
Authority
WO
WIPO (PCT)
Prior art keywords
current frame
tile
encoding
difference
target
Prior art date
Application number
PCT/CN2021/098383
Other languages
French (fr)
Chinese (zh)
Inventor
郑萧桢
缪泽翔
李蔚然
郭泽
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2021/098383 priority Critical patent/WO2022252222A1/en
Priority to CN202180094389.9A priority patent/CN116918331A/en
Publication of WO2022252222A1 publication Critical patent/WO2022252222A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/189Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
    • H04N19/196Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding being specially adapted for the computation of encoding parameters, e.g. by averaging previously computed encoding parameters

Definitions

  • the present application relates to the field of encoding and decoding, and more specifically, relates to an encoding method and an encoding device.
  • JPEG XR Joint Photographic Experts Group Extended Range
  • the degree of quantization depends on the specified quantization parameter (Quantization Parameter, QP).
  • QP quantization Parameter
  • some algorithms require multiple encodings. This approach will bring additional complexity and lead to encoding delay, which will affect the running speed of the encoder and is not conducive to real-time encoding.
  • Other algorithms use fixed quantization parameters. However, using fixed quantization parameters will lead to uncontrollable output code rate.
  • the embodiment of the present application provides a coding method and a coding device, which can ensure the improvement of coding efficiency and reduce the consumption of hardware resources without sacrificing the accuracy of code rate control, and at the same time can ensure the flexibility of quantization parameters to avoid the problem of uncontrollable output code rate .
  • an encoding method including: acquiring image complexity information of each of the n1 tiles in the current frame, the image complexity information including the pixel value of each tile
  • n1 is a positive integer greater than or equal to 2
  • the quantization parameters of the n1 tiles are updated according to the image complexity information.
  • the image complexity information is related to the transformation coefficient of the tile in the current frame, and the transformation coefficient is the coefficient obtained after performing PCT processing on the pixel value of the tile, by
  • the degree information is updated or the QP of each tile included in the image to be encoded can be guaranteed to improve the encoding efficiency and reduce the consumption of hardware resources without sacrificing the bit rate control accuracy, and at the same time, it can ensure the flexibility of quantization parameters to avoid output The code rate is uncontrollable.
  • an encoding method including: obtaining image complexity information of the current frame, the image complexity information including transformation obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame coefficient; determine the initial quantization parameter (initial QP) of the current frame according to the image complexity information; update the initial QP of the target frame according to the initial QP of the current frame, and the target frame is the first x of the current frame frame and/or next y frames, where x and y are positive integers greater than or equal to 1.
  • PCT processing image kernel transformation processing
  • the image complexity information is related to the transformation coefficient of the current frame, and the transformation coefficient is the coefficient obtained after performing PCT processing on the pixel values in the current frame, it is determined according to the image complexity information
  • the initial QP of the current frame and the initial QP of the target frame are updated according to the initial QP, which can ensure that the encoding efficiency is improved and the hardware resource consumption is reduced without sacrificing the accuracy of the code rate control, and at the same time, the flexibility of quantization parameters can be guaranteed to avoid output
  • the code rate is uncontrollable.
  • an encoding device including: a complexity calculation module, configured to obtain image complexity information of each of the n1 tiles in the current frame, the image complexity information including the The transformation coefficient obtained after the pixel value of each tile undergoes image kernel transformation processing (PCT processing), n1 is a positive integer greater than or equal to 2; the code rate control module is used to update the n1 according to the image complexity information Quantization parameters for tiles.
  • a complexity calculation module configured to obtain image complexity information of each of the n1 tiles in the current frame, the image complexity information including the The transformation coefficient obtained after the pixel value of each tile undergoes image kernel transformation processing (PCT processing), n1 is a positive integer greater than or equal to 2; the code rate control module is used to update the n1 according to the image complexity information Quantization parameters for tiles.
  • an encoding device including: a complexity calculation module, configured to obtain image complexity information of a current frame, where the image complexity information includes performing image kernel transformation processing on pixel values of the current frame ( Transform coefficients obtained after PCT processing); a code rate control module, configured to determine the initial quantization parameter (initial QP) of the current frame according to the image complexity information; the code rate control module is also used to: according to the described image complexity information
  • the initial QP of the current frame updates the initial QP of the target frame, where the target frame is the previous x frames and/or the last y frames of the current frame, and x and y are positive integers greater than or equal to 1.
  • an encoding device including: a processor, configured to: acquire image complexity information of each of the n1 tiles in the current frame, where the image complexity information includes The pixel values of a tile are transformed coefficients obtained after image kernel transformation processing (PCT processing), n1 is a positive integer greater than or equal to 2; the quantization parameters of the n1 tiles are updated according to the image complexity information.
  • PCT processing image kernel transformation processing
  • an encoding device including: a processor, configured to: obtain image complexity information of a current frame, where the image complexity information includes performing image kernel transformation processing (PCT) on pixel values of the current frame transform coefficient obtained after processing); determine the initial quantization parameter (initial QP) of the current frame according to the image complexity information; update the initial QP of the target frame according to the initial QP of the current frame, and the target frame is the The previous x frame and/or the next y frame of the current frame, where x and y are positive integers greater than or equal to 1.
  • PCT image kernel transformation processing
  • an encoding device including a processor and a memory.
  • the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the first aspect or the second aspect or each implementation thereof.
  • a chip is provided for implementing the method in the above first aspect or the second aspect or each implementation manner thereof.
  • the chip includes: a processor, configured to call and run a computer program from the memory, so that the device installed with the chip executes the method in the above first aspect or the second aspect or each implementation thereof.
  • a ninth aspect provides a computer-readable storage medium for storing a computer program, and the computer program includes any possible implementation manners for executing the first aspect to the second aspect or the first aspect to the second aspect. method directive.
  • a computer program product including computer program instructions, the computer program instructions causing a computer to execute the methods in the implementation manners of the first aspect to the second aspect or the first aspect to the second aspect.
  • FIG. 1 is a structural diagram of a technical solution applying an embodiment of the present application.
  • Fig. 2 is a schematic diagram of a video coding framework 2 according to an embodiment of the present application.
  • Fig. 3 is a schematic diagram of JPEG XR processing images according to five levels from large to small when processing images provided by the embodiment of the present application.
  • Fig. 4 is a schematic structural diagram of a JPEG XR encoder provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of forming transform coefficients based on macroblocks according to an embodiment of the present application.
  • Fig. 6 is a schematic diagram of an encoding method provided by an embodiment of the present application.
  • Fig. 7a is a schematic diagram of division of an image to be coded provided by an embodiment of the present application.
  • Fig. 7b is a schematic diagram of division of an image to be coded according to another embodiment of the present application.
  • Fig. 7c is a schematic diagram of division of an image to be coded according to yet another embodiment of the present application.
  • Fig. 7d is a schematic diagram of division of an image to be encoded according to yet another embodiment of the present application.
  • Fig. 7e is a schematic diagram of division of an image to be encoded according to yet another embodiment of the present application.
  • Fig. 7f is a schematic diagram of division of an image to be coded according to yet another embodiment of the present application.
  • FIG. 8 is a schematic diagram of an implemented matrix position conversion function provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a mapping relationship of blocks provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of an encoding method provided by another embodiment of the present application.
  • Fig. 11 is a schematic diagram of an encoding method provided by another embodiment of the present application.
  • Fig. 12 is a schematic structural diagram of an encoding device provided by an embodiment of the present application.
  • Fig. 13a is a schematic structural diagram of a JPEG XR encoder provided by another embodiment of the present application.
  • Fig. 13b is a schematic structural diagram of a JPEG XR encoder provided by another embodiment of the present application.
  • Fig. 14 is a schematic structural diagram of an encoding device provided by another embodiment of the present application.
  • FIG. 15 is a schematic structural diagram of an encoding device provided by another embodiment of the present application.
  • FIG. 16 is a schematic structural diagram of an encoding device provided in yet another embodiment of the present application.
  • FIG. 17 is a schematic structural diagram of a chip provided by an embodiment of the present application.
  • FIG. 1 is a structural diagram of a technical solution applying an embodiment of the present application.
  • the system 100 may receive data to be processed 102 , process the data to be processed 102 , and generate processed data 108 .
  • the system 100 may receive data to be encoded and encode the data to be encoded to generate encoded data, or the system 100 may receive data to be decoded and decode the data to be decoded to generate decoded data.
  • the components in system 100 may be implemented by one or more processors, which may be processors in computing devices, or processors in mobile devices (such as drones).
  • the processor may be any type of processor, which is not limited in this embodiment of the present invention.
  • the processor may include an encoder, decoder, or codec, among others.
  • One or more memories may also be included in system 100 .
  • the memory may be used to store instructions and data, for example, computer-executable instructions for implementing the technical solutions of the embodiments of the present invention, data to be processed 102, processed data 108, and the like.
  • the storage may be any type of storage, which is not limited in this embodiment of the present invention.
  • Data to be encoded may include text, images, graphic objects, animation sequences, audio, video, or any other data that requires encoding.
  • the data to be encoded may include sensory data from sensors such as vision sensors (e.g., cameras, infrared sensors), microphones, near-field sensors (e.g., ultrasonic sensors, radar), position sensors, temperature sensors, touch sensors, etc.
  • the data to be encoded may include information from the user, for example, biometric information, which may include facial features, fingerprint scans, retinal scans, voice recordings, DNA samples, and the like.
  • Fig. 2 is a schematic diagram of a video coding framework 2 according to an embodiment of the present application.
  • the current coded frame mainly undergoes: Prediction, Transform, Quantization and Entropy Coding, etc., and finally outputs the code stream of the current coded frame.
  • the decoding process usually decodes the received code stream according to the reverse process of the above process, so as to recover the video frame information before decoding.
  • the video encoding framework 2 includes an encoding control module 201 for performing decision-making control actions and parameter selection during the encoding process.
  • the encoding control module 201 controls parameters used in transformation, quantization, inverse quantization, and inverse transformation, controls the selection of intra-frame mode or inter-frame mode, and parameter control of motion estimation and filtering, And the control parameters of the encoding control module 201 will also be input into the entropy encoding module, and encoded to form a part of the encoded code stream.
  • the coded frame is divided 202 , specifically, it is first divided into slices and then divided into blocks.
  • the coded frame is divided into a plurality of non-overlapping largest CTUs, and each CTU can also be iteratively divided into a series of smaller coded Unit (Coding Unit, CU), in some examples, CU can also contain associated prediction unit (Prediction Unit, PU) and transformation unit (Transform Unit, TU), where PU is the basic unit of prediction, and TU is transformation and the basic unit of quantification.
  • Prediction Unit PU
  • Transform Unit Transform Unit
  • a PU and a TU are respectively obtained by dividing a CU into one or more blocks, and one PU includes multiple prediction blocks (Prediction Block, PB) and related syntax elements.
  • the PU and the TU may be the same, or they may be obtained by dividing the CU through different methods.
  • at least two of CU, PU, and TU are the same.
  • CU, PU, and TU are not distinguished, and prediction, quantization, and transformation are all performed in units of CU.
  • a CTU, a CU or other formed data units are all referred to as coding blocks.
  • the data unit targeted by video encoding may be a frame, a slice, a coding tree unit, a coding unit, a coding block, or a group of any of the above.
  • the size of the data unit may vary.
  • a prediction process is performed to remove redundant information in the spatial domain and time domain of the current coded frame.
  • commonly used predictive coding methods include intra-frame prediction and inter-frame prediction. Intra-frame prediction only uses the reconstructed information in this frame image to predict the current coding block, while inter-frame prediction uses the information in other frame images (also called reference frames) that have been reconstructed before to predict the current coding block. Make predictions.
  • the encoding control module 201 is used to decide to select intra prediction or inter prediction.
  • the process of intra-frame prediction 203 includes obtaining the reconstructed block of the coded adjacent block around the current coded block as a reference block, based on the pixel value of the reference block, using the prediction mode method to calculate the prediction value to generate a prediction block , subtracting the corresponding pixel values of the current coding block and the prediction block to obtain the residual of the current coding block, and the residual of the current coding block undergoes transformation 204 , quantization 205 and entropy coding 210 to form a code stream of the current coding block. Further, all the coded blocks of the current coded frame form a part of the coded code stream of the coded frame after undergoing the above coded process. In addition, the control and reference data generated in intra-frame prediction 203 are also encoded by entropy encoding 210 to form a part of the encoded code stream.
  • the transform 204 is used to remove the correlation of the residual of the image block, so as to improve the coding efficiency.
  • two-dimensional discrete cosine transform Discrete Cosine Transform, DCT
  • two-dimensional discrete sine transform Discrete Sine Transform, DST
  • quantization 205 is used to further improve the compression efficiency.
  • the quantized coefficients can be obtained after the transform coefficients are quantized, and then the quantized coefficients are subjected to entropy encoding 210 to obtain the residual code stream of the current encoding block, wherein the entropy encoding method includes But not limited to Context Adaptive Binary Arithmetic Coding (CABAC) entropy coding.
  • CABAC Context Adaptive Binary Arithmetic Coding
  • the bit stream obtained by entropy encoding and the encoded encoding mode information are stored or sent to the decoding end.
  • inverse quantization 206 is performed on the quantized result
  • inverse transformation 207 is performed on the dequantized result.
  • the reconstructed pixels are obtained using the inverse transformation result and the motion compensation result. Afterwards, the reconstructed pixels are filtered (ie loop filtered) 211 . After 211, the filtered reconstructed image (belonging to the reconstructed video frame) is output. Subsequently, the reconstructed image can be used as a reference frame image of other frame images for inter-frame prediction. In this embodiment of the present application, the reconstructed image may also be referred to as a reconstructed image or a reconstructed image.
  • the coded adjacent blocks in the process of intra prediction 203 are: the coded neighboring blocks before the current coded block is coded, and the residual generated during the coded process of the neighboring blocks is transformed 204, quantized 205, After inverse quantization 206 and inverse transformation 207, the reconstructed block is added to the prediction block of the adjacent block.
  • inverse quantization 206 and inverse transformation 207 are inverse processes of quantization 206 and transformation 204, and are used to recover residual data before quantization and transformation.
  • the inter prediction process when the inter prediction mode is selected, includes motion estimation (Motion Estimation, ME) 208 and motion compensation (Motion Compensation, MC) 209.
  • the encoder can perform motion estimation 208 according to the reference frame images in the reconstructed video frame, and search for the image block most similar to the current encoding block in one or more reference frame images according to a certain matching criterion as the prediction block,
  • the relative displacement between the prediction block and the current coding block is the motion vector (Motion Vector, MV) of the current coding block.
  • MV Motion Vector
  • the residual of the current coding block forms a part of the coded code stream of the coded frame.
  • motion compensation 209 may be performed based on the determined motion vector and the predicted block to obtain the current coding block.
  • the reconstructed video frame is obtained after filtering 211 .
  • a reconstructed video frame includes one or more reconstructed images.
  • Filtering 211 is used to reduce compression distortion such as block effect and ringing effect generated during the encoding process.
  • the reconstructed video frame is used to provide reference frames for inter-frame prediction during the encoding process.
  • the reconstructed video frame is output after post-processing for the final decoded video.
  • the inter-frame prediction mode may include an advanced motion vector prediction (Advanced Motion Vector Prediction, AMVP) mode, a merge (Merge) mode or a skip (skip) mode.
  • AMVP Advanced Motion Vector Prediction
  • merge Merge
  • skip skip
  • the motion vector prediction (Motion Vector Prediction, MVP) can be determined first. After the MVP is obtained, the starting point of the motion estimation can be determined according to the MVP, and the motion search is performed near the starting point. After the search is completed, the optimal MV, the position of the reference block in the reference image is determined by the MV, the reference block is subtracted from the current block to obtain the residual block, the MV is subtracted from the MVP to obtain the motion vector difference (Motion Vector Difference, MVD), and the MVD and MVP The index is transmitted to the decoder through the code stream.
  • MVP Motion Vector Prediction
  • the MVP can be determined first, and the MVP can be directly determined as the MV of the current block.
  • an MVP candidate list (merge candidate list) can be constructed first.
  • the MVP candidate list at least one candidate MVP can be included, and each candidate MVP can have an index corresponding to it.
  • the MVP index can be written into the code stream, and the decoder can find the MVP corresponding to the index from the MVP candidate list according to the index, so as to decode the image block.
  • Skip mode is a special case of Merge mode. After the MV is obtained according to the Merge mode, if the encoder determines that the current block is basically the same as the reference block, then there is no need to transmit the residual data, only the index of the MVP, and a flag that can indicate that the current block can be directly Obtained from the reference block.
  • the Merge mode can be applied to geometric forecasting techniques.
  • the image block to be coded can be divided into multiple sub-image blocks shaped as polygons, and the motion vector can be determined for each sub-image block from the motion information candidate list, and based on the The motion vector determines the prediction sub-block corresponding to each sub-image block, and constructs the prediction block of the current image block based on the prediction sub-block corresponding to each sub-image block, so as to realize the coding of the current image block.
  • For the decoding end perform operations corresponding to the encoding end.
  • entropy decoding, inverse quantization and inverse transformation are used to obtain residual information, and it is determined whether the current image block uses intra prediction or inter prediction according to the decoded code stream. If it is intra-frame prediction, use the reconstructed image block in the current frame to construct prediction information according to the intra-frame prediction method; if it is inter-frame prediction, you need to parse out the motion information, and use the parsed motion information in the reconstructed image
  • the reference block is determined to obtain the prediction information; next, the prediction information and the residual information are superimposed, and the reconstruction information can be obtained after filtering.
  • encoding video based on the video encoding framework 2 shown in FIG. 2 can save space or traffic occupied by video image storage and transmission.
  • the uncompressed original image data collected by the camera occupies a large storage space.
  • the image with a resolution of 3840 ⁇ 2160 and a storage format of YUV4:2:210-bit as an example.
  • Storing the image requires about 20M bytes of storage space.
  • an 8G memory card can only store 500 uncompressed photos of the above specifications. 20M bytes of traffic is required. Therefore, in order to save space or traffic occupied by image storage and transmission, image data needs to be encoded and compressed.
  • JPEG XR Joint Photographic Experts Group Extended Range
  • HD Photo or network media image
  • Microsoft Microsoft (microsoft ) development
  • XPS XML Paper Specification
  • XML Extensible Markup Language
  • Currently supported software includes .NET framework (3.0 or later), operating system (windows vista/windows 7), Internet Explorer (IE) 9, animation player (flashplayer) 11, etc.
  • JPEG XR is an image codec that can realize high dynamic range image encoding, and only requires integer operations during compression and decompression. It can support monochrome, Red Green Blue (RGB), Cyan Magenta Yellow Black (CMYK), 16-bit unsigned integer or 32-bit fixed-point or floating-point multi-channel color format images, and it can also support RGBE Radiance images Format. It can optionally embed the International Color Consortium (ICC) color profile for color consistency across devices.
  • ICC International Color Consortium
  • the alpha channel can indicate the degree of transparency, and supports Exchangeable Image File (EXIF) and Extensible Metadata Platform (XMP) metadata formats. This format also supports multiple images in one file. It supports only partial decoding of the image, and there is no need to decode the entire image for some specific operations such as cropping, downsampling, horizontal and vertical flipping, or rotation.
  • FIG. 3 it is a schematic diagram of processing images in five levels from large to small when JPEG XR processes images.
  • the figure includes an image (image), a tile (tile), a macro block (macro block), a block (block), and a pixel (pixel).
  • One of the images can consist of one or more tiles. If the tile is on the right and bottom edge of the image, it will be padded to an integer number of macroblocks (16 ⁇ 16).
  • Each macroblock may contain 16 4x4 blocks, and each block may contain 4x4 pixels.
  • JPEG XR performs a two-stage transform on each 4 ⁇ 4 block and the recombined low-pass block in the 16 ⁇ 16 macroblock.
  • the JPEG XR encoder may include five modules: a filtering module 410, a transform module 420, a quantization module 430, a prediction module 440, and an entropy encoding module 450.
  • the functions of these five modules are similar to those of the modules involved in the above-mentioned FIG. 2 similar.
  • the filtering module 410 can reduce the block effect of the decoded and reconstructed image through smoothing between adjacent pixels; the transform module 420 can convert the image information from the spatial domain to the frequency domain, and remove part of the redundant information in the spatial domain; the quantization module 430 can convert the frequency domain
  • the coefficients are shrunk to reduce the magnitude of the coefficients that need to be coded.
  • the degree of reduction of the coefficients depends on the size of the specified quantization parameter (Quantization Parameter, QP);
  • the prediction module 440 can remove the adjacent blocks through the prediction between the coefficients of the adjacent blocks The correlation between partial coefficients; the entropy encoding module 450 can encode the finally obtained coefficients into a binary code stream.
  • the size of the final code stream (that is, the code rate) mainly depends on the degree of quantization, prediction efficiency and entropy coding performance. Among them, quantization degree is decisive.
  • the following section first introduces the transformation module and quantization module of JPEG XR.
  • JPEG XR The transformation of JPEG XR is based on an integer transformation, and each macroblock can participate in two stages of transformation. Transforms can all be performed on a 4x4 block basis.
  • the first-stage transformation can be applied to 16 blocks within a macroblock, resulting in 16 low-pass coefficients (Low Pass Coefficient, LP Coefficient) and 240 high-pass (High Pass Coefficient, HP Coefficient) coefficients, namely Each of these 16 blocks produces one LP coefficient and 15 HP coefficients.
  • the second-stage transformation can be applied to the recombined block of 16 LP coefficients obtained in the first stage, and finally generate 1 DC coefficient (Direct Current Coefficient, DC Coefficient) and 15 LP coefficients through re-transformation.
  • Quantization in JPEG XR is highly flexible, since quantization parameters may vary among tiles, macroblocks and DC coefficients, LP coefficients, HP coefficients.
  • the quantization parameter range of JPEG XR is an integer from 0 to 255. When the quantization parameter is 0 and 1, it is lossless compression, and when the quantization parameter is 255, it is the most lossy compression.
  • Scale Factor, SF Scale Factor
  • the quantized coefficients are obtained by dividing the original coefficients by the corresponding scaling factor for the chosen quantization parameter and then rounding them to integers.
  • the final size of the code rate of the compressed image using the JPEG XR encoder depends on the degree of quantization, and the degree of quantization depends on the specified quantization parameters.
  • some algorithms require multiple encodings. This approach will bring additional complexity and lead to encoding delay, which will affect the running speed of the encoder and is not conducive to real-time encoding.
  • Other algorithms use fixed quantization parameters. However, using fixed quantization parameters will lead to uncontrollable output code rate.
  • this application proposes a coding method, which can improve the coding efficiency and reduce the consumption of hardware resources without sacrificing the accuracy of code rate control, and at the same time can ensure the flexibility of quantization parameters to avoid uncontrollable output code rate The problem.
  • the encoding method 600 may include steps 610-620.
  • n1 is a positive integer greater than or equal to 2.
  • the image to be encoded when dividing the image to be encoded, may be divided according to a fixed width or a fixed height, or may not be divided according to a fixed width or a fixed height.
  • the coded image may be divided horizontally, or the image to be coded may be divided vertically.
  • the horizontal division in the embodiment of the present application may refer to the division of the image to be coded in the horizontal direction
  • the vertical division may refer to the division of the image to be coded in the vertical direction
  • FIG. 7a it is a schematic diagram of division of an image to be encoded provided by an embodiment of the present application.
  • the image to be encoded can be divided vertically according to the preset fixed width, assuming that the preset fixed width is 384, as can be seen from Figure 7a, the image to be encoded can be divided into 3 tiles, and the width of these 3 tiles Both are the same, both are 384.
  • FIG. 7 b it is a schematic diagram of division of an image to be encoded provided by another embodiment of the present application.
  • the image to be encoded can be divided vertically according to the preset fixed width, assuming that the preset fixed width is 384, as can be seen from Figure 7b, the image to be encoded can be divided into 3 tiles, and tile 1 and Tile 2 has the same width, both 384, while Tile 3 has a width less than 384.
  • the divided tiles ie, tile 1, tile 2, and tile 3 have the same height, which is the height of the image to be encoded.
  • FIG. 7c it is a schematic diagram of division of an image to be coded provided by another embodiment of the present application.
  • the image to be coded can be horizontally divided according to the preset fixed height, assuming the preset fixed height is 384, as can be seen from Figure 7c, the image to be coded can be divided into 3 tiles, and the height of these 3 tiles Both are the same, both are 384.
  • FIG. 7d it is a schematic diagram of division of an image to be encoded provided by yet another embodiment of the present application.
  • the image to be coded can be horizontally divided according to the preset fixed height, assuming that the preset fixed height is 384, as can be seen from Figure 7d, the image to be coded can be divided into 3 tiles, and tile 1 and tile 2 The heights of tiles are the same, both are 384, and the height of tile 3 is less than 384.
  • the widths of the divided tiles are the same, which is the width of the image to be encoded.
  • the image to be coded may not be divided according to a fixed width or a fixed height, but may be divided according to multiple preset widths or multiple heights.
  • FIG. 7e it is a schematic diagram of division of an image to be coded provided by yet another embodiment of the present application.
  • the image to be coded can be divided vertically according to multiple preset fixed widths. Assuming that the preset fixed widths include 160 and 384, it can be seen from Figure 7e that the width of tile 1 is 160, and the width of tile 2 is 384, tile 3 has a width of 224.
  • FIG. 7f it is a schematic diagram of division of an image to be coded provided by yet another embodiment of the present application.
  • the image to be coded can be horizontally divided according to multiple preset fixed heights. Assuming that the multiple preset fixed heights are 160 and 384, it can be seen from Figure 7f that the height of tile 1 is 160, and the height of tile 2 The height is 384 and the height of tile 3 is 224.
  • the setting of the fixed width or fixed height is related to the number of pixels included in the PCT-processed block, specifically See below for a description.
  • the calculation of the image complexity information may also be replaced by operators including but not limited to Hadamard transform or mean square error.
  • the image complexity information in the embodiment of the present application may refer to the transform coefficients of the tiles included in the image to be encoded, and the QP of the tiles is updated according to the transform coefficients of the tiles.
  • the image complexity information is related to the transformation coefficient of the tile in the current frame, and the transformation coefficient is the coefficient obtained after performing PCT processing on the pixel value of the tile, by
  • the degree information is updated or the QP of each tile included in the image to be encoded can be guaranteed to improve the encoding efficiency and reduce the consumption of hardware resources without sacrificing the bit rate control accuracy, and at the same time, it can ensure the flexibility of quantization parameters to avoid output The code rate is uncontrollable.
  • the image complexity information includes the transformation coefficients obtained after PCT processing is performed on the pixel values of each tile, and the PCT processing involved will be described below.
  • the PCT processing may include the following flow, wherein, the 4*4 blocks included in each macroblock may be transformed according to the following flow.
  • _2 ⁇ 2T_h(a, b, c, d, flag), _T_odd(a, b, c, d), _T_odd_odd(a, b, c, d) and _FwdPermute(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) represent 4 different calculations, and the letters in brackets represent the input and output of the calculation.
  • PCT4 ⁇ 4 (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
  • t1 and t2 in the above formula are temporary values, and the >> symbol represents a right shift operation.
  • t1 and t2 in the above formula are temporary values, and the >> symbol represents a right shift operation.
  • This process realizes a matrix position conversion function, that is, the position of the letter of the left figure shown in FIG. 8 is converted to the position of the letter of the right figure shown in FIG. 8 .
  • the above-mentioned PCT processing flow is described by taking simple numerical values as an example, assuming that the above-mentioned a, b, c, d, e, f, g, h, i, j, k, l, m, n, o , the values of p are respectively 1, 2, 3, 4, 2, 3, 5, 4, 2, 3, 4, 0, 3, 2, 1, 1, and PCT processing is performed on these values according to the above procedure.
  • a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p are updated to 10, -1, 1, 0, - 1, 3, 0, 2, 0, -1, -1, -2, -1, 0, -1, -3.
  • the updated values of c, d, g, and h are 1, 0, -2, 0 respectively.
  • the updated values of i, m, j, and n are -1, 0, -1, 0 respectively.
  • the updated values of a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p are 10, -1, 1, 0 respectively , -1, 3, -2, 0, -1, -1, 0, 1, 0, 0, 0, -4.
  • matrix transformation processing is performed on the input values, and finally updated a, b, c, d, e, f, g, h, i, j, k, l, m, n, o,
  • the values of p are 10, -1, -1, 0, 1, -4, 0, 0, -1, 0, 3, -1, 0, 1, -2, 0.
  • the updating the QP of the n1 tiles according to the image complexity information includes: calculating the i-th of the n1 tiles according to the image complexity information
  • the cumulative value of the target number of bytes of the tile, i is a positive integer less than or equal to n1; the QP of the i-th tile is updated according to the cumulative value of the target number of bytes of the i-th tile.
  • the cumulative value of the target number of bytes of the i-th tile in this embodiment of the present application may refer to the target number of bytes of all tiles in the previous i-th tile (including the i-th tile).
  • the cumulative value of the target byte count of the second tile may refer to the sum of the target byte count of the first tile and the target byte count of the second tile; the target byte count of the fifth tile
  • the cumulative value of the number of sections can refer to the target byte count of the first tile, the target byte count of the second tile, the target byte count of the third tile, and the target byte count of the fourth tile and the sum of the target byte count of the fifth tile; and so on, the cumulative value of the target byte count of the n1th tile can refer to the target byte count of the first tile, the second tile
  • the sum of the target number of bytes of the slice ..., the target number of bytes of the n1-1th tile, and the target number of bytes of the n1th tile.
  • the QP of the i-th tile may be updated according to the accumulated value of the target byte number of the i-th tile.
  • the QP of the first tile can be updated according to the cumulative value of the target byte count of the first tile (that is, the target byte count of the first tile), and according to the target byte count of the third tile The cumulative value of updates the QP of the third tile.
  • the initial QP of the first tile is updated according to the target number of bytes of the first tile.
  • the image complexity information in the embodiment of the present application includes the transformation coefficient obtained after PCT processing is performed on the pixel value of each tile. This is because, since the image complexity information calculated by using the transformation form of the JPEG XR transformation module has a strong correlation with the size of the final code stream, the image complexity information used in the embodiment of this application can be processed by the above-mentioned PCT Calculated by accumulating transform coefficients.
  • the acquisition of the image complexity information of each of the n1 tiles in the current frame includes:
  • preset transformation is performed to generate preset transformation parameters, and the image complexity information of the tile is generated according to the preset transformation parameters.
  • the preset transformation includes PCT transformation
  • the width of the image to be encoded is not an integer multiple of the fixed width
  • the complexity of pixels in the tile whose width on the rightmost side is less than the fixed width may not be calculated , or, if the height of the image to be encoded is not an integer multiple of the fixed height, then the complexity of the pixels in the tile whose lowermost height is less than the fixed height may not be calculated.
  • the image complexity of the rightmost tile of the image to be encoded can be calculated through the proportional relationship, or, if the height of the image to be encoded is not fixed Integer multiples of the height, the image complexity of the bottom tile of the image to be encoded can be calculated through the proportional relationship.
  • the input processed by PCT can include 4*4 pixel blocks.
  • 2x8 blocks can be mapped to 4x4 blocks for input . This operation can save 2 lines of cache resources.
  • FIG. 9 it is a schematic diagram of a block mapping relationship provided by the embodiment of the present application.
  • (a) in FIG. 9 is a schematic diagram of a block before mapping
  • (b) in FIG. 9 is a schematic diagram of a block after mapping.
  • This mapping relationship can be understood as moving the last four pixels of the first row to the position below the second row, that is, the position of the third row, and moving the last four pixels of the second row to the bottom of the third row, that is, the position of the fourth row. row position.
  • the setting of the fixed width or fixed height is related to the number of pixels included in the PCT-processed block.
  • mapping relationship is to map a 2x8 block to a 4x4 block for input, that is, the block before mapping includes 2 rows and 8 columns of pixels. Therefore, when setting the above fixed width, it can be set to a value that is an integer multiple of 8. In this way, when mapping the rightmost block of the tile, it can just be mapped as a 4*4 block.
  • the above-mentioned fixed height when setting the above-mentioned fixed height, it can be set to a value that is an integer multiple of 2, so that when mapping the bottom block of the tile, it can just be mapped to a 4*4 block.
  • the width of the rightmost tile may not meet the fixed width, or the height of the bottommost tile may not be Satisfying a fixed height, when calculating the image complexity value of the rightmost tile or the bottommost tile, it can be calculated in the following way.
  • the width of the rightmost tile (that is, the n1th tile) may be less than 384. Therefore, the image complexity value of the 1st to n1-1th tiles can be calculated first, and then the image complexity value of the n1th tile can be calculated according to the proportional relationship.
  • the absolute values of all DC coefficients in the obtained tiles and coefficients other than DC coefficients can be absolute
  • complexityDC i represents the image complexity value of the DC coefficient of the i-th tile
  • ⁇ 2x8 blocks in tile DC coefficient represents the sum of the DC coefficients of all blocks in the i-th tile
  • complexityLPHP i represents the i-th tile
  • the image complexity value of the LPHP coefficient, ⁇ 2x8 blocks in tile LPHP coefficient represents the sum of the LPHP coefficients of all blocks in the i-th tile.
  • complexityDC n1 complexityDC n1-1 *tilewidth n1 /384 (39)
  • complexityLPHP n1 complexityLPHP n1-1 *tilewidth n1 /384 (40)
  • complexityDC n1 represents the image complexity value of the DC coefficient of the rightmost tile
  • complexityDC n1-1 represents the image complexity value of the DC coefficient of the tile adjacent to the left side of the rightmost tile
  • complexitLPHP n1 Indicates the image complexity value of the LPHP coefficient of the rightmost tile
  • complexitLPHP n1-1 indicates the image complexity value of the LPHP coefficient of the tile adjacent to the left side of the rightmost tile
  • tilewidth n1 indicates the rightmost The actual width of the tile.
  • tile 1 , tile 2 and tile 3 are both 384, and the width of tile 3 is smaller than 384.
  • the image complexity values of tile 1 and tile 2 can be obtained according to the above formulas (37) and (38), and the image complexity value of tile 3 can be obtained according to the above formulas (39) and (40).
  • the DC coefficient and the LPHP coefficient in the tile have been described above, and for the sake of brevity, details will not be repeated here.
  • the image complexity value of the DC coefficient of tile 1 is 100, and the image complexity value of the LPHP coefficient of tile 1 is 80.
  • the image complexity value of the DC coefficient of tile 2 is 146, and the image complexity value of the LPHP coefficient of tile 2 is 100.
  • the image complexity value of the DC coefficient of tile 3 is 38, and the image complexity value of the LPHP coefficient of tile 3 is 26.
  • the target number of bytes of each tile can be calculated according to its image complexity value, and then the i-th tile can be updated based on the cumulative value of the target number of bytes of the i-th tile QP of tiles.
  • the target number of bytes of each tile according to its image complexity value please refer to the following content.
  • the updating the QP of the i-th tile according to the cumulative value of the target number of bytes of the i-th tile includes: according to the absolute value of the first difference and The first threshold updates the QP of the ith tile, and the first difference is the cumulative value of the target number of bytes of the ith tile and the actual number of encoded bytes of the ith tile The difference between the accumulated values of .
  • the cumulative value of the actual number of encoded bytes of the i-th tile in this embodiment of the present application may refer to the actual number of encoded bytes of all tiles in the previous i-th tile (including the i-th tile).
  • the cumulative value of the actual number of encoded bytes of the second tile may refer to the sum of the actual number of encoded bytes of the first tile and the actual number of encoded bytes of the second tile;
  • the actual number of encoded bytes can refer to the actual number of encoded bytes of the first tile, the actual number of encoded bytes of the second tile, the actual number of encoded bytes of the third tile, the actual number of encoded bytes of the fourth tile The sum of the actual number of encoded bytes and the actual number of encoded bytes of the fifth tile; and so on, the cumulative value of the actual number of encoded bytes of the n1th tile can refer to the actual encoding of the first tile The sum of the number of bytes, the actual number of encoded bytes of the second tile..., the actual number of encoded bytes of the n1-1th tile, and the actual number of encoded bytes of the n1th tile.
  • the actual number of encoded bytes of the i-th tile can be obtained by the encoder during the process of encoding the image to be encoded.
  • the first threshold in the embodiment of the present application may be fixed or continuously adjusted, which is not specifically limited in the present application.
  • the encoder can encode in units of tiles.
  • the initial QP 0 of the first tile can be calculated according to the original size of the image and the target number of bytes of the current frame.
  • the QP of the current tile may be updated according to the difference between the cumulative value of the target byte number of the current tile and the cumulative value of the actual coded byte number.
  • the calculation of the target byte count of the current frame and the target byte count of each tile is as follows.
  • targetByte represents the target number of bytes of the image (being the current frame in the embodiment of the present application)
  • width represents the width of the image
  • height represents the height of the image
  • bitdepth represents the bit depth of the image
  • m represents the number of all pixels
  • the ratio of the number to the number of brightness pixels for example, when encoding a YUV422 format image, the value of n is 2)
  • compressRatio indicates the image compression ratio.
  • n represents the number of tiles that the current image is divided into
  • i represents the i-th tile
  • t arg etByte i represents the target byte number of the i-th tile
  • complexityLPHP i represents the number of bytes corresponding to the i-th tile.
  • Image complexity of LPHP coefficients Represents the sum of the image complexity of the LPHP coefficients of all tiles in the current frame.
  • image complexity information is used in this embodiment, which is guidance information obtained based on prior data.
  • the calculation of the Qp of each tile according to the image complexity information in the following is calculated based on the image complexity value of the LPHP coefficient.
  • the target number of bytes of the current frame is:
  • the target byte count for each tile is:
  • the first threshold may include multiple thresholds, for example, may include two thresholds, and the threshold may be calculated by using formula (43) and formula (44).
  • targetByte represents the target number of bytes of the image (that is, the current frame in the embodiment of the present application)
  • n represents the number of tiles that represent the current image to be encoded
  • threshold1 and threshold2 represent threshold 1 and threshold 2.
  • the initial QP 0 of the first tile can be calculated first, and then the QP of each tile can be updated or calculated based on the initial QP 0 .
  • image complexity can represent the amount of information in the original image content
  • target number of bytes represents the amount of information after compression
  • the two will be converted to the logarithmic domain for calculation when calculating QP.
  • the initial QP calculation can be calculated by formula (45) to formula (49).
  • the formula (45) in this embodiment normalizes the number of bytes to the data volume bpp of each pixel, and converts it to the logarithmic domain.
  • Equation (46) and Equation (47) transform the complexity into the logarithmic domain. Since compression is a nonlinear process, the complexity will be further converted into bpp multiplicative relational operator Equation (46) in the process of establishing the mathematical model and the additive relationship operator formula (47) to improve the fit of the mathematical model.
  • QP is obtained by formula (48) established by multiplicative operator, additive operator, log(bpp) and variable parameters x and y of complexity.
  • z in the formula is a variable parameter, which can be updated later, and the initial value can be set to 0.
  • QP 0 Cilp3(min QP, max QP, QP) (49)
  • QP 0 in the formula is the final determined initial QP
  • minQP and maxQP are the minimum value and maximum value of QP respectively
  • minQP may not be less than
  • maxQP may not be greater than 255.
  • QP 0 can be any value in the brackets. If the QP calculated by the above formula (18) is between minQP and maxQP, then QP 0 is QP; if the QP calculated by the above formula (18) is less than minQP, then QP 0 is minQP; if by the above formula (18 ) calculated QP is greater than maxQP, then QP 0 is maxQP.
  • the determined initial QP 0 is 147.47.
  • the QP of tile 1 in the current frame can be updated based on the determined initial QP 0 , then the QP of tile 2 can be calculated based on the updated QP of tile 1, and finally the tile can be calculated based on the QP of tile 2 QP for slice 3.
  • the encoding end can update the QP of the i-th tile according to the absolute value of the first difference and the first threshold, which will be described in detail below.
  • the updating the QP of the ith tile according to the absolute value of the first difference and the first threshold includes: if the first difference is positive, setting The difference between the QP of the i-1 tile and the first offset QP is used as the QP of the i-th tile; if the first difference is negative, the i-1 tile’s The sum of QP and the first offset QP is used as the QP of the ith tile; wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold .
  • the QP of the ith tile of the image to be encoded may be updated in combination with the sign of the first difference.
  • the cumulative value of the target number of bytes and the cumulative value of the actual number of encoded bytes of the i-th tile can be calculated according to formula (50) and formula (51).
  • accTarBytes i represents the cumulative value of the target number of bytes of the i-th tile, Indicates the sum of the target bytes of all tiles in the first i tile (including the i-th tile), accActBytes i indicates the cumulative value of the actual coded bytes of the i-th tile, Indicates the sum of the actual number of encoded bytes of all tiles in the first i tile (including the i-th tile).
  • the first difference is calculated according to formula (50) and formula (51), as shown in formula (52), and the offset value of QP is obtained through formula (53) and formula (54).
  • deltaBytes i accTarBytes i -accActBytes i (52)
  • offsetB
  • deltaBytes i represents the difference between the cumulative value of the target number of bytes of the i-th tile and the cumulative value of the actual number of encoded bytes, that is, the first difference
  • QPoffset i represents the offset of the QP of the i-th tile value
  • offsetA is a preset parameter and can be set to 2.
  • the meaning expressed by formula (54) is: if the absolute value
  • the range of QP can still be between [min QP, max QP].
  • the QP of the ith tile can be updated according to equation (55).
  • QP i represents the QP of the i-th tile
  • QP i-1 represents the QP of the i-1-th tile
  • sign(deltaBytes i ) represents the sign of deltaBytes i .
  • the QPs of tile 1, tile 2, and tile 3 are updated or calculated respectively.
  • the preset threshold 1 (threhold1) and the preset threshold 2 (threhold2) can be calculated respectively according to the above formula (43) and formula (44).
  • the target number of bytes of tile 1 is 337, assuming that the actual number of encoded bytes of tile 1 is 300, then the target number of bytes of tile 1 and the actual number of encoded bytes can be obtained by formula (52).
  • the target byte count of tile 2 is 421, assuming that the actual encoded byte count of tile 2 is 470, the cumulative value of the target byte count of tile 2 is the same as the target byte count of tile 1
  • the target byte count of tile 3 is 109.5, assuming that the actual encoded byte count of tile 3 is 50, the cumulative value of the target byte count of tile 3 is the same as the target byte count of tile 1
  • the cumulative value of the actual coded byte count of tile 3 is the actual coded word of tile 1
  • the target number of bytes of the i-th tile is related to first information; the first information is at least one of the following information: the target number of bytes of the current frame , the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
  • the target byte count of the current frame is related to second information; the second information is at least one of the following information: width of the current frame, width of the current frame The height of the current frame, the bit depth of the current frame, the coding format of the current frame or the image compression ratio of the current frame.
  • the target number of bytes of the i-th tile may be related to the target number of bytes of the current frame, the transformation coefficient of the i-th tile, or the transformation coefficient of the current frame.
  • the target number of bytes of the i-th tile can be calculated by the above formula (42).
  • specific content please refer to the description of the above formula (42).
  • details will not be repeated here.
  • the target number of bytes of the current frame may be related to the width of the current frame, the height of the current frame, the bit depth of the current frame, the encoding format of the current frame, or the image compression ratio of the current frame.
  • the target number of bytes of the current frame can be calculated by the above-mentioned formula (41), and the specific content can refer to the description of the above-mentioned formula (41), for the sake of brevity, no more details are given here.
  • the method further includes: updating the n2 tiles in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold The QP of the slice.
  • the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame
  • the target frame is the first x frames and/or the last x frames of the current frame y frame
  • x and y are positive integers greater than or equal to 1
  • n2 is a positive integer greater than or equal to 2.
  • the QPs of n2 tiles in the target frame may be updated according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold.
  • the target frame may be the previous x frames of the current frame; if the current encoding method is backward prediction, the target frame may be the last y frames of the current frame; if If the current encoding method is bidirectional prediction, the target frame may be the previous x frame and the next y frame of the current frame.
  • the image to be encoded when dividing the image to be encoded (target frame), the image to be encoded may be divided according to a fixed width or a fixed height, or may not be divided according to a fixed width Or divide the image to be coded with a fixed height; there is no limit.
  • the coded image may be divided horizontally, or the image to be coded may be divided vertically.
  • n2 in this embodiment of the present application may be the same as or different from n1 above, which is not specifically limited in this application.
  • the ratio of the second difference (the difference between the target number of bytes of the current frame and the actual number of encoded bytes) to the target number of bytes of the current frame is used to update the number of tiles included in the target frame.
  • QP can further improve the coding efficiency, and at the same time, it can ensure the flexibility of quantization parameters to avoid the problem of uncontrollable output code rate.
  • updating the QP of n2 tiles in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of a second threshold include:
  • the difference between the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter; according to the updated first parameter Calculate the QP of the n2 tiles;
  • the sum of the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter; calculated according to the updated first parameter QP of the n2 tiles.
  • the initial QP0 of the first tile of the target frame can be obtained first, and the parameter z in the above formula (48) can be updated in the following way, and then based on the update
  • the last parameter z (namely the first parameter in this application) calculates the initial QP 0 of the target frame.
  • the actual number of encoded bytes of the current frame can be calculated by formula (57).
  • accActBytes n1 represents the actual number of encoded bytes of the current frame
  • n1 represents the number of tiles divided by the current frame.
  • deltaBytes n1 t arg etByte n1 -accActBytes n1 (58)
  • deltaBytes n1 indicates the difference between the target number of bytes of the current frame and the actual number of encoded bytes
  • targ etByte n1 indicates the target number of bytes of the current frame
  • accActBytes n1 indicates the actual number of encoded bytes of the current frame.
  • the updated parameter z is determined according to Equation (59)-Equation (61).
  • delta z represents the difference before and after the update of parameter z
  • tmpOffset1 and tmpOffset2 are temporary variables.
  • the updated parameter z can be calculated based on formula (62).
  • z new represents the value of the parameter z after the update
  • z represents the value of the parameter z before the update
  • sign(deltaBytes n ) represents the sign of deltaBytes n .
  • the actual encoded byte count of the current frame can be obtained by the above formula (57): As mentioned above, the target byte count for this current frame is 867.5.
  • the updated parameter z new can be used for calculation.
  • the value of the parameter z in the above formula (48) is calculated with the updated parameter z new , that is, -2 is used to calculate the initial QP of the first tile of the target frame 0 .
  • the initial QP 1 of the first tile can be updated based on the image complexity information of the first tile of the target frame, and then the QP 2 of the second tile can be calculated based on the updated initial QP 1 of the first tile , and then calculate the QP 3 of the third tile based on the QP 2 of the second tile, ..., and so on, until the QP calculation of all tiles of the target frame is completed.
  • the updated first parameter is determined in combination with the sign of the second difference value, and the QP of the tile included in the target frame is updated based on the updated first parameter, which can further improve coding efficiency.
  • FIG. 10 is a schematic diagram of an encoding method 1000 provided by another embodiment of the present application.
  • the encoding method 1000 may include steps 1010-1060.
  • the encoding method provided by the embodiment of the present application is outlined below with reference to FIG. 10 .
  • step 1030 is performed; if the first tile is not currently being encoded, then step 1040 is performed.
  • step 1060 If yes, execute step 1060 , if not, return to execute step 1020 .
  • the acquiring the image complexity information of each of the n1 tiles in the current frame includes: respectively acquiring the n1 The image complexity information of the components of each tile in the tiles, the components include the brightness component and/or at least one chrominance component of the current frame; update the n1 tiles according to the image complexity information
  • the QP includes: updating the QP of the n1 tiles according to the image complexity information of at least one of the components.
  • the multi-channel encoding in this embodiment of the present application may include YUV encoding or RGB encoding, without limitation.
  • YUV refers to a pixel format in which luma parameters and chrominance parameters are represented separately.
  • the format of YUV encoding can include YUV444, YUV422, YUV420 and YUV411. The following takes the YUV encoding format as YUV422 as an example for illustration.
  • Y component For the image complexity information of the tiles of the Y component, please refer to the above content.
  • UV component Since the format of YUV encoding is YUV422, the pixel of the UV component can be half of the pixel value of the image to be encoded, and the image complexity information of the tile is obtained based on this half of the pixel value.
  • the image complexity information of the Y component and the UV component of each tile in the n1 tiles can be respectively obtained, and the average of the image complexity information of the Y component and the UV component can be based on
  • the QP of n1 tiles can be updated by the value; the QP of n1 tiles can also be updated according to the image complexity information of the Y component; the QP of n1 tiles can also be updated according to the image complexity information of the UV component; limit.
  • updating the QP of n1 tiles according to the image complexity information of at least one of the components is not limited to the ones listed above, and can also be in other ways, for example, the image complexity information of the Y component and the image of the UV component
  • the root mean square value of the complexity information and the like are not specifically limited in this application.
  • the accuracy of the quantization parameter can be improved by updating the QP of the tile according to the obtained image complexity information of at least one component of the image complexity information of the components of each tile.
  • the acquiring the image complexity information of each of the n1 tiles in the current frame includes: acquiring multiple transformation parameters of each tile; One parameter is selected from the plurality of transformation parameters as the image complexity information of each tile.
  • one parameter may be selected from the acquired transformation parameters to calculate the image complexity information of each tile.
  • the image complexity information of each tile is calculated based on the LPHP coefficient of the tile.
  • the image complexity information of each tile can also be calculated according to the DC coefficient of the tile. degree information, or, the image complexity information of each tile may also be calculated according to the average value of the LPHP coefficient and the DC coefficient of the tile, which is not specifically limited in the present application.
  • the method 600 may also include:
  • the updated QP of the n1 tiles is less than a third threshold, use the third threshold as the updated QP of the n1 tiles; or,
  • the updated QP of the n1 tiles is greater than a fourth threshold, use the fourth threshold as the updated QP of the n1 tiles;
  • the third threshold is the minimum value of the QP used for encoding
  • the fourth threshold is the maximum value of the QP used for encoding
  • the minimum value (ie, the third threshold) and the maximum value (ie, the fourth threshold) of QP may be set.
  • the third threshold and/or the fourth threshold in this embodiment of the present application may be fixed or continuously adjusted, and are not limited.
  • the QP of the tile calculated by the above formula is less than the minimum value, then the QP of the tile can be calculated based on the set minimum value; if the QP of the tile calculated by the above formula is greater than the maximum value, then the follow-up can be based on the set maximum value Calculate the QP of the tile.
  • the minimum and maximum values of QP can be set to 5 and 150 respectively. If the QP of a tile calculated by the above formula is any value from 5 to 150, it can be based on the calculated QP. The next tile is encoded; if the QP of the tile calculated by the above formula is 3, the next tile can be encoded based on 5; if the QP of the tile calculated by the above formula is 160, it can be encoded based on 150 The next tile is encoded.
  • the encoding method is applied in the JPEG XR encoding format.
  • the JPEG XR encoding format is a continuous-tone still image compression algorithm and file format that can support lossy data compression as well as lossless data compression.
  • the JPEG XR encoding format has certain advantages over the JPEG encoding format.
  • JPEG uses 8-bit encoding, enabling 256 colors, while JPEG XR can use 16-bit or more, providing better results and more editing flexibility.
  • the JPEG XR encoding format uses a more efficient compression algorithm.
  • the image quality can be twice that of the latter, or half the size of the latter for the same quality.
  • JPEG XR's highest quality compression allows no loss of information.
  • FIG. 11 is a schematic diagram of an encoding method 1100 provided by still another embodiment of the present application.
  • the encoding method 1100 may include steps 1110-1130.
  • Acquire image complexity information of the current frame where the image complexity information includes transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on pixel values of the current frame.
  • PCT processing image kernel transformation processing
  • the initial QP of the current frame can be determined according to the image complexity information, and the initial QP can be described according to the above formula (45) to formula (49). For the sake of brevity, details are not repeated here.
  • the initial QP in the embodiment of the present application is the initial QP of the current frame; while the encoding method 600 above is performed in units of tiles Therefore, the initial QP in the above embodiment is the initial QP of the first tile in the current frame.
  • the target frame may be the previous x frames of the current frame; if the current encoding method is backward prediction, the target frame may be the last y frames of the current frame; if If the current encoding method is bidirectional prediction, the target frame may be the previous x frame and the next y frame of the current frame.
  • the image complexity information is related to the transformation coefficient of the current frame, and the transformation coefficient is the coefficient obtained after performing PCT processing on the pixel values in the current frame, it is determined according to the image complexity information
  • the initial QP of the current frame and the initial QP of the target frame are updated according to the initial QP, which can ensure that the encoding efficiency is improved and the hardware resource consumption is reduced without sacrificing the accuracy of the code rate control, and at the same time, the flexibility of quantization parameters can be guaranteed to avoid output
  • the code rate is uncontrollable.
  • the updating the initial QP of the target frame according to the initial QP of the current frame includes: according to the difference between the absolute value of the second difference and the target byte number of the current frame The ratio and the size of the second threshold update the initial QP in the target frame; wherein, the second difference is the difference between the target byte number of the current frame and the actual coded byte number of the current frame.
  • the second threshold in the embodiment of the present application may be a fixed value, or may be continuously adjusted, which is not specifically limited in the present application.
  • the updating the initial QP of the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of a second threshold includes :
  • the difference between the first parameter and the offset parameter used to calculate the initial QP of the current frame is used as the updated first parameter
  • the second difference is a negative value
  • the sum of the first parameter and the offset parameter used to calculate the initial QP of the previous frame is used as the updated first parameter
  • the first parameter in the embodiment of the present application can be the parameter z in the above formula (48).
  • the initial value of the parameter z can be set to 0, and the subsequent calculation of the target frame
  • the parameter z in the formula (48) can be updated according to the image complexity information of the current frame.
  • the difference between the target number of bytes of the current frame and the actual number of encoded bytes can be calculated first, based on the ratio of the absolute value of the difference to the target number of bytes of the current frame and the size update formula of the second threshold (48 ), and then update the initial QP of the target frame based on the updated parameter z and the image complexity information of the target frame.
  • the above formula (57) ⁇ formula (62) and formula (45) ⁇ (49) for the sake of brevity, no more details here.
  • the updated first parameter is determined in combination with the sign of the second difference value, and the QP of the target frame is updated based on the updated first parameter, which can further improve coding efficiency.
  • obtaining the image complexity information of the current frame can obtain multiple The image complexity information of each component, see below for details.
  • the acquiring the image complexity information of the current frame includes: respectively acquiring the image complexity information of the components of the current frame, the The components include a luminance component and/or at least one chrominance component of the current frame; updating the initial QP of the target frame according to the initial QP of the current frame includes: updating according to the image complexity information of at least one of the components The initial QP of the target frame.
  • the multi-channel encoding in this embodiment of the present application may include YUV encoding or RGB encoding, without limitation.
  • YUV refers to a pixel format in which luma parameters and chrominance parameters are represented separately.
  • the format of YUV encoding can include YUV444, YUV422, YUV420 and YUV411. The following takes the YUV encoding format as YUV422 as an example for illustration.
  • Y component For the image complexity information of the tiles of the Y component, please refer to the above content.
  • UV component Since the format of YUV encoding is YUV422, the pixel of the UV component can be half of the pixel value of the image to be encoded, and the image complexity information of the tile is obtained based on this half of the pixel value.
  • the initial QP of the target frame can be updated based on the average value of the image complexity information of the Y component and the image complexity information of the UV component;
  • the image complexity information updates the initial QP of the target frame;
  • the initial QP of the target frame can also be updated according to the image complexity information of the UV component; not limited.
  • updating the initial QP of the target frame according to the image complexity information of at least one of the components is not limited to the ones listed above, and can also be in other ways, for example, the image complexity information of the Y component and the image complexity of the UV component
  • the root mean square value of degree information, etc. is not specifically limited in this application.
  • the accuracy of quantization parameters can be improved by updating the initial QP of the target frame according to the acquired image complexity information of at least one component in the image complexity information of the components of the current frame.
  • the acquiring the image complexity information of the current frame includes: acquiring multiple transformation parameters of the current frame; selecting a parameter from the multiple transformation parameters as the current frame image complexity information.
  • one parameter may be selected from the acquired transformation parameters to calculate the image complexity information of each tile.
  • the image complexity information of the current frame can be calculated based on the LPHP coefficient of the current frame.
  • the image complexity information of the current frame can also be calculated according to the DC coefficient of the current frame, or , the image complexity information of the current frame may also be calculated according to the average value of the LPHP coefficient and the DC coefficient of the current frame, which is not specifically limited in the present application.
  • the method may further include: if the updated initial QP of the target frame is smaller than a third threshold, using the third threshold as the updated target frame or, if the updated initial QP of the target frame is greater than a fourth threshold, use the fourth threshold as the updated initial QP of the target frame; wherein, the third The threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  • the minimum value (ie, the third threshold) and the maximum value (ie, the fourth threshold) of the initial QP may be set.
  • the initial QP of the current frame calculated by the above formula is less than the minimum value, then the initial QP of the target frame can be calculated based on the set minimum value; if the initial QP of the current frame calculated by the above formula is greater than the maximum value, then the follow-up can be based on the set The maximum value of calculates the initial QP of the target frame.
  • the minimum and maximum values of the initial QP can be set to 5 and 150 respectively. If the initial QP of the current frame calculated by the above formula is any value from 5 to 150, it can be obtained based on the calculation The initial QP of the current frame is used to encode the target frame; if the initial QP of the current frame calculated by the above formula is 3, the target frame can be encoded based on 5; if the initial QP of the current frame calculated by the above formula is 160, then the target frame can be encoded based on 150 Encode the target frame.
  • the encoding method is applied in the JPEG XR encoding format.
  • the JPEG XR encoding format is a continuous-tone still image compression algorithm and file format that can support lossy data compression as well as lossless data compression.
  • the JPEG XR encoding format has certain advantages over the JPEG encoding format.
  • JPEG uses 8-bit encoding, enabling 256 colors, while JPEG XR can use 16-bit or more, providing better results and more editing flexibility.
  • the JPEG XR encoding format uses a more efficient compression algorithm.
  • the image quality can be twice that of the latter, or half the size of the latter for the same quality.
  • JPEG XR's highest quality compression allows no loss of information.
  • FIG. 12 is a schematic structural diagram of an encoding device 1200 provided by an embodiment of the present application.
  • the encoding device 1200 may include a complexity calculation module 1210 and a code rate control module 1220 .
  • a complexity calculation module 1210 configured to acquire image complexity information of each of the n1 tiles in the current frame, the image complexity information including image kernel transformation processing of pixel values of each tile
  • the transformation coefficient obtained after (PCT processing) n1 is a positive integer greater than or equal to 2.
  • a code rate control module 1220 configured to update the quantization parameters (QP) of the n1 tiles according to the image complexity information.
  • Figure 13a is a schematic structural diagram of a JPEG XR encoder provided by an embodiment of the present application.
  • the schematic diagram may include a filter module 410 , a transform module 420 , a quantization module 430 , a prediction module 440 , an entropy encoding module 450 , a complexity calculation module 460 and a code rate control module 470 .
  • the five modules of the filtering module 410 , the transform module 420 , the quantization module 430 , the prediction module 440 , and the entropy coding module 450 are similar to the functions of the modules mentioned above in FIG. 2 .
  • the complexity calculation module 460 and the code rate control module 470 can be the complexity calculation module 1210 and the code rate control module 1220 in the embodiment of the present application, and can realize the update of the QP of the tile in the embodiment of the present application.
  • the complexity calculation module 460 can obtain image complexity information and output the information to the code rate control module 470, and the code rate control module 470 can receive the size of the actual code stream as an input to update the code rate control parameters, that is, realize QP update.
  • FIG. 13b is a schematic structural diagram of a JPEG XR encoder provided by another embodiment of the present application.
  • the schematic diagram may also include a filter module 410 , a transform module 420 , a quantization module 430 , a prediction module 440 , an entropy encoding module 450 , a complexity calculation module 460 and a code rate control module 470 .
  • the complexity calculation module 460 and the code rate control module 470 in Fig. 13b are located in the JPEG XR encoder, while the complexity calculation module 460 in Fig. 13a is located in the processor, and the code rate control module 470 Located in the JPEG XR encoder.
  • the two JPEG XR encoders shown in Figure 13a and Figure 13b can both implement the update of the QP of the tile in the embodiment of the present application.
  • the difference is that the JPEG XR encoder shown in Figure 13a is currently encoding.
  • the encoding of the current image to be encoded can only be started after the complexity calculation of the image to be encoded is completed.
  • the time is slightly increased; the complexity calculation of the image to be encoded is completed before starting Encode the current image to be encoded, and then use it with a delay of one frame.
  • the first frame has no input prior knowledge.
  • the code rate control module 1220 is further configured to: calculate the cumulative value of the target number of bytes of the i-th tile among the n1 tiles according to the image complexity information , i is a positive integer less than or equal to n; the QP of the i-th tile is updated according to the cumulative value of the target number of bytes of the i-th tile.
  • the code rate control module 1220 is further configured to: update the QP of the ith tile according to the absolute value of the first difference and the first threshold, the first difference is the difference between the cumulative value of the target number of bytes of the ith tile and the cumulative value of the actual coded number of bytes of the ith tile.
  • the code rate control module 1220 is further configured to: if the first difference is a positive value, calculate the difference between the QP of the i-1th tile and the first offset QP value as the QP of the ith tile; if the first difference is a negative value, the sum of the QP of the i-1th tile and the first offset QP is used as the ith QP of tiles; wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold.
  • the target number of bytes of the i-th tile is related to first information; the first information is at least one of the following information: the target number of bytes of the current frame , the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
  • the target byte count of the current frame is related to second information; the second information is at least one of the following information: width of the current frame, width of the current frame The height of the current frame, the bit depth of the current frame, the coding format of the current frame or the image compression ratio of the current frame.
  • the code rate control module 1220 is further configured to: update the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold The QP of the n2 tiles; wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame, and the target frame is the current The previous x frame and/or the subsequent y frame of the frame, x and y are positive integers greater than or equal to 1, and n2 is a positive integer greater than or equal to 2.
  • the code rate control module 1220 is further configured to: if the second difference is a positive value, combine the first parameter in the QP used to calculate the n1 tiles with The difference of the offset parameter is used as the updated first parameter; the QP of the n2 tiles is calculated according to the updated first parameter; or, if the second difference is negative, it will be used to calculate the The sum of the first parameter and the offset parameter in the QP of the n1 tiles is used as the updated first parameter; and the QP of the n2 tiles is calculated according to the updated first parameter.
  • the complexity calculation module 1210 is further configured to: separately obtain an image of a component of each tile in the n1 tiles Complexity information, the component includes the brightness component and/or at least one chrominance component of the current frame; the code rate control module 1220 is further configured to: update according to the image complexity information of at least one component in the component QP of the n1 tiles.
  • the complexity calculation module 1210 is further configured to: obtain multiple transformation parameters of each tile; select a parameter from the multiple transformation parameters as the The image complexity information of the tile.
  • the code rate control module 1220 is further configured to: if the updated QP of the n1 tiles is smaller than a third threshold, use the third threshold as the updated The QP of the n1 tiles; or, if the updated QP of the n1 tiles is greater than a fourth threshold, the fourth threshold is used as the updated QP of the n1 tiles; wherein , the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  • the encoding device 1200 is applied in the JPEG XR encoding format.
  • FIG. 14 is a schematic structural diagram of an encoding device 1400 provided by another embodiment of the present application.
  • the encoding device 1400 may include a complexity calculation module 1410 and a code rate control module 1420 .
  • the complexity calculation module 1410 is configured to obtain image complexity information of the current frame, where the image complexity information includes transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame.
  • PCT processing image kernel transformation processing
  • a code rate control module 1420 configured to determine an initial quantization parameter (initial QP) of the current frame according to the image complexity information.
  • the code rate control module 1420 is also configured to: update the initial QP of the target frame according to the initial QP of the current frame, the target frame is the previous x frame and/or the next y frame of the current frame, and x and y are A positive integer greater than or equal to 1.
  • the complexity calculation module 460 and the code rate control module 470 in FIG. 13b above can be the complexity calculation module 1210 and the code rate control module 1220 in the embodiment of the present application, which can realize the update of the QP of the target frame in the embodiment of the present application .
  • the code rate control module 1420 is further configured to: update according to the ratio of the absolute value of the second difference to the target number of bytes of the current frame and the size of the second threshold The initial QP in the target frame; wherein, the second difference is the difference between the target byte count of the current frame and the actual coded byte count of the current frame.
  • the code rate control module 1420 is further configured to: if the second difference is a positive value, combine the first parameter used to calculate the initial QP of the current frame with the offset The difference of the shift parameter is used as the updated first parameter; the initial QP of the target frame is calculated according to the updated first parameter; or, if the second difference is negative, it will be used to calculate the initial QP of the previous frame The sum of the first parameter in the QP and the offset parameter is used as the updated first parameter; and the initial QP of the target frame is calculated according to the updated first parameter.
  • the complexity calculation module 1410 is further configured to: respectively acquire image complexity information of components of the current frame, the components include The luma component and/or at least one chrominance component of the current frame; the code rate control module 1420 is further configured to: update the initial QP of the target frame according to the image complexity information of at least one component in the component.
  • the complexity calculation module 1410 is further configured to: acquire multiple transformation parameters of the current frame; select a parameter from the multiple transformation parameters as the image of the current frame complexity information.
  • the code rate control module 1420 is further configured to: if the updated initial QP of the target frame is smaller than a third threshold, use the third threshold as the updated The initial QP of the target frame; or, if the updated initial QP of the target frame is greater than a fourth threshold, the fourth threshold is used as the updated initial QP of the target frame; wherein, The third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  • the encoding device 1400 is applied in the JPEG XR encoding format.
  • FIG. 15 provides an encoding device 1500 according to yet another embodiment of the present application, and the encoding device 1500 may include a processor 1510 .
  • the processor 1510 is configured to: acquire image complexity information of each of the n1 tiles in the current frame, where the image complexity information includes image kernel transformation processing of pixel values of each tile ( PCT processing), n1 is a positive integer greater than or equal to 2; update the quantization parameters (QP) of the n1 tiles according to the image complexity information.
  • the processor 1510 is further configured to: calculate the cumulative value of the target number of bytes of the i-th tile among the n1 tiles according to the image complexity information, i is a positive integer less than or equal to n; the QP of the i-th tile is updated according to the cumulative value of the target number of bytes of the i-th tile.
  • the processor 1510 is further configured to: update the QP of the ith tile according to an absolute value of a first difference and a first threshold, where the first difference is The difference between the cumulative value of the target number of bytes of the ith tile and the cumulative value of the actual coded number of bytes of the ith tile.
  • the processor 1510 is further configured to: if the first difference is a positive value, use the difference between the QP of the i-1th tile and the first offset QP as The QP of the ith tile; if the first difference is a negative value, the sum of the QP of the i-1th tile and the first offset QP is used as the ith tile QP of a slice; wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold.
  • the target number of bytes of the i-th tile is related to first information; the first information is at least one of the following information: the target number of bytes of the current frame , the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
  • the target byte count of the current frame is related to second information; the second information is at least one of the following information: width of the current frame, width of the current frame The height of the current frame, the bit depth of the current frame, the coding format of the current frame or the image compression ratio of the current frame.
  • the processor 1510 is further configured to: update the number of bytes in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold.
  • QP of n2 tiles wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame, and the target frame is the number of bytes of the current frame.
  • the processor 1510 is further configured to: if the second difference is a positive value, the first parameter and the offset used to calculate the QP of the n1 tiles The difference between the parameters is used as the updated first parameter; the QP of the n2 tiles is calculated according to the updated first parameter; or, if the second difference is negative, it will be used to calculate the n1 tiles The sum of the first parameter in the QP of the tile and the offset parameter is used as the updated first parameter; and the QP of the n2 tiles is calculated according to the updated first parameter.
  • the processor 1510 is further configured to: respectively obtain the image complexity of the components of each tile in the n1 tiles Information, the component includes the luma component and/or at least one chrominance component of the current frame; the QP of the n1 tiles is updated according to the image complexity information of at least one component in the component.
  • the processor 1510 is further configured to: acquire multiple transformation parameters of each tile; select one parameter from the multiple transformation parameters as the parameter for each tile image complexity information.
  • the processor 1510 is further configured to: if the updated QP of the n1 tiles is smaller than a third threshold, use the third threshold as the updated The QP of n1 tiles; or, if the updated QP of the n1 tiles is greater than the fourth threshold, the fourth threshold is used as the updated QP of the n1 tiles; wherein, The third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  • the encoding device 1500 is applied in the JPEG XR encoding format.
  • the encoding device 1500 may further include a memory 1520 .
  • the processor 1510 can invoke and run a computer program from the memory 1520, so as to implement the method in the embodiment of the present application.
  • the memory 1520 may be an independent device independent of the processor 1510 , or may be integrated in the processor 1510 .
  • the encoding device 1500 may further include a transceiver 1530 .
  • the transceiver 1530 may be an independent device independent of the processor 1510 , or may be integrated in the processor 1510 .
  • the encoding device can be, for example, an encoder, a terminal (including but not limited to mobile phones, cameras, drones, etc.), and the encoding device can implement the corresponding process in the encoding method 600 of the embodiment of the present application, for the sake of brevity , which will not be repeated here.
  • FIG. 16 provides an encoding device 1600 according to yet another embodiment of the present application, and the encoding device 1600 may include a processor 1610 .
  • Processor 1610 configured to: acquire image complexity information of the current frame, where the image complexity information includes transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame;
  • the complexity information determines the initial quantization parameter (initial QP) of the current frame; updates the initial QP of the target frame according to the initial QP of the current frame, and the target frame is the first x frame and/or the last y of the current frame frame, x and y are positive integers greater than or equal to 1.
  • the processor 1610 is further configured to: update the The initial QP in the target frame; wherein, the second difference is the difference between the target byte count of the current frame and the actual coded byte count of the current frame.
  • the processor 1610 is further configured to: if the second difference is a positive value, the first parameter and the offset parameter used to calculate the initial QP of the current frame The difference is used as the updated first parameter; the initial QP of the target frame is calculated according to the updated first parameter; or, if the second difference is negative, it will be used to calculate the initial QP of the previous frame The sum of the first parameter and the offset parameter is used as the updated first parameter; and the initial QP of the target frame is calculated according to the updated first parameter.
  • the processor 1610 is further configured to: respectively acquire image complexity information of components of the current frame, the components including the A luma component and/or at least one chrominance component of the current frame; updating the initial QP of the target frame according to image complexity information of at least one component in the components.
  • the processor 1610 is further configured to: acquire multiple transformation parameters of the current frame; select one parameter from the multiple transformation parameters as the image complexity of the current frame information.
  • the processor 1610 is further configured to: if the updated initial QP of the target frame is smaller than a third threshold, use the third threshold as the updated target frame The initial QP of the frame; or, if the updated initial QP of the target frame is greater than a fourth threshold, the fourth threshold is used as the updated initial QP of the target frame; wherein, the The third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  • the encoding device 1600 is applied in a JPEG XR encoding format.
  • the encoding device 1600 may further include a memory 1620 .
  • the processor 1610 can invoke and run a computer program from the memory 1620, so as to implement the method in the embodiment of the present application.
  • the memory 1620 may be an independent device independent of the processor 1610 , or may be integrated in the processor 1610 .
  • the encoding device 1600 may further include a transceiver 1630 .
  • the transceiver 1630 may be an independent device independent of the processor 1610 , or may be integrated in the processor 1610 .
  • the encoding device can be, for example, an encoder, a terminal (including but not limited to mobile phones, cameras, drones, etc.), and the encoding device can implement the corresponding process in the encoding method 1100 of the embodiment of the present application, for the sake of brevity , which will not be repeated here.
  • FIG. 17 is a schematic structural diagram of a chip according to an embodiment of the present application.
  • the chip 1700 shown in FIG. 17 includes a processor 1710, and the processor 1710 can call and run a computer program from a memory, so as to implement the method in the embodiment of the present application.
  • the chip 1700 may further include a memory 1720 .
  • the processor 1710 can invoke and run a computer program from the memory 1720, so as to implement the method in the embodiment of the present application.
  • the memory 1720 may be a separate device independent of the processor 1710 , or may be integrated in the processor 1710 .
  • the chip 1700 may also include an input interface 1730 .
  • the processor 1710 can control the input interface 1730 to communicate with other devices or chips, specifically, can obtain information or data sent by other devices or chips.
  • the chip 1700 may also include an output interface 1740 .
  • the processor 1710 can control the output interface 1740 to communicate with other devices or chips, specifically, can output information or data to other devices or chips.
  • the chip mentioned in the embodiment of the present application may also be called a system-on-chip, a system-on-chip, a system-on-a-chip, or a system-on-a-chip.
  • the processor in the embodiment of the present application may be an integrated circuit image processing system, which has a signal processing capability.
  • each step of the above-mentioned method embodiments may be completed by an integrated logic circuit of hardware in a processor or instructions in the form of software.
  • the above-mentioned processor can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), an off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA) or other available Program logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.
  • the memory in the embodiments of the present application may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories.
  • the non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electronically programmable Erase Programmable Read-Only Memory (Electrically EPROM, EEPROM) or Flash.
  • the volatile memory can be Random Access Memory (RAM), which acts as external cache memory.
  • RAM Static Random Access Memory
  • SRAM Static Random Access Memory
  • DRAM Dynamic Random Access Memory
  • Synchronous Dynamic Random Access Memory Synchronous Dynamic Random Access Memory
  • SDRAM double data rate synchronous dynamic random access memory
  • Double Data Rate SDRAM, DDR SDRAM enhanced synchronous dynamic random access memory
  • Enhanced SDRAM, ESDRAM synchronous connection dynamic random access memory
  • Synchlink DRAM, SLDRAM Direct Memory Bus Random Access Memory
  • Direct Rambus RAM Direct Rambus RAM
  • the memory in the embodiment of the present application may also be a static random access memory (static RAM, SRAM), a dynamic random access memory (dynamic RAM, DRAM), Synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection Dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM), etc. That is, the memory in the embodiments of the present application is intended to include, but not be limited to, these and any other suitable types of memory.
  • the memory in the embodiments of the present application may provide instructions and data to the processor.
  • a portion of the memory may also include non-volatile random access memory.
  • the memory may also store device type information.
  • the processor may be used to execute instructions stored in the memory, and when the processor executes the instructions, the processor may execute various steps corresponding to the terminal device in the foregoing method embodiments.
  • each step of the above method can be completed by an integrated logic circuit of the hardware in the processor or an instruction in the form of software.
  • the steps of the methods disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory, and the processor executes the instructions in the memory to complete the steps of the above method in combination with its hardware. To avoid repetition, no detailed description is given here.
  • the pixels in the image may be located in different rows and/or columns, wherein the length of A may correspond to the number of pixels in the same row included in A, and the height of A may be Corresponding to the number of pixels in the same column included in A.
  • the length and height of A may also be referred to as width and depth of A, respectively, which is not limited in this embodiment of the present application.
  • distributed of distance from the boundary of A may refer to being at least one pixel apart from the boundary of A, and may also be referred to as “not adjacent to the boundary of A” or “not located at the boundary of A”.
  • Boundary which is not limited in this embodiment of the present application, where A may be an image, a rectangular area, or a sub-image, and so on.
  • the embodiment of the present application also provides a computer-readable storage medium for storing computer programs.
  • the computer-readable storage medium can be applied to the coding device in the embodiment of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the coding device in the methods of the embodiment of the present application.
  • the computer program enables the computer to execute the corresponding processes implemented by the coding device in the methods of the embodiment of the present application.
  • the embodiment of the present application also provides a computer program product, including computer program instructions.
  • the computer program product can be applied to the encoding device in the embodiment of the present application, and the computer program instructions cause the computer to execute the corresponding processes implemented by the encoding device in the methods of the embodiment of the present application.
  • the Let me repeat for the sake of brevity, the Let me repeat.
  • the embodiment of the present application also provides a computer program.
  • the computer program can be applied to the encoding device in the embodiment of the present application.
  • the computer program executes the corresponding processes implemented by the encoding device in the methods of the embodiment of the present application.
  • the computer program executes the corresponding processes implemented by the encoding device in the methods of the embodiment of the present application.
  • the disclosed systems, devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present application.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of software products, and the computer software products are stored in a storage medium
  • a computer device which may be a personal computer, a server, or a network device, etc.
  • the aforementioned storage medium includes: various media capable of storing program codes such as U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The present application provides an encoding method and an encoding device. The method comprises: obtaining image complexity information of each of n1 tiles in a current frame, the image complexity information comprising a transform coefficient obtained after a pixel value of each tile is subjected to photo core transform processing, and n1 being a positive integer greater than or equal to 2; and updating Quantization Parameters (QPs) of the n1 tiles according to the image complexity information. By updating or calculating, according to the image complexity information, QPs of respective tiles comprised in an image to be encoded, the solution provided in the present application can ensure that encoding efficiency is improved and hardware resource consumption is reduced without sacrificing code rate control accuracy, and can also ensure the flexibility of the QPs to avoid the problem of an uncontrollable output code rate.

Description

编码方法和编码装置Encoding method and encoding device 技术领域technical field
本申请涉及编解码领域,并且更为具体地,涉及一种编码方法和编码装置。The present application relates to the field of encoding and decoding, and more specifically, relates to an encoding method and an encoding device.
背景技术Background technique
联合摄影专家组扩展范围(Joint Photographic Experts Group Extended Range,JPEG XR)是一种连续色调静止图像压缩算法和文件格式。Joint Photographic Experts Group Extended Range (JPEG XR) is a continuous-tone still image compression algorithm and file format.
由于JPEG XR编码器压缩图像的码率最终大小取决于量化程度,而量化程度取决于指定的量化参数(Quantization Parameter,QP)。目前针对JPEG XR的码率控制算法中,有一些算法需要多次编码,该做法会带来额外的复杂度导致编码延迟,从而影响编码器的运行速度,并且不利于实现实时编码。另外一些算法则使用固定量化参数的办法,然而使用固定量化参数会导致输出码率不可控的问题。Since the final bit rate of the image compressed by the JPEG XR encoder depends on the degree of quantization, the degree of quantization depends on the specified quantization parameter (Quantization Parameter, QP). Among the current rate control algorithms for JPEG XR, some algorithms require multiple encodings. This approach will bring additional complexity and lead to encoding delay, which will affect the running speed of the encoder and is not conducive to real-time encoding. Other algorithms use fixed quantization parameters. However, using fixed quantization parameters will lead to uncontrollable output code rate.
因此,如何提高编码效率以及保证QP的灵活性是需要解决的问题。Therefore, how to improve coding efficiency and ensure the flexibility of QP is a problem to be solved.
发明内容Contents of the invention
本申请实施例提供编码方法和编码装置,可以保证在不牺牲码率控制精度的前提下,提高编码效率以及降低硬件资源消耗,同时可以保证量化参数的灵活性以避免输出码率不可控的问题。The embodiment of the present application provides a coding method and a coding device, which can ensure the improvement of coding efficiency and reduce the consumption of hardware resources without sacrificing the accuracy of code rate control, and at the same time can ensure the flexibility of quantization parameters to avoid the problem of uncontrollable output code rate .
第一方面,提供了一种编码方法,包括:获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换处理(PCT处理)后得到的变换系数,n1为大于或等于2的正整数;根据所述图像复杂度信息更新所述n1个瓦片的量化参数。In the first aspect, an encoding method is provided, including: acquiring image complexity information of each of the n1 tiles in the current frame, the image complexity information including the pixel value of each tile For the transformation coefficients obtained after image kernel transformation processing (PCT processing), n1 is a positive integer greater than or equal to 2; the quantization parameters of the n1 tiles are updated according to the image complexity information.
本申请实施例提供的方案,由于图像复杂度信息与当前帧中的瓦片的变换系数有关,且该变换系数是经过对瓦片的像素值进行PCT处理后的得到的系数,通过根据图像复杂度信息更新或计算待编码图像所包括的各个瓦片的QP,可以保证在不牺牲码率控制精度的前提下,提高编码效率以及降低硬件资源消耗,同时可以保证量化参数的灵活性以避免输出码率不可控的问 题。In the solution provided by the embodiment of the present application, since the image complexity information is related to the transformation coefficient of the tile in the current frame, and the transformation coefficient is the coefficient obtained after performing PCT processing on the pixel value of the tile, by The degree information is updated or the QP of each tile included in the image to be encoded can be guaranteed to improve the encoding efficiency and reduce the consumption of hardware resources without sacrificing the bit rate control accuracy, and at the same time, it can ensure the flexibility of quantization parameters to avoid output The code rate is uncontrollable.
第二方面,提供了一种编码方法,包括:获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数;根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP);根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。In a second aspect, an encoding method is provided, including: obtaining image complexity information of the current frame, the image complexity information including transformation obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame coefficient; determine the initial quantization parameter (initial QP) of the current frame according to the image complexity information; update the initial QP of the target frame according to the initial QP of the current frame, and the target frame is the first x of the current frame frame and/or next y frames, where x and y are positive integers greater than or equal to 1.
本申请实施例提供的方案,由于图像复杂度信息与当前帧的变换系数有关,且该变换系数是经过对当前帧中的像素值进行PCT处理后的得到的系数,通过根据图像复杂度信息确定当前帧的初始QP并根据该初始QP更新目标帧的初始QP,可以保证在不牺牲码率控制精度的前提下,提高编码效率以及降低硬件资源消耗,同时可以保证量化参数的灵活性以避免输出码率不可控的问题。In the solution provided by the embodiment of the present application, since the image complexity information is related to the transformation coefficient of the current frame, and the transformation coefficient is the coefficient obtained after performing PCT processing on the pixel values in the current frame, it is determined according to the image complexity information The initial QP of the current frame and the initial QP of the target frame are updated according to the initial QP, which can ensure that the encoding efficiency is improved and the hardware resource consumption is reduced without sacrificing the accuracy of the code rate control, and at the same time, the flexibility of quantization parameters can be guaranteed to avoid output The code rate is uncontrollable.
第三方面,提供了一种编码装置,包括:复杂度计算模块,用于获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换处理(PCT处理)后得到的变换系数,n1为大于或等于2的正整数;码率控制模块,用于根据所述图像复杂度信息更新所述n1个瓦片的量化参数。In a third aspect, an encoding device is provided, including: a complexity calculation module, configured to obtain image complexity information of each of the n1 tiles in the current frame, the image complexity information including the The transformation coefficient obtained after the pixel value of each tile undergoes image kernel transformation processing (PCT processing), n1 is a positive integer greater than or equal to 2; the code rate control module is used to update the n1 according to the image complexity information Quantization parameters for tiles.
第三方面的有益效果可以参考第一方面的有益效果,在此不再赘述。For the beneficial effects of the third aspect, reference may be made to the beneficial effects of the first aspect, which will not be repeated here.
第四方面,提供了一种编码装置,包括:复杂度计算模块,用于获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数;码率控制模块,用于根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP);所述码率控制模块还用于:根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。In a fourth aspect, an encoding device is provided, including: a complexity calculation module, configured to obtain image complexity information of a current frame, where the image complexity information includes performing image kernel transformation processing on pixel values of the current frame ( Transform coefficients obtained after PCT processing); a code rate control module, configured to determine the initial quantization parameter (initial QP) of the current frame according to the image complexity information; the code rate control module is also used to: according to the described image complexity information The initial QP of the current frame updates the initial QP of the target frame, where the target frame is the previous x frames and/or the last y frames of the current frame, and x and y are positive integers greater than or equal to 1.
第四方面的有益效果可以参考第二方面的有益效果,在此不再赘述。For the beneficial effects of the fourth aspect, reference may be made to the beneficial effects of the second aspect, which will not be repeated here.
第五方面,提供了一种编码装置,包括:处理器,用于:获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换处理(PCT处理)后得到的变换系数,n1为大于或等于2的正整数;根据所述图像复杂度信息更新所述n1个 瓦片的量化参数。In a fifth aspect, an encoding device is provided, including: a processor, configured to: acquire image complexity information of each of the n1 tiles in the current frame, where the image complexity information includes The pixel values of a tile are transformed coefficients obtained after image kernel transformation processing (PCT processing), n1 is a positive integer greater than or equal to 2; the quantization parameters of the n1 tiles are updated according to the image complexity information.
第五方面的有益效果可以参考第一方面的有益效果,在此不再赘述。For the beneficial effects of the fifth aspect, reference may be made to the beneficial effects of the first aspect, which will not be repeated here.
第六方面,提供了一种编码装置,包括:处理器,用于:获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数;根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP);根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。In a sixth aspect, an encoding device is provided, including: a processor, configured to: obtain image complexity information of a current frame, where the image complexity information includes performing image kernel transformation processing (PCT) on pixel values of the current frame transform coefficient obtained after processing); determine the initial quantization parameter (initial QP) of the current frame according to the image complexity information; update the initial QP of the target frame according to the initial QP of the current frame, and the target frame is the The previous x frame and/or the next y frame of the current frame, where x and y are positive integers greater than or equal to 1.
第六方面的有益效果可以参考第二方面的有益效果,在此不再赘述。For the beneficial effects of the sixth aspect, reference may be made to the beneficial effects of the second aspect, which will not be repeated here.
第七方面,提供了一种编码装置,包括处理器和存储器。该存储器用于存储计算机程序,该处理器用于调用并运行该存储器中存储的计算机程序,执行上述第一方面或第二方面或其各实现方式中的方法。In a seventh aspect, an encoding device is provided, including a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the first aspect or the second aspect or each implementation thereof.
第八方面,提供一种芯片,用于实现上述第一方面或第二方面或其各实现方式中的方法。In an eighth aspect, a chip is provided for implementing the method in the above first aspect or the second aspect or each implementation manner thereof.
具体地,该芯片包括:处理器,用于从存储器中调用并运行计算机程序,使得安装有该芯片的设备执行如上述第一方面或第二方面或其各实现方式中的方法。Specifically, the chip includes: a processor, configured to call and run a computer program from the memory, so that the device installed with the chip executes the method in the above first aspect or the second aspect or each implementation thereof.
第九方面,提供了一种计算机可读存储介质,用于存储计算机程序,该计算机程序包括用于执行第一方面至第二方面或第一方面至第二方面的任意可能的实现方式中的方法的指令。A ninth aspect provides a computer-readable storage medium for storing a computer program, and the computer program includes any possible implementation manners for executing the first aspect to the second aspect or the first aspect to the second aspect. method directive.
第十方面,提供了一种计算机程序产品,包括计算机程序指令,该计算机程序指令使得计算机执行上述第一方面至第二方面或第一方面至第二方面的各实现方式中的方法。In a tenth aspect, a computer program product is provided, including computer program instructions, the computer program instructions causing a computer to execute the methods in the implementation manners of the first aspect to the second aspect or the first aspect to the second aspect.
附图说明Description of drawings
下面将对实施例使用的附图作简单地介绍。The drawings used in the embodiments will be briefly introduced below.
图1是应用本申请实施例的技术方案的架构图。FIG. 1 is a structural diagram of a technical solution applying an embodiment of the present application.
图2是根据本申请实施例的视频编码框架2示意图。Fig. 2 is a schematic diagram of a video coding framework 2 according to an embodiment of the present application.
图3为本申请实施例提供的JPEG XR处理图像时将图像按从大到小以下五个层次进行处理的示意性图。Fig. 3 is a schematic diagram of JPEG XR processing images according to five levels from large to small when processing images provided by the embodiment of the present application.
图4为本申请一实施例提供的JPEG XR编码器的示意性结构图。Fig. 4 is a schematic structural diagram of a JPEG XR encoder provided by an embodiment of the present application.
图5为本申请实施例提供的一种基于宏块形成变换系数的示意图。FIG. 5 is a schematic diagram of forming transform coefficients based on macroblocks according to an embodiment of the present application.
图6为本申请一实施例提供的一种编码方法的示意图。Fig. 6 is a schematic diagram of an encoding method provided by an embodiment of the present application.
图7a为本申请一实施例提供的一种对待编码图像划分的示意性图。Fig. 7a is a schematic diagram of division of an image to be coded provided by an embodiment of the present application.
图7b为本申请另一实施例提供的一种对待编码图像划分的示意性图。Fig. 7b is a schematic diagram of division of an image to be coded according to another embodiment of the present application.
图7c为本申请又一实施例提供的一种对待编码图像划分的示意性图。Fig. 7c is a schematic diagram of division of an image to be coded according to yet another embodiment of the present application.
图7d为本申请再一实施例提供的一种对待编码图像划分的示意性图。Fig. 7d is a schematic diagram of division of an image to be encoded according to yet another embodiment of the present application.
图7e为本申请再一实施例提供的一种对待编码图像划分的示意性图。Fig. 7e is a schematic diagram of division of an image to be encoded according to yet another embodiment of the present application.
图7f为本申请再一实施例提供的一种对待编码图像划分的示意性图。Fig. 7f is a schematic diagram of division of an image to be coded according to yet another embodiment of the present application.
图8为本申请实施例提供的一种实现的矩阵位置转换功能的示意性图。FIG. 8 is a schematic diagram of an implemented matrix position conversion function provided by an embodiment of the present application.
图9为本申请实施例提供的一种块的映射关系的示意图。FIG. 9 is a schematic diagram of a mapping relationship of blocks provided by an embodiment of the present application.
图10为本申请另一实施例提供的一种编码方法的示意图。FIG. 10 is a schematic diagram of an encoding method provided by another embodiment of the present application.
图11为本申请又一实施例提供的一种编码方法的示意图。Fig. 11 is a schematic diagram of an encoding method provided by another embodiment of the present application.
图12为本申请一实施例提供的一种编码装置的示意性结构图。Fig. 12 is a schematic structural diagram of an encoding device provided by an embodiment of the present application.
图13a为本申请另一实施例提供的JPEG XR编码器的示意性结构图。Fig. 13a is a schematic structural diagram of a JPEG XR encoder provided by another embodiment of the present application.
图13b为本申请又一实施例提供的JPEG XR编码器的示意性结构图。Fig. 13b is a schematic structural diagram of a JPEG XR encoder provided by another embodiment of the present application.
图14为本申请另一实施例提供的一种编码装置的示意性结构图。Fig. 14 is a schematic structural diagram of an encoding device provided by another embodiment of the present application.
图15为本申请又一实施例提供的一种编码装置的示意性结构图。FIG. 15 is a schematic structural diagram of an encoding device provided by another embodiment of the present application.
图16为本申请再一实施例提供的一种编码装置的示意性结构图。FIG. 16 is a schematic structural diagram of an encoding device provided in yet another embodiment of the present application.
图17本申请实施例提供的芯片的示意性结构图。FIG. 17 is a schematic structural diagram of a chip provided by an embodiment of the present application.
具体实施方式Detailed ways
下面对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application are described below.
除非另有说明,本申请实施例所使用的所有技术和科学术语与本申请的技术领域的技术人员通常理解的含义相同。本申请中所使用的术语只是为了描述具体的实施例的目的,不是旨在限制本申请的范围。Unless otherwise specified, all technical and scientific terms used in the embodiments of the present application have the same meaning as commonly understood by those skilled in the technical field of the present application. The terms used in the present application are only for the purpose of describing specific embodiments, and are not intended to limit the scope of the present application.
图1是应用本申请实施例的技术方案的架构图。FIG. 1 is a structural diagram of a technical solution applying an embodiment of the present application.
如图1所示,系统100可以接收待处理数据102,对待处理数据102进行处理,产生处理后的数据108。例如,系统100可以接收待编码数据,对待编码数据进行编码以产生编码后的数据,或者,系统100可以接收待解码数据,对待解码数据进行解码以产生解码后的数据。在一些实施例中,系统100中的部件可以由一个或多个处理器实现,该处理器可以是计算设备中的 处理器,也可以是移动设备(例如无人机)中的处理器。该处理器可以为任意种类的处理器,本发明实施例对此不做限定。在一些可能的设计中,该处理器可以包括编码器、解码器或编解码器等。系统100中还可以包括一个或多个存储器。该存储器可用于存储指令和数据,例如,实现本发明实施例的技术方案的计算机可执行指令、待处理数据102、处理后的数据108等。该存储器可以为任意种类的存储器,本发明实施例对此也不做限定。As shown in FIG. 1 , the system 100 may receive data to be processed 102 , process the data to be processed 102 , and generate processed data 108 . For example, the system 100 may receive data to be encoded and encode the data to be encoded to generate encoded data, or the system 100 may receive data to be decoded and decode the data to be decoded to generate decoded data. In some embodiments, the components in system 100 may be implemented by one or more processors, which may be processors in computing devices, or processors in mobile devices (such as drones). The processor may be any type of processor, which is not limited in this embodiment of the present invention. In some possible designs, the processor may include an encoder, decoder, or codec, among others. One or more memories may also be included in system 100 . The memory may be used to store instructions and data, for example, computer-executable instructions for implementing the technical solutions of the embodiments of the present invention, data to be processed 102, processed data 108, and the like. The storage may be any type of storage, which is not limited in this embodiment of the present invention.
待编码数据可以包括文本、图像、图形对象、动画序列、音频、视频、或者任何需要编码的其他数据。在一些情况下,待编码数据可以包括来自传感器的传感数据,该传感器可以为视觉传感器(例如,相机、红外传感器),麦克风、近场传感器(例如,超声波传感器、雷达)、位置传感器、温度传感器、触摸传感器等。在一些情况下,待编码数据可以包括来自用户的信息,例如,生物信息,该生物信息可以包括面部特征、指纹扫描、视网膜扫描、嗓音记录、DNA采样等。Data to be encoded may include text, images, graphic objects, animation sequences, audio, video, or any other data that requires encoding. In some cases, the data to be encoded may include sensory data from sensors such as vision sensors (e.g., cameras, infrared sensors), microphones, near-field sensors (e.g., ultrasonic sensors, radar), position sensors, temperature sensors, touch sensors, etc. In some cases, the data to be encoded may include information from the user, for example, biometric information, which may include facial features, fingerprint scans, retinal scans, voice recordings, DNA samples, and the like.
图2是根据本申请实施例的视频编码框架2示意图。如图2所示,在接收待编码视频后,从待编码视频的第一帧开始,依次对待编码视频中的每一帧进行编码。其中,当前编码帧主要经过:预测(Prediction)、变换(Transform)、量化(Quantization)和熵编码(Entropy Coding)等处理,最终输出当前编码帧的码流。对应的,解码过程通常是按照上述过程的逆过程对接收到的码流进行解码,以恢复出解码前的视频帧信息。Fig. 2 is a schematic diagram of a video coding framework 2 according to an embodiment of the present application. As shown in FIG. 2 , after the video to be encoded is received, starting from the first frame of the video to be encoded, each frame in the video to be encoded is sequentially encoded. Among them, the current coded frame mainly undergoes: Prediction, Transform, Quantization and Entropy Coding, etc., and finally outputs the code stream of the current coded frame. Correspondingly, the decoding process usually decodes the received code stream according to the reverse process of the above process, so as to recover the video frame information before decoding.
具体地,如图2所示,所述视频编码框架2中包括一个编码控制模块201,用于进行编码过程中的决策控制动作,以及参数的选择。例如,如图2所示,编码控制模块201控制变换、量化、反量化、反变换的中用到的参数,控制进行帧内模式或者帧间模式的选择,以及运动估计和滤波的参数控制,且编码控制模块201的控制参数也将输入至熵编码模块中,进行编码形成编码码流中的一部分。Specifically, as shown in FIG. 2 , the video encoding framework 2 includes an encoding control module 201 for performing decision-making control actions and parameter selection during the encoding process. For example, as shown in FIG. 2, the encoding control module 201 controls parameters used in transformation, quantization, inverse quantization, and inverse transformation, controls the selection of intra-frame mode or inter-frame mode, and parameter control of motion estimation and filtering, And the control parameters of the encoding control module 201 will also be input into the entropy encoding module, and encoded to form a part of the encoded code stream.
对当前编码帧开始编码时,对编码帧进行划分202处理,具体地,首先对其进行条带(slice)划分,再进行块划分。可选地,在一个示例中,编码帧划分为多个互不重叠的最大的CTU,各CTU还可以分别按四叉树、或二叉树、或三叉树的方式迭代划分为一系列更小的编码单元(Coding Unit,CU),一些示例中,CU还可以包含与之相关联的预测单元(Prediction Unit,PU)和变换单元(Transform Unit,TU),其中PU为预测的基本单元,TU 为变换和量化的基本单元。一些示例中,PU和TU分别是在CU的基础上划分成一个或多个块得到的,其中一个PU包含多个预测块(Prediction Block,PB)以及相关语法元素。一些示例中,PU和TU可以是相同的,或者,是由CU通过不同的划分方法得到的。一些示例中,CU、PU和TU中的至少两种是相同的,例如,不区分CU、PU和TU,全部是以CU为单位进行预测、量化和变换。为方便描述,下文中将CTU、CU或者其它形成的数据单元均称为编码块。When coding the current coded frame starts, the coded frame is divided 202 , specifically, it is first divided into slices and then divided into blocks. Optionally, in an example, the coded frame is divided into a plurality of non-overlapping largest CTUs, and each CTU can also be iteratively divided into a series of smaller coded Unit (Coding Unit, CU), in some examples, CU can also contain associated prediction unit (Prediction Unit, PU) and transformation unit (Transform Unit, TU), where PU is the basic unit of prediction, and TU is transformation and the basic unit of quantification. In some examples, a PU and a TU are respectively obtained by dividing a CU into one or more blocks, and one PU includes multiple prediction blocks (Prediction Block, PB) and related syntax elements. In some examples, the PU and the TU may be the same, or they may be obtained by dividing the CU through different methods. In some examples, at least two of CU, PU, and TU are the same. For example, CU, PU, and TU are not distinguished, and prediction, quantization, and transformation are all performed in units of CU. For the convenience of description, hereinafter, a CTU, a CU or other formed data units are all referred to as coding blocks.
应理解,在本申请实施例中,视频编码针对的数据单元可以为帧,条带,编码树单元,编码单元,编码块或以上任一种的组。在不同的实施例中,数据单元的大小可以变化。It should be understood that, in this embodiment of the present application, the data unit targeted by video encoding may be a frame, a slice, a coding tree unit, a coding unit, a coding block, or a group of any of the above. In different embodiments, the size of the data unit may vary.
具体地,如图2所示,编码帧划分为多个编码块后,进行预测过程,用于去除当前编码帧的空域和时域冗余信息。当前比较常用的预测编码方法包括帧内预测和帧间预测两种方法。帧内预测仅利用本帧图像中己重建的信息对当前编码块进行预测,而帧间预测会利用到之前已经重建过的其它帧图像(也被称作参考帧)中的信息对当前编码块进行预测。具体地,在本申请实施例中,编码控制模块201用于决策选择帧内预测或者帧间预测。Specifically, as shown in FIG. 2 , after the coded frame is divided into multiple coded blocks, a prediction process is performed to remove redundant information in the spatial domain and time domain of the current coded frame. Currently, commonly used predictive coding methods include intra-frame prediction and inter-frame prediction. Intra-frame prediction only uses the reconstructed information in this frame image to predict the current coding block, while inter-frame prediction uses the information in other frame images (also called reference frames) that have been reconstructed before to predict the current coding block. Make predictions. Specifically, in the embodiment of the present application, the encoding control module 201 is used to decide to select intra prediction or inter prediction.
当选择帧内预测模式时,帧内预测203的过程包括获取当前编码块周围已编码相邻块的重建块作为参考块,基于该参考块的像素值,采用预测模式方法计算预测值生成预测块,将当前编码块与预测块的相应像素值相减得到当前编码块的残差,当前编码块的残差经过变换204、量化205以及熵编码210后形成当前编码块的码流。进一步的,当前编码帧的全部编码块经过上述编码过程后,形成编码帧的编码码流中的一部分。此外,帧内预测203中产生的控制和参考数据也经过熵编码210编码,形成编码码流中的一部分。When the intra-frame prediction mode is selected, the process of intra-frame prediction 203 includes obtaining the reconstructed block of the coded adjacent block around the current coded block as a reference block, based on the pixel value of the reference block, using the prediction mode method to calculate the prediction value to generate a prediction block , subtracting the corresponding pixel values of the current coding block and the prediction block to obtain the residual of the current coding block, and the residual of the current coding block undergoes transformation 204 , quantization 205 and entropy coding 210 to form a code stream of the current coding block. Further, all the coded blocks of the current coded frame form a part of the coded code stream of the coded frame after undergoing the above coded process. In addition, the control and reference data generated in intra-frame prediction 203 are also encoded by entropy encoding 210 to form a part of the encoded code stream.
具体地,变换204用于去除图像块的残差的相关性,以便提高编码效率。对于当前编码块残差数据的变换通常采用二维离散余弦变换(Discrete Cosine Transform,DCT)变换和二维离散正弦变换(Discrete Sine Transform,DST)变换,例如在编码端将编码块的残差信息分别与一个N×M的变换矩阵及其转置矩阵相乘,相乘之后得到当前编码块的变换系数。Specifically, the transform 204 is used to remove the correlation of the residual of the image block, so as to improve the coding efficiency. For the transformation of the residual data of the current coding block, two-dimensional discrete cosine transform (Discrete Cosine Transform, DCT) transformation and two-dimensional discrete sine transform (Discrete Sine Transform, DST) transformation are usually used. Multiply with an N×M transformation matrix and its transpose matrix respectively, and obtain the transformation coefficient of the current coding block after multiplication.
在产生变换系数之后用量化205进一步提高压缩效率,变换系数经量化可以得到量化后的系数,然后将量化后的系数进行熵编码210得到当前编码块的残差码流,其中,熵编码方法包括但不限于内容自适应二进制算术编码 (Context Adaptive Binary Arithmetic Coding,CABAC)熵编码。最后将熵编码得到的比特流及进行编码后的编码模式信息进行存储或发送到解码端。在编码端,还会对量化的结果进行反量化206,对反量化结果进行反变换207。在反变换207之后,利用反变换结果以及运动补偿结果,得到重建像素。之后,对重建像素进行滤波(即环路滤波)211。在211之后,输出滤波后的重建图像(属于重建视频帧)。后续,重建图像可以作为其他帧图像的参考帧图像进行帧间预测。本申请实施例中,重建图像又可称为重建后的图像或重构图像。After the transform coefficients are generated, quantization 205 is used to further improve the compression efficiency. The quantized coefficients can be obtained after the transform coefficients are quantized, and then the quantized coefficients are subjected to entropy encoding 210 to obtain the residual code stream of the current encoding block, wherein the entropy encoding method includes But not limited to Context Adaptive Binary Arithmetic Coding (CABAC) entropy coding. Finally, the bit stream obtained by entropy encoding and the encoded encoding mode information are stored or sent to the decoding end. At the encoding end, inverse quantization 206 is performed on the quantized result, and inverse transformation 207 is performed on the dequantized result. After the inverse transformation 207, the reconstructed pixels are obtained using the inverse transformation result and the motion compensation result. Afterwards, the reconstructed pixels are filtered (ie loop filtered) 211 . After 211, the filtered reconstructed image (belonging to the reconstructed video frame) is output. Subsequently, the reconstructed image can be used as a reference frame image of other frame images for inter-frame prediction. In this embodiment of the present application, the reconstructed image may also be referred to as a reconstructed image or a reconstructed image.
具体地,帧内预测203过程中的已编码相邻块为:当前编码块编码之前,已进行编码的相邻块,该相邻块的编码过程中产生的残差经过变换204、量化205、反量化206、和反变换207后,与该相邻块的预测块相加得到的重建块。对应的,反量化206和反变换207为量化206和变换204的逆过程,用于恢复量化和变换前的残差数据。Specifically, the coded adjacent blocks in the process of intra prediction 203 are: the coded neighboring blocks before the current coded block is coded, and the residual generated during the coded process of the neighboring blocks is transformed 204, quantized 205, After inverse quantization 206 and inverse transformation 207, the reconstructed block is added to the prediction block of the adjacent block. Correspondingly, inverse quantization 206 and inverse transformation 207 are inverse processes of quantization 206 and transformation 204, and are used to recover residual data before quantization and transformation.
如图2所示,当选择帧间预测模式时,帧间预测过程包括运动估计(Motion Estimation,ME)208和运动补偿(Motion Compensation,MC)209。具体地,编码端可以根据重建视频帧中的参考帧图像进行运动估计208,在一张或多张参考帧图像中根据一定的匹配准则搜索到与当前编码块最相似的图像块作为预测块,该预测块与当前编码块的相对位移即为当前编码块的运动矢量(Motion Vector,MV)。并将该编码块像素的原始值与对应的预测块像素值相减得到编码块的残差。当前编码块的残差经过变换204、量化205以及熵编码210后形成编码帧的编码码流中的一部分。对于解码端来说,可以基于上述确定的运动矢量和预测块进行运动补偿209,获得当前编码块。As shown in FIG. 2, when the inter prediction mode is selected, the inter prediction process includes motion estimation (Motion Estimation, ME) 208 and motion compensation (Motion Compensation, MC) 209. Specifically, the encoder can perform motion estimation 208 according to the reference frame images in the reconstructed video frame, and search for the image block most similar to the current encoding block in one or more reference frame images according to a certain matching criterion as the prediction block, The relative displacement between the prediction block and the current coding block is the motion vector (Motion Vector, MV) of the current coding block. And subtracting the original value of the pixel of the coding block from the pixel value of the corresponding prediction block to obtain the residual of the coding block. After transformation 204 , quantization 205 and entropy coding 210 , the residual of the current coding block forms a part of the coded code stream of the coded frame. For the decoding end, motion compensation 209 may be performed based on the determined motion vector and the predicted block to obtain the current coding block.
其中,如图2所示,重建视频帧为经过滤波211之后得到视频帧。重建视频帧包括一个或多个重建后的图像。滤波211用于减少编码过程中产生的块效应和振铃效应等压缩失真,重建视频帧在编码过程中用于为帧间预测提供参考帧,在解码过程中,重建视频帧经过后处理后输出为最终的解码视频。Wherein, as shown in FIG. 2 , the reconstructed video frame is obtained after filtering 211 . A reconstructed video frame includes one or more reconstructed images. Filtering 211 is used to reduce compression distortion such as block effect and ringing effect generated during the encoding process. The reconstructed video frame is used to provide reference frames for inter-frame prediction during the encoding process. During the decoding process, the reconstructed video frame is output after post-processing for the final decoded video.
具体地,帧间预测模式可以包括高级运动矢量预测(Advanced Motion Vector Prediction,AMVP)模式、合并(Merge)模式或跳过(skip)模式。Specifically, the inter-frame prediction mode may include an advanced motion vector prediction (Advanced Motion Vector Prediction, AMVP) mode, a merge (Merge) mode or a skip (skip) mode.
对于AMVP模式而言,可以先确定运动矢量预测(Motion Vector Prediction,MVP),在得到MVP之后,可以根据MVP确定运动估计的起始点,在起始点附近,进行运动搜索,搜索完毕之后得到最优的MV,由MV 确定参考块在参考图像中的位置,参考块减去当前块得到残差块,MV减去MVP得到运动矢量差值(Motion Vector Difference,MVD),并将该MVD和MVP的索引通过码流传输给解码端。For the AMVP mode, the motion vector prediction (Motion Vector Prediction, MVP) can be determined first. After the MVP is obtained, the starting point of the motion estimation can be determined according to the MVP, and the motion search is performed near the starting point. After the search is completed, the optimal MV, the position of the reference block in the reference image is determined by the MV, the reference block is subtracted from the current block to obtain the residual block, the MV is subtracted from the MVP to obtain the motion vector difference (Motion Vector Difference, MVD), and the MVD and MVP The index is transmitted to the decoder through the code stream.
对于Merge模式而言,可以先确定MVP,并直接将MVP确定为当前块的MV。其中,为了得到MVP,可以先构建一个MVP候选列表(merge candidate list),在MVP候选列表中,可以包括至少一个候选MVP,每个候选MVP可以对应有一个索引,编码端在从MVP候选列表中选择MVP之后,可以将该MVP索引写入到码流中,则解码端可以按照该索引从MVP候选列表中找到该索引对应的MVP,以实现对图像块的解码。For the Merge mode, the MVP can be determined first, and the MVP can be directly determined as the MV of the current block. Among them, in order to obtain the MVP, an MVP candidate list (merge candidate list) can be constructed first. In the MVP candidate list, at least one candidate MVP can be included, and each candidate MVP can have an index corresponding to it. After the MVP is selected, the MVP index can be written into the code stream, and the decoder can find the MVP corresponding to the index from the MVP candidate list according to the index, so as to decode the image block.
应理解,以上过程只是Merge模式的一种具体实现方式。Merge模式还可以具有其他的实现方式。It should be understood that the above process is only a specific implementation of the Merge mode. The Merge pattern can also have other implementations.
例如,Skip模式是Merge模式的一种特例。按照Merge模式得到MV之后,如果编码端确定当前块和参考块基本一样,那么不需要传输残差数据,只需要传递MVP的索引,以及进一步地可以传递一个标志,该标志可以表明当前块可以直接从参考块得到。For example, Skip mode is a special case of Merge mode. After the MV is obtained according to the Merge mode, if the encoder determines that the current block is basically the same as the reference block, then there is no need to transmit the residual data, only the index of the MVP, and a flag that can indicate that the current block can be directly Obtained from the reference block.
也就是说,Merge模式特点为:MV=MVP(MVD=0);而Skip模式还多一个特点,即:重构值rec=预测值pred(残差值resi=0)。That is to say, the feature of the Merge mode is: MV=MVP (MVD=0); and the Skip mode has one more feature, namely: the reconstructed value rec=predicted value pred (residual value resi=0).
Merge模式可以应用于几何预测技术中。在几何预测技术中,可以将待编码的图像块划分为多个形状为多边形的子图像块,可以从运动信息候选列表中,分别为每个子图像块确定运动矢量,并基于每个子图像块的运动矢量,确定每个子图像块对应的预测子块,基于每个子图像块对应的预测子块,构造当前图像块的预测块,从而实现对当前图像块的编码。The Merge mode can be applied to geometric forecasting techniques. In the geometric prediction technology, the image block to be coded can be divided into multiple sub-image blocks shaped as polygons, and the motion vector can be determined for each sub-image block from the motion information candidate list, and based on the The motion vector determines the prediction sub-block corresponding to each sub-image block, and constructs the prediction block of the current image block based on the prediction sub-block corresponding to each sub-image block, so as to realize the coding of the current image block.
对于解码端,则进行与编码端相对应的操作。首先利用熵解码以及反量化和反变换得到残差信息,并根据解码码流确定当前图像块使用帧内预测还是帧间预测。如果是帧内预测,则利用当前帧中已重建图像块按照帧内预测方法构建预测信息;如果是帧间预测,则需要解析出运动信息,并使用所解析出的运动信息在已重建的图像中确定参考块,得到预测信息;接下来,再将预测信息与残差信息进行叠加,并经过滤波操作便可以得到重建信息。For the decoding end, perform operations corresponding to the encoding end. First, entropy decoding, inverse quantization and inverse transformation are used to obtain residual information, and it is determined whether the current image block uses intra prediction or inter prediction according to the decoded code stream. If it is intra-frame prediction, use the reconstructed image block in the current frame to construct prediction information according to the intra-frame prediction method; if it is inter-frame prediction, you need to parse out the motion information, and use the parsed motion information in the reconstructed image The reference block is determined to obtain the prediction information; next, the prediction information and the residual information are superimposed, and the reconstruction information can be obtained after filtering.
如上所述,基于图2所示出的视频编码框架2对视频进行编码可以节约视频图像存储和传输所占用的空间或流量。一般情况下,摄像头采集所得未经压缩的原始图像数据占用的存储空间很大,以分辨率为3840×2160、存储 格式为YUV4:2:210-bit的图像为例,在无压缩的情况下存储该图像需要占用约20M字节的存储空间,通常一张8G的存储卡只能存放500张上述规格的未压缩照片,同时也意味着在网络传输时一张未压缩的上述规格的照片就需要20M字节流量。因此为了节约图像存储和传输所占用的空间或流量,需要对图像数据进行编码压缩处理。As mentioned above, encoding video based on the video encoding framework 2 shown in FIG. 2 can save space or traffic occupied by video image storage and transmission. In general, the uncompressed original image data collected by the camera occupies a large storage space. Take the image with a resolution of 3840×2160 and a storage format of YUV4:2:210-bit as an example. Storing the image requires about 20M bytes of storage space. Usually, an 8G memory card can only store 500 uncompressed photos of the above specifications. 20M bytes of traffic is required. Therefore, in order to save space or traffic occupied by image storage and transmission, image data needs to be encoded and compressed.
联合摄影专家组扩展范围(Joint Photographic Experts Group Extended Range,JPEG XR)是一种连续色调静止图像压缩算法和文件格式,也可以称为HD Photo或网络媒体图像(Windows Media Photo),由微软(microsoft)开发,属于网络媒体(windows media)家族的一部分。它支持有损数据压缩以及无损数据压缩,并且是微软的XML文本规格(XML Paper Specification,XPS)文档的首选图像格式。其中XML为可扩展标记语言(Extensible Markup Language)。目前支持的软件包括.NET framework(3.0或更新版本),操作系统(windows vista/windows 7)、网络探路者(Internet Explorer,IE)9,动画播放器(flashplayer)11等。Joint Photographic Experts Group Extended Range (JPEG XR) is a continuous tone still image compression algorithm and file format, also known as HD Photo or network media image (Windows Media Photo), developed by Microsoft (microsoft ) development, is part of the network media (windows media) family. It supports lossy as well as lossless data compression, and is the preferred image format for Microsoft's XML Paper Specification (XPS) documents. Among them, XML is Extensible Markup Language (Extensible Markup Language). Currently supported software includes .NET framework (3.0 or later), operating system (windows vista/windows 7), Internet Explorer (IE) 9, animation player (flashplayer) 11, etc.
JPEG XR是一款可以实现高动态范围图像编码,而且在压缩与解压时只需要整数运算的图像编解码器。它可以支持单色、Red Green Blue(RGB)、Cyan Magenta Yellow Black(CMYK)、16位无符号整数或者32位定点或者浮点数表示的多通道彩色格式的图像,并且它还可以支持RGBE Radiance图像格式。它可以选择嵌入国际色彩协会(International Color Consortium,ICC)彩色描述档以实现不同设备上的色彩一致性。阿尔法通道可以表示透明程度,同时支持可交换图像文件(Exchangeable Image File,EXIF)、可扩展元数据平台(Extensible Metadata Platform,XMP)元数据格式。这种格式还支持在一个文件中包含多幅图像。支持只对图像的进行部分解码,对于一些特定的操作如裁剪、降采样、水平竖直翻转或者旋转都无需对整幅图像进行解码。JPEG XR is an image codec that can realize high dynamic range image encoding, and only requires integer operations during compression and decompression. It can support monochrome, Red Green Blue (RGB), Cyan Magenta Yellow Black (CMYK), 16-bit unsigned integer or 32-bit fixed-point or floating-point multi-channel color format images, and it can also support RGBE Radiance images Format. It can optionally embed the International Color Consortium (ICC) color profile for color consistency across devices. The alpha channel can indicate the degree of transparency, and supports Exchangeable Image File (EXIF) and Extensible Metadata Platform (XMP) metadata formats. This format also supports multiple images in one file. It supports only partial decoding of the image, and there is no need to decode the entire image for some specific operations such as cropping, downsampling, horizontal and vertical flipping, or rotation.
如图3所示为JPEG XR处理图像时将图像按从大到小以下五个层次进行处理的示意性图。其中,该图中包括图像(image)、瓦片(tile)、宏块(macro block)、块(block)、像素(pixel)。其中一个图像可以由一个或多个瓦片组成。如果瓦片位于图像的右侧和底部边缘,则会将其填充为整数个宏块(16×16)。每个宏块可以包含16个4×4块,并且每个块可以包含4×4像素。JPEG XR对每个4×4块和16×16宏块中的重组低通块进行两阶段变换。As shown in Figure 3, it is a schematic diagram of processing images in five levels from large to small when JPEG XR processes images. Wherein, the figure includes an image (image), a tile (tile), a macro block (macro block), a block (block), and a pixel (pixel). One of the images can consist of one or more tiles. If the tile is on the right and bottom edge of the image, it will be padded to an integer number of macroblocks (16×16). Each macroblock may contain 16 4x4 blocks, and each block may contain 4x4 pixels. JPEG XR performs a two-stage transform on each 4×4 block and the recombined low-pass block in the 16×16 macroblock.
如图4所示,为本申请一实施例提供的JPEG XR编码器的示意性结构图。该JPEG XR编码器可以包括滤波模块410、变换模块420、量化模块430、预测模块440、熵编码模块450五个模块,这五个模块的作用与上述图2中所涉及到的模块的作用相类似。具体地,滤波模块410可以通过相邻像素间的平滑减轻解码重建图像的块效应;变换模块420可以将图像信息从空域转换到频域,去除部分空域冗余信息;量化模块430可以将频域系数进行缩小,降低需要编码的系数幅值,系数幅值降低的程度取决于指定的量化参数(Quantization Parameter,QP)的大小;预测模块440可以通过相邻块部分系数间的预测去除相邻块间部分系数的相关性;熵编码模块450可以将最终得到的系数编码成二进制码流。As shown in Figure 4, it is a schematic structural diagram of a JPEG XR encoder provided by an embodiment of the present application. The JPEG XR encoder may include five modules: a filtering module 410, a transform module 420, a quantization module 430, a prediction module 440, and an entropy encoding module 450. The functions of these five modules are similar to those of the modules involved in the above-mentioned FIG. 2 similar. Specifically, the filtering module 410 can reduce the block effect of the decoded and reconstructed image through smoothing between adjacent pixels; the transform module 420 can convert the image information from the spatial domain to the frequency domain, and remove part of the redundant information in the spatial domain; the quantization module 430 can convert the frequency domain The coefficients are shrunk to reduce the magnitude of the coefficients that need to be coded. The degree of reduction of the coefficients depends on the size of the specified quantization parameter (Quantization Parameter, QP); the prediction module 440 can remove the adjacent blocks through the prediction between the coefficients of the adjacent blocks The correlation between partial coefficients; the entropy encoding module 450 can encode the finally obtained coefficients into a binary code stream.
从上述五个模块的功能分析以及结合上述图2中关于这些模块的描述,可以看出,最终码流的大小(即码率)主要取决于量化程度、预测效率以及熵编码性能,其中,量化程度具有决定性作用。From the functional analysis of the above five modules and the description of these modules in Figure 2 above, it can be seen that the size of the final code stream (that is, the code rate) mainly depends on the degree of quantization, prediction efficiency and entropy coding performance. Among them, quantization degree is decisive.
下文先介绍关于JPEG XR的变换模块及量化模块。The following section first introduces the transformation module and quantization module of JPEG XR.
1、变换模块1. Transformation module
JPEG XR的变换是基于整数的变换,每个宏块可以参与两个阶段的变换。变换均可以基于4x4个块进行。如图5所示,第一阶段变换可以应用于宏块内的16个块,产生16个低通系数(Low Pass Coefficient,LP Coefficient)和240个高通(High Pass Coefficient,HP Coefficient)系数,即这16个块中的每一个块均产生一个LP系数和15个HP系数。第二阶段变换可以应用于第一阶段得到的16个LP系数的重组块,并通过再次变换最终生成1个直流系数(Direct Current Coefficient,DC Coefficient)和15个LP系数。The transformation of JPEG XR is based on an integer transformation, and each macroblock can participate in two stages of transformation. Transforms can all be performed on a 4x4 block basis. As shown in Figure 5, the first-stage transformation can be applied to 16 blocks within a macroblock, resulting in 16 low-pass coefficients (Low Pass Coefficient, LP Coefficient) and 240 high-pass (High Pass Coefficient, HP Coefficient) coefficients, namely Each of these 16 blocks produces one LP coefficient and 15 HP coefficients. The second-stage transformation can be applied to the recombined block of 16 LP coefficients obtained in the first stage, and finally generate 1 DC coefficient (Direct Current Coefficient, DC Coefficient) and 15 LP coefficients through re-transformation.
2、量化模块2. Quantization module
JPEG XR中的量化具有高度的灵活性,因为量化参数在瓦片,宏块和DC系数、LP系数、HP系数中可能会有所不同。JPEG XR的量化参数范围为从0到255的整数,其中量化参数为0及1时为无损压缩,量化参数为255时为损失程度最大的压缩。从量化参数到缩放因子(Scale Factor,SF)的映射关系如下式(1)所示:Quantization in JPEG XR is highly flexible, since quantization parameters may vary among tiles, macroblocks and DC coefficients, LP coefficients, HP coefficients. The quantization parameter range of JPEG XR is an integer from 0 to 255. When the quantization parameter is 0 and 1, it is lossless compression, and when the quantization parameter is 255, it is the most lossy compression. The mapping relationship from quantization parameters to scaling factors (Scale Factor, SF) is shown in the following formula (1):
Figure PCTCN2021098383-appb-000001
Figure PCTCN2021098383-appb-000001
通过将原始系数除以所选量化参数的相应缩放因子,然后将其舍入为整 数,即可得到量化后的系数。The quantized coefficients are obtained by dividing the original coefficients by the corresponding scaling factor for the chosen quantization parameter and then rounding them to integers.
由此可知,使用JPEG XR编码器压缩图像的码率最终大小取决于量化程度,而量化程度取决于指定的量化参数。目前针对JPEG XR的码率控制算法中,有一些算法需要多次编码,该做法会带来额外的复杂度导致编码延迟,从而影响编码器的运行速度,并且不利于实现实时编码。另外一些算法则使用固定量化参数的办法,然而使用固定量化参数会导致输出码率不可控的问题。It can be seen that the final size of the code rate of the compressed image using the JPEG XR encoder depends on the degree of quantization, and the degree of quantization depends on the specified quantization parameters. Among the current rate control algorithms for JPEG XR, some algorithms require multiple encodings. This approach will bring additional complexity and lead to encoding delay, which will affect the running speed of the encoder and is not conducive to real-time encoding. Other algorithms use fixed quantization parameters. However, using fixed quantization parameters will lead to uncontrollable output code rate.
针对上述问题,本申请提出了一种编码方法,可以保证在不牺牲码率控制精度的前提下,提高编码效率以及降低硬件资源消耗,同时可以保证量化参数的灵活性以避免输出码率不可控的问题。In view of the above problems, this application proposes a coding method, which can improve the coding efficiency and reduce the consumption of hardware resources without sacrificing the accuracy of code rate control, and at the same time can ensure the flexibility of quantization parameters to avoid uncontrollable output code rate The problem.
如图6所示,为本申请实施例提供的一种编码方法600,该编码方法600可以包括步骤610-620。As shown in FIG. 6 , it is an encoding method 600 provided in the embodiment of the present application, and the encoding method 600 may include steps 610-620.
610,获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换(Photo Core Transform,PCT)处理后得到的变换系数,n1为大于或等于2的正整数。610. Obtain the image complexity information of each of the n1 tiles in the current frame, where the image complexity information includes performing image core transformation (Photo Core Transform, PCT) on the pixel value of each tile Transform coefficient obtained after processing, n1 is a positive integer greater than or equal to 2.
本申请实施例中,在对待编码图像进行划分的时候,可以按照固定宽度或固定高度对待编码图像进行划分,也可以不按照固定宽度或固定高度对待编码图像进行划分。In the embodiment of the present application, when dividing the image to be encoded, the image to be encoded may be divided according to a fixed width or a fixed height, or may not be divided according to a fixed width or a fixed height.
此外,本申请实施例中,可以对编码图像进行水平划分,也可以对待编码图像进行垂直划分。In addition, in the embodiment of the present application, the coded image may be divided horizontally, or the image to be coded may be divided vertically.
应理解,本申请实施例中的水平划分可以是指从水平方向对待编码图像进行的划分,垂直划分可以是指从垂直方向对待编码图像进行的划分。It should be understood that the horizontal division in the embodiment of the present application may refer to the division of the image to be coded in the horizontal direction, and the vertical division may refer to the division of the image to be coded in the vertical direction.
例如,如图7a所示,为本申请一实施例提供的一种对待编码图像划分的示意性图。可以按照预设的固定宽度对待编码图像进行垂直划分,假设预设的固定宽度为384,从图7a中可以看出,待编码图像可以划分为3个瓦片,且这3个瓦片的宽度均相同,均为384。For example, as shown in FIG. 7a , it is a schematic diagram of division of an image to be encoded provided by an embodiment of the present application. The image to be encoded can be divided vertically according to the preset fixed width, assuming that the preset fixed width is 384, as can be seen from Figure 7a, the image to be encoded can be divided into 3 tiles, and the width of these 3 tiles Both are the same, both are 384.
如图7b所示,为本申请另一种实施例提供的一种对待编码图像划分的示意性图。同样地,可以按照预设的固定宽度对待编码图像进行垂直划分,假设预设的固定宽度为384,从图7b中可以看出,待编码图像可以划分为3个瓦片,且瓦片1和瓦片2的宽度相同,均为384,而瓦片3的宽度小于384。As shown in FIG. 7 b , it is a schematic diagram of division of an image to be encoded provided by another embodiment of the present application. Similarly, the image to be encoded can be divided vertically according to the preset fixed width, assuming that the preset fixed width is 384, as can be seen from Figure 7b, the image to be encoded can be divided into 3 tiles, and tile 1 and Tile 2 has the same width, both 384, while Tile 3 has a width less than 384.
可以理解的是,按照上述图7a和图7b的划分方式,划分后的瓦片(即瓦片1、瓦片2和瓦片3)的高度是相同的,均为待编码图像的高度。It can be understood that, according to the above-mentioned division methods in FIG. 7a and FIG. 7b, the divided tiles (ie, tile 1, tile 2, and tile 3) have the same height, which is the height of the image to be encoded.
如图7c所示,为本申请又一实施例提供的一种对待编码图像划分的示意性图。可以按照预设的固定高度对待编码图像进行水平划分,假设预设的固定高度为384,从图7c中可以看出,待编码图像可以划分为3个瓦片,且这3个瓦片的高度均相同,均为384。As shown in FIG. 7c, it is a schematic diagram of division of an image to be coded provided by another embodiment of the present application. The image to be coded can be horizontally divided according to the preset fixed height, assuming the preset fixed height is 384, as can be seen from Figure 7c, the image to be coded can be divided into 3 tiles, and the height of these 3 tiles Both are the same, both are 384.
如图7d所示,为本申请再一实施例提供的一种对待编码图像划分的示意性图。可以按照预设的固定高度对待编码图像进行水平划分,假设预设的固定高度为384,从图7d中可以看出,待编码图像可以划分为3个瓦片,且瓦片1和瓦片2的高度相同,均为384,瓦片3的高度小于384。As shown in FIG. 7d , it is a schematic diagram of division of an image to be encoded provided by yet another embodiment of the present application. The image to be coded can be horizontally divided according to the preset fixed height, assuming that the preset fixed height is 384, as can be seen from Figure 7d, the image to be coded can be divided into 3 tiles, and tile 1 and tile 2 The heights of tiles are the same, both are 384, and the height of tile 3 is less than 384.
可以理解的是,按照上述图7c和图7d的划分方式,划分后的瓦片的宽度是相同的,均为待编码图像的宽度。It can be understood that, according to the above division manners in FIG. 7c and FIG. 7d , the widths of the divided tiles are the same, which is the width of the image to be encoded.
在一些实施例中,也可以不按照固定宽度或固定高度对待编码图像进行划分,可以按照预设的多个宽度或多个高度对待编码图像进行划分。In some embodiments, the image to be coded may not be divided according to a fixed width or a fixed height, but may be divided according to multiple preset widths or multiple heights.
如图7e所示,为本申请再一实施例提供的一种对待编码图像划分的示意性图。可以按照多个预设的固定宽度对待编码图像进行垂直划分,假设预设的固定宽度包括160和384,则从图7e中可以看出,瓦片1的宽度为160,瓦片2的宽度为384,瓦片3的宽度为224。As shown in FIG. 7e , it is a schematic diagram of division of an image to be coded provided by yet another embodiment of the present application. The image to be coded can be divided vertically according to multiple preset fixed widths. Assuming that the preset fixed widths include 160 and 384, it can be seen from Figure 7e that the width of tile 1 is 160, and the width of tile 2 is 384, tile 3 has a width of 224.
如图7f所示,为本申请再一实施例提供的一种对待编码图像划分的示意性图。可以按照多个预设的固定高度对待编码图像进行水平划分,假设多个预设的固定高度为160和384,则从图7f中可以看出,瓦片1的高度为160,瓦片2的高度为384,瓦片3的高度为224。As shown in FIG. 7f , it is a schematic diagram of division of an image to be coded provided by yet another embodiment of the present application. The image to be coded can be horizontally divided according to multiple preset fixed heights. Assuming that the multiple preset fixed heights are 160 and 384, it can be seen from Figure 7f that the height of tile 1 is 160, and the height of tile 2 The height is 384 and the height of tile 3 is 224.
应理解,上述数值均为举例说明,还可以为其它数值,本申请对此不作具体限定。It should be understood that the above numerical values are for illustration only, and may also be other numerical values, which are not specifically limited in the present application.
需要特别说明的是,在一些实施例中,在按照固定宽度或固定高度对待编码图像进行划分的时候,该固定宽度或固定高度的设置与PCT处理的块所包括的像素的个数有关,具体描述请参见后文。It should be noted that, in some embodiments, when the image to be coded is divided according to a fixed width or a fixed height, the setting of the fixed width or fixed height is related to the number of pixels included in the PCT-processed block, specifically See below for a description.
在一些实施例中,图像复杂度信息的计算也可以替换为包括但不限于哈达玛变换或均方误差等算子进行计算。In some embodiments, the calculation of the image complexity information may also be replaced by operators including but not limited to Hadamard transform or mean square error.
520,根据所述图像复杂度信息更新所述n1个瓦片的量化参数。520. Update quantization parameters of the n1 tiles according to the image complexity information.
本申请实施例中的图像复杂度信息可以是指待编码图像中包括的瓦片 的变换系数,根据瓦片的变换系数更新瓦片的QP。The image complexity information in the embodiment of the present application may refer to the transform coefficients of the tiles included in the image to be encoded, and the QP of the tiles is updated according to the transform coefficients of the tiles.
本申请实施例提供的方案,由于图像复杂度信息与当前帧中的瓦片的变换系数有关,且该变换系数是经过对瓦片的像素值进行PCT处理后的得到的系数,通过根据图像复杂度信息更新或计算待编码图像所包括的各个瓦片的QP,可以保证在不牺牲码率控制精度的前提下,提高编码效率以及降低硬件资源消耗,同时可以保证量化参数的灵活性以避免输出码率不可控的问题。In the solution provided by the embodiment of the present application, since the image complexity information is related to the transformation coefficient of the tile in the current frame, and the transformation coefficient is the coefficient obtained after performing PCT processing on the pixel value of the tile, by The degree information is updated or the QP of each tile included in the image to be encoded can be guaranteed to improve the encoding efficiency and reduce the consumption of hardware resources without sacrificing the bit rate control accuracy, and at the same time, it can ensure the flexibility of quantization parameters to avoid output The code rate is uncontrollable.
上文指出,图像复杂度信息包括对每一个瓦片的像素值经过PCT处理后得到的变换系数,下文将对其中所涉及的PCT处理进行说明。As pointed out above, the image complexity information includes the transformation coefficients obtained after PCT processing is performed on the pixel values of each tile, and the PCT processing involved will be described below.
PCT处理可以包括以下流程,其中,对于每一个宏块所包括的4*4的块均可以按照以下流程进行变换。The PCT processing may include the following flow, wherein, the 4*4 blocks included in each macroblock may be transformed according to the following flow.
下文中的_2×2T_h(a,b,c,d,flag)、_T_odd(a,b,c,d)、_T_odd_odd(a,b,c,d)以及_FwdPermute(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)表示4种不同的计算,括号内的字母表示计算的输入及输出。_2×2T_h(a, b, c, d, flag), _T_odd(a, b, c, d), _T_odd_odd(a, b, c, d) and _FwdPermute(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) represent 4 different calculations, and the letters in brackets represent the input and output of the calculation.
PCT4×4(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)PCT4×4 (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
_2×2T_h(a,d,m,p,0)_2×2T_h(a, d, m, p, 0)
_2×2T_h(f,g,j,k,0)_2×2T_h(f, g, j, k, 0)
_2×2T_h(b,c,n,o,0)_2×2T_h(b,c,n,o,0)
_2×2T_h(e,h,i,l,0)_2×2T_h(e, h, i, l, 0)
_2×2T_h(a,b,e,f,1)_2×2T_h(a, b, e, f, 1)
_T_odd(c,d,g,h)_T_odd(c,d,g,h)
_T_odd(i,m,j,n)_T_odd(i, m, j, n)
_T_odd_odd(k,l,o,p)_T_odd_odd (k, l, o, p)
_FwdPermute(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)_FwdPermute(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
1)、_2×2T_h(a,b,c,d,flag)的计算过程如式(2)-式(9)所示1), the calculation process of _2×2T_h(a, b, c, d, flag) is shown in formula (2) - formula (9)
a=a+d   (2)a=a+d (2)
b=b-c    (3)b=b-c (3)
t1=((a-b+flag)>>1)   (4)t1=((a-b+flag)>>1) (4)
t2=c    (5)t2=c (5)
c=t1-d   (6)c=t1-d (6)
d=t1-t2   (7)d=t1-t2 (7)
a=a-d   (8)a=a-d (8)
b=b+c   (9)b=b+c (9)
其中,上述式中t1、t2为临时值,>>符号表示右移操作。Wherein, t1 and t2 in the above formula are temporary values, and the >> symbol represents a right shift operation.
2)、_T_odd(a,b,c,d)的计算过程如式(10)-式(21)所示2), the calculation process of _T_odd(a, b, c, d) is shown in formula (10) - formula (21)
b=b-c    (10)b=b-c (10)
a=a+d   (11)a=a+d (11)
c=c+((b+1)>>1)    (12)c=c+((b+1)>>1) (12)
d=((a+1)>>1)-d   (13)d=((a+1)>>1)-d (13)
b=b-((a*3+4)>>3)   (14)b=b-((a*3+4)>>3) (14)
a=a+((b*3+4)>>3)   (15)a=a+((b*3+4)>>3) (15)
d=d-((c*3+4)>>3)   (16)d=d-((c*3+4)>>3) (16)
c=c+((d*3+4)>>3)   (17)c=c+((d*3+4)>>3) (17)
d=d+(b>>1)   (18)d=d+(b>>1) (18)
c=c-((a+1)>>1)   (19)c=c-((a+1)>>1) (19)
b=b-d   (20)b=b-d (20)
a=a+c   (21)a=a+c (21)
3)、_T_odd_odd(a,b,c,d)的计算过程如式(22)-式(36)所示3), the calculation process of _T_odd_odd(a, b, c, d) is shown in formula (22) - formula (36)
b=-1*b   (22)b=-1*b (22)
c=-1*c   (23)c=-1*c (23)
d=d+a    (24)d=d+a (24)
c=c-b    (25)c=c-b (25)
t1=d>>1   (26)t1=d>>1 (26)
t2=c>>1   (27)t2=c>>1 (27)
a=a-t1   (28)a=a-t1 (28)
b=b+t2   (29)b=b+t2 (29)
a=a+((b*3+4)>>3)   (30)a=a+((b*3+4)>>3) (30)
b=b-((a*3+4)>>2)    (31)b=b-((a*3+4)>>2) (31)
a=a+((b*3+3)>>3)   (32)a=a+((b*3+3)>>3) (32)
b=b-t2   (33)b=b-t2 (33)
a=a+t1   (34)a=a+t1 (34)
c=c+b   (35)c=c+b (35)
d=d-a   (36)d=d-a (36)
其中,上述式中t1、t2为临时值,>>符号表示右移操作。Wherein, t1 and t2 in the above formula are temporary values, and the >> symbol represents a right shift operation.
4)、_FwdPermute(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)的计算过程如图8所示4), the calculation process of _FwdPermute(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) is shown in Figure 8
该过程实现的是一个矩阵位置转换功能,即将图8所示的左侧图形的字母的位置转换到图8所示的右侧图形的字母的位置。This process realizes a matrix position conversion function, that is, the position of the letter of the left figure shown in FIG. 8 is converted to the position of the letter of the right figure shown in FIG. 8 .
示例性地,以简单的数值为例,对上述PCT处理流程进行说明,假设上述a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p的取值分别为1,2,3,4,2,3,5,4,2,3,4,0,3,2,1,1,按照上述流程对这些数值进行PCT处理。Exemplarily, the above-mentioned PCT processing flow is described by taking simple numerical values as an example, assuming that the above-mentioned a, b, c, d, e, f, g, h, i, j, k, l, m, n, o , the values of p are respectively 1, 2, 3, 4, 2, 3, 5, 4, 2, 3, 4, 0, 3, 2, 1, 1, and PCT processing is performed on these values according to the above procedure.
1)、进行_2×2T_h(a,b,c,d,flag)处理1), carry out _2×2T_h (a, b, c, d, flag) processing
①、_2×2T_h(a,d,m,p,0)的流程如下①. The process of _2×2T_h(a, d, m, p, 0) is as follows
a=a+p=1+1=2a=a+p=1+1=2
d=d-m=4-3=1d=d-m=4-3=1
t1=((a-d+flag)>>1)=0t1=((a-d+flag)>>1)=0
t2=m=3t2=m=3
m=t1-p=-1m=t1-p=-1
p=t1-t2=0-3=-3p=t1-t2=0-3=-3
a=a-p=2-(-3)=5a=a-p=2-(-3)=5
d=d+m=1+(-1)=0d=d+m=1+(-1)=0
②、_2×2T_h(f,g,j,k,0)的流程如下②. The process of _2×2T_h(f, g, j, k, 0) is as follows
f=f+k=3+4=7f=f+k=3+4=7
g=g-j=5-3=2g=g-j=5-3=2
t1=((f-g+flag)>>1)=2t1=((f-g+flag)>>1)=2
t2=j=3t2=j=3
j=t1-k=2-4=-2j=t1-k=2-4=-2
k=t1-t2=2-3=-1k=t1-t2=2-3=-1
f=f-k=7-(-1)=8f=f-k=7-(-1)=8
g=g+j=2-(-2)=0g=g+j=2-(-2)=0
③、_2×2T_h(b,c,n,o,0)的流程如下③. The process of _2×2T_h(b, c, n, o, 0) is as follows
b=b+o=2+1=3b=b+o=2+1=3
c=c-n=3-2=1c=c-n=3-2=1
t1=((b-c+flag)>>1)=1t1=((b-c+flag)>>1)=1
t2=n=2t2=n=2
n=t1-o=1-1=0n=t1-o=1-1=0
o=t1-t2=1-2=-1o=t1-t2=1-2=-1
b=b-o=3-(-1)=4b=b-o=3-(-1)=4
c=c+n=1+0=1c=c+n=1+0=1
④、_2×2T_h(e,h,i,l,0)的流程如下④ The process of _2×2T_h(e, h, i, l, 0) is as follows
e=e+l=2+0=2e=e+l=2+0=2
h=h-i=4-2=2h=h-i=4-2=2
t1=((e-h+flag)>>1)=0t1=((e-h+flag)>>1)=0
t2=i=2t2=i=2
i=t1-l=0-0=0i=t1-l=0-0=0
l=t1-t2=0-2=-2l=t1-t2=0-2=-2
e=e-l=2-(-2)=4e=e-l=2-(-2)=4
h=h+i=2+0=2h=h+i=2+0=2
⑤、_2×2T_h(a,b,e,f,1)的流程如下⑤ The process of _2×2T_h(a, b, e, f, 1) is as follows
a=a+f=5+8=13a=a+f=5+8=13
b=b-e=4-4=0b=b-e=4-4=0
t1=((a-b+flag)>>1)=7t1=((a-b+flag)>>1)=7
t2=e=4t2=e=4
e=t1-f=7-8=-1e=t1-f=7-8=-1
f=t1-t2=7-4=3f=t1-t2=7-4=3
a=a-f=13-3=10a=a-f=13-3=10
b=b+e=0+(-1)=-1b=b+e=0+(-1)=-1
基于此,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p的取值分别更新为10,-1,1,0,-1,3,0,2,0,-1,-1,-2,-1,0,-1,-3。Based on this, the values of a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p are updated to 10, -1, 1, 0, - 1, 3, 0, 2, 0, -1, -1, -2, -1, 0, -1, -3.
2)、进行_T_odd(a,b,c,d)的处理2), carry out the processing of _T_odd (a, b, c, d)
①、_T_odd(c,d,g,h)的流程如下①. The process of _T_odd(c, d, g, h) is as follows
从上述可以看出,c,d,g,h的取值分别为1,0,0,2。It can be seen from the above that the values of c, d, g, and h are 1, 0, 0, and 2, respectively.
d=d-g=0-0=0d=d-g=0-0=0
c=c+h=1+2=3c=c+h=1+2=3
g=g+((d+1)>>1)=0g=g+((d+1)>>1)=0
h=((c+1)>>1)-h=0h=((c+1)>>1)-h=0
d=d-((c*3+4)>>3)=0d=d-((c*3+4)>>3)=0
c=c+((d*3+4)>>3)=3c=c+((d*3+4)>>3)=3
h=h-((g*3+4)>>3)=0h=h-((g*3+4)>>3)=0
g=g+((h*3+4)>>3)=0g=g+((h*3+4)>>3)=0
h=h+(d>>1)=0h=h+(d>>1)=0
g=g-((c+1)>>1)=-2g=g-((c+1)>>1)=-2
d=d-h=0-0=0d=d-h=0-0=0
c=c+g=3+(-2)=1c=c+g=3+(-2)=1
因此,更新后的c,d,g,h的取值分别为1,0,-2,0。Therefore, the updated values of c, d, g, and h are 1, 0, -2, 0 respectively.
②、_T_odd(i,m,j,n)的流程如下②. The process of _T_odd(i, m, j, n) is as follows
从上述可以看出,i,m,j,n的取值分别为0,-1,-1,0。It can be seen from the above that the values of i, m, j, and n are 0, -1, -1, and 0, respectively.
m=m-j=-1-(-1)=0m=m-j=-1-(-1)=0
i=i+n=0+0=0i=i+n=0+0=0
j=j+((m+1)>>1)=-1j=j+((m+1)>>1)=-1
n=((i+1)>>1)-n=0n=((i+1)>>1)-n=0
m=m-((i*3+4)>>3)=0m=m-((i*3+4)>>3)=0
i=i+((m*3+4)>>3)=0i=i+((m*3+4)>>3)=0
n=n-((j*3+4)>>3)=0n=n-((j*3+4)>>3)=0
j=j+((n*3+4)>>3)=-1j=j+((n*3+4)>>3)=-1
n=n+(m>>1)=0n=n+(m>>1)=0
j=j-((i+1)>>1)=-1j=j-((i+1)>>1)=-1
m=m-n=0m=m-n=0
i=i+j=-1i=i+j=-1
因此,更新后的i,m,j,n的取值分别为-1,0,-1,0。Therefore, the updated values of i, m, j, and n are -1, 0, -1, 0 respectively.
3)、进行_T_odd_odd(k,l,o,p)处理3), carry out _T_odd_odd (k, l, o, p) processing
从上述可以看出,k,l,o,p的取值分别为-1,2,-1,-3。It can be seen from the above that the values of k, l, o, p are -1, 2, -1, -3 respectively.
l=-1*l=2l=-1*l=2
o=-1*o=1o=-1*o=1
p=p+k=(-3)+(-1)=-4p=p+k=(-3)+(-1)=-4
o=o-l=1-2=-1o=o-l=1-2=-1
t1=p>>1=2t1=p>>1=2
t2=o>>1=0t2=o>>1=0
k=k-t1=(-1)-2=-3k=k-t1=(-1)-2=-3
l=l+t2=2+0=2l=l+t2=2+0=2
k=k+((l*3+4)>>3)=-2k=k+((l*3+4)>>3)=-2
l=l-((k*3+4)>>2)=1l=l-((k*3+4)>>2)=1
k=k+((l*3+3)>>3)=-2k=k+((l*3+3)>>3)=-2
l=l-t2=1-0=1l=l-t2=1-0=1
k=k+t1=(-2)+2=0k=k+t1=(-2)+2=0
o=o+l=(-1)+1=0o=o+l=(-1)+1=0
p=p-k=(-4)-0=-4p=p-k=(-4)-0=-4
因此,更新后的k,l,o,p的取值分别为0,1,0,-4。Therefore, the updated values of k, l, o, p are 0, 1, 0, -4 respectively.
基于此,更新后的a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p的取值分别为10,-1,1,0,-1,3,-2,0,-1,-1,0,1,0,0,0,-4。Based on this, the updated values of a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p are 10, -1, 1, 0 respectively , -1, 3, -2, 0, -1, -1, 0, 1, 0, 0, 0, -4.
4)、进行_FwdPermute(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)处理4), carry out _FwdPermute (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) processing
按照如图8所示的,对输入值进行矩阵变换处理,最终更新后的a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p的取值分别为10,-1,-1,0,1,-4,0,0,-1,0,3,-1,0,1,-2,0。As shown in Figure 8, matrix transformation processing is performed on the input values, and finally updated a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, The values of p are 10, -1, -1, 0, 1, -4, 0, 0, -1, 0, 3, -1, 0, 1, -2, 0.
应理解,上述过程仅以简单的数值进行举例说明,在实际编码过程中,待编码图像中的像素值可能远远大于上述所列举的数值,但计算流程在本质上是一致的。It should be understood that the above process is only illustrated with simple numerical values. In an actual encoding process, the pixel values in the image to be encoded may be much larger than the numerical values listed above, but the calculation process is essentially the same.
可选地,在一些实施例中,所述根据所述图像复杂度信息更新所述n1个瓦片的QP,包括:根据所述图像复杂度信息计算所述n1个瓦片中的第i个瓦片的目标字节数的累积值,i为小于或等于n1的正整数;根据所述第i个瓦片的目标字节数的累积值更新所述第i个瓦片的QP。Optionally, in some embodiments, the updating the QP of the n1 tiles according to the image complexity information includes: calculating the i-th of the n1 tiles according to the image complexity information The cumulative value of the target number of bytes of the tile, i is a positive integer less than or equal to n1; the QP of the i-th tile is updated according to the cumulative value of the target number of bytes of the i-th tile.
本申请实施例中的第i个瓦片的目标字节数的累积值可以是指前i个瓦片(包括第i个瓦片)的所有瓦片的目标字节数。The cumulative value of the target number of bytes of the i-th tile in this embodiment of the present application may refer to the target number of bytes of all tiles in the previous i-th tile (including the i-th tile).
例如,第2个瓦片的目标字节数的累积值可以是指第1个瓦片的目标字节数与第2个瓦片的目标字节数的和;第5个瓦片的目标字节数的累积值可以是指第1个瓦片的目标字节数、第2个瓦片的目标字节数、第3个瓦片的 目标字节数、第4个瓦片的目标字节数以及第5个瓦片的目标字节数的和;以此类推,第n1个瓦片的目标字节数的累积值可以是指第1个瓦片的目标字节数、第2个瓦片的目标字节数……、第n1-1个瓦片的目标字节数以及第n1个瓦片的目标字节数的和。For example, the cumulative value of the target byte count of the second tile may refer to the sum of the target byte count of the first tile and the target byte count of the second tile; the target byte count of the fifth tile The cumulative value of the number of sections can refer to the target byte count of the first tile, the target byte count of the second tile, the target byte count of the third tile, and the target byte count of the fourth tile and the sum of the target byte count of the fifth tile; and so on, the cumulative value of the target byte count of the n1th tile can refer to the target byte count of the first tile, the second tile The sum of the target number of bytes of the slice..., the target number of bytes of the n1-1th tile, and the target number of bytes of the n1th tile.
本申请实施例中,可以根据第i个瓦片的目标字节数的累积值更新第i个瓦片的QP。例如,可以根据第1个瓦片的目标字节数的累积值(即第1个瓦片的目标字节数)更新第1个瓦片的QP,根据第3个瓦片的目标字节数的累积值更新第3个瓦片的QP。In the embodiment of the present application, the QP of the i-th tile may be updated according to the accumulated value of the target byte number of the i-th tile. For example, the QP of the first tile can be updated according to the cumulative value of the target byte count of the first tile (that is, the target byte count of the first tile), and according to the target byte count of the third tile The cumulative value of updates the QP of the third tile.
需要说明的是,对于第1个瓦片,可以有一个初始QP,然后再根据第1个瓦片的目标字节数更新该第1个瓦片的初始QP。It should be noted that, for the first tile, there may be an initial QP, and then the initial QP of the first tile is updated according to the target number of bytes of the first tile.
如上所述,本申请实施例中的图像复杂度信息包括对每一个瓦片的像素值经过PCT处理后得到的变换系数。这是因为,由于使用JPEG XR的变换模块的变换形式计算得到的图像复杂度信息与最终码流大小有强相关性,因此,本申请实施例中使用的图像复杂度信息可以采用上述PCT处理后累加变换系数的方法进行计算。As mentioned above, the image complexity information in the embodiment of the present application includes the transformation coefficient obtained after PCT processing is performed on the pixel value of each tile. This is because, since the image complexity information calculated by using the transformation form of the JPEG XR transformation module has a strong correlation with the size of the final code stream, the image complexity information used in the embodiment of this application can be processed by the above-mentioned PCT Calculated by accumulating transform coefficients.
其中,所述获取当前帧中的n1个瓦片的每一个瓦片的的图像复杂度信息,包括:Wherein, the acquisition of the image complexity information of each of the n1 tiles in the current frame includes:
对所述瓦片内的块进行映射后进行预设变换生成预设变换参数,根据所述预设变换参数生成所述瓦片的图像复杂度信息。所述预设变换包括PCT变换After the blocks in the tile are mapped, preset transformation is performed to generate preset transformation parameters, and the image complexity information of the tile is generated according to the preset transformation parameters. The preset transformation includes PCT transformation
值得注意的是,为减少硬件的边界情况,在一些实施例中,若待编码图像的宽度不是固定宽度的整数倍,则可以不计算最右侧宽度不满固定宽度的瓦片内像素的复杂度,或,若待编码图像的高度不是固定高度的整数倍,则可以不计算最下方高度不满固定高度的瓦片内像素的复杂度。It is worth noting that, in order to reduce the boundary conditions of the hardware, in some embodiments, if the width of the image to be encoded is not an integer multiple of the fixed width, the complexity of pixels in the tile whose width on the rightmost side is less than the fixed width may not be calculated , or, if the height of the image to be encoded is not an integer multiple of the fixed height, then the complexity of the pixels in the tile whose lowermost height is less than the fixed height may not be calculated.
在另一些实施例中,若待编码图像的宽度不是固定宽度的整数倍,则可以通过比例关系推算该待编码图像最右侧瓦片的图像复杂度,或,若待编码图像的高度不是固定高度的整数倍,则可以通过比例关系推算该待编码图像最下方瓦片的图像复杂度。In some other embodiments, if the width of the image to be encoded is not an integer multiple of the fixed width, the image complexity of the rightmost tile of the image to be encoded can be calculated through the proportional relationship, or, if the height of the image to be encoded is not fixed Integer multiples of the height, the image complexity of the bottom tile of the image to be encoded can be calculated through the proportional relationship.
如上所述,PCT处理的输入可以包括4*4像素的块,考虑到在系统级芯片(System On Chip,SOC)实现中节约硬件行缓存资源,可以将2x8的块映射为4x4的块进行输入。通过该操作可节约2行行缓存资源。As mentioned above, the input processed by PCT can include 4*4 pixel blocks. Considering the saving of hardware line cache resources in System On Chip (SOC) implementation, 2x8 blocks can be mapped to 4x4 blocks for input . This operation can save 2 lines of cache resources.
如图9所示,为本申请实施例提供的一种块的映射关系的示意图。其中,图9中的(a)为映射前的块的示意图,图9中的(b)为映射后的块的示意图。As shown in FIG. 9 , it is a schematic diagram of a block mapping relationship provided by the embodiment of the present application. Wherein, (a) in FIG. 9 is a schematic diagram of a block before mapping, and (b) in FIG. 9 is a schematic diagram of a block after mapping.
该映射关系可以理解为将第一行的后四个像素移动至第二行的下方,即第三行的位置,将第二行的后四个像素移动至第三行的下方,即第四行的位置。This mapping relationship can be understood as moving the last four pixels of the first row to the position below the second row, that is, the position of the third row, and moving the last four pixels of the second row to the bottom of the third row, that is, the position of the fourth row. row position.
可以理解是,通过上述操作仅仅涉及到像素的位置的变化,并未涉及到像素的数值的变化。It can be understood that the above operations only involve the change of the position of the pixel, but not the change of the value of the pixel.
此外,上文还指出,在一些实施例中,在按照固定宽度或固定高度对待编码图像进行划分的时候,该固定宽度或固定高度的设置与PCT处理的块所包括的像素的个数有关。In addition, it is also pointed out above that in some embodiments, when the image to be coded is divided according to a fixed width or a fixed height, the setting of the fixed width or fixed height is related to the number of pixels included in the PCT-processed block.
由于上述映射关系是将2x8的块映射为4x4的块进行输入,即映射前的块包括2行8列个像素,因此,在设置上述固定宽度的时候,可以设置为8的整数倍的数值,这样在映射瓦片的最右侧的块的时候,刚好可以被映射为4*4的块。Since the above mapping relationship is to map a 2x8 block to a 4x4 block for input, that is, the block before mapping includes 2 rows and 8 columns of pixels. Therefore, when setting the above fixed width, it can be set to a value that is an integer multiple of 8. In this way, when mapping the rightmost block of the tile, it can just be mapped as a 4*4 block.
类似地,在设置上述固定高度的时候,可以设置为2的整数倍的数值,这样在映射瓦片的最下方的块的时候,刚好也可以被映射为4*4的块。Similarly, when setting the above-mentioned fixed height, it can be set to a value that is an integer multiple of 2, so that when mapping the bottom block of the tile, it can just be mapped to a 4*4 block.
在上文的描述中,在对待编码图像按照固定宽度进行垂直划分或按照固定高度进行水平划分的时候,其最右侧瓦片的宽度可能不满足固定宽度,或最下方瓦片的高度可能不满足固定高度,在计算最右侧瓦片或最最下方瓦片的图像复杂度值的时候,可以通过下文的方式进行计算。In the above description, when the image to be coded is divided vertically according to a fixed width or horizontally divided according to a fixed height, the width of the rightmost tile may not meet the fixed width, or the height of the bottommost tile may not be Satisfying a fixed height, when calculating the image complexity value of the rightmost tile or the bottommost tile, it can be calculated in the following way.
以对待编码图像按照固定宽度进行垂直划分为例,若待编码图像被划分为n1个瓦片,最右侧瓦片(即第n1个瓦片)的宽度可能不满384。因此,可以先计算第1~n1-1个瓦片的图像复杂度值,再依据比例关系推算第n1个瓦片的图像复杂度值。Taking the vertical division of the image to be coded according to a fixed width as an example, if the image to be coded is divided into n1 tiles, the width of the rightmost tile (that is, the n1th tile) may be less than 384. Therefore, the image complexity value of the 1st to n1-1th tiles can be calculated first, and then the image complexity value of the n1th tile can be calculated according to the proportional relationship.
在将1~n1-1的瓦片内的所有2x8的块都映射并完成PCT处理后,可以将得到的瓦片内所有DC系数绝对值及除DC系数外的系数(称为LPHP系数)绝对值各自累加作为该瓦片的图像复杂度值,如式(37)、式(38)所示,式中i=1,2,3,…,n1-1。After mapping all 2x8 blocks in tiles 1 to n1-1 and completing PCT processing, the absolute values of all DC coefficients in the obtained tiles and coefficients other than DC coefficients (called LPHP coefficients) can be absolute The values are accumulated as the image complexity value of the tile, as shown in formula (37) and formula (38), where i=1, 2, 3, . . . , n1-1.
complexityDC i=∑ 2x8 blocks in tileDC coefficient    (37) complexityDC i =∑ 2x8 blocks in tile DC coefficient (37)
complexityLPHP i=∑ 2x8 blocks in tileLPHP coefficient    (38) complexityLPHP i =∑ 2x8 blocks in tile LPHP coefficient (38)
其中,complexityDC i表示第i个瓦片的DC系数的图像复杂度值, ∑ 2x8 blocks in tileDC coefficient表示第i个瓦片中的所有块的DC系数之和,complexityLPHP i表示第i个瓦片的LPHP系数的图像复杂度值,∑ 2x8 blocks in tileLPHP coefficient表示第i个瓦片的所有块的LPHP系数之和。 Among them, complexityDC i represents the image complexity value of the DC coefficient of the i-th tile, ∑ 2x8 blocks in tile DC coefficient represents the sum of the DC coefficients of all blocks in the i-th tile, and complexityLPHP i represents the i-th tile The image complexity value of the LPHP coefficient, ∑ 2x8 blocks in tile LPHP coefficient represents the sum of the LPHP coefficients of all blocks in the i-th tile.
对于最右侧不满宽度384的瓦片,其图像复杂度值可通过式(39)和式(40)计算:For the rightmost tile whose width is less than 384, its image complexity value can be calculated by formula (39) and formula (40):
complexityDC n1=complexityDC n1-1*tilewidth n1/384   (39) complexityDC n1 =complexityDC n1-1 *tilewidth n1 /384 (39)
complexityLPHP n1=complexityLPHP n1-1*tilewidth n1/384   (40) complexityLPHP n1 =complexityLPHP n1-1 *tilewidth n1 /384 (40)
其中,complexityDC n1表示最右侧瓦片的DC系数的图像复杂度值,complexityDC n1-1表示与最右侧的瓦片的左侧相邻的瓦片的DC系数的图像复杂度值,complexitLPHP n1表示最右侧瓦片的LPHP系数的图像复杂度值,complexitLPHP n1-1表示与最右侧的瓦片的左侧相邻的瓦片的LPHP系数的图像复杂度值,tilewidth n1表示最右侧的瓦片的实际宽度。 Among them, complexityDC n1 represents the image complexity value of the DC coefficient of the rightmost tile, complexityDC n1-1 represents the image complexity value of the DC coefficient of the tile adjacent to the left side of the rightmost tile, and complexitLPHP n1 Indicates the image complexity value of the LPHP coefficient of the rightmost tile, complexitLPHP n1-1 indicates the image complexity value of the LPHP coefficient of the tile adjacent to the left side of the rightmost tile, and tilewidth n1 indicates the rightmost The actual width of the tile.
如上述图7b所示,通过对待编码图像按照固定宽度384进行垂直划分,可以得到3个瓦片,分别为瓦片1、瓦片2和瓦片3。其中,瓦片1和瓦片2的宽度均为384,瓦片3的宽度小于384。As shown in FIG. 7 b above, by vertically dividing the image to be coded according to a fixed width 384 , three tiles can be obtained, namely tile 1 , tile 2 and tile 3 . Among them, the widths of tile 1 and tile 2 are both 384, and the width of tile 3 is smaller than 384.
根据上述公式(37)和(38)可以得到瓦片1和瓦片2的图像复杂度值,根据上述公式(39)和(40)可以得到瓦片3的图像复杂度值。其中,关于瓦片内的DC系数和LPHP系数已在上文进行了描述,为了简洁,这里不再赘述。The image complexity values of tile 1 and tile 2 can be obtained according to the above formulas (37) and (38), and the image complexity value of tile 3 can be obtained according to the above formulas (39) and (40). Wherein, the DC coefficient and the LPHP coefficient in the tile have been described above, and for the sake of brevity, details will not be repeated here.
假设瓦片1内的DC系数的绝对值之和为100,LPHP系数的绝对值之和为80;瓦片2内的DC系数的绝对值之和为146,LPHP系数的绝对值之和为100。即:Suppose the sum of the absolute values of the DC coefficients in tile 1 is 100, the sum of the absolute values of the LPHP coefficients is 80; the sum of the absolute values of the DC coefficients in tile 2 is 146, and the sum of the absolute values of the LPHP coefficients is 100 . which is:
(1)、瓦片1(1), tile 1
complexityDC 1=∑ 2x8 blocks in tileDC coefficient=100 complexityDC 1 =∑ 2x8 blocks in tile DC coefficient=100
complexityLPHP 1=∑ 2x8 blocks in tileLPHP coefficient=80 complexityLPHP 1 =∑ 2x8 blocks in tile LPHP coefficient=80
则瓦片1的DC系数的图像复杂度值为100,瓦片1的LPHP系数的图像复杂度值为80。Then the image complexity value of the DC coefficient of tile 1 is 100, and the image complexity value of the LPHP coefficient of tile 1 is 80.
(2)、瓦片2(2), tile 2
complexityDC 2=∑ 2x8 blocks in tileDC coefficient=146 complexityDC 2 =∑ 2x8 blocks in tile DC coefficient=146
complexityLPHP 2=∑ 2x8 blocks in tileLPHP coefficient=100 complexityLPHP 2 =∑ 2x8 blocks in tile LPHP coefficient=100
则瓦片2的DC系数的图像复杂度值为146,瓦片2的LPHP系数的图像复杂度值为100。Then the image complexity value of the DC coefficient of tile 2 is 146, and the image complexity value of the LPHP coefficient of tile 2 is 100.
(3)、瓦片3(3), tile 3
complexitDC 3=complexitDC 2*tilewidth 3/384=146*100/384=38 complexitDC 3 = complexitDC 2 * tilewidth 3 /384 = 146*100/384 = 38
complexitLPHP 3=complexitLPHP 2*tilewidth 3/384=146*100/384=26 complexitLPHP 3 = complexitLPHP 2 * tilewidth 3 /384 = 146*100/384 = 26
则瓦片3的DC系数的图像复杂度值为38,瓦片3的LPHP系数的图像复杂度值为26。Then the image complexity value of the DC coefficient of tile 3 is 38, and the image complexity value of the LPHP coefficient of tile 3 is 26.
在得到每一个瓦片的图像复杂度值后,可以根据其图像复杂度值计算每一个瓦片的目标字节数,然后再基于第i个瓦片的目标字节数的累积值更新第i个瓦片的QP。其中,关于根据其图像复杂度值计算每一个瓦片的目标字节数可以参考下文内容。After the image complexity value of each tile is obtained, the target number of bytes of each tile can be calculated according to its image complexity value, and then the i-th tile can be updated based on the cumulative value of the target number of bytes of the i-th tile QP of tiles. For calculating the target number of bytes of each tile according to its image complexity value, please refer to the following content.
本申请实施例提供的方案,通过根据待编码图像包括的第i个瓦片的目标字节数的累积值更新第i个瓦片的QP,可以保证在不牺牲码率控制精度的前提下,提高编码效率以及降低硬件资源消耗,同时可以保证量化参数的灵活性以避免输出码率不可控的问题。In the solution provided by the embodiment of the present application, by updating the QP of the i-th tile according to the cumulative value of the target number of bytes of the i-th tile included in the image to be encoded, it can be ensured that without sacrificing the accuracy of code rate control, Improve coding efficiency and reduce hardware resource consumption, while ensuring the flexibility of quantization parameters to avoid the problem of uncontrollable output code rate.
可选地,在一些实施例中,所述根据所述第i个瓦片的目标字节数的累积值更新所述第i个瓦片的QP,包括:根据第一差值的绝对值与第一阈值更新所述第i个瓦片的QP,所述第一差值为所述第i个瓦片的目标字节数的累积值与所述第i个瓦片的实际编码字节数的累积值的差值。Optionally, in some embodiments, the updating the QP of the i-th tile according to the cumulative value of the target number of bytes of the i-th tile includes: according to the absolute value of the first difference and The first threshold updates the QP of the ith tile, and the first difference is the cumulative value of the target number of bytes of the ith tile and the actual number of encoded bytes of the ith tile The difference between the accumulated values of .
类似地,本申请实施例中的第i个瓦片的实际编码字节数的累积值可以是指前i个瓦片(包括第i个瓦片)的所有瓦片的实际编码字节数。Similarly, the cumulative value of the actual number of encoded bytes of the i-th tile in this embodiment of the present application may refer to the actual number of encoded bytes of all tiles in the previous i-th tile (including the i-th tile).
例如,第2个瓦片的实际编码字节数的累积值可以是指第1个瓦片的实际编码字节数与第2个瓦片的实际编码字节数的和;第5个瓦片的实际编码字节数可以是指第1个瓦片的实际编码字节数、第2个瓦片的实际编码字节数、第3个瓦片的实际编码字节数、第4个瓦片的实际编码字节数以及第5个瓦片的实际编码字节数的和;以此类推,第n1个瓦片的实际编码字节数的累积值可以是指第1个瓦片的实际编码字节数、第2个瓦片的实际编码字节数……、第n1-1个瓦片的实际编码字节数以及第n1个瓦片的实际编码字节数的和。For example, the cumulative value of the actual number of encoded bytes of the second tile may refer to the sum of the actual number of encoded bytes of the first tile and the actual number of encoded bytes of the second tile; The actual number of encoded bytes can refer to the actual number of encoded bytes of the first tile, the actual number of encoded bytes of the second tile, the actual number of encoded bytes of the third tile, the actual number of encoded bytes of the fourth tile The sum of the actual number of encoded bytes and the actual number of encoded bytes of the fifth tile; and so on, the cumulative value of the actual number of encoded bytes of the n1th tile can refer to the actual encoding of the first tile The sum of the number of bytes, the actual number of encoded bytes of the second tile..., the actual number of encoded bytes of the n1-1th tile, and the actual number of encoded bytes of the n1th tile.
本申请实施例中的第i个瓦片的实际编码字节数可以通过编码器在对待编码图像进行编码的过程中获得。In the embodiment of the present application, the actual number of encoded bytes of the i-th tile can be obtained by the encoder during the process of encoding the image to be encoded.
本申请实施例中的第一阈值可以固定的,也可以是不断调整的,本申请对此不作具体限定。The first threshold in the embodiment of the present application may be fixed or continuously adjusted, which is not specifically limited in the present application.
本申请实施例中,编码器可以以瓦片为单位进行编码,在图像编码开始 前,可以根据图像原始大小和当前帧的目标字节数计算第一个瓦片的初始QP 0,此后在编码当前瓦片的QP时,可以根据当前瓦片的目标字节数的累积值与实际编码字节数的累积值的差值来更新当前瓦片的QP。 In the embodiment of this application, the encoder can encode in units of tiles. Before the start of image encoding, the initial QP 0 of the first tile can be calculated according to the original size of the image and the target number of bytes of the current frame. For the QP of the current tile, the QP of the current tile may be updated according to the difference between the cumulative value of the target byte number of the current tile and the cumulative value of the actual coded byte number.
关于当前帧的目标字节数以及各瓦片目标字节数的计算如下文所示。The calculation of the target byte count of the current frame and the target byte count of each tile is as follows.
a、当前帧的目标字节数的计算可以通过式(41)进行计算a. The calculation of the target number of bytes of the current frame can be calculated by formula (41)
Figure PCTCN2021098383-appb-000002
Figure PCTCN2021098383-appb-000002
其中,t arg etByte表示图像(即为本申请实施例中的当前帧)的目标字节数,width表示图像的宽度,height表示图像的高度,bitdepth表示图像的位深,m表示所有像素点个数与亮度像素点个数比例(如编码YUV422格式图像时n值为2),compressRatio表示图像压缩比。Wherein, targetByte represents the target number of bytes of the image (being the current frame in the embodiment of the present application), width represents the width of the image, height represents the height of the image, bitdepth represents the bit depth of the image, and m represents the number of all pixels The ratio of the number to the number of brightness pixels (for example, when encoding a YUV422 format image, the value of n is 2), and compressRatio indicates the image compression ratio.
b、各瓦片的目标字节数的计算可以通过式(42)进行计算b. The calculation of the target number of bytes of each tile can be calculated by formula (42)
Figure PCTCN2021098383-appb-000003
Figure PCTCN2021098383-appb-000003
其中,n表示当前图像总共分为的瓦片的个数,i表示第i个瓦片,t arg etByte i表示第i个瓦片的目标字节数,complexityLPHP i表示第i个瓦片对应的LPHP系数的图像复杂度,
Figure PCTCN2021098383-appb-000004
表示当前帧中的所有瓦片的LPHP系数的图像复杂度的和。
Among them, n represents the number of tiles that the current image is divided into, i represents the i-th tile, t arg etByte i represents the target byte number of the i-th tile, and complexityLPHP i represents the number of bytes corresponding to the i-th tile. Image complexity of LPHP coefficients,
Figure PCTCN2021098383-appb-000004
Represents the sum of the image complexity of the LPHP coefficients of all tiles in the current frame.
值得注意的是,本实施例中使用的并不是全部的图像复杂度信息,这是基于先验数据得到的指导信息。例如,下文中根据图像复杂度信息计算各个瓦片的Qp均是基于LPHP系数的图像复杂度值进行计算的。It should be noted that not all image complexity information is used in this embodiment, which is guidance information obtained based on prior data. For example, the calculation of the Qp of each tile according to the image complexity information in the following is calculated based on the image complexity value of the LPHP coefficient.
继续以上述图7b为例进行说明,假设图像的高度为100,位深为8,压缩比为200,编码格式为YUV422,则当前帧的目标字节数为:Continuing to take the above figure 7b as an example, assuming that the height of the image is 100, the bit depth is 8, the compression ratio is 200, and the encoding format is YUV422, then the target number of bytes of the current frame is:
Figure PCTCN2021098383-appb-000005
Figure PCTCN2021098383-appb-000005
各瓦片的目标字节数为:The target byte count for each tile is:
Figure PCTCN2021098383-appb-000006
Figure PCTCN2021098383-appb-000006
Figure PCTCN2021098383-appb-000007
Figure PCTCN2021098383-appb-000007
Figure PCTCN2021098383-appb-000008
Figure PCTCN2021098383-appb-000008
在得到每一个瓦片的目标字节数后,可以先计算每一个瓦片的目标字节数的累积值与实际编码字节数的累积值的差值,然后再基于获得的差值更新 或计算每一个瓦片的QP。After obtaining the target number of bytes for each tile, you can first calculate the difference between the cumulative value of the target number of bytes for each tile and the cumulative value of the actual number of encoded bytes, and then update or Calculate the QP of each tile.
本申请实施例中第一阈值可以包括多个阈值,例如,可以包括两个阈值,该阈值可以通过式(43)和式(44)进行计算。In this embodiment of the present application, the first threshold may include multiple thresholds, for example, may include two thresholds, and the threshold may be calculated by using formula (43) and formula (44).
Figure PCTCN2021098383-appb-000009
Figure PCTCN2021098383-appb-000009
Figure PCTCN2021098383-appb-000010
Figure PCTCN2021098383-appb-000010
其中,t arg etByte表示图像(即为本申请实施例中的当前帧)的目标字节数,n表示表示当前待编码图像总共分为的瓦片的个数,threhold1和threhold2表示阈值1和阈值2,alpha、beta为预设参数,一种设置方法可以设置为alpha=4,beta=16。Wherein, targetByte represents the target number of bytes of the image (that is, the current frame in the embodiment of the present application), n represents the number of tiles that represent the current image to be encoded, and threshold1 and threshold2 represent threshold 1 and threshold 2. alpha and beta are preset parameters, and one setting method can be alpha=4, beta=16.
此外,上文还指出可以先计算第一个瓦片的初始QP 0,再基于该初始QP 0更新或计算各个瓦片的QP。 In addition, it is also pointed out above that the initial QP 0 of the first tile can be calculated first, and then the QP of each tile can be updated or calculated based on the initial QP 0 .
因为图像复杂度可以表征原始图像内容的信息量,目标字节数代表压缩后的信息量,所以通过结合复杂度和目标字节数建立数学模型计算表征压缩程度的参数QP是合理有效的。同时为了将复杂度与目标字节数的幅度范围拉近,在计算QP时会将二者转换到对数域进行计算。Because image complexity can represent the amount of information in the original image content, and the target number of bytes represents the amount of information after compression, it is reasonable and effective to calculate the parameter QP that characterizes the degree of compression by combining complexity and target number of bytes to establish a mathematical model. At the same time, in order to narrow the complexity and the range of the target number of bytes, the two will be converted to the logarithmic domain for calculation when calculating QP.
初始的QP计算可以通过式(45)至式(49)进行计算。本实施例中式(45)将字节数归一化到每个像素的数据量bpp,并将其转换到对数域。The initial QP calculation can be calculated by formula (45) to formula (49). The formula (45) in this embodiment normalizes the number of bytes to the data volume bpp of each pixel, and converts it to the logarithmic domain.
log(bpp)=log(t arg etByte/(width*height))   (45)log(bpp)=log(t arg etByte/(width*height)) (45)
其中,式中log表示以自然对数为底的对数,log10是以10为底的对数。式(46)、式(47)将复杂度转换到对数域,由于压缩是非线性过程,因此在建立数学模型的过程中会将复杂度进一步转换为bpp的乘性关系算子式(46)和加性关系算子式(47)以提高数学模型的吻合度。Among them, log in the formula means the logarithm with the natural logarithm as the base, and log10 means the logarithm with the base 10. Equation (46) and Equation (47) transform the complexity into the logarithmic domain. Since compression is a nonlinear process, the complexity will be further converted into bpp multiplicative relational operator Equation (46) in the process of establishing the mathematical model and the additive relationship operator formula (47) to improve the fit of the mathematical model.
Figure PCTCN2021098383-appb-000011
Figure PCTCN2021098383-appb-000011
Figure PCTCN2021098383-appb-000012
Figure PCTCN2021098383-appb-000012
其中,paramA、paramB、paramC、paramD为预设的参数,一种典型的来自先验知识的配置可以为paramA=0.02213,paramB=-24.32,paramC=30.45,paramD=-76.78。Wherein, paramA, paramB, paramC, and paramD are preset parameters, and a typical configuration from prior knowledge may be paramA=0.02213, paramB=-24.32, paramC=30.45, and paramD=-76.78.
本实施例中用复杂度的乘性算子、加性算子、log(bpp)和变量参数x、y建立的公式(48)求得QP。In this embodiment, QP is obtained by formula (48) established by multiplicative operator, additive operator, log(bpp) and variable parameters x and y of complexity.
QP=x*log(bpp)+y+z   (48)QP=x*log(bpp)+y+z (48)
其中,式中z为变量参数,在后文中可以被更新,初始值可以设置为0。Among them, z in the formula is a variable parameter, which can be updated later, and the initial value can be set to 0.
QP 0=Cilp3(min QP,max QP,QP)   (49) QP 0 = Cilp3(min QP, max QP, QP) (49)
其中,式中QP 0为最终确定的初始QP,minQP和maxQP分别为QP的最小值和最大值,minQP可以不小于0,maxQP可以不大于255。一组典型的配置可以为min QP=5,max QP=150。 Wherein, QP 0 in the formula is the final determined initial QP, minQP and maxQP are the minimum value and maximum value of QP respectively, minQP may not be less than 0, and maxQP may not be greater than 255. A typical set of configurations might be min QP=5, max QP=150.
需要说明的是,上述式(49)表示的含义是QP 0可以为括号中的任意一个值。若通过上述式(18)计算得到的QP在minQP和maxQP之间,则QP 0为QP;若通过上述式(18)计算得到的QP小于minQP,则QP 0为minQP;若通过上述式(18)计算得到的QP大于maxQP,则QP 0为maxQP。 It should be noted that the above formula (49) means that QP 0 can be any value in the brackets. If the QP calculated by the above formula (18) is between minQP and maxQP, then QP 0 is QP; if the QP calculated by the above formula (18) is less than minQP, then QP 0 is minQP; if by the above formula (18 ) calculated QP is greater than maxQP, then QP 0 is maxQP.
继续以上述图7b为例,如上所述,待编码图像的宽度和高度分别为868和100,则log(bpp)=log(t arg etByte/(width*height))=log(868(868*100))=0.01Continue taking the above-mentioned Fig. 7b as an example, as mentioned above, the width and height of the image to be encoded are 868 and 100 respectively, then log(bpp)=log(t arg etByte/(width*height))=log(868(868* 100)) = 0.01
Figure PCTCN2021098383-appb-000013
Figure PCTCN2021098383-appb-000013
Figure PCTCN2021098383-appb-000014
Figure PCTCN2021098383-appb-000014
QP=x*log(bpp)+y+z=147.47QP=x*log(bpp)+y+z=147.47
QP 0=Cilp3(5,150,147.47) QP0 = Cilp3(5, 150, 147.47)
则可以得到确定的初始QP 0为147.47。 Then it can be obtained that the determined initial QP 0 is 147.47.
在后续编码过程中,可以基于确定的初始QP 0更新当前帧中的瓦片1的QP,再基于更新后的瓦片1的QP计算瓦片2的QP,最后基于瓦片2的QP计算瓦片3的QP。 In the subsequent encoding process, the QP of tile 1 in the current frame can be updated based on the determined initial QP 0 , then the QP of tile 2 can be calculated based on the updated QP of tile 1, and finally the tile can be calculated based on the QP of tile 2 QP for slice 3.
本申请实施例提供的方案,通过根据第一差值的绝对值与第一阈值更新待编码图像所包括的瓦片的QP,可以进一步保证在不牺牲码率控制精度的前提下,提高编码效率以及降低硬件资源消耗,同时可以保证量化参数的灵活性以避免输出码率不可控的问题。In the solution provided by the embodiment of the present application, by updating the QP of the tile included in the image to be encoded according to the absolute value of the first difference and the first threshold, it can further ensure that the coding efficiency is improved without sacrificing the accuracy of the code rate control And reduce the consumption of hardware resources, while ensuring the flexibility of quantization parameters to avoid the problem of uncontrollable output code rate.
上文说明了编码端可以根据第一差值的绝对值与第一阈值更新第i个瓦片的QP,下文将对其进行详细说明。It has been explained above that the encoding end can update the QP of the i-th tile according to the absolute value of the first difference and the first threshold, which will be described in detail below.
可选地,在一些实施例中,所述根据第一差值的绝对值与第一阈值更新所述第i个瓦片的QP,包括:若所述第一差值为正值,将第i-1个瓦片的QP与第一偏移QP的差值作为所述第i个瓦片的QP;若所述第一差值为负值,将所述第i-1个瓦片的QP与所述第一偏移QP的和作为所述第i个瓦片的QP;其中,所述第一偏移QP是基于所述第一差值的绝对值和所述第一阈值得到的。Optionally, in some embodiments, the updating the QP of the ith tile according to the absolute value of the first difference and the first threshold includes: if the first difference is positive, setting The difference between the QP of the i-1 tile and the first offset QP is used as the QP of the i-th tile; if the first difference is negative, the i-1 tile’s The sum of QP and the first offset QP is used as the QP of the ith tile; wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold .
本申请实施例中,可以结合第一差值的正负来更新待编码图像的第i个瓦片的QP。In the embodiment of the present application, the QP of the ith tile of the image to be encoded may be updated in combination with the sign of the first difference.
若当前已编码至第i个瓦片,此时第i个瓦片的目标字节数的累积值及实际编码字节数的累积值可以根据式(50)、式(51)计算。If the i-th tile is currently encoded, the cumulative value of the target number of bytes and the cumulative value of the actual number of encoded bytes of the i-th tile can be calculated according to formula (50) and formula (51).
Figure PCTCN2021098383-appb-000015
Figure PCTCN2021098383-appb-000015
Figure PCTCN2021098383-appb-000016
Figure PCTCN2021098383-appb-000016
其中,accTarBytes i表示第i个瓦片的目标字节数的累积值,
Figure PCTCN2021098383-appb-000017
表示前i个瓦片(包括第i个瓦片)的所有瓦片的目标字节数的和,accActBytes i表示第i个瓦的实际编码字节数的累积值,
Figure PCTCN2021098383-appb-000018
表示前i个瓦片(包括第i个瓦片)的所有瓦片的实际编码字节数的和。
Among them, accTarBytes i represents the cumulative value of the target number of bytes of the i-th tile,
Figure PCTCN2021098383-appb-000017
Indicates the sum of the target bytes of all tiles in the first i tile (including the i-th tile), accActBytes i indicates the cumulative value of the actual coded bytes of the i-th tile,
Figure PCTCN2021098383-appb-000018
Indicates the sum of the actual number of encoded bytes of all tiles in the first i tile (including the i-th tile).
根据式(50)和式(51)计算第一差值,如式(52)所示,并通过式(53)和式(54)得到QP的偏移值。The first difference is calculated according to formula (50) and formula (51), as shown in formula (52), and the offset value of QP is obtained through formula (53) and formula (54).
deltaBytes i=accTarBytes i-accActBytes i   (52) deltaBytes i =accTarBytes i -accActBytes i (52)
QPoffset i=|deltaBytes i|>threhold1?offsetA:offsetB   (53) QPoffset i =|deltaBytes i |>threhold1? offsetA: offsetB (53)
offsetB=|deltaBytes i|>threhold2?1:0   (54) offsetB=|deltaBytes i |>threhold2?1:0 (54)
其中,deltaBytes i表示第i个瓦片的目标字节数的累积值与实际编码字节数的累积值的差值,即第一差值,QPoffset i表示第i个瓦片的QP的偏移值,offsetA为预设参数,可以设置为2。 Among them, deltaBytes i represents the difference between the cumulative value of the target number of bytes of the i-th tile and the cumulative value of the actual number of encoded bytes, that is, the first difference, and QPoffset i represents the offset of the QP of the i-th tile value, offsetA is a preset parameter and can be set to 2.
式(53)表示的含义为:若当前编码的第i个瓦片的目标字节数的累积值与实际编码字节数的累积值的差值的绝对值|deltaBytes i|大于预设阈值threhold1,则当前编码的第i个瓦片的QP的偏移值QPoffset i可以取值为offsetA,否则取值为offsetB。 The meaning expressed by formula (53) is: if the absolute value |deltaBytes i | , then the offset value QPoffset i of the QP of the i-th tile currently encoded can be offsetA, otherwise it can be offsetB.
类似地,式(54)表示的含义为:若当前编码的第i个瓦片的目标字节数的累积值与实际编码字节数的累积值的差值的绝对值|deltaBytes i|大于预设阈值threhold2,则当前编码的第i个瓦片的QP的偏移值QPoffset i可以取值为1,否则取值为0。 Similarly, the meaning expressed by formula (54) is: if the absolute value |deltaBytes i | If the threshold threshold2 is set, the QP offset value QPoffset i of the QP of the i-th tile currently encoded can take a value of 1, otherwise it takes a value of 0.
进一步更新第i个瓦片使用的QP,QP的范围仍然可以在[min QP,max QP]之间。可以根据式(55)更新第i个瓦片的QP。Further update the QP used by the i-th tile, the range of QP can still be between [min QP, max QP]. The QP of the ith tile can be updated according to equation (55).
QP i=QP i-1-sign(deltaBytes i)*QPoffset i   (55) QP i =QP i-1 -sign(deltaBytes i )*QPoffset i (55)
QP i=Cilp3(min QP,max QP,QP i)   (56) QP i =Cilp3(min QP, max QP, QP i ) (56)
其中,QP i表示第i个瓦片的QP,QP i-1表示第i-1个瓦片的QP,sign(deltaBytes i)表示取deltaBytes i的符号。 Among them, QP i represents the QP of the i-th tile, QP i-1 represents the QP of the i-1-th tile, and sign(deltaBytes i ) represents the sign of deltaBytes i .
继续以上述图7b为例进行说明,分别更新或计算瓦片1、瓦片2和瓦片3的QP。Continuing to take the above-mentioned FIG. 7b as an example for description, the QPs of tile 1, tile 2, and tile 3 are updated or calculated respectively.
a、瓦片1的QP的计算a. Calculation of QP of tile 1
首先,可以先根据上述式(43)和式(44)分别计算预设阈值1(threhold1)和预设阈值2(threhold2)。假设alpha=4,beta=16,则:First, the preset threshold 1 (threhold1) and the preset threshold 2 (threhold2) can be calculated respectively according to the above formula (43) and formula (44). Suppose alpha=4, beta=16, then:
Figure PCTCN2021098383-appb-000019
Figure PCTCN2021098383-appb-000019
Figure PCTCN2021098383-appb-000020
Figure PCTCN2021098383-appb-000020
其次,如上所述,瓦片1的目标字节数为337,假设瓦片1的实际编码字节数为300,则通过式(52)可以得到瓦片1的目标字节数与实际编码字节数的差值为deltaBytes 1=accTarBytes 1-accActBytes 1=337-300=37。 Secondly, as mentioned above, the target number of bytes of tile 1 is 337, assuming that the actual number of encoded bytes of tile 1 is 300, then the target number of bytes of tile 1 and the actual number of encoded bytes can be obtained by formula (52). The difference in the number of sections is deltaBytes 1 =accTarBytes 1 -accActBytes 1 =337-300=37.
根据式(53)和式(54)计算瓦片1的QP的偏移值,由于瓦片1的目标字节数与实际编码字节数的差值为37,大于预设阈值2,因此,瓦片1的QP的偏移值为1。Calculate the QP offset value of tile 1 according to formula (53) and formula (54). Since the difference between the target number of bytes of tile 1 and the actual number of encoded bytes is 37, which is greater than the preset threshold 2, therefore, The QP of tile 1 has an offset value of 1.
则可以根据上述瓦片1的QP的偏移值和第一差值的绝对值更新瓦片1的QP1为:QP 1=QP 0-sign(deltaBytes 1)*QPoffset 1=147.47-1=146.47 Then QP1 of tile 1 can be updated according to the offset value of QP of tile 1 and the absolute value of the first difference: QP 1 =QP 0 -sign(deltaBytes 1 )*QPoffset 1 =147.47-1=146.47
b、瓦片2的QP的计算b. Calculation of QP of tile 2
如上所述,瓦片2的目标字节数为421,假设瓦片2的实际编码字节数为470,则瓦片2的目标字节数的累积值为瓦片1的目标字节数与瓦片2的目标字节数的和,即为421+337=758;瓦片2的实际编码字节数的累积值为瓦片1的实际编码字节数与瓦片2的实际编码字节数的和,即为300+470=770。As mentioned above, the target byte count of tile 2 is 421, assuming that the actual encoded byte count of tile 2 is 470, the cumulative value of the target byte count of tile 2 is the same as the target byte count of tile 1 The sum of the target bytes of tile 2 is 421+337=758; the cumulative value of the actual encoded bytes of tile 2 is the actual encoded bytes of tile 1 and the actual encoded bytes of tile 2 The sum of the numbers is 300+470=770.
则通过式(52)可以得到瓦片2的目标字节数累积值与实际编码字节数累积值的差值为deltaBytes 2=accTarBytes 2-accActBytes 2=758-770=-12。 Then, the difference between the cumulative target byte count and the actual coded byte count of tile 2 can be obtained by formula (52) as deltaBytes 2 =accTarBytes 2 -accActBytes 2 =758-770=-12.
根据式(53)和式(54)计算瓦片2的QP的偏移值,由于瓦片2的目标字节数的累积值与实际编码字节数的累积值的差值为-12,其绝对值为12,小于预设阈值2,因此,瓦片2的QP的偏移值为0。Calculate the QP offset value of tile 2 according to formula (53) and formula (54). Since the difference between the cumulative value of the target byte number of tile 2 and the cumulative value of the actual coded byte number is -12, it The absolute value is 12, which is smaller than the preset threshold value 2. Therefore, the offset value of the QP of tile 2 is 0.
则可以根据上述瓦片2的QP的偏移值和第一差值的绝对值更新瓦片2的QP2为:QP 2=QP 1-sign(deltaBytes 2)*QPoffset 2=146.47-0=146.47 Then QP2 of tile 2 can be updated according to the offset value of QP of tile 2 and the absolute value of the first difference: QP 2 =QP 1 -sign(deltaBytes 2 )*QPoffset 2 =146.47-0=146.47
c、瓦片3的QP的计算c. Calculation of QP of tile 3
如上所述,瓦片3的目标字节数为109.5,假设瓦片3的实际编码字节数为50,则瓦片3的目标字节数的累积值为瓦片1的目标字节数与瓦片2 的目标字节数以及瓦片3的目标字节数的和,即为421+337+109.5=867.5;瓦片3的实际编码字节数的累积值为瓦片1的实际编码字节数与瓦片2的实际编码字节数以及瓦片3的实际编码字节数的和,即为300+470+50=820。As mentioned above, the target byte count of tile 3 is 109.5, assuming that the actual encoded byte count of tile 3 is 50, the cumulative value of the target byte count of tile 3 is the same as the target byte count of tile 1 The sum of the target byte count of tile 2 and the target byte count of tile 3 is 421+337+109.5=867.5; the cumulative value of the actual coded byte count of tile 3 is the actual coded word of tile 1 The sum of the number of sections, the actual number of encoded bytes of tile 2 and the actual number of encoded bytes of tile 3 is 300+470+50=820.
则通过式(52)可以得到瓦片3的目标字节数累积值与实际编码字节数累积值的差值为deltaBytes 3=accTarBytes 3-accActBytes 3=867.5-820=47.5。 Then, the difference between the cumulative target byte count and the actual coded byte count of tile 3 can be obtained by formula (52) as deltaBytes 3 =accTarBytes 3 -accActBytes 3 =867.5-820=47.5.
根据式(53)和式(54)计算瓦片3的QP的偏移值,由于瓦片3的目标字节数的累积值与实际编码字节数的累积值的差值为47.5,大于预设阈值2,因此,瓦片3的QP的偏移值为1。Calculate the QP offset value of tile 3 according to formula (53) and formula (54), because the difference between the cumulative value of the target byte number of tile 3 and the cumulative value of the actual coded byte number is 47.5, which is greater than the expected Set the threshold to 2, therefore, the offset value of the QP of tile 3 is 1.
则可以根据上述瓦片3的QP的偏移值和第一差值的绝对值更新瓦片3的QP3为:QP 3=QP 2-sign(deltaBytes 3)*QPoffset 3=146.47-1=145.47 Then QP3 of tile 3 can be updated according to the offset value of QP of tile 3 and the absolute value of the first difference: QP 3 =QP 2 -sign(deltaBytes 3 )*QPoffset 3 =146.47-1=145.47
可选地,在一些实施例中,所述第i个瓦片的目标字节数与第一信息有关;所述第一信息为以下信息中的至少一个:所述当前帧的目标字节数、所述第i个瓦片的变换系数或所述当前帧的变换系数。Optionally, in some embodiments, the target number of bytes of the i-th tile is related to first information; the first information is at least one of the following information: the target number of bytes of the current frame , the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
可选地,在一些实施例中,所述当前帧的目标字节数与第二信息有关;所述第二信息为以下信息中的至少一种:所述当前帧的宽度、所述当前帧的高度、所述当前帧的位深、所述当前帧的编码格式或所述当前帧的图像压缩比。Optionally, in some embodiments, the target byte count of the current frame is related to second information; the second information is at least one of the following information: width of the current frame, width of the current frame The height of the current frame, the bit depth of the current frame, the coding format of the current frame or the image compression ratio of the current frame.
本申请实施例中,第i个瓦片的目标字节数可以与当前帧的目标字节数、第i个瓦片的变换系数或当前帧的变换系数有关。例如,第i个瓦片的目标字节数可以通过上述式(42)进行计算,具体内容可以参考上述式(42)的说明,为了简洁,这里不再赘述。In this embodiment of the present application, the target number of bytes of the i-th tile may be related to the target number of bytes of the current frame, the transformation coefficient of the i-th tile, or the transformation coefficient of the current frame. For example, the target number of bytes of the i-th tile can be calculated by the above formula (42). For specific content, please refer to the description of the above formula (42). For the sake of brevity, details will not be repeated here.
本申请实施例中,当前帧的目标字节数可以与当前帧的宽度、当前帧的高度、当前帧的位深、当前帧的编码格式或当前帧的图像压缩比有关。例如,当前帧的目标字节数可以通过上述上述式(41)进行计算,具体内容可以参考上述式(41)的说明,为了简洁,这里不再赘述。In this embodiment of the present application, the target number of bytes of the current frame may be related to the width of the current frame, the height of the current frame, the bit depth of the current frame, the encoding format of the current frame, or the image compression ratio of the current frame. For example, the target number of bytes of the current frame can be calculated by the above-mentioned formula (41), and the specific content can refer to the description of the above-mentioned formula (41), for the sake of brevity, no more details are given here.
基于此,上文说明了当前帧的n1个瓦片的QP的计算,下文将说明目标帧中的瓦片的QP的计算,具体请参见下文。Based on this, the calculation of the QP of n1 tiles in the current frame is described above, and the calculation of the QP of the tiles in the target frame will be described below, please refer to the following for details.
可选地,在一些实施例中,所述方法还包括:根据第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP。Optionally, in some embodiments, the method further includes: updating the n2 tiles in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold The QP of the slice.
其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编 码字节数的差值,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数,n2为大于或等于2的正整数。Wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame, and the target frame is the first x frames and/or the last x frames of the current frame y frame, x and y are positive integers greater than or equal to 1, and n2 is a positive integer greater than or equal to 2.
本申请实施例中,可以根据第二差值的绝对值与当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP。In the embodiment of the present application, the QPs of n2 tiles in the target frame may be updated according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold.
本申请实施例中,若当前编码方法为前向预测,则目标帧帧可以为当前帧的前x帧;若当前编码方法为后向预测,则目标帧可以为当前帧的后y帧;若当前编码方法为双向预测,则目标帧可以为当前帧的前x帧和后y帧。In the embodiment of the present application, if the current encoding method is forward prediction, the target frame may be the previous x frames of the current frame; if the current encoding method is backward prediction, the target frame may be the last y frames of the current frame; if If the current encoding method is bidirectional prediction, the target frame may be the previous x frame and the next y frame of the current frame.
类似地,与上述当前帧的划分方式类似,本申请实施例中,在对待编码图像(目标帧)进行划分的时候,可以按照固定宽度或固定高度对待编码图像进行划分,也可以不按照固定宽度或固定高度对待编码图像进行划分;不予限制。Similarly, similar to the division method of the above-mentioned current frame, in the embodiment of the present application, when dividing the image to be encoded (target frame), the image to be encoded may be divided according to a fixed width or a fixed height, or may not be divided according to a fixed width Or divide the image to be coded with a fixed height; there is no limit.
本申请实施例中,可以对编码图像进行水平划分,也可以对待编码图像进行垂直划分。In the embodiment of the present application, the coded image may be divided horizontally, or the image to be coded may be divided vertically.
应理解,本申请实施例中的n2可以与上文中的n1相同,也可以不同,本申请对此不作具体限定。It should be understood that n2 in this embodiment of the present application may be the same as or different from n1 above, which is not specifically limited in this application.
本申请实施例提供的方案,通过第二差值(当前帧的目标字节数与实际编码字节数的差值)与当前帧的目标字节数的比值,更新目标帧包括的瓦片的QP,可以进一步提高编码效率,同时可以保证量化参数的灵活性以避免输出码率不可控的问题。In the solution provided by the embodiment of the present application, the ratio of the second difference (the difference between the target number of bytes of the current frame and the actual number of encoded bytes) to the target number of bytes of the current frame is used to update the number of tiles included in the target frame. QP can further improve the coding efficiency, and at the same time, it can ensure the flexibility of quantization parameters to avoid the problem of uncontrollable output code rate.
可选地,在一些实施例中,所述根据第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP,包括:Optionally, in some embodiments, updating the QP of n2 tiles in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of a second threshold, include:
若所述第二差值为正值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的差值作为更新后的第一参数;根据更新后的第一参数计算所述n2个瓦片的QP;If the second difference is a positive value, the difference between the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter; according to the updated first parameter Calculate the QP of the n2 tiles;
或,or,
若所述第二差值为负值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的和作为更新后的第一参数;根据更新后的第一参数计算所述n2个瓦片的QP。If the second difference is a negative value, the sum of the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter; calculated according to the updated first parameter QP of the n2 tiles.
本申请实施例中,更新目标帧的n2个瓦片的QP可以先获得目标帧的第一个瓦片的初始QP0,可以先通过以下方式更新上述式(48)中的参数z,然后基于更新后的参数z(即为本申请中的第一参数)计算目标帧的初始QP 0In the embodiment of the present application, to update the QP of the n2 tiles of the target frame, the initial QP0 of the first tile of the target frame can be obtained first, and the parameter z in the above formula (48) can be updated in the following way, and then based on the update The last parameter z (namely the first parameter in this application) calculates the initial QP 0 of the target frame.
首先,可以通过式(57)计算当前帧的实际编码的字节数。First, the actual number of encoded bytes of the current frame can be calculated by formula (57).
Figure PCTCN2021098383-appb-000021
Figure PCTCN2021098383-appb-000021
其中,accActBytes n1表示当前帧的实际编码的字节数,n1表示当前帧划分的瓦片的个数。 Among them, accActBytes n1 represents the actual number of encoded bytes of the current frame, and n1 represents the number of tiles divided by the current frame.
根据式(58)计算该当前帧的目标字节数与实际编码的字节数的差值。Calculate the difference between the target byte number of the current frame and the actual coded byte number according to formula (58).
deltaBytes n1=t arg etByte n1-accActBytes n1   (58) deltaBytes n1 = t arg etByte n1 -accActBytes n1 (58)
其中,deltaBytes n1表示当前帧的目标字节数与实际编码字节数的差值,t arg etByte n1表示当前帧的目标字节数,accActBytes n1表示当前帧的实际编码字节数。 Among them, deltaBytes n1 indicates the difference between the target number of bytes of the current frame and the actual number of encoded bytes, targ etByte n1 indicates the target number of bytes of the current frame, and accActBytes n1 indicates the actual number of encoded bytes of the current frame.
根据式(59)-式(61)确定更新的参数z。The updated parameter z is determined according to Equation (59)-Equation (61).
Figure PCTCN2021098383-appb-000022
Figure PCTCN2021098383-appb-000022
Figure PCTCN2021098383-appb-000023
Figure PCTCN2021098383-appb-000023
Figure PCTCN2021098383-appb-000024
Figure PCTCN2021098383-appb-000024
其中,delta z表示参数z更新前后的差值,上述式(59)-式(61)中的deltaThres0、deltaThres1、deltaThres2为预设的门限系数,例如,可以预设置为deltaThres0=0.02、deltaThres1=0.05、deltaThres2=0.1;tmpOffset1、tmpOffset2为临时变量。Wherein, delta z represents the difference before and after the update of parameter z, and deltaThres0, deltaThres1, deltaThres2 in the above-mentioned formula (59) - formula (61) are preset threshold coefficients, for example, can be preset as deltaThres0=0.02, deltaThres1=0.05 , deltaThres2=0.1; tmpOffset1 and tmpOffset2 are temporary variables.
式(60)和式(61)中的deltaOffset1、deltaOffset2、deltaOffset3为预设的偏移值,例如,可以预设置为deltaOffset1=1、deltaOffset2=2、deltaOffset3=3。deltaOffset1, deltaOffset2, and deltaOffset3 in formula (60) and formula (61) are preset offset values, for example, deltaOffset1=1, deltaOffset2=2, deltaOffset3=3 can be preset.
在得到delta z后,可以基于式(62)计算更新的参数z。After getting delta z, the updated parameter z can be calculated based on formula (62).
z new=z-sign(deltaBytes n1)*delta z   (62) z new = z-sign(deltaBytes n1 )*delta z (62)
其中,z new表示更新后的参数z的值,z表示更新前的参数z的值,sign(deltaBytes n)表示取deltaBytes n的符号。 Among them, z new represents the value of the parameter z after the update, z represents the value of the parameter z before the update, and sign(deltaBytes n ) represents the sign of deltaBytes n .
仍然以上述图7b为例进行说明,更新上述参数z。Still taking the above-mentioned FIG. 7b as an example for description, the above-mentioned parameter z is updated.
通过上述式(57)可以得到该当前帧的实际编码的字节数可以为:
Figure PCTCN2021098383-appb-000025
如上所述,该当前帧的目标字节数为867.5。
The actual encoded byte count of the current frame can be obtained by the above formula (57):
Figure PCTCN2021098383-appb-000025
As mentioned above, the target byte count for this current frame is 867.5.
则通过上述式(58)可以得到,该当前帧的目标字节数与实际编码字节数的差值为:deltaBytes 3=t arg etByte 3-accActBytes 3=867.5-820=47.5。 Then it can be obtained through the above formula (58), that the difference between the target byte number and the actual coded byte number of the current frame is: deltaBytes 3 =t arg etByte 3 -accActBytes 3 =867.5-820=47.5.
在获得当前帧的目标字节数与实际编码的字节数的差值后,可以先通过 式(59)计算,上述差值的绝对值与该当前帧的目标字节数的比值为47.5/867.5=0.05,由于该比值0.05大于差值预设门限系数0(deltaThres0=0.02),则delta z=tmpOffset1,进一步地,可以根据式(60)来计算,该比值0.05等于差值预设门限系数1(deltaThres1=0.05),则delta z=tmpOffset2;进一步地,可以根据式(61)来计算,该比值0.05小于差值预设门限系数2(deltaThres2=0.1),则delta z=deltaOffset2,若deltaOffset2=2,则参数z更新前后的差值为2。After obtaining the difference between the target number of bytes of the current frame and the actual number of encoded bytes, it can be calculated by formula (59), the ratio of the absolute value of the above difference to the target number of bytes of the current frame is 47.5/ 867.5=0.05, because the ratio 0.05 is greater than the difference preset threshold coefficient 0 (deltaThres0=0.02), then delta z=tmpOffset1, further, can be calculated according to formula (60), the ratio 0.05 is equal to the difference preset threshold coefficient 1 (deltaThres1=0.05), then delta z=tmpOffset2; further, it can be calculated according to formula (61), the ratio 0.05 is less than the difference preset threshold coefficient 2 (deltaThres2=0.1), then delta z=deltaOffset2, if deltaOffset2 =2, then the difference between the parameter z before and after updating is 2.
通过上述式(62)计算更新后的参数z new=z-sign(deltaBytes 3)*delta z=0-2=-2。后续计算目标帧的第一个瓦片的初始QP 0的时候,可以利用更新后的参数z new进行计算。 The updated parameter z new =z-sign(deltaBytes 3 )*delta z=0−2=−2 is calculated by the above formula (62). When subsequently calculating the initial QP 0 of the first tile of the target frame, the updated parameter z new can be used for calculation.
换句话说,在编码目标帧的过程中,上述式(48)中的参数z的数值用更新后的参数z new进行计算,即用-2计算目标帧的第一个瓦片的初始QP 0。后续可以基于目标帧的第一个瓦片的图像复杂度信息更新第一个瓦片的初始QP 1,然后基于更新后的第一个瓦片的初始QP 1计算第二个瓦片的QP 2,再基于第二个瓦片的QP 2计算第三个瓦片的QP 3,……,后续以此类推,直到目标帧的所有瓦片的QP计算完成。 In other words, in the process of encoding the target frame, the value of the parameter z in the above formula (48) is calculated with the updated parameter z new , that is, -2 is used to calculate the initial QP of the first tile of the target frame 0 . Subsequently, the initial QP 1 of the first tile can be updated based on the image complexity information of the first tile of the target frame, and then the QP 2 of the second tile can be calculated based on the updated initial QP 1 of the first tile , and then calculate the QP 3 of the third tile based on the QP 2 of the second tile, ..., and so on, until the QP calculation of all tiles of the target frame is completed.
本申请实施例提供的方案,结合第二差值的符号,确定更新的第一参数,基于更新后的第一参数更新目标帧包括的瓦片的QP,可以进一步提高编码效率。In the solution provided by the embodiment of the present application, the updated first parameter is determined in combination with the sign of the second difference value, and the QP of the tile included in the target frame is updated based on the updated first parameter, which can further improve coding efficiency.
图10为本申请另一实施例提供的一种编码方法1000的示意性图。该编码方法1000可以包括步骤1010~1060。下文结合图10概述本申请实施例提供的编码方法。FIG. 10 is a schematic diagram of an encoding method 1000 provided by another embodiment of the present application. The encoding method 1000 may include steps 1010-1060. The encoding method provided by the embodiment of the present application is outlined below with reference to FIG. 10 .
1010,计算当前帧的目标字节数以及各瓦片的目标字节数。1010. Calculate the target byte count of the current frame and the target byte count of each tile.
1020,判断当前是否编码第一个瓦片。1020. Determine whether to encode the first tile currently.
若当前编码第一个瓦片,则执行步骤1030;若当前不是编码第一个瓦片,则执行步骤1040。If the first tile is currently being encoded, then step 1030 is performed; if the first tile is not currently being encoded, then step 1040 is performed.
1030,计算第一个瓦片的初始QP。1030. Calculate the initial QP of the first tile.
1040,进行当前帧的帧内QP更新。1040. Perform intra-frame QP update of the current frame.
1050,判断当前帧的最后一个瓦片是否编码完成。1050. Determine whether the encoding of the last tile of the current frame is completed.
若是,则执行步骤1060,若否,则返回执行步骤1020。If yes, execute step 1060 , if not, return to execute step 1020 .
1060,帧级参数更新。1060, frame-level parameter update.
关于上述步骤1010~1060的内容详见上文中关于图6-图9的内容,为了 简洁,这里不再赘述。For the content of the above steps 1010-1060, please refer to the content of Fig. 6-Fig.
在上文的内容中,仅涉及到了对待编码图像进行单通道编码,在一些实施例中,可以对待编码图像进行多通道编码,在这种情况下,获取当前帧中的每一个瓦片的图像复杂度信息可以获取多个分量的图像复杂度信息,具体详见下文。In the above content, only single-channel encoding of the image to be encoded is involved. In some embodiments, multi-channel encoding can be performed on the image to be encoded. In this case, the image of each tile in the current frame is acquired Complexity information can obtain image complexity information of multiple components, see below for details.
可选地,在一些实施例中,若对所述当前帧进行多通道编码,所述获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,包括:分别获取所述n1个瓦片中的每一个瓦片的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;根据所述图像复杂度信息更新n1个瓦片的QP,包括:根据所述分量中的至少一个分量的图像复杂度信息更新所述n1个瓦片的QP。Optionally, in some embodiments, if multi-channel encoding is performed on the current frame, the acquiring the image complexity information of each of the n1 tiles in the current frame includes: respectively acquiring the n1 The image complexity information of the components of each tile in the tiles, the components include the brightness component and/or at least one chrominance component of the current frame; update the n1 tiles according to the image complexity information The QP includes: updating the QP of the n1 tiles according to the image complexity information of at least one of the components.
本申请实施例中的多通道编码可以包括YUV编码或RGB编码,不予限制。The multi-channel encoding in this embodiment of the present application may include YUV encoding or RGB encoding, without limitation.
YUV是指亮度参量和色度参量分开表示的像素格式,YUV编码的格式可以包括YUV444,YUV422,YUV420以及YUV411。下文以YUV编码的格式为YUV422为例进行说明。YUV refers to a pixel format in which luma parameters and chrominance parameters are represented separately. The format of YUV encoding can include YUV444, YUV422, YUV420 and YUV411. The following takes the YUV encoding format as YUV422 as an example for illustration.
Y分量:关于Y分量的瓦片的图像复杂度信息可以参考上文内容。Y component: For the image complexity information of the tiles of the Y component, please refer to the above content.
UV分量:由于YUV编码的格式为YUV422,则关于UV分量的像素可以为待编码图像的像素值的一半,基于这一半的像素值获取瓦片的图像复杂度信息。UV component: Since the format of YUV encoding is YUV422, the pixel of the UV component can be half of the pixel value of the image to be encoded, and the image complexity information of the tile is obtained based on this half of the pixel value.
本申请实施例中,可以分别获取n1个瓦片中的每一个瓦片的Y分量和UV分量的图像复杂度信息,可以基于Y分量的图像复杂度信息和UV分量的图像复杂度信息的平均值更新n1个瓦片的的QP;也可以根据Y分量的图像复杂度信息更新n1个瓦片的的QP;还可以根据UV分量的图像复杂度信息更新n1个瓦片的的QP;不予限制。In the embodiment of the present application, the image complexity information of the Y component and the UV component of each tile in the n1 tiles can be respectively obtained, and the average of the image complexity information of the Y component and the UV component can be based on The QP of n1 tiles can be updated by the value; the QP of n1 tiles can also be updated according to the image complexity information of the Y component; the QP of n1 tiles can also be updated according to the image complexity information of the UV component; limit.
应理解,根据分量中的至少一个分量的图像复杂度信息更新n1个瓦片的QP不局限于上述所列举的,还可以为其它方式,例如,Y分量的图像复杂度信息和UV分量的图像复杂度信息的均方根值等,本申请对此不作具体限定。It should be understood that updating the QP of n1 tiles according to the image complexity information of at least one of the components is not limited to the ones listed above, and can also be in other ways, for example, the image complexity information of the Y component and the image of the UV component The root mean square value of the complexity information and the like are not specifically limited in this application.
本申请实施例提供的方案,通过根据获取的每一个瓦片的分量的图像复杂度信息中的至少一个分量的图像复杂度信息更新瓦片的QP,可以提高量 化参数的精准度。In the solution provided by the embodiment of the present application, the accuracy of the quantization parameter can be improved by updating the QP of the tile according to the obtained image complexity information of at least one component of the image complexity information of the components of each tile.
可选地,在一些实施例中,所述获取当前帧中的n1个瓦片的每一个瓦片的的图像复杂度信息,包括:获取所述每一个瓦片的多个变换参数;从所述多个变换参数中选择一个参数作为所述每一个瓦片的图像复杂度信息。Optionally, in some embodiments, the acquiring the image complexity information of each of the n1 tiles in the current frame includes: acquiring multiple transformation parameters of each tile; One parameter is selected from the plurality of transformation parameters as the image complexity information of each tile.
本申请实施例中,可以从获取的多个变换参数中选择一个参数计算每一个瓦片的图像复杂度信息。上文所描述的内容中,是基于瓦片的LPHP系数来计算每一个瓦片的图像复杂度信息,在一些实施例中,也可以根据瓦片的DC系数来计算每一个瓦片的图像复杂度信息,或者,还可以根据瓦片的LPHP系数和DC系数的平均值来计算每一个瓦片的图像复杂度信息,本申请对此不作具体限定。In the embodiment of the present application, one parameter may be selected from the acquired transformation parameters to calculate the image complexity information of each tile. In the content described above, the image complexity information of each tile is calculated based on the LPHP coefficient of the tile. In some embodiments, the image complexity information of each tile can also be calculated according to the DC coefficient of the tile. degree information, or, the image complexity information of each tile may also be calculated according to the average value of the LPHP coefficient and the DC coefficient of the tile, which is not specifically limited in the present application.
可选地,在一些实施例中,所述方法600还可以包括:Optionally, in some embodiments, the method 600 may also include:
若更新后的所述n1个瓦片的QP小于第三阈值,将所述第三阈值作为所述更新后的所述n1个瓦片的QP;或,If the updated QP of the n1 tiles is less than a third threshold, use the third threshold as the updated QP of the n1 tiles; or,
若更新后的所述n1个瓦片的QP大于第四阈值,将所述第四阈值作为所述更新后的所述n1个瓦片的QP;If the updated QP of the n1 tiles is greater than a fourth threshold, use the fourth threshold as the updated QP of the n1 tiles;
其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Wherein, the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
本申请实施例中,在对待编码图像进行编码的过程中,可以设置QP的最小值(即第三阈值)和最大值(即第四阈值)。本申请实施例中的第三阈值和/或第四阈值可以是固定的,也可以是不断调整的,不予限制。In the embodiment of the present application, in the process of encoding the image to be encoded, the minimum value (ie, the third threshold) and the maximum value (ie, the fourth threshold) of QP may be set. The third threshold and/or the fourth threshold in this embodiment of the present application may be fixed or continuously adjusted, and are not limited.
若通过上述公式计算的瓦片的QP小于最小值,则后续可以基于设置的最小值计算瓦片的QP;若通过上述公式计算的瓦片的QP大于最大值,则后续可以基于设置的最大值计算瓦片的QP。If the QP of the tile calculated by the above formula is less than the minimum value, then the QP of the tile can be calculated based on the set minimum value; if the QP of the tile calculated by the above formula is greater than the maximum value, then the follow-up can be based on the set maximum value Calculate the QP of the tile.
示例性地,如上所述,可以设置QP的最小值和最大值分别为5和150,若通过上述公式计算的瓦片的QP为5~150中的任何一个数值,可以基于计算得到的QP对下一个瓦片进行编码;若通过上述公式计算的瓦片的QP为3,则可以基于5对下一个瓦片进行编码;若通过上述公式计算的瓦片的QP为160,则可以基于150对下一个瓦片进行编码。Exemplarily, as mentioned above, the minimum and maximum values of QP can be set to 5 and 150 respectively. If the QP of a tile calculated by the above formula is any value from 5 to 150, it can be based on the calculated QP. The next tile is encoded; if the QP of the tile calculated by the above formula is 3, the next tile can be encoded based on 5; if the QP of the tile calculated by the above formula is 160, it can be encoded based on 150 The next tile is encoded.
可选地,在一些实施例中,所述编码方法应用于JPEG XR编码格式中。Optionally, in some embodiments, the encoding method is applied in the JPEG XR encoding format.
如上所述,JPEG XR编码格式是一种连续色调静止图像压缩算法和文件格式,可以支持有损数据压缩以及无损数据压缩。As mentioned above, the JPEG XR encoding format is a continuous-tone still image compression algorithm and file format that can support lossy data compression as well as lossless data compression.
JPEG XR编码格式相比JPEG编码格式具有一定的优势。The JPEG XR encoding format has certain advantages over the JPEG encoding format.
首先,JPEG使用8位元编码,实现了256色,而JPEG XR可以使用16位元或更多,提供了更好的效果和更多的编辑灵活性。First, JPEG uses 8-bit encoding, enabling 256 colors, while JPEG XR can use 16-bit or more, providing better results and more editing flexibility.
其次,JPEG XR编码格式使用更加高效率的压缩算法,与JPEG文件同等大小的情况下,图像质量可以是后者的两倍,或同等质量只需后者一半的体积。并且与JPEG不同,JPEG XR的最高质量压缩可以不丢失任何信息。Secondly, the JPEG XR encoding format uses a more efficient compression algorithm. In the case of the same size as a JPEG file, the image quality can be twice that of the latter, or half the size of the latter for the same quality. And unlike JPEG, JPEG XR's highest quality compression allows no loss of information.
图11为本申请实施例又一实施例提供的一种编码方法1100的示意图,该编码方法1100可以包括步骤1110-1130。FIG. 11 is a schematic diagram of an encoding method 1100 provided by still another embodiment of the present application. The encoding method 1100 may include steps 1110-1130.
1110,获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数。1110. Acquire image complexity information of the current frame, where the image complexity information includes transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on pixel values of the current frame.
本申请实施例中,关于PCT处理的流程可以参考上述式(2)~式(36)的描述,为了简洁,这里不再赘述。In the embodiment of the present application, for the process of PCT processing, reference may be made to the descriptions of the foregoing formulas (2) to (36), and for the sake of brevity, details are not repeated here.
1120,根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP)。1120. Determine an initial quantization parameter (initial QP) of the current frame according to the image complexity information.
本申请实施例中,可以根据图像复杂度信息确定当前帧的初始QP,该初始QP可以根据上述式(45)~式(49)的描述,为了简洁,这里不再赘述。In the embodiment of the present application, the initial QP of the current frame can be determined according to the image complexity information, and the initial QP can be described according to the above formula (45) to formula (49). For the sake of brevity, details are not repeated here.
需要说明的是,由于该编码方法1100是以帧为单位进行的,因此,本申请实施例中的初始QP即为当前帧的初始QP;而上文中的编码方法600是以瓦片为单位进行的,因此,上述实施例中的初始QP为当前帧中的第一个瓦片的初始QP。It should be noted that since the encoding method 1100 is performed in units of frames, the initial QP in the embodiment of the present application is the initial QP of the current frame; while the encoding method 600 above is performed in units of tiles Therefore, the initial QP in the above embodiment is the initial QP of the first tile in the current frame.
1130,根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。1130. Update the initial QP of the target frame according to the initial QP of the current frame, where the target frame is x frames before and/or y frames after the current frame, and x and y are positive integers greater than or equal to 1.
本申请实施例中,若当前编码方法为前向预测,则目标帧帧可以为当前帧的前x帧;若当前编码方法为后向预测,则目标帧可以为当前帧的后y帧;若当前编码方法为双向预测,则目标帧可以为当前帧的前x帧和后y帧。In the embodiment of the present application, if the current encoding method is forward prediction, the target frame may be the previous x frames of the current frame; if the current encoding method is backward prediction, the target frame may be the last y frames of the current frame; if If the current encoding method is bidirectional prediction, the target frame may be the previous x frame and the next y frame of the current frame.
本申请实施例提供的方案,由于图像复杂度信息与当前帧的变换系数有关,且该变换系数是经过对当前帧中的像素值进行PCT处理后的得到的系数,通过根据图像复杂度信息确定当前帧的初始QP并根据该初始QP更新目标帧的初始QP,可以保证在不牺牲码率控制精度的前提下,提高编码效率以及降低硬件资源消耗,同时可以保证量化参数的灵活性以避免输出码率 不可控的问题。In the solution provided by the embodiment of the present application, since the image complexity information is related to the transformation coefficient of the current frame, and the transformation coefficient is the coefficient obtained after performing PCT processing on the pixel values in the current frame, it is determined according to the image complexity information The initial QP of the current frame and the initial QP of the target frame are updated according to the initial QP, which can ensure that the encoding efficiency is improved and the hardware resource consumption is reduced without sacrificing the accuracy of the code rate control, and at the same time, the flexibility of quantization parameters can be guaranteed to avoid output The code rate is uncontrollable.
可选地,在一些实施例中,所述根据所述当前帧的初始QP更新目标帧的初始QP,包括:根据所述第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新所述目标帧中的初始QP;其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值。Optionally, in some embodiments, the updating the initial QP of the target frame according to the initial QP of the current frame includes: according to the difference between the absolute value of the second difference and the target byte number of the current frame The ratio and the size of the second threshold update the initial QP in the target frame; wherein, the second difference is the difference between the target byte number of the current frame and the actual coded byte number of the current frame.
本申请实施例中的第二阈值可以为固定值,也可以不断调整,本申请对此不作具体限定。The second threshold in the embodiment of the present application may be a fixed value, or may be continuously adjusted, which is not specifically limited in the present application.
可选地,在一些实施例中,所述根据所述第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新所述目标帧的初始QP,包括:Optionally, in some embodiments, the updating the initial QP of the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of a second threshold includes :
若所述第二差值为正值,将用于计算所述当前帧的初始QP中的第一参数与偏移参数的差值作为更新后的第一参数;If the second difference is a positive value, the difference between the first parameter and the offset parameter used to calculate the initial QP of the current frame is used as the updated first parameter;
根据更新后的第一参数计算所述目标帧的初始QP;calculating the initial QP of the target frame according to the updated first parameter;
或,or,
若所述第二差值为负值,将用于计算前帧的初始QP中的第一参数与偏移参数的和作为更新后的第一参数;If the second difference is a negative value, the sum of the first parameter and the offset parameter used to calculate the initial QP of the previous frame is used as the updated first parameter;
根据更新后的第一参数计算所述目标帧的初始QP。Calculate the initial QP of the target frame according to the updated first parameter.
本申请实施例中的第一参数可以为上文式(48)中的参数z,在计算上述当前帧的初始QP的过程中,参数z的初始值可以设定为0,后续在计算目标帧的初始QP的时候,可以根据当前帧的图像复杂度信息更新该式(48)中的参数z。The first parameter in the embodiment of the present application can be the parameter z in the above formula (48). In the process of calculating the initial QP of the current frame above, the initial value of the parameter z can be set to 0, and the subsequent calculation of the target frame When the initial QP of , the parameter z in the formula (48) can be updated according to the image complexity information of the current frame.
具体地,可以先计算当前帧的目标字节数与实际编码字节数的差值,基于该差值的绝对值与当前帧的目标字节数的比值和第二阈值的大小更新式(48)中的参数z,然后再基于更新后的参数z以及目标帧的的图像复杂度信息来更新目标帧的初始QP,具体内容可以参考上述式(57)~式(62)以及式(45)~(49),为了简洁,这里不再赘述。Specifically, the difference between the target number of bytes of the current frame and the actual number of encoded bytes can be calculated first, based on the ratio of the absolute value of the difference to the target number of bytes of the current frame and the size update formula of the second threshold (48 ), and then update the initial QP of the target frame based on the updated parameter z and the image complexity information of the target frame. For details, please refer to the above formula (57) ~ formula (62) and formula (45) ~(49), for the sake of brevity, no more details here.
本申请实施例提供的方案,结合第二差值的符号,确定更新的第一参数,基于更新后的第一参数更新目标帧的QP,可以进一步提高编码效率。In the solution provided by the embodiment of the present application, the updated first parameter is determined in combination with the sign of the second difference value, and the QP of the target frame is updated based on the updated first parameter, which can further improve coding efficiency.
在上文的内容中,仅涉及到了对待编码图像进行单通道编码,在一些实施例中,可以对待编码图像进行多通道编码,在这种情况下,获取当前帧的图像复杂度信息可以获取多个分量的图像复杂度信息,具体详见下文。In the above content, only single-channel encoding of the image to be encoded is involved. In some embodiments, multi-channel encoding can be performed on the image to be encoded. In this case, obtaining the image complexity information of the current frame can obtain multiple The image complexity information of each component, see below for details.
可选地,在一些实施例中,若对所述当前帧进行多通道编码,所述获取 当前帧的图像复杂度信息,包括:分别获取所述当前帧的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;根据所述当前帧的初始QP更新目标帧的初始QP,包括:根据所述分量中的至少一个分量的图像复杂度信息更新所述目标帧的初始QP。Optionally, in some embodiments, if multi-channel encoding is performed on the current frame, the acquiring the image complexity information of the current frame includes: respectively acquiring the image complexity information of the components of the current frame, the The components include a luminance component and/or at least one chrominance component of the current frame; updating the initial QP of the target frame according to the initial QP of the current frame includes: updating according to the image complexity information of at least one of the components The initial QP of the target frame.
本申请实施例中的多通道编码可以包括YUV编码或RGB编码,不予限制。The multi-channel encoding in this embodiment of the present application may include YUV encoding or RGB encoding, without limitation.
YUV是指亮度参量和色度参量分开表示的像素格式,YUV编码的格式可以包括YUV444,YUV422,YUV420以及YUV411。下文以YUV编码的格式为YUV422为例进行说明。YUV refers to a pixel format in which luma parameters and chrominance parameters are represented separately. The format of YUV encoding can include YUV444, YUV422, YUV420 and YUV411. The following takes the YUV encoding format as YUV422 as an example for illustration.
Y分量:关于Y分量的瓦片的图像复杂度信息可以参考上文内容。Y component: For the image complexity information of the tiles of the Y component, please refer to the above content.
UV分量:由于YUV编码的格式为YUV422,则关于UV分量的像素可以为待编码图像的像素值的一半,基于这一半的像素值获取瓦片的图像复杂度信息。UV component: Since the format of YUV encoding is YUV422, the pixel of the UV component can be half of the pixel value of the image to be encoded, and the image complexity information of the tile is obtained based on this half of the pixel value.
假设分别获取当前帧的Y分量和UV分量的图像复杂度信息,可以基于Y分量的图像复杂度信息和UV分量的图像复杂度信息的平均值更新目标帧的初始QP;也可以根据Y分量的图像复杂度信息更新目标帧的初始QP;还可以根据UV分量的图像复杂度信息更新目标帧的初始QP;不予限制。Assuming that the image complexity information of the Y component and the UV component of the current frame are respectively obtained, the initial QP of the target frame can be updated based on the average value of the image complexity information of the Y component and the image complexity information of the UV component; The image complexity information updates the initial QP of the target frame; the initial QP of the target frame can also be updated according to the image complexity information of the UV component; not limited.
应理解,根据分量中的至少一个分量的图像复杂度信息更新目标帧的初始QP不局限于上述所列举的,还可以为其它方式,例如,Y分量的图像复杂度信息和UV分量的图像复杂度信息的均方根值等,本申请对此不作具体限定。It should be understood that updating the initial QP of the target frame according to the image complexity information of at least one of the components is not limited to the ones listed above, and can also be in other ways, for example, the image complexity information of the Y component and the image complexity of the UV component The root mean square value of degree information, etc., is not specifically limited in this application.
本申请实施例提供的方案,通过根据获取的当前帧的分量的图像复杂度信息中的至少一个分量的图像复杂度信息更新目标帧的初始QP,可以提高量化参数的精准度。In the solution provided by the embodiment of the present application, the accuracy of quantization parameters can be improved by updating the initial QP of the target frame according to the acquired image complexity information of at least one component in the image complexity information of the components of the current frame.
可选地,在一些实施例中,所述获取当前帧的图像复杂度信息,包括:获取所述当前帧的多个变换参数;从所述多个变换参数中选择一个参数作为所述当前帧的图像复杂度信息。Optionally, in some embodiments, the acquiring the image complexity information of the current frame includes: acquiring multiple transformation parameters of the current frame; selecting a parameter from the multiple transformation parameters as the current frame image complexity information.
本申请实施例中,可以从获取的多个变换参数中选择一个参数计算每一个瓦片的图像复杂度信息。上文所描述的内容中,可以基于当前帧的LPHP系数来计算当期帧的图像复杂度信息,在一些实施例中,也可以根据当前帧的DC系数来计算当前帧的图像复杂度信息,或者,还可以根据当前帧的 LPHP系数和DC系数的平均值来计算当前帧的图像复杂度信息,本申请对此不作具体限定。In the embodiment of the present application, one parameter may be selected from the acquired transformation parameters to calculate the image complexity information of each tile. In the content described above, the image complexity information of the current frame can be calculated based on the LPHP coefficient of the current frame. In some embodiments, the image complexity information of the current frame can also be calculated according to the DC coefficient of the current frame, or , the image complexity information of the current frame may also be calculated according to the average value of the LPHP coefficient and the DC coefficient of the current frame, which is not specifically limited in the present application.
可选地,在一些实施例中,所述方法还可以包括:若更新后的所述目标帧的初始QP小于第三阈值,将所述第三阈值作为所述更新后的所述目标帧的的初始QP;或,若更新后的所述目标帧的的初始QP大于第四阈值,将所述第四阈值作为所述更新后的所述目标帧的的初始QP;其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Optionally, in some embodiments, the method may further include: if the updated initial QP of the target frame is smaller than a third threshold, using the third threshold as the updated target frame or, if the updated initial QP of the target frame is greater than a fourth threshold, use the fourth threshold as the updated initial QP of the target frame; wherein, the third The threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
本申请实施例中,在对待编码图像进行编码的过程中,可以设置初始QP的最小值(即第三阈值)和最大值(即第四阈值)。In the embodiment of the present application, during the process of encoding the image to be encoded, the minimum value (ie, the third threshold) and the maximum value (ie, the fourth threshold) of the initial QP may be set.
若通过上述公式计算的当前帧的初始QP小于最小值,则后续可以基于设置的最小值计算目标帧的初始QP;若通过上述公式计算的当前帧的初始QP大于最大值,则后续可以基于设置的最大值计算目标帧的初始QP。If the initial QP of the current frame calculated by the above formula is less than the minimum value, then the initial QP of the target frame can be calculated based on the set minimum value; if the initial QP of the current frame calculated by the above formula is greater than the maximum value, then the follow-up can be based on the set The maximum value of calculates the initial QP of the target frame.
示例性地,如上所述,设置的初始QP的最小值和最大值可以分别为5和150,若通过上述公式计算的当前帧的初始QP为5~150中的任何一个数值,可以基于计算得到的初始QP对目标帧进行编码;若通过上述公式计算的当前帧的初始QP为3,则可以基于5对目标帧进行编码;若通过上述公式计算的当前帧的初始QP为160,则可以基于150对目标帧进行编码。Exemplarily, as mentioned above, the minimum and maximum values of the initial QP can be set to 5 and 150 respectively. If the initial QP of the current frame calculated by the above formula is any value from 5 to 150, it can be obtained based on the calculation The initial QP of the current frame is used to encode the target frame; if the initial QP of the current frame calculated by the above formula is 3, the target frame can be encoded based on 5; if the initial QP of the current frame calculated by the above formula is 160, then the target frame can be encoded based on 150 Encode the target frame.
可选地,在一些实施例中,所述编码方法应用于JPEG XR编码格式中。Optionally, in some embodiments, the encoding method is applied in the JPEG XR encoding format.
如上所述,JPEG XR编码格式是一种连续色调静止图像压缩算法和文件格式,可以支持有损数据压缩以及无损数据压缩。As mentioned above, the JPEG XR encoding format is a continuous-tone still image compression algorithm and file format that can support lossy data compression as well as lossless data compression.
JPEG XR编码格式相比JPEG编码格式具有一定的优势。The JPEG XR encoding format has certain advantages over the JPEG encoding format.
首先,JPEG使用8位元编码,实现了256色,而JPEG XR可以使用16位元或更多,提供了更好的效果和更多的编辑灵活性。First, JPEG uses 8-bit encoding, enabling 256 colors, while JPEG XR can use 16-bit or more, providing better results and more editing flexibility.
其次,JPEG XR编码格式使用更加高效率的压缩算法,与JPEG文件同等大小的情况下,图像质量可以是后者的两倍,或同等质量只需后者一半的体积。并且与JPEG不同,JPEG XR的最高质量压缩可以不丢失任何信息。Secondly, the JPEG XR encoding format uses a more efficient compression algorithm. In the case of the same size as a JPEG file, the image quality can be twice that of the latter, or half the size of the latter for the same quality. And unlike JPEG, JPEG XR's highest quality compression allows no loss of information.
上文结合图1-图11,详细描述了本申请的方法实施例,下面结合图12-图17,描述本申请的装置实施例,装置实施例与方法实施例相互对应,因此未详细描述的部分可参见前面各部分方法实施例。The method embodiment of this application is described in detail above with reference to Figure 1-Figure 11, and the device embodiment of this application is described below in conjunction with Figure 12-Figure 17. The device embodiment and the method embodiment correspond to each other, so the details are not described in detail For details, please refer to the previous method embodiments.
图12为本申请一实施例提供的一种编码装置1200的示意性结构图,该编码装置1200可以包括复杂度计算模块1210和码率控制模块1220。FIG. 12 is a schematic structural diagram of an encoding device 1200 provided by an embodiment of the present application. The encoding device 1200 may include a complexity calculation module 1210 and a code rate control module 1220 .
复杂度计算模块1210,用于获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换处理(PCT处理)后得到的变换系数,n1为大于或等于2的正整数。A complexity calculation module 1210, configured to acquire image complexity information of each of the n1 tiles in the current frame, the image complexity information including image kernel transformation processing of pixel values of each tile The transformation coefficient obtained after (PCT processing), n1 is a positive integer greater than or equal to 2.
码率控制模块1220,用于根据所述图像复杂度信息更新所述n1个瓦片的量化参数(QP)。A code rate control module 1220, configured to update the quantization parameters (QP) of the n1 tiles according to the image complexity information.
如图13a所示为本申请一实施例提供的JPEG XR编码器的示意性结构图。该示意图中可以包括滤波模块410、变换模块420、量化模块430、预测模块440、熵编码模块450、复杂度计算模块460和码率控制模块470。Figure 13a is a schematic structural diagram of a JPEG XR encoder provided by an embodiment of the present application. The schematic diagram may include a filter module 410 , a transform module 420 , a quantization module 430 , a prediction module 440 , an entropy encoding module 450 , a complexity calculation module 460 and a code rate control module 470 .
其中,滤波模块410、变换模块420、量化模块430、预测模块440、熵编码模块450这五个模块作用与上述图2中所涉及到的模块的作用相类似。Among them, the five modules of the filtering module 410 , the transform module 420 , the quantization module 430 , the prediction module 440 , and the entropy coding module 450 are similar to the functions of the modules mentioned above in FIG. 2 .
复杂度计算模块460和码率控制模块470可以为本申请实施例中的复杂度计算模块1210和码率控制模块1220,可以实现本申请实施例中瓦片的QP的更新。The complexity calculation module 460 and the code rate control module 470 can be the complexity calculation module 1210 and the code rate control module 1220 in the embodiment of the present application, and can realize the update of the QP of the tile in the embodiment of the present application.
其中,复杂度计算模块460可以获取图像复杂度信息并将其信息输出至码率控制模块470,同时码率控制模块470可以接收实际码流的大小作为输入进行码率控制参数更新,即实现QP的更新。Among them, the complexity calculation module 460 can obtain image complexity information and output the information to the code rate control module 470, and the code rate control module 470 can receive the size of the actual code stream as an input to update the code rate control parameters, that is, realize QP update.
如图13b所示为本申请另一实施例提供的JPEG XR编码器的示意性结构图。该示意图中也可以包括滤波模块410、变换模块420、量化模块430、预测模块440、熵编码模块450、复杂度计算模块460和码率控制模块470。FIG. 13b is a schematic structural diagram of a JPEG XR encoder provided by another embodiment of the present application. The schematic diagram may also include a filter module 410 , a transform module 420 , a quantization module 430 , a prediction module 440 , an entropy encoding module 450 , a complexity calculation module 460 and a code rate control module 470 .
与图13a不同的是,图13b中的复杂度计算模块460和码率控制模块470均位于JPEG XR编码器中,而图13a中的复杂度计算模块460位于处理器中,码率控制模块470位于JPEG XR编码器中。Different from Fig. 13a, the complexity calculation module 460 and the code rate control module 470 in Fig. 13b are located in the JPEG XR encoder, while the complexity calculation module 460 in Fig. 13a is located in the processor, and the code rate control module 470 Located in the JPEG XR encoder.
图13a和图13b所示出的这两种JPEG XR编码器均可以实现本申请实施例的瓦片的QP的更新,区别在于,图13a所示的JPEG XR编码器在编码的过程中,当前待编码图像的复杂度计算完成后才可以开始编码当前待编码图像,与图13b所示出的JPEG XR编码器相比,在时间上略有增加;当前待编码图像的复杂度计算完成才开始编码当前待编码图像,此后延迟一帧使用,与图13b所示出的JPEG XR编码器相比,第一帧无输入先验知识。The two JPEG XR encoders shown in Figure 13a and Figure 13b can both implement the update of the QP of the tile in the embodiment of the present application. The difference is that the JPEG XR encoder shown in Figure 13a is currently encoding. The encoding of the current image to be encoded can only be started after the complexity calculation of the image to be encoded is completed. Compared with the JPEG XR encoder shown in Figure 13b, the time is slightly increased; the complexity calculation of the image to be encoded is completed before starting Encode the current image to be encoded, and then use it with a delay of one frame. Compared with the JPEG XR encoder shown in Figure 13b, the first frame has no input prior knowledge.
可选地,在一些实施例中,所述码率控制模块1220进一步用于:根据所述图像复杂度信息计算所述n1个瓦片中的第i个瓦片的目标字节数的累积 值,i为小于或等于n的正整数;根据所述第i个瓦片的目标字节数的累积值更新所述第i个瓦片的QP。Optionally, in some embodiments, the code rate control module 1220 is further configured to: calculate the cumulative value of the target number of bytes of the i-th tile among the n1 tiles according to the image complexity information , i is a positive integer less than or equal to n; the QP of the i-th tile is updated according to the cumulative value of the target number of bytes of the i-th tile.
可选地,在一些实施例中,所述码率控制模块1220进一步用于:根据第一差值的绝对值与第一阈值更新所述第i个瓦片的QP,所述第一差值为所述第i个瓦片的目标字节数的累积值与所述第i个瓦片的实际编码字节数的累积值的差值。Optionally, in some embodiments, the code rate control module 1220 is further configured to: update the QP of the ith tile according to the absolute value of the first difference and the first threshold, the first difference is the difference between the cumulative value of the target number of bytes of the ith tile and the cumulative value of the actual coded number of bytes of the ith tile.
可选地,在一些实施例中,所述码率控制模块1220进一步用于:若所述第一差值为正值,将第i-1个瓦片的QP与第一偏移QP的差值作为所述第i个瓦片的QP;若所述第一差值为负值,将所述第i-1个瓦片的QP与所述第一偏移QP的和作为所述第i个瓦片的QP;其中,所述第一偏移QP是基于所述第一差值的绝对值和所述第一阈值得到的。Optionally, in some embodiments, the code rate control module 1220 is further configured to: if the first difference is a positive value, calculate the difference between the QP of the i-1th tile and the first offset QP value as the QP of the ith tile; if the first difference is a negative value, the sum of the QP of the i-1th tile and the first offset QP is used as the ith QP of tiles; wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold.
可选地,在一些实施例中,所述第i个瓦片的目标字节数与第一信息有关;所述第一信息为以下信息中的至少一个:所述当前帧的目标字节数、所述第i个瓦片的变换系数或所述当前帧的变换系数。Optionally, in some embodiments, the target number of bytes of the i-th tile is related to first information; the first information is at least one of the following information: the target number of bytes of the current frame , the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
可选地,在一些实施例中,所述当前帧的目标字节数与第二信息有关;所述第二信息为以下信息中的至少一种:所述当前帧的宽度、所述当前帧的高度、所述当前帧的位深、所述当前帧的编码格式或所述当前帧的图像压缩比。Optionally, in some embodiments, the target byte count of the current frame is related to second information; the second information is at least one of the following information: width of the current frame, width of the current frame The height of the current frame, the bit depth of the current frame, the coding format of the current frame or the image compression ratio of the current frame.
可选地,在一些实施例中,所述码率控制模块1220进一步用于:根据第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP;其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数,n2为大于或等于2的正整数。Optionally, in some embodiments, the code rate control module 1220 is further configured to: update the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold The QP of the n2 tiles; wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame, and the target frame is the current The previous x frame and/or the subsequent y frame of the frame, x and y are positive integers greater than or equal to 1, and n2 is a positive integer greater than or equal to 2.
可选地,在一些实施例中,所述码率控制模块1220进一步用于:若所述第二差值为正值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的差值作为更新后的第一参数;根据更新后的第一参数计算所述n2个瓦片的QP;或,若所述第二差值为负值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的和作为更新后的第一参数;根据更新后的第一参数计算所述n2个瓦片的QP。Optionally, in some embodiments, the code rate control module 1220 is further configured to: if the second difference is a positive value, combine the first parameter in the QP used to calculate the n1 tiles with The difference of the offset parameter is used as the updated first parameter; the QP of the n2 tiles is calculated according to the updated first parameter; or, if the second difference is negative, it will be used to calculate the The sum of the first parameter and the offset parameter in the QP of the n1 tiles is used as the updated first parameter; and the QP of the n2 tiles is calculated according to the updated first parameter.
可选地,在一些实施例中,若对所述当前帧进行多通道编码,所述复杂 度计算模块1210进一步用于:分别获取所述n1个瓦片中的每一个瓦片的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;所述码率控制模块1220进一步用于:根据所述分量中的至少一个分量的图像复杂度信息更新所述n1个瓦片的的QP。Optionally, in some embodiments, if multi-channel encoding is performed on the current frame, the complexity calculation module 1210 is further configured to: separately obtain an image of a component of each tile in the n1 tiles Complexity information, the component includes the brightness component and/or at least one chrominance component of the current frame; the code rate control module 1220 is further configured to: update according to the image complexity information of at least one component in the component QP of the n1 tiles.
可选地,在一些实施例中,所述复杂度计算模块1210进一步用于:获取所述每一个瓦片的多个变换参数;从所述多个变换参数中选择一个参数作为所述每一个瓦片的图像复杂度信息。Optionally, in some embodiments, the complexity calculation module 1210 is further configured to: obtain multiple transformation parameters of each tile; select a parameter from the multiple transformation parameters as the The image complexity information of the tile.
可选地,在一些实施例中,所述码率控制模块1220进一步用于:若更新后的所述n1个瓦片的QP小于第三阈值,将所述第三阈值作为所述更新后的所述n1个瓦片的QP;或,若更新后的所述n1个瓦片的QP大于第四阈值,将所述第四阈值作为所述更新后的所述n1个瓦片的QP;其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Optionally, in some embodiments, the code rate control module 1220 is further configured to: if the updated QP of the n1 tiles is smaller than a third threshold, use the third threshold as the updated The QP of the n1 tiles; or, if the updated QP of the n1 tiles is greater than a fourth threshold, the fourth threshold is used as the updated QP of the n1 tiles; wherein , the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
可选地,在一些实施例中,所述编码装置1200应用于JPEG XR编码格式中。Optionally, in some embodiments, the encoding device 1200 is applied in the JPEG XR encoding format.
图14为本申请另一实施例提供的一种编码装置1400的示意性结构图,该编码装置1400可以包括复杂度计算模块1410和码率控制模块1420。FIG. 14 is a schematic structural diagram of an encoding device 1400 provided by another embodiment of the present application. The encoding device 1400 may include a complexity calculation module 1410 and a code rate control module 1420 .
复杂度计算模块1410,用于获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数。The complexity calculation module 1410 is configured to obtain image complexity information of the current frame, where the image complexity information includes transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame.
码率控制模块1420,用于根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP)。A code rate control module 1420, configured to determine an initial quantization parameter (initial QP) of the current frame according to the image complexity information.
所述码率控制模块1420还用于:根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。The code rate control module 1420 is also configured to: update the initial QP of the target frame according to the initial QP of the current frame, the target frame is the previous x frame and/or the next y frame of the current frame, and x and y are A positive integer greater than or equal to 1.
上述图13b中的复杂度计算模块460和码率控制模块470可以为本申请实施例中的复杂度计算模块1210和码率控制模块1220,可以实现本申请实施例中的目标帧的QP的更新。The complexity calculation module 460 and the code rate control module 470 in FIG. 13b above can be the complexity calculation module 1210 and the code rate control module 1220 in the embodiment of the present application, which can realize the update of the QP of the target frame in the embodiment of the present application .
可选地,在一些实施例中,所述码率控制模块1420进一步用于:根据所述第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新所述目标帧中的初始QP;其中,所述第二差值为所述当前帧的目标 字节数与所述当前帧的实际编码字节数的差值。Optionally, in some embodiments, the code rate control module 1420 is further configured to: update according to the ratio of the absolute value of the second difference to the target number of bytes of the current frame and the size of the second threshold The initial QP in the target frame; wherein, the second difference is the difference between the target byte count of the current frame and the actual coded byte count of the current frame.
可选地,在一些实施例中,所述码率控制模块1420进一步用于:若所述第二差值为正值,将用于计算所述当前帧的初始QP中的第一参数与偏移参数的差值作为更新后的第一参数;根据更新后的第一参数计算所述目标帧的初始QP;或,若所述第二差值为负值,将用于计算前帧的初始QP中的第一参数与偏移参数的和作为更新后的第一参数;根据更新后的第一参数计算所述目标帧的初始QP。Optionally, in some embodiments, the code rate control module 1420 is further configured to: if the second difference is a positive value, combine the first parameter used to calculate the initial QP of the current frame with the offset The difference of the shift parameter is used as the updated first parameter; the initial QP of the target frame is calculated according to the updated first parameter; or, if the second difference is negative, it will be used to calculate the initial QP of the previous frame The sum of the first parameter in the QP and the offset parameter is used as the updated first parameter; and the initial QP of the target frame is calculated according to the updated first parameter.
可选地,在一些实施例中,若对所述当前帧进行多通道编码,所述复杂度计算模块1410进一步用于:分别获取所述当前帧的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;所述码率控制模块1420进一步用于:根据所述分量中的至少一个分量的图像复杂度信息更新所述目标帧的初始QP。Optionally, in some embodiments, if multi-channel encoding is performed on the current frame, the complexity calculation module 1410 is further configured to: respectively acquire image complexity information of components of the current frame, the components include The luma component and/or at least one chrominance component of the current frame; the code rate control module 1420 is further configured to: update the initial QP of the target frame according to the image complexity information of at least one component in the component.
可选地,在一些实施例中,所述复杂度计算模块1410进一步用于:获取所述当前帧的多个变换参数;从所述多个变换参数中选择一个参数作为所述当前帧的图像复杂度信息。Optionally, in some embodiments, the complexity calculation module 1410 is further configured to: acquire multiple transformation parameters of the current frame; select a parameter from the multiple transformation parameters as the image of the current frame complexity information.
可选地,在一些实施例中,所述码率控制模块1420进一步用于:若更新后的所述目标帧的初始QP小于第三阈值,将所述第三阈值作为所述更新后的所述目标帧的的初始QP;或,若更新后的所述目标帧的的初始QP大于第四阈值,将所述第四阈值作为所述更新后的所述目标帧的的初始QP;其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Optionally, in some embodiments, the code rate control module 1420 is further configured to: if the updated initial QP of the target frame is smaller than a third threshold, use the third threshold as the updated The initial QP of the target frame; or, if the updated initial QP of the target frame is greater than a fourth threshold, the fourth threshold is used as the updated initial QP of the target frame; wherein, The third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
可选地,在一些实施例中,所述编码装置1400应用于JPEG XR编码格式中。Optionally, in some embodiments, the encoding device 1400 is applied in the JPEG XR encoding format.
图15为本申请又一实施例提供一种编码装置1500,该编码装置1500可以包括处理器1510。FIG. 15 provides an encoding device 1500 according to yet another embodiment of the present application, and the encoding device 1500 may include a processor 1510 .
处理器1510,用于:获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换处理(PCT处理)后得到的变换系数,n1为大于或等于2的正整数;根据所述图像复杂度信息更新所述n1个瓦片的量化参数(QP)。The processor 1510 is configured to: acquire image complexity information of each of the n1 tiles in the current frame, where the image complexity information includes image kernel transformation processing of pixel values of each tile ( PCT processing), n1 is a positive integer greater than or equal to 2; update the quantization parameters (QP) of the n1 tiles according to the image complexity information.
可选地,在一些实施例中,所述处理器1510进一步用于:根据所述图像复杂度信息计算所述n1个瓦片中的第i个瓦片的目标字节数的累积值,i 为小于或等于n的正整数;根据所述第i个瓦片的目标字节数的累积值更新所述第i个瓦片的QP。Optionally, in some embodiments, the processor 1510 is further configured to: calculate the cumulative value of the target number of bytes of the i-th tile among the n1 tiles according to the image complexity information, i is a positive integer less than or equal to n; the QP of the i-th tile is updated according to the cumulative value of the target number of bytes of the i-th tile.
可选地,在一些实施例中,所述处理器1510进一步用于:根据第一差值的绝对值与第一阈值更新所述第i个瓦片的QP,所述第一差值为所述第i个瓦片的目标字节数的累积值与所述第i个瓦片的实际编码字节数的累积值的差值。Optionally, in some embodiments, the processor 1510 is further configured to: update the QP of the ith tile according to an absolute value of a first difference and a first threshold, where the first difference is The difference between the cumulative value of the target number of bytes of the ith tile and the cumulative value of the actual coded number of bytes of the ith tile.
可选地,在一些实施例中,所述处理器1510进一步用于:若所述第一差值为正值,将第i-1个瓦片的QP与第一偏移QP的差值作为所述第i个瓦片的QP;若所述第一差值为负值,将所述第i-1个瓦片的QP与所述第一偏移QP的和作为所述第i个瓦片的QP;其中,所述第一偏移QP是基于所述第一差值的绝对值和所述第一阈值得到的。Optionally, in some embodiments, the processor 1510 is further configured to: if the first difference is a positive value, use the difference between the QP of the i-1th tile and the first offset QP as The QP of the ith tile; if the first difference is a negative value, the sum of the QP of the i-1th tile and the first offset QP is used as the ith tile QP of a slice; wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold.
可选地,在一些实施例中,所述第i个瓦片的目标字节数与第一信息有关;所述第一信息为以下信息中的至少一个:所述当前帧的目标字节数、所述第i个瓦片的变换系数或所述当前帧的变换系数。Optionally, in some embodiments, the target number of bytes of the i-th tile is related to first information; the first information is at least one of the following information: the target number of bytes of the current frame , the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
可选地,在一些实施例中,所述当前帧的目标字节数与第二信息有关;所述第二信息为以下信息中的至少一种:所述当前帧的宽度、所述当前帧的高度、所述当前帧的位深、所述当前帧的编码格式或所述当前帧的图像压缩比。Optionally, in some embodiments, the target byte count of the current frame is related to second information; the second information is at least one of the following information: width of the current frame, width of the current frame The height of the current frame, the bit depth of the current frame, the coding format of the current frame or the image compression ratio of the current frame.
可选地,在一些实施例中,所述处理器1510进一步用于:根据第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP;其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数,n2为大于或等于2的正整数。Optionally, in some embodiments, the processor 1510 is further configured to: update the number of bytes in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold. QP of n2 tiles; wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame, and the target frame is the number of bytes of the current frame The previous x frame and/or the next y frame, x and y are positive integers greater than or equal to 1, and n2 is a positive integer greater than or equal to 2.
可选地,在一些实施例中,所述处理器1510进一步用于:若所述第二差值为正值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的差值作为更新后的第一参数;根据更新后的第一参数计算所述n2个瓦片的QP;或,若所述第二差值为负值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的和作为更新后的第一参数;根据更新后的第一参数计算所述n2个瓦片的QP。Optionally, in some embodiments, the processor 1510 is further configured to: if the second difference is a positive value, the first parameter and the offset used to calculate the QP of the n1 tiles The difference between the parameters is used as the updated first parameter; the QP of the n2 tiles is calculated according to the updated first parameter; or, if the second difference is negative, it will be used to calculate the n1 tiles The sum of the first parameter in the QP of the tile and the offset parameter is used as the updated first parameter; and the QP of the n2 tiles is calculated according to the updated first parameter.
可选地,在一些实施例中,若对所述当前帧进行多通道编码,所述处理器1510进一步用于:分别获取所述n1个瓦片中的每一个瓦片的分量的图像 复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;根据所述分量中的至少一个分量的图像复杂度信息更新所述n1个瓦片的的QP。Optionally, in some embodiments, if multi-channel encoding is performed on the current frame, the processor 1510 is further configured to: respectively obtain the image complexity of the components of each tile in the n1 tiles Information, the component includes the luma component and/or at least one chrominance component of the current frame; the QP of the n1 tiles is updated according to the image complexity information of at least one component in the component.
可选地,在一些实施例中,所述处理器1510进一步用于:获取所述每一个瓦片的多个变换参数;从所述多个变换参数中选择一个参数作为所述每一个瓦片的图像复杂度信息。Optionally, in some embodiments, the processor 1510 is further configured to: acquire multiple transformation parameters of each tile; select one parameter from the multiple transformation parameters as the parameter for each tile image complexity information.
可选地,在一些实施例中,所述处理器1510进一步用于:若更新后的所述n1个瓦片的QP小于第三阈值,将所述第三阈值作为所述更新后的所述n1个瓦片的QP;或,若更新后的所述n1个瓦片的QP大于第四阈值,将所述第四阈值作为所述更新后的所述n1个瓦片的QP;其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Optionally, in some embodiments, the processor 1510 is further configured to: if the updated QP of the n1 tiles is smaller than a third threshold, use the third threshold as the updated The QP of n1 tiles; or, if the updated QP of the n1 tiles is greater than the fourth threshold, the fourth threshold is used as the updated QP of the n1 tiles; wherein, The third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
可选地,在一些实施例中,所述编码装置1500应用于JPEG XR编码格式中。Optionally, in some embodiments, the encoding device 1500 is applied in the JPEG XR encoding format.
可选地,该编码装置1500还可以包括存储器1520。其中,处理器1510可以从存储器1520中调用并运行计算机程序,以实现本申请实施例中的方法。Optionally, the encoding device 1500 may further include a memory 1520 . Wherein, the processor 1510 can invoke and run a computer program from the memory 1520, so as to implement the method in the embodiment of the present application.
其中,存储器1520可以是独立于处理器1510的一个单独的器件,也可以集成在处理器1510中。Wherein, the memory 1520 may be an independent device independent of the processor 1510 , or may be integrated in the processor 1510 .
可选地,该编码装置1500还可以包括收发器1530。其中,收发器1530可以是独立于处理器1510的一个单独的器件,也可以集成在处理器1510中。Optionally, the encoding device 1500 may further include a transceiver 1530 . Wherein, the transceiver 1530 may be an independent device independent of the processor 1510 , or may be integrated in the processor 1510 .
可选地,该编码装置例如可以是编码器、终端(包括但不限于手机、相机、无人机等),并且该编码装置可以实现本申请实施例的编码方法600中的相应流程,为了简洁,在此不再赘述。Optionally, the encoding device can be, for example, an encoder, a terminal (including but not limited to mobile phones, cameras, drones, etc.), and the encoding device can implement the corresponding process in the encoding method 600 of the embodiment of the present application, for the sake of brevity , which will not be repeated here.
图16为本申请再一实施例提供一种编码装置1600,该编码装置1600可以包括处理器1610。FIG. 16 provides an encoding device 1600 according to yet another embodiment of the present application, and the encoding device 1600 may include a processor 1610 .
处理器1610,用于:获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数;根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP);根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。 Processor 1610, configured to: acquire image complexity information of the current frame, where the image complexity information includes transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame; The complexity information determines the initial quantization parameter (initial QP) of the current frame; updates the initial QP of the target frame according to the initial QP of the current frame, and the target frame is the first x frame and/or the last y of the current frame frame, x and y are positive integers greater than or equal to 1.
可选地,在一些实施例中,所述处理器1610进一步用于:根据所述第 二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新所述目标帧中的初始QP;其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值。Optionally, in some embodiments, the processor 1610 is further configured to: update the The initial QP in the target frame; wherein, the second difference is the difference between the target byte count of the current frame and the actual coded byte count of the current frame.
可选地,在一些实施例中,所述处理器1610进一步用于:若所述第二差值为正值,将用于计算所述当前帧的初始QP中的第一参数与偏移参数的差值作为更新后的第一参数;根据更新后的第一参数计算所述目标帧的初始QP;或,若所述第二差值为负值,将用于计算前帧的初始QP中的第一参数与偏移参数的和作为更新后的第一参数;根据更新后的第一参数计算所述目标帧的初始QP。Optionally, in some embodiments, the processor 1610 is further configured to: if the second difference is a positive value, the first parameter and the offset parameter used to calculate the initial QP of the current frame The difference is used as the updated first parameter; the initial QP of the target frame is calculated according to the updated first parameter; or, if the second difference is negative, it will be used to calculate the initial QP of the previous frame The sum of the first parameter and the offset parameter is used as the updated first parameter; and the initial QP of the target frame is calculated according to the updated first parameter.
可选地,在一些实施例中,若对所述当前帧进行多通道编码,所述处理器1610进一步用于:分别获取所述当前帧的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;根据所述分量中的至少一个分量的图像复杂度信息更新所述目标帧的初始QP。Optionally, in some embodiments, if multi-channel encoding is performed on the current frame, the processor 1610 is further configured to: respectively acquire image complexity information of components of the current frame, the components including the A luma component and/or at least one chrominance component of the current frame; updating the initial QP of the target frame according to image complexity information of at least one component in the components.
可选地,在一些实施例中,所述处理器1610进一步用于:获取所述当前帧的多个变换参数;从所述多个变换参数中选择一个参数作为所述当前帧的图像复杂度信息。Optionally, in some embodiments, the processor 1610 is further configured to: acquire multiple transformation parameters of the current frame; select one parameter from the multiple transformation parameters as the image complexity of the current frame information.
可选地,在一些实施例中,所述处理器1610进一步用于:若更新后的所述目标帧的初始QP小于第三阈值,将所述第三阈值作为所述更新后的所述目标帧的的初始QP;或,若更新后的所述目标帧的的初始QP大于第四阈值,将所述第四阈值作为所述更新后的所述目标帧的的初始QP;其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Optionally, in some embodiments, the processor 1610 is further configured to: if the updated initial QP of the target frame is smaller than a third threshold, use the third threshold as the updated target frame The initial QP of the frame; or, if the updated initial QP of the target frame is greater than a fourth threshold, the fourth threshold is used as the updated initial QP of the target frame; wherein, the The third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
可选地,在一些实施例中,所述编码装置1600应用于JPEG XR编码格式中。Optionally, in some embodiments, the encoding device 1600 is applied in a JPEG XR encoding format.
可选地,该编码装置1600还可以包括存储器1620。其中,处理器1610可以从存储器1620中调用并运行计算机程序,以实现本申请实施例中的方法。Optionally, the encoding device 1600 may further include a memory 1620 . Wherein, the processor 1610 can invoke and run a computer program from the memory 1620, so as to implement the method in the embodiment of the present application.
其中,存储器1620可以是独立于处理器1610的一个单独的器件,也可以集成在处理器1610中。Wherein, the memory 1620 may be an independent device independent of the processor 1610 , or may be integrated in the processor 1610 .
可选地,该编码装置1600还可以包括收发器1630。其中,收发器1630可以是独立于处理器1610的一个单独的器件,也可以集成在处理器1610中。Optionally, the encoding device 1600 may further include a transceiver 1630 . Wherein, the transceiver 1630 may be an independent device independent of the processor 1610 , or may be integrated in the processor 1610 .
可选地,该编码装置例如可以是编码器、终端(包括但不限于手机、相机、无人机等),并且该编码装置可以实现本申请实施例的编码方法1100中的相应流程,为了简洁,在此不再赘述。Optionally, the encoding device can be, for example, an encoder, a terminal (including but not limited to mobile phones, cameras, drones, etc.), and the encoding device can implement the corresponding process in the encoding method 1100 of the embodiment of the present application, for the sake of brevity , which will not be repeated here.
图17是本申请实施例的芯片的示意性结构图。图17所示的芯片1700包括处理器1710,处理器1710可以从存储器中调用并运行计算机程序,以实现本申请实施例中的方法。FIG. 17 is a schematic structural diagram of a chip according to an embodiment of the present application. The chip 1700 shown in FIG. 17 includes a processor 1710, and the processor 1710 can call and run a computer program from a memory, so as to implement the method in the embodiment of the present application.
可选地,如图17所示,芯片1700还可以包括存储器1720。其中,处理器1710可以从存储器1720中调用并运行计算机程序,以实现本申请实施例中的方法。Optionally, as shown in FIG. 17 , the chip 1700 may further include a memory 1720 . Wherein, the processor 1710 can invoke and run a computer program from the memory 1720, so as to implement the method in the embodiment of the present application.
其中,存储器1720可以是独立于处理器1710一个单独的器件,也可以集成在处理器1710中。Wherein, the memory 1720 may be a separate device independent of the processor 1710 , or may be integrated in the processor 1710 .
可选地,该芯片1700还可以包括输入接口1730。其中,处理器1710可以控制该输入接口1730与其他装置或芯片进行通信,具体地,可以获取其他装置或芯片发送的信息或数据。Optionally, the chip 1700 may also include an input interface 1730 . Wherein, the processor 1710 can control the input interface 1730 to communicate with other devices or chips, specifically, can obtain information or data sent by other devices or chips.
可选地,该芯片1700还可以包括输出接口1740。其中,处理器1710可以控制该输出接口1740与其他装置或芯片进行通信,具体地,可以向其他装置或芯片输出信息或数据。Optionally, the chip 1700 may also include an output interface 1740 . Wherein, the processor 1710 can control the output interface 1740 to communicate with other devices or chips, specifically, can output information or data to other devices or chips.
应理解,本申请实施例提到的芯片还可以称为系统级芯片,系统芯片,芯片系统或片上系统芯片等。It should be understood that the chip mentioned in the embodiment of the present application may also be called a system-on-chip, a system-on-chip, a system-on-a-chip, or a system-on-a-chip.
应理解,本申请实施例的处理器可能是一种集成电路图像处理系统,具有信号的处理能力。在实现过程中,上述方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该 存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。It should be understood that the processor in the embodiment of the present application may be an integrated circuit image processing system, which has a signal processing capability. In the implementation process, each step of the above-mentioned method embodiments may be completed by an integrated logic circuit of hardware in a processor or instructions in the form of software. The above-mentioned processor can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), an off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA) or other available Program logic devices, discrete gate or transistor logic devices, discrete hardware components. Various methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.
可以理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the memory in the embodiments of the present application may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electronically programmable Erase Programmable Read-Only Memory (Electrically EPROM, EEPROM) or Flash. The volatile memory can be Random Access Memory (RAM), which acts as external cache memory. By way of illustration and not limitation, many forms of RAM are available, such as Static Random Access Memory (Static RAM, SRAM), Dynamic Random Access Memory (Dynamic RAM, DRAM), Synchronous Dynamic Random Access Memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (Synchlink DRAM, SLDRAM ) and Direct Memory Bus Random Access Memory (Direct Rambus RAM, DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but not be limited to, these and any other suitable types of memory.
应理解,上述存储器为示例性但不是限制性说明,例如,本申请实施例中的存储器还可以是静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synch link DRAM,SLDRAM)以及直接内存总线随机存取存储器(Direct Rambus RAM,DR RAM)等等。也就是说,本申请实施例中的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It should be understood that the above-mentioned memory is illustrative but not restrictive. For example, the memory in the embodiment of the present application may also be a static random access memory (static RAM, SRAM), a dynamic random access memory (dynamic RAM, DRAM), Synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection Dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM), etc. That is, the memory in the embodiments of the present application is intended to include, but not be limited to, these and any other suitable types of memory.
本申请实施例中的存储器可以向处理器提供指令和数据。存储器的一部分还可以包括非易失性随机存取存储器。例如,存储器还可以存储设备类型的信息。该处理器可以用于执行存储器中存储的指令,并且该处理器执行该指令时,该处理器可以执行上述方法实施例中与终端设备对应的各个步骤。The memory in the embodiments of the present application may provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information. The processor may be used to execute instructions stored in the memory, and when the processor executes the instructions, the processor may execute various steps corresponding to the terminal device in the foregoing method embodiments.
在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑 电路或者软件形式的指令完成。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器执行存储器中的指令,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。In the implementation process, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor or an instruction in the form of software. The steps of the methods disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register. The storage medium is located in the memory, and the processor executes the instructions in the memory to complete the steps of the above method in combination with its hardware. To avoid repetition, no detailed description is given here.
还应理解,在本申请实施例中,图像中的像素点可以位于不同的行和/或列,其中,A的长度可以对应于A包括的位于同一行的像素点个数,A的高度可以对应于A包括的位于同一列的像素点个数。此外,A的长度和高度也可以分别称为A的宽度和深度,本申请实施例对此不做限定。It should also be understood that in the embodiment of the present application, the pixels in the image may be located in different rows and/or columns, wherein the length of A may correspond to the number of pixels in the same row included in A, and the height of A may be Corresponding to the number of pixels in the same column included in A. In addition, the length and height of A may also be referred to as width and depth of A, respectively, which is not limited in this embodiment of the present application.
还应理解,在本申请实施例中,“与A的边界间隔分布”可以指与A的边界间隔至少一个像素点,也可以称为“不与A的边界相邻”或者“不位于A的边界”,本申请实施例对此不做限定,其中,A可以是图像、矩形区域或子图像,等等。It should also be understood that, in this embodiment of the present application, "distribution of distance from the boundary of A" may refer to being at least one pixel apart from the boundary of A, and may also be referred to as "not adjacent to the boundary of A" or "not located at the boundary of A". Boundary", which is not limited in this embodiment of the present application, where A may be an image, a rectangular area, or a sub-image, and so on.
还应理解,上文对本申请实施例的描述着重于强调各个实施例之间的不同之处,未提到的相同或相似之处可以互相参考,为了简洁,这里不再赘述。It should also be understood that the above description of the embodiments of the present application focuses on emphasizing the differences between the various embodiments, and the same or similar points that are not mentioned can be referred to each other, and for the sake of brevity, details are not repeated here.
本申请实施例还提供了一种计算机可读存储介质,用于存储计算机程序。The embodiment of the present application also provides a computer-readable storage medium for storing computer programs.
可选的,该计算机可读存储介质可应用于本申请实施例中的编码装置,并且该计算机程序使得计算机执行本申请实施例的各个方法中由编码装置实现的相应流程,为了简洁,在此不再赘述。Optionally, the computer-readable storage medium can be applied to the coding device in the embodiment of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the coding device in the methods of the embodiment of the present application. For the sake of brevity, here No longer.
本申请实施例还提供了一种计算机程序产品,包括计算机程序指令。The embodiment of the present application also provides a computer program product, including computer program instructions.
可选的,该计算机程序产品可应用于本申请实施例中的编码装置,并且该计算机程序指令使得计算机执行本申请实施例的各个方法中由编码装置实现的相应流程,为了简洁,在此不再赘述。Optionally, the computer program product can be applied to the encoding device in the embodiment of the present application, and the computer program instructions cause the computer to execute the corresponding processes implemented by the encoding device in the methods of the embodiment of the present application. For the sake of brevity, the Let me repeat.
本申请实施例还提供了一种计算机程序。The embodiment of the present application also provides a computer program.
可选的,该计算机程序可应用于本申请实施例中的编码装置,当该计算机程序在计算机上运行时,使得计算机执行本申请实施例的各个方法中由编码装置实现的相应流程,为了简洁,在此不再赘述。Optionally, the computer program can be applied to the encoding device in the embodiment of the present application. When the computer program is run on the computer, the computer executes the corresponding processes implemented by the encoding device in the methods of the embodiment of the present application. For the sake of brevity , which will not be repeated here.
应理解,在本申请实施例中,术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系。例如,A和/或B,可以表示:单独存在A, 同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should be understood that in this embodiment of the present application, the term "and/or" is only an association relationship describing associated objects, indicating that there may be three relationships. For example, A and/or B may mean that A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in this article generally indicates that the contextual objects are an "or" relationship.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the relationship between hardware and software Interchangeability. In the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, and will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present application.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在 一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of software products, and the computer software products are stored in a storage medium In, several instructions are included to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media capable of storing program codes such as U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the application, but the scope of protection of the application is not limited thereto. Any person familiar with the technical field can easily think of various equivalents within the scope of the technology disclosed in the application. Modifications or replacements, these modifications or replacements shall be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (60)

  1. 一种编码方法,其特征在于,包括:A coding method, characterized in that, comprising:
    获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换处理(PCT处理)后得到的变换系数,n1为大于或等于2的正整数;Obtain the image complexity information of each of the n1 tiles in the current frame, the image complexity information includes the transformation obtained after the pixel value of each tile is processed by image kernel transformation (PCT processing) Coefficient, n1 is a positive integer greater than or equal to 2;
    根据所述图像复杂度信息更新所述n1个瓦片的量化参数(QP)。Updating the quantization parameters (QP) of the n1 tiles according to the image complexity information.
  2. 根据权利要求1所述的编码方法,其特征在于,所述根据所述图像复杂度信息更新所述n1个瓦片的QP,包括:The encoding method according to claim 1, wherein the updating the QPs of the n1 tiles according to the image complexity information includes:
    根据所述图像复杂度信息计算所述n1个瓦片中的第i个瓦片的目标字节数的累积值,i为小于或等于n1的正整数;calculating the cumulative value of the target number of bytes of the i-th tile among the n1 tiles according to the image complexity information, where i is a positive integer less than or equal to n1;
    根据所述第i个瓦片的目标字节数的累积值更新所述第i个瓦片的QP。Updating the QP of the i-th tile according to the cumulative value of the target number of bytes of the i-th tile.
  3. 根据权利要求2所述的编码方法,其特征在于,所述根据所述第i个瓦片的目标字节数的累积值更新所述第i个瓦片的QP,包括:The encoding method according to claim 2, wherein updating the QP of the i-th tile according to the cumulative value of the target number of bytes of the i-th tile includes:
    根据第一差值的绝对值与第一阈值更新所述第i个瓦片的QP,所述第一差值为所述第i个瓦片的目标字节数的累积值与所述第i个瓦片的实际编码字节数的累积值的差值。Update the QP of the i-th tile according to the absolute value of the first difference and the first threshold, the first difference is the cumulative value of the target number of bytes of the i-th tile and the i-th tile The difference between the cumulative value of the actual number of encoded bytes for tiles.
  4. 根据权利要求3所述的编码方法,其特征在于,所述根据第一差值的绝对值与第一阈值更新所述第i个瓦片的QP,包括:The encoding method according to claim 3, wherein updating the QP of the ith tile according to the absolute value of the first difference and the first threshold includes:
    若所述第一差值为正值,将第i-1个瓦片的QP与第一偏移QP的差值作为所述第i个瓦片的QP;If the first difference is a positive value, use the difference between the QP of the i-1th tile and the first offset QP as the QP of the i-th tile;
    若所述第一差值为负值,将所述第i-1个瓦片的QP与所述第一偏移QP的和作为所述第i个瓦片的QP;If the first difference is a negative value, using the sum of the QP of the i-1th tile and the first offset QP as the QP of the i-th tile;
    其中,所述第一偏移QP是基于所述第一差值的绝对值和所述第一阈值得到的。Wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold.
  5. 根据权利要求3或4所述的编码方法,其特征在于,所述第i个瓦片的目标字节数与第一信息有关;The encoding method according to claim 3 or 4, wherein the target number of bytes of the i-th tile is related to the first information;
    所述第一信息为以下信息中的至少一个:The first information is at least one of the following information:
    所述当前帧的目标字节数、所述第i个瓦片的变换系数或所述当前帧的变换系数。The target number of bytes of the current frame, the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
  6. 根据权利要求5所述的编码方法,其特征在于,所述当前帧的目标 字节数与第二信息有关;The encoding method according to claim 5, wherein the target byte count of the current frame is related to the second information;
    所述第二信息为以下信息中的至少一种:The second information is at least one of the following information:
    所述当前帧的宽度、所述当前帧的高度、所述当前帧的位深、所述当前帧的编码格式或所述当前帧的图像压缩比。The width of the current frame, the height of the current frame, the bit depth of the current frame, the encoding format of the current frame, or the image compression ratio of the current frame.
  7. 根据权利要求1至6中任一项所述的编码方法,其特征在于,所述方法还包括:The encoding method according to any one of claims 1 to 6, wherein the method further comprises:
    根据第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP;Updating the QP of n2 tiles in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold;
    其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数,n2为大于或等于2的正整数。Wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame, and the target frame is the first x frames and/or the last x frames of the current frame y frame, x and y are positive integers greater than or equal to 1, and n2 is a positive integer greater than or equal to 2.
  8. 根据权利要求7所述的编码方法,其特征在于,所述根据第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP,包括:The encoding method according to claim 7, wherein the n2 tiles in the target frame are updated according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold Slices of QP, including:
    若所述第二差值为正值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的差值作为更新后的第一参数;If the second difference is a positive value, the difference between the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter;
    根据更新后的第一参数计算所述n2个瓦片的QP;Calculate the QP of the n2 tiles according to the updated first parameter;
    或,or,
    若所述第二差值为负值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的和作为更新后的第一参数;If the second difference is a negative value, the sum of the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter;
    根据更新后的第一参数计算所述n2个瓦片的QP。Calculate the QP of the n2 tiles according to the updated first parameter.
  9. 根据权利要求1至8中任一项所述的编码方法,其特征在于,若对所述当前帧进行多通道编码,所述获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,包括:The encoding method according to any one of claims 1 to 8, wherein if multi-channel encoding is performed on the current frame, the acquisition of the image of each of the n1 tiles in the current frame is complicated Degree information, including:
    分别获取所述n1个瓦片中的每一个瓦片的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;Respectively acquire image complexity information of components of each of the n1 tiles, where the components include a luminance component and/or at least one chrominance component of the current frame;
    根据所述图像复杂度信息更新n1个瓦片的QP,包括:Updating the QP of n1 tiles according to the image complexity information includes:
    根据所述分量中的至少一个分量的图像复杂度信息更新所述n1个瓦片的的QP。Updating the QPs of the n1 tiles according to the image complexity information of at least one of the components.
  10. 根据权利要求1至9中任一项所述的编码方法,其特征在于,所述获取当前帧中的n1个瓦片的每一个瓦片的的图像复杂度信息,包括:The encoding method according to any one of claims 1 to 9, wherein the acquiring the image complexity information of each of the n1 tiles in the current frame comprises:
    获取所述每一个瓦片的多个变换参数;Obtain multiple transformation parameters of each tile;
    从所述多个变换参数中选择一个参数作为所述每一个瓦片的图像复杂度信息。Selecting one parameter from the plurality of transformation parameters as the image complexity information of each tile.
  11. 根据权利要求1至10中任一项所述的编码方法,其特征在于,所述获取当前帧中的n1个瓦片的每一个瓦片的的图像复杂度信息,包括:The encoding method according to any one of claims 1 to 10, wherein the acquiring the image complexity information of each of the n1 tiles in the current frame comprises:
    对所述瓦片内的块进行映射后进行预设变换生成预设变换参数,根据所述预设变换参数生成所述瓦片的图像复杂度信息。After the blocks in the tile are mapped, preset transformation is performed to generate preset transformation parameters, and the image complexity information of the tile is generated according to the preset transformation parameters.
  12. 根据权利要求11所述的编码方法,其特征在于,所述预设变换包括PCT变换。The encoding method according to claim 11, wherein the preset transformation comprises PCT transformation.
  13. 根据权利要求1至12中任一项所述的编码方法,其特征在于,所述方法还包括:The encoding method according to any one of claims 1 to 12, wherein the method further comprises:
    若更新后的所述n1个瓦片的QP小于第三阈值,将所述第三阈值作为所述更新后的所述n1个瓦片的QP;或,If the updated QP of the n1 tiles is less than a third threshold, use the third threshold as the updated QP of the n1 tiles; or,
    若更新后的所述n1个瓦片的QP大于第四阈值,将所述第四阈值作为所述更新后的所述n1个瓦片的QP;If the updated QP of the n1 tiles is greater than a fourth threshold, use the fourth threshold as the updated QP of the n1 tiles;
    其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Wherein, the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  14. 根据权利要求1至13中任一项所述的编码方法,其特征在于,所述编码方法应用于联合摄影专家组扩展范围编码格式(JPEG XR编码格式)中。The encoding method according to any one of claims 1 to 13, wherein the encoding method is applied in the Joint Photographic Experts Group Extended Range encoding format (JPEG XR encoding format).
  15. 一种编码方法,其特征在于,包括:A coding method, characterized in that, comprising:
    获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数;Obtaining image complexity information of the current frame, the image complexity information including transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame;
    根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP);Determine the initial quantization parameter (initial QP) of the current frame according to the image complexity information;
    根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。Update the initial QP of the target frame according to the initial QP of the current frame, the target frame is the previous x frames and/or the subsequent y frames of the current frame, and x and y are positive integers greater than or equal to 1.
  16. 根据权利要求15所述的编码方法,其特征在于,所述根据所述当前帧的初始QP更新目标帧的初始QP,包括:The encoding method according to claim 15, wherein the updating the initial QP of the target frame according to the initial QP of the current frame comprises:
    根据所述第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新所述目标帧中的初始QP;updating the initial QP in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of a second threshold;
    其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编 码字节数的差值。Wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame.
  17. 根据权利要求16所述的编码方法,其特征在于,所述根据所述第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新所述目标帧中的初始QP,包括:The encoding method according to claim 16, characterized in that, updating the target frame in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold The initial QP, including:
    若所述第二差值为正值,将用于计算所述当前帧的初始QP中的第一参数与偏移参数的差值作为更新后的第一参数;If the second difference is a positive value, the difference between the first parameter and the offset parameter used to calculate the initial QP of the current frame is used as the updated first parameter;
    根据更新后的第一参数计算所述目标帧的初始QP;calculating the initial QP of the target frame according to the updated first parameter;
    或,or,
    若所述第二差值为负值,将用于计算前帧的初始QP中的第一参数与偏移参数的和作为更新后的第一参数;If the second difference is a negative value, the sum of the first parameter and the offset parameter used to calculate the initial QP of the previous frame is used as the updated first parameter;
    根据更新后的第一参数计算所述目标帧的初始QP。Calculate the initial QP of the target frame according to the updated first parameter.
  18. 根据权利要求15至17中任一项所述的编码方法,其特征在于,若对所述当前帧进行多通道编码,所述获取当前帧的图像复杂度信息,包括:The encoding method according to any one of claims 15 to 17, wherein if multi-channel encoding is performed on the current frame, the acquiring the image complexity information of the current frame includes:
    分别获取所述当前帧的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;respectively acquiring image complexity information of components of the current frame, where the components include a luma component and/or at least one chrominance component of the current frame;
    根据所述当前帧的初始QP更新目标帧的初始QP,包括:Updating the initial QP of the target frame according to the initial QP of the current frame includes:
    根据所述分量中的至少一个分量的图像复杂度信息更新所述目标帧的初始QP。Updating the initial QP of the target frame according to the image complexity information of at least one of the components.
  19. 根据权利要求15至18中任一项所述的编码方法,其特征在于,所述获取当前帧的图像复杂度信息,包括:The encoding method according to any one of claims 15 to 18, wherein said acquiring the image complexity information of the current frame comprises:
    获取所述当前帧的多个变换参数;Obtain multiple transformation parameters of the current frame;
    从所述多个变换参数中选择一个参数作为所述当前帧的图像复杂度信息。Selecting one parameter from the plurality of transformation parameters as the image complexity information of the current frame.
  20. 根据权利要求15至19中任一项所述的编码方法,其特征在于,所述方法还包括:The encoding method according to any one of claims 15 to 19, wherein the method further comprises:
    若更新后的所述目标帧的初始QP小于第三阈值,将所述第三阈值作为所述更新后的所述目标帧的的初始QP;或,If the updated initial QP of the target frame is less than a third threshold, using the third threshold as the updated initial QP of the target frame; or,
    若更新后的所述目标帧的的初始QP大于第四阈值,将所述第四阈值作为所述更新后的所述目标帧的的初始QP;If the updated initial QP of the target frame is greater than a fourth threshold, use the fourth threshold as the updated initial QP of the target frame;
    其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Wherein, the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  21. 根据权利要求15至20中任一项所述的编码方法,其特征在于,所述编码方法应用于联合摄影专家组扩展范围编码格式(JPEG XR编码格式)中。The encoding method according to any one of claims 15 to 20, wherein the encoding method is applied in the Joint Photographic Experts Group Extended Range encoding format (JPEG XR encoding format).
  22. 一种编码装置,其特征在于,包括:An encoding device, characterized in that it comprises:
    复杂度计算模块,用于获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换处理(PCT处理)后得到的变换系数,n1为大于或等于2的正整数;The complexity calculation module is used to obtain the image complexity information of each tile of the n1 tiles in the current frame, and the image complexity information includes the image kernel transformation process on the pixel value of each tile ( PCT processing), the transformation coefficient obtained after n1 is a positive integer greater than or equal to 2;
    码率控制模块,用于根据所述图像复杂度信息更新所述n1个瓦片的量化参数(QP)。A code rate control module, configured to update the quantization parameters (QP) of the n1 tiles according to the image complexity information.
  23. 根据权利要求22所述的编码装置,其特征在于,所述码率控制模块进一步用于:The encoding device according to claim 22, wherein the code rate control module is further used for:
    根据所述图像复杂度信息计算所述n1个瓦片中的第i个瓦片的目标字节数的累积值,i为小于或等于n的正整数;calculating the cumulative value of the target number of bytes of the i-th tile among the n1 tiles according to the image complexity information, where i is a positive integer less than or equal to n;
    根据所述第i个瓦片的目标字节数的累积值更新所述第i个瓦片的QP。Updating the QP of the i-th tile according to the cumulative value of the target number of bytes of the i-th tile.
  24. 根据权利要求23所述的编码装置,其特征在于,所述码率控制模块进一步用于:The encoding device according to claim 23, wherein the code rate control module is further used for:
    根据第一差值的绝对值与第一阈值更新所述第i个瓦片的QP,所述第一差值为所述第i个瓦片的目标字节数的累积值与所述第i个瓦片的实际编码字节数的累积值的差值。Update the QP of the i-th tile according to the absolute value of the first difference and the first threshold, the first difference is the cumulative value of the target number of bytes of the i-th tile and the i-th tile The difference between the cumulative value of the actual number of encoded bytes for tiles.
  25. 根据权利要求24所述的编码装置,其特征在于,所述码率控制模块进一步用于:The encoding device according to claim 24, wherein the code rate control module is further used for:
    若所述第一差值为正值,将第i-1个瓦片的QP与第一偏移QP的差值作为所述第i个瓦片的QP;If the first difference is a positive value, use the difference between the QP of the i-1th tile and the first offset QP as the QP of the i-th tile;
    若所述第一差值为负值,将所述第i-1个瓦片的QP与所述第一偏移QP的和作为所述第i个瓦片的QP;If the first difference is a negative value, using the sum of the QP of the i-1th tile and the first offset QP as the QP of the i-th tile;
    其中,所述第一偏移QP是基于所述第一差值的绝对值和所述第一阈值得到的。Wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold.
  26. 根据权利要求24或25所述的编码装置,其特征在于,所述第i个瓦片的目标字节数与第一信息有关;The encoding device according to claim 24 or 25, wherein the target number of bytes of the ith tile is related to the first information;
    所述第一信息为以下信息中的至少一个:The first information is at least one of the following information:
    所述当前帧的目标字节数、所述第i个瓦片的变换系数或所述当前帧的 变换系数。The target number of bytes of the current frame, the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
  27. 根据权利要求26所述的编码装置,其特征在于,所述当前帧的目标字节数与第二信息有关;The encoding device according to claim 26, wherein the target number of bytes of the current frame is related to the second information;
    所述第二信息为以下信息中的至少一种:The second information is at least one of the following information:
    所述当前帧的宽度、所述当前帧的高度、所述当前帧的位深、所述当前帧的编码格式或所述当前帧的图像压缩比。The width of the current frame, the height of the current frame, the bit depth of the current frame, the encoding format of the current frame, or the image compression ratio of the current frame.
  28. 根据权利要求22至27中任一项所述的编码装置,所述码率控制模块进一步用于:According to the encoding device according to any one of claims 22 to 27, the code rate control module is further used for:
    根据第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP;Updating the QP of n2 tiles in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold;
    其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数,n2为大于或等于2的正整数。Wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame, and the target frame is the first x frames and/or the last x frames of the current frame y frame, x and y are positive integers greater than or equal to 1, and n2 is a positive integer greater than or equal to 2.
  29. 根据权利要求28所述的编码装置,其特征在于,所述码率控制模块进一步用于:The encoding device according to claim 28, wherein the code rate control module is further used for:
    若所述第二差值为正值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的差值作为更新后的第一参数;If the second difference is a positive value, the difference between the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter;
    根据更新后的第一参数计算所述n2个瓦片的QP;Calculate the QP of the n2 tiles according to the updated first parameter;
    或,or,
    若所述第二差值为负值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的和作为更新后的第一参数;If the second difference is a negative value, the sum of the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter;
    根据更新后的第一参数计算所述n2个瓦片的QP。Calculate the QP of the n2 tiles according to the updated first parameter.
  30. 根据权利要求22至29中任一项所述的编码装置,其特征在于,若对所述当前帧进行多通道编码,所述复杂度计算模块进一步用于:The encoding device according to any one of claims 22 to 29, wherein if multi-channel encoding is performed on the current frame, the complexity calculation module is further used for:
    分别获取所述n1个瓦片中的每一个瓦片的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;Respectively acquire image complexity information of components of each of the n1 tiles, where the components include a luminance component and/or at least one chrominance component of the current frame;
    所述码率控制模块进一步用于:The code rate control module is further used for:
    根据所述分量中的至少一个分量的图像复杂度信息更新所述n1个瓦片的的QP。Updating the QPs of the n1 tiles according to the image complexity information of at least one of the components.
  31. 根据权利要求22至30中任一项所述的编码装置,其特征在于,所述复杂度计算模块进一步用于:The encoding device according to any one of claims 22 to 30, wherein the complexity calculation module is further used for:
    获取所述每一个瓦片的多个变换参数;Obtain multiple transformation parameters of each tile;
    从所述多个变换参数中选择一个参数作为所述每一个瓦片的图像复杂度信息。Selecting one parameter from the plurality of transformation parameters as the image complexity information of each tile.
  32. 根据权利要求22至31中任一项所述的编码装置,其特征在于,所述码率控制模块进一步用于:The encoding device according to any one of claims 22 to 31, wherein the code rate control module is further used for:
    若更新后的所述n1个瓦片的QP小于第三阈值,将所述第三阈值作为所述更新后的所述n1个瓦片的QP;或,If the updated QP of the n1 tiles is less than a third threshold, use the third threshold as the updated QP of the n1 tiles; or,
    若更新后的所述n1个瓦片的QP大于第四阈值,将所述第四阈值作为所述更新后的所述n1个瓦片的QP;If the updated QP of the n1 tiles is greater than a fourth threshold, use the fourth threshold as the updated QP of the n1 tiles;
    其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Wherein, the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  33. 根据权利要求22至32中任一项所述的编码装置,其特征在于,所述编码装置应用于联合摄影专家组扩展范围编码格式(JPEG XR编码格式)中。The encoding device according to any one of claims 22 to 32, wherein the encoding device is applied in the Joint Photographic Experts Group Extended Range encoding format (JPEG XR encoding format).
  34. 一种编码装置,其特征在于,包括:An encoding device, characterized in that it comprises:
    复杂度计算模块,用于获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数;The complexity calculation module is used to obtain the image complexity information of the current frame, and the image complexity information includes transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame;
    码率控制模块,用于根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP);A code rate control module, configured to determine an initial quantization parameter (initial QP) of the current frame according to the image complexity information;
    所述码率控制模块还用于:根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。The code rate control module is also used to: update the initial QP of the target frame according to the initial QP of the current frame, the target frame is the previous x frame and/or the next y frame of the current frame, and x and y are greater than or a positive integer equal to 1.
  35. 根据权利要求34所述的编码装置,其特征在于,所述码率控制模块进一步用于:The encoding device according to claim 34, wherein the code rate control module is further used for:
    根据所述第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新所述目标帧中的初始QP;updating the initial QP in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of a second threshold;
    其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值。Wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame.
  36. 根据权利要求35所述的编码装置,其特征在于,所述码率控制模块进一步用于:The encoding device according to claim 35, wherein the code rate control module is further used for:
    若所述第二差值为正值,将用于计算所述当前帧的初始QP中的第一参数与偏移参数的差值作为更新后的第一参数;If the second difference is a positive value, the difference between the first parameter and the offset parameter used to calculate the initial QP of the current frame is used as the updated first parameter;
    根据更新后的第一参数计算所述目标帧的初始QP;calculating the initial QP of the target frame according to the updated first parameter;
    或,or,
    若所述第二差值为负值,将用于计算前帧的初始QP中的第一参数与偏移参数的和作为更新后的第一参数;If the second difference is a negative value, the sum of the first parameter and the offset parameter used to calculate the initial QP of the previous frame is used as the updated first parameter;
    根据更新后的第一参数计算所述目标帧的初始QP。Calculate the initial QP of the target frame according to the updated first parameter.
  37. 根据权利要求34至36中任一项所述的编码装置,其特征在于,若对所述当前帧进行多通道编码,所述复杂度计算模块进一步用于:The encoding device according to any one of claims 34 to 36, wherein, if multi-channel encoding is performed on the current frame, the complexity calculation module is further used for:
    分别获取所述当前帧的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;Respectively acquire image complexity information of components of the current frame, where the components include a luminance component and/or at least one chrominance component of the current frame;
    所述码率控制模块进一步用于:The code rate control module is further used for:
    根据所述分量中的至少一个分量的图像复杂度信息更新所述目标帧的初始QP。Updating the initial QP of the target frame according to the image complexity information of at least one of the components.
  38. 根据权利要求34至37中任一项所述的编码装置,其特征在于,所述复杂度计算模块进一步用于:The encoding device according to any one of claims 34 to 37, wherein the complexity calculation module is further used for:
    获取所述当前帧的多个变换参数;Obtain a plurality of transformation parameters of the current frame;
    从所述多个变换参数中选择一个参数作为所述当前帧的图像复杂度信息。Selecting one parameter from the plurality of transformation parameters as the image complexity information of the current frame.
  39. 根据权利要求34至38中任一项所述的编码装置,其特征在于,所述码率控制模块进一步用于:The encoding device according to any one of claims 34 to 38, wherein the code rate control module is further used for:
    若更新后的所述目标帧的初始QP小于第三阈值,将所述第三阈值作为所述更新后的所述目标帧的的初始QP;或,If the updated initial QP of the target frame is less than a third threshold, using the third threshold as the updated initial QP of the target frame; or,
    若更新后的所述目标帧的的初始QP大于第四阈值,将所述第四阈值作为所述更新后的所述目标帧的的初始QP;If the updated initial QP of the target frame is greater than a fourth threshold, use the fourth threshold as the updated initial QP of the target frame;
    其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Wherein, the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  40. 根据权利要求34至39中任一项所述的编码装置,其特征在于,所述编码装置应用于联合摄影专家组扩展范围编码格式(JPEG XR编码格式)中。The encoding device according to any one of claims 34 to 39, wherein the encoding device is applied in the Joint Photographic Experts Group Extended Range encoding format (JPEG XR encoding format).
  41. 一种编码装置,其特征在于,包括:An encoding device, characterized in that it comprises:
    处理器,用于:获取当前帧中的n1个瓦片的每一个瓦片的图像复杂度信息,所述图像复杂度信息包括对所述每一个瓦片的像素值经过图像核变换处理(PCT处理)后得到的变换系数,n1为大于或等于2的正整数;The processor is configured to: acquire image complexity information of each of the n1 tiles in the current frame, the image complexity information including image kernel transformation processing (PCT) for the pixel value of each tile The transformation coefficient obtained after processing), n1 is a positive integer greater than or equal to 2;
    根据所述图像复杂度信息更新所述n1个瓦片的量化参数(QP)。Updating the quantization parameters (QP) of the n1 tiles according to the image complexity information.
  42. 根据权利要求41所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to claim 41, wherein the processor is further used for:
    根据所述图像复杂度信息计算所述n1个瓦片中的第i个瓦片的目标字节数的累积值,i为小于或等于n的正整数;calculating the cumulative value of the target number of bytes of the i-th tile among the n1 tiles according to the image complexity information, where i is a positive integer less than or equal to n;
    根据所述第i个瓦片的目标字节数的累积值更新所述第i个瓦片的QP。Updating the QP of the i-th tile according to the cumulative value of the target number of bytes of the i-th tile.
  43. 根据权利要求42所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to claim 42, wherein the processor is further used for:
    根据第一差值的绝对值与第一阈值更新所述第i个瓦片的QP,所述第一差值为所述第i个瓦片的目标字节数的累积值与所述第i个瓦片的实际编码字节数的累积值的差值。Update the QP of the i-th tile according to the absolute value of the first difference and the first threshold, the first difference is the cumulative value of the target number of bytes of the i-th tile and the i-th tile The difference between the cumulative value of the actual number of encoded bytes for tiles.
  44. 根据权利要求43所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to claim 43, wherein the processor is further used for:
    若所述第一差值为正值,将第i-1个瓦片的QP与第一偏移QP的差值作为所述第i个瓦片的QP;If the first difference is a positive value, use the difference between the QP of the i-1th tile and the first offset QP as the QP of the i-th tile;
    若所述第一差值为负值,将所述第i-1个瓦片的QP与所述第一偏移QP的和作为所述第i个瓦片的QP;If the first difference is a negative value, using the sum of the QP of the i-1th tile and the first offset QP as the QP of the i-th tile;
    其中,所述第一偏移QP是基于所述第一差值的绝对值和所述第一阈值得到的。Wherein, the first offset QP is obtained based on the absolute value of the first difference and the first threshold.
  45. 根据权利要求43或44所述的编码装置,其特征在于,所述第i个瓦片的目标字节数与第一信息有关;The encoding device according to claim 43 or 44, wherein the target number of bytes of the ith tile is related to the first information;
    所述第一信息为以下信息中的至少一个:The first information is at least one of the following information:
    所述当前帧的目标字节数、所述第i个瓦片的变换系数或所述当前帧的变换系数。The target number of bytes of the current frame, the transformation coefficient of the ith tile or the transformation coefficient of the current frame.
  46. 根据权利要求45所述的编码装置,其特征在于,所述当前帧的目标字节数与第二信息有关;The encoding device according to claim 45, wherein the target number of bytes of the current frame is related to the second information;
    所述第二信息为以下信息中的至少一种:The second information is at least one of the following information:
    所述当前帧的宽度、所述当前帧的高度、所述当前帧的位深、所述当前 帧的编码格式或所述当前帧的图像压缩比。The width of the current frame, the height of the current frame, the bit depth of the current frame, the encoding format of the current frame or the image compression ratio of the current frame.
  47. 根据权利要求41至46中任一项所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to any one of claims 41 to 46, wherein the processor is further configured to:
    根据第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新目标帧中的n2个瓦片的QP;Updating the QP of n2 tiles in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of the second threshold;
    其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数,n2为大于或等于2的正整数。Wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame, and the target frame is the first x frames and/or the last x frames of the current frame y frame, x and y are positive integers greater than or equal to 1, and n2 is a positive integer greater than or equal to 2.
  48. 根据权利要求47所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to claim 47, wherein the processor is further used for:
    若所述第二差值为正值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的差值作为更新后的第一参数;If the second difference is a positive value, the difference between the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter;
    根据更新后的第一参数计算所述n2个瓦片的QP;Calculate the QP of the n2 tiles according to the updated first parameter;
    或,or,
    若所述第二差值为负值,将用于计算所述n1个瓦片的QP中的第一参数与偏移参数的和作为更新后的第一参数;If the second difference is a negative value, the sum of the first parameter and the offset parameter used to calculate the QP of the n1 tiles is used as the updated first parameter;
    根据更新后的第一参数计算所述n2个瓦片的QP。Calculate the QP of the n2 tiles according to the updated first parameter.
  49. 根据权利要求41至48中任一项所述的编码装置,其特征在于,若对所述当前帧进行多通道编码,所述处理器进一步用于:The encoding device according to any one of claims 41 to 48, wherein if multi-channel encoding is performed on the current frame, the processor is further configured to:
    分别获取所述n1个瓦片中的每一个瓦片的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;Respectively acquire image complexity information of components of each of the n1 tiles, where the components include a luminance component and/or at least one chrominance component of the current frame;
    根据所述分量中的至少一个分量的图像复杂度信息更新所述n1个瓦片的的QP。Updating the QPs of the n1 tiles according to the image complexity information of at least one of the components.
  50. 根据权利要求41至49中任一项所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to any one of claims 41 to 49, wherein the processor is further configured to:
    获取所述每一个瓦片的多个变换参数;Obtain multiple transformation parameters of each tile;
    从所述多个变换参数中选择一个参数作为所述每一个瓦片的图像复杂度信息。Selecting one parameter from the plurality of transformation parameters as the image complexity information of each tile.
  51. 根据权利要求41至50中任一项所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to any one of claims 41 to 50, wherein the processor is further configured to:
    若更新后的所述n1个瓦片的QP小于第三阈值,将所述第三阈值作为所 述更新后的所述n1个瓦片的QP;或,If the updated QP of the n1 tiles is less than a third threshold, use the third threshold as the updated QP of the n1 tiles; or,
    若更新后的所述n1个瓦片的QP大于第四阈值,将所述第四阈值作为所述更新后的所述n1个瓦片的QP;If the updated QP of the n1 tiles is greater than a fourth threshold, use the fourth threshold as the updated QP of the n1 tiles;
    其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Wherein, the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  52. 根据权利要求41至51中任一项所述的编码装置,其特征在于,所述编码装置应用于联合摄影专家组扩展范围编码格式(JPEG XR编码格式)中。The encoding device according to any one of claims 41 to 51, wherein the encoding device is applied in the Joint Photographic Experts Group Extended Range encoding format (JPEG XR encoding format).
  53. 一种编码装置,其特征在于,包括:An encoding device, characterized in that it comprises:
    处理器,用于:Processor for:
    获取当前帧的图像复杂度信息,所述图像复杂度信息包括对所述当前帧的像素值经过图像核变换处理(PCT处理)后得到的变换系数;Obtaining image complexity information of the current frame, the image complexity information including transformation coefficients obtained after image kernel transformation processing (PCT processing) is performed on the pixel values of the current frame;
    根据所述图像复杂度信息确定所述当前帧的初始量化参数(初始QP);Determine the initial quantization parameter (initial QP) of the current frame according to the image complexity information;
    根据所述当前帧的初始QP更新目标帧的初始QP,所述目标帧为所述当前帧的前x帧和/或后y帧,x和y为大于或等于1的正整数。Update the initial QP of the target frame according to the initial QP of the current frame, the target frame is the previous x frames and/or the subsequent y frames of the current frame, and x and y are positive integers greater than or equal to 1.
  54. 根据权利要求53所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to claim 53, wherein the processor is further used for:
    根据所述第二差值的绝对值与所述当前帧的目标字节数的比值和第二阈值的大小更新所述目标帧中的初始QP;updating the initial QP in the target frame according to the ratio of the absolute value of the second difference to the target byte number of the current frame and the size of a second threshold;
    其中,所述第二差值为所述当前帧的目标字节数与所述当前帧的实际编码字节数的差值。Wherein, the second difference is the difference between the target number of bytes of the current frame and the actual number of encoded bytes of the current frame.
  55. 根据权利要求54所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to claim 54, wherein the processor is further used for:
    若所述第二差值为正值,将用于计算所述当前帧的初始QP中的第一参数与偏移参数的差值作为更新后的第一参数;If the second difference is a positive value, the difference between the first parameter and the offset parameter used to calculate the initial QP of the current frame is used as the updated first parameter;
    根据更新后的第一参数计算所述目标帧的初始QP;calculating the initial QP of the target frame according to the updated first parameter;
    或,or,
    若所述第二差值为负值,将用于计算前帧的初始QP中的第一参数与偏移参数的和作为更新后的第一参数;If the second difference is a negative value, the sum of the first parameter and the offset parameter used to calculate the initial QP of the previous frame is used as the updated first parameter;
    根据更新后的第一参数计算所述目标帧的初始QP。Calculate the initial QP of the target frame according to the updated first parameter.
  56. 根据权利要求53至55中任一项所述的编码装置,其特征在于,若 对所述当前帧进行多通道编码,所述处理器进一步用于:The encoding device according to any one of claims 53 to 55, wherein if multi-channel encoding is performed on the current frame, the processor is further used for:
    分别获取所述当前帧的分量的图像复杂度信息,所述分量包括所述当前帧的亮度分量和/或至少一个色度分量;respectively acquiring image complexity information of components of the current frame, where the components include a luma component and/or at least one chrominance component of the current frame;
    根据所述分量中的至少一个分量的图像复杂度信息更新所述目标帧的初始QP。Updating the initial QP of the target frame according to the image complexity information of at least one of the components.
  57. 根据权利要求53至56中任一项所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to any one of claims 53 to 56, wherein the processor is further configured to:
    获取所述当前帧的多个变换参数;Obtain a plurality of transformation parameters of the current frame;
    从所述多个变换参数中选择一个参数作为所述当前帧的图像复杂度信息。Selecting one parameter from the plurality of transformation parameters as the image complexity information of the current frame.
  58. 根据权利要求53至57中任一项所述的编码装置,其特征在于,所述处理器进一步用于:The encoding device according to any one of claims 53 to 57, wherein the processor is further configured to:
    若更新后的所述目标帧的初始QP小于第三阈值,将所述第三阈值作为所述更新后的所述目标帧的的初始QP;或,If the updated initial QP of the target frame is less than a third threshold, using the third threshold as the updated initial QP of the target frame; or,
    若更新后的所述目标帧的的初始QP大于第四阈值,将所述第四阈值作为所述更新后的所述目标帧的的初始QP;If the updated initial QP of the target frame is greater than a fourth threshold, use the fourth threshold as the updated initial QP of the target frame;
    其中,所述第三阈值为用于编码的QP的最小值,所述第四阈值为用于编码的QP的最大值。Wherein, the third threshold is the minimum value of the QP used for encoding, and the fourth threshold is the maximum value of the QP used for encoding.
  59. 根据权利要求53至58中任一项所述的编码装置,其特征在于,所述编码装置应用于联合摄影专家组扩展范围编码格式(JPEG XR编码格式)中。The encoding device according to any one of claims 53 to 58, wherein the encoding device is applied in the Joint Photographic Experts Group Extended Range encoding format (JPEG XR encoding format).
  60. 一种计算机可读存储介质,其特征在于,包括程序指令,所述程序指令被计算机运行时,所述计算机执行如权利要求1至19中任一项所述的编码方法。A computer-readable storage medium, characterized by comprising program instructions, and when the program instructions are executed by a computer, the computer executes the encoding method according to any one of claims 1 to 19.
PCT/CN2021/098383 2021-06-04 2021-06-04 Encoding method and encoding device WO2022252222A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2021/098383 WO2022252222A1 (en) 2021-06-04 2021-06-04 Encoding method and encoding device
CN202180094389.9A CN116918331A (en) 2021-06-04 2021-06-04 Coding method and coding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/098383 WO2022252222A1 (en) 2021-06-04 2021-06-04 Encoding method and encoding device

Publications (1)

Publication Number Publication Date
WO2022252222A1 true WO2022252222A1 (en) 2022-12-08

Family

ID=84323728

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/098383 WO2022252222A1 (en) 2021-06-04 2021-06-04 Encoding method and encoding device

Country Status (2)

Country Link
CN (1) CN116918331A (en)
WO (1) WO2022252222A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117478891A (en) * 2023-12-28 2024-01-30 辽宁云也智能信息科技有限公司 Intelligent management system for building construction

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117478881A (en) * 2023-11-06 2024-01-30 淘宝(中国)软件有限公司 Video information processing method, system, device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5991452A (en) * 1993-04-02 1999-11-23 Fujitsu Limited Image and code data compression apparatus
CN101094411A (en) * 2007-07-03 2007-12-26 芯瀚电子技术(上海)有限公司 Code rate control method of video code
CN104125460A (en) * 2013-04-26 2014-10-29 韩国科亚电子股份有限公司 Method and apparatus for controlling video bitrates
CN109076212A (en) * 2017-12-27 2018-12-21 深圳市大疆创新科技有限公司 The method and code device of code rate control
CN110495174A (en) * 2018-04-04 2019-11-22 深圳市大疆创新科技有限公司 Coding method, device, image processing system and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5991452A (en) * 1993-04-02 1999-11-23 Fujitsu Limited Image and code data compression apparatus
CN101094411A (en) * 2007-07-03 2007-12-26 芯瀚电子技术(上海)有限公司 Code rate control method of video code
CN104125460A (en) * 2013-04-26 2014-10-29 韩国科亚电子股份有限公司 Method and apparatus for controlling video bitrates
CN109076212A (en) * 2017-12-27 2018-12-21 深圳市大疆创新科技有限公司 The method and code device of code rate control
CN110495174A (en) * 2018-04-04 2019-11-22 深圳市大疆创新科技有限公司 Coding method, device, image processing system and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117478891A (en) * 2023-12-28 2024-01-30 辽宁云也智能信息科技有限公司 Intelligent management system for building construction
CN117478891B (en) * 2023-12-28 2024-03-15 辽宁云也智能信息科技有限公司 Intelligent management system for building construction

Also Published As

Publication number Publication date
CN116918331A (en) 2023-10-20

Similar Documents

Publication Publication Date Title
US11025907B2 (en) Receptive-field-conforming convolution models for video coding
RU2643504C1 (en) Advanced intraframe prediction coding using planar representations
RU2663199C1 (en) Image coding device, image coding method, image decoding device, image decoding method and data storage medium
KR101247042B1 (en) Prediction of transform coefficients for image compression
TW202044834A (en) Method and system for processing video content
CN103782598A (en) Fast encoding method for lossless coding
WO2022252222A1 (en) Encoding method and encoding device
WO2021203394A1 (en) Loop filtering method and apparatus
JP2007116558A (en) Moving image encoding apparatus
CN114145016A (en) Matrix weighted intra prediction for video signals
WO2021134706A1 (en) Loop filtering method and device
WO2020103800A1 (en) Video decoding method and video decoder
JP2013500661A (en) Method for decoding a stream of encoded data representing an image sequence and method for encoding an image sequence
EP3743855A1 (en) Receptive-field-conforming convolution models for video coding
US20130300893A1 (en) Two-dimensional signal encoding device
WO2021185008A1 (en) Encoding method, decoding method, encoder, decoder, and electronic device
WO2021196035A1 (en) Video coding method and apparatus
WO2023005830A1 (en) Predictive coding method and apparatus, and electronic device
CN113068025B (en) Decoding prediction method, device and computer storage medium
WO2022155923A1 (en) Encoding method, decoding method, encoder, decoder, and electronic device
CN117692633A (en) Video encoding, decoding method and apparatus for prediction from multiple cross components
JP2018032909A (en) Image coding device, control method therefor, imaging apparatus and program
WO2021134654A1 (en) Video encoding method and apparatus
CN112640458A (en) Information processing method and device, equipment and storage medium
CN112913242B (en) Encoding method and encoding device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21943583

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180094389.9

Country of ref document: CN

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21943583

Country of ref document: EP

Kind code of ref document: A1