Image coding method and device, image decoding method and device, electronic equipment, chip and medium

The image encoding method addresses high complexity and numerous encoding modes by limiting quantization parameters to two modes, improving efficiency and reducing image size for efficient data transmission and storage.

CN119254967APending Publication Date: 2025-01-03BEIJING X RING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310807908.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-03
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Existing image compression technologies face high complexity and numerous encoding modes, leading to inefficiencies in encoding and decoding processes.

Method used

An image encoding method that reduces the number of quantization parameters by determining a quantization parameter list with only two encoding modes, variable-length and fixed-length encoding, thereby improving efficiency and facilitating data transmission and storage.

Benefits of technology

The method effectively controls the quantization parameter list, reducing the number of traversed parameters and enhancing encoding and decoding efficiency while minimizing image size under acceptable visual quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254967A_ABST
    Figure CN119254967A_ABST
Patent Text Reader

Abstract

The invention provides an image coding method and device, an image decoding method and device, electronic equipment, a chip and a medium, and relates to the technical field of image processing, and the method comprises the steps: obtaining a first coding parameter and a second coding parameter of an input image; determining a quantization parameter list and a first quantization parameter in the quantization parameter list based on the first coding parameter and the second coding parameter; first coding is carried out on the first image block through the first quantization parameter and the coding mode to obtain image coding data, the coding mode comprises variable-length coding or fixed-length coding, a quantization parameter list of coding parameters of an image can be effectively controlled, traversal quantization parameters are reduced by determining the quantization parameter list, and the coding efficiency of the image is improved. And only two coding modes are included in the coding process, the variable-length coding mode or the fixed-length coding mode can be covered, the coding and decoding efficiency is improved, and data transmission and storage are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to an image encoding method, an image decoding method, a device, an electronic device, a chip and a medium. Background Art

[0002] In order to reduce the amount of data transmitted by an image, it is necessary to compress and encode the image to reduce the amount of data. The image compression technology of related technologies can be divided into two categories: lossy compression and lossless compression. Common lossy compression is JPEG compression based on Discrete Cosine Transform (DCT). JPEG is a standard way to compress grayscale images and true color images. Summary of the invention

[0003] The present disclosure provides an image encoding method, an image decoding method, an apparatus, an electronic device, a chip and a medium to solve the problem of a large number of encoding modes and high complexity in related technologies. The quantization parameter list of the encoding parameters of the image can be effectively controlled. By determining the quantization parameter list, the traversed encoding parameters are reduced. The list only includes two encoding modes, which can cover both variable-length encoding and fixed-length encoding modes, thereby improving encoding and decoding efficiency and facilitating data transmission and storage.

[0004] The first aspect embodiment of the present disclosure proposes an image encoding method, which includes: obtaining a first encoding parameter and a second encoding parameter of an input image; determining a quantization parameter list and a first quantization parameter in the quantization parameter list based on the first encoding parameter and the second encoding parameter; performing a first encoding on a first image block through the first quantization parameter and an encoding mode to obtain image encoding data, wherein the encoding mode includes variable-length encoding or fixed-length encoding.

[0005] In some embodiments of the present disclosure, obtaining first encoding parameters and second encoding parameters of an input image includes: preprocessing the input image to determine a first encoding parameter of a first image block in the input image; performing a second encoding on the first image block to determine a second encoding parameter.

[0006] In some embodiments of the present disclosure, preprocessing an input image to determine a first encoding parameter of a first image block in the input image includes: dividing the input image into a plurality of second image blocks of preset sizes; dividing the plurality of second image blocks into a plurality of first image blocks, wherein the size of the plurality of first image blocks is less than or equal to the size of the second image blocks; determining a third encoding parameter and a sum of absolute errors of the plurality of first image blocks; and determining the first encoding parameter through the third encoding parameter and the sum of absolute errors.

[0007] In some embodiments of the present disclosure, determining the sum of absolute errors of multiple first image blocks and a third encoding parameter includes: determining the third encoding parameter based on the compression rate of the input image and the size of the second image block, the compression rate being the ratio of a preset image size to the input image size; and determining the sum of absolute errors of multiple first image blocks based on the pixel values ​​of the first image blocks.

[0008] In some embodiments of the present disclosure, performing a second encoding on the first image block and determining the second encoding parameter includes: determining a third quantization parameter according to a compression rate of the input image; determining a second quantization parameter based on the third quantization parameter; and performing a second encoding on the first image block using the second quantization parameter to determine the second encoding parameter.

[0009] In some embodiments of the present disclosure, based on the first encoding parameter and the second encoding parameter, determining a quantization parameter list includes: judging the size relationship between the first encoding parameter and the second encoding parameter; when the first encoding parameter is greater than the second encoding parameter, determining a first quantization parameter list, the maximum quantization parameter of the first quantization parameter list includes the second quantization parameter, and the minimum quantization parameter includes a first preset value; when the first encoding parameter is less than the second encoding parameter, determining a second quantization parameter list, the maximum quantization parameter of the second quantization parameter list includes a third quantization parameter, and the minimum quantization parameter includes the sum of the second quantization parameter and the second preset value.

[0010] In some embodiments of the present disclosure, the method further includes: when the first encoding parameter is equal to the second encoding parameter, using the second quantization parameter as the first quantization parameter.

