WO2023138391A1 - 系数解码方法、装置、图像解码器及电子设备 - Google Patents

系数解码方法、装置、图像解码器及电子设备 Download PDF

Info

Publication number
WO2023138391A1
WO2023138391A1 PCT/CN2023/070728 CN2023070728W WO2023138391A1 WO 2023138391 A1 WO2023138391 A1 WO 2023138391A1 CN 2023070728 W CN2023070728 W CN 2023070728W WO 2023138391 A1 WO2023138391 A1 WO 2023138391A1
Authority
WO
WIPO (PCT)
Prior art keywords
coefficient
length
code
coefficient group
group
Prior art date
Application number
PCT/CN2023/070728
Other languages
English (en)
French (fr)
Inventor
潘冬萍
孙煜程
曹小强
陈方栋
Original Assignee
杭州海康威视数字技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Publication of WO2023138391A1 publication Critical patent/WO2023138391A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/18Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a set of transform coefficients
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/20Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video object coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/44Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/63Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using sub-band based transform, e.g. wavelets
    • H04N19/64Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using sub-band based transform, e.g. wavelets characterised by ordering of coefficients or of bits for transmission
    • H04N19/645Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using sub-band based transform, e.g. wavelets characterised by ordering of coefficients or of bits for transmission by grouping of coefficients into blocks after the transform

