Image processing method and device, electronic equipment, chip and storage medium
By precoding the image to be processed, the image encoding parameters are determined using two encoding methods, which solves the problem of excessive power consumption of image compression technology in the prior art, realizes system power consumption, bandwidth and storage savings, and improves system work efficiency.
Patent Information
- Application Number
- CN202311303431.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-09
- Publication Date
- 2025-04-11
AI Technical Summary
While reducing hardware and bandwidth resources, existing image compression technology has problems of excessive power consumption and high complexity.
By precoding the image to be processed, two encoding methods (first entropy encoding and second entropy encoding) are used to determine the image encoding and decoding parameters, and key technical improvements in the encoding and decoding process in image compression processing are realized.
It saves the system's power consumption, bandwidth and storage, improves the system's working efficiency, and achieves the balance of subjective quality and compression rate of image compression processing.
Smart Images

Figure CN119815044A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image compression, and in particular to an image processing method, device, electronic device, chip and storage medium. Background Art
[0002] In image compression technology, frame buffer compression technology is mainly used inside the chip for cache compression processing in image processing. The main purpose of frame buffer compression is to reduce hardware and bandwidth resources, but at the same time requires that the image cannot have obvious damage. In order to achieve the above purpose, international standard solutions can be used to compress the image, such as JPEG-LS, DSC, JPEG and other solutions, but these solutions are often more complex and can reduce storage and bandwidth, but there is also the problem of excessive power consumption. Summary of the invention
[0003] The present disclosure provides an image processing method, device, electronic device, chip and storage medium. By adopting two encoding methods for encoding, the key technologies of the encoding and decoding process of image processing are improved, which can save system power consumption, bandwidth and storage and improve system work efficiency.
[0004] A first aspect of the present disclosure provides an image processing method, comprising: obtaining an image to be processed; performing pre-coding processing on the image to be processed, the pre-coding processing comprising first entropy coding and second entropy coding; determining a target code stream according to a first code stream corresponding to the first entropy coding and a second code stream corresponding to the second entropy coding; and performing image compression processing on the image to be processed based on a target image coding parameter corresponding to the target code stream.
[0005] In some embodiments of the present disclosure, pre-encoding processing of the image to be processed includes: performing residual quantization processing on the image to be processed to obtain an image residual; using the same image coding parameters, performing first entropy coding and second entropy coding on the image residual respectively to obtain a first code stream and a second code stream.
[0006] In some embodiments of the present disclosure, performing residual quantization processing on the image to be processed to obtain the image residual includes: obtaining a predicted image for the image to be processed; and subtracting the predicted image from the image to be processed to obtain the image residual.
[0007] In some embodiments of the present disclosure, the method also includes: obtaining initial image coding parameters based on the compression rate; performing residual inverse quantization on the image processed by residual quantization based on the initial image coding parameters to obtain restored data; and performing adaptive prediction based on the restored data to obtain a predicted image.
[0008] In some embodiments of the present disclosure, the method also includes: obtaining intermediate image coding parameters, which are obtained by performing code stream control on a first pixel area of the image to be processed; based on the intermediate image coding parameters, performing residual inverse quantization on a second pixel area that has been processed by residual quantization to obtain restored data; and based on the restored data, performing adaptive prediction to obtain a predicted image.
[0009] In some embodiments of the present disclosure, determining the target bitstream according to the first bitstream corresponding to the first entropy coding and the second bitstream corresponding to the second entropy coding includes: determining the code lengths of the first bitstream and the second bitstream; and determining the bitstream corresponding to the minimum code length as the target bitstream.
[0010] In some embodiments of the present disclosure, the method also includes: the first entropy coding is encoded using a fixed bit width, and the fixed bit width is related to the maximum value of the image residual; the second entropy coding is encoded using an adaptive exponential Golomb coding, and the adaptive index includes at least one of code table adaptation and exponent adaptation, and the adaptive index is related to the encoded context information.
[0011] In some embodiments of the present disclosure, the method also includes: obtaining multiple candidate image coding parameters; determining multiple first image coding parameters from the candidate image coding parameters; based on preset bitstream conditions, determining multiple second image coding parameters from the multiple candidate image coding parameters according to the bitstreams corresponding to the multiple first image coding parameters; based on preset bitstream conditions, determining the target image coding parameters according to the bitstreams corresponding to the multiple second image coding parameters.
[0012] In some embodiments of the present disclosure, the preset bitstream condition includes at least one of the following: the length of the current bitstream is less than or equal to the preset bitstream length; the image coding parameter corresponding to the current bitstream is the smallest; the image coding parameter corresponding to the current bitstream is in a preset range; the difference between the image coding parameter corresponding to the current bitstream and the image coding parameter corresponding to the reference bitstream is less than or equal to a preset value.
[0013] In some embodiments of the present disclosure, the method further includes: preprocessing the target bitstream, the preprocessing including writing mode bits and / or writing quantization parameter QP bits; and decoding the preprocessed target bitstream.
[0014] A second aspect embodiment of the present disclosure proposes an image processing device, which includes: an acquisition module, used to acquire an image to be processed; a processing module, used to perform pre-coding processing on the image to be processed, the pre-coding processing including first entropy coding and second entropy coding; a determination module, used to determine a target code stream according to a first code stream corresponding to the first entropy coding and a second code stream corresponding to the second entropy coding; and a compression module, used to perform image compression processing on the image to be processed based on a target image coding parameter corresponding to the target code stream.
[0015] The third 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 of the present disclosure, or execute the method described in the second aspect embodiment of the present disclosure.
[0016] The fourth 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 of the present disclosure, or to execute the method described in the second aspect embodiment of the present disclosure.
[0017] The fifth aspect embodiment of the present disclosure proposes a chip, which includes one or more interfaces and one or more processors; the interface 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 method described in the first aspect embodiment of the present disclosure, or executes the method described in the second aspect embodiment of the present disclosure.
[0018] In summary, the image processing method, device, electronic device, chip and storage medium proposed in the present invention, by pre-encoding the image to be processed and using two encoding methods to determine the image encoding parameters, realize the improvement of the key technology of the encoding and decoding process in the image compression processing. While ensuring that the image compression processing achieves a balance between subjective quality and compression rate, it can save system power consumption, bandwidth and storage, and improve system work efficiency.
[0019] 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
[0020] 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.
[0021] Figure 1 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0022] Figure 2 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0023] Figure 3 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0024] Figure 4 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0025] Figure 5 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0026] Figure 6 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0027] Figure 7 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0028] Figure 8 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0029] Figure 9a An example flow chart of an encoding end of an image processing method provided by an embodiment of the present disclosure;
[0030] Figure 9b An example flowchart of a decoding end of an image processing method provided by an embodiment of the present disclosure;
[0031] Fig.10 A schematic diagram of the structure of an image processing device provided in an embodiment of the present disclosure;
[0032] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;
[0033] Fig.12 A schematic diagram of the chip structure provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] 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.
[0035] Among various technologies for compressing data, the development of image compression processing technology has received more attention. The main reason is that there is a large amount of data redundancy and subjective visual redundancy in digital image and video data, which will occupy a large amount of storage and bandwidth, increase system power consumption, and waste resources on the one hand. On the other hand, the transmission rate of large data packets will also be reduced, which does not meet the efficient requirements for data transmission. Therefore, image compression processing is very necessary.
[0036] Frame buffer compression is mainly used for cache compression inside the chip for image processing. In order to facilitate image reconstruction, frame buffer compression needs to reduce hardware storage and bandwidth resources while ensuring that there is no obvious damage to the image after compression. In order to achieve the above requirements, international standards such as JPEG-LS, DSC, and JPEG can be used to compress the image. However, the international standard scheme is mainly defined between various devices, and the implementation complexity is relatively high. While saving storage and bandwidth, it also increases power consumption. Under the same compression rate conditions, the power consumption may be several times higher.
[0037] In summary, in order to solve the technical problems in the related technologies, the embodiments of the present invention provide an image processing method, which pre-encodes the image to be processed and adopts two encoding methods to determine the image encoding parameters, thereby realizing key technical improvements in the encoding and decoding process in image compression processing and saving the system's power consumption, bandwidth and storage.
[0038] Figure 1 The following is a flow chart of an image processing method provided by an embodiment of the present disclosure. Figure 1 As shown, the method can be executed by an electronic device, optionally, the method can be executed by a network device, optionally, the method can be executed by a server. The method can include the following steps.
[0039] Step 101: Obtain an image to be processed.
[0040] In some embodiments, the image to be processed may be an image to be compressed.
[0041] Step 102: performing pre-coding processing on the image to be processed, where the pre-coding processing includes first entropy coding and second entropy coding.
[0042] In some embodiments, the first entropy coding is performed using a fixed bit width, where the fixed bit width is related to the maximum value of the image residual.
[0043] In some embodiments, the first entropy coding may be a constant bit rate (CBR) coding, which may directly obtain the coded data through the address offset to achieve random access. The fixed bit length coding uses a fixed bit width to directly write the bit stream for coding, and the fixed bit width is related to the maximum value of the image residual. For example, if the image residual value is 10 bits, the fixed bit width may be 4 bits.
[0044] In some embodiments, the maximum value of the image residual can be determined according to the image coding parameter, and the image residual value corresponding to each image coding parameter is calculated based on multiple image coding parameters, and the maximum residual value is determined as the maximum value of the image residual.
[0045] In some embodiments, the second entropy coding uses adaptive exponential Golomb coding, the adaptive index includes at least one of code table adaptation and index adaptation, and the adaptive index is related to the encoded context information.
[0046] In some embodiments, the second entropy coding may be a variable bit rate (VBR) coding. In the variable bit rate coding mode, random access may be achieved by additionally storing address location information.
[0047] In some embodiments, the exponential adaptation of the second entropy coding may be K value adaptation, and the K value adaptation may obtain a predicted value of the current area by predicting residuals, pixels, etc. of surrounding areas.
[0048] In some embodiments, the current region may be a pixel region on the image to be processed that is undergoing image processing.
[0049] Step 103: determine a target bitstream according to the first bitstream corresponding to the first entropy coding and the second bitstream corresponding to the second entropy coding.
[0050] In some embodiments, the precoding process may use the first entropy coding and the second entropy coding to encode the residual to obtain a corresponding code stream.
[0051] In some embodiments, a bitstream control module may be used to select a mode, compare and judge the bitstreams obtained by the first entropy coding and the second entropy coding, and for bitstreams corresponding to the same image coding parameters, determine the bitstream with the smaller bitstream length as the target bitstream.
[0052] In some embodiments, the bitstream control module is mainly used to judge and select the bitstream information, and its main purposes include: judging the encoded bitstream information to determine whether it exceeds the preset ideal bitstream length; subtracting the current area image coding parameters from the surrounding image coding parameters to ensure that the difference in image coding parameters in adjacent areas is within a preset range.
[0053] Step 104: perform image compression processing on the image to be processed based on the target image coding parameters corresponding to the target code stream.
[0054] In some embodiments, the corresponding image coding parameters may be obtained based on the target code stream, and the image may be compressed using the image coding parameters.
[0055] In summary, the above-mentioned embodiments of the present application, by pre-encoding the image to be processed, select the code stream with a smaller code length obtained by the first entropy coding and the second entropy coding as the target code stream, and obtain its corresponding image coding parameters based on the target code stream, compress the image based on the image coding parameters, and use two encoding methods to determine the image coding parameters, thereby achieving an improvement in the image compression processing encoding and decoding process and saving the system's power consumption, bandwidth and storage.
[0056] Figure 2 The following is a flow chart of an image processing method provided by an embodiment of the present disclosure. Figure 2 As shown, based on Figure 1 In the embodiment shown, this embodiment specifically describes the above step 102. The method may include the following steps.
[0057] Step 201 , performing residual quantization processing on the image to be processed to obtain image residual.
[0058] In some embodiments, the residual is the deviation between the actual observed value and the model predicted value, and residual quantization can be used to predict the current area based on the residual values of the surrounding areas.
[0059] In some embodiments, quantization may be performed by directly shifting data.
[0060] Step 202: Use the same image coding parameters to perform first entropy coding and second entropy coding on the image residual to obtain a first bitstream and a second bitstream.
[0061] In some embodiments, the image coding parameter may be a quantization parameter (QP), which may reflect the degree of compression of the image. The larger the QP value, the more information the image loses and the worse the image compression quality. Correspondingly, the smaller the QP value, the less information the image loses and the better the compression quality.
[0062] In some embodiments, the first entropy coding may be a fixed code length coding, and the second entropy coding may be a variable code length coding. For the same image coding parameters, both coding methods may be used for encoding, which can avoid the problem that the code length after encoding is longer than that before encoding that may occur in variable code length coding, and facilitates the selection of a suitable coding method to obtain a better target code stream.
[0063] In summary, the above-mentioned embodiments of the present application obtain image residual information by performing residual quantization processing on the image to be processed, and obtain corresponding code stream information by using two entropy coding modes according to the residual information, thereby realizing pre-coding processing of the image to be processed, improving the image compression processing encoding and decoding process, and saving the system's power consumption, bandwidth and storage.
[0064] Figure 3 The following is a flow chart of an image processing method provided by an embodiment of the present disclosure. Figure 3 As shown, based on Figure 2 In the embodiment shown, this embodiment specifically describes the above step 201. The method may include the following steps.
[0065] Step 301: Obtain a predicted image for the image to be processed.
[0066] In some embodiments, the predicted image of the image to be processed may be used to represent the predicted effect of the image to be processed after compression.
[0067] In some embodiments, the current region that has been subjected to residual quantization may be inversely quantized to obtain restored data, and based on the restored data, the predictor may obtain a predicted image.
[0068] Step 302: Subtract the predicted image from the image to be processed to obtain an image residual.
[0069] In some embodiments, the difference between the predicted image and the image to be processed is the residual of the image.
[0070] In summary, the above-mentioned embodiments of the present application, by acquiring a predicted image and obtaining an image residual based on the predicted image, can obtain a value range of the predicted image coding parameter of the current area based on the image residual, which facilitates more accurate selection of parameter values when determining the image coding parameters, thereby improving the work efficiency of the system and saving the system's power consumption, bandwidth and storage.
[0071] Figure 4 The following is a flow chart of a method for determining image coding parameters provided by an embodiment of the present disclosure. Figure 4 As shown, based on Figure 3 In the illustrated embodiment, the method may further include the following steps.
[0072] Step 401: Obtain initial image encoding parameters based on the compression rate.
[0073] In some embodiments, the initial image encoding parameter may be a first quantization parameter QP.
[0074] In some embodiments, a corresponding QP value may be calculated from the compression rate, and the QP value may be determined as an initial image encoding parameter.
[0075] Step 402: Based on the initial image coding parameters, perform residual inverse quantization on the image that has been subjected to residual quantization processing to obtain restored data.
[0076] In some embodiments, residual dequantization may be performed on the image after residual quantization based on the initial image encoding parameters to obtain restored data, wherein residual dequantization is an inverse process of residual quantization.
[0077] Step 403: Perform adaptive prediction based on the restored data to obtain a predicted image.
[0078] In some embodiments, the restored data obtained by inverse quantization of the residual may be used by a predictor to predict an image.
[0079] In some embodiments, the adaptive prediction may be a direction-adaptive prediction, which may determine which pixel value the current region is closest to based on the pixel values around the current region, and spontaneously select the closest value when subsequently determining the encoded image parameters.
[0080] In some embodiments, adaptive prediction can be used to avoid coding loss and hardware processing pipeline pause caused by the prediction mode.
[0081] In summary, the above-mentioned embodiments of the present application obtain initial image coding parameters based on the image compression rate, obtain restored data according to the initial image coding parameters, and obtain a predicted image based on the restored data. This can make it more convenient and accurate to determine the image coding parameters of the current area, improve system work efficiency, and save system power consumption, bandwidth, and storage.
[0082] Figure 5 The following is a flow chart of a method for determining image coding parameters provided by an embodiment of the present disclosure. Figure 5 As shown, based on Figure 3 In the illustrated embodiment, the method may further include the following steps.
[0083] Step 501, obtaining intermediate image coding parameters, where the intermediate image coding parameters are obtained by performing code stream control on a first pixel region of an image to be processed.
[0084] In some embodiments, subsequent image coding parameters except the initial image coding parameters may be obtained according to code stream control.
[0085] In some embodiments, the first pixel region of the image to be processed may be a pixel region for which image encoding parameters have been determined, such as a 3*3 pixel region.
[0086] In some embodiments, the code stream control module may judge and determine a plurality of image coding parameters of the first pixel region, and may determine the intermediate image coding parameters according to a preset code stream condition.
[0087] In some embodiments, the intermediate image coding parameters may be image coding parameters adopted by the first pixel region.
[0088] In some embodiments, the preset bitstream condition includes at least one of the following: the length of the current bitstream is less than or equal to the preset bitstream length; the image coding parameter corresponding to the current bitstream is the smallest; the image coding parameter corresponding to the current bitstream is in a preset range; the difference between the image coding parameter corresponding to the current bitstream and the image coding parameter corresponding to the reference bitstream is less than or equal to a preset value.
[0089] Step 502: Based on the intermediate image coding parameters, perform residual inverse quantization on the second pixel region that has been subjected to residual quantization processing to obtain restored data.
[0090] In some embodiments, the second pixel region may be a pixel region to be processed next after the first pixel region is processed, and the first pixel region and the second pixel region are adjacent to each other on the same image.
[0091] In some embodiments, the code stream control module may perform residual inverse quantization on the second pixel region based on the image coding parameters of the first pixel region to obtain a predicted image of the second pixel region.
[0092] Step 503: Perform adaptive prediction based on the restored data to obtain a predicted image.
[0093] In some embodiments, the process of obtaining the predicted image based on the restored data has been described in detail in step 403 and will not be repeated here.
[0094] In summary, the above-mentioned embodiments of the present application, by performing residual dequantization on the second pixel area that has been residual quantized based on the intermediate coding parameters of the first pixel area to obtain restored data, and obtaining a predicted image based on the restored data, can realize prediction of the current area according to the image coding parameters of the surrounding areas, and can be more convenient and accurate in determining the image coding parameters of the current area, thereby improving system work efficiency and saving system power consumption, bandwidth and storage.
[0095] Figure 6 The following is a flow chart of an image processing method provided by an embodiment of the present disclosure. Figure 6 As shown, based on Figure 1 In the embodiment shown, this embodiment specifically describes the above step 103. The method may include the following steps.
[0096] Step 601: determine the code lengths of the first code stream and the second code stream.
[0097] In some embodiments, the image may be subjected to first entropy coding and second entropy coding to obtain corresponding first code stream and second code stream.
[0098] In some embodiments, the first code stream may be obtained through a fixed code length coding mode, and the second code stream may be obtained through a variable code length coding mode.
[0099] Step 602: determine the bitstream corresponding to the minimum bitlength as the target bitstream.
[0100] In some embodiments, the bitstream control module may compare the lengths of the first bitstream and the second bitstream, and determine the bitstream with the smallest bitstream length as the target bitstream.
[0101] In some embodiments, corresponding image encoding parameters may be acquired according to the target code stream, and the encoding parameters may be used to compress the image.
[0102] In summary, the above-mentioned embodiments of the present application can determine the image encoding parameters by comparing the lengths of the first code stream and the second code stream and determining the code stream with the smallest code length as the target code stream. The use of two encoding methods can avoid the problem of variable code length encoding having a longer code length after encoding than before encoding, making it easier to select a better encoding method and obtain a better compression effect. By improving the key technologies of the image compression processing encoding and decoding process, system power consumption, bandwidth and storage can be saved.
[0103] Figure 7 The following is a flow chart of an image processing method provided by an embodiment of the present disclosure. Figure 7 As shown, based on Figures 1 to 5 In the illustrated embodiment, the method may further include the following steps.
[0104] Step 701: Obtain multiple candidate image encoding parameters.
[0105] In some embodiments, a value range of the image coding parameter may be obtained according to a fixed bit width of the image to be processed, and all or part of the image coding parameters within the value range are multiple candidate image coding parameters.
[0106] Step 702: determine a plurality of first image coding parameters from candidate image coding parameters.
[0107] In some embodiments, a plurality of candidate image parameters may be sampled at preset intervals to obtain a plurality of first image encoding parameters.
[0108] In some embodiments, the preset interval can be manually specified according to the value range and actual needs.
[0109] Step 703 : Based on a preset bitstream condition and according to the bitstreams corresponding to the multiple first image coding parameters, determine multiple second image coding parameters from multiple candidate image coding parameters.
[0110] In some embodiments, a plurality of first image coding parameters may be pre-encoded to obtain corresponding code streams.
[0111] In some embodiments, the code stream control module determines and controls the code stream corresponding to the first image coding parameter based on a preset code stream condition to obtain a code stream that meets the preset code stream condition, and determines a plurality of second coding parameters based on the code stream.
[0112] In some embodiments, the preset bitstream condition includes any one of the following 1) to 4):
[0113] 1) The length of the current code stream is less than or equal to the preset code stream length;
[0114] In some embodiments, in order to ensure the compression rate, the code stream control module may preset an ideal code stream length. When the length of the current code stream is less than or equal to the preset length, the compression rate meets the requirement.
[0115] 2) The image encoding parameters corresponding to the current code stream are the smallest;
[0116] In some embodiments, the value of the image coding parameter can be used to indicate the degree of image compression. The higher the image coding parameter value, the higher the degree of compression, the more information is lost, and the worse the picture quality; the lower the image coding parameter value, the less information is lost, and the better the picture quality.
[0117] In some embodiments, a plurality of first image coding parameters corresponding to a plurality of code streams may be obtained according to the plurality of code streams, and a code stream corresponding to a minimum value of the plurality of first image coding parameters may be selected as the current code stream.
[0118] 3) The image coding parameters corresponding to the current code stream are within the preset range;
[0119] In some embodiments, the preset interval may be a value range of an image encoding parameter obtained according to a fixed bit width of the image to be processed.
[0120] 4) The difference between the image coding parameters corresponding to the current code stream and the image coding parameters corresponding to the reference code stream is less than or equal to a preset value.
[0121] In some embodiments, the reference bitstream is obtained by pre-encoding image encoding parameters of a region adjacent to the current region.
[0122] In some embodiments, when the image coding parameter values of two adjacent or neighboring areas differ too much, the image will appear discontinuous. In order to ensure the smooth transition of the image, it is required that the image coding parameter values of adjacent areas should not differ too much. A value can be preset to judge the difference between the image coding parameter values of the current bitstream and the reference bitstream. When the difference value is less than or equal to the preset value, the preset bitstream condition is met.
[0123] Step 704: Based on the preset bitstream condition and the bitstreams corresponding to the plurality of second image coding parameters, determine the target image coding parameters.
[0124] In some embodiments, a plurality of second image encoding parameters may be pre-encoded to obtain corresponding code streams.
[0125] In some embodiments, the bitstream control module determines and controls the bitstream corresponding to the second image coding parameter based on a preset bitstream condition to obtain a bitstream that meets the preset bitstream condition, and determines that the image coding parameter corresponding to the bitstream is the target coding parameter.
[0126] In some embodiments, the target encoding parameters may be used to perform compression processing on the image to be processed.
[0127] In summary, the above-mentioned embodiments of the present application obtain multiple second image coding parameters by performing code stream control on multiple first image coding parameters, and determine the target image coding parameters based on the code stream of the multiple second image coding parameters, thereby realizing the determination of image coding parameters by a hierarchical decision-making method, which can improve system efficiency and save system power consumption, bandwidth and storage.
[0128] Figure 8 The following is a flow chart of a method for determining image coding parameters provided by an embodiment of the present disclosure. Figure 8 As shown, based on Figures 1 to 5 In the illustrated embodiment, the method may further include the following steps.
[0129] Step 801 : preprocessing the target bitstream, where the preprocessing includes writing mode bits and / or writing quantization parameter QP bits.
[0130] In some embodiments, when reconstructing an image, a decoding process needs to be performed, and the decoding process may be the inverse process of the encoding process.
[0131] In some embodiments, the decoding process may include a pre-processing process and a decoding process.
[0132] In some embodiments, the target code stream may be a code stream obtained by encoding the image to be processed using the target image encoding parameters.
[0133] In some embodiments, during decoding preprocessing, it is necessary to first write a mode bit and / or a quantization parameter QP bit for each region, which can ensure that the decoding process can perform the decoding operation normally.
[0134] Step 802: Decode the pre-processed target bitstream.
[0135] In some embodiments, corresponding to the encoding process, the decoding process decodes the image data encoded by the first entropy encoding and the second entropy encoding.
[0136] In summary, the above-mentioned embodiments of the present application achieve key technical improvements in the decoding process of image compression processing by performing preprocessing and decoding operations on the target code stream, improve the efficiency of the system, and save the system's power consumption, bandwidth and storage.
[0137] For the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously.
[0138] Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0139] The technical solution of the present disclosure is further described in detail below in conjunction with specific application examples.
[0140] Figure 9a and Figure 9b An example diagram of an image processing method provided in an embodiment of the present disclosure. Figure 9a This is an example diagram of the encoding process for image compression processing. Figure 9b This is an example diagram of the decoding process of image compression processing.
[0141] like Figure 9a As shown, the coding process example diagram mainly includes a pre-coding module, a coding mode selection module, a bit stream control module and a bit stream output module.
[0142] In the pre-coding module, the image residual can be quantized and encoded. The residual value of the image can be input in the data input part. The pre-coding module can perform residual quantization based on the residual value. The residual quantization can obtain the restored data after residual inverse quantization. The predictor can predict the image to be processed based on the restored data. When making predictions, the data of the previous row and the current row can be saved, and there is a cache space of one row. The predictor can make a directional adaptive prediction of the current area based on the value of the processed pixel area to obtain the predicted value. Direction adaptive prediction makes it more convenient and accurate to select the image encoding parameters for the current area. Adaptive prediction can avoid the coding loss caused by the prediction mode and the pause of the hardware processing pipeline.
[0143] When performing residual quantization and inverse quantization, data direct shifting can be used to simplify the operation. The image coding parameter has a specific block length, and the entire length should not be set too large. For example, it can be set to 8, 16, 32, etc. The value of the initial image coding parameter can be calculated from the compression rate, and the remaining image coding parameters need to be determined by the code stream control module.
[0144] When encoding the image residual, two encoding methods can be used. For example, fixed code length encoding and variable code length encoding can be used. Among them, fixed code length encoding uses a fixed bit width to directly write the code stream, and its bit width is determined by the maximum value of the image residual; variable code length encoding uses adaptive encoding. For example, adaptive Columbus encoding can be used, and its adaptive part includes code table adaptation and index adaptation, such as K value adaptation. Adaptive coding can be adaptive according to the context information that has been encoded, and the value of the current area is predicted according to the surrounding values.
[0145] In the coding mode selection module, the bit stream information obtained from two different coding modes can be selected, and the bit stream with the smallest bit stream length is selected and input into the bit stream control module.
[0146] The code stream control module can make judgments and determinations based on preset code stream conditions, and the preset code stream conditions include at least one of the following: the length of the current code stream is less than or equal to the preset code stream length; the image coding parameter corresponding to the current code stream is the smallest; the image coding parameter corresponding to the current code stream is in a preset range; the difference between the image coding parameter corresponding to the current code stream and the image coding parameter corresponding to the reference code stream is less than or equal to a preset value.
[0147] The main purposes of the bitstream control module are twofold: first, to select more appropriate image coding parameters for the current region based on the encoded target bitstream, and to control the length of the final encoded bitstream not to exceed the preset ideal bitstream length; second, when selecting image coding parameters for different regions, to control the image coding parameter values between adjacent regions not to exceed the set values, and to avoid causing image non-smoothness problems.
[0148] The code stream output module can output the target code stream of the current area to the decoding end.
[0149] like Figure 9b As shown, the decoding process example diagram mainly includes a pre-decoding module, a decoding mode selection module, a restoration module and a data output module.
[0150] The decoding process is opposite to the encoding process. Before the bitstream is input, the mode bit and quantization parameter QP bit need to be written for each region to ensure that the decoding end can decode normally.
[0151] The bitstream input end can receive the target bitstream. The decoding mode selection module also provides two decoding methods, which correspond to the two encoding methods of the encoding end. The residual inverse quantization process is performed in the restoration module to obtain the restored data. The predictor of the decoding end has the same working process as the predictor of the encoding end, which will not be repeated here.
[0152] The data output module can output the restored image data.
[0153] In summary, the image processing method provided in this example can obtain more suitable image encoding parameters by adopting two encoding methods, and improve the key technologies of the encoding and decoding process to improve system efficiency and save system power consumption, bandwidth and storage.
[0154] Fig.10 FIG. 1 is a block diagram of an image processing device 1000 provided in an embodiment of the present disclosure. Fig.10 As shown, the device 1000 includes:
[0155] The acquisition module 1010 is used to acquire the image to be processed; the processing module 1020 is used to perform pre-coding processing on the image to be processed, and the pre-coding processing includes first entropy coding and second entropy coding; the determination module 1030 is used to determine the target bit stream according to the first bit stream corresponding to the first entropy coding and the second bit stream corresponding to the second entropy coding; the compression module 1040 is used to perform image compression processing on the image to be processed based on the target image coding parameters corresponding to the target bit stream.
[0156] In summary, the image to be processed is acquired through the acquisition module, the processing module pre-encodes the image to be processed, the determination module determines the target bitstream based on the pre-encoding result, the compression module determines the target image encoding parameters based on the target bitstream, and compresses the image, thereby realizing the key technical improvement of the encoding and decoding process in image compression processing, saving system power consumption, bandwidth and storage.
[0157] In some embodiments, the processing module 1020 is further used to execute: performing residual quantization processing on the image to be processed to obtain image residual; using the same image coding parameters, performing first entropy coding and second entropy coding on the image residual respectively to obtain a first bitstream and a second bitstream.
[0158] In some embodiments, the processing module 1020 is further used to execute: obtaining a predicted image for the image to be processed; and subtracting the predicted image from the image to be processed to obtain an image residual.
[0159] In some embodiments, the processing module 1020 is also used to perform: based on the compression rate, obtaining initial image coding parameters; based on the initial image coding parameters, performing residual inverse quantization on the image processed by residual quantization to obtain restored data; based on the restored data, performing adaptive prediction to obtain a predicted image.
[0160] In some embodiments, the processing module 1020 is also used to execute: obtaining intermediate image coding parameters, the intermediate image coding parameters are obtained by performing code stream control on a first pixel area of the image to be processed; based on the intermediate image coding parameters, performing residual inverse quantization on a second pixel area that has been processed by residual quantization to obtain restored data; based on the restored data, performing adaptive prediction to obtain a predicted image.
[0161] In some embodiments, the determination module 1030 is further configured to: determine the code lengths of the first code stream and the second code stream; and determine the code stream corresponding to the minimum code length as the target code stream.
[0162] In some embodiments, the first entropy coding uses a fixed bit width for encoding, and the fixed bit width is related to the maximum value of the image residual; the second entropy coding uses adaptive exponential Golomb coding, and the adaptive index includes at least one of code table adaptation and exponent adaptation, and the adaptive index is related to the encoded context information.
[0163] In some embodiments, the compression module 1040 is also used to perform: obtaining multiple candidate image coding parameters; determining multiple first image coding parameters from the candidate image coding parameters; based on preset bitstream conditions, determining multiple second image coding parameters from the multiple candidate image coding parameters according to the bitstreams corresponding to the multiple first image coding parameters; based on preset bitstream conditions, determining the target image coding parameters according to the bitstreams corresponding to the multiple second image coding parameters.
[0164] In some embodiments, the preset bitstream condition includes at least one of the following: the length of the current bitstream is less than or equal to the preset bitstream length; the image coding parameter corresponding to the current bitstream is the smallest; the image coding parameter corresponding to the current bitstream is in a preset range; the difference between the image coding parameter corresponding to the current bitstream and the image coding parameter corresponding to the reference bitstream is less than or equal to a preset value.
[0165] In some embodiments, the apparatus 1000 further includes a decoding module, which can be used to perform: preprocessing the target bitstream, the preprocessing including writing mode bits and / or writing quantization parameter QP bits; and decoding the preprocessed target bitstream.
[0166] In summary, the device 1000 obtains an image to be processed, pre-encodes the image to be processed, determines a target bitstream based on the pre-encoding result, determines image encoding parameters based on the target bitstream, and compresses the image to be processed according to the image encoding parameters, thereby achieving improvements in key technologies of the image compression processing flow, reducing the complexity of the solution, improving encoding efficiency, and saving system power consumption, bandwidth, and storage.
[0167] Fig.11A block diagram of an electronic device 1100 for implementing the above-mentioned image processing method provided in an embodiment of the present disclosure.
[0168] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present disclosure, the embodiment of the present disclosure also provides an electronic device, such as Fig.11 As shown, the electronic device 1100 includes:
[0169] Communication interface 1101, capable of exchanging information with other devices;
[0170] The processor 1102 is connected to the communication interface 1101 to implement information interaction with other devices, and is used to execute the method provided by one or more of the above technical solutions when running the computer program;
[0171] The computer program is stored in the memory 1103 .
[0172] Specifically, the processor 1102 can be used to obtain an image to be processed; perform pre-coding processing on the image to be processed, the pre-coding processing including first entropy coding and second entropy coding; determine a target code stream according to a first code stream corresponding to the first entropy coding and a second code stream corresponding to the second entropy coding; and perform image compression processing on the image to be processed based on a target image coding parameter corresponding to the target code stream.
[0173] It should be noted that the specific processing process of the processor 1102 can be understood by referring to the above method.
[0174] Of course, in actual application, the various components in the electronic device 1100 are coupled together through the bus system 1104. It can be understood that the bus system 1104 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 1104 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Fig.11 Various buses are labeled as bus system 1104 .
[0175] The memory 1103 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device 1100. Examples of such data include: any computer program used to operate on the electronic device 1100.
[0176] The method disclosed in the above embodiment of the present application can be applied to the processor 1102, or implemented by the processor 1102. The processor 1102 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor 1102 or an instruction in the form of software. The above-mentioned first processor 1102 may be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 1102 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 1103, and the processor 1102 reads the information in the memory 1103 and completes the steps of the above method in combination with its hardware.
[0177] In an exemplary embodiment, the electronic device 1100 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.
[0178] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1104 including instructions, and the instructions can be executed by a processor 1120 of the electronic device 1100 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.
[0179] An embodiment of the present disclosure further proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the image processing method described in the above embodiment of the present disclosure.
[0180] The embodiment of the present disclosure also provides a chip, such as Fig.12As shown, the chip includes a processor 1210 and an interface 1220. The number of the processors 1210 may be one or more, the number of the interfaces 1220 may be multiple, and the interface circuit is used to receive a signal from the memory of the electronic device and send a 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 image processing method described in the above embodiment of the present disclosure.
[0181] It should be noted that, for the convenience of description, only the parts related to the relevant invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other.
[0182] It should be understood that the "system", "device", "unit" and / or "module" used in this application is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the word can be replaced by other expressions.
[0183] As shown in this application and claims, unless the context clearly indicates an exception, the words "a", "an", "a kind" and / or "the" do not refer to the singular, but also include the plural. Generally speaking, the terms "include" and "comprise" only indicate the inclusion of clearly identified steps and elements, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements. The elements defined by the sentence "includes a..." do not exclude the existence of other identical elements in the process, method, commodity or device that includes the elements.
[0184] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0185] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0186] Flowcharts are used in the present application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed accurately in order. On the contrary, the various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes, or one or more operations may be removed from these processes.
[0187] 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.
[0188] 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.
[0189] 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.
[0190] 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.
[0191] 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.
[0192] 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 commodity, 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.
[0193] 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 processing method, characterized in that: include: Get the image to be processed; Performing a pre-coding process on the image to be processed, wherein the pre-coding process includes a first entropy coding and a second entropy coding; Determine a target bitstream according to a first bitstream corresponding to the first entropy coding and a second bitstream corresponding to the second entropy coding; Based on the target image encoding parameters corresponding to the target code stream, image compression processing is performed on the image to be processed.
2. The method according to claim 1, characterized in that The pre-coding process of the image to be processed comprises: Performing residual quantization processing on the image to be processed to obtain an image residual; The first entropy coding and the second entropy coding are respectively performed on the image residual using the same image coding parameters to obtain the first code stream and the second code stream.
3. The method according to claim 2, characterized in that The performing residual quantization processing on the image to be processed to obtain the image residual comprises: Acquire a predicted image for the image to be processed; The predicted image is subtracted from the image to be processed to obtain the image residual.
4. The method according to claim 3, characterized in that The method further comprises: Based on the compression ratio, obtaining initial image encoding parameters; Based on the initial image encoding parameters, performing residual inverse quantization on the image processed by residual quantization to obtain restored data; Based on the restored data, adaptive prediction is performed to obtain the predicted image.
5. The method according to claim 3, characterized in that: The method further comprises: Acquire an intermediate image coding parameter, where the intermediate image coding parameter is obtained by performing code stream control on a first pixel region of the image to be processed; Based on the intermediate image coding parameter, performing residual inverse quantization on the second pixel region that has been subjected to residual quantization processing to obtain restored data; Based on the restored data, adaptive prediction is performed to obtain the predicted image.
6. The method according to any one of claims 1 to 5, characterized in that The determining the target bitstream according to the first bitstream corresponding to the first entropy coding and the second bitstream corresponding to the second entropy coding comprises: Determining code lengths of the first code stream and the second code stream; The code stream corresponding to the minimum code length is determined as the target code stream.
7. The method according to any one of claims 1 to 5, characterized in that The first entropy coding is encoded using a fixed bit width, where the fixed bit width is related to the maximum value of the image residual; The second entropy coding adopts adaptive exponential Golomb coding, the adaptive index includes at least one of code table adaptation and index adaptation, and the adaptive index is related to the encoded context information.
8. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Obtaining multiple candidate image encoding parameters; Determine a plurality of first image coding parameters from the candidate image coding parameters; Based on a preset bitstream condition, determining a plurality of second image coding parameters from the plurality of candidate image coding parameters according to the bitstreams corresponding to the plurality of first image coding parameters; Based on a preset code stream condition, the target image coding parameter is determined according to the code streams corresponding to the plurality of second image coding parameters.
9. The method according to claim 8, characterized in that The preset bitstream condition includes at least one of the following: The length of the current code stream is less than or equal to the preset code stream length; The image encoding parameters corresponding to the current code stream are the smallest; The image encoding parameters corresponding to the current code stream are within a preset range; The difference between the image coding parameters corresponding to the current code stream and the image coding parameters corresponding to the reference code stream is less than or equal to a preset value.
10. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Preprocessing the target bitstream, wherein the preprocessing includes writing mode bits and / or writing quantization parameter QP bits; The pre-processed target code stream is decoded.
11. An image processing device, characterized in that: The device comprises: An acquisition module, used for acquiring an image to be processed; A processing module, used for performing a pre-coding process on the image to be processed, wherein the pre-coding process includes a first entropy coding and a second entropy coding; A determination module, configured to determine a target bitstream according to a first bitstream corresponding to the first entropy coding and a second bitstream corresponding to the second entropy coding; The compression module is used to perform image compression processing on the image to be processed based on the target image encoding parameters corresponding to the target code stream.
12. An electronic device, characterized in that: include: at least one processor; and a memory communicatively coupled to the at least one processor; 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 so that the at least one processor can execute the method according to any one of claims 1 to 10.
13. 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 to 10.
14. 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 to 10.