[0011] In some embodiments of the present disclosure, determining the first quantization parameter in a quantization parameter list based on the first encoding parameter and the second encoding parameter includes: determining multiple quantization parameters in the first quantization parameter list or the second quantization parameter list, the multiple quantization parameters including the first quantization parameter; performing a third encoding on the input image using the multiple quantization parameters respectively to obtain the first quantization parameter corresponding to the fourth encoding parameter, the fourth encoding parameter being less than or equal to the first encoding parameter.

[0012] In some embodiments of the present disclosure, a first encoding is performed on a first image block using a first quantization parameter and an encoding mode to obtain image encoding data, and the encoding mode includes variable-length encoding or fixed-length encoding, including: determining the size of a fifth encoding parameter corresponding to the variable-length encoding and a sixth encoding parameter corresponding to the fixed-length encoding; when the fifth encoding parameter is less than the sixth encoding parameter, determining that the encoding mode is variable-length encoding; when the fifth encoding parameter is greater than the sixth encoding parameter, determining that the encoding mode is fixed-length encoding, and the fifth encoding parameter and the sixth encoding parameter are obtained through the first encoding.

[0013] The second aspect embodiment of the present disclosure proposes an image decoding method, which includes: parsing received image encoding data to obtain a first quantization parameter and an encoding mode corresponding to a first image block, the encoding mode including variable-length encoding or fixed-length encoding; performing a first decoding on the first image block based on a decoding mode corresponding to the encoding mode to obtain an output image.

[0014] The third aspect embodiment of the present disclosure proposes an image encoding device, which includes: an acquisition unit, used to acquire a first encoding parameter and a second encoding parameter of an input image; a determination unit, used to determine a quantization parameter list and a first quantization parameter in the quantization parameter list based on the first encoding parameter and the second encoding parameter; an encoding unit, used to perform a first encoding on a first image block through a first quantization parameter and an encoding mode to obtain image encoding data, wherein the encoding mode includes variable-length encoding or fixed-length encoding.

[0015] The fourth aspect embodiment of the present disclosure proposes an image decoding device, which includes: a parsing unit, used to parse received image encoding data to obtain a first quantization parameter and an encoding mode corresponding to a first image block, the encoding mode including variable-length encoding or fixed-length encoding; a decoding unit, used to perform a first decoding on the first image block based on a decoding mode corresponding to the encoding mode to obtain an output image.

[0016] The fifth aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect embodiment or the second aspect embodiment of the present disclosure.

[0017] The sixth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment or the second aspect embodiment of the present disclosure.

[0018] The seventh aspect embodiment of the present disclosure proposes a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from the memory of the electronic device and send signals to the processor, the signals include computer instructions stored in the memory, when the processor executes the computer instructions, the electronic device executes the method described in the first aspect embodiment or the second aspect embodiment of the present disclosure.

[0019] In summary, according to the image encoding method proposed in the present invention, a first encoding parameter and a second encoding parameter of an input image are obtained; based on the first encoding parameter and the second encoding parameter, a quantization parameter list and a first quantization parameter in the quantization parameter list are determined; a first encoding is performed on the first image block through the first quantization parameter and the encoding mode to obtain image encoding data, and the encoding mode includes variable-length coding or fixed-length coding, which can effectively control the quantization parameter list of the encoding parameters of the image, and by determining the quantization parameter list, the traversed quantization parameters are reduced, and the encoding process only includes two encoding modes, which can cover both variable-length coding and fixed-length coding modes, thereby improving encoding and decoding efficiency and facilitating data transmission and storage.

[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0022] Figure 1 A flowchart of an image encoding method provided by an embodiment of the present disclosure;

[0023] Figure 2 A flowchart of an image encoding method provided by an embodiment of the present disclosure;

[0024] Figure 3 A flowchart of an image decoding method provided by an embodiment of the present disclosure;

[0025] Figure 4 A schematic diagram of a specific image encoding method provided by an embodiment of the present disclosure;

[0026] Figure 5 A schematic diagram of a specific image decoding method provided by an embodiment of the present disclosure;

[0027] Figure 6 A schematic diagram of the structure of an image encoding device provided by an embodiment of the present disclosure;

[0028] Figure 7 A schematic diagram of the structure of an image decoding device provided by an embodiment of the present disclosure;

[0029] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0031] In the related technology, the JPEG compression process first divides the image into 8*8 sub-blocks, and performs DCT transformation, quantization, and entropy coding on each sub-block in order from left to right and from top to bottom. Lossless compression includes JPEG lossless compression. The main content of JPEG lossless compression can be summarized as pixel-by-pixel prediction of the input image and entropy coding process. Compared with lossless compression, lossy compression can reduce the amount of data to a greater extent. Correspondingly, lossy compression will cause certain damage to the quality of the image. The degree of damage is determined by the degree of quantization. Generally, the larger the quantization value, the greater the damage and the smaller the amount of data after compression.

[0032] In the related art, in order to solve the problem of large data volume, through four encoding modes, the candidate quantization parameter list (QP candidate list) is: [0, bitdepth], where bitdepth represents the bit width of the current image, and the quantization parameters (QP values) in all candidate quantization parameter lists and the encoding parameters corresponding to the four encoding modes under the quantization parameters (QP values) are traversed, and the minimum quantization parameter and encoding mode corresponding to the encoding parameter less than or equal to the target encoding parameter are selected for final encoding. This method has too many encoding modes and high complexity.