Definitions

  • the embodiments of the present application relate to the technical field of image encoding and decoding, and in particular, relate to a coefficient decoding method, device, image decoder, and electronic equipment.
  • Lossless compression refers to the technology of compressing the redundant information in the original image and reconstructing the original image without causing any distortion. If there is an error between the reconstructed image and the original image, and the error is limited within a certain range, it can be called near lossless compression.
  • the residual value between pixels in the original image is predicted, and the residual value is used to indicate the difference between pixels.
  • Use Semi Fixed-Length Code (Semi Fixed-Length Code) to encode the residual value to further reduce the code length.
  • the existing semi-fixed-length coding technology still has the problems of long coding length and low coding efficiency.
  • Embodiments of the present application provide a coefficient decoding method, device, image decoder, and electronic equipment, which can improve image decoding performance.
  • an embodiment of the present application provides a coefficient decoding method, including: analyzing the code stream to obtain coefficient group information of the unit to be decoded.
  • the coefficients of the unit to be decoded are divided into one or more coefficient groups.
  • Each coefficient group includes at least one coefficient code.
  • the coefficient codes in the same coefficient group are fixed-length codes with the same code length.
  • At least one coefficient group includes a first coefficient group, and the coefficient group information includes the boundary symbol of the first coefficient group;
  • the decoding range of the fixed-length coding without boundary symbols is [0,2 ⁇ bit_depth-1], and when the boundary symbols are introduced to perform fixed-length decoding on the coefficient codes of the coefficient group, the positive or negative of the coefficient group is determined according to the boundary symbols of the coefficient group, and the resolution range of the fixed-length coding is changed from [0,2 ⁇ bit_depth-1] to [-2 ⁇ (coding length–1)-1,2 ⁇ (coding length th-1)], there is no need to increase the code length corresponding to the coefficient group when there is a coefficient value equal to 2 ⁇ bit_depth-1 in the coefficient group, which improves the encoding and decoding efficiency.
  • the coefficient group information also includes the code length and the image bit width of the first coefficient group.
  • the code length is used to represent the length of the fixed-length code corresponding to the first coefficient group, and the coefficient code of the first coefficient group is parsed into a coefficient value, including: if the code length is greater than or equal to the image bit width, the coefficient code of the first coefficient group is parsed into a coefficient value by using a fixed-length code whose length is equal to the image bit width;
  • the image bit width corresponding to the coefficient group is used to represent the value range of the coefficient value in the coefficient group, and according to the fixed-length encoding of the preset code length corresponding to the coefficient group and the analytical value range of the coefficient value in the coefficient group, the corresponding fixed-length encoding and the analytical range of the coefficient value in the coefficient group are determined to ensure the accuracy of the judgment method.
  • the bit width of the image corresponding to the coefficient group can be obtained by analyzing the code stream, which can simply and quickly extract the data required for judgment and improve the judgment efficiency. According to the two situations, fixed-length codes with different code lengths are used to analyze the coefficient codes, which improves the decoding efficiency.
  • the code length of the coefficient group includes a coefficient group code length and a coefficient bit code length
  • the coefficient bit code length is used to indicate the length of the fixed-length code corresponding to the coefficient code at a specific position in the first coefficient group, wherein the specific position is obtained according to codec consistency or derived from the context.
  • the coefficient code of the first coefficient group is resolved into a coefficient value by using a fixed-length code whose length is a code length, including: using a fixed-length code whose length is a coefficient bit code length to resolve a coefficient code at a specific position in the first coefficient group into a coefficient value; adopting a fixed-length code whose length is a coefficient group code length to resolve coefficient codes in the first coefficient group except for a specific position into a coefficient value.
  • coefficient codes corresponding to the same or similar code lengths are put into the same coefficient group according to the size of the coefficient values during encoding sorting. Therefore, when the coefficient values in the same coefficient group have fixed-length coded analytical extremum values corresponding to the code length, other coefficient values and analytical extremum values in the same coefficient group are both positive or negative. Therefore, in the case that there is an absolute extremum in the first coefficient group, all coefficient values in the coefficient group are determined to be all positive or all negative according to the boundary sign, and the absolute extremum value is the maximum absolute value of the coded value range of the fixed-length code corresponding to the code length of the coefficient group.
  • the same coefficient group uses a boundary symbol to indicate the positive and negative coefficients, which improves the coding efficiency.
  • the same coefficient group is divided into multiple coefficient blocks, and if there is an absolute extremum in any coefficient block, all coefficient values in any coefficient block are determined to be all positive or all negative according to the boundary sign of any coefficient block. The accuracy of indicating the sign of the coefficient value by the boundary sign is further improved.
  • the residual coefficient is obtained by quantizing the predicted value and residual value, and the coefficient transformation step will not be performed.
  • the coefficient code in the unit to be decoded obtained by the decoding device by parsing the code stream may be a semi-fixed-length coding result of residual coefficients or a semi-fixed-length coding result of transform coefficients.
  • the coefficient decoding method in any of the above implementation manners can be applied to the decoding of residual coefficients or transform coefficients, which improves the applicability of the coefficient decoding method.
  • the DC coefficient group and the AC coefficient group included in the transformation coefficients are respectively divided into different coefficient groups.
  • the code length of each coefficient group is in the code length encoding form in the coefficient group information
  • the boundary symbol is in the boundary symbol encoding form in the coefficient group information.
  • the code length encoding of the coefficient group is analyzed by using a DC coefficient decoding method (such as a fixed-length code) to obtain the code length corresponding to the coefficient group
  • the boundary symbol code of the coefficient group is analyzed by using the fixed-length coding corresponding to the coefficient group to obtain the boundary symbol.
  • a fixed-length code can be used to analyze the code length encoding of the coefficient group to obtain the code length corresponding to the coefficient group, the DC coefficient value can be analyzed using the fixed-length code corresponding to the coefficient group, and the boundary symbol code of the coefficient group can be analyzed with a fixed code length of 1 to obtain the boundary symbol.
  • the fixed-length decoding method is used to analyze the code length code corresponding to the coefficient group to obtain the code length corresponding to the coefficient group; the boundary symbol code of the coefficient group is analyzed by using the fixed-length code corresponding to the coefficient group to obtain the boundary symbol.
  • DC coefficients and AC coefficients are generated when performing coefficient transformation on residual values and predicted values
  • DC coefficients and AC coefficients are separately divided into coefficient groups.
  • the DC coefficient decoding method is used to analyze the code length encoding of the DC coefficient group
  • the fixed-length decoding method is used to analyze the code length encoding of the AC coefficient group.
  • Coefficient encoding and decoding can be performed on the DC coefficients and AC coefficients, avoiding the problem that the coefficient values in the same coefficient group differ greatly and require a longer code-length fixed-length encoding for encoding and analysis, and the decoding efficiency is improved.
  • determining the first coefficient group in the unit to be decoded includes: determining a scanning mode and a grouping mode of the unit to be decoded from the code stream; scanning the unit to be decoded according to the scanning mode to obtain a scanning result; dividing the scanning result into one or more coefficient groups according to the grouping mode, and the first coefficient group is any coefficient group in the one or more coefficient groups.
  • decoding can be the inverse step of encoding.
  • the scanning mode, grouping mode, and fixed-length encoding used by the encoding end and the decoding end are all pre-agreed and consistent, following the consistency of encoding and decoding.
  • the residual coefficients or transformation coefficients are sorted and grouped by using a scanning method and a grouping method, and the coefficient values encoded by fixed-length codes of different code lengths are respectively set into different groups, and the scanning method and grouping method are transmitted to the decoding device through the code stream, and the coefficient groups determined by the decoding device according to the scanning method and grouping method use the fixed-length code of the same code length to ensure the consistency of encoding and decoding, thereby ensuring the accuracy of encoding and decoding.
  • the coefficient group information includes a code length threshold and a coefficient additional value of each coefficient group. If the corresponding code length of the coefficient group is greater than the code length threshold of the coefficient group, after obtaining the coefficient value through fixed-length decoding, it further includes: adding the coefficient value to the coefficient additional value of the coefficient group to obtain the coefficient value of the coefficient group.
  • the decoding device determines whether the coefficient group subtracts the same coefficient added value from all coefficient values in the coefficient group during encoding based on the code length threshold, and can add the coefficient added value after decoding the value in the coefficient group at the decoding end to restore the coefficient value in the coefficient group.
  • the coefficient group information may also include the coefficient compensation value of each coefficient group.
  • the coefficient compensation value is used to compensate the extreme value in the coefficient group.
  • the method further includes: adding the absolute extremum in the coefficient values to the coefficient compensation value to obtain the coefficient value at the position of the absolute extremum in the coefficient group. The resolution range of the sum of extremum plus coefficient compensation value is obtained through shorter coding length, thereby improving coding and decoding efficiency.
  • the coefficient group is divided into a plurality of coefficient blocks, and the coefficient compensation value of each coefficient group includes the coefficient compensation values of all coefficient blocks in the coefficient group.
  • the method further includes: adding the absolute extremum in each coefficient block to the coefficient compensation value of the same coefficient block to obtain the coefficient value of the absolute extremum position of each coefficient block.
  • the coefficient compensation value can compensate the extremum in each coefficient block, further improving the coding efficiency.
  • an embodiment of the present application provides a coefficient decoding device, including an analysis module and a decoding module, wherein the analysis module is used to analyze the code stream to obtain coefficient group information of the unit to be decoded, the coefficients of the unit to be decoded are divided into one or more coefficient groups, each coefficient group includes at least one coefficient code, the coefficient codes in the same coefficient group are fixed-length codes with the same code length, at least one coefficient group includes a first coefficient group, and the coefficient group information includes boundary symbols of the first coefficient group.
  • the decoding module is used to parse the coefficient codes of the first coefficient group into coefficient values, and is also used to determine whether the coefficient values in the first coefficient group are positive or negative according to the boundary sign.
  • an embodiment of the present application provides an image decoder, where the image decoder is configured to perform the coefficient decoding method described in any one of the first aspect and its possible implementation manners.
  • an embodiment of the present application provides an electronic device, including the image decoder, communication interface, and memory described in the third aspect; the image decoder is used to execute the coefficient decoding method described in any one of the first aspect and its possible implementations.
  • the embodiment of the present application provides a computer-readable storage medium, including computer instructions, which, when the computer instructions are run on the electronic device, cause the electronic device to execute the coefficient decoding method described in any one of the above-mentioned first aspect and its possible implementations.
  • an embodiment of the present application provides a computer program product, which executes the coefficient decoding method described in any one of the first aspect and possible implementations thereof when the computer program product is run on a computer.
  • the embodiment of the present application provides a device, including a memory and a processor.
  • Memory is used to store computer instructions.
  • the processor is configured to call and execute the computer instruction from the memory, so that the electronic device executes the coefficient decoding method described in any one of the first aspect and possible implementations thereof.
  • an embodiment of the present application provides an image encoding and decoding system, including an image encoding device and an image decoding device.
  • the image decoding device is configured to receive an image code stream from the image encoding device, and execute the coefficient decoding method described in any one of the first aspect and its possible implementation manners to perform coefficient decoding on the image code stream, perform image reconstruction according to the coefficient decoding result, and obtain a decoded image.
  • FIG. 1 is a schematic diagram of the architecture of a codec system provided by an embodiment of the present application
  • FIG. 2 is a schematic block diagram of an encoder provided in an embodiment of the present application.
  • FIG. 3 is a schematic block diagram of a decoder provided in an embodiment of the present application.
  • FIG. 4 is a schematic flow diagram of an encoding/decoding process provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a coefficient encoding method provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a coefficient decoding method provided by an embodiment of the present application.
  • FIG. 7 is one of the schematic diagrams of a scanning mode provided by the embodiment of the present application.
  • FIG. 8 is one of the schematic diagrams of a grouping method provided by the embodiment of the present application.
  • Fig. 9 is the second schematic diagram of a scanning mode provided by the embodiment of the present application.
  • Figure 10 is the second schematic diagram of a grouping method provided by the embodiment of the present application.
  • FIG. 11 is one of the schematic diagrams of scanning and grouping methods provided by the embodiment of the present application.
  • FIG. 12 is the second schematic diagram of a scanning and grouping method provided by the embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of a coefficient decoding device provided by an embodiment of the present application.
  • FIG. 14 is a hardware structural diagram of an electronic device provided by an embodiment of the present application.
  • first and second in the description and claims of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order of objects.
  • first prediction mode and the second prediction mode are used to distinguish different prediction modes, rather than describing a specific order of the prediction modes.
  • words such as “exemplary” or “for example” are used as examples, illustrations or illustrations. Any embodiment or design scheme described as “exemplary” or “for example” in the embodiments of the present application shall not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Rather, the use of words such as “exemplary” or “such as” is intended to present related concepts in a concrete manner.
  • multiple prediction units refer to two or more multiple prediction units
  • multiple coding blocks refer to two or more coding blocks.
  • the coefficient decoding method provided in the embodiment of the present application can also be used for video decoding, image decoding, etc. It should be understood that as long as there is a coding method for semi-fixed-length coding of the predicted value, residual value or coefficient value, the coefficient decoding method provided in the present application is applicable.
  • the image is first converted from RGB (Red-Green-Blue) format to YUV (Y represents brightness, U and V represent chroma) format. Then sample the image in YUV format according to a certain sampling format, and divide the image into multiple data blocks. Among them, the three components (Y, U, V) of each point in the source image appear alternately. First, separate these three components and store them in three tables.
  • DCT discrete cosine transform
  • encoding may include binarization and entropy encoding steps.
  • binarization is also called binarization.
  • the symbols or coefficients that need to be encoded are binarized, and the binarized symbols or coefficients are converted into binary strings. Different binarization methods encode the same coefficients.
  • the binary strings obtained may have different binary probability models and different string lengths.
  • Entropy coding refers to a lossless coding method based on the principle of information entropy, which converts a series of element symbols used to represent image sequences into a binary code stream for transmission or storage.
  • the output data after entropy coding is the final code stream after compression of the original image.
  • the DCT transform is to transform the image from the time domain signal to the frequency domain.
  • the dynamic range of image coding can be reduced on the basis of the transform module by zeroing the high-frequency coefficients through quantization. Remove the transform coefficients in the high-frequency region, reduce the overhead of the code rate, and will not cause great distortion.
  • the residual value is composed into a residual block, and the transformed and quantized coefficients of the residual block are called transformation coefficients.
  • encoding when encoding, the image is sequentially subjected to color gamut conversion, sampling, DCT transformation, quantization, and encoding.
  • decoding it is necessary to sequentially decode, dequantize, and inverse discrete cosine transform the received code stream, and then arrange the results of the inverse discrete cosine transform in reverse sampling order, and finally convert the image data from YUV format back to RGB format.
  • the quantized data of a data block includes (-4, -4, -3, -2, -1, 0, 1, 2, 3, 7), it can be divided into (-1, 0, 1), (-3, -2, 2, 3), (-4, -4, 7).
  • (-1,0,1) the code length corresponding to the code length encoding is 2
  • the code length corresponding to the code length encoding of (-3,-2,2,3) is 3
  • the code length corresponding to the code length encoding of (-4,-4,7) is 4
  • the length is 3, and then use the code length of 1 to encode the symbol of each data or use the code length of 1 to encode the symbol of each non-zero data.
  • the existing semi-fixed-length coding performs fixed-length fixed-length code grouping on the quantized data in the group.
  • lossless coding can be performed to a certain extent, when there is an extreme value of the analysis range of the fixed-length code of the code length in the group corresponding to a certain code length, it is necessary to increase the entire code length of the coefficient group. Therefore, such a code length is still relatively large.
  • the embodiment of the present application provides a coefficient decoding method.
  • FIG. 1 a schematic diagram of an architecture of a coding and decoding system (also referred to as a coding and decoding system) 10 applied in the embodiment of the present application is shown.
  • a codec system 10 may include a source device 11 and a destination device 12.
  • the source device 11 is used to encode images. Therefore, the source device 11 may be called a video encoding device.
  • the destination device 12 is used to decode the encoded image data generated by the source device 11, therefore, the destination device 12 may be referred to as a video decoding device.
  • Source device 11 and destination device 12 may include a variety of devices including, for example, desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, cell phones, televisions, cameras, display devices, digital media players, video game consoles, vehicle-mounted computers, wireless communication devices, and the like.
  • the source device 11 and the destination device 12 in FIG. 1 may be two separate devices, or the source device 11 and the destination device 12 are the same device, that is, the source device 11 or the corresponding function and the destination device 12 or the corresponding function may be integrated on the same device.
  • destination device 12 may receive encoded image data from source device 11 .
  • destination device 12 may include one or more communication media over which the encoded image data is transmitted, which may include routers, switches, base stations, or other devices that facilitate communication from source device 11 to destination device 12.
  • the source device 11 includes an encoder 112 , and in an example, the source device 11 may further include an image preprocessor 111 and a communication interface 113 .
  • the image preprocessor 111 is configured to perform preprocessing on the received image to be encoded.
  • the preprocessing performed by the image preprocessor 111 may include trimming, color format conversion (for example, from RGB format to YUV format), color correction or denoising, etc.
  • the encoder 112 is configured to receive the preprocessed image, and process the preprocessed image by using a relevant prediction mode (such as the prediction mode in each embodiment herein), so as to provide coded image data.
  • the encoder 112 may be used to perform image encoding processes in various embodiments described below.
  • the communication interface 113 can be used to transmit the encoded image data to the destination device 12 or any other device (such as a memory) for storage or direct reconstruction.
  • the other device can be any device for decoding or storage.
  • the communication interface 113 may also encapsulate the encoded image data into a suitable format before transmitting it.
  • the image preprocessor 111, the encoder 112, and the communication interface 113 may be hardware components in the source device 11, or may be software programs in the source device 11, which are not limited in this embodiment of the present application.
  • the destination device 12 includes a decoder 122 , and in an example, the destination device 12 may further include a communication interface 121 and an image post-processor 123 .
  • the communication interface 121 may be used to receive encoded image data from the source device 11 or any other source device, such as a storage device.
  • the communication interface 121 may also decapsulate the data transmitted by the communication interface 113 to obtain encoded image data.
  • the decoder 122 is configured to receive encoded image data and output decoded image data (also referred to as reconstructed image data or reconstructed image data).
  • the decoder 122 may be configured to perform coefficient decoding processes described in various embodiments described below.
  • the image post-processor 123 is configured to perform post-processing on the decoded image data to obtain post-processed image data.
  • the post-processing performed by the image post-processor 123 may include: color format conversion (for example, from YUV format to RGB format), color correction, trimming or resampling, or any other processing, and may also be used to transmit the post-processed image data to a display device for display.
  • the above-mentioned communication interface 121, decoder 122, and image post-processor 123 may be hardware components in the destination device 12, or may be software programs in the destination device 12, which is not limited in this embodiment of the present application.
  • FIG. 2 shows a schematic block diagram of an example of an encoder 20 for implementing an embodiment of the present application.
  • the encoder includes a prediction processing unit 201 , a residual calculation unit 202 , a transformation processing unit 203 , a quantization unit 204 , and an encoding unit 205 .
  • the encoder further includes an inverse quantization unit (also called an inverse quantization unit), an inverse transform processing unit (also called an inverse transform processing unit), a reconstruction unit (or called a reconstruction unit) and a filter unit.
  • an inverse quantization unit also called an inverse quantization unit
  • an inverse transform processing unit also called an inverse transform processing unit
  • a reconstruction unit or called a reconstruction unit
  • the encoder 20 may further include a buffer and a decoded image buffer, wherein the buffer is used for buffering the reconstructed image block output by the reconstruction unit, and the decoded image buffer is used for buffering the filtered image block output by the filter unit.
  • the input of the encoder 20 is an image block of an image (which may be referred to as an image to be encoded), and the image block may also be referred to as a current image block or an image block to be encoded.
  • the encoder 20 may also include a segmentation unit (not shown in FIG. 2 ), which is used to segment the image to be encoded into a plurality of image blocks.
  • the encoder 20 is used for block-by-block encoding to complete the encoding of the image to be encoded, for example, to perform an encoding process on each image block.
  • the prediction processing unit 201 is configured to receive or acquire an image block (the current image block to be encoded of the current image to be encoded can also be referred to as the current image block, which can be understood as the real value of the image block) and reconstructed image data, predict the current image block based on the relevant data in the reconstructed image data, and obtain the predicted block of the current image block.
  • an image block the current image block to be encoded of the current image to be encoded can also be referred to as the current image block, which can be understood as the real value of the image block
  • the current image block which can be understood as the real value of the image block
  • the residual calculation unit 202 is used to calculate the residual between the real value of the image block and the prediction block of the image block to obtain the residual block, for example, by subtracting the pixel value of the image block from the pixel value of the prediction block pixel by pixel.
  • the transform processing unit 203 is configured to perform coefficient transform such as discrete cosine transform and discrete sine transform (Discrete Sine Transform, DST) on the residual block, so as to obtain transform coefficients in the transform domain. It should be understood that, in this embodiment, the transform processing unit 203 may perform coefficient transform on the residual block, and may not perform coefficient transform on the residual block when the coding efficiency difference between the residual block and the transform coefficient is small.
  • coefficient transform such as discrete cosine transform and discrete sine transform (Discrete Sine Transform, DST)
  • the quantization unit 204 is used to quantize the transform coefficients by applying scalar quantization or vector quantization to obtain quantized transform coefficients, which may also be referred to as quantized residual coefficients.
  • the quantization process can reduce the bit depth associated with some or all of the transform coefficients. For example, n-bit transform coefficients may be rounded down to m-bit transform coefficients during quantization, where n is greater than m.
  • the degree of quantization can be modified by adjusting the quantization parameter (Quantization Parameter, QP). For example, with scalar quantization, different scales can be applied to achieve finer or coarser quantization. Smaller quantization steps correspond to finer quantization, while larger quantization steps correspond to coarser quantization. An appropriate quantization step size can be indicated by a quantization parameter.
  • the encoding unit 205 is used to encode the above-mentioned quantized residual coefficients or transform coefficients, and then encode and arrange the coefficients into units to be decoded in a scanning manner and in a grouping manner, and output encoded image data in the form of encoded bit streams (that is, units to be decoded), and then transmit the encoded bit streams to the decoder, or store them, and then transmit them to the decoder or use them for retrieval.
  • the encoding unit 205 can also be used to encode other syntax elements of the current image block, such as encoding the prediction mode into a code stream and the like.
  • one of unary codes, truncated unary codes, truncated binary codes, fixed-length coding, semi-fixed-length coding, run-length coding, k-order exponential Golomb coding, truncated Rice coding, Golomb-Rice coding, Huffman coding, arithmetic coding, adaptive variable-length coding, etc. can be used to code the coefficients.
  • the encoder 20 is used to implement the image encoding method described in the following embodiments.
  • FIG. 3 shows a schematic block diagram of an example of a decoder 30 for implementing the embodiment of the present application.
  • the decoder 30 is configured to receive encoded image data (ie, an encoded bitstream, eg, an encoded bitstream including image blocks and associated syntax elements) encoded by the encoder 20 to obtain a decoded image.
  • the decoder 30 includes a decoding unit 301 , an inverse quantization unit 302 , an inverse transform processing unit 303 , a prediction processing unit 304 , a reconstruction unit 305 , and a filter unit 306 .
  • decoder 30 may perform a decoding pass that is substantially the inverse of the encoding pass described for encoder 20 of FIG. 2 .
  • the decoder 30 may further include a buffer and a decoded image buffer, wherein the buffer is used for buffering the reconstructed image block output by the reconstruction unit 305 , and the decoded image buffer is used for buffering the filtered image block output by the filter unit 306 .
  • the decoding unit 301 is configured to perform decoding on encoded image data to obtain quantized coefficients (such as residual coefficients or transform coefficients).
  • the decoding unit 301 is further configured to forward the decoded encoding parameters to the prediction processing unit 304 for the prediction processing unit to perform a prediction process according to the encoding parameters.
  • the inverse quantization unit 302 is configured to perform inverse quantization on the above quantized coefficients to obtain the inverse quantized coefficients.
  • the inverse quantization is the reverse application of the above quantization unit 204, for example, based on or using the same quantization step size as the quantization unit 204, the inverse quantization scheme of the quantization scheme applied by the quantization unit 204 is applied.
  • Inverse quantized coefficients may also be referred to as inverse quantized residual coefficients or quantized transform coefficients.
  • the inverse transform processing unit 303 is configured to perform inverse transform on the above-mentioned inverse quantization coefficients. It should be understood that the inverse transform is the reverse application of the above-mentioned transform processing unit 203.
  • the inverse transform may include inverse discrete cosine transform or inverse discrete sine transform to obtain an inverse transform block in the pixel domain (or called the sample domain).
  • An inverse transform block may also be called an inverse transform inverse quantized block or an inverse transform residual block.
  • the reconstruction unit 305 (such as a summer) is used to perform inverse transformation (for example, inverse DCT, inverse integer transformation, or conceptually similar inverse transformation process) on the above-mentioned quantized coefficients to obtain an inverse transformation block (also called an inverse transformation residual block), and the inverse transformation block is the residual block of the current image block in the pixel domain.
  • inverse transformation for example, inverse DCT, inverse integer transformation, or conceptually similar inverse transformation process
  • the prediction processing unit 304 is configured to receive or obtain coded image data (such as the coded bitstream of the current image block) and reconstructed image data.
  • the prediction processing unit 301 may also receive or obtain prediction related parameters and/or information about the selected prediction mode (that is, decoded coding parameters) from, for example, the decoding unit 302, and predict the current image block based on the relevant data in the reconstructed image data and the decoded coding parameters to obtain a prediction block of the current image block.
  • the reconstruction unit 305 is used to add an inverse transform block (ie, an inverse transform residual block) to a prediction block to obtain a reconstructed block in the sample domain, for example, adding sample values of the inverse transform residual block to sample values of the prediction block.
  • an inverse transform block ie, an inverse transform residual block
  • the filter unit 306 is configured to filter the reconstructed block to obtain a filtered block, which is a decoded image block.
  • the decoding unit 301 is configured to implement the coefficient decoding method described in the following embodiments.
  • the processing result for a certain link may be further processed and then output to the next link.
  • this embodiment of the present application provides a possible encoding/decoding implementation, as shown in FIG. 4 , which is a schematic flowchart of an encoding/decoding provided by the embodiment of the present application.
  • the encoding/decoding implementation includes process 1 to process 5, and process 1 to process 5 can be executed by any one or more of the above-mentioned source device 11, decoder 20, destination device 12 or decoder 30.
  • Process 1 Divide a frame of image into one or more non-overlapping parallel coding units. There is no dependency between the one or more parallel encoding units, and they can be completely parallel/independently encoded and decoded, as shown in FIG. 4 , the parallel encoding unit 1 and the parallel encoding unit 2 .
  • each parallel coding unit it can be divided into one or more independent coding units that do not overlap with each other.
  • Each independent coding unit can be independent of each other, but can share some parallel coding unit header information.
  • an independent coding unit has a width of w_lcu and a height of h_lcu. If the parallel coding unit is divided into an independent coding unit, the size of the independent coding unit is exactly the same as that of the parallel coding unit; otherwise, the width of the independent coding unit should be larger than the height (except for the edge area).
  • the independent coding unit may be fixed w_lcu ⁇ h_lcu, both w_lcu and h_lcu are 2 to the Nth power (N ⁇ 0), for example, the size of the independent coding unit is: 128 ⁇ 4, 64 ⁇ 4, 32 ⁇ 4, 16 ⁇ 4, 8 ⁇ 4, 32 ⁇ 2, 16 ⁇ 2 or 8 ⁇ 2, etc.
  • the independent coding unit may be a fixed 128 ⁇ 4. If the size of the parallel coding unit is 256 ⁇ 8, the parallel coding unit can be equally divided into 4 independent coding units; if the size of the parallel coding unit is 288 ⁇ 10, the parallel coding unit is divided into: the first/second row is two 128 ⁇ 4+1 32 ⁇ 4 independent coding units; the third row is 2 128 ⁇ 2+1 32 ⁇ 2 independent coding units.
  • an independent coding unit may include three components of luma Y, chroma Cb, and chroma Cr, or three components of red (R), green (G), and blue (B), or only one of them. If the independent coding unit includes three components, the sizes of the three components may be exactly the same or different, which is specifically related to the input format of the image.
  • each independent coding unit it can be divided into one or more non-overlapping coding units.
  • Each coding unit in an independent coding unit can depend on each other. For example, multiple coding units can perform mutual reference precoding and decoding.
  • the size of the coding unit is the same as that of the independent coding unit (that is, the independent coding unit is only divided into one coding unit), then its size can be all the sizes described in process 2.
  • the feasible division examples include: horizontal equal division (the height of the coding unit is the same as that of the independent coding unit, but the width is different, which can be 1/2, 1/4, 1/8, 1/16, etc.), vertical equal division (the width of the coding unit is the same as that of the independent coding unit, but the height is different, which can be 1/2, 1/4, 1/8, 1/16, etc.), horizontal and vertical equal division (quadtree division), etc., preferably horizontal equal division.
  • the width of the coding unit is w_cu, and the height is h_cu, so its width should be greater than its height (unless it is an edge area).
  • the coding unit can be a fixed w_cu ⁇ h_cu, both w_cu and h_cu are 2 to the Nth power (N is greater than or equal to 0), such as 16 ⁇ 4, 8 ⁇ 4, 16 ⁇ 2, 8 ⁇ 2, 8 ⁇ 1, 4 ⁇ 1 and so on.
  • the coding unit may be a fixed 16 ⁇ 4. If the size of the independent coding unit is 64 ⁇ 4, the independent coding unit can be equally divided into 4 coding units; if the size of the independent coding unit is 72 ⁇ 4, the coding unit can be divided into four 16 ⁇ 4+1 8 ⁇ 4.
  • the coding unit may include three components of luma Y, chroma Cb, and chroma Cr (or three components of red R, green G, and blue B), or only one of them. If it contains three components, the sizes of several components can be exactly the same or different, depending on the image input format.
  • process 3 is an optional step in the encoding and decoding method, and the encoder/decoder can encode/decode the residual coefficients (or transformation coefficients) of the independent coding units obtained in the process 2.
  • PG Prediction Group
  • PG can also be referred to as Group for short.
  • Each PG is encoded and decoded according to the selected prediction mode to obtain the predicted value of PG, which forms the predicted value of the entire coding unit. Based on the predicted value and the original value of the coding unit, the residual value of the coding unit is obtained.
  • the coding units are grouped by the selected scanning method, which may include, but not limited to, any one or more of the following: raster scanning, block scanning, horizontal scanning, vertical scanning, round-trip (horizontal/vertical) scanning, diagonal (upper left, upper right, lower left, lower right) scanning, inverse diagonal scanning, inverse horizontal scanning, inverse vertical scanning, or scanning based on a fixed scanning template.
  • Process 5 Based on the residual value of the coding unit, the coding unit is grouped to obtain one or more non-overlapping residual blocks (Residual Block, RB).
  • the residual coefficients or transformation coefficients of each RB are encoded and decoded according to the selected mode to form a residual coefficient stream or a transformation coefficient stream.
  • the selection mode of the encoding and decoding method of the residual coefficient or transform coefficient in the above process 5 may include, but not limited to, any one or more of the following: unary code, truncated unary code, truncated binary code, fixed-length coding, semi-fixed-length coding, run-length coding, k-order exponential Golomb coding, truncated Rice coding, Golomb-Rice coding, Huffman coding, arithmetic coding, adaptive variable-length coding, etc.
  • an encoder may directly encode coefficients within an RB.
  • the encoder may also perform transformation on the residual block, such as DCT, DST, Hadamard transformation, etc., and then encode the transformed coefficients.
  • transformation such as DCT, DST, Hadamard transformation, etc.
  • the encoder can directly uniformly quantize each coefficient in the RB, and then perform binarization encoding. If the RB is large, it can be further divided into multiple coefficient groups (Coefficient Group, CG), and then each CG is uniformly quantized, and then binarized and encoded. In some embodiments of the present application, the coefficient set and the quantization set may be the same.
  • the maximum value of the absolute value of the residual within an RB block is defined as the modified maximum value (mm).
  • the number of coded bits of the residual coefficient in the RB block is determined (the number of coded bits of the residual coefficient in the same RB block is the same). For example, if the critical limit (Critical Limit, CL) of the current RB block is 2 and the current residual coefficient is 1, then 2 bits are required to encode the residual coefficient 1, which can be expressed as 01. If the CL of the current RB block is 7, it means encoding 7-bit residual coefficient and 1-bit sign bit.
  • CL Critical Limit
  • the determination of CL is to find the minimum coding length value that satisfies all the residuals of the current sub-block within the range of [-2 ⁇ (coding length-1)-1, 2 ⁇ (coding length-1)] and the boundary value.
  • the boundary value can be -2 ⁇ (coding length-1) or 2 ⁇ (coding length-1).
  • a boundary symbol code in the code stream, that is, it is necessary to determine the positive or negative of the coefficient value 2 ⁇ (coding length-1) in the current RB block according to the boundary symbol represented by the boundary symbol code; If there is a coefficient value with an absolute value of 2 ⁇ (coding length-1) in the coefficient group, a boundary symbol code can be used to represent the sign of all coefficients in the coefficient group.
  • the encoder can also directly encode the original value of the image instead of the residual value.
  • the prediction unit in the embodiment of the present application may be a coding unit obtained through the above process 3, or may be a prediction group after the coding unit is further divided.
  • the embodiment of the present application provides a coefficient encoding method, which can be applied to the encoding unit 205.
  • the coefficient encoding method may include S501-S504.
  • the encoding unit 205 determines a scanning mode and an optimal grouping mode of units to be encoded.
  • the scanning mode and grouping mode of the units to be encoded can be obtained according to the agreement between the encoding unit 205 and the decoding unit 301 in codec consistency.
  • the optimal grouping method can be determined according to the coding cost of each grouping method.
  • the encoding cost can be calculated by using rate distortion optimization (Rate Distortion Optimization), minimizing rate distortion cost (Rate Distortion Cost) and other methods.
  • the grouping method with the least coding cost is the optimal grouping method, that is, the codes with high frequency should be as short as possible, and the codes with low frequency should be longer.
  • the optimal grouping method can be obtained according to the agreement between the coding unit 205 and the decoding unit 301 in codec consistency, or the decoding unit 301 derives it according to the context (derived from the coded data, residual coefficient or coded parameters), or the coding unit 205 obtains it by passing parameters.
  • the encoding unit 205 divides the unit to be encoded into multiple coefficient groups according to an optimal grouping manner.
  • the above-mentioned scanning method can choose any of the scanning methods listed in the process 5 of the encoding/decoding implementation method provided above, and will not be repeated here.
  • the encoding unit 205 determines the coefficient group information of each coefficient group.
  • the coefficient group information may include a code length, a boundary symbol, and an image bit width corresponding to the coefficient group, and the code length corresponding to the coefficient group is used to indicate that the coefficient codes in the coefficient group are encoded by fixed-length coding of the code length.
  • the image bit width (bit_depth) represents the maximum bit of the original data or reconstructed data, and according to the code length and image bit width corresponding to a coefficient group, it can be judged whether there are coefficient values in the coefficient group that exceed the range of fixed-length coded values of the code length. If there is no coefficient value exceeding the range of fixed-length coded values of the code length in the coefficient group, it is not necessary to set a boundary symbol for the coefficient group, that is, the coding range of the coefficient group is [0,2 ⁇ bit_depth-1].
  • the coefficient group can use the same boundary symbol to indicate that all coefficient values in the coefficient group are simultaneously positive or negative, that is, the coefficient group shares a boundary symbol.
  • the absolute value in the coefficient group is equal to the absolute extreme value, that is, the coefficient values equal to 2 ⁇ (coding length-1) can use the same boundary symbol to indicate that these coefficient values are positive or negative at the same time, that is, the coefficient values with an absolute value equal to 2 ⁇ (coding length-1) share a boundary symbol.
  • the encoding unit 205 For each coefficient group, the encoding unit 205 encodes the coefficient value, code length, boundary symbol, and image bit width of the coefficient group according to the fixed-length encoding corresponding to the code length of the coefficient group, and obtains the coefficient fixed-length encoding and coefficient group information.
  • the encoding unit 205 transmits the code stream to the decoding unit 301 .
  • the embodiment of the present application provides a coefficient decoding method, which is applied to the decoding unit 301.
  • the coefficient decoding method may include S601-S603.
  • the decoding unit 301 parses the code stream to obtain information about units to be decoded and coefficient groups.
  • the unit to be decoded includes at least one coefficient group, each coefficient group includes at least one coefficient fixed-length code, the coefficient group information includes the boundary symbol of each coefficient group, and the coefficient codes in each coefficient group are decoded using the fixed-length code with the same code length.
  • the code stream can be analyzed to obtain the scanning mode and grouping mode corresponding to the unit to be decoded, and the unit to be decoded is scanned according to the scanning mode to obtain a scanning result.
  • the scanning result divides the unit to be decoded into at least one prediction group.
  • the scanning result is divided into at least one coefficient group, and a first coefficient group is selected therefrom.
  • the coefficient group needs to be extracted from the unit to be decoded.
  • the code stream can be analyzed to obtain the grouping mode corresponding to the unit to be decoded, and the prediction mode of the current coding unit can be obtained from the code stream.
  • a scanning mode is derived, and the unit to be decoded is scanned according to the scanning mode to obtain a scanning result.
  • the scanning result divides the unit to be decoded into at least one prediction group.
  • the scanning result is divided into at least one coefficient group, and a first coefficient group is selected therefrom.
  • fixed-length encodings with different code lengths may be selected to analyze the coefficient codes. If the code length is greater than or equal to the image bit width, a fixed-length code whose length is equal to the image bit width is used to parse the coefficient codes of the first coefficient group into coefficient values. If the code length is smaller than the image bit width, the coefficient codes of the first coefficient group are parsed into coefficient values by using fixed-length coding of the code length.
  • the code length, boundary symbol and image bit width of the above first coefficient group can all be obtained from the coefficient group information, and the coefficient group information transmitted from the code stream can be in the form of fixed-length coding, namely code length code, boundary symbol code and image bit width code.
  • the decoding unit 301 analyzes the code length code, boundary symbol code and image bit width code of the first coefficient group by using a fixed-length coding decoding method or other decoding methods to obtain the code length, boundary symbol code and image bit width of the first coefficient group.
  • a run-length encoding method may also be introduced to analyze the continuous 0 values in the coefficient group.
  • the specific analysis method is the same as the existing run-length encoding method, and will not be repeated here.
  • a method of skipping coefficients can also be introduced. For example, if the mode of skipping coefficients is analyzed from the code stream, the entire group does not need to encode any coefficients, and the reconstruction value of the decoding unit 301 is directly equal to the predicted value.
  • S603 Determine whether the coefficient values in the first coefficient group are positive or negative according to the boundary sign.
  • the resolution range of the fixed-length coding of the first coefficient group whose length is equal to the bit width of the image is [0,2 ⁇ bit_depth-1].
  • the resolution range of the fixed-length coding corresponding to the code length of the first coefficient group and the boundary symbols is [-2 ⁇ (coding length-1)-1,2 ⁇ (coding length-1)].
  • the first coefficient group can share a boundary symbol, and the boundary symbol indicates the positive or negative of all coefficient values in the first coefficient group.
  • these coefficients are coefficients lying on the border, the sign of which can be determined by the sign of the border.
  • these coefficients can share a boundary symbol, that is, the sign of the coefficient whose absolute value is equal to 2 ⁇ (coding length-1) is represented by the boundary symbol.
  • the embodiment of the present application changes the analytical range of the coefficient value of the semi-fixed-length coding from [0,2 ⁇ bit_depth-1] to [-2 ⁇ (coding length-1)-1,2 ⁇ (coding length-1)] under the condition of introducing boundary symbols, which further shortens the overall coding length and improves the coding and decoding efficiency.
  • the first coefficient group can be further divided into a plurality of coefficient blocks, and coefficient codes in different coefficient blocks cannot share one boundary symbol, then there can be multiple boundary symbols in the code stream data, that is, the code stream includes a boundary symbol corresponding to each coefficient block, and each coefficient block shares a boundary symbol.
  • the S603 analysis boundary sign code represents negative, then the absolute value of the analysis value in this coefficient block is equal to 2 ⁇ (coding length-1) and the coefficient value is -2 ⁇ (coding length-1), if the S603 analysis boundary sign code represents positive, then the absolute value of the analysis value in this coefficient block is equal to 2 ⁇ (coding length-1) and the coefficient value is 2 ⁇ (coding length-1).
  • the parsed value of the boundary sign code may be 0 for negative or 1 for positive, or 0 for positive and 1 for negative, and the boundary sign code is represented by one bit.
  • the coefficient decoding method provided in this embodiment can not only analyze the encoding of transform coefficients or residual coefficients, but also analyze the encoding of original pixel values according to the analysis steps without introducing boundary symbols.
  • An embodiment of the present application provides a coefficient decoding method applied to residual coefficients in a point-by-point prediction mode, which is applied to the decoding unit 301 .
  • the scanning method can be point-by-point prediction mode 1 shown in (a) in Figure 7, point-by-point prediction mode 2 shown in (b), point-by-point prediction mode 3 shown in (c), point-by-point prediction mode 4 shown in (d), etc.
  • Group 1 (Group1) and Group 2 (Group2) indicate that they are different.
  • both Group1 and Group2 adopt the scanning order of vertical direction priority, that is, the scanning order is from top to bottom and then from left to right.
  • Group1 and Group2 successively adopt horizontal direction priority, that is, from left to right.
  • Group1 and Group2 adopt a scanning order from left to right and then from top to bottom.
  • both Group1 and Group2 adopt a vertical-first scanning order, that is, a scanning order from top to bottom and then from left to right.
  • each cell represents a coefficient fixed-length code, and different gray values represent different coefficient groups.
  • Figure 8(a) shows that when the coding index is 0, the entire prediction group is regarded as a 16*1 coefficient group. It means that when the coding index is 101, a prediction group is divided into an 8*1 coefficient group and two 4*1 coefficient groups in turn.
  • Figure 8(d) shows that when the coding index is 110, a prediction group is divided into two 4*1 coefficient groups and an 8*1 coefficient group in turn.
  • Step S602 will be described for the residual coefficient obtained by predicting the chroma Cb and chroma Cr in the point-by-point prediction mode.
  • the scanning mode is scanning in the horizontal direction, i.e. scanning from left to right progressively.
  • each small cell represents a coefficient fixed-length code, and different gray values represent different prediction groups.
  • the first four cells in the first row, the last four cells in the first row, the first four cells in the second row, and the last four cells in the second row are different gray levels.
  • each small grid represents a coefficient fixed coding. Different gray values represent different coefficient arrays. In the case of 1, a prediction group is divided into two 4*1 coefficients in turn. Among them, the first four and the rear four grids are different gray.
  • the decoding unit 301 determines the code length corresponding to the coefficient group, which may be to first use the fixed-length coding decoding method to analyze the code length code corresponding to the coefficient group to obtain the code length coding length.
  • a mixed method of fixed-length coding and truncated unary code or other coding may also be used for parsing.
  • the decoding unit 301 analyzes the coefficient codes one by one according to the fixed-length code corresponding to the coding length. If the coding length corresponding to the coefficient group is greater than or equal to the image bit width of the coefficient group, use the fixed-length code corresponding to the code length of the image bit width to analyze the coefficient code, and the resolution range is [0,2 ⁇ bit_depth-1]. If the coding length corresponding to the coefficient group is smaller than the image bit width of the coefficient group, use the fixed-length coding corresponding to the coding length to analyze the coefficient code.
  • the decoding unit 301 determines whether the coefficient value in the coefficient group is positive or negative according to the boundary sign, so that the analytical range of the coefficient value is [-2 ⁇ (coding length-1)-1, 2 ⁇ (coding length-1)]. If there is a coefficient value whose absolute value is equal to 2 ⁇ (coding length-1) in the coefficient group, then all coefficient values in the coefficient group have a common boundary sign.
  • these coefficients when there are absolute extremums in the coefficient group, that is, when there are coefficients whose absolute value is equal to 2 ⁇ (coding length-1) in the coefficient group, these coefficients can share a boundary sign, that is, the boundary sign indicates that the signs of the coefficients whose absolute value is equal to 2 ⁇ (coding length-1) are all positive or all negative.
  • the embodiment of the present application improves the applicability of coefficient decoding by flexibly grouping luma and chrominance coefficients in different ways, and introduces boundary symbols to indicate the sign of the analytical extreme value of the fixed-length coding corresponding to the code length of the coefficient group, which improves the encoding and decoding efficiency.
  • the scanning method and grouping method take into account the distribution of data, so that coefficients with similar amplitudes are distributed in adjacent areas, so that the correlation between each coefficient value of the divided coefficient group is preserved, and the decoding accuracy is improved.
  • the embodiment of the present application also provides a coefficient decoding method applied to residual coefficients in a non-point-by-point prediction mode, which is applied to the decoding unit 301 .
  • the scanning order can be shown in the direction of the arrows in (a) and (b) in Figure 11, and the division of coefficient groups can be shown in different gray levels in (a) and (b) in Figure 10, and each gray level represents the same coefficient group.
  • the method of determining the code length corresponding to the coefficient group can be obtained by analyzing the code length code corresponding to the coefficient group by using Huffman coding.
  • the decoding unit 301 uses the fixed-length code corresponding to the code length of the image bit width to analyze the coefficient code, and the analysis range is [0, 2 ⁇ bit_depth-1]. If the coding length corresponding to the coefficient group is smaller than the image bit width of the coefficient group, use the fixed-length code corresponding to the coding length to analyze the coefficient code.
  • the decoding unit 301 uses boundary symbols to determine whether the coefficient values in the coefficient group are positive or negative, so that the analytical range of the coefficient values is [-2 ⁇ (coding length-1)-1, 2 ⁇ (coding length-1)]. If there is a coefficient value whose absolute value is equal to 2 ⁇ (coding length-1) in the coefficient group, a common boundary symbol is encoded for the coefficient group.
  • these coefficients when there are absolute extremums in the coefficient group, that is, when there are coefficients whose absolute value is equal to 2 ⁇ (coding length-1) in the coefficient group, these coefficients can share a boundary sign, that is, the boundary sign indicates that the signs of the coefficients whose absolute value is equal to 2 ⁇ (coding length-1) are all positive or all negative.
  • the embodiment of the present application also provides a coefficient decoding method applied to transform coefficients in non-point-by-point prediction mode, which is applied to the decoding unit 301.
  • the scanning order can be shown in the direction of the arrows in (a) and (b) in Figure 12, and the division of the coefficient groups can be divided into different gray levels in (a) and (b) in Figure 12.
  • Each gray level represents the same coefficient group.
  • the part containing the dot represents the DC coefficient. All DC coefficients are divided into one DC coefficient group, and the part not including the dot is divided into one or more AC coefficients.
  • the method of determining the code length corresponding to the fixed-length coding of the coefficient group may be to use Huffman coding to analyze the coding length corresponding to the AC coefficient group, and to use the fixed-length coding method to analyze the coding length corresponding to the DC coefficient group.
  • the decoding unit 301 uses the fixed-length coding corresponding to the code length of coding length to analyze the coefficient code. In the case that the coding length corresponding to the coefficient group is greater than or equal to 7, use the fixed-length coding corresponding to the image bit width bit_depth+3 to analyze the coefficient code.
  • the decoding unit 301 uses boundary symbols to determine whether the coefficient values in the coefficient group are positive or negative, so that the analytical range of the coefficient values is [-2 ⁇ (coding length-1)-1, 2 ⁇ (coding length-1)]. If there is a coefficient value whose absolute value is equal to 2 ⁇ (coding length-1) in the coefficient group, a common boundary symbol is encoded for the coefficient group.
  • these coefficients when there are absolute extremums in the coefficient group, that is, when there are coefficients whose absolute value is equal to 2 ⁇ (coding length-1) in the coefficient group, these coefficients can share a boundary sign, that is, the boundary sign indicates that the signs of the coefficients whose absolute value is equal to 2 ⁇ (coding length-1) are all positive or all negative.
  • the DC coefficients and AC coefficients in the transformation coefficients are divided into different coefficient groups, and then the coefficient values are encoded, so as to avoid using fixed-length encoding with the same code length for the DC coefficients with relatively low frequencies and the AC coefficients with relatively high frequencies in the same coefficient group, thereby improving the encoding efficiency.
  • the embodiment of the present application also provides a coefficient decoding method, which is applied to the decoding unit 301.
  • the coefficient decoding method adjusts the code length (coding length) of the fixed-length code corresponding to the coefficient value in the coefficient group, and the coefficient values at different positions can be analyzed using fixed-length codes with different code lengths.
  • this coefficient decoding method is only different in the steps of determining the corresponding code length (coding length) of the coefficient group and analyzing the coefficient according to the fixed-length coding corresponding to the coefficient group, and the same parts will not be repeated here.
  • the step of determining the code length corresponding to the coefficient group in S601 may be as follows:
  • the decoding unit 301 analyzes the code length coding length and code length additional value A corresponding to the fixed-length coding of the coefficient group from the code stream.
  • the code length additional value A may be the value A set by the encoding unit 205 for a specific position in the coefficient group where the coefficient value exceeds the average value of the coefficient group when encoding the coefficient value.
  • the decoding unit 301 determines a specific position in the coefficient group.
  • the specific position may be agreed upon by the coding unit 205 and the decoding unit 301 in coding consistency, or may be derived by the coding unit 301 according to the context information. For example, a certain position of the previous unit to be decoded is a specific position, and then it is determined that the corresponding position of the current unit to be decoded is a specific position.
  • the decoding unit 301 determines that the code length corresponding to the fixed-length coding at a specific position in the coefficient group is coding length+A, and the code length corresponding to the fixed-length coding of coefficients other than the specific position is coding length.
  • the step of analyzing the coefficients according to the fixed-length code corresponding to the code length of the coefficient group may be to use the fixed-length code whose code length is coding length+A to analyze the coefficient code at a specific position, and use the fixed-length code whose code length is coding length to analyze other coefficient codes except for the specific position.
  • this embodiment can also perform the following operations when the coding length corresponding to the coefficient group is short.
  • the encoding unit 205 and the decoding unit 301 agree on the code length threshold B through encoding consistency, and carry coefficient value range data C in the code stream.
  • the coefficient value range data C is used to indicate whether the absolute value of the coefficient value is less than 2 ⁇ (coding length-3).
  • the step of determining the code length corresponding to the coefficient group in S601 may include: when the coding length is less than the code length threshold B, the decoding unit 301 determines that the code length corresponding to all the coefficient codes of the coefficient group is the coding length.
  • the decoding unit 301 determines whether the absolute value of each coefficient code is less than 2 ⁇ (coding length-3) according to the coefficient value range data C, and if so, uses the fixed-length code corresponding to the coding length-3 to analyze the coefficient code, and if not, uses the fixed-length code corresponding to the coding length to analyze the coefficient code.
  • this embodiment can also transform the coding length of the coefficient group into k-order Exponential Golomb decoding, for example, the coding unit 205 and the decoding unit 301 agree on the code length threshold D through coding consistency.
  • the step of determining the code length corresponding to the coefficient group in S601 may include: the decoding unit 301 resolves the code length of the coefficient group as coding length by a fixed-length decoding method, and when the coding length is not equal to the preset value E, the code lengths corresponding to all the coefficient codes in the coefficient group are coding length.
  • the preset value E may be 2, 3, etc.
  • the value of N may be greater than 4.
  • the code length of the fixed-length code corresponding to the coefficient code at one or more positions in a coefficient group can be regarded as the coefficient bit code length
  • the code length of the shared fixed-length code corresponding to other positions in the coefficient group can be regarded as the code length of the coefficient group.
  • the fixed-length codes corresponding to different code lengths are used to analyze the different coefficient codes in the coefficient value, and the fixed-length codes with special code lengths can be used to analyze the coefficient codes at a certain position, and the fixed-length codes with shorter code lengths are still used for other positions, which reduces the overall code length and improves the coding efficiency.
  • this embodiment also provides a coefficient decoding method, which is applied to the decoding unit 301, adjusts the coefficient values in the coefficient group during encoding, and restores the coefficient values during decoding, reducing the overall encoding length of the coefficient values.
  • the coefficient decoding method is only different in the step of parsing the coefficients according to the fixed-length code corresponding to the code length of the coefficient group, and the same parts will not be repeated here.
  • the above-mentioned specific position may be agreed upon by the coding unit 205 and the decoding unit 301 in coding consistency, or may be derived by the coding unit 301 according to the context information. For example, a certain position of the previous unit to be decoded is a specific position, and then it is determined that the corresponding position of the current unit to be decoded is a specific position.
  • the coefficient group information obtained by the decoding unit 301 through S601 includes a code length threshold and a coefficient additional value G of the coefficient group.
  • the setting of the code length threshold and the coefficient additional value G will be described below.
  • the encoding unit 205 if the code length of the fixed-length encoding corresponding to a certain coefficient value is greater than the code length threshold of the coefficient group, subtract the coefficient value G from the coefficient value, and encode the result of subtracting the coefficient additional value G from the coefficient value.
  • the code length threshold and coefficient additional value G can be flexibly set according to the specific size of the coefficient value of the coefficient group.
  • the decoding unit 301 In the step of analyzing the coefficients according to the fixed-length coding corresponding to the code length of the coefficient group, if the fixed-length coding length is greater than the code length threshold, the decoding unit 301 first uses the fixed-length coding with the code length to analyze the coding of the added value G of the coefficient to obtain the added value G of the coefficient, and then uses the fixed-length coding with the code length to analyze all the coefficient values in the coefficient group, and adds all the coefficient values to the added value G of the coefficient, thereby restoring the coefficient value.
  • the coefficient values in the coefficient group are adjusted during encoding, and then the coefficients at specific positions in the coefficient group are restored based on the parameters transmitted by the code stream during decoding, so that there is no need to carry a long complete coefficient code during code stream transmission, which improves the coding efficiency.
  • this embodiment also provides a coefficient decoding method, which is applied to the decoding unit 301, and adjusts the boundary symbols of the coefficient groups during encoding, and further expands the decoding range through the boundary symbols.
  • the boundary sign of the coefficient group information can not only use 1 bit to represent the sign of the absolute extremum in the coefficient group, but also use n bits to represent the coefficient compensation value. Then S603 analyzes the coefficient code according to the fixed-length code whose code length is coding length, then analyzes the coefficient compensation value from the boundary symbol for the coefficient code position whose analysis value is equal to the absolute extremum value 2 ⁇ (coding length-1), and adds the coefficient compensation value to the absolute extremum value in the coefficient group as the coefficient value at the absolute extremum position.
  • a boundary symbol may also be used to indicate the positive or negative of the coefficient compensation value.
  • the decoding unit 301 needs to analyze the boundary symbol code to obtain the boundary symbol.
  • the analysis method can be fixed-length decoding, truncated unary code, Huffman decoding or a mixed decoding method of several common decoding methods.
  • an embodiment of the present application provides a coefficient decoding device.
  • the coefficient decoding device may be, for example, any coefficient decoding device during a call.
  • the coefficient decoding device may be divided into functional modules.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules. It should be noted that the division of modules in the embodiment of the present invention is schematic, and is only a logical function division, and there may be another division manner in actual implementation.
  • FIG. 13 shows a possible structural diagram of the coefficient decoding apparatus involved in the above embodiment.
  • the coefficient decoding device 13 includes an analysis module 131 and a decoding module 132 .
  • the analysis module 131 is configured to obtain coefficient group information of the unit to be decoded, the coefficients of the unit to be decoded are divided into one or more coefficient groups, each coefficient group includes at least one coefficient code, the coefficient codes in the same coefficient group are fixed-length codes with the same code length, at least one coefficient group includes the first coefficient group, and the coefficient group information includes the boundary symbol of the first coefficient group.
  • the decoding module 132 is used to parse the coefficient codes of the first coefficient group into coefficient values, and is also used to determine whether the coefficient values in the first coefficient group are positive or negative according to the boundary sign.
  • Each module of the above-mentioned coefficient decoding device can also be used to perform other actions in the above-mentioned method embodiment. All relevant content of each step involved in the above-mentioned method embodiment can be referred to the function description of the corresponding functional module, and will not be repeated here.
  • FIG. 14 is a hardware structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device may include an image decoder 141, a memory 142, and a communication interface (not shown).
  • the memory 142 stores computer instructions that can be executed by the image decoder 141, and the image decoder 141 is configured to execute the computer instructions to implement the methods disclosed in any of the above-mentioned embodiments of the present application.
  • all or part of them may be implemented by software, hardware, firmware or any combination thereof.
  • a software program it may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part.
  • the computer can be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) methods.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device including a server, a data center, and the like integrated with one or more available media.
  • the available medium may be a magnetic medium (for example, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (for example, a digital video disc (digital video disc, DVD)), or a semiconductor medium (for example, a solid state drive (solid state drives, SSD)), etc.
  • a magnetic medium for example, a floppy disk, a magnetic disk, a magnetic tape
  • an optical medium for example, a digital video disc (digital video disc, DVD)
  • a semiconductor medium for example, a solid state drive (solid state drives, SSD)
  • the disclosed system, device and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or integrated into another system, or some features may be ignored or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product
  • the computer software product is stored in a storage medium, and includes several instructions to make a computer device (which can be a personal computer, server, or network device, etc.) or a processor execute all or part of the steps of the method described in each embodiment of the application.
  • the aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk, and other various media capable of storing program codes.

Abstract

本申请实施例提供一种系数解码方法、装置、图像解码器及电子设备,涉及图像编解码领域,能够提升图像解码性能。该方法包括:解析码流,获得待解码单元的系数组信息,待解码单元的系数被划分包括至少一个系数组,每个系数组包括至少一个系数码,同一系数组中的系数码为同一码长的定长编码,至少一个系数组包括第一系数组,系数组信息包括第一系数组的边界符号;将第一系数组的系数码解析为系数值;根据边界符号确定第一系数组中的系数值为正值或负值。

Description

系数解码方法、装置、图像解码器及电子设备 技术领域
本申请实施例涉及图像编解码技术领域,尤其涉及一种系数解码方法、装置、图像解码器及电子设备。
背景技术
无损压缩就是指对原图像中的冗余信息进行压缩,重建原图像而不引起任何失真的技术。如果重建后图像和原图像存在误差,而误差被限制在一定的范围内可称为近无损压缩。在压缩编码过程中,预测原图像中像素间的残差值,残差值用于指示像素间的差异。采用半定长编码(Semi Fixed-Length Code)对残差值进行编码,进一步降低编码长度。但是现有的半定长编码技术仍然存在编码长度较长,编码效率较低的问题。
发明内容
本申请实施例提供一种系数解码方法、装置、图像解码器及电子设备,能够提升图像解码性能。
为达到上述目的,本申请实施例采用如下技术方案:
第一方面,本申请实施例提供一种系数解码方法,包括:解析码流,获得待解码单元的系数组信息,待解码单元的系数被划分包括为一个或多个系数组,每个系数组包括至少一个系数码,同一系数组中的系数码为同一码长的定长编码,至少一个系数组包括第一系数组,系数组信息包括第一系数组的边界符号;将第一系数组的系数码解析为系数值;根据边界符号确定第一系数组中的系数值为正值或负值。
本申请实施例提供的系数解码方法中,对比现有技术,未引入边界符号的定长编码的解码范围为[0,2^bit_depth-1],在引入边界符号对该系数组的系数码进行定长解码的情况下,根据该系数组的边界符号确定该系数组的正负,将定长编码的解析范围从[0,2^bit_depth-1]变化为[-2^(coding length–1)-1,2^(coding length-1)],无需在系数组中存在系数值等于2^bit_depth-1的情况下增加该系数组对应的码长,提高了编解码效率。
一种可能的实现方式中,系数组信息还包括第一系数组的码长和图像位宽,码长用于表示第一系数组对应的定长编码的长度,将第一系数组的系数码解析为系数值,包括:若码长大于或等于图像位宽,则采用长度与图像位宽等长的定长编码将第一系数组的系数码解析为系数值;若码长小于图像位宽,则采用码长的定长编码将第一系数组的系数码解析为系数值。
系数组对应的图像位宽用于表示该系数组中系数值的取值范围,根据该系数组对应的预设码长的定长编码和该系数组中系数值的解析取值范围,确定该系数组对应定长编码和系数值的解析范围,保证了判断方式的准确性。系数组对应的图像位宽可以由码流解析获得,能够简单快速地提取判断所需数据,提高了判断效率。根据两种情况采用不同码长的定长编码对系数码进行解析,提高了解码效率。
一种可能实现的方式中,系数组的码长包括系数组码长和系数位码长,系数位码长用于表示第一系数组中特定位置的系数码对应的定长编码的长度,其中,特定位置根据编解码一致性获得或上下文导出。则采用长度为码长的定长编码将所述第一系数组的系数码解析为系数值,包括:采用长度为系数位码长的定长编码将第一系数组中特定位置的系数码解析为系数值;采用长度为系数组码长的定长编码将第一系数组中除特定位置外的系数码解析为系数值。在系数分布不均匀时,对于一些特定位置的系数码,对同一系数组内的系数码使用不同长度的定长编码进行解析,避免由于系数组中少数特定位置的系数码与其他位置系数码的差值较大而增加系数组的整体编码长度,提高了解码效率。
一种可能的实现方式中,在编码排序时会根据系数值的大小将对应码长相同或相近的系数码放入同一系数组,因此同一系数组中的系数值存在对应码长的定长编码的解析极值时,同一系数组中的其它系数值和解析极值同为正或同为负。因此,在第一系数组中存在绝对极值的情况下,根据边界符号确定系数组中的所有系数值全部为正值或全部 为负值,绝对极值为该系数组对应码长的定长编码的编码值范围的最大绝对值。同一系数组采用一个边界符号表示系数正负,提高了编码效率。
一种可能的实现方式中,将同一系数组划分为多个系数块,在任一系数块中存在绝对极值的情况下,根据任一系数块的边界符号确定任一系数块中的所有系数值全部为正或全部为负。进一步提高了边界符号对系数值的正负性的指示精度。
一种可能的实现方式中,在编码过程中,若预测值和残差值进行量化,与将预测值和残差值进行系数变换后进行量化相比,具有相同或更好的图像传输质量和编解码效率,则对预测值和残差值进行量化获得残差系数,不会进行系数变换步骤。
因此,解码设备解析码流获得的待解码单元中的系数码可能是残差系数的半定长编码结果,或是变换系数的半定长编码结果。上述任一实现方式中的系数解码方法能够应用于残差系数或变换系数的解码,提高了该系数解码方法的适用性。
一种可能的实现方式中,变换系数中包括的直流系数组和交流系数组被分别划分为不同系数组。每个系数组的码长在系数组信息中为码长编码形式,边界符号在系数组信息中为边界符号编码形式。针对系数组中的系数为变换系数,且该系数组为直流系数组的情况,采用直流系数解码方式(如定长码)解析系数组的码长编码,获得该系数组对应的码长,采用该系数组对应的码长的定长编码解析系数组的边界符号码,获得边界符号。在另一示例中,针对系数组中的系数为变换系数,且该系数组为直流系数组的情况,可采用定长码解析系数组的码长编码,获得该系数组对应的码长,采用该系数组对应的码长的定长编码解析直流系数值,采用固定码长为1解析系数组的边界符号码,获得边界符号。
一种可能的实现方式中,在系数组中的系数为变换系数,且系数组为交流系数组的情况下,采用定长解码方式解析该系数组对应的码长编码,获得该系数组对应的码长;采用该系数组对应码长的定长编码解析系数组的边界符号码,获得边界符号。
由于在对残差值和预测值进行系数变换时会产生直流系数和交流系数,则针对直流系数和交流系数分别进行系数组划分的情况,采用直流系数解码方式解析直流系数组的码长编码,采用定长解码方式解析交流系数组的码长编码,能够对直流系数和交流系数分别进行系数编解码,避免同一系数组中系数值差异较大需要较长码长的定长编码进行编解析的问题,提高了解码效率。
一种可能的实现方式中,确定待解码单元中的第一系数组,包括:从码流中确定待解码单元的扫描方式和分组方式;根据扫描方式扫描待解码单元,获得扫描结果;根据分组方式将扫描结果划分为一个或多个系数组,第一系数组为一个或多个系数组中的任一系数组。
在编解码过程中,解码可以是为编码的逆步骤,编码端和解码端使用的扫描方式、分组方式、定长编码等均为预先约定一致,遵循编解码一致性。在半定长编码时采用一扫描方式和分组方式对残差系数或变换系数进行排序分组,将不同码长的定长编码进行编码的系数值分别设置为不同分组,则通过码流将该扫描方式和分组方式传输至解码设备,解码设备根据该扫描方式和分组方式确定的系数组使用同一码长的定长编码,保证了编解码一致性,从而保证了编解码准确性。
一种可能的实现方式中,系数组信息包括每个系数组的码长阈值和系数附加值,在系数组对应码长大于该系数组的码长阈值的情况下,在通过定长解码方式获得系数值之后,还包括:将系数值与系数组的系数附加值相加,获得该系数组的系数值。
解码设备基于码长阈值判断系数组是否在编码时将系数组中所有系数值减去同一系数附加值,能够在解码端解码系数组中的值后再加上系数附加值,以还原系数组中系数值,编码设备传输预设均值至解码设备,解码设备基于系数附加值还原系数值,避免对系数组中原始的较大系数值对应的长编码进行传输,提高了编解码效率。
一种可能的实现方式中,系数组信息中除了包括用于表示极值正负的符号位之外, 系数组信息还可以包括每个系数组的系数补偿值。系数补偿值用于对系数组中极值进行补偿。则在根据边界符号确定系数组中的系数值为正值或负值之后,还包括:将系数值中的绝对极值与系数补偿值相加,获得该系数组中绝对极值位置的系数值。通过较短的编码长度获得极值加系数补偿值的和的解析范围,从而提高了编解码效率。
一种可能的实现方式中,将系数组划分为多个系数块,每个系数组的系数补偿值包括该系数组中所有系数块的系数补偿值,则在根据边界符号确定系数组中的系数值为正值或负值之后,还包括:将每个系数块中的绝对极值与同一系数块的系数补偿值相加,获得每个系数块的绝对极值位置的系数值。使系数补偿值能够对每个系数块中的极值进行补偿,进一步提高了编码效率。
第二方面,本申请实施例提供一种系数解码装置,包括解析模块和解码模块,其中,解析模块用于解析码流,获得待解码单元的系数组信息,待解码单元的系数被划分包括为一个或多个系数组,每个系数组包括至少一个系数码,同一系数组中的系数码为同一码长的定长编码,至少一个系数组包括第一系数组,系数组信息包括第一系数组的边界符号。解码模块用于将第一系数组的系数码解析为系数值,还用于根据边界符号确定所述第一系数组中的系数值为正值或负值。
第三方面,本申请实施例提供一种图像解码器,该图像解码器用于执行第一方面及其可能的实现方式中任意之一所述的系数解码方法。
第四方面,本申请实施例提供一种电子设备,包括第三方面所述的图像解码器、通信接口以及存储器;该图像解码器用于执行上述第一方面及其可能的实现方式中任意之一所述的系数解码方法。
第五方面,本申请实施例提供一种计算机可读存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得电子设备执行上述第一方面及其可能的实现方式中任意之一所述的系数解码方法。
第六方面,本申请实施例提供一种计算机程序产品,当计算机程序产品在计算机上运行时,执行第一方面及其可能的实现方式中任意之一所述的系数解码方法。
第七方面,本申请实施例提供一种装置,包括存储器和处理器。存储器用于存储计算机指令。处理器用于从存储器中调用并运行该计算机指令,以使得电子设备执行第一方面及其可能的实现方式中任意之一所述的系数解码方法。
第八方面,本申请实施例提供一种图像编解码系统,包括图像编码设备和图像解码设备,图像解码设备用于从图像编码设备接收图像码流,并且执行第一方面及其可能的实现方式中任意之一所述的系数解码方法以对图像码流进行系数解码,根据系数解码结果进行图像重建,得到解码后的图像。
应当理解的是,本申请实施例的第二方面至第八方面技术方案及对应的可能的实施方式所取得的有益效果可以参见上述对第一方面及其对应的可能的实施方式的技术效果,此处不再赘述。
附图说明
图1为本申请实施例提供的一种编解码系统的架构示意图;
图2为本申请实施例提供的一种编码器的示意性框图;
图3为本申请实施例提供的一种解码器的示意性框图;
图4为本申请实施例提供的一种编/解码的流程示意图;
图5为本申请实施例提供的一种系数编码方法示意图;
图6为本申请实施例提供的一种系数解码方法示意图;
图7为本申请实施例提供的一种扫描方式示意图之一;
图8为本申请实施例提供的一种分组方式示意图之一;
图9为本申请实施例提供的一种扫描方式示意图之二;
图10为本申请实施例提供的一种分组方式示意图之二;
图11为本申请实施例提供的一种扫描及分组方式示意图之一;
图12为本申请实施例提供的一种扫描及分组方式示意图之二;
图13为本申请实施例提供的一种系数解码装置的结构示意图;
图14为本申请实施例提供的一种电子设备的硬件结构图。
具体实施方式
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。
本申请实施例的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一预测模式和第二预测模式等是用于区别不同的预测模式,而不是用于描述预测模式的特定顺序。
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个预测单元是指两个或两个以上的多个预测单元,多个编码块是指两个或两个以上的编码块。
本申请实施例提供的系数解码方法也可以用于视频解码、图像解码等,应理解,只要存在将预测值、残差值或系数值等进行半定长编码的编码方式,本申请提供的系数解码方法均适用。
下面对现有的图像编解码技术和半定长编码技术进行说明。
以JPEG(Joint Photographic Experts Group)图像压缩方式为例,首先将图像由RGB(Red-Green-Blue)格式转换为YUV(Y表示明亮度,U和V表示色度)格式。然后按照一定的采样格式对YUV格式的图像进行采样,并将图像划分成多个数据块,其中,源图像中每点的三个分量(Y、U、V)是交替出现的,先要把这三个分量分开,存放到三张表中。编码时,从源数据中读取一个数据块后,进行离散余弦变换(Discrete Cosine Transform,DCT)变换、量化以及编码,然后再读取、处理下一个数据块。其中,编码可以包括二值化和熵编码步骤。其中,二值化也叫二进制化,对需要编码的符号或系数进行二值化,经过二值化后的符号或系数转化为二元字符串,不同的二值化方法对相同的系数进行编码得到的二元字符串可能具有不同的二元概率模型,以及不同的字符串长度。熵编码是指按照信息熵的原理进行的无损编码方式,把一系列用来表示图像序列的元素符号转变为一个用来传输或存储的二进制码流,熵编码后的输出数据即原始图像压缩后的最终码流。DCT变换是将图像从时域信号变换至频域。由于大部分图像的能量主要集中在低频区域,且人眼对低频较为敏感,因此通过量化将高频系数置零可以在变换模块的基础上减小图像编码的动态范围。去除高频区域的变换系数,减小码率的开销,并且不会造成很大的失真。其中,将残差值组成残差块,残差块经过变换、量化后的系数称为变换系数。
应当理解的是,编码和解码的过程相反,例如编码时对图像依次进行色域转换、采样、DCT变换、量化以及编码,解码时则需要对接收到的码流依次进行解码、反量化、逆离散余弦变换,然后对逆离散余弦变换的结果进行逆采样顺序排列,最后将图像数据从YUV格式转换回RGB格式。
在无损与近无损视频压缩算法中,例如在利用JPEG图像压缩方式编码时,在执行量化步骤后,经常会使用半定长编码方式对量化后数据进行编码,将待编码系数按照预测方向以及残差大小进行分组,每个组对应一个码长编码,对同一个组内的系数使用相同的码长的定长编码进行编码。
例如,一个数据块量化后的数据包括(-4,-4,-3,-2,-1,0,1,2,3,7),则可以将其划分为(-1,0,1),(-3,-2,2,3),(-4,-4,7)。其中,(-1,0,1)对应的码长编码的码长为2,(-3,-2,2,3)对应的码长编码的码长为3,(-4,-4,7)对应的码长编码的码长为4;或者,(-1,0,1)对应的码长编码的码长为1,(-3,-2,2,3)对应的码长编码的码长为2,(-4,-4,7)对应的码长编码的码长为3,再使用码长为1编每个数据的符号或再使用码长为1编每个非0数据的符号。
现有的半定长编码对量化后的组内数据进行固定长度的定长码分组,虽然可以一定程度上进行无损编码,但在某一码长对应的分组中存在该码长的定长编码的解析范围的极值时,需要增加该系数组所有的编码长度,因此这样的编码码长依然比较大,为了进一步提高编码性能,本申请实施例提供了一种系数解码方法。
下面描述本申请实施例的系数解码方法所应用的系统架构。参见图1,给出了本申请实施例所应用的编解码系统(也可以称为编码及解码系统)10的架构示意图。如图1所示,编解码系统10可以包括源设备11和目的设备12,源设备11用于对图像进行编码,因此,源设备11可被称为视频编码装置。目的设备12用于对由源设备11所产生的经编码的图像数据进行解码,因此,目的设备12可被称为视频解码装置。
源设备11和目的设备12可以包括各种装置,例如,包含桌上型计算机、移动计算装置、笔记型(例如,膝上型)计算机、平板计算机、机顶盒、手机、电视机、相机、显示装置、数字媒体播放器、视频游戏控制台、车载计算机、无线通信设备等等。
在一个例子中,图1中的源设备11和目的设备12可以是两个单独的设备,或者,源设备11和目的设备12为同一设备,即源设备11或对应的功能以及目的设备12或对应的功能可以集成在同一个设备上。
源设备11和目的设备12之间可以进行通信,例如,目的设备12可从源设备11接收经编码图像数据。在一个实例中,源设备11和目的设备12之间可以包括一个或多个通信媒体,通过一个或多个通信媒体传输经编码图像数据,该一个或多个通信媒体可包含路由器、交换器、基站或促进从源设备11到目的设备12的通信的其它设备。
如图1所示,源设备11包括编码器112,在一个例子中,源设备11还可以包括图像预处理器111以及通信接口113。其中,图像预处理器111,用于对接收到的待编码图像执行预处理,例如,图像预处理器111执行的预处理可以包括整修、色彩格式转换(例如,从RGB格式转换为YUV格式)、调色或去噪等。编码器112,用于接收经预处理的图像,采用相关预测模式(如本文各个实施例中的预测模式)对经预处理的图像进行处理,从而提供经编码图像数据。在一些实施例中,编码器112可以用于执行下文中所描述的各个实施例中的图像编码过程。通信接口113,可用于将经编码图像数据传输至目的设备12或任何其它设备(如存储器),以用于存储或直接重构,其它设备可为任何用于解码或存储的设备。通信接口113也可以将经编码图像数据封装成合适的格式之后再传输。
在一个例子中,上述图像预处理器111、编码器112以及通信接口113可能是源设备11中的硬件部件,也可能是源设备11中的软件程序,本申请实施例不做限定。
继续如图1所示,目的设备12包括解码器122,在一个例子中,目的设备12还可以包括通信接口121、图像后处理器123。其中,通信接口121可用于从源设备11或任何其它源设备接收经编码图像数据,该任何其它源设备例如为存储设备。通信接口121还可以解封装通信接口113所传输的数据以获取经编码图像数据。解码器122,用于接收经编码图像数据并输出经解码图像数据(也称为经重构图像数据或已重构图像数据)。在一些实施例中,解码器122可以用于执行下文中所描述的各个实施例所述的系数解码过程。
图像后处理器123,用于对经解码图像数据执行后处理,以获得经后处理像数据。图像后处理器123执行的后处理可以包括:色彩格式转换(例如,从YUV格式转换为 RGB格式)、调色、整修或重采样,或任何其它处理,还可用于将将经后处理图像数据传输至显示设备进行显示。
同理,在一个例子中,上述通信接口121、解码器122以及图像后处理器123可能是目的设备12中的硬件部件,也可能是目的设备12中的软件程序,本申请实施例不做限定。
下面对图1中的编码器和解码器的结构进行简单介绍。
参见图2,图2示出用于实现本申请实施例的编码器20的实例的示意性框图。在图2中,编码器包括预测处理单元201、残差计算单元202、变换处理单元203、量化单元204、编码单元205。在一个例子中,编码器还包括反量化单元(也可以称为逆量化单元)、反变换处理单元(也可以称为逆变换处理单元)、重构单元(或者称为重建单元)以及滤波器单元。在一个例子中,编码器20还可以包括缓冲器、经解码图像缓冲器,其中,缓冲器用于缓存重构单元输出的重构图像块,经解码图像缓冲器用于缓存滤波器单元输出的滤波后的图像块。
编码器20的输入为图像(可以称为待编码图像)的图像块,图像块也可以称为当前图像块或待编码图像块,编码器20中还可以包括分割单元(图2中未示出),该分割单元用于将待编码图像分割成多个图像块。编码器20用于逐块编码从而完成对待编码图像的编码,例如,对每个图像块执行编码过程。
预测处理单元201,用于接收或获取图像块(当前待编码图像的当前待编码图像块,也可以称为当前图像块,该图像块可以理解为图像块的真实值)和已重构图像数据,基于已重构图像数据中的相关数据对当前图像块进行预测,得到当前图像块的预测块。
残差计算单元202用于计算图像块的真实值和该图像块的预测块之间的残差,得到残差块,例如,通过逐像素将图像块的像素值减去预测块的像素值。
变换处理单元203用于对残差块进行例如离散余弦变换和离散正弦变换(Discrete Sine Transform,DST)等系数变换,以在变换域中获取变换系数。应当理解的是,本实施中变换处理单元203可以对残差块进行系数变换,在残差块与变换系数的编码效率差距较小时,也可以不对残差块进行系数变换。
量化单元204用于通过应用标量量化或向量量化来量化变换系数,以获取经量化变换系数,经量化变换系数也可以称为经量化残差系数。量化过程可以减少与部分或全部变换系数有关的位深度。例如,可在量化期间将n位变换系数向下舍入到m位变换系数,其中n大于m。可通过调整量化参数(Quantization Parameter,QP)修改量化程度。例如,对于标量量化,可以应用不同的标度来实现较细或较粗的量化。较小量化步长对应较细量化,而较大量化步长对应较粗量化。可以通过量化参数指示合适的量化步长。
编码单元205用于对上述经量化残差系数或变换系数进行编码,然后以一扫描方式和分组方式将系数编码排列为待解码单元,以编码比特流的形式输出的经编码图像数据(即待解码单元),然后可以将经编码比特流传输到解码器,或将其存储起来,后续传输至解码器或用于检索。编码单元205还可用于对当前图像块的其它语法元素进行编码,例如将预测模式编码至码流等。可选地,本实施例中可以采用一元码、截断一元码、截断二元码、定长编码、半定长编码、游程编码、k阶指数哥伦布编码、截断莱斯编码、哥伦布-莱斯编码、霍夫曼编码、算术编码、自适应变长编码等,其中的一种或结合多种编码方式,对系数进行编码。
具体的,在本申请实施例中,编码器20用于实现后文实施例中描述的图像编码方法。
参见图3,图3示出用于实现本申请实施例的解码器30的实例的示意性框图。解码器30用于接收例如由编码器20编码的经编码图像数据(即经编码比特流,例如,包括图像块的经编码比特流及相关联的语法元素),以获取经解码图像。解码器30包括解码单元301、反量化单元302、反变换处理单元303、预测处理单元304、重构单元305、滤波器单元306。在一些实例中,解码器30可执行大体上与图2的编码器20描述的编 码遍次互逆的解码遍次。在一个例子中,解码器30还可以包括缓冲器、经解码图像缓冲器,其中,缓冲器用于缓存重构单元305输出的重构图像块,经解码图像缓冲器用于缓存滤波器单元306输出的滤波后的图像块。
解码单元301用于对经编码图像数据执行解码,以获取经量化系数(例如残差系数或变换系数)。解码单元301还用于将上述经解码的编码参数转发至预测处理单元304,以供预测处理单元根据编码参数执行预测过程。
反量化单元302用于对上述经量化系数进行反量化,以获取经反量化系数,该反量化是上述量化单元204的反向应用,例如,基于或使用与量化单元204相同的量化步长,应用量化单元204应用的量化方案的逆量化方案。经反量化系数也可以称为经反量化残差系数或经量化变换系数。
反变换处理单元303用于对上述反量化系数进行反变换,应理解,该反变换是上述变换处理单元203的反向应用,例如,反变换可以包括逆离散余弦变换或逆离散正弦变换,以在像素域(或者称为样本域)中获取逆变换块。逆变换块也可以称为逆变换经反量化块或逆变换残差块。
重构单元305(例如求和器)用于对上述经量化系数进行逆变换(例如,逆DCT、逆整数变换或概念上类似的逆变换过程),得到逆变换块(也可以称为逆变换残差块),该逆变换块即为当前图像块在像素域中的残差块。
预测处理单元304,用于接收或获取经编码图像数据(例如当前图像块的经编码比特流)和已重构图像数据,预测处理单元301还可以从例如解码单元302接收或获取预测相关参数和/或关于所选择的预测模式的信息(即经解码的编码参数),并且基于已重构图像数据中的相关数据和经解码的编码参数对当前图像块进行预测,得到当前图像块的预测块。
重构单元305用于将逆变换块(即逆变换残差块)添加到预测块,以在样本域中获取经重构块,例如将逆变换残差块的样本值与预测块的样本值相加。
滤波器单元306用于对经重构块进行滤波以获取经滤波块,该经滤波块即为经解码图像块。
具体的,在本申请实施例中,解码单元301用于实现后文实施例中描述的系数解码方法。
应当理解的是,在本申请实施例的编码器20和解码器30中,针对某个环节的处理结果也可以经过进一步处理后,输出到下一个环节。
下面在图1~图3所示出的编解码系统、编码器以及解码器的基础上,本申请实施例提供一种可能的编/解码实现方式,如图4所示,图4为本申请实施例提供的一种编/解码的流程示意图,该编/解码实现方式包括过程①至过程⑤,过程①至过程⑤可以由上述的源设备11、解码器20、目的设备12或解码器30中的任意一个或多个执行。
过程①:将一帧图像分成一个或多个互相不重叠的并行编码单元。该一个或多个并行编码单元间无依赖关系,可完全并行/独立编码和解码,如图4所示出的并行编码单元1和并行编码单元2。
过程②:对于每个并行编码单元,可再将其分成一个或多个互相不重叠的独立编码单元,各个独立编码单元间可相互不依赖,但可以共用一些并行编码单元头信息。
例如,独立编码单元的宽为w_lcu,高为h_lcu。若并行编码单元划分成一个独立编码单元,则独立编码单元的尺寸与并行编码单元完全相同;否则,则独立编码单元的宽应大于高(除非是边缘区域)。
通常的,独立编码单元可为固定的w_lcu×h_lcu,w_lcu和h_lcu均为2的N次方(N≥0),如独立编码单元的尺寸为:128×4,64×4,32×4,16×4,8×4,32×2,16×2或8×2等。
作为一种可能的示例,独立编码单元可为固定的128×4。若并行编码单元的尺寸为 256×8,则可将并行编码单元等分为4个独立编码单元;若并行编码单元的尺寸为288×10,则并行编码单元划分为:第一/二行为2个128×4+1个32×4的独立编码单元;第三行为2个128×2+1个32×2的独立编码单元。
值得注意的是,独立编码单元既可以是包括亮度Y、色度Cb、色度Cr三个分量,或红(R)、绿(G)、蓝(B)三个分量,也可以仅包含其中的某一个分量。若独立编码单元包含三个分量,则这三个分量的尺寸可以完全一样,也可以不一样,具体与图像的输入格式相关。
过程③:对于每个独立编码单元,可再将其分成一个或多个互相不重叠的编码单元,独立编码单元内的各个编码单元可相互依赖,如多个编码单元可以进行相互参考预编解码。
若编码单元与独立编码单元尺寸相同(即独立编码单元仅分成一个编码单元),则其尺寸可为过程②所述的所有尺寸。
若独立编码单元分成多个互相不重叠的编码单元,则其可行划分例子有:水平等分(编码单元的高与独立编码单元相同,但宽不同,可为其1/2,1/4,1/8,1/16等),垂直等分(编码单元的宽与独立编码单元相同,高不同,可为其1/2,1/4,1/8,1/16等),水平和垂直等分(四叉树划分)等,优选为水平等分。
编码单元的宽为w_cu,高为h_cu,则其宽应大于高(除非是边缘区域)。通常的,编码单元可为固定的w_cu×h_cu,w_cu和h_cu均为2的N次方(N大于等于0),如16×4,8×4,16×2,8×2,8×1,4×1等。
作为一种可能的示例,编码单元可为固定的16×4。若独立编码单元的尺寸为64×4,则可将独立编码单元等分为4个编码单元;若独立编码单元的尺寸为72×4,则编码单元划分为:4个16×4+1个8×4。
值得注意的是,编码单元既可以是包括亮度Y、色度Cb、色度Cr三个分量(或红R、绿G、蓝B三分量),也可以仅包含其中的某一个分量。若包含三个分量,几个分量的尺寸可以完全一样,也可以不一样,具体与图像输入格式相关。
值得注意的是,过程③是编解码方法中一个可选的步骤,编/解码器可以对过程②获得的独立编码单元进行残差系数(或变换系数)进行编/解码。
过程④:对于编码单元,可以将其再分成一个或多个互相不重叠的预测组(Prediction Group,PG),PG也可简称为Group,各个PG按照选定预测模式进行编解码,得到PG的预测值,组成整个编码单元的预测值,基于预测值和编码单元的原始值,获得编码单元的残差值。
其中,过程④中通过选定的扫描方式对编码单元进行分组,扫描方式可以包括,但不限于下述任一种或多种:光栅扫描、块扫描、水平扫描、垂直扫描、往返(水平/垂直)扫描、对角(左上,右上,左下,右下)扫描、逆对角线扫描、逆水平扫描、逆垂直扫描或基于一个固定的扫描模板进行扫描等。
过程⑤:基于编码单元的残差值,对编码单元进行分组,获得一个或多个相不重叠的残差小块(Residual Block,RB),各个RB的残差系数或变换系数按照选定模式进行编解码,形成残差系数流或变换系数流。
上述过程⑤中残差系数或变换系数的编解码方法的选定模式可以包括,但不限于下述任一种或多种:一元码、截断一元码、截断二元码、定长编码、半定长编码、游程编码、k阶指数哥伦布编码、截断莱斯编码、哥伦布-莱斯编码、霍夫曼编码、算术编码、自适应变长编码等。
例如,编码器可直接对RB内的系数进行编码。
又如,编码器也可对残差块进行变换,如DCT、DST、Hadamard变换等,再对变换后的系数进行编码。
作为一种可能的示例,当RB较小时,编码器可直接对RB内的各个系数进行统一 量化,再进行二值化编码。若RB较大,可进一步划分为多个系数组(Coefficient Group,CG),再对各个CG进行统一量化,再进行二值化编码。在本申请的一些实施例中,系数组和量化组可以相同。
下面以半定长编码方式对残差系数编码的部分进行示例性说明。首先,将一个RB块内残差绝对值的最大值定义为修整最大值(modified maximum,mm)。其次,确定该RB块内残差系数的编码比特数(同一个RB块内残差系数的编码比特数一致)。例如,若当前RB块的关键限值(Critical Limit,CL)为2,当前残差系数为1,则编码残差系数1需要2个比特,可表示为01。若当前RB块的CL为7,则表示编码7bit的残差系数和1bit的符号位。CL的确定是去找满足当前子块所有残差都在[-2^(coding length-1)-1,2^(coding length-1)]以及边界值范围之内的最小coding length值,边界值可以是-2^(coding length-1)或2^(coding length-1)。若当前RB块中存在绝对值为2^(coding length-1)的系数值,则在码流中增加一个边界符号编码,即需要根据边界符号编码表示的边界符号确定当前RB块中系数值2^(coding length-1)的正负;若所有残差均不存在-2^(coding length-1)和2^(coding length-1)中的任何一个,则无需编码该边界符号位。若系数组中存在绝对值为2^(coding length-1)的系数值,可以用一个边界符号编码表示该系数组中所有系数的正负。
另外,对于某些特殊的情况,编码器也可以直接编码图像的原始值,而不是残差值。
需要说明的是,本申请实施例中的预测单元可以是经上述过程③划分得到的编码单元,也可以是编码单元再经过划分后的预测组。
结合上述图1所示的编解码系统、图2所示的编码器以及图3所示的解码器的框架示意图,下面对本申请涉及的图像编码方法和系数解码方法进行详细描述。
首先,本申请实施例提供一种系数编码方法,可应用于编码单元205,如图5所示,该系数编码方法可以包括S501-S504。
S501:编码单元205确定待编码单元的扫描方式和最优分组方式。
上述待编码单元的扫描方式和分组方式可以根据编解码一致性中编码单元205和解码单元301约定获得。
最优分组方式可以根据每种分组方式的编码代价确定。编码代价可以使用率失真优化(Rate Distortion Optimation)、最小化率失真代价(Rate Distortion Cost)等方式计算获得。编码代价最小的分组方式为最优分组方式,即让频率高的编码尽量短,频率低的编码较长。可选地,最优分组方式可以根据编编码单元205和解码单元301在编解码一致性中的约定获得,或解码单元301根据上下文导出(根据已编码数据导出、残差系数或已编码的参数导出),或编码单元205传参获得。
S502:编码单元205根据最优分组方式将待编码单元划分为多个系数组。
上述扫描方式可以选用前文提供的编/解码实现方式中过程⑤中列举的任一种扫描方式,在此不再赘述。
S503:编码单元205确定每个系数组的系数组信息。
可选地,系数组信息可以包括该系数组对应的码长、边界符号和图像位宽,该系数组对应的码长用于表示系数组中的系数码由该码长长度的定长编码进行编码获得。
其中,图像位宽(bit_depth)表示原始数据或重建数据的最大比特位,根据一系数组对应的码长和图像位宽,能够判断该系数组中是否存在超过该码长的定长编码值范围的系数值。若系数组中不存在超过该码长的定长编码值范围的系数值,则不需要为该系数组设置边界符号,即该系数组的编码范围是[0,2^bit_depth-1]。若系数组中存在超过该码长的定长编码值范围的系数值,则需要为该系数组设置边界符号,使该系数组的编码范围为[-2^(coding length-1)-1,2^(coding length-1)]。
可选地,若一系数组内存在边界符号,则该系数组可采用同一个边界符号表示系数组内所有系数值同时为正或同时为负,即该系数组共享一个边界符号。
在另一实施例中,若一系数组内存在边界符号,则该系数组内绝对值等于绝对极值,即等于2^(coding length-1)的系数值可采用同一个边界符号,以表示这些系数值同时为正或同时为负,即这些绝对值等于2^(coding length-1)的系数值共享一个边界符号。
S504:编码单元205针对每个系数组,根据系数组对应码长的定长编码对系数组的系数值、码长、边界符号和图像位宽进行编码,获得系数定长编码和系数组信息。
应当理解的是,在进行系数编码时,根据不同的预测模式,存在不同的扫描方式,针对不同的扫描方式存在不同的分组方式,也就存在不同的系数分组情况,因此对应不同的系数编码方法。因此除了上述S501-S504的系数编码方法,还可以根据不同的系数分组情况对上述S501-S504的系数编码方法进行一个或多个步骤的适应性细化或变化,此处不再对系数编码方法的具体实施方式进行举例说明,参考下文系数解码方法的具体实施例可以逆向推理出编码步骤。
对于图5所示的系数编码方法,编码单元205完成系数编码之后,将码流传输至解码单元301。相应地,本申请实施例提供了一种系数解码方法,应用于解码单元301,如图6所示,该系数解码方法可包括S601-S603。
S601:解码单元301解析码流,获得待解码单元和系数组信息。
上述待解码单元包括至少一个系数组,每个系数组包括至少一个系数定长编码,系数组信息包括每个系数组的边界符号,每个系数组中的系数码采用相同码长的定长编码进行解码。
应当理解的是,在对某个系数组进行解析前,需要从待解码单元中提取该系数组,本实施例可以解析码流获得待解码单元对应的扫描方式和分组方式,根据该扫描方式扫描待解码单元,获得扫描结果,该扫描结果将待解码单元划分为至少一个预测组。然后根据分组方式将扫描结果划分为至少一个系数组,从中选择第一系数组。
在另一个实施例中,在对某个系数组进行解析前,需要从待解码单元中提取该系数组,本实施例可以解析码流获得待解码单元对应的分组方式,从码流中获取当前编码单元的预测模式,基于该预测模式导出扫描方式,根据该扫描方式扫描待解码单元,获得扫描结果,该扫描结果将待解码单元划分为至少一个预测组。然后根据分组方式将扫描结果划分为至少一个系数组,从中选择第一系数组。
S602:将第一系数组的系数码解析为系数值。
可选地,本实施例可以根据第一系数组的码长是否小于该系数组的图像位宽选择不同码长的定长编码对系数码进行解析。若码长大于或等于图像位宽,则采用长度与图像位宽等长的定长编码将第一系数组的系数码解析为系数值。若码长小于图像位宽,则采用码长的定长编码将第一系数组的系数码解析为系数值。
上述第一系数组的码长、边界符号和图像位宽均可以由系数组信息获得,在码流传输来的系数组信息中可为定长编码形式,即码长码、边界符号码和图像位宽码。解码单元301使用定长编码解码方式或其他解码方式解析第一系数组的码长码、边界符号码和图像位宽码,获得第一系数组的码长、边界符号和图像位宽。
应当理解的是,本实施例中S602对系数组中系数码进行解析的过程,还可以引入游程编码方式对系数组中的连续0值进行解析,其具体解析方式与现有游程编码方式相同,在此不再赘述。与此同时,还可以引入跳过系数的方式,例如,若从码流中解析跳过系数模式开启时,整个组不需要编码任何系数,解码单元301的重建值直接等于预测值。
S603:根据边界符号确定第一系数组中的系数值为正值或负值。
未使用边界符号的情况下,第一系数组的与图像位宽等长的定长编码的解析范围是[0,2^bit_depth-1]。使用边界符号的情况下,第一系数组对应码长的定长编码与边界符号的解析范围是[-2^(coding length-1)-1,2^(coding length-1)]。
进一步地,在第一系数组中存在绝对极值的情况下,即第一系数组存在绝对值等于 2^(coding length-1)的系数值的情况下,第一系数组可以共用一个边界符号,由该边界符号表示第一系数组中所有系数值的正负。
在另一实施例中,当系数值解析等于绝对极值时,这些系数是位于边界的系数,其符号可以由边界符号确定。例如,在第一系数组中存在绝对极值的情况下,即第一系数组存在绝对值等于2^(coding length-1)的系数的情况下,这些系数可以共用一个边界符号,即由该边界符号表示绝对值等于2^(coding length-1)的系数的正负。
与现有技术相比,本申请实施例在引入边界符号的情况下,使半定长编码的系数值解析范围从[0,2^bit_depth-1]变化为[-2^(coding length-1)-1,2^(coding length-1)],进一步缩短了整体编码长度,提高了编解码效率。
在一个例子中,第一系数组还可以进一步划分为多个系数块,不同系数块中的系数码不能共用一个边界符号,则码流数据中的边界符号可以为多个,即码流中包括每个系数块对应的边界符号,每个系数块共用一个边界符号。针对同一系数块,若S603解析边界符号码表示负,则该系数块中解析值的绝对值等于2^(coding length-1)的系数值为-2^(coding length-1),若S603解析边界符号码表示正,则该系数块中解析值的绝对值等于2^(coding length-1)的系数值为2^(coding length-1)。可选地,边界符号码解析后的值可以是表示负的0或表示正的1,也可以用0表示正、1表示负,边界符号码用一比特表示。
需要说明的是,本实施例中S602-S603对待解码单元中一个系数组进行解析完成后,还需要采用与S602-S603相同的方式对待解码单元中其他系数组进行解析,直至待解码单元中所有系数组均解析完毕后才完成该待解码单元的系数解码。
应当理解的是,本实施例提供的系数解码方法不仅可以对变换系数或残差系数的编码进行解析,根据不引入边界符号的情况下的解析步骤,还可以对原始像素值的编码进行解析。
本申请实施例提供一种应用于逐点预测模式下残差系数的系数解码方法,应用于解码单元301。
首先对解码单元301如何确定扫描方式和分组方式进行说明。针对采用逐点预测模式对亮度Y进行预测获得的残差系数,例如16*2像素块,扫描方式可以为图7中(a)所示的逐点预测模式1,(b)所示的逐点预测模式2,(c)所示的逐点预测模式3,(d)所示的逐点预测模式4等。其中,组1(Group1)和组2(Group2)表示不同。逐点预测模式1中Group1与Group2均采用垂直方向优先的扫描顺序,即先从上到下,再从左到右的扫描顺序。逐点预测模式2中Group1与Group2先后采用水平方向优先,即从左到右。逐点预测模式3中Group1与Group2采用先从左到右,再从上到下的扫描顺序。逐点预测模式4中Group1与Group2均采用垂直方向优先的扫描顺序,即先从上到下,再从左到右的扫描顺序。
根据上述扫描方式中的任一种对待解码单元进行扫描,获得预测组Group1和Group2,对每个预测组进行分组,分组方式可如图8所示,其中每一小格代表一个系数定长编码,不同的灰度值代表不同的系数组,图8(a)表示编码索引为0时的情况下将整个预测组作为一个16*1的系数组,图8(b)表示编码索引为100的情况下将一个预测组依次划分为两个8*1的系数组,图8(c)表示编码索引为101的情况下将一个预测组依次划分为一个8*1的系数组和两个4*1的系数组,图8(d)表示编码索引为110的情况下将一个预测组依次划分为两个4*1的系数组和一个8*1的系数组,图8(e)表示编码索引111的情况下将一个预测组依次划分为四个4*1的系数组。
针对逐点预测模式对色度Cb、色度Cr进行预测获得的残差系数,对步骤S602进行说明。例如8*2像素块,扫描方式为水平方向扫描,即从左至右逐行扫描,则可以如图9中(a)所示,在扫描方式的编码索引为0的情况下将待解码单元划分为两个不同的预测组,也可以如图9中(b)所示,在扫描方式的编码索引为1时将待解码单元划 分为四个不同的预测组。其中,每一小格代表一个系数定长编码,不同的灰度值代表不同的预测组,(b)中第一行前四格、第一行后四格、第二行前四格和第二行后四格为不同灰度。
根据上述扫描方式对待解码单元进行扫描,获得预测组,对每个预测组进行分组,分组方式可如图10所示,其中每一小格代表一个系数定长编码,不同的灰度值代表不同的系数组,图10(a)表示编码索引为0时的情况下将整个预测组作为一个8*1的系数组,图10(b)表示编码索引为1的情况下将一个预测组依次划分为两个4*1的系数组,其中,前四格和后四格为不同灰度。
根据上述扫描方式和分组方式实现系数组的划分后,解码单元301确定系数组对应码长的方式,可以是先采用定长编码的解码方式解析系数组对应码长码来获得码长coding length。可选地,针对码长的解析,还可以采用定长编码与截断一元码或其他编码的混合方式进行解析。
在S602中解码单元301根据coding length对应的定长编码对系数码逐个进行解析。若系数组对应的coding length大于或等于该系数组的图像位宽,则使用图像位宽的码长对应的定长编码对系数码进行解析,解析范围为[0,2^bit_depth-1]。若系数组对应的coding length小于该系数组的图像位宽,则使用coding length对应的定长编码解析系数码。
在S603中,解码单元301根据边界符号确定该系数组中系数值的正负,使系数值的解析范围为[-2^(coding length-1)-1,2^(coding length-1)]。若该系数组中存在绝对值等于2^(coding length-1)的系数值,则该系数组的所有系数值有一个共用的边界符号。
在另一实施例中,在该系数组中存在绝对极值的情况下,即该系数组存在绝对值等于2^(coding length-1)的系数的情况下,这些系数可以共用一个边界符号,即由该边界符号表示绝对值等于2^(coding length-1)的系数的符号全部为正或全部为负。
与现有技术相比,本申请实施例通过灵活地对亮度和色度进行不同方式的系数分组,提高了系数解码的适用性,并引入边界符号表示系数组对应码长的定长编码的解析极值的正负,提高了编解码效率。同时,该扫描方式和分组方式,考虑到数据的分布,使幅值相近的系数分布在邻近区域,使划分的系数组的每个系数值之间的关联性得到保留,提高了解码准确性。
本申请实施例还提供一种应用于非逐点预测模式下残差系数的系数解码方法,应用于解码单元301。
首先对扫描方式和分组方式进行说明。针对采用非逐点预测模式获得的残差系数,例如16*2像素块,扫描顺序可以如图11中(a)、(b)的箭头方向所示,系数组的划分可以如图10中(a)、(b)不同灰度所示,每一灰度表示同一系数组。
根据上述扫描方式和分组方式实现系数组的划分后,确定系数组对应码长的方式,可以是采用霍夫曼编码解析系数组对应的码长码获得。
在S602中,解码单元301在系数组对应的coding length大于或等于该系数组的图像位宽的情况下,使用图像位宽的码长对应的定长编码对系数码进行解析,解析范围为[0,2^bit_depth-1]。在系数组对应的coding length小于该系数组的图像位宽的情况下,使用coding length对应的定长编码对系数码进行解析。
在S603中,解码单元301采用边界符号确定该系数组中系数值的正负,使系数值的解析范围为[-2^(coding length-1)-1,2^(coding length-1)]。若该系数组中存在绝对值等于2^(coding length-1)的系数值,则为该系数组编码一个共用的边界符号。
在另一实施例中,在该系数组中存在绝对极值的情况下,即该系数组存在绝对值等于2^(coding length-1)的系数的情况下,这些系数可以共用一个边界符号,即由该边界符号表示绝对值等于2^(coding length-1)的系数的符号全部为正或全部为负。
本申请实施例还提供一种应用于非逐点预测模式下变换系数的系数解码方法,应用 于解码单元301。
首先对扫描方式和分组方式进行说明。针对采用非逐点预测模式获得的变换系数,例如16*2像素块,扫描顺序可以如图12中(a)、(b)的箭头方向所示,系数组的划分可以如图12中(a)、(b)不同灰度,每一灰度表示同一系数组,包含圆点的部分表示直流系数,所有直流系数划分为一个直流系数组,不包含圆点的部分划分为一个或多个交流系数。
根据上述扫描方式和分组方式实现系数组的划分后,确定系数组对应定长编码的码长的方式,可以是采用霍夫曼编码解析交流系数组对应的coding length,采用定长编码方式解析直流系数组对应的coding length。
在S602中,解码单元301在系数组对应的coding length小于7的情况下,使用长度为coding length的码长对应的定长编码对系数码进行解析。在系数组对应的coding length大于或等于7的情况下,则使用长度为图像位宽bit_depth+3对应的定长编码对系数码进行解析。
在S603中,解码单元301采用边界符号确定该系数组中系数值的正负,使系数值的解析范围为[-2^(coding length-1)-1,2^(coding length-1)]。若该系数组中存在绝对值等于2^(coding length-1)的系数值,则为该系数组编码一个共用的边界符号。
在另一实施例中,在该系数组中存在绝对极值的情况下,即该系数组存在绝对值等于2^(coding length-1)的系数的情况下,这些系数可以共用一个边界符号,即由该边界符号表示绝对值等于2^(coding length-1)的系数的符号全部为正或全部为负。
与现有技术相比,本申请实施例针对非逐点预测模式下的变换系数进行编码时,将变换系数中的直流系数和交流系数划分为不同系数组,再进行系数值的编码,避免对同一系数组中相对频率较低的直流系数和相对频率较高的交流系数采用相同码长的定长编码,从而提高了编码效率。
在同一系数组中,由于分组方式或系数类型的原因,可能会存在少数几个(如一个或两个)超过系数组均值较多的系数值,例如将直流系数和交流系数划分在同一系数组时,直流系数与交流系数的差值较大,或是预测值在扫描获得的预测组外时,预测值可能与当前像素值的差较大。因此,本申请实施例还提供一种系数解码方法,应用于解码单元301,该系数解码方法对系数组中系数值对应的定长编码的码长(coding length)进行调节,不同位置的系数值可以采用不同码长的定长编码进行解析。相对于S601-S603,该系数解码方法仅在确定系数组对应的码长(coding length)以及根据该系数组对应码长的定长编码对系数进行解析的步骤存在差异,相同部分在此不再赘述。
在一个例子中,S601中确定系数组对应的码长的步骤可以如下:
首先,解码单元301从码流中解析系数组对应定长编码的码长coding length和码长附加值A。
码长附加值A可以是编码单元205在对系数值进行编码时,针对系数组中系数值超过系数组均值较多的特定位置设置的数值A,该数值A等于特定位置的系数值对应的定长编码的码长与该系数组对应的定长编码的码长的差。例如,对于编码单元301,系数组中最大的系数值为9,第二大的系数值为3,系数值3对应的coding length为2,系数值9对应的coding length为4,则A=4-2=2。
其次,解码单元301确定系数组中的特定位置。
特定位置可以是编码单元205和解码单元301在编码一致性中约定,也可以是编码单元301根据上下文信息导出,例如前一待解码单元的某位置为特定位置,则确定当前待解码单元的对应位置为特定位置。
然后,解码单元301确定系数组中特定位置对应定长编码的码长为coding length+A,除特定位置外的系数对应定长编码的码长为coding length。
根据该系数组对应码长的定长编码对系数进行解析的步骤,可以是使用码长为 coding length+A的定长编码对特定位置的系数码进行解析,使用码长为coding length的定长编码对除特定位置外的其他系数码进行解析。
在一个例子中,本实施例还可以在系数组对应的coding length较短时进行如下操作,例如编码单元205和解码单元301通过编码一致性约定码长阈值B,并在码流中携带系数值范围数据C,系数值范围数据C用于表示系数值的绝对值是否小于2^(coding length-3)。
S601中确定系数组对应的码长的步骤可以包括:在coding length小于码长阈值B时,解码单元301确定该系数组所有系数码对应码长为coding length。
S602中,解码单元301在coding length大于或等于码长阈值B时,根据系数值范围数据C确定每个系数码的绝对值是否小于2^(coding length-3),若是,使用coding length-3对应的定长编码对系数码进行解析,若否,使用coding length对应的定长编码对系数码进行解析。
在一个例子中,本实施例还可以将系数组的码长coding length变换为k阶指数哥伦布解码,例如编码单元205和解码单元301通过编码一致性约定码长阈值D。
S601中确定系数组对应的码长的步骤可以包括:在系数组的coding length小于码长阈值D时,解码单元301确定该系数组所有系数码对应码长为coding length。在系数组的coding length大于或等于码长阈值D时,解码单元301引入阶数k=(coding length-5)的k阶数哥伦布解码获得系数码对应的码长。其中,k的值可以使用其他变换方法,由coding length导出。后续S602的系数码解析方式仍然是采用系数码对应码长的定长编码进行解析,在此不再赘述。
在一个例子中,若系数组中系数码个数较多时,例如系数码个数大于N时,S601中确定系数组对应的码长的步骤可以包括:解码单元301通过定长解码方式解析系数组的码长为coding length,在coding length不等于预设值E时,该系数组中所有系数码对应的码长为coding length。在coding length等于预设值E时,确定该系数组中系数值不大于0的系数为0,确定该系数组中大于0的位置的系数码对应的码长为coding length。在可选的示例中,预设值E可以为2、3等,N的值可以大于4。
应当理解的是,本实施例中可以将一个系数组中某一个或多个位置的系数码对应的定长编码的码长视为系数位码长,将该系数组中其他位置对应的共用的定长编码的码长视为系数组码长。
与现有技术相比,通过对系数组中系数对应的码长进行变更,对系数值中不同系数码采用不同码长对应的定长编码进行解析,能够使用特殊码长的定长编码对某位置的系数码进行解析,其他位置仍然使用较短码长的定长编码进行解析,减少了整体编码长度,提高了编码效率。
除了对系数组的定长编码的码长进行调节,本实施例还提供了一种系数解码方法,应用于解码单元301,在编码时对系数组中的系数值进行调节,在解码时对系数值进行还原,减少了系数值的整体编码长度。相对于S601-S603,系数解码方法仅在根据该系数组对应码长的定长编码对系数进行解析的步骤存在差异,相同部分在此不再赘述。
在一个例子中,在根据该系数组对应码长的定长编码对系数进行解析的步骤中,解码单元301先采用该系数组对应码长的定长编码解析所有系数值,针对特定位置,对系数值进行移位,即coefficient=coefficient<<F。使用定长编码解码方式解析F得到delda_coefficient,将系数组中所有特殊位置的已解析获得的系数值加上delda_coefficient。上述特定位置可以是编码单元205和解码单元301在编码一致性中约定,也可以是编码单元301根据上下文信息导出,例如前一待解码单元的某位置为特定位置,则确定当前待解码单元的对应位置为特定位置。
在一个例子中,解码单元301通过S601获取的系数组信息中包括该系数组的码长阈值和系数附加值G。下面对码长阈值和系数附加值G的设置进行说明,编码单元205 在进行系数编码过程中,若某系数值对应的定长编码的码长大于系数组的码长阈值,则将该系数值减去系数附加值G,对该系数值减去系数附加值G的结果进行编码,其中码长阈值和系数附加值G可以根据系数组的系数值具体大小进行灵活设定。解码单元301在根据该系数组对应码长的定长编码对系数进行解析的步骤中,若定长码coding length大于码长阈值,则先采用码长为coding length的定长编码解析系数附加值G的编码,获得系数附加值G,再采用码长为coding length的定长编码解析系数组中的所有系数值,并将所有系数值与系数附加值G相加,从而将系数值还原。
与现有技术相比,在编码时对系数组中的系数值进行调节,然后在解码时基于码流传输的参数对系数组中特定位置的系数进行还原,无需在码流传输时携带较长的完整系数编码,提高了编码效率。
除了对系数组的定长编码的码长和系数组中的系数值进行调节,本实施例还提供了一种系数解码方法,应用于解码单元301,在编码时对系数组的边界符号进行调节,通过边界符号进一步扩大解码范围。
在一个例子中,系数组信息的边界符号不仅可以用1比特表示系数组中绝对极值的正负,还可以用n比特表示系数补偿值。则S603在根据码长为coding length的定长编码对系数码进行解析后,针对解析值等于绝对极值2^(coding length-1)的系数码位置,再从边界符号中解析系数补偿值,将该系数组中的绝对极值加上系数补偿值,作为该绝对极值位置的系数值。可选地,还可以采用边界符号表示系数补偿值的正负。应当理解的是,若同一系数组中存在多个绝对极值,则系数补偿值也可以为多个,将绝对极值分别加上对应的系数补偿值则可获得补偿后的系数值。应当理解的是,本实施例中解码单元301需要解析边界符号码获得边界符号,该解析方式可以采用定长解码、截断一元码、霍夫曼解码或几种常见的解码方式的混合解码方式等。
相应地,本申请实施例提供一种系数解码装置,该系数解码装置可以例如为通话过程中的任一系数解码装置,根据上述方法示例可以对该系数解码装置进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本发明实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用对应各个功能划分各个功能模块的情况下,图13示出上述实施例中所涉及的系数解码装置的一种可能的结构示意图。如图13所示,该系数解码装置13包括解析模块131、解码模块132。
在一种实施例中,上述解析模块131用于获得待解码单元的系数组信息,待解码单元的系数被划分包括为一个或多个系数组,每个系数组包括至少一个系数码,同一系数组中的系数码为同一码长的定长编码,至少一个系数组包括第一系数组,系数组信息包括第一系数组的边界符号。解码模块132用于将第一系数组的系数码解析为系数值,还用于根据边界符号确定第一系数组中的系数值为正值或负值。
上述系数解码装置的各个模块还可以用于执行上述方法实施例中的其他动作,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
图14为本申请实施例提供的一种电子设备的硬件结构图。如图14所示,该电子设备可包括图像解码器141、存储器142以及通信接口(未示出)。存储器142存储有能够被图像解码器141执行的计算机指令,图像解码器141用于执行计算机指令,以实现本申请上述任意实施例公开的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机指令时,全部或部 分地产生按照本申请实施例中的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))方式或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包括一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质(例如,软盘、磁盘、磁带)、光介质(例如,数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state drives,SSD))等。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:快闪存储器、移动硬盘、只读存储器、随机存取存储器、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (19)

  1. 一种系数解码方法,其特征在于,包括:
    解析码流,获得待解码单元的系数组信息,所述待解码单元的系数被划分包括至少一个系数组,每个系数组包括至少一个系数码,同一系数组中的系数码为同一码长的定长编码,所述至少一个系数组包括第一系数组,所述系数组信息包括所述第一系数组的边界符号;
    将所述第一系数组的系数码解析为系数值;
    根据所述边界符号确定所述第一系数组中的系数值为正值或负值。
  2. 根据权利要求1所述的系数解码方法,其特征在于,所述系数组信息还包括所述第一系数组的码长和图像位宽,所述码长用于表示所述第一系数组对应的定长编码的长度,所述将所述第一系数组的系数码解析为系数值,包括:
    若所述码长大于或等于所述图像位宽,则采用长度为与所述图像位宽等长的定长编码将所述第一系数组的系数码解析为系数值;
    若所述码长小于所述图像位宽,则采用长度为所述码长的定长编码将所述第一系数组的系数码解析为系数值。
  3. 根据权利要求1所述的系数解码方法,其特征在于,所述根据所述边界符号确定所述第一系数组中的系数值为正值或负值,包括:
    在所述第一系数组中存在绝对极值的情况下,根据所述边界符号确定所述第一系数组中的系数值的绝对值等于所述绝对极值的系数的符号全部为正或全部为负,所述绝对极值为所述码长的定长编码值范围的最大绝对值。
  4. 根据权利要求3所述的系数解码方法,其特征在于,所述第一系数组包括1个或多个系数块,所述边界符号包括所述每个系数块的边界符号,所述根据所述边界符号确定所述第一系数组中的系数值为正值或负值,包括:
    针对任一系数块,在所述系数块中存在绝对极值的情况下,根据所述系数块的边界符号确定所述系数块中的系数值的绝对值等于所述绝对极值的系数的符号全部为正或全部为负。
  5. 根据权利要求1-4中任一项所述的系数解码方法,其特征在于,所述第一系数组中的系数为残差系数、变换系数或原始像素值。
  6. 根据权利要求5所述的系数解码方法,其特征在于,所述至少一个系数组中包括直流系数组和交流系数组,所述第一系数组为直流系数组或交流系数组。
  7. 根据权利要求6所述的系数解码方法,其特征在于,所述码长在所述系数组信息中为码长码形式,所述边界符号在所述系数组信息中为边界符号码形式;
    在所述第一系数组中的系数码表示变换系数,且所述第一系数组为直流系数组的情况下,所述系数解码方法还包括:采用定长码解析所述码长码,获得所述码长;采用长度为所述码长的定长编码解析直流系数值,采用固定码长为1解析所述边界符号码,获得所述边界符号。
  8. 根据权利要求5所述的系数解码方法,其特征在于,所述系数解码方法还包括:
    根据所述码流中确定所述待解码单元的分组方式;
    从所述码流中获取当前编码单元的预测模式,基于所述预测模式导出扫描方式;
    根据所述扫描方式扫描所述待解码单元,获得扫描结果;
    根据所述分组方式从所述扫描结果中提取所述第一系数组。
  9. 一种系数解码装置,其特征在于,包括:
    解析模块,用于解析码流,获得待解码单元的系数组信息,所述待解码单元的系数被划分包括至少一个系数组,每个系数组包括至少一个系数码,同一系数组中的系数码为同一码长的定长编码,所述至少一个系数组包括第一系数组,所述系数组信息包括所述第一系数组的边界符号;
    解码模块,用于将所述第一系数组的系数码解析为系数值;
    所述解码模块还用于根据所述边界符号确定所述第一系数组中的系数值为正值或负值。
  10. 一种图像解码器,其特征在于,用于执行如权利要求1至8任一项所述的系数解码方法。
  11. 一种电子设备,其特征在于,包括图像解码器、通信接口以及存储器;所述图像解码器用于执行操作,所述操作包括:
    解析码流,获得待解码单元的系数组信息,所述待解码单元的系数被划分包括至少一个系数组,每个系数组包括至少一个系数码,同一系数组中的系数码为同一码长的定长编码,所述至少一个系数组包括第一系数组,所述系数组信息包括所述第一系数组的边界符号;
    将所述第一系数组的系数码解析为系数值;
    根据所述边界符号确定所述第一系数组中的系数值为正值或负值。
  12. 根据权利要求11所述的电子设备,其特征在于,所述系数组信息还包括所述第一系数组的码长和图像位宽,所述码长用于表示所述第一系数组对应的定长编码的长度,所述将所述第一系数组的系数码解析为系数值,包括:
    若所述码长大于或等于所述图像位宽,则采用长度为与所述图像位宽等长的定长编码将所述第一系数组的系数码解析为系数值;
    若所述码长小于所述图像位宽,则采用长度为所述码长的定长编码将所述第一系数组的系数码解析为系数值。
  13. 根据权利要求11所述的电子设备,其特征在于,所述第一系数组包括多个系数块,所述边界符号包括所述每个系数块的边界符号,所述根据所述边界符号确定所述第一系数组中的系数值为正值或负值,包括:
    针对任一系数块,在所述系数块中存在绝对极值的情况下,根据所述系数块的边界符号确定所述系数块中的系数值的绝对值等于所述绝对极值的系数的符号全部为正或全部为负。
  14. 根据权利要求13所述的电子设备,其特征在于,所述第一系数组包括多个系数块,所述边界符号包括所述每个系数块的边界符号,所述根据所述边界符号确定所述第一系数组中的系数值为正值或负值,包括:
    针对任一系数块,在所述系数块中存在绝对极值的情况下,根据所述系数块的边界符号确定所述系数块中的系数值的绝对值等于所述绝对极值的系数的符号全部为正或全部为负。
  15. 根据权利要求11-14中任一项所述的电子设备,其特征在于,所述第一系数组中的系数为残差系数、变换系数或原始像素值。
  16. 根据权利要求15所述的电子设备,其特征在于,所述至少一个系数组中包括直流系数组和交流系数组,所述第一系数组为直流系数组或交流系数组。
  17. 根据权利要求16所述的电子设备,其特征在于,所述码长在所述系数组信息中为码长码形式,所述边界符号在所述系数组信息中为边界符号码形式;
    在所述第一系数组中的系数码表示变换系数,且所述第一系数组为直流系数组的情况下,所述操作还包括:采用定长码解析所述码长码,获得所述码长;采用长度为所述码长的定长编码解析所述边界符号码,获得所述边界符号。
  18. 根据权利要求15所述的电子设备,其特征在于,所述操作还包括:
    根据所述码流中确定所述待解码单元的分组方式;
    从所述码流中获取当前编码单元的预测模式,基于所述预测模式导出扫描方式;
    根据所述扫描方式扫描所述待解码单元,获得扫描结果;
    根据所述分组方式从所述扫描结果中提取所述第一系数组。
  19. 一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1至8任一项所述的系数解码方法。
