Image entropy coding method, device, electronic device, chip system and storage medium
By segmenting the image into image blocks and entropy coding, the problems of high complexity and cost of image encoding in the prior art are solved, and efficient image compression and simplified encoding process are realized.
Patent Information
- Application Number
- CN202410650012.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-05-23
AI Technical Summary
The prior art is complex and costly in image encoding, making it difficult to determine the optimal encoding method, resulting in difficulty in implementing and applying it.
By dividing the image to be processed into a plurality of image blocks, a prediction residual is determined based on the pixel information of each image block, and encoding parameters are determined using the first prediction residual value, and entropy encoding is performed on the image blocks to obtain compressed data.
While ensuring image entropy coding efficiency, it reduces the amount of image transmission data, reduces the complexity of image encoding, and improves the ability to implement and apply it.
Smart Images

Figure CN118433423B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image entropy coding method, device, electronic device, chip system and storage medium. Background Art
[0002] With the development of mobile communication technology and the popularization of digital images, the amount of data transmitted by images is increasing. Image coding technology can reduce the amount of data required to transmit images. Image coding technology is a technology that uses fewer bits to represent images or information contained in images while meeting quality requirements.
[0003] In the related art, multiple encoding methods are traversed to determine the best encoding method, and the image is encoded according to the best encoding method. This method is relatively complex and costly, and is not easy to implement. Summary of the invention
[0004] The present disclosure provides an image entropy coding method, device, electronic device, chip system and storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided an image entropy coding method, comprising:
[0006] Divide the image to be processed into multiple image blocks;
[0007] For at least one image block among the multiple image blocks, determining a prediction residual corresponding to a pixel to be encoded in the image block according to pixel information of the image block;
[0008] Determining a first prediction residual value of the image block according to the prediction residual corresponding to the pixel to be encoded in the image block;
[0009] Determining, according to the first prediction residual value, a first encoding parameter corresponding to each to-be-encoded prediction residual in the image block;
[0010] According to the first encoding parameter corresponding to each prediction residual to be encoded, the corresponding prediction residual to be encoded is encoded to obtain compressed data of the image block.
[0011] According to a second aspect of an embodiment of the present disclosure, there is provided an image entropy coding apparatus, including:
[0012] A segmentation module, used for segmenting the image to be processed into multiple image blocks;
[0013] A first determination module is used to determine, for at least one image block among the multiple image blocks, a prediction residual corresponding to a pixel to be encoded in the image block according to pixel information of the image block;
[0014] A second determination module, used to determine a first prediction residual value of the image block according to the prediction residual corresponding to the pixel to be encoded in the image block;
[0015] A third determination module, configured to determine, according to the first prediction residual value, a first encoding parameter corresponding to each to-be-encoded prediction residual in the image block;
[0016] The encoding module is used to encode the corresponding prediction residual to be encoded according to the first encoding parameter corresponding to each prediction residual to be encoded, so as to obtain compressed data of the image block.
[0017] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: one or more processors; wherein the processor is used to call instructions so that the electronic device executes the image entropy coding method described in the first aspect above.
[0018] According to the fourth aspect of an embodiment of the present disclosure, a chip system is provided, which includes a processing unit and an interface circuit, the processing unit obtains program instructions through the interface circuit, the program instructions are executed by the processing unit, and the processing unit is used to execute the steps of the method described in the first aspect above.
[0019] According to a fifth aspect of an embodiment of the present disclosure, a storage medium is provided, which stores instructions. When the instructions are executed on an electronic device, the electronic device executes the image entropy coding method described in the first aspect.
[0020] According to a sixth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program, which implements the steps of the method described in the first aspect when executed by a processor.
[0021] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: dividing the image to be processed into multiple image blocks; for at least one image block among the multiple image blocks, determining the prediction residual corresponding to the pixel to be encoded in the image block according to the pixel information of the image block; determining the first prediction residual value of the image block according to the prediction residual corresponding to the pixel to be encoded in the image block; determining the first coding parameter corresponding to each prediction residual to be encoded in the image block according to the first prediction residual value; encoding the corresponding prediction residual to be encoded according to the first coding parameter corresponding to each prediction residual to be encoded to obtain compressed data of the image block. In this way, the amount of image transmission data can be reduced, the complexity of image encoding can be reduced, and the application capability can be improved while ensuring the efficiency of image entropy coding.
[0022] 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
[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0024] Figure 1 It is a flowchart of an image entropy coding method provided according to an embodiment of the present disclosure.
[0025] Figure 2 It is a flowchart of an image entropy coding method provided according to an embodiment of the present disclosure.
[0026] Figure 3 It is a flowchart of an image entropy coding method provided according to an embodiment of the present disclosure.
[0027] Figure 4 is an example diagram of the first Huffman coding table provided according to an embodiment of the present disclosure.
[0028] Figure 5 It is a schematic diagram of the range of k values provided according to an embodiment of the present disclosure.
[0029] Figure 6 It is a block diagram of an image entropy coding device provided according to an embodiment of the present disclosure.
[0030] Figure 7 is a block diagram of an electronic device provided according to an embodiment of the present disclosure.
[0031] Figure 8 It is a block diagram of a chip system provided according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] Some embodiments of the present disclosure will be described in detail here, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. Various changes, modifications and equivalents of the methods, devices and / or systems described herein will become apparent after understanding the present disclosure. For example, the order of operations described herein is merely an example and is not limited to those orders set forth herein, but can be changed as becomes apparent after understanding the present disclosure, except for operations that must be performed in a specific order. In addition, for clarity and brevity, descriptions of features known in the art may be omitted.
[0033] The embodiments described in some embodiments of the present disclosure below 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.
[0034] In the process of image transmission, compressing and encoding the image can reduce the amount of data transmitted by the image. Image coding can remove the correlation in the image to be processed to reduce the redundant information in the image and improve the image coding efficiency.
[0035] It should be noted that entropy coding is a coding method that utilizes statistical characteristics in an image to remove statistical redundancy in the image. Entropy coding includes but is not limited to run-length coding, Huffman coding, and Columbus coding.
[0036] Among them, Huffman coding is a lossless entropy coding method based on variable length coding. The image is compressed by assigning codes of different lengths to different symbols. For example, symbols with higher frequency of occurrence are represented by shorter codes, and symbols with lower frequency of occurrence are represented by longer codes.
[0037] Golomb coding is an entropy coding method for lossless data compression, which is suitable for data with Gaussian distribution characteristics. Golomb coding is mainly used to encode non-negative integer sequences. Exemplarily, the value is decomposed into a quotient part and a remainder part, and the quotient part and the remainder part are represented by fixed-length coding and variable-length coding.
[0038] In the related art, multiple encoding methods are traversed to determine the best encoding method, and the image is encoded according to the best encoding method. This method has high complexity and cost and is not easy to be applied.
[0039] To this end, the present disclosure provides an image entropy coding method, device, electronic device, chip system and storage medium. Figure 1 FIG. 1 is a flow chart of an image entropy coding method provided according to an embodiment of the present disclosure. Figure 1 As shown, the image entropy coding method of the embodiment of the present disclosure first divides the image to be processed into blocks to obtain multiple image blocks; for each image block in the multiple image blocks, prediction processing is performed on the image block according to the pixel information of the image block to obtain a prediction residual, and entropy coding is performed on the image block according to the prediction residual to obtain compressed data of the image block, until all image blocks are completely encoded to obtain a compressed image corresponding to the image to be processed.
[0040] The following describes the image entropy coding method, device, electronic device, chip system and storage medium of the embodiments of the present disclosure with reference to the accompanying drawings.
[0041] Figure 2 1 is a flow chart of an image entropy coding method provided according to an embodiment of the present disclosure. Figure 2 As shown, the image entropy coding method includes but is not limited to the following steps:
[0042] In step S201, the image to be processed is divided into a plurality of image blocks.
[0043] In some embodiments, the image to be processed is divided into a plurality of image blocks according to the pixel information of the image to be processed. Exemplarily, the length of the image to be processed is 256 pixels, the width of the image to be processed is 256 pixels, and the image to be processed is divided into 16 image blocks according to the pixel information of the image to be processed, and the length and width of each image block are 64 pixels respectively.
[0044] In step S202, for at least one image block among the multiple image blocks, a prediction residual corresponding to a pixel to be encoded in the image block is determined according to pixel information of the image block.
[0045] Optionally, in some embodiments, for at least one image block among multiple image blocks, the pixel value to be encoded in the image block is predicted using adjacent encoded reconstructed pixel values to obtain a predicted value of the pixel value to be encoded; the difference between the pixel value to be encoded and the predicted value of the pixel value to be encoded is determined as the residual of the pixel value to be encoded; and the residual is mapped to an absolute value to obtain a predicted residual corresponding to the pixel value to be encoded.
[0046] It should be noted that the spatial correlation of an image refers to the similarity of the brightness and chromaticity information of adjacent pixels in the image. The closer the brightness and chromaticity information of adjacent pixels in the image, the higher the spatial correlation of the image, and the greater the spatial redundancy of the image. Intra-frame prediction refers to a compression method based on coded pixel values to predict pixel values to be coded. Intra-frame prediction uses the spatial correlation of an image to compress the image to be processed to reduce the spatial redundancy of the image to be processed. Optionally, in some embodiments, for each image block in a plurality of image blocks, the pixel value to be coded in the image block is intra-predicted using adjacent coded reconstructed pixel values to obtain a predicted value of the pixel value to be coded.
[0047] It should be noted that the method for determining the predicted value of the pixel value to be encoded may be an intra-frame prediction method or other image prediction methods, which is not specifically limited in the embodiments of the present disclosure and will not be elaborated on.
[0048] Exemplarily, the difference between the pixel value to be encoded and the predicted value of the pixel value to be encoded is determined as the residual of the pixel value to be encoded. The residual of the pixel value to be encoded can be calculated by the following formula (1):
[0049] diff = pixel-pred (1)
[0050] Among them, diff refers to the residual of the pixel value to be encoded; pixel refers to the pixel value to be encoded; pred refers to the predicted value of the pixel value to be encoded.
[0051] Exemplarily, the absolute value mapping is performed on the residual to obtain the prediction residual corresponding to the pixel value to be encoded. The prediction residual corresponding to the pixel value to be encoded can be calculated by the following formula (2):
[0052]
[0053] Among them, diff map It refers to the prediction residual corresponding to the pixel value to be encoded; diff refers to the residual of the pixel value to be encoded; abs refers to the absolute value function, which is used to perform absolute value mapping on the residual of the pixel value to be encoded.
[0054] It should be noted that the method for determining the prediction residual corresponding to the pixel value to be encoded can be calculated by the above formula (2), or it can be implemented in other ways, for example, by performing absolute value mapping on the residual based on a linear rectification function to obtain the prediction residual corresponding to the pixel value to be encoded. The embodiment of the present disclosure does not make specific limitations on this and will not be repeated.
[0055] In step S203, a first prediction residual value of the image block is determined according to the prediction residual corresponding to the pixel value to be encoded in the image block.
[0056] Optionally, in some embodiments, the maximum value of the prediction residuals corresponding to all the pixel values to be encoded in the image block is determined as the first prediction residual value of the image block. For example, the first prediction residual value of the image block can be calculated by the following formula (3):
[0057] diff mapmax =MAX(diff mapall ) (3)
[0058] Among them, diff mapmax Refers to the first prediction residual value of the image block; diff mapall It refers to the prediction residuals corresponding to all the pixel values to be encoded in the image block; MAX refers to the maximum value function, which is used to calculate the maximum value of the prediction residuals corresponding to all the pixel values to be encoded in the image block.
[0059] It should be noted that, based on the prediction residual corresponding to the pixel value to be encoded in the image block, the first prediction residual value of the image block is determined, and the first prediction residual value is encoded. This can minimize the spatial redundancy of the image to be processed and reduce the number of encoding bits corresponding to each pixel value in the image block to reduce the amount of transmitted data of the image.
[0060] In step S204, a first encoding parameter corresponding to each to-be-encoded prediction residual in the image block is determined according to the first prediction residual value.
[0061] It should be noted that, in some embodiments, the first encoding parameter is a Golomb parameter k value. Optionally, in some embodiments, the Golomb parameter k value corresponding to each to-be-encoded prediction residual in the image block is determined according to the first prediction residual value.
[0062] It should be noted that, in the image encoding process, adaptively updating the k value used in the exponential Golomb coding can improve the efficiency of image entropy coding.
[0063] In step S205, the corresponding prediction residual to be encoded is encoded according to the first encoding parameter corresponding to each prediction residual to be encoded, so as to obtain compressed data of the image block.
[0064] Optionally, in some embodiments, according to the first coding parameter corresponding to each prediction residual to be encoded, the corresponding prediction residual to be encoded is exponentially Golomb encoded to obtain the coding shift quotient and coding shift residue of each prediction residual to be encoded; the coding shift quotient and coding shift residue of each prediction residual to be encoded are respectively encoded to obtain compressed data of the image block.
[0065] Optionally, in some embodiments, a first divisor of each prediction residual to be encoded is determined according to a first coding parameter corresponding to each prediction residual to be encoded; exponential Golomb coding is performed on the corresponding prediction residual to be encoded according to the first divisor to obtain a coding shift quotient and a coding shift remainder of each prediction residual to be encoded.
[0066] Exemplarily, the first divisor of each prediction residual to be encoded can be calculated by the following formula (4):
[0067] div=2 k (4)
[0068] Wherein, div refers to the first divisor of each prediction residual to be encoded; k refers to the first encoding parameter corresponding to each prediction residual to be encoded.
[0069] Exemplarily, the coding shift quotient of each prediction residual to be coded can be calculated by the following formula (5):
[0070] Q = diff map / div (5)
[0071] Where Q refers to the coding shift quotient of each prediction residual to be coded; diff map refers to each prediction residual to be encoded; div refers to the first divisor of each prediction residual to be encoded.
[0072] Exemplarily, the coding shift residue of each prediction residual to be coded can be calculated by the following formula (6):
[0073] R = diffmap %div (6)
[0074] Among them, R refers to the coding shift residue of each prediction residual to be coded; diff map Refers to each prediction residual to be encoded; div refers to the first divisor of each prediction residual to be encoded.
[0075] Optionally, in some embodiments, the coding shift quotient of each prediction residual to be encoded is encoded to determine the first coding data of each prediction residual to be encoded; the coding shift residue of each prediction residual to be encoded is encoded to determine the second coding data of each prediction residual to be encoded; and the compressed data of the image block is obtained according to the first coding data of each prediction residual to be encoded and the second coding data of each prediction residual to be encoded. Exemplarily, the coding shift quotient of each prediction residual to be encoded is Huffman encoded to determine the first coding data of each prediction residual to be encoded; the coding shift residue of each prediction residual to be encoded is binary encoded to determine the second coding data of each prediction residual to be encoded; and the compressed data of the image block is obtained according to the first coding data of each prediction residual to be encoded and the second coding data of each prediction residual to be encoded.
[0076] Optionally, in some embodiments, after the compressed data of the multiple image blocks are determined, the compressed data of the image to be processed is obtained according to the compressed data of the multiple image blocks.
[0077] In the embodiment of the present disclosure, the image to be processed is divided into multiple image blocks; for at least one image block among the multiple image blocks, the prediction residual corresponding to the pixel to be encoded in the image block is determined according to the pixel information of the image block; the first prediction residual value of the image block is determined according to the prediction residual corresponding to the pixel to be encoded in the image block; the first coding parameter corresponding to each prediction residual to be encoded in the image block is determined according to the first prediction residual value; according to the first coding parameter corresponding to each prediction residual to be encoded, the corresponding prediction residual to be encoded is encoded to obtain compressed data of the image block. In this way, the amount of image transmission data can be reduced, the complexity of image encoding can be reduced, and the application capability can be improved while ensuring the efficiency of image entropy encoding.
[0078] It should be noted that, in some embodiments, the first coding parameter is the Golomb parameter k value; the k value is the order value of the exponential Golomb coding; the k value corresponding to the current prediction residual to be encoded in the image block is determined based on the previous prediction residual to be encoded and its corresponding k value, and the previous prediction residual to be encoded is the prediction residual in the image block that is adjacent to the position of the current prediction residual to be encoded and the most recent one that has been encoded. Figure 3 is a schematic diagram of an image entropy coding method provided according to an embodiment of the present disclosure. Figure 3 As shown, the image entropy coding method includes but is not limited to the following steps:
[0079] In step S301, the image to be processed is divided into a plurality of image blocks.
[0080] In the embodiments of the present disclosure, step S301 may be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.
[0081] In step S302, for at least one image block among the multiple image blocks, a prediction residual corresponding to a pixel to be encoded in the image block is determined according to pixel information of the image block.
[0082] In the embodiments of the present disclosure, step S302 may be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.
[0083] In step S303, a first prediction residual value of the image block is determined according to the prediction residual corresponding to the pixel value to be encoded in the image block.
[0084] In the embodiments of the present disclosure, step S303 may be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.
[0085] In step S304, the k value corresponding to the first prediction residual to be encoded in the image block is determined according to the first prediction residual value.
[0086] Optionally, in some embodiments, the maximum number of bits used for encoding the image block is determined based on the first prediction residual value; the maximum k value of the exponential Golomb coding is determined based on the maximum number of bits; and the k value corresponding to the first prediction residual to be encoded is determined based on the maximum k value of the exponential Golomb coding.
[0087] Exemplarily, the maximum number of bits used for encoding the image block can be calculated using the following formula (7):
[0088] max_bit_len=Bin(diff mapmax )) (7)
[0089] Among them, max_bit_len refers to the maximum number of bits used for encoding the image block; diff mapmax refers to the first prediction residual value; Bin refers to a binary function used to calculate the binary length of the first prediction residual value.
[0090] In step S305, the k value used for the exponential Golomb coding is updated according to the first prediction residual to be encoded and its k value, and the updated k value is determined as the k value corresponding to the next prediction residual to be encoded in the image block.
[0091] Optionally, in some embodiments, based on the maximum code length in the first coding table, a corresponding first number of bits is determined; based on the maximum k value of the exponential Golumbus coding and the first number of bits, a first upper limit value of the k value corresponding to the first prediction residual to be encoded is determined; wherein the maximum k value of the exponential Golumbus coding is obtained by performing a binary length calculation on the first prediction residual value; a binary length calculation is performed on the first prediction residual to be encoded to obtain a corresponding second number of bits, and the second number of bits is determined as the optimal k value for the first prediction residual to be encoded; and the k value used for the exponential Golumbus coding is updated according to the optimal k value and the first upper limit value.
[0092] It should be noted that, in some embodiments, the first coding table is a first Huffman coding table; the first Huffman coding table is constructed according to the image to be processed; and the corresponding first number of bits is determined according to the maximum code length in the first Huffman coding table. Exemplarily, the first number of bits can be calculated by the following formula (8):
[0093] bit1=Bin(Huffman maxlen ) (8)
[0094] Among them, bit1 refers to the first bit number; Huffman maxlen Refers to the maximum code length in the first Huffman coding table; Bin refers to a binary function used to calculate the binary length of the first prediction residual value.
[0095] Figure 4 is an example diagram of a first Huffman coding table provided according to an embodiment of the present disclosure. Figure 4 As shown, the first Huffman coding table includes a coding shift quotient, a code word and a code length. The maximum code length of the first Huffman coding table is 9. According to the maximum code length in the first Huffman coding table, the corresponding first number of bits is determined to be 3.
[0096] It should be noted that Figure 4 The above description is for illustrative purposes only and is intended only for those skilled in the art to understand the embodiments of the present disclosure, and the present disclosure does not make any specific limitation thereto.
[0097] Optionally, in some embodiments, after determining the corresponding first number of bits, the difference between the maximum k value of the exponential Golomb coding and the first number of bits is determined; and the maximum value between the difference and the first value is determined as the first upper limit value of the k value corresponding to the first prediction residual to be encoded.
[0098] Exemplarily, the difference between the maximum k value of the exponential Golomb coding and the first number of bits can be calculated by the following formula (9):
[0099] means k =max k -bit1 (9)
[0100] Among them, means k It refers to the difference between the maximum k value of the exponential Golomb code and the first bit number; max k is the maximum k value of the exponential Golomb coding, which is obtained by calculating the binary length of the first prediction residual value; bit1 refers to the first bit number.
[0101] Exemplarily, the first upper limit value of the k value corresponding to the first prediction residual to be encoded can be calculated by the following formula (10):
[0102] up k =MAX(a,means k ) (10)
[0103] Among them, up k refers to the first upper limit of the k value corresponding to the first prediction residual to be encoded; a refers to the first value; means k It refers to the difference between the maximum k value of the Exponential Golomb code and the first bit number; MAX refers to the maximum value function, which is used to calculate the maximum value between the difference and the first value.
[0104] Optionally, in some embodiments, the first value is 0. Exemplarily, the first upper limit value of the k value corresponding to the first prediction residual to be encoded can be calculated by the following formula (11):
[0105] up k =MAX(0,means k ) (11)
[0106] Among them, up k It refers to the first upper limit value of the k value corresponding to the first prediction residual to be encoded; means k It refers to the difference between the maximum k value of the Exponential Golomb code and the first bit number; MAX refers to the maximum value function, which is used to calculate the maximum value between the difference and the first value.
[0107] Optionally, in some embodiments, after determining the first upper limit value of the k value corresponding to the first prediction residual to be encoded, a binary length calculation is performed according to the first prediction residual to be encoded to obtain a corresponding second number of bits, and the second number of bits is determined as the optimal k value of the first prediction residual to be encoded. Exemplarily, the optimal k value of the first prediction residual to be encoded can be calculated by the following formula (12):
[0108] bestk =Bin(diff map ) (12)
[0109] Among them, best k refers to the optimal k value of the first prediction residual to be encoded; diff map refers to the first prediction residual to be encoded; Bin refers to a binary function used to calculate the binary length of the first prediction residual to be encoded.
[0110] It should be noted that, in some embodiments, the first lower limit value is greater than the second value and less than the first upper limit value. Optionally, in some embodiments, the implementation method of updating the k value used for the exponential Columbus coding according to the optimal k value and the first upper limit value can be: when the optimal k value is greater than the first lower limit value of the k value corresponding to the first prediction residual to be encoded, the k value used for the exponential Columbus coding is updated according to the k value corresponding to the first prediction residual to be encoded and the first upper limit value, and the maximum value between the obtained k value and the first lower limit value is determined as the updated k value; or, when the optimal k value is less than or equal to the first lower limit value, the k value used for the exponential Columbus coding is updated according to the k value corresponding to the first prediction residual to be encoded and the first lower limit value, and the maximum value between the obtained k value and the first lower limit value is determined as the updated k value.
[0111] Exemplarily, the first upper limit value is means k ; The first lower limit is When the optimal k value is greater than the first lower limit of the k value corresponding to the first prediction residual to be encoded, the updated k value can be calculated by the following formula (13):
[0112]
[0113] Among them, k′ refers to the updated k value; k refers to the k value corresponding to the first prediction residual to be encoded; means k Refers to the first upper limit value; >> refers to the right shift operation; MAX refers to the maximum value function, which is used to calculate the maximum value between the k value and the first lower limit value.
[0114] When the optimal k value is less than or equal to the first lower limit value, the updated k value can be calculated by the following formula (14):
[0115]
[0116] Wherein, k′ refers to the updated k value; k refers to the k value corresponding to the first prediction residual to be encoded; Refers to the first lower limit value; >> refers to the right shift operation; MAX refers to the maximum value function, which is used to calculate the maximum value between the k value and the first lower limit value.
[0117] Figure 5 Schematic diagram of the range of k values provided according to the embodiment of the present disclosure. Figure 5 As shown, in the first lower limit And the first upper limit value is means k In the case of, the value range of k is greater than or equal to and less than or equal to means k .
[0118] In step S306, the next prediction residual to be encoded is taken as the new first prediction residual to be encoded, and the k value used for the exponential Golomb coding is updated based on the new first prediction residual to be encoded and its k value, until the k value corresponding to each prediction residual to be encoded is obtained.
[0119] In step S307, the corresponding prediction residual to be encoded is encoded according to the first encoding parameter corresponding to each prediction residual to be encoded, so as to obtain compressed data of the image block.
[0120] In the embodiments of the present disclosure, step S307 may be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.
[0121] In an embodiment of the present disclosure, a k value corresponding to the first prediction residual to be encoded in the image block is determined according to the first prediction residual value; the k value used for the exponential Golomb coding is updated according to the first prediction residual to be encoded and its k value, and the updated k value is determined as the k value corresponding to the next prediction residual to be encoded in the image block; the next prediction residual to be encoded is used as the new first prediction residual to be encoded, and the k value used for the exponential Golomb coding is updated based on the new first prediction residual to be encoded and its k value, until the k value corresponding to each prediction residual to be encoded is reached. In this way, the k value of the exponential Golomb coding can be adaptively updated to further reduce the amount of image transmission data and further improve the coding efficiency of image entropy coding.
[0122] Figure 6 is a block diagram of an image entropy coding device provided according to an embodiment of the present disclosure. Figure 6 As shown, the image entropy coding device includes but is not limited to a segmentation module 601 , a first determination module 602 , a second determination module 603 , a third determination module 604 , and a coding module 605 .
[0123] The segmentation module 601 is used to segment the image to be processed into multiple image blocks;
[0124] A first determination module 602 is configured to determine, for at least one image block among the multiple image blocks, a prediction residual corresponding to a pixel to be encoded in the image block according to pixel information of the image block;
[0125] A second determination module 603, configured to determine a first prediction residual value of the image block according to the prediction residual corresponding to the pixel to be encoded in the image block;
[0126] A third determination module 604 is used to determine a first coding parameter corresponding to each to-be-coded prediction residual in the image block according to the first prediction residual value;
[0127] The encoding module 605 is used to encode the corresponding prediction residual to be encoded according to the first encoding parameter corresponding to each prediction residual to be encoded, so as to obtain compressed data of the image block.
[0128] As an example, the first coding parameter in the third determination module 604 is the Golomb parameter k value; the k value is the order value of the exponential Golomb coding; the k value corresponding to the current prediction residual to be encoded in the image block is determined based on the previous prediction residual to be encoded and its corresponding k value, and the previous prediction residual to be encoded is the prediction residual in the image block that is adjacent to the current prediction residual to be encoded and the latest one that has been encoded. The third determination module 604 is also used to determine the k value corresponding to the first prediction residual to be encoded in the image block according to the first prediction residual value; update the k value used for the exponential Golomb coding according to the first prediction residual to be encoded and its k value, and determine the updated k value as the k value corresponding to the next prediction residual to be encoded in the image block; use the next prediction residual to be encoded as the new first prediction residual to be encoded, and update the k value used for the exponential Golomb coding based on the new first prediction residual to be encoded and its k value, and so on, to obtain the k value corresponding to each prediction residual to be encoded.
[0129] As an example, the third determination module 604 is also used to determine the maximum number of bits used for image block encoding based on the first prediction residual value; determine the maximum k value of exponential Golomb coding based on the maximum number of bits; and determine the k value corresponding to the first prediction residual to be encoded based on the maximum k value of exponential Golomb coding.
[0130] As an example, the third determination module 604 is also used to determine the corresponding first number of bits based on the maximum code length in the first coding table; determine the first upper limit value of the k value corresponding to the first prediction residual to be encoded based on the maximum k value and the first number of bits of the exponential Columbus coding; wherein the maximum k value of the exponential Columbus coding is obtained by performing a binary length calculation on the first prediction residual value; perform a binary length calculation on the first prediction residual to be encoded to obtain the corresponding second number of bits, and determine the second number of bits as the optimal k value for the first prediction residual to be encoded; and update the k value used for the exponential Columbus coding based on the optimal k value and the first upper limit value.
[0131] As an example, the third determination module 604 is also used to determine the difference between the maximum k value of the exponential Golomb coding and the first number of bits; and determine the maximum value of the difference and the first value as the first upper limit value of the k value corresponding to the first prediction residual to be encoded.
[0132] As an example, the first lower limit value in the third determination module 604 is greater than the second value and less than the first upper limit value. The third determination module 604 is also used for updating the k value used for the exponential Columbus coding according to the k value corresponding to the first prediction residual to be encoded and the first upper limit value when the optimal k value is greater than the first lower limit value, and determining the maximum value between the obtained k value and the first lower limit value as the updated k value; or, when the optimal k value is less than or equal to the first lower limit value, updating the k value used for the exponential Columbus coding according to the k value corresponding to the first prediction residual to be encoded and the first lower limit value, and determining the maximum value between the obtained k value and the first lower limit value as the updated k value.
[0133] As an example, the first determination module 602 is also used to predict the pixel value to be encoded in the image block using the adjacent encoded reconstructed pixel values to obtain the predicted value of the pixel value to be encoded; determine the difference between the pixel value to be encoded and the predicted value of the pixel value to be encoded as the residual of the pixel value to be encoded; and perform absolute value mapping on the residual to obtain the predicted residual corresponding to the pixel value to be encoded.
[0134] As an example, the second determination module 603 is further configured to determine the maximum value of the prediction residuals corresponding to all the pixel values to be encoded in the image block as the first prediction residual value of the image block.
[0135] As an example, the encoding module 605 is also used to perform exponential Golomb coding on the corresponding prediction residual to be encoded according to the first encoding parameter corresponding to each prediction residual to be encoded, so as to obtain the encoding shift quotient and the encoding shift remainder of each prediction residual to be encoded; and encode the encoding shift quotient and the encoding shift remainder of each prediction residual to be encoded respectively to obtain compressed data of the image block.
[0136] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0137] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a chip system and a readable storage medium.
[0138] Figure 7 700 is a block diagram of an electronic device provided according to an embodiment of the present disclosure. For example, the electronic device 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0139] Reference Figure 7 , the electronic device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .
[0140] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 707 and the processing component 702.
[0141] The memory 704 is configured to store various types of data to support operations on the electronic device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 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.
[0142] The power component 706 provides power to the various components of the electronic device 700. The power component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 700.
[0143] The multimedia component 708 includes a screen that provides an output interface between the electronic device 700 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 707 includes a front camera and / or a rear camera. When the electronic device 700 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 the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0144] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the electronic device 700 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 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.
[0145] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0146] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the electronic device 700. For example, the sensor assembly 714 can detect the open / closed state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700, and the sensor assembly 714 can also detect the position change of the electronic device 700 or a component of the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 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 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0147] The communication component 716 is configured to facilitate wired or wireless communication between the electronic device 700 and other devices. The electronic device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 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 716 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.
[0148] In an exemplary embodiment, the electronic device 700 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.
[0149] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to perform 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.
[0150] Some embodiments of the present disclosure also provide a chip system, such as Figure 8 As shown, the chip system includes at least one processor 801 and at least one interface circuit 802. The processor 801 and the interface circuit 802 can be interconnected via lines. For example, the interface circuit 802 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 802 can be used to send signals to other devices (such as the processor 801). Exemplarily, the interface circuit 802 can read instructions stored in the memory and send the instructions to the processor 801. When the instructions are executed by the processor 801, the electronic device 700 can perform the various steps in the above embodiments. Of course, the chip system may also include other discrete devices, and some embodiments of the present disclosure are not specifically limited to this.
[0151] In some embodiments of the present disclosure, the interface circuit 802 can obtain data, program instructions and / or information from the internal storage area of the chip system; it can also obtain data, program instructions and / or information from outside the chip system.
[0152] Optionally, the chip system also includes a memory 803, and the memory 803 is used to store necessary computer programs and data.
[0153] Optionally, in some embodiments, a computer program product is also provided, including a computer program, which can implement the image entropy coding method provided by the embodiments of the present disclosure when executed by one or more processors 720 or processor 801.
[0154] Those skilled in the art may also understand that the various illustrative logical blocks and steps listed in the embodiments of the present application may be implemented by electronic hardware, computer software, or a combination of the two. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art may use various methods to implement the functions described for each specific application, but such implementation should not be understood as exceeding the scope of protection of the embodiments of the present application.
[0155] In addition, the word "exemplary" is used herein to indicate serving as an example, instance, or diagram. Any aspect or design described as "exemplary" in this article is not necessarily understood to be advantageous compared to other aspects or designs. On the contrary, the use of the word exemplary is intended to present concepts in a specific way. As used herein, the term "or" is intended to represent an inclusive "or" rather than an exclusive "or". That is, unless otherwise specified or clear from the context, "X applies A or B" is intended to represent any one of the natural inclusive arrangements. That is, if X applies A; X applies B; or X applies both A and B, "X applies A or B" is satisfied under any of the aforementioned examples. In addition, unless otherwise specified or clearly pointed to a singular form from the context, the articles "one" and "an" as used in this application and the appended claims are generally understood to mean "one or more".
[0156] Likewise, although the present disclosure has been shown and described with respect to one or more implementations, equivalent variations and modifications will occur to those skilled in the art after reading and understanding the specification and drawings. The present disclosure includes all such modifications and variations and is limited only by the scope of the claims. In particular, with respect to the various functions performed by the components (e.g., elements, resources, etc.) described above, unless otherwise noted, the terms used to describe such components are intended to correspond to any component (functionally equivalent) that performs the specific functions of the described components, even if the structure is not equivalent to the disclosed structure. In addition, although the specific features of the present disclosure may have been disclosed with respect to only one of several implementations, such features may be combined with one or more other features of other implementations as may be desired and conducive to any given or specific application. In addition, with respect to "including", "having", "having", "having", or variations thereof used in the specific embodiments or claims, such terms are intended to be inclusive in a manner similar to the term "comprising".
[0157] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0158] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. An image coding method, characterized in that: include: Divide the image to be processed into multiple image blocks; For at least one of the multiple image blocks, determining, according to pixel information of the image block, a prediction residual corresponding to a pixel to be encoded in the image block; Determining a first prediction residual value of the image block according to the prediction residual corresponding to the to-be-encoded pixel in the image block; Determine, according to the first prediction residual value, a first coding parameter corresponding to each prediction residual to be encoded in the image block; the first coding parameter is a Golomb parameter k value; the k value is an order value of exponential Golomb coding, and the k value corresponding to the current prediction residual to be encoded in the image block is determined based on the previous prediction residual to be encoded and its corresponding k value; According to the first encoding parameter corresponding to each prediction residual to be encoded, the corresponding prediction residual to be encoded is encoded to obtain compressed data of the image block.
2. The method according to claim 1, characterized in that The previous prediction residual to be encoded is a prediction residual in the image block that is adjacent to the current prediction residual to be encoded and has been encoded the most recently; The determining, according to the first prediction residual value, a first encoding parameter corresponding to each to-be-encoded prediction residual in the image block comprises: Determining, according to the first prediction residual value, a k value corresponding to a first prediction residual to be encoded in the image block; updating the k value used for exponential Golomb coding according to the first prediction residual to be encoded and its k value, and determining the updated k value as the k value corresponding to the next prediction residual to be encoded in the image block; The next prediction residual to be encoded is used as the new first prediction residual to be encoded, and the k value used for exponential Golomb coding is updated based on the new first prediction residual to be encoded and its k value, until the k value corresponding to each prediction residual to be encoded is obtained.
3. The method according to claim 2, characterized in that The step of determining, according to the first prediction residual value, a k value corresponding to a first prediction residual to be encoded in the image block comprises: Determining a maximum number of bits used for encoding the image block according to the first prediction residual value; Determining a maximum k value of an exponential Golomb coding according to the maximum number of bits; According to the maximum k value of the exponential Golomb coding, the k value corresponding to the first prediction residual to be encoded is determined.
4. The method according to claim 2, characterized in that The updating of the k value used for the exponential Golomb coding according to the first prediction residual to be encoded and the k value thereof includes: Determine a first number of bits corresponding to a maximum code length in the first coding table; Determine a first upper limit value of the k value corresponding to the first prediction residual to be encoded according to the maximum k value of the exponential Golomb coding and the first number of bits; wherein the maximum k value of the exponential Golomb coding is obtained by performing binary length calculation on the first prediction residual value; Perform binary length calculation according to the first prediction residual to be encoded to obtain a corresponding second number of bits, and determine the second number of bits as the optimal k value of the first prediction residual to be encoded; The k value used in the exponential Golomb coding is updated according to the optimal k value and the first upper limit value.
5. The method according to claim 4, characterized in that The determining, according to the maximum k value of the exponential Golomb coding and the first number of bits, a first upper limit value of the k value corresponding to the first prediction residual to be encoded includes: determining a difference between a maximum k value of the EGG code and the first number of bits; The maximum value between the difference and the first value is determined as the first upper limit value of the k value corresponding to the first prediction residual to be encoded.
6. The method according to claim 4, characterized in that The updating of the k value used for the exponential Golomb coding according to the optimal k value and the first upper limit value includes: The optimal k value is greater than a first lower limit value of the k value corresponding to the first prediction residual to be encoded, and the k value used for exponential Golomb coding is updated according to the k value corresponding to the first prediction residual to be encoded and the first upper limit value, and the maximum value between the obtained k value and the first lower limit value is determined as the updated k value; or The optimal k value is less than or equal to the first lower limit value, and the k value used for exponential Golomb coding is updated according to the k value corresponding to the first prediction residual to be encoded and the first lower limit value, and the maximum value between the obtained k value and the first lower limit value is determined as the updated k value; The first lower limit value is greater than the second value and less than the first upper limit value.
7. The method according to claim 1, characterized in that The determining, according to the pixel information of the image block, the prediction residual corresponding to the pixel to be encoded in the image block comprises: Predicting a pixel to be encoded in the image block using adjacent encoded reconstructed pixels to obtain a predicted value of the pixel to be encoded; Determine a difference between the pixel to be encoded and the predicted value of the pixel to be encoded as a residual of the pixel to be encoded; Perform absolute value mapping on the residual to obtain a prediction residual corresponding to the pixel to be encoded.
8. The method according to claim 1, characterized in that The determining, according to the prediction residual corresponding to the pixel to be encoded in the image block, a first prediction residual value of the image block comprises: The maximum value of the prediction residuals corresponding to all the pixels to be encoded in the image block is determined as the first prediction residual value of the image block.
9. The method according to claim 1, characterized in that The step of encoding the corresponding prediction residual to be encoded according to the first encoding parameter corresponding to each prediction residual to be encoded to obtain compressed data of the image block includes: According to the first coding parameter corresponding to each prediction residual to be encoded, performing exponential Golomb coding on the corresponding prediction residual to be encoded, so as to obtain a coding shift quotient and a coding shift remainder of each prediction residual to be encoded; The coding shift quotient and the coding shift remainder of each prediction residual to be coded are respectively coded to obtain compressed data of the image block.
10. An image encoding device, characterized in that: include: A segmentation module, used for segmenting the image to be processed into multiple image blocks; A first determination module is used to determine, for at least one of the multiple image blocks, a prediction residual corresponding to a pixel to be encoded in the image block according to pixel information of the image block; A second determination module, configured to determine a first prediction residual value of the image block according to the prediction residual corresponding to the pixel to be encoded in the image block; A third determination module is used to determine a first coding parameter corresponding to each prediction residual to be encoded in the image block according to the first prediction residual value; the first coding parameter is a Golomb parameter k value; the k value is an order value of the exponential Golomb coding, and the k value corresponding to the current prediction residual to be encoded in the image block is determined based on the previous prediction residual to be encoded and its corresponding k value; The encoding module is used to encode the corresponding prediction residual to be encoded according to the first encoding parameter corresponding to each prediction residual to be encoded, so as to obtain compressed data of the image block.
11. An electronic device, characterized in that: include: one or more processors; The processor is used to call instructions so that the electronic device executes the image encoding method according to any one of claims 1 to 9.
12. A chip system, characterized in that: The chip system includes a processing unit and an interface circuit, the processing unit obtains program instructions through the interface circuit, the program instructions are executed by the processing unit, and the processing unit is used to execute the steps of the method as described in any one of claims 1-9.
13. A storage medium storing instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is enabled to execute the image encoding method according to any one of claims 1 to 9.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Lossless encoding and decoding method of Bayer image
CN107105208A