[0033] In order to solve the problem of too many and high complexity of coding modes existing in related technologies, the present disclosure proposes an image coding scheme, which can effectively reduce the number of quantization parameters traversed by determining a quantization parameter list, and only includes two coding modes, covering variable-length coding or fixed-length coding, thereby improving encoding and decoding efficiency, reducing the image size as much as possible under acceptable visual damage, and facilitating data transmission and storage.

[0034] The method proposed in the present disclosure can be applied to application scenarios suitable for image encoding and decoding, and can also be applied to fields such as terminal photography, video recording and industrial camera imaging. Specifically, it can be applied to the process of image compression, which is not limited in the embodiments of the present disclosure.

[0035] The image encoding method and image decoding method provided by the present application are described in detail below with reference to the accompanying drawings.

[0036] Figure 1This is a flowchart of an image encoding method provided by an embodiment of the present disclosure. The solution of the present disclosure can be applied to terminals such as mobile phones and tablet computers, and can be stored in a storable medium in the form of software. When the software is executed, the technical solution of the present disclosure is implemented. Figure 1 As shown, the image encoding method includes steps 101-103.

[0037] Step 101: Obtain a first encoding parameter and a second encoding parameter of an input image.

[0038] In an embodiment of the present disclosure, it is necessary to first segment the input image to obtain a first image block, and obtain a first encoding parameter and a second encoding parameter of the first image block. The first encoding parameter refers to the target number of encoding bits, that is, the target number of encoding bits of the current first image block. The first encoding parameter is obtained by calculating the absolute error sum of the first image block. The second encoding parameter refers to the number of encoding bits obtained by the second encoding, and the second encoding refers to the process of encoding by the second quantization parameter obtained based on the compression rate of the input image.

[0039] Step 102: Determine a quantization parameter list and a first quantization parameter in the quantization parameter list based on the first encoding parameter and the second encoding parameter.

[0040] In an embodiment of the present disclosure, a quantization parameter list is determined by judging the magnitude relationship between the first encoding parameter and the second encoding parameter, and a first quantization parameter in the quantization parameter list is determined. The quantization parameter list includes the first quantization parameter list and the second quantization parameter list.

[0041] The first quantization parameter refers to a first quantization parameter corresponding to a fourth encoding parameter determined in a first encoding process, wherein the fourth encoding parameter is less than or equal to the first encoding parameter.

[0042] Specifically, the quantization parameter list includes multiple quantization parameters, and the first encoding is performed respectively by the multiple quantization parameters in a certain order to obtain a fourth encoding parameter that is less than or equal to the first encoding parameter. The quantization parameter corresponding to the fourth encoding parameter is the first quantization parameter.

[0043] It can be understood that in the first encoding process, multiple quantization parameters in the quantization parameter list can be traversed in ascending order, so the first encoding parameter that is less than or equal to the first encoding parameter can be used as the fourth encoding parameter, and its corresponding quantization parameter is the first quantization parameter.

[0044] Step 103 , performing first encoding on the first image block by using a first quantization parameter and an encoding mode to obtain image encoding data, where the encoding mode includes variable length encoding or fixed length encoding.

[0045] In an embodiment of the present disclosure, the first image block is encoded using the first quantization parameter determined above and the encoding mode determined above to obtain an image encoding order.

[0046] The coding mode refers to the mode that saves the most coding bits in the coding process, that is, comparing the fifth coding parameters corresponding to the variable-length coding and the fixed-length coding.

[0047] Fixed-length coding means that the coding length of each symbol is the same, such as binary code, octal code, hexadecimal code, etc. Their coding lengths are fixed, such as the coding length of binary code is 1 bit, the coding length of octal code is 3 bits, and the coding length of hexadecimal code is 4 bits. Variable-length coding means that the coding length of each symbol is not necessarily the same, such as Huffman code, entropy coding, etc. Their coding lengths are determined according to the probability of the symbol appearing. The greater the probability of appearance, the shorter the coding length, and the smaller the probability of appearance, the longer the coding length. Both fixed-length coding and variable-length coding are used to encode information. The advantage of fixed-length coding is simple coding, and the disadvantage is low coding efficiency; the advantage of variable-length coding is high coding efficiency, and the disadvantage is complex coding.

[0048] In summary, according to the image encoding method proposed in the present invention, a first encoding parameter and a second encoding parameter of an input image are obtained; based on the first encoding parameter and the second encoding parameter, a quantization parameter list and a first quantization parameter in the quantization parameter list are determined; a first encoding is performed on the first image block through the first quantization parameter and the encoding mode to obtain image encoding data, and the encoding mode includes variable-length coding or fixed-length coding, which can effectively control the quantization parameter list of the encoding parameters of the image, and by determining the quantization parameter list, the traversed quantization parameters are reduced, and the encoding process only includes two encoding modes, which can cover both variable-length coding and fixed-length coding modes, thereby improving encoding and decoding efficiency and facilitating data transmission and storage.