PCT/CN2023/070728 2022-01-19 2023-01-05 系数解码方法、装置、图像解码器及电子设备 WO2023138391A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210062532.2 2022-01-19
CN202210062532.2A CN116074525A (zh) 2022-01-19 2022-01-19 一种系数解码方法、装置、图像解码器及电子设备

Publications (1)

Publication Number Publication Date
WO2023138391A1 true WO2023138391A1 (zh) 2023-07-27

Family

ID=86173700

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/070728 WO2023138391A1 (zh) 2022-01-19 2023-01-05 系数解码方法、装置、图像解码器及电子设备

Country Status (2)

Country Link
CN (3) CN116074525A (zh)
WO (1) WO2023138391A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190208225A1 (en) * 2018-01-02 2019-07-04 Qualcomm Incorporated Sign prediction in video coding
CN110650343A (zh) * 2018-06-27 2020-01-03 中兴通讯股份有限公司 图像的编码、解码方法及装置、电子设备及系统
CN112995671A (zh) * 2021-02-21 2021-06-18 腾讯科技(深圳)有限公司 视频编解码方法、装置、计算机可读介质及电子设备

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190208225A1 (en) * 2018-01-02 2019-07-04 Qualcomm Incorporated Sign prediction in video coding
CN110650343A (zh) * 2018-06-27 2020-01-03 中兴通讯股份有限公司 图像的编码、解码方法及装置、电子设备及系统
CN112995671A (zh) * 2021-02-21 2021-06-18 腾讯科技(深圳)有限公司 视频编解码方法、装置、计算机可读介质及电子设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZHOU, TIANYANG ET AL.: "CE-3.1 and CE-3.2: Transform coefficients range extension for high bit-depth coding", JOINT VIDEO EXPERTS TEAM (JVET) OF ITU-T SG 16 WP 3 AND ISO/IEC JTC 1/SC 29 22ND MEETING, BY TELECONFERENCE, 20–28 APR. 2021 JVET-V0047, 13 April 2021 (2021-04-13), XP030294031 *

