Image coding method and apparatus
By performing interpolation and layering processing on the image data, the problem of excessive bitstream in progressive coding methods is solved, achieving a reduction in the amount of encoded data and a progressive display effect.
Patent Information
- Application Number
- CN202110460846.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-27
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2041-04-27
AI Technical Summary
Existing progressive coding methods result in very large transmitted bitstreams, making it impossible to effectively reduce the amount of encoded data.
After performing DCT transformation and quantization on the current frame image, the difference is first processed, and then the image data is layered according to the preset layering rules and shift number. The amount of encoded data is reduced by difference and shift subtraction processing, and the layered data is sent to the decoding end.
It effectively reduces the amount of encoded data at each layer, thereby reducing the size of the transmission bitstream, and the decoding end can improve the image quality layer by layer to achieve a progressive display effect.
Smart Images

Figure CN113179402B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to an image coding and decoding method and device. BACKGROUND
[0002] Before transmission, an image usually needs to be encoded, such as using a progressive encoding method. At present, the basic process of using the progressive encoding method to encode is as follows: DCT (Discrete Cosine Transform) and quantization processing are respectively performed on a frame of image or a block region in a frame of image, to obtain encoding data, and then the encoding data is transmitted to a decoding end for decoding. Since all image data is directly encoded and transmitted, this results in a very large code stream being transmitted. SUMMARY
[0003] The present application provides an image coding and decoding method and device, which can solve the problem of a large code stream being transmitted by the existing progressive encoding method. The technical solution is as follows:
[0004] According to a first aspect of the present application, an image encoding method is provided, which comprises the following steps:
[0005] performing DCT (Discrete Cosine Transform) and quantization processing on a current frame of image in sequence, to obtain first image data;
[0006] performing difference processing on the first image data, to obtain second image data;
[0007] performing layering on the second image data according to a preset layering rule, to obtain layering data;
[0008] transmitting the layering data to a decoding end.
[0009] The first image data obtained after DCT and quantization processing of the current frame of image is subjected to difference processing before layering processing. The difference processing can reduce the amount of encoding data, and thus reduces the code stream being transmitted.
[0010] In one embodiment, the first image data is stored in descending order of numerical value; and the difference processing on the first image data comprises the following steps:
[0011] keeping the data with the highest numerical value in the first image data unchanged;
[0012] starting from the data with the second highest numerical value in the first image data, subtracting the numerical value of each data from the numerical value of the previous data in the storage order of the first image data, to obtain the second image data.
[0013] In one embodiment, the layering the second image data according to the preset layering rule comprises:
[0014] acquiring data with the highest value in the first image data;
[0015] calculating a shift number of the data with the highest value in the first image data shifting towards 0;
[0016] performing shift and subtraction processing on the second image data according to a preset layering number N and the shift number, the N being an integer greater than 1.
[0017] In one embodiment, the performing shift and subtraction processing on the second image data according to the preset layering number and the shift number comprises:
[0018] when a current layering number i is less than the preset layering number N, performing right shift processing on the second image data according to the shift number to obtain first data, the i being a positive integer;
[0019] performing reverse shift on the first data to obtain second data;
[0020] counting data with the most same data in the first data to obtain third data;
[0021] subtracting the third data from the first data to obtain i-layer layering data;
[0022] subtracting the second data from the second image data to obtain fourth data, updating the second image data to the fourth data, and increasing the i by 1;
[0023] when the i is equal to the N, setting the shift number to 0, and performing shift, reverse shift and subtraction processing on N-1-layer updated second image data according to the shift number 0 in sequence to obtain N-layer layering data.
[0024] By performing right shift and subtraction processing on the second image data obtained after difference processing according to a preset layering number and a shift number after sequentially performing DCT transformation, quantization processing and difference processing on the current frame image, the encoding data amount of each layer can be effectively reduced while layering the second image data, thereby further reducing the size of the transmission code stream.
[0025] In one embodiment, the sending the layering data to a decoding end comprises:
[0026] sending i-layer layering data and the third data to the decoding end.
[0027] In one embodiment, the sequentially performing discrete cosine (DCT) transformation and quantization processing on the current frame image comprises:
[0028] divide the current frame image into a plurality of image blocks;
[0029] perform DCT transformation on each image block to obtain DCT coefficient values, and sequentially save the DCT coefficient values in descending order;
[0030] perform quantization processing on the DCT coefficient values.
[0031] According to a second aspect of the embodiment of the present application, an image decoding method is provided, which comprises:
[0032] receiving layered data and third data corresponding to the layered data sent by an encoding end, the third data being data with the largest number of same data in first data, the first data being data obtained by right-shifting second image data according to a shift number, and the second image data being data obtained by sequentially performing discrete cosine (DCT) transformation, quantization processing and difference processing on a current frame image by the encoding end;
[0033] decoding each layer of the layered data sequentially according to the layered data and the third data corresponding to the layered data to obtain decoded image data;
[0034] displaying the decoded image data.
[0035] After the decoding end receives the layered data and the corresponding third data sent by the encoding end, each layer of the layered data can be decoded sequentially according to the layered data and the corresponding third data and displayed, so that the effect of progressive display can be achieved and the code stream is reduced.
[0036] In one embodiment, the decoding each layer of the layered data sequentially according to the layered data and the third data corresponding to the layered data to obtain decoded image data comprises:
[0037] when j = 1, adding the received first layer of the layered data to the third data, and performing inverse quantization processing on the obtained data to obtain first layer decoded data, wherein j is an integer greater than 1 and less than a preset number of layers N, j represents the number of the layer currently processed, and N is an integer greater than 1;
[0038] when j is greater than 1 and less than N, adding the received jth layer of the layered data to the third data, and performing inverse quantization processing on the obtained data to obtain jth layer of inverse quantization processed data;
[0039] summing the jth layer of inverse quantization processed data and (j-1)th layer of decoded data to obtain jth layer of decoded data, and adding 1 to j;
[0040] When j=N, the data after the inverse quantization of the Nth layer is summed with the decoded data of the (N-1)th layer, and the summed data is subjected to the inverse DCT transform to obtain the decoded image data.
[0041] The decoding end can decode the layered data of each layer in the layered order after receiving the layered data, and each subsequent layer supplements the detailed information on the basis of the decoded image, so that the decoded image becomes more detailed, the image quality is improved layer by layer, the effect of progressive display can be achieved, and the code stream is reduced.
[0042] According to a third aspect of the embodiments of the present application, an image encoding device is provided, which includes a processor and a memory, the memory stores at least one computer instruction, the instruction is loaded and executed by the processor to implement the steps performed by any embodiment of the image encoding method as described above.
[0043] According to a fourth aspect of the embodiments of the present application, an image decoding device is provided, which includes a processor and a memory, the memory stores at least one computer instruction, the instruction is loaded and executed by the processor to implement the steps performed by any embodiment of the image decoding method as described above.
[0044] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0045] The accompanying drawings, which are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application and, together with the specification, serve to explain the principles of the present application.
[0046] Figure 1 is a flowchart of an image encoding method provided by the embodiments of the present application;
[0047] Figure 2 is a schematic diagram of a DCT coefficient value storage method provided by the embodiments of the present application;
[0048] Figure 3 is a schematic diagram of a DCT coefficient value storage order provided by the embodiments of the present application, which is embodied by a digital serial number;
[0049] Figure 4 is a flowchart of an image decoding method provided by the embodiments of the present application;
[0050] Figure 5 is a structural schematic diagram of an image encoding device provided by the embodiments of the present application;
[0051] Figure 6is a structural schematic diagram of a specific image encoding device provided by an embodiment of the present application.
[0052] Figure 7 is a structural schematic diagram of an image decoding device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0053] The exemplary embodiments will be described in detail herein with reference to the drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.
[0054] An image encoding method provided by an embodiment of the present application can be applied to an image encoding device, such as Figure 1 As shown in the figure, the image encoding method can include the following steps:
[0055] Step 101: Perform DCT transformation and quantization processing on the current frame image in sequence to obtain first image data.
[0056] The encoding end obtains the current frame image, divides the current frame image into multiple image blocks, i.e., macroblocks, then performs DCT transformation on each image block to obtain DCT coefficient values, and saves the DCT coefficient values in sequence from large to small, and then performs quantization processing on the DCT coefficient values to obtain first image data.
[0057] For example, the current frame image can be divided into multiple 8*8 image blocks. After DCT transformation on the 8*8 image blocks, the 8*8 pixel values can be transformed into 8*8 DCT coefficient values, which are then saved in sequence from large to small. It should be noted that the storage order of the DCT coefficient values in the 8*8 matrix to some extent reflects the importance of the pixel points corresponding to the DCT coefficients. For the convenience of description, the order in the 8*8 matrix is reflected by the numerical sequence of the positions in the 8*8 matrix. Figure 2 Figure 2 Figure 3
[0058] Specifically, in the 8*8 matrix, the "0" position is the DCT coefficient value (frequency value) of the pixel point that the human eye pays the most attention to, and then the DCT coefficients are arranged in sequence from large to small, and the "63" position is the DCT coefficient value of the pixel point that the human eye is most likely to ignore. Figure 3
[0059] Step 102: Perform difference processing on the first image data to obtain second image data.
[0060] After obtaining the first image data, the first image data is processed by difference to obtain second image data. Specifically, it can include: keeping the data with the highest value in the first image data unchanged; starting from the data with the second highest value in the first image data, subtracting the value of each data from the value of the previous data in the storage order of the first image data to obtain the second image data.
[0061] For example, in Figure 3 , the data at the "0" position remains unchanged, and each subsequent data is subtracted from the data at the previous sequence number in sequence order.
[0062] Step 103: layering the second image data according to a preset layering rule to obtain layered data.
[0063] After obtaining the second image data, the second image data is layered according to a preset layering rule to obtain layered data, and then the layered data is sent to a decoding end.
[0064] Specifically, layering the second image data according to a preset layering rule includes: obtaining the data with the highest value in the first image data; calculating the shift number of the data with the highest value in the first image data that tends to be close to 0; and performing shift and subtraction processing on the second image data according to a preset number of layers N and the shift number, where N is an integer greater than 1.
[0065] Wherein, the shift and subtraction processing on the second image data according to the preset number of layers and the shift number includes: when the current number of layers i is less than the preset number of layers N, performing right shift processing on the second image data according to the shift number to obtain first data, where i is a positive integer and the initial value is 1; performing reverse shift on the first data to obtain second data; counting the data with the most number of the same data in the first data to obtain third data; subtracting the third data from the first data to obtain the i-th layer of layered data; subtracting the second data from the fourth data to obtain the fourth data, and updating the second image data with the fourth data and adding 1 to i, i.e. updating the second image data to the fourth data; when i is equal to N, setting the shift number to 0, and performing shift, reverse shift and subtraction processing on the N-1-th layer of updated second image data according to the shift number 0 to obtain the N-th layer of layered data.
[0066] For example, taking the second image data into 4 layers (i.e. the preset number of layers N = 4) as an example and combining Figure 3 , the layering can be performed by the following steps S1-S7:
[0067] Step S1: data shift.
[0068] Obtain Figure 3The data in the "0" position is shifted to obtain a shift number bitNum which is close to 0. For example, the data in the "0" position is binary number "100", and the number close to 0 is obtained by right shifting the binary number "100" by 2 bits, i.e. "001". Thus, the shift number bitNum is 2. After the shift number bitNum is determined, the 64 DCT coefficient values are right shifted by the shift number bitNum to obtain first data. The 64 DCT coefficient values before the shift can be denoted as org, and the first data obtained after the shift can be denoted as qua.
[0069] Step S2: reverse shift.
[0070] The first data qua obtained after the right shift in step S1 is reverse shifted to obtain second data iqua. It should be noted that after the data is shifted and then reverse shifted, the data is not the same as before, for example, for data 38, the data 4 is obtained by right shifting the data 38 by 3 bits, but the data 32 is obtained by left shifting the data 4 by 3 bits, not the data 38. Thus, the remaining data das is generated. Thus, the das is the remaining value after the shift, i.e. das = 38-32 = 6.
[0071] Step S3: determine the first layer of layered data.
[0072] The number of the same data in the first data qua obtained after the shift is counted, and the data subnum with the largest number is determined according to the counting result. The data subnum is subtracted from the data qua to obtain the first layer of layered data. For example, the number of data 2 in the first data qua is the largest, and thus the data subnum is determined to be 2. Then, the data subnum is subtracted from each data in the data qua to obtain data sub1. The data sub1 is the data of the first layer which is ready to be encoded and transmitted to the decoding end.
[0073] Step S4: calculate the remaining data.
[0074] The 64 DCT coefficient values org before the shift are subtracted from the second data iqua obtained after the reverse shift to obtain the remaining data after the transmission of the first layer, which can be denoted as das, i.e. das = org-iqua.
[0075] Step S5: the remaining data das obtained in step S4 is also subjected to the steps S1-S3 described above to obtain data sub2. The data sub2 is the data of the second layer which is ready to be encoded and transmitted to the decoding end.
[0076] Step S6: the remaining data das obtained in step S4 is also subtracted from the second data iqua obtained after the reverse shift to obtain new remaining data das. Then, the data sub3 is obtained by the same shift and subtraction operation in steps S1-S3 described above. The data sub3 is the data of the third layer which is ready to be encoded and transmitted to the decoding end.
[0077] Step S7: for the 4th layer, i.e. the last layer, set the shift number bitNum of all macroblocks to 0 to ensure that all data of the last layer can be transmitted to the decoding end and there is no remaining data, and then perform the same shift subtraction operation of steps S1-S3 to obtain data sub4, which is the data of the 4th layer ready for encoding and transmission to the decoding end.
[0078] In this way, the amount of data transmitted for each layer can be greatly reduced, thereby reducing the overall code stream.
[0079] Step 104: send the layered data to the decoding end.
[0080] After obtaining the layered data, the layered data is sent to the decoding end. Specifically, the i-th layered data and the third data are sent to the decoding end so that the decoding end can decode and restore the layered data to obtain the final data to be displayed.
[0081] In actual applications, the layered data can be sent to the decoding end as soon as it is obtained, or all layered data can be sent to the decoding end after all layered processing is completed.
[0082] The image encoding method provided by the embodiment of the present application first performs difference processing on the first image data obtained after DCT transformation and quantization processing of the current frame image before performing layered processing on the first image data, which can reduce the amount of encoded data and thereby reduce the transmission code stream; after the difference processing, the second image data obtained after the difference processing is right-shifted and subtracted according to the preset number of layers and the shift number, which can effectively reduce the amount of encoded data of each layer while performing layered processing on the second image data, thereby further reducing the size of the transmission code stream.
[0083] Based on the above Figure 1 The image encoding method provided by the corresponding embodiment, another embodiment of the present application provides an image decoding method, which can be applied to an image decoding device. Referring to Figure 4 The image decoding method provided by the embodiment can include the following steps:
[0084] Step 401: receive layered data and third data corresponding to the layered data sent by the encoding end.
[0085] The third data is the data with the largest number of identical data in the first data, wherein the first data is obtained by right-shifting the second image data according to the shift number, and wherein the second image data is obtained by sequentially performing DCT transformation, quantization processing and difference processing on the current frame image by the encoding end.
[0086] Step 402: decoding the layered data of each layer in sequence according to the layered data and the third data corresponding to the layered data, to obtain decoded image data.
[0087] Specifically, j can represent the current processing layer number, and j is an integer greater than 1 and less than a preset layered number N, where N is an integer greater than 1. After receiving the layered data and the third data corresponding to the layered data sent by the encoding end, the layered data is processed as follows:
[0088] When j = 1, the received first-layer layered data is added to the third data, and the obtained data is subjected to inverse quantization processing to obtain first-layer decoded data. In actual application, the encoding end can also send the quantization parameter used when quantizing the current frame image to the image decoding device of the decoding end, and the decoding end can perform inverse quantization processing according to the quantization parameter.
[0089] When j is greater than 1 and less than N, the received j-layer layered data is first added to the third data, and the obtained data is subjected to inverse quantization processing to obtain j-layer inverse quantization processed data. Then, the j-layer inverse quantization processed data is summed with the (j-1)-layer decoded data to obtain j-layer decoded data, and j is incremented by 1.
[0090] When j = N, the N-layer inverse quantization processed data is summed with the (N-1)-layer decoded data, and the summed data is subjected to DCT inverse transformation to obtain decoded image data.
[0091] Step 403: displaying the decoded image data.
[0092] After obtaining the decoded image data, the decoded image data is displayed.
[0093] For example, taking the received layered data as four-layer data, after receiving the first-layer layered data and the third data subnum, the first-layer layered data is first added to the third data subnum, and then the obtained data is subjected to inverse quantization processing to obtain first-layer decoded data, which can be denoted as ref1. After sequentially receiving the second-layer layered data, the second-layer layered data is added to subnum and subjected to inverse quantization, and the inverse quantization processed data is summed with ref1 to obtain new data ref2. The third-layer layered data and the fourth-layer layered data are processed in the same way, and after processing the fourth-layer layered data, new data ref4 is obtained. The DCT inverse transformation of the finally obtained ref4 can obtain decoded image data, i.e., the final display data.
[0094] The image decoding method provided in this application embodiment allows the image decoding device at the decoding end to decode each layer of data in the order of layering after receiving the layered data. Each subsequent layer adds detailed information based on the previously decoded data, making the decoded image more refined and improving the image quality layer by layer. This achieves a progressive display effect while reducing the bit rate.
[0095] Based on the above Figure 1 and Figure 4 The image encoding and image decoding methods described in the corresponding embodiments are described below as device embodiments of this application, which can be used to execute the method embodiments of this application.
[0096] This application provides an image encoding device, such as... Figure 5 As shown, the image encoding device 50 includes: a quantization processing module 501, a difference processing module 502, a layering module 503, and a transmission module 504;
[0097] The quantization processing module 501 is used to sequentially perform Discrete Cosine Transform (DCT) and quantization processing on the current frame image to obtain the first image data. Specifically, the quantization processing module 501 may include a block division unit, a DCT transformation unit, and a quantization unit. The block division unit is used to divide the current frame image into multiple image blocks. The DCT transformation unit is used to perform DCT transformation on each image block to obtain DCT coefficient values, and to save the DCT coefficient values in descending order. The quantization unit is used to perform quantization processing on the DCT coefficient values.
[0098] The difference processing module 502 is used to perform difference processing on the first image data obtained by the quantization processing module 501 to obtain the second image data. Specifically, the first image data can be stored in descending order of value. The difference processing module 502 is specifically used to keep the highest value in the first image data unchanged, and starting from the second highest value in the first image data, subtract the value of the previous value from the value of each data according to the storage order of the first image data to obtain the second image data.
[0099] The layering module 503 is used to layer the second image data obtained by the difference processing module 502 according to a preset layering rule to obtain layered data;
[0100] The sending module 504 is used to send the layered data obtained by the layering module 503 to the decoding end.
[0101] In one embodiment, such as Figure 6 As shown, the hierarchical module 503 may include an acquisition unit 5031, a calculation unit 5032, and a hierarchical unit 5033. Among them,
[0102] The acquisition unit 5031 is used to acquire the data with the highest value in the first image data;
[0103] The calculation unit 5032 is used to calculate the number of shifts in the first image data where the highest value shifts close to 0;
[0104] The layering unit 5033 is used to perform shifting and subtraction processing on the second image data according to the preset layering number N and the shifting number, where N is an integer greater than 1.
[0105] In one embodiment, the layering unit 5033 is specifically used to, when the current layer number i is less than the preset layer number N, perform right shift processing on the second image data according to the shift number to obtain the first data, where i is a positive integer, perform reverse shift on the first data to obtain the second data, count the data with the most identical data in the first data to obtain the third data, subtract the third data from the first data to obtain the i-th layer data, subtract the second data from the second image data to obtain the fourth data, update the second image data to the fourth data and increment i by 1; when i equals N, set the shift number to 0, and perform shift, reverse shift and subtraction processing on the updated second image data of the N-1th layer according to the shift number 0 to obtain the N-th layer data.
[0106] The sending module 504 is specifically used to send the i-th layer data and the third data to the decoding end.
[0107] The image encoding device provided in this application performs interpolation processing on the first image data obtained after DCT transformation and quantization of the current frame image before performing layer processing. Interpolation processing can reduce the amount of encoded data, thereby reducing the transmission bitstream. After interpolation processing, the second image data obtained after interpolation processing is shifted to the right and subtracted according to the preset number of layers and the number of shifts. This can effectively reduce the amount of encoded data in each layer while performing layer processing on the second image data, thereby further reducing the size of the transmission bitstream.
[0108] This application provides an image decoding device, such as... Figure 7 As shown, the image decoding device 70 includes a receiving module 701, a decoding module 702, and a display module 703. Among them,
[0109] The receiving module 701 is used to receive the layered data and the third data corresponding to the layered data sent by the encoding end. The third data is the data with the most identical data in the first data. The first data is the data obtained by shifting the second image data to the right according to the shift number. The second image data is the data obtained by the encoding end after performing discrete cosine DCT transformation, quantization processing and difference processing on the current frame image in sequence.
[0110] The decoding module 702 is configured to decode each layer of the layered data in sequence according to the layered data and the third data received by the receiving module 701, to obtain decoded image data.
[0111] The display module 703 is configured to display the decoded image data.
[0112] Specifically, in one embodiment, the decoding module 702 is specifically configured to: when j = 1, add the received first layer of layered data to the third data, and perform inverse quantization on the obtained data to obtain first layer decoding data, where j is an integer greater than 1 and less than a preset number of layers N, j represents the number of the layer currently processed, and N is an integer greater than 1; when j is greater than 1 and less than N, add the received jth layer of layered data to the third data, and perform inverse quantization on the obtained data to obtain jth layer inverse quantization data, sum the jth layer inverse quantization data and the (j-1)th layer decoding data to obtain jth layer decoding data, and add 1 to j; when j = N, sum the Nth layer inverse quantization data and the (N-1)th layer decoding data, and perform DCT inverse transform on the summed data to obtain decoded image data.
[0113] The image decoding device provided by the embodiment of the present application can decode each layer of layered data in sequence after receiving the layered data, and each layer after the previous layer is decoded is supplemented with detailed information, so that the decoded image becomes more detailed, the image quality is improved layer by layer, the effect of progressive display can be achieved, and the code stream is reduced.
[0114] The embodiment of the present application further provides another image encoding device, which comprises a processor and a memory, and the memory stores at least one computer instruction, which is loaded and executed by the processor to implement the image encoding method described in the corresponding embodiment. Figure 1 The image encoding method described in the corresponding embodiment.
[0115] The embodiment of the present application further provides another image decoding device, which comprises a processor and a memory, and the memory stores at least one computer instruction, which is loaded and executed by the processor to implement the image encoding method described in the corresponding embodiment. Figure 4 The image encoding method described in the corresponding embodiment.
[0116] Based on the image encoding method described in the corresponding embodiment or the image encoding method described above, Figure 1 the image encoding method described in the corresponding embodiment or the image encoding method described above, Figure 4According to the image decoding method described in the corresponding embodiment, the present embodiment also provides a computer readable storage medium, for example, a non-transitory computer readable storage medium can be a read only memory (Read Only Memory, ROM), a random access memory (Random Access Memory, RAM), a CD-ROM, a magnetic tape, a floppy disk and an optical data storage device, etc. The storage medium stores computer instructions for executing the above Figure 1 According to the image encoding method described in the corresponding embodiment or the above Figure 4 According to the image decoding method described in the corresponding embodiment, this will not be described here.
[0117] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The specification and examples given are exemplary only and the true scope and spirit of the application are indicated by the appended claims. It will be appreciated by those skilled in the art that the present application can be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The presently disclosed embodiments are therefore considered in all respects to be illustrative and not restrictive. The scope of the application is indicated by the appended claims, and all changes which come within the meaning and range of equivalents are intended to be embraced therein.
[0118] It should be understood that the application is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application is indicated by the appended claims, and all changes that come within the meaning and range of equivalents are intended to be embraced therein.
Claims
1. An image coding method characterized by, The method comprises: performing discrete cosine DCT transformation and quantization processing on the current frame image in sequence to obtain first image data; performing difference processing on the first image data to obtain second image data; performing layering on the second image data according to a preset layering rule to obtain layering data; sending the layering data to a decoding end; the layering on the second image data according to the preset layering rule comprises: obtaining data with the highest value in the first image data; calculating a shift number of the data with the highest value in the first image data shifting to approach 0; performing shift and subtraction processing on the second image data according to a preset layering number N and the shift number, wherein the N is an integer greater than 1; the shift and subtraction processing on the second image data according to the preset layering number N and the shift number comprises: when a current layering number i is less than the preset layering number N, performing right shift processing on the second image data according to the shift number to obtain first data, wherein the i is a positive integer; performing reverse shift on the first data to obtain second data; obtaining third data by counting data with the largest number of same data in the first data; obtaining i-layer layering data by subtracting the third data from the first data; obtaining fourth data by subtracting the second data from the second image data, updating the second image data to the fourth data, and increasing the i by 1; when the i is equal to the N, setting the shift number to 0, and performing shift, reverse shift and subtraction processing on the N-1-layer updated second image data according to the shift number 0 to obtain N-layer layering data.
2. The method of claim 1, wherein, the first image data is stored in descending order of value; the difference processing on the first image data comprises: keeping the data with the highest value in the first image data unchanged; starting from the data with the second highest value in the first image data, subtracting the value of each data from the value of the previous data according to the storage order of the first image data to obtain the second image data.
3. The method of claim 1, wherein, the sending of the layering data to the decoding end comprises: sending i-layer layering data and the third data to the decoding end.
4. The method of claim 1, wherein, the DCT transformation and quantization processing on the current frame image in sequence comprises: dividing the current frame image into multiple image blocks; performing DCT transformation on each image block to obtain DCT coefficient values, and sequentially saving the DCT coefficient values in descending order; performing quantization processing on the DCT coefficient values.
5. An image decoding method characterized by, comprises: receiving layering data and third data corresponding to the layering data sent by an encoding end, wherein the third data is data with the largest number of same data in first data, the first data is data obtained by right shifting second image data according to a shift number, and the second image data is data obtained by sequentially performing DCT transformation, quantization processing and difference processing on a current frame image by the encoding end; sequentially decoding each layer of layering data according to the layering data and the third data corresponding to the layering data to obtain decoded image data; displaying the decoded image data; The decoding the layered data of each layer in sequence according to the layered data and the third data corresponding to the layered data comprises: when j is 1, adding the received first layered data to the third data, and performing inverse quantization on the obtained data to obtain first decoded data, wherein j is an integer greater than 1 and less than a preset number of layers N, j represents the number of layers currently processed, and N is an integer greater than 1; when j is greater than 1 and less than N, adding the received jth layered data to the third data, and performing inverse quantization on the obtained data to obtain jth inverse quantization processed data; summing the jth inverse quantization processed data and the (j-1)th decoded data to obtain jth decoded data, and adding 1 to j; when j is N, summing the Nth inverse quantization processed data and the (N-1)th decoded data, and performing DCT inverse transform on the summed data to obtain decoded image data.
6. An image coding apparatus characterized by comprising: The image encoding device comprises a processor and a memory, and the memory stores at least one computer instruction, which is loaded and executed by the processor to implement the steps performed in the image encoding method of any one of claims 1 to 4.
7. An image decoding apparatus characterized by comprising: The image decoding device comprises a processor and a memory, and the memory stores at least one computer instruction, which is loaded and executed by the processor to implement the steps performed in the image decoding method of claim 5.
Citation Information
Patent Citations
System and method for real-time transcoding of digital video for fine-granular scalability
CN101077011A
Data transmission method and device
CN111556315A