[0049] based on Figure 1 The embodiment shown, Figure 2 The following further shows a flowchart of an image encoding method proposed in the present disclosure. Figure 2 based on Figure 1 In the embodiment shown, step 101 and step 103 are further defined. Figure 2 In the embodiment shown, step 101 includes step 201 and step 202; step 102 includes step 203 and step 204. Figure 2 As shown, the method comprises the following steps:

[0050] Step 201 : preprocess an input image to determine a first encoding parameter of a first image block in the input image.

[0051] In an embodiment of the present disclosure, an input image is divided into a plurality of second image blocks of preset sizes; the plurality of second image blocks are divided into a plurality of first image blocks, and the sizes of the plurality of first image blocks are less than or equal to the sizes of the second image blocks; a third encoding parameter and a sum of absolute errors of the plurality of first image blocks are determined; and the first encoding parameter is determined through the third encoding parameter and the sum of absolute errors.

[0052] The preset size of the second image block is not limited in the embodiment of the present disclosure. The first image block is a micro block of the second image block.

[0053] The third encoding parameter is calculated based on the compression rate of the input image and the size of the second image block, and the compression rate is the ratio of the preset image size to the input image size. The absolute error sum of the first image block can be SAD (Sum of absolute differences), which is commonly used for image block matching. The absolute value of the difference between the corresponding values ​​of each pixel is summed to evaluate the similarity of the two image blocks. In the present disclosure, the absolute error sum is determined based on the pixel value of the first image block and the predicted pixel value; the predicted pixel value is the pixel value of the image block that has been encoded and reconstructed around the first image block, that is, the pixel value in the reconstructed image block that is closest to the current pixel value of the first image block.

[0054] In an optional embodiment of the present disclosure, the input image is first divided into blocks into second image blocks of the same size, and the size of the second image block may be: 2^i*2^j (i, j=0, 1, 2....n).

[0055] Preprocess the current second image block, calculate the SAD (Sum of Absolute Differences) by formula 1, divide the second image block into sub-blocks MB (Micro Block) of the same size, that is, the first image block, and the size of the first image block is smaller than or equal to the second image block;

[0056]

[0057] Where SAD represents the sum of absolute differences, pixel(i) represents the pixel value of the first image, pred(i) represents the predicted pixel value, and mb _ size represents the size of the first image block, and i represents the position of the pixel.

[0058] The rate control system can calculate the target number of bits (i.e., the first encoding parameter) of the current first image block based on the obtained absolute error sum and the target number of bits corresponding to the current second image block through Formula 2:

[0059] mb_target_bits = function(sad, block_target_bits) Formula 2

[0060] The target number of bits corresponding to the current second image block can be calculated by formula 3:

[0061] bock_target_bits=comp_ratio*block_size Formula 3

[0062] Among them, mb_target_bits represents the first encoding parameter, sad represents the absolute error sum, block_target_bits represents the target number of bits corresponding to the current second image block, comp_ratio represents the compression ratio of the input image (ie, the target compression ratio), and block_size represents the size of the current second image block.

[0063] Step 202: perform second encoding on the first image block and determine second encoding parameters.

[0064] In the disclosed embodiment, a third quantization parameter is determined according to the compression rate of the input image; a second quantization parameter is determined based on the third quantization parameter; and a second encoding parameter is determined by performing a second encoding on the first image block using the second quantization parameter.

[0065] The third quantization parameter is the maximum quantization parameter of the current first image block calculated by the compression rate. The second quantization parameter refers to the initial quantization parameter calculated by the third quantization parameter determined by the compression rate in the first image block, that is, the second quantization parameter is half of the third quantization parameter.

[0066] In an optional embodiment of the present disclosure, the third quantization parameter (maximum QP value) may be calculated according to the compression rate according to Formula 4:

[0067] max_qp = bitdepth - (bitdepth * comp_ratio) + 1 Formula 4

[0068] Where bitdepth represents the bit width of the current image, and comp_ratio represents the target compression ratio.

[0069] The second quantization parameter is calculated based on the third quantization parameter by company 5, that is, (initialization QP value):

[0070]

[0071] The second encoding (pre-encoding) is performed through qp_init to obtain the number of encoding bits pre_mb_bits in the pre-encoding process, that is, the second encoding parameter.

[0072] Step 203: Determine the magnitudes of the first coding parameter and the second coding parameter, and based on the determination result, determine the quantization parameter list.

[0073] In the embodiments of the present disclosure, determine the magnitudes of the first coding parameter and the second coding parameter; in the case where the first coding parameter is greater than the second coding parameter, determine the first quantization parameter list, where the maximum quantization parameter of the first quantization parameter list includes the second quantization parameter, and the minimum quantization parameter includes the first preset value; in the case where the first coding parameter is less than the second coding parameter, determine the second quantization parameter list, where the maximum quantization parameter of the second quantization parameter list includes the third quantization parameter, and the minimum quantization parameter includes the sum of the second quantization parameter and the second preset value.

[0074] The first preset value may be 0 in the present disclosure, that is, the first quantization parameter list refers to the range of multiple quantization parameters between 0 and the second quantization parameter. The second preset value may be 1 in the present disclosure, that is, the second quantization parameter list refers to the range of multiple quantization parameters between the sum of the second quantization parameter and 1 and the third quantization parameter.