Also Published As

Publication number Publication date
CN116489370A (zh) 2023-07-25
TW202335505A (zh) 2023-09-01
CN116074525A (zh) 2023-05-05
CN116600130A (zh) 2023-08-15

Similar Documents

Publication Publication Date Title
TWI624172B (zh) 基於調色板之視訊寫碼
WO2015194187A1 (en) Harmonized palette coding
TWI750624B (zh) 編解碼變換係數的方法及裝置
JP7343669B2 (ja) Vvcにおける色変換のための方法及び機器
KR20220104309A (ko) 적응형 컬러 공간 변환 코딩
KR20190029796A (ko) 디스플레이 스트림 압축 (dsc) 을 위한 엔트로피 코딩 기법들
TW201725905A (zh) 用於非4:4:4色度子採樣之顯示串流壓縮(dsc)之熵寫碼技術
JP7297918B2 (ja) ビデオ符号化のための色変換
CN116506614A (zh) 一种视频译码方法、装置及存储介质
WO2022174660A1 (zh) 视频编解码方法、装置、计算机可读介质及电子设备
TW201737706A (zh) 用於顯示串流壓縮之基於向量之熵寫碼的裝置及方法
WO2024022359A1 (zh) 一种图像编解码方法及装置
WO2023083225A1 (zh) 视频编解码方法及装置
US20230042484A1 (en) Decoding method and coding method for unmatched pixel, decoder, and encoder
WO2023138391A1 (zh) 系数解码方法、装置、图像解码器及电子设备
CN116489373A (zh) 一种图像解码方法、编码方法及装置
CN116366847A (zh) 一种视频图像解码方法、装置及存储介质
TWI840086B (zh) 係數解碼方法、裝置、圖像解碼器及電子設備
WO2023083245A1 (zh) 解码方法、编码方法及装置
WO2023138562A1 (zh) 图像解码方法、图像编码方法及相应的装置
WO2023138532A1 (zh) 一种视频解码方法、装置、视频解码器及存储介质
EP4117289A1 (en) Image processing method and image processing device
JP2023521678A (ja) 組み合わせられた可逆及び非可逆符号化のための方法及びシステム
JP2022548685A (ja) 画像データの符号化及び復号化

Legal Events

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

Ref document number: 23742707

Country of ref document: EP

Kind code of ref document: A1