[0075] In addition, in the case where the first coding parameter is equal to the second coding parameter, the second quantization parameter may be directly used as the first quantization parameter.

[0076] In an alternative embodiment of the present disclosure, compare the MB pre-coding bit number (the second quantization parameter) with the target bit number (the first quantization parameter) to obtain a candidate QP list (quantization parameter list):

[0077] If pre_mb_bits (the second coding parameter) < target_mb_bits (the first coding parameter), at this time, the minimum quantization parameter in the first quantization parameter list is 0 (qp_min = 0), and the maximum quantization parameter is the second quantization parameter (qp_max = qp_init);

[0078] If pre_mb_bits (the second coding parameter) > target_mb_bits (the first coding parameter), at this time, the minimum quantization parameter in the second quantization parameter list is the value of the second quantization parameter plus 1 (qp_min = qp_init + 1), and the maximum quantization parameter is the third quantization parameter (qp_max = max_qp).

[0079] If pre_mb_bits (the second coding parameter) = target_mb_bits (the first coding parameter), use the second quantization parameter at this time as the first quantization parameter (final_qp = qp_init).

[0080] Step 204: Determine the first quantization parameter in the quantization parameter list.

[0081] In an embodiment of the present disclosure, multiple quantization parameters in a first quantization parameter list or a second quantization parameter list are determined, and the multiple quantization parameters include a first quantization parameter; a third encoding is performed on the input image using the multiple quantization parameters respectively to obtain the first quantization parameter corresponding to a fourth encoding parameter, and the fourth encoding parameter is less than or equal to the first encoding parameter.

[0082] The multiple quantization parameters refer to all quantization parameters in the first quantization parameter list or the second quantization parameter list. The first quantization parameter refers to the quantization parameter corresponding to the first encoding parameter obtained by traversing multiple quantization parameters in order from small to large and encoding, and the first encoding parameter that is less than or equal to the first encoding parameter is the fourth encoding parameter.

[0083] In an optional embodiment of the present disclosure, all QP values ​​in [qp_min, qp_max] are traversed to find the number of coded bits corresponding to each QP value, and the minimum QP value corresponding to the number of coded bits less than or equal to target_mb_bits is used as the QP value required for the final encoding, that is, final_qp.

[0084] Step 205 , performing first encoding on the first image block by using a first quantization parameter and an encoding mode to obtain image encoding data, wherein the encoding mode includes variable length encoding or fixed length encoding.

[0085] In the embodiment of the present disclosure, it is necessary to determine the size of the fifth coding parameter corresponding to the variable-length coding and the sixth coding parameter corresponding to the fixed-length coding; when the fifth coding parameter is less than the sixth coding parameter, the coding mode is determined to be variable-length coding; when the fifth coding parameter is greater than the sixth coding parameter, the coding mode is determined to be fixed-length coding, and the fifth coding parameter and the sixth coding parameter are obtained through the first coding. The first encoding is performed on the first image block based on the determined coding mode and the first quantization parameter. In other words, the coding mode is to determine the coding mode that saves the most coding bits by determining the size of the coding bits corresponding to different coding modes.

[0086] In an optional embodiment of the present disclosure, final_qp needs to be written into the bitstream during encoding, and the encoding process and the determination of the encoding mode can be carried out in the following manner:

[0087] The encoding process predicts the input pixel to obtain the predicted value, subtracts the predicted value from the original pixel value to obtain the residual (diff), and then quantizes the residual:

[0088] round=(1<<(QP-1))–1

[0089] diff_qp=(diff+round)>>QP,diff>=0

[0090] diff_qp=(-diff-round)>>QP,diff<0

[0091] Map the absolute value of the quantized residual to obtain the final coding coefficient:

[0092] dif_map=abs(diff_qp)*2,diff_qp>=0

[0093] dif_map=abs(diff_qp)*2–1,diff_qp<0

[0094] The dif_map is entropy encoded using Golomb coding. The k value of Golomb coding is initialized to default_k, and the value range is: [1, bitdepth]. The next encoding value k = (log2(dif_map+1)+k)>>1, and the number of Golomb coding bits glb_mb_bits is obtained. In addition, the number of coding bits required for residual direct transmission is calculated: the maximum value in dif_map is obtained, and the number of bits required for the maximum value transmission is used as the number of bits required for the current direct transmission encoding of each dif_map value. From this, the number of bits required for direct transmission can be calculated, and then compared with the number of bits required for Golomb coding. If the number of Golomb coding bits is greater than the number of bits required for residual direct transmission, then the current coding mode uses residual direct transmission, otherwise Golomb coding is used. The coding mode needs to be written into the bitstream during encoding.

[0095] It can be understood that the above encoding process and determination of the encoding mode are applicable to any encoding process, that is, applicable to the second encoding (pre-encoding) and third encoding processes of the present disclosure.

[0096] In summary, through the method provided by the present invention, the input image is preprocessed, the first encoding parameter of the first image block in the input image is determined, the first image block is second-encoded, the second encoding parameter is determined, the size of the first encoding parameter and the second encoding parameter is judged, and based on the judgment result, a quantization parameter list is determined, the first quantization parameter in the quantization parameter list is determined, and the first image block is first encoded by the first quantization parameter and the encoding mode to obtain image encoding data. The encoding mode includes variable-length coding or fixed-length coding, and the quantization parameter list of the encoding parameters of the image can be effectively controlled. The QP candidate list is determined by pre-encoding, and there is no need to traverse bitdepth QP values, thereby reducing the number of traversed QPs, effectively controlling the number of encoding bits of each second image block (block) within a limited range, and the number of encoding bits of the entire frame image is controlled within the compression rate range, thereby improving the encoding and decoding efficiency and facilitating data transmission and storage.

[0097] Figure 3 This is a flowchart of an image decoding method provided by an embodiment of the present disclosure. The solution of the present disclosure can be applied to terminals such as mobile phones and tablet computers, and can be stored in a storable medium in the form of software. When the software is executed, the technical solution of the present disclosure is implemented. Figure 3 As shown, the image encoding method includes steps 301-302.

[0098] Step 301 , parse the received image coding data to obtain a first quantization parameter and a coding mode corresponding to a first image block, where the coding mode includes variable-length coding or fixed-length coding.

[0099] Step 302: Perform a first decoding on the first image block based on a decoding mode corresponding to the encoding mode to obtain an output image.

[0100] In an embodiment of the present disclosure, after receiving the bit stream, the decoding end first decodes the first quantization parameter (QP value) of the current first image block (MB), then decodes the encoding mode, and then decodes the current MB through the decoding mode corresponding to the encoding mode (for example, entropy decoding), dequantizes and predicts and reconstructs to obtain reconstructed pixels to obtain an output image.

[0101] In summary, the received image coding data is parsed to obtain the first quantization parameter and coding mode corresponding to the first image block, the coding mode includes variable-length coding or fixed-length coding, and the first image block is first decoded based on the decoding mode corresponding to the coding mode to obtain an output image. The quantization parameter list of the coding parameters of the image can be effectively controlled. By determining the quantization parameter list, the traversed quantization parameters are reduced, and the encoding process only includes two coding modes, which can cover both variable-length coding and fixed-length coding modes, thereby improving the encoding and decoding efficiency and facilitating data transmission and storage.

[0102] based on Figure 1 , Figure 2 as well as Figure 3 In the illustrated embodiment, the present disclosure provides Figure 4 , Figure 5 A specific image encoding method and a specific image decoding method are shown.

[0103] In an embodiment of the present disclosure, during the encoding process, it is necessary to first divide the input image into blocks to obtain a first image block, and then obtain the corresponding absolute error sum by preprocessing the first image block. According to the compression rate, the maximum QP value, that is, the third quantization parameter, is calculated, and the second quantization parameter is determined by the third quantization parameter. Precoding is performed with the second quantization parameter to calculate the number of precoded bits, that is, the second coding parameter. The rate control system calculates the first coding parameter of the current first image block through the absolute error sum obtained by preprocessing and the third coding parameter. Compare the size of the second coding parameter with the first coding parameter to obtain a candidate QP list, that is, a quantization parameter list. By traversing the candidate QP list, the first quantization parameter is determined, and the first quantization parameter is encoded in the encoding module to output a code stream. Among them, the encoding mode needs to be determined during the encoding process using the first quantization parameter.

[0104] In an embodiment of the present disclosure, during the decoding process, the input code stream is decoded to obtain a QP value and a coding mode, the corresponding decoding mode (such as entropy decoding) is determined by the coding mode, and the input code stream is decoded, dequantized, and predicted and reconstructed to obtain reconstructed pixels, that is, a reconstructed image.

[0105] In summary, the precoding process can effectively reduce the number of QPs to be traversed, and only includes two modes: variable-length coding and fixed-length coding, which improves the efficiency of encoding and decoding, and reduces the image size as much as possible under acceptable visual damage for easy transmission and storage.

[0106] Figure 6 FIG. 6 is a schematic diagram of the structure of an image encoding device 600 provided in an embodiment of the present disclosure. Figure 6 As shown, the image encoding device includes:

[0107] An acquiring unit 610 is configured to acquire a first encoding parameter and a second encoding parameter of an input image;

[0108] A determining unit 620, configured to determine a quantization parameter list and a first quantization parameter in the quantization parameter list based on the first encoding parameter and the second encoding parameter;

[0109] The encoding unit 630 is used to perform a first encoding on the first image block by using a first quantization parameter and an encoding mode to obtain image encoding data. The encoding mode includes variable-length encoding or fixed-length encoding.

[0110] In some embodiments, the acquisition unit 610 is used to: pre-process the input image to determine a first encoding parameter of a first image block in the input image; and perform a second encoding on the first image block to determine a second encoding parameter.

[0111] In some embodiments, the acquisition unit 610 is used to: divide the input image into multiple second image blocks of preset sizes; divide the multiple second image blocks into multiple first image blocks, and the size of the multiple first image blocks is less than or equal to the size of the second image blocks; determine a third encoding parameter and the absolute error sum of the multiple first image blocks; determine the first encoding parameter through the third encoding parameter and the absolute error sum.

[0112] In some embodiments, the acquisition unit 610 is used to: determine a third encoding parameter based on the compression rate of the input image and the size of the second image block, where the compression rate is the ratio of the preset image size to the input image size; and determine the absolute error sum of multiple first image blocks based on the pixel value of the first image block.

[0113] In some embodiments, the acquisition unit 610 is used to: determine a third quantization parameter according to a compression rate of an input image; determine a second quantization parameter based on the third quantization parameter; and perform a second encoding on the first image block using the second quantization parameter to determine a second encoding parameter.

[0114] In some embodiments, the determination unit 620 is used to: determine the size relationship between the first encoding parameter and the second encoding parameter; when the first encoding parameter is greater than the second encoding parameter, determine a first quantization parameter list, the maximum quantization parameter of the first quantization parameter list includes the second quantization parameter, and the minimum quantization parameter includes the first preset value; when the first encoding parameter is less than the second encoding parameter, determine a second quantization parameter list, the maximum quantization parameter of the second quantization parameter list includes the third quantization parameter, and the minimum quantization parameter includes the sum of the second quantization parameter and the second preset value.

[0115] In some embodiments, the determination unit 620 is configured to: when the first encoding parameter is equal to the second encoding parameter, use the second quantization parameter as the first quantization parameter.

[0116] In some embodiments, the determination unit 620 is used to: determine multiple quantization parameters in the first quantization parameter list or the second quantization parameter list, the multiple quantization parameters include the first quantization parameter; perform a third encoding on the input image using the multiple quantization parameters respectively to obtain the first quantization parameter corresponding to the fourth encoding parameter, and the fourth encoding parameter is less than or equal to the first encoding parameter.

[0117] In some embodiments, the encoding unit 630 is used to: determine the size of the fifth encoding parameter corresponding to the variable-length encoding and the sixth encoding parameter corresponding to the fixed-length encoding; when the fifth encoding parameter is less than the sixth encoding parameter, determine that the encoding mode is variable-length encoding; when the fifth encoding parameter is greater than the sixth encoding parameter, determine that the encoding mode is fixed-length encoding, and the fifth encoding parameter and the sixth encoding parameter are obtained through the first encoding.

[0118] In summary, through the image encoding device, the first encoding parameter and the second encoding parameter of the input image are obtained; based on the first encoding parameter and the second encoding parameter, a quantization parameter list and the first quantization parameter in the quantization parameter list are determined; the first image block is first encoded through the first quantization parameter and the encoding mode to obtain image encoding data, and the encoding mode includes variable-length coding or fixed-length coding, which can effectively control the quantization parameter list of the encoding parameters of the image, and by determining the quantization parameter list, the traversed quantization parameters are reduced, and the encoding process only includes two encoding modes, which can cover both variable-length coding and fixed-length coding modes, thereby improving encoding and decoding efficiency and facilitating data transmission and storage.

[0119] Corresponding to the methods provided in the above-mentioned embodiments, the present disclosure also provides an image encoding device. Since the device provided in the embodiments of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation method is also applicable to the device provided in this embodiment and will not be described in detail in this embodiment.

[0120] Figure 7 FIG. 7 is a structural diagram of an image decoding device 700 provided in an embodiment of the present disclosure. Figure 7 As shown, the image decoding device comprises:

[0121] The parsing unit 710 is configured to parse the received image encoding data to obtain a first quantization parameter and an encoding mode corresponding to the first image block, where the encoding mode includes variable length encoding or fixed length encoding;

[0122] The decoding unit 720 is configured to perform a first decoding on the first image block based on a decoding mode corresponding to the encoding mode to obtain an output image.

[0123] In summary, through the image decoding device, the received image coding data is parsed to obtain the first quantization parameter and the coding mode corresponding to the first image block, and the coding mode includes variable-length coding or fixed-length coding; the first image block is first decoded based on the decoding mode corresponding to the coding mode to obtain the output image, which can effectively control the quantization parameter list of the coding parameters of the image. By determining the quantization parameter list, the traversed quantization parameters are reduced, and the encoding process only includes two coding modes, which can cover both variable-length coding and fixed-length coding modes, thereby improving the encoding and decoding efficiency and facilitating data transmission and storage.

[0124] Corresponding to the methods provided in the above-mentioned embodiments, the present disclosure also provides an image encoding device. Since the device provided in the embodiments of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation method is also applicable to the device provided in this embodiment and will not be described in detail in this embodiment.

[0125] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.

[0126] Figure 8 1 is a block diagram of an electronic device 800 for implementing the above-mentioned image encoding method or image decoding method according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0127] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0128] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0129] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0130] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0131] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0132] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0133] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0134] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0135] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio) or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0136] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0137] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the above instructions can be executed by the processor 820 of the electronic device 800 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0138] The embodiments of the present disclosure further provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the image encoding method described in the above embodiments of the present disclosure.

[0139] An embodiment of the present disclosure further provides a computer program product, including a computer program, which executes the image encoding method or the image decoding method described in the above embodiments of the present disclosure when a processor is used to execute the computer program.

[0140] An embodiment of the present disclosure also proposes a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send signals to the processor, the signals include computer instructions stored in the memory, and when the processor executes the computer instructions, the electronic device executes the image encoding method or image decoding method described in the above embodiments of the present disclosure.

[0141] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0142] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0143] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.

[0144] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.

[0145] It should be understood that the various parts of the embodiments of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0146] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0147] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0148] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. An image coding method, characterized in that: The method comprises: Obtaining a first encoding parameter and a second encoding parameter of an input image; Determine a quantization parameter list and a first quantization parameter in the quantization parameter list based on the first encoding parameter and the second encoding parameter; The first image block is first encoded using the first quantization parameter and encoding mode to obtain image encoding data, wherein the encoding mode includes variable-length encoding or fixed-length encoding.

2. The method according to claim 1, characterized in that The obtaining of the first encoding parameter and the second encoding parameter of the input image comprises: Preprocessing the input image to determine a first encoding parameter of a first image block in the input image; Perform second encoding on the first image block to determine second encoding parameters.

3. The method according to claim 2, characterized in that The preprocessing of the input image to determine a first encoding parameter of a first image block in the input image includes: Dividing the input image into a plurality of second image blocks of preset sizes; Divide the plurality of second image blocks into a plurality of first image blocks, wherein the size of the plurality of first image blocks is smaller than or equal to the size of the second image block; Determining a third encoding parameter and a sum of absolute errors of the plurality of first image blocks; The first encoding parameter is determined by using the third encoding parameter and the absolute error sum.

4. The method according to claim 3, characterized in that Determining the absolute error sums of the plurality of first image blocks and the third encoding parameter comprises: Determining a third encoding parameter based on a compression rate of the input image and a size of the second image block, wherein the compression rate is a ratio of a preset image size to a size of the input image; Based on the pixel values ​​of the first image block, a sum of absolute errors of the plurality of first image blocks is determined.

5. The method according to claim 2, characterized in that: The performing second encoding on the first image block and determining the second encoding parameter comprises: Determining a third quantization parameter according to the compression rate of the input image; Based on the third quantization parameter, determining a second quantization parameter; The first image block is second-encoded using the second quantization parameter to determine a second encoding parameter.

6. The method according to claim 1, characterized in that Based on the first encoding parameter and the second encoding parameter, determining a quantization parameter list includes: Determine the size of the first encoding parameter and the second encoding parameter; In a case where the first encoding parameter is greater than the second encoding parameter, determining a first quantization parameter list, wherein a maximum quantization parameter in the first quantization parameter list includes the second quantization parameter, and a minimum quantization parameter includes a first preset value; When the first encoding parameter is less than the second encoding parameter, a second quantization parameter list is determined, wherein the maximum quantization parameter of the second quantization parameter list includes the third quantization parameter, and the minimum quantization parameter includes the sum of the second quantization parameter and a second preset value.

7. The method according to claim 6, characterized in that The method further comprises: When the first encoding parameter is equal to the second encoding parameter, the second quantization parameter is used as the first quantization parameter.

8. The method according to claim 7, characterized in that Determining, based on the first encoding parameter and the second encoding parameter, a first quantization parameter in the quantization parameter list includes: Determine a plurality of quantization parameters in the first quantization parameter list or the second quantization parameter list, the plurality of quantization parameters including the first quantization parameter; The input image is thirdly encoded using the multiple quantization parameters respectively to obtain a first quantization parameter corresponding to a fourth encoding parameter, where the fourth encoding parameter is less than or equal to the first encoding parameter.

9. The method according to claim 8, characterized in that Based on performing a first encoding on the first image block using the first quantization parameter and the encoding mode, obtaining image encoding data, wherein the encoding mode includes variable-length encoding or fixed-length encoding, comprises: Determine the size of a fifth coding parameter corresponding to the variable-length coding and a sixth coding parameter corresponding to the fixed-length coding; When the fifth coding parameter is less than the sixth coding parameter, determining that the coding mode is the variable length coding; When the fifth coding parameter is greater than the sixth coding parameter, the coding mode is determined to be the fixed-length coding, and the fifth coding parameter and the sixth coding parameter are obtained through the first coding.

10. An image decoding method, characterized in that: The method comprises: Parsing the received image encoding data to obtain a first quantization parameter and an encoding mode corresponding to the first image block, wherein the encoding mode includes variable-length encoding or fixed-length encoding; The first image block is first decoded based on a decoding mode corresponding to the encoding mode to obtain an output image.

11. An image encoding device, characterized in that: The device comprises: An acquisition unit, configured to acquire a first encoding parameter and a second encoding parameter of an input image; A determining unit, configured to determine a quantization parameter list and a first quantization parameter in the quantization parameter list based on the first encoding parameter and the second encoding parameter; The encoding unit is used to perform a first encoding on the first image block by using the first quantization parameter and an encoding mode to obtain image encoding data, wherein the encoding mode includes variable-length encoding or fixed-length encoding.

12. An image encoding device, characterized in that: The device comprises: A parsing unit, configured to parse the received image encoding data to obtain a first quantization parameter and an encoding mode corresponding to the first image block, wherein the encoding mode includes variable-length encoding or fixed-length encoding; A decoding unit is used to perform a first decoding on the first image block based on a decoding mode corresponding to the encoding mode to obtain an output image.

13. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9 or 10.

14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9 or 10.

15. A chip, characterized in that: It comprises one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory of an electronic device and send the signal to the processor, the signal includes a computer instruction stored in the memory, and when the processor executes the computer instruction, the electronic device executes the method described in any one of claims 1-9 or 10.