WO2012113328A1 - 一种变换系数块的扫描方法和装置 - Google Patents
一种变换系数块的扫描方法和装置 Download PDFInfo
- Publication number
- WO2012113328A1 WO2012113328A1 PCT/CN2012/071432 CN2012071432W WO2012113328A1 WO 2012113328 A1 WO2012113328 A1 WO 2012113328A1 CN 2012071432 W CN2012071432 W CN 2012071432W WO 2012113328 A1 WO2012113328 A1 WO 2012113328A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- block
- texture
- scan order
- scanning
- transform coefficient
- Prior art date
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods 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/18—Methods 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/129—Scanning of coding units, e.g. zig-zag scan of transform coefficients or flexible macroblock ordering [FMO]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/136—Incoming video signal characteristics or properties
- H04N19/14—Coding unit complexity, e.g. amount of activity or edge presence estimation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/146—Data rate or code amount at the encoder output
- H04N19/147—Data rate or code amount at the encoder output according to rate distortion criteria
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods 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/17—Methods 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/176—Methods 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/46—Embedding additional information in the video signal during the compression process
Definitions
- the present invention relates to the field of communications technologies, and in particular, to a scanning method and apparatus for transform coefficient blocks in video encoding and decoding.
- the scanning of transform coefficient blocks is an integral part of video coding and decoding techniques.
- the scanning of the transform coefficient block has the following applications:
- the video encoding end scans the transformed two-dimensional transform coefficient block in the transform domain by the video encoding end, and converts the two-dimensional transform coefficient in the transform coefficient block into one-dimensional A sequence of transform coefficients.
- the scanning order needs to be selected according to the transformation mode of the current transform coefficient block, so that the scanned one-dimensional transform coefficient sequence tends to be arranged from large to small, thereby improving coding efficiency;
- at the video decoding end by video
- the decoding end converts the one-dimensional transform coefficient sequence into a two-dimensional transform coefficient block according to the transform mode and selects the reverse scan order.
- transforming the prediction residual is performed to obtain transform coefficients, and before performing transform coefficient scanning, reference block information and quantized transform coefficient information may also be obtained;
- a set of optimal scan modes is selected by the rate distortion optimization criterion from the following three scan modes: Z-scan mode, horizontal scan mode, and vertical scan mode; then the selected scan mode pair transform is used.
- the coefficients are scanned, and the selection information of the scan mode is encoded into the code stream and transmitted to the decoding end.
- the mode Since the mode is selected in the three scanning modes at the encoding end of the video, the complexity of the encoding end is high. In addition, the selection information of the scanning mode needs to be encoded into the code stream, which affects the compression coding efficiency.
- Embodiments of the present invention provide a scanning method and apparatus for transform coefficient blocks, which improve compression coding efficiency. Rate.
- An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
- the texture embodies a variation rule of the transform coefficient block of the block to be coded in each of the transform coefficients
- the preset candidate scan order includes a scan order other than a Z-scan sequence
- the rate distortion is preferably processed for the Z-scan sequence and the selected scan order to obtain a preferred scan order
- the transform coefficient block of the block to be encoded is scanned according to a preferred scanning order
- the transform coefficient block of the block to be encoded is reset to a transform coefficient block scanned in a scan order of a predetermined rule; Transmitting a block of transform coefficients of the block to be encoded after the reset;
- An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
- Parsing the code stream to obtain indication information if the indication information of the received code stream indicates that the scanning order is not a zigzag scanning order, detecting a texture of the decoded block as a reference of the to-be-decoded block, the texture embodies the waiting Converting a transform coefficient block of the transform block to a variation rule of the transform coefficients in each of the directions; selecting a scan order corresponding to the texture from a preset candidate scan order; the preset candidate scan order includes a scan order other than the Z-shaped scan order Scanning order
- the transform coefficient block of the block to be decoded is reset to be selectable according to the selected scan order according to the selected scan order and the scan order of the predetermined rule. Scanned transform coefficient block.
- An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
- the texture embodies a variation rule of the transform coefficient block of the block to be coded in each of the transform coefficients
- the preset candidate scan order includes a Z-scan order and a scan order other than the Z-scan order; If the selected scanning order is a zigzag scanning order, the transform coefficient blocks of the block to be encoded are scanned in a zigzag scanning order; if the selected scanning order is a scanning order other than the zigzag scanning order, the coding sequence is to be encoded
- the transform coefficient block of the block is reset to a transform coefficient block conforming to the zigzag scan order; the transform coefficient block of the reset block to be encoded is scanned in a zigzag scan order.
- An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
- the preset candidate scan order includes a Z-scan order and a scan order other than the Z-scan order;
- the transform coefficient blocks of the block to be decoded are scanned according to a Z-shaped scanning order
- the transform coefficient block of the block to be decoded is reset from the transform coefficient block conforming to the Z-shaped scanning order to the transform coefficient block conforming to the selected scanning order;
- the transformed transform coefficient block of the block to be decoded after being scanned is scanned according to the selected scanning manner.
- An embodiment of the present invention provides a scanning device for transforming coefficient blocks, including:
- a first detecting unit configured to detect a texture of the encoded block as a reference of the block to be encoded, where the texture embodies a variation rule of the transform coefficient block of the block to be encoded in each of the transform coefficients; And a scan order corresponding to the texture is selected from a preset candidate scan order; the preset candidate scan order includes a scan order other than a Z-scan sequence; and the first processing unit is configured to preset The Z-scan sequence and the selected scan order are subjected to rate distortion optimization processing to obtain a preferred scan order;
- a first reset unit configured to reset a transform coefficient block of the block to be encoded to a transform coefficient block scanned in a scan order of a predetermined rule, if the preferred scan order is a scan order other than a Z-scan sequence;
- a first scanning unit configured to scan a transform coefficient block of the block to be coded according to a preferred scan order if the preferred scan order is a Z-scan sequence; if the preferred scan order is a scan order other than the Z-scan order, Scanning the transformed coefficient block of the block to be encoded after the reset according to the scanning order of the predetermined rule;
- the first coding unit is configured to encode the indication information of whether the scanning order used for scanning is a Z-shaped scanning order into the code stream.
- An embodiment of the present invention provides a scanning device for transforming coefficient blocks, including:
- a second parsing unit configured to parse the code stream to obtain indication information
- a second detecting unit configured to: if the indication information of the received code stream indicates that the scanning order is not a Z-shaped scanning order, detect a texture of the encoded or decoded block that is a reference of the block to be decoded, where the texture reflects the The variation law of the transform coefficient block of the decoding block in the transform coefficients of the respective parties;
- a second selecting unit configured to select a scan order corresponding to the texture from a preset candidate scan order;
- the preset candidate scan order includes a scan order other than a Z-scan sequence; and the second scan unit uses Scanning the transform coefficient block of the decoded block in a scan order according to a predetermined rule;
- a second reset unit configured to: if the selected scan order is different from the scan order of the predetermined rule, the transform coefficient block of the block to be decoded is heavy according to the selected scan order and the scan order of the predetermined rule after the end of the scan Set to a block of transform coefficients that can be scanned in the selected scan order.
- An embodiment of the present invention provides a scanning device for transforming coefficient blocks, including:
- a third detecting unit configured to detect a texture of the encoded block as a reference of the block to be encoded, where the texture embodies a variation rule of the transform coefficient block of the block to be encoded in each of the transform coefficients; And a scan order corresponding to the texture is selected from a preset candidate scan order; the preset candidate scan order includes a zigzag scan order and other scan orders than a zigzag scan order;
- a third reset unit configured to reset a transform coefficient block of the block to be coded into a transform coefficient block conforming to a Z-shaped scan order if the selected scan order is other scan order than the Z-scan sequence;
- a third scanning unit configured to: if the selected scanning order is a Z-shaped scanning order, scan the transform coefficient block of the to-be-coded block according to a Z-shaped scanning order; or, according to the Z-shaped scanning order, the resetted position The transform coefficient block of the coded block is scanned for scanning.
- An embodiment of the present invention provides a scanning device for transforming coefficient blocks, including:
- a fourth detecting unit configured to detect a texture of a decoded block that is a reference of the block to be decoded, where the texture reflects a variation rule of a transform coefficient block of the block to be decoded in each of the transform coefficients
- a fourth selecting unit configured to select a scan order corresponding to the texture from a preset candidate scan order; the preset candidate scan order includes a Z-scan order and a scan order other than a Z-scan order;
- a fourth reset unit configured to reset the transform coefficient block of the block to be decoded from the transform coefficient block conforming to the Z-scan order to the selection if the selected scan order is other than the Z-scan order a transform coefficient block of the scan order;
- a fourth scanning unit configured to scan a transform coefficient block of the block to be decoded according to a zigzag scan order if the selected scan order is a z-scan sequence; or, after the reset according to the selected scan mode The transform coefficient block of the block to be encoded is scanned.
- An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
- the texture embodies a variation rule of the transform coefficient block of the block to be coded in each of the transform coefficients
- the residual data block of the block to be coded is reset, so that the transform coefficient block corresponding to the residual data block is a transform coefficient block scanned according to a predetermined rule.
- the transform coefficient blocks of the block to be encoded are scanned in a preferred scan order, and the preferred scan order is a scan order obtained by performing rate distortion optimization processing on a Z-scan sequence and a predetermined rule scan order;
- An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
- the indication information of the code stream indicates that the scan order is not a zigzag scan, detecting a texture of the decoded block as a reference of the block to be decoded, where the texture reflects that the transform coefficient block of the block to be decoded is transformed in all directions a variation rule of the coefficient; if the scan order corresponding to the texture is different from the scan order of the predetermined rule, the block to be decoded is to be decoded according to the scan order corresponding to the texture and the scan order of the predetermined rule after the end of the inverse transform
- the difference data block is reset, and the transform coefficient block corresponding to the residual data block is a transform coefficient block that can be scanned in a scan order of a predetermined rule.
- An embodiment of the present invention provides a method for scanning a transform coefficient block, including: Detecting a texture of the coded block as a reference of the block to be coded, the texture embodies a variation rule of the transform coefficient block of the block to be coded in each of the transform coefficients;
- the residual data block of the block to be coded is reset, so that the transform coefficient block corresponding to the residual data block is a transform coefficient block scanned according to a predetermined rule.
- the embodiment of the present invention provides a method for scanning a block of transform coefficients, including:
- the residual data block of the block to be decoded is reset according to the scan order corresponding to the texture and the scan order of the predetermined rule. And transforming the transform coefficient block corresponding to the residual data block into a transform coefficient block that can be scanned in a scan order of a predetermined rule.
- An embodiment of the present invention provides a scanning device for transforming coefficient blocks, including:
- a fifth detecting unit configured to detect a texture of the encoded block as a reference of the block to be encoded, where the texture reflects a variation rule of the transform coefficient block of the block to be encoded in each of the transform coefficients; And if the scanning order corresponding to the texture is inconsistent with the scanning order of the predetermined rule, the residual data block of the to-be-coded block is reset, so that the transform coefficient block corresponding to the residual data block is scanned according to a predetermined rule.
- Transform coefficient block
- a fifth processing unit configured to perform a rate-distortion optimization process on the preset Z-scan sequence and the scan order of the predetermined rule to obtain a preferred scan order
- a fifth scanning unit configured to scan a transform coefficient block of the block to be coded according to a preferred scan order
- a fifth coding unit configured to encode the indication information of whether the scanning order used for scanning is a Z-shaped scanning order into the code stream.
- An embodiment of the present invention provides a scanning device for transforming coefficient blocks, including:
- a sixth parsing unit configured to parse the code stream to obtain indication information
- a sixth scanning unit configured to perform a transform coefficient block of the block to be decoded according to the parsed scan order Scan
- a sixth detecting unit configured to: if the indication information of the code stream indicates that the scanning order is not a zigzag scanning, detect a texture of the decoded block that is a reference of the to-be-decoded block, where the texture reflects a transformation of the to-be-decoded block The variation law of the coefficient of transformation of the coefficient block in each direction;
- a sixth reset unit configured to: if the scan order corresponding to the texture is different from the scan order of the predetermined rule, after the end of the inverse transform, the scan order corresponding to the texture and the scan order of the predetermined rule are to be decoded
- the residual data block of the block is reset, so that the transform coefficient block corresponding to the residual data block is a transform coefficient block that can be scanned in a scan order of a predetermined rule.
- An embodiment of the present invention provides a scanning device for transforming coefficient blocks, including:
- a seventh detecting unit configured to detect a texture of the encoded block as a reference of the block to be encoded, where the texture reflects a variation rule of the transform coefficient of the block to be encoded in each of the transform coefficients; And if the scanning order corresponding to the texture is inconsistent with the scanning order of the predetermined rule, the residual data block of the to-be-coded block is reset, so that the transform coefficient block corresponding to the residual data block is scanned according to a predetermined rule.
- Transform coefficient block
- a seventh scanning unit configured to scan a transform coefficient block of the coded block according to a scan order of a predetermined rule
- An embodiment of the present invention provides a scanning device for transforming coefficient blocks, including:
- An eighth scanning unit configured to scan a transform coefficient block of the block to be decoded according to a scan order of a predetermined rule
- An eighth detecting unit configured to detect a texture of a decoded block that is a reference of the block to be decoded, where the texture reflects a variation rule of a transform coefficient block of the block to be decoded in each of the transform coefficients;
- An eighth reset unit configured to: if the scan order corresponding to the texture is different from the scan order of the predetermined rule, after the inverse transform ends, the scan order corresponding to the texture and the scan order of the predetermined rule are to be decoded
- the residual data block of the block is reset, so that the transform coefficient block corresponding to the residual data block is a transform coefficient block that can be scanned in a scan order of a predetermined rule.
- the above technical solution only needs to select between the predetermined scanning order and the Z-shaped scanning order, and is an alternative of two choices. Compared with the selection in the three-choice one, one less one can be used to carry the selected information, so When coding the encoding header information, it saves resources; in addition, it is more efficient when it is selected. DRAWINGS
- FIG. 1 is a schematic flowchart of a method according to an embodiment of the present invention.
- FIG. 2A is a schematic diagram showing a scanning sequence of a vertical texture according to an embodiment of the present invention.
- 2B is a schematic diagram of a scanning sequence of a horizontal texture according to an embodiment of the present invention.
- 2C is a schematic diagram showing a scanning sequence of a diagonal texture according to an embodiment of the present invention.
- FIG. 3 is a schematic flowchart of a method according to an embodiment of the present invention.
- FIG. 4 is a schematic flowchart of a method according to an embodiment of the present invention.
- FIG. 5 is a schematic flowchart of a method according to an embodiment of the present invention.
- FIG. 6 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
- FIG. 7 is a schematic structural view of an apparatus according to an embodiment of the present invention.
- FIG. 8 is a schematic structural view of an apparatus according to an embodiment of the present invention.
- FIG. 9 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
- FIG. 10 is a schematic flowchart of a method according to an embodiment of the present invention.
- FIG. 11 is a schematic flowchart of a method according to an embodiment of the present invention.
- FIG. 13 is a schematic flowchart of a method according to an embodiment of the present invention.
- FIG. 14 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
- Figure 15 is a schematic structural view of an apparatus according to an embodiment of the present invention.
- 16 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
- FIG. 17 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
- an optimal inter-frame coding type is selected according to a rate-distortion criterion from various inter-coding types, and motion information is obtained at the same time, and motion information is obtained.
- the encoded reconstructed frame information obtains a predicted value of the block to be coded, and performs a difference between the predicted value and the pixel value of the block to be coded to obtain a residual value, and sequentially transforms, quantizes, scans, and entropy encodes the residual value , the code stream is programmed, and the motion information is programmed into the code stream to complete the encoding process.
- the scanning in the encoding and decoding process will be specifically described below.
- the transform mentioned in the embodiment of the present invention may be a Discrete Cosine Transform (DCT); or a multi-transformation technique, such as a KL transform (KLT), which is not limited in this embodiment of the present invention.
- DCT Discrete Cosine Transform
- KLT KL transform
- a scanning method of a transform coefficient block which can be executed at the encoding end, as shown in FIG. 1, and includes:
- the above 101 belongs to a physical derivation, and the encoded texture as a reference approximates the texture of the current block to be encoded, and the texture to be encoded is similar to the residual texture to be encoded, and the distribution law of the transform coefficients is closely related to the residual texture.
- the above texture includes a horizontal texture, a vertical texture, and a diagonal texture; wherein the oblique texture can also be regarded as no texture.
- the detecting the texture of the decoded block includes:
- a horizontal gradient value in a horizontal direction of the transform coefficient block and a vertical gradient value in a vertical direction are calculated;
- the horizontal gradient value is a sum of absolute values of difference values of adjacent pixel points in the horizontal direction
- the vertical gradient value is a sum of absolute values of differences of adjacent pixels in the vertical direction;
- the transform coefficient block as a reference is the coefficient of variation block of the decoded block;
- the texture is determined to be a vertical texture, and the vertical gradient value is greater than N times the horizontal gradient value to determine that the texture is a horizontal texture, otherwise the texture is determined to be a diagonal texture;
- the texture is determined to be a vertical texture
- the offset of the horizontal direction of the intra prediction mode direction is within M
- the texture is determined. Is a horizontal texture, otherwise the texture is determined to be a diagonal texture; the above M is the second preset value, and M can also be
- the resolution width is determined, for example, set to 5, and may be set to other values, such as 3, 4, etc., which are not limited in this embodiment of the present invention.
- the embodiment of the present invention further provides an implementation manner of modifying the preset value: if the ratio of the horizontal texture to the vertical texture exceeds the third preset value in the block that has been decoded, the value of N is reduced, if the horizontal texture and the vertical If the ratio of the straight texture is less than N, the value of N is increased.
- the third preset value may be obtained by performing intra-frame coding on a sequence of transform coefficients of different characteristics, and calculating a proportional relationship between the horizontal and vertical prediction directions, and the proportional relationship may be used as the third preset value.
- the texture of the already encoded block or the decoded block is known, and the information may be used to reduce the amount of operations;
- the texture of the detected transform coefficient block includes: detecting to be decoded The block sets the texture of the block or decoded block within the time domain or spatial domain distance, and determines the detected texture as the texture of the transform coefficient block.
- the preset candidate scan order includes a scan order other than the Z-scan order;
- the scanning order corresponding to the above texture includes as shown in FIG. 2A to FIG. 2C: the vertical texture corresponds to the horizontal scanning order of the progressive scanning, the horizontal texture corresponds to the vertical scanning order of the column-by-column scanning, and the oblique texture corresponds to the Z-shaped sequential scanning Z. Shape scan order.
- a 4X4 matrix is taken as an example, in which a circle represents a transformation coefficient, a numerical value under a circle represents a coordinate (i.e., a position) at which a transformation coefficient is located, and an arrow direction represents a scanning direction, that is, a scanning order. It should be noted that the matrix on the left side of FIG.
- the Z-shaped scanning sequence is not limited in the embodiment of the invention.
- the transform coefficient block of the block to be coded is scanned according to a preferred scan order; if the preferred scan order is a scan order other than the Z-scan order, the transform of the block to be coded is performed. Converting the coefficient block to a transform coefficient block scanned in a scan order of a predetermined rule; scanning the block of transform coefficients of the block to be encoded after the reset according to the scan order of the predetermined rule;
- the transform coefficient block of the block to be encoded is reset to be scanned in a scanning order of a predetermined rule.
- Transforming the coefficient block; scanning the transformed coefficient block of the block to be encoded after the reset according to the scanning order of the predetermined rule includes:
- the transform coefficients of the block to be coded are transposed, and the transform coefficient blocks of the transposed block to be coded are scanned according to the second scan order; the first scan order and the first scan order
- the scanning order of the two scanning sequences is symmetrical;
- the transform coefficient blocks of the block to be encoded are scanned in the second scanning order.
- first and second are used to distinguish two scanning sequences having a symmetric relationship, and are not otherwise limited.
- first scanning order if the first scanning order is a horizontal scanning order, the second scanning order is a vertical scanning order, and if the first scanning order is a vertical scanning order, the second scanning order is a horizontal scanning order.
- the transform coefficient block of the block to be coded is reset to a transform coefficient block scanned in a scan order of a predetermined rule; the transform coefficient of the reset block to be coded according to the scan order of the predetermined rule
- the scanning of the block includes: resetting the transform coefficient block of the block to be encoded into a transform coefficient block conforming to the Z-scan order; and scanning the transform coefficient block of the reset block to be encoded according to the Z-scan order. If the method is used, the indication information in 105 may not be transmitted, and the subsequent embodiments will be described in detail.
- the indication that the scan order used for scanning is the Z-scan order is programmed into the code stream.
- the selection is one of the alternatives, and the selected information can be used less than one in the selection of the three-choice one, so When it is programmed into the encoding header information, it saves resources; in addition, it is more efficient when it is selected.
- multiplexing the transform coefficient matrix multiplexing the same entropy coding model can improve the coding efficiency.
- the embodiment further provides an example of an implementation manner of a preset candidate scan sequence, where the preset candidate scan sequence includes:
- the scan rule determines the order of the scan; or, pre-statistically counts the number of transform coefficients of each position of two or more transform coefficient blocks to be non-zero, from large to small
- the positions of the transform coefficients corresponding to the respective non-zero numbers are sequentially arranged, and the order of the positions of the above-described transform coefficients obtained by the arrangement is determined as a preset candidate scan order.
- the quantized residuals can be classified into three categories: horizontal texture The corresponding quantized residual, the quantized residual corresponding to the vertical texture, and the quantized residual corresponding to the oblique texture; the manner of determining the scanning order is: establishing a counter group with the same number of transform coefficients (for example, 16 counters for 4x4 transform) And then counting with a counter, specifically: determining whether each transform coefficient is zero, if non-zero, the corresponding position counter is incremented by one; after the detected number of transform coefficient blocks reaches a set number, each counter has its The value of the count; at this time, the values of the respective counters can be arranged from large to small, and the order of the positions of the above-described transform coefficients obtained by the arrangement can be determined as a preset candidate scan order.
- Example 1 The following describes the scanning process in the encoding process:
- A code according to the encoding process until the transform coefficient is encoded
- inter-frame coding (Inter) is performed, the reference block texture is detected to obtain its texture (horizonous Hor texture, vertical ver texture, oblique texture); if intra-frame coding (Intra) is performed In the case, if the direction of the intra prediction mode (ipmode) is ver +/- 5, the texture is a vertical texture with a direction of Hor +/- 5, the texture is a horizontal texture, and the rest is a diagonal texture.
- the offset set in this embodiment is 5, and may of course be set to other values, which is not limited in this embodiment of the present invention.
- a scan order corresponding to the above texture is selected from the preset candidate scan order based on the obtained texture.
- the detection method in the above B can be:
- a difference is obtained for every two pixel points of the adjacent detection step in the horizontal direction; an absolute value of the accumulated difference value is obtained as a horizontal gradient value;
- Step C is the pre-predetermined value An automatic correction process for setting, which is not a step that must be performed.
- step B detection there may be an alternative to the method of step B detection in the above encoding process: detecting the texture of the already encoded block or the decoded block within the distance of the time domain or the spatial domain to be decoded, and determining the detected texture as the waiting The texture of the transform coefficient block of the decoded block. More specifically, for example, the texture of the decoded block of the periphery of the block to be decoded (upper, left, upper left, upper right, lower left) is detected as the texture of the block of the current transform block to be decoded.
- F Scan the transform coefficient block to be scanned according to the horizontal scanning order and the related entropy coding model, and then continue the subsequent encoding process.
- G encodes and scans the transform coefficient block to be scanned according to the Z-scan order and the related entropy coding model, and then continues the subsequent encoding process.
- step H The above-mentioned scan sequence used for scanning is programmed into the code stream for the indication of the Z-scan order. This step can be performed during the execution of step G or F. It can be understood that after the encoding is completed, the encoded result (code stream) is sent to the decoding end, and other positions of the embodiment of the present invention are not described.
- the embodiment of the present invention further provides scanning of a transform coefficient block performed at the decoding end.
- the method as shown in Figure 3, includes:
- the transform coefficient block of the block to be decoded is scanned according to the Z-shaped scanning sequence; the scanning process ends.
- the indication information of the received code stream indicates that the scanning order is not a Z-shaped scanning order, detecting a texture of the decoded block that is a reference of the to-be-decoded block, where the texture reflects the transform coefficient block of the to-be-decoded block in each a change rule of the transform coefficient in the direction; selecting a scan order corresponding to the texture from the preset candidate scan order; in the embodiment, the preset candidate scan order includes a scan order other than the Z scan order;
- resetting the transform coefficient block of the block to be decoded according to the selected scan order and the scan order of the predetermined rule after the end of the scan may be performed according to the selected scan order.
- Scanned transform coefficient block It can be understood that, in this embodiment, corresponding to the encoding end, the transform coefficient block of the block to be decoded is once reset by the encoding end according to the predetermined rule.
- the transform coefficient block of the block to be decoded is scanned according to the scan order of the predetermined rule; if the scan order selected is different from the scan order of the predetermined rule, after the scan ends, according to the selected scan order and the predetermined rule
- the scan order resets the transform coefficient block of the block to be decoded to a transform coefficient block that can be scanned in the selected scan order, including:
- the selected scan order is the first scan order
- the scanning order is symmetrical, and the second scanning order is the scanning order of the above predetermined rules.
- Example 2 The decoding process is similar to the scanning process of the encoding process:
- A Decode according to the decoding process until the transform coefficient is parsed
- step B parsing the code stream, obtaining indication information, that is, the indication information in step H of the encoding process; determining whether the indication information indicates that the scanning order is a zigzag scanning order; if yes, executing E; otherwise executing C;
- C This step can refer to step B of the first scheme, according to the obtained texture, select the scan order corresponding to the above texture from the preset candidate scan order, and then execute D;
- the transform coefficient blocks to be scanned are parsed and scanned according to the horizontal scanning order and the related entropy coding model, and then the transform coefficients are transposed to continue the subsequent decoding process; if the texture direction corresponds to the horizontal level In the scanning sequence, the transform coefficient blocks to be scanned are parsed and scanned according to the horizontal scanning order and the related entropy coding model, and the subsequent decoding process is continued;
- the above example ones and twos only need to choose between the horizontal and vertical scanning order and the zigzag scanning order, which is the alternative of the two, one compared to the horizontal, vertical and zigzag scanning order (zig-zag)
- the choice between three choices can use one less to carry the selected information, so it saves resources when it is coded into the encoding header information; in addition, it is more efficient at the time of selection.
- Another embodiment of the present invention further provides a scanning method for a transform coefficient block, which is implemented in an encoding device. Further, the instruction information is not further transmitted on the basis of the above two schemes, and the coding efficiency can be further improved. As shown in Figure 4, it includes:
- the candidate scan order preset in this embodiment includes a Z-scan order and a scan order other than the Z-scan order;
- the selected scanning order is a Z-shaped scanning order, scanning the transform coefficient block of the to-be-coded block according to a Z-shaped scanning order; if the selected scanning order is a scanning order other than the Z-shaped scanning order, The transform coefficient block of the coded block is reset to a transform coefficient block conforming to the zigzag scan order; the transform coefficient block of the reset block to be coded is scanned in a zigzag scan order.
- the embodiment of the present invention further provides another method for scanning a transform coefficient block.
- the solution is executed in a decoding device, and the coding efficiency is further improved without transmitting the indication information.
- the method includes:
- Example 1 The following describes the scanning process in the encoding process:
- This step can refer to step B of the first scheme, and select a scan order corresponding to the texture from the preset candidate scan order according to the obtained texture;
- 501 Detect a texture of a decoded block that is a reference of the block to be decoded, where the texture reflects a variation rule of a transform coefficient block of the block to be decoded in each of the transform coefficients.
- the candidate scan order preset in this embodiment includes a Z-scan order and a scan order other than the Z-scan order;
- the selected scanning order is a Z-shaped scanning order, scanning the transform coefficient block of the to-be-decoded block according to a Z-shaped scanning order;
- the transform coefficient block of the block to be decoded is reset from the transform coefficient block conforming to the Z-shaped scanning order to the transform coefficient block conforming to the selected scanning order. And translating the transformed coefficient block of the block to be decoded after the reset according to the scanning mode selected above.
- the corresponding decoding process is similar to the scanning process of the encoding process:
- A Decode according to the decoding process until the transform coefficient is parsed
- step C In this step, referring to step B of the first scheme, the scan order corresponding to the texture is selected from the preset candidate scan order according to the obtained texture;
- D If the texture direction corresponds to the vertical scanning order, the position of the transform coefficient is reset to a positional relationship in accordance with the vertical scanning order; if the texture direction corresponds to the horizontal scanning order, the position of the transform coefficient is reset to a position conforming to the horizontal scanning order Relationship; if the texture direction corresponds to the zigzag scanning order, the step operation is not performed;
- the scan order of the transform coefficients corresponds to a unique frequency domain positional relationship (ie, (0, 0), (0, 1) , ( 1 , 0 ) ... ), so when parsing the scanned point, it can give it a possible value according to the value of the point that has been resolved around the frequency domain (ie, establish an entropy coding model, which can be regarded as A prediction that makes coding more efficient).
- each scanning order can still be performed in a single scanning scheme.
- the embodiment of the present invention can determine whether it is zig-zag and cannot distinguish between horizontal and vertical, so if no operation is performed, in the non-zig-zag, the relationship between the scan order and the frequency domain position cannot be determined. There is no way to establish an entropy coding model, and it cannot be decoded. The above solution solves this problem by resetting.
- Test condition JCTVC high efficiency low delay test condition
- Test results The third column is the result of the technical solution integrated in the TMuC (New Generation Video Coding Test Software Platform), and the fourth column is the result of the solution of the embodiment of the present invention. It can be seen that the embodiment of the present invention has a high efficiency.
- a scanning device for transform coefficient blocks includes:
- a first detecting unit 601 configured to detect a texture of a coded block that is a reference of a block to be coded, where the texture reflects a variation rule of a transform coefficient block of the block to be coded in each of the transform coefficients;
- the first selecting unit 602 For selecting a scan order corresponding to the texture from the preset candidate scan order;
- the preset candidate scan order includes a scan order other than the Z-scan order;
- the first processing unit 603 is configured to preset the Z
- the shape scan order and the selected scan order are subjected to rate distortion optimization processing to obtain a preferred scan order;
- the first reset unit 604 is configured to: if the preferred scan order is a scan order other than the Z-scan sequence, reset the transform coefficient block of the block to be coded into a transform coefficient block scanned in a scan order of a predetermined rule;
- the first scanning unit 605 is configured to scan the transform coefficient block of the block to be coded according to the preferred scan order if the preferred scan order is a Z-scan sequence; if the preferred scan order is a scan order other than the Z-scan order, Scanning the transform coefficient block of the block to be encoded after the reset according to the scanning order of the predetermined rule;
- the first coding unit 606 is configured to encode the indication information of whether the scanning order used for scanning is a Z-shaped scanning order into the code stream.
- a scanning device for transform coefficient blocks includes:
- a second parsing unit 701 configured to parse the code stream to obtain indication information
- the second detecting unit 702 is configured to: if the received information of the code stream indicates that the scanning order is not Z Forming a scanning sequence, detecting a texture of the encoded or decoded block as a reference of the block to be decoded, wherein the texture reflects a variation rule of the transform coefficient block of the block to be decoded in each of the transform coefficients;
- a second selecting unit 703 configured to select a scan order corresponding to the texture from a preset candidate scan order; the preset candidate scan order includes a scan order other than a Z-scan sequence; and the second scan unit 704 uses Scanning the transform coefficient block of the decoded block in a scan order according to a predetermined rule;
- a second reset unit 705, configured to: if the selected scan order is different from the scan order of the predetermined rule, reset the transform coefficient block of the block to be decoded according to the selected scan order and the scan order of the predetermined rule after the scan ends A block of transform coefficients that can be scanned in the selected scan order.
- a scanning device for transform coefficient blocks includes:
- a third detecting unit 801 configured to detect a texture of the encoded block as a reference of the block to be encoded, where the texture reflects a variation rule of the transform coefficient of the block to be encoded in each of the transform coefficients; the third selecting unit 802, And a scan order corresponding to the texture is selected from the preset candidate scan sequences; the preset candidate scan order includes a Z-scan order and a scan order other than the Z-scan order;
- a third reset unit 803, configured to: if the selected scan order is a scan order other than the Z-scan sequence, reset the transform coefficient block of the block to be coded into a transform coefficient block conforming to the Z-scan order;
- the unit 804 is configured to: if the selected scanning order is a Z-shaped scanning order, scan the transform coefficient block of the to-be-coded block according to a Z-shaped scanning order; or: perform the resetting the to-be-coded block according to a Z-shaped scanning order.
- the transform coefficient block is scanned.
- a scanning device for transform coefficient blocks includes:
- a fourth detecting unit 901 configured to detect a texture of the decoded block that is a reference of the to-be-decoded block, where the texture reflects a variation rule of the transform coefficient block of the to-be-decoded block in each of the upward transform coefficients;
- the fourth selecting unit 902 is configured to select a scan order corresponding to the texture from the preset candidate scan order;
- the preset candidate scan order includes a Z-scan order and a scan order other than the Z-scan order;
- the fourth reset unit 903 is configured to reset the transform coefficient block of the block to be decoded from the transform coefficient block conforming to the zigzag scan order to another scan mode if the selected scan order is a zigzag scan order. a transform coefficient block that conforms to the scan order of the above selection;
- a fourth scanning unit 904 configured to: if the selected scanning order is a Z-shaped scanning order, scan the transform coefficient block of the to-be-decoded block according to a Z-shaped scanning order; or, according to the selected scanning manner, the reset The transform coefficient block of the above-mentioned block to be coded is scanned.
- a scanning method of a transform coefficient block which can be executed on the encoding end, as shown in FIG. 10, and includes:
- 1001 Detecting a texture of a coded block that is a reference of a block to be coded, where the texture reflects a variation rule of a transform coefficient block of the block to be coded in each of the transform coefficients;
- the above 1001 belongs to a physical derivation.
- the referenced encoded texture approximates the texture of the current block to be encoded, and the texture to be encoded is similar to the residual texture to be encoded.
- the distribution law of the transform coefficients is closely related to the residual texture.
- the above texture includes a horizontal texture, a vertical texture, and a diagonal texture; wherein the oblique texture can also be regarded as no texture.
- the detecting the texture of the decoded block includes:
- a horizontal gradient value in a horizontal direction of the transform coefficient block and a vertical gradient value in a vertical direction are calculated;
- the horizontal gradient value is a sum of absolute values of difference values of adjacent pixel points in the horizontal direction
- the vertical gradient value is a sum of absolute values of differences of adjacent pixels in the vertical direction;
- the transform coefficient block as a reference is the coefficient of variation block of the decoded block;
- the texture is determined to be a vertical texture, and the vertical gradient value is greater than N times the horizontal gradient value to determine that the texture is a horizontal texture, otherwise the texture is determined to be a diagonal texture;
- the texture is determined to be a vertical texture, and the offset of the horizontal direction of the intra prediction mode direction is determined within M.
- the texture is a horizontal texture, otherwise the texture is determined to be a diagonal texture; the above M is the second preset value, and M can also be determined by the resolution width, for example, set to 5, and can also be set to other values such as 3, 4, etc.
- the embodiment of the invention is not limited.
- the embodiment of the present invention further provides an implementation manner of modifying the preset value: if the ratio of the horizontal texture to the vertical texture exceeds the third preset value in the block that has been decoded, the value of N is reduced, if the horizontal texture and the vertical If the ratio of the straight texture is less than N, the value of N is increased.
- the third preset value may be obtained by performing intra-frame coding on a sequence of transform coefficients of different characteristics, and calculating a proportional relationship between the horizontal and vertical prediction directions, and the proportional relationship may be used as the third preset value.
- the texture of the already encoded block or the decoded block is known, and the information may be used to reduce the amount of operations;
- the texture of the detected transform coefficient block includes: detecting to be decoded The block sets the texture of the block or decoded block within the time domain or spatial domain distance, and determines the detected texture as the texture of the transform coefficient block.
- the residual data block of the block to be coded is reset, so that the corresponding transform coefficient block is a transform coefficient block scanned according to a predetermined rule;
- the scanning order corresponding to the above texture includes as shown in FIG. 2A to FIG. 2C: the vertical texture corresponds to the horizontal scanning order of the progressive scanning, the horizontal texture corresponds to the vertical scanning order of the column-by-column scanning, and the oblique texture corresponds to the Z-shaped sequential scanning Z. Shape scan order.
- a 4X4 matrix is taken as an example, in which a circle represents a transformation coefficient, a numerical value under a circle represents a coordinate (i.e., a position) at which a transformation coefficient is located, and an arrow direction represents a scanning direction, that is, a scanning order. It should be noted that the matrix on the left side of FIG.
- the Z-shaped scanning sequence is not limited in the embodiment of the invention.
- Transforming coefficient blocks; scanning the transform coefficient blocks of the block to be encoded according to a scanning order of a predetermined rule includes:
- the preferred scanning order is the first scanning order
- the residual data block of the block to be encoded is transposed, Performing scanning on the transformed coefficient block of the transposed block to be encoded according to the second scanning sequence; the scanning order of the first scanning sequence and the second scanning sequence is symmetric;
- the transform coefficient blocks of the block to be encoded are scanned in the second scanning order.
- first and second are used to distinguish two scanning sequences having a symmetric relationship, and are not otherwise limited.
- first scanning order if the first scanning order is a horizontal scanning order, the second scanning order is a vertical scanning order, and if the first scanning order is a vertical scanning order, the second scanning order is a horizontal scanning order.
- the selection is one of the alternatives, and the selected information can be used less than one in the selection of the three-choice one, so When it is programmed into the encoding header information, it saves resources; in addition, it is more efficient when it is selected.
- multiplexing the transform coefficient matrix multiplexing the same entropy coding model can improve the coding efficiency.
- the embodiment further provides an example of an implementation manner of a preset candidate scan sequence, where the preset candidate scan sequence includes:
- the scan rule determines the order of the scan; or, pre-statistically counts the number of transform coefficients of each position of two or more transform coefficient blocks to be non-zero, and arranges each non-zero in descending order
- the position of the transform coefficient corresponding to the number of times determines the order of the positions of the above-described transform coefficients obtained as the preset candidate scan order.
- the quantized residuals can be classified into three categories: horizontal texture The corresponding quantized residual, the quantized residual corresponding to the vertical texture, and the quantized residual corresponding to the oblique texture; the manner of determining the scanning order is: establishing a counter group with the same number of transform coefficients (for example, 16 counters for 4x4 transform) And then counting with a counter, specifically: determining whether each transform coefficient is zero, if non-zero, the corresponding position counter is incremented by one; after the detected number of transform coefficient blocks reaches a set number, each counter has its The value of the count; at this time, the values of the respective counters can be arranged from large to small, and the order of the positions of the above-described transform coefficients obtained by the arrangement can be determined as a preset candidate scan order.
- the position of the transform coefficient corresponding to the vertical texture for example, 16 counters for 4x4 transform
- Example 1 The following describes the scanning process in the encoding process:
- A code according to the encoding process until the transform coefficient is encoded
- inter-frame coding (Inter) is performed, the reference block texture is detected to obtain its texture (horizonous Hor texture, vertical ver texture, oblique texture); if intra-frame coding (Intra) is performed In the case, if the direction of the intra prediction mode (ipmode) is ver +/- 5, the texture is a vertical texture with a direction of Hor +/- 5, the texture is a horizontal texture, and the rest is a diagonal texture.
- the offset set in this embodiment is 5, and may of course be set to other values, which is not limited in this embodiment of the present invention.
- a scan order corresponding to the above texture is selected from the preset candidate scan order based on the obtained texture.
- the detection method in the above B can be:
- a difference is obtained for every two pixel points of the adjacent detection step in the horizontal direction; an absolute value of the accumulated difference value is obtained as a horizontal gradient value;
- B4 if the horizontal gradient value is greater than N times the vertical gradient value, it is determined that the texture is a vertical texture; If the vertical gradient value is greater than N times the horizontal gradient value, the texture is determined to be a horizontal texture; the other case is a diagonal texture; after B4, the horizontal, vertical, and oblique texture ratio distribution in the coded block may be further determined. It is judged whether the threshold value N needs to be updated, and the determination mode is to determine whether the ratio of the horizontal gradient value to the vertical gradient value exceeds a preset value, and if so, the preset value is increased, otherwise, the preset value is reduced.
- the preset value is obtained by the following method: by intra-coding the sequence of transform coefficients with different characteristics, and the proportional relationship between the statistical level and the vertical prediction direction, the proportional relationship can be used as the preset value.
- Step C is the pre-predetermined value An automatic correction process for setting, which is not a step that must be performed.
- step B detection there may be an alternative to the method of step B detection in the above encoding process: detecting the texture of the already encoded block or the decoded block within the distance of the time domain or the spatial domain to be decoded, and determining the detected texture as the waiting The texture of the transform coefficient block of the decoded block. More specifically, for example, the texture of the decoded block of the periphery of the block to be decoded (upper, left, upper left, upper right, lower left) is detected as the texture of the block of the current transform block to be decoded.
- step F The above-mentioned scan sequence used for scanning is programmed into the code stream for the indication of the Z-scan order. This step can be performed during the execution of step E. It can be understood that, after the encoding is completed, the encoded result (code stream) is sent to the decoding end, and other positions of the embodiment of the present invention are not described.
- the embodiment of the present invention further provides a scanning method of a transform coefficient block performed on the decoding end. As shown in FIG. 11, the method includes:
- the scan sequence corresponding to the texture includes a scan order other than the Z-scan sequence; 1304: If the scan order corresponding to the texture is different from the scan order of the predetermined rule, the residual data block of the block to be decoded is obtained according to the scan order corresponding to the texture and the scan order of the predetermined rule after the end of the inverse transform Reset, such that the corresponding transform coefficient block is a transform coefficient block that can be scanned in a scan order of a predetermined rule. It can be understood that, in this embodiment, the residual data block of the to-be-decode
- the transform coefficient block of the block to be decoded is scanned according to a scan order of a predetermined rule; if the scan order corresponding to the texture is different from the scan order of the predetermined rule, according to the texture after the end of the inverse transform
- the corresponding scan order and the scan order of the predetermined rule reset the residual data block of the block to be decoded, so that the corresponding transform coefficient block is a transform coefficient block that can be scanned in a scan order according to a predetermined rule, and includes:
- the selected scan order is the first scan order
- the scanning order of the scanning order is symmetrical, and the second scanning order is the scanning order of the above predetermined rules.
- Example 2 The decoding process is similar to the scanning process of the encoding process:
- A Decode according to the decoding process until the transform coefficient is parsed
- step D Determine whether the indication information indicates that the scanning order is a Z-shaped scanning order. If it is not a Z-shaped scanning, refer to step B of the first scheme, according to the obtained texture direction. If the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, transducing the residual data block of the block to be decoded;
- the above example ones and twos only need to choose between the horizontal and vertical scanning order and the zigzag scanning order, which is the alternative of the two, one compared to the horizontal, vertical and zigzag scanning order (zig-zag)
- the choice between three choices can use one less to carry the selected information, so it saves resources when it is coded into the encoding header information; in addition, it is more efficient at the time of selection.
- Another embodiment of the present invention also provides a scanning method for transform coefficient blocks.
- the coding efficiency can be further improved without further transmitting the indication information on the basis of the above two solutions; as shown in FIG. 12, the method includes:
- the residual data block of the block to be coded is reset, so that the corresponding transform coefficient block is a transform coefficient block scanned according to a predetermined rule;
- Example 1403 Scan the transform coefficient block of the block to be encoded according to a scanning order of a predetermined rule.
- Example 1 The following describes the scanning process in the encoding process:
- A code according to the encoding process until the transform coefficient is encoded
- Step B This step can refer to step B of the first example to obtain the texture direction.
- the embodiment of the present invention further provides another method for scanning a transform coefficient block.
- the solution is executed in a decoding device, and the coding efficiency is further improved without transmitting the indication information.
- the method includes:
- 1501 scanning a transform coefficient block of the decoded block according to a scan order of a predetermined rule; 1502: detecting a texture of the decoded block as a reference of the block to be decoded, the texture embodying a transform coefficient block of the block to be decoded The law of the change of the coefficient of transformation in all directions;
- the residual data block of the block to be decoded is determined according to a scan order corresponding to the texture and a scan order of a predetermined rule. Reset, such that the corresponding transform coefficient block is a transform coefficient block that can be scanned in a scan order of a predetermined rule.
- the corresponding decoding process is similar to the scanning process of the encoding process:
- A Decode according to the decoding process until the transform coefficient is parsed
- step C In this step, reference may be made to step B of the first solution to obtain a texture direction. If the scan order corresponding to the texture is different from the scan order of the predetermined rule, the residual data block of the block to be decoded is transposed.
- the parallelism of the decoding is not affected, the processing delay is reduced, and the decoding efficiency is improved.
- a scanning device for transform coefficient blocks includes:
- a fifth detecting unit 1601 configured to detect a texture of the encoded block that is a reference of the block to be encoded, where the texture embodies a variation rule of the transform coefficient block of the block to be encoded in each of the transform coefficients;
- the fifth reset unit 1602 is configured to: if the scan order corresponding to the texture does not match the scan order of the predetermined rule, reset the residual data block of the block to be coded, so that the corresponding transform coefficient block is according to a predetermined rule. Scanned transform coefficient block;
- the fifth processing unit 1603 is configured to perform rate-distortion optimization processing on the preset Z-scan sequence and the scan order of the predetermined rule to obtain a preferred scan order;
- a fifth scanning unit 1604 configured to scan a transform coefficient block of the block to be coded according to a preferred scan order
- the fifth coding unit 1605 is configured to encode the indication information of whether the scanning order used for scanning is a Z-shaped scanning order into the code stream.
- a scanning device for transform coefficient blocks includes:
- a sixth parsing unit 1701 configured to parse the code stream to obtain indication information
- a sixth scanning unit 1702 configured to scan a transform coefficient block of the block to be decoded according to the parsed scan order
- a sixth detecting unit 1703 configured to: if the indication information of the code stream indicates that the scanning order is not a zigzag scan, detect a texture of the decoded block that is a reference of the to-be-decoded block, where the texture reflects the to-be-decoded block The variation law of the transform coefficient block in each of the transform coefficients;
- the sixth reset unit 1704 is configured to: if the scan order corresponding to the texture is different from the scan order of the predetermined rule, after the end of the inverse transform, according to the scan order corresponding to the texture and the predetermined
- the regular scan order resets the residual data block of the block to be decoded so that the corresponding transform coefficient block is a transform coefficient block that can be scanned in a scan order of a predetermined rule.
- a scanning device for transform coefficient blocks includes:
- a seventh detecting unit 1801 configured to detect a texture of the encoded block as a reference of the block to be encoded, where the texture embodies a variation rule of the transform coefficient block of the block to be encoded in each of the transform coefficients;
- the seventh reset unit 1802 is configured to: if the scan order corresponding to the texture does not match the scan order of the predetermined rule, reset the residual data block of the block to be coded, so that the corresponding transform coefficient block is according to a predetermined rule. Scanned transform coefficient block;
- a seventh scanning unit 1803, configured to scan a transform coefficient block of the coded block according to a scan order of a predetermined rule
- a scanning device for transform coefficient blocks includes:
- the eighth scanning unit 1901 is configured to scan a transform coefficient block of the block to be decoded according to a scan order of a predetermined rule
- An eighth detecting unit 1902 configured to detect a texture of a decoded block that is a reference of the to-be-decoded block, where the texture reflects a variation rule of a transform coefficient block of the to-be-decoded block in each of the upward transform coefficients;
- the eighth reset unit 1903 is configured to: if the scan order corresponding to the texture is different from the scan order of the predetermined rule, after the inverse transform ends, according to the scan order corresponding to the texture and the scan order of the predetermined rule
- the residual data block of the decoded block is reset such that its corresponding transform coefficient block is a transform coefficient block that can be scanned in a scan order of a predetermined rule.
- the method provided by the embodiment of the present invention can be applied to the field of digital signal processing, and is implemented by a video encoder and a decoder.
- Video encoders, decoders are widely used in a variety of communication devices or electronic devices, such as: media gateways, mobile phones, wireless devices, personal data assistants (PDAs), handheld or portable computers, GPS receivers/navigators, cameras , video players, camcorders, video recorders, surveillance equipment, and more.
- Such devices include processors, memory, and interfaces for transmitting data.
- the video codec can be implemented directly by a digital circuit or chip such as a DSP (digital signal processor) or by a software code that drives a processor to execute the flow in the software code.
- DSP digital signal processor
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
Description
本申请要求于 2011年 2月 23 日提交的申请号为 201110043594。 0, 发 明名称为 "一种变换系数块的扫描方法和装置"的中国专利申请和 2011年 3月 29 日提交的申请号为 201110076616.3 , 发明名称为"一种变换系数块的扫描 方法和装置"的中国专利申请的优先权, 其全部内容通过引用结合在本申请 中。
技术领域
本发明涉及通信技术领域, 特别涉及一种视频编解码中变换系数块的扫 描方法和装置。
背景技术
变换系数块的扫描是视频编解码技术的一个组成部分。 变换系数块的扫 描有如下的应用: 视频编码端, 由视频编码端对经过变换后在变换域的二维 的变换系数块进行扫描, 使变换系数块中的二维的变换系数转变成一维的变 换系数序列。 在这一过程中, 需要根据当前变换系数块的变换方式选择扫描 顺序, 使扫描所得的一维变换系数序列更趋向于由大到小的排列, 从而提高 编码效率; 在视频解码端, 由视频解码端根据变换方式, 选择反扫描顺序将 一维变换系数序列转换成二维的变换系数块。
目前在视频编码端, 在执行视频编码过程中, 首先对预测残差进行变换 操作得到变换系数, 在进行变换系数扫描之前, 还可以得到参考块信息, 以 及量化后的变换系数信息; 当高频变换系数非零时, 从以下三种扫描模式: Z 形扫描模式, 水平扫描模式以及竖直扫描模式中, 通过率失真优化准则选择 一组最优的扫描模式; 然后使用选择的扫描模式对变换系数进行扫描, 将扫 描模式的选择信息编入码流, 传递给解码端。
由于在视频的编码端, 需要在三种扫描模式中进行模式的选择, 使编码 端复杂度高; 另外, 需要将扫描模式的选择信息编入码流, 影响了压缩编码 效率。
发明内容
本发明实施例提供一种变换系数块的扫描方法和装置, 提高压缩编码效
率。
本发明实施例提供一种变换系数块的扫描方法, 包括:
检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编 码块的变换系数块在各方向上变换系数的变化规律;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序; 所述预置的 候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序;
对 Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优选扫描顺 序;
若优选的扫描顺序为 Z形扫描顺序则按照优选扫描顺序对所述待编码块 的变换系数块进行扫描;
若所述优选扫描顺序为 Z形扫描顺序以外的其它扫描顺序, 则将待编码块 的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块; 按照所述预 定规则的扫描顺序对重置后的所述待编码块的变换系数块进行扫描;
将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指示信息编入码流。 本发明实施例提供一种变换系数块的扫描方法, 包括:
解析码流得到指示信息,若接收到的码流的指示信息指示扫描顺序不是 Z 形扫描顺序, 则检测作为所述待解码块的参考的已解码块的纹理, 所述纹理 体现了所述待解码块的变换系数块在各方向上变换系数的变化规律; 从预置 的候选扫描顺序中选择与所述纹理对应的扫描顺序; 所述预置的候选扫描顺 序包含 Z形扫描顺序以外的其它扫描顺序;
按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;
若选择的扫描顺序与所述预定规则的扫描顺序不同, 则在扫描结束后根 据所述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数块重 置为可按照选择的扫描顺序扫描的变换系数块。
本发明实施例提供一种变换系数块的扫描方法, 包括:
检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编 码块的变换系数块在各方向上变换系数的变化规律;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序; 所述预置的 候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的其它扫描顺序;
若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫描顺序对所述待编码块 的变换系数块进行扫描; 若选择的扫描顺序为 Z形扫描顺序以外的其它扫描顺 序, 则将待编码块的变换系数块重置为符合 Z形扫描顺序的变换系数块; 按照 Z形扫描顺序对重置后的所述待编码块的变换系数块进行扫描。
本发明实施例提供一种变换系数块的扫描方法, 包括:
检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述 待解码块的变换系数块在各方向上变换系数的变化规律;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序; 所述预置的 候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的其它扫描顺序;
若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫描顺序对所述待解码块 的变换系数块进行扫描;
若选择的扫描顺序为 Z形扫描顺序以外的其它扫描方式, 则将待解码块的 变换系数块从符合 Z形扫描顺序的变换系数块重置为符合所述选择的扫描顺 序的变换系数块; 按照所述选择的扫描方式对重置后的所述待解码块的变换 系数块进行扫描。
本发明实施例提供一种变换系数块的扫描装置, 包括:
第一检测单元, 用于检测作为待编码块的参考的已编码块的纹理, 所述 纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律; 第一选择单元, 用于从预置的候选扫描顺序中选择与所述纹理对应的扫 描顺序; 所述预置的候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序; 第一处理单元, 用于对预置的 Z形扫描顺序和选择的扫描顺序进行率失真 优选处理得到优选扫描顺序;
第一重置单元, 用于若所述优选扫描顺序为 Z形扫描顺序以外的其它扫描 顺序, 则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换 系数块;
第一扫描单元, 用于若优选的扫描顺序为 Z形扫描顺序则按照优选扫描顺 序对待编码块的变换系数块进行扫描; 若所述优选扫描顺序为 Z形扫描顺序以 外的其它扫描顺序, 则按照所述预定规则的扫描顺序对重置后的所述待编码 块的变换系数块进行扫描;
第一编码单元, 用于将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指 示信息编入码流。
本发明实施例提供一种变换系数块的扫描装置, 包括:
第二解析单元, 用于解析码流得到指示信息;
第二检测单元,用于若接收到的码流的指示信息指示扫描顺序不是 Z形扫 描顺序, 则检测作为待解码块的参考的已编码或解码块的纹理, 所述纹理体 现了所述待解码块的变换系数块在各方向上变换系数的变化规律;
第二选择单元, 用于从预置的候选扫描顺序中选择与所述纹理对应的扫 描顺序; 所述预置的候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序; 第二扫描单元, 用于按照预定规则的扫描顺序对待解码块的变换系数块 进行扫描;
第二重置单元, 用于若选择的扫描顺序与所述预定规则的扫描顺序不同, 则在扫描结束后根据所述选择的扫描顺序以及预定规则的扫描顺序将待解码 块的变换系数块重置为可按照选择的扫描顺序扫描的变换系数块。
本发明实施例提供一种变换系数块的扫描装置, 包括:
第三检测单元, 用于检测作为待编码块的参考的已编码块的纹理, 所述 纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律; 第三选择单元, 用于从预置的候选扫描顺序中选择与所述纹理对应的扫 描顺序; 所述预置的候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的 其它扫描顺序;
第三重置单元, 用于若选择的扫描顺序为 Z形扫描顺序以外的其它扫描顺 序, 则将待编码块的变换系数块重置为符合 Z形扫描顺序的变换系数块;
第三扫描单元, 用于若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫描 顺序对所述待编码块的变换系数块进行扫描; 或者, 按照 Z形扫描顺序对重置 后的所述待编码块的变换系数块进行扫描。
本发明实施例提供一种变换系数块的扫描装置, 包括:
第四检测单元, 用于检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规 律;
第四选择单元, 用于从预置的候选扫描顺序中选择与所述纹理对应的扫 描顺序; 所述预置的候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的 其它扫描顺序;
第四重置单元, 用于若选择的扫描顺序为 Z形扫描顺序以外的其它扫描方 式, 则将待解码块的变换系数块从符合 Z形扫描顺序的变换系数块重置为符合 所述选择的扫描顺序的变换系数块;
第四扫描单元, 用于若选择的扫描顺序为 z形扫描顺序, 则按照 Z形扫描 顺序对所述待解码块的变换系数块进行扫描; 或者, 按照所述选择的扫描方 式对重置后的所述待编码块的变换系数块进行扫描。
本发明实施例提供一种变换系数块的扫描方法, 包括:
检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编 码块的变换系数块在各方向上变换系数的变化规律;
若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致, 则对待编 码块的残差数据块重置, 使所述残差数据块对应的变换系数块为按预定规则 扫描的变换系数块;
按照优选扫描顺序对所述待编码块的变换系数块进行扫描, 所述优选扫 描顺序为对 Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理得到的 扫描顺序;
将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指示信息编入码流。 本发明实施例提供一种变换系数块的扫描方法, 包括:
解析码流得到指示信息, 码流的指示信息指示扫描顺序;
按照解析的扫描顺序对待解码块的变换系数块进行扫描;
若码流的指示信息指示扫描顺序不是 Z形扫描, 则检测作为所述待解码块 的参考的已解码块的纹理, 所述纹理体现了所述待解码块的变换系数块在各 方向上变换系数的变化规律; 若所述纹理所对应的扫描顺序与所述预定规则 的扫描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定 规则的扫描顺序将待解码块的残差数据块重置, 使所述残差数据块对应的变 换系数块为可按照预定规则的扫描顺序扫描的变换系数块。
本发明实施例提供一种变换系数块的扫描方法, 包括:
检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编 码块的变换系数块在各方向上变换系数的变化规律;
若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致, 则对待编 码块的残差数据块重置, 使所述残差数据块对应的变换系数块为按预定规则 扫描的变换系数块;
按照预定规则的扫描顺序对所述待编码块的变换系数块进行扫描; 本发明实施例提供一种变换系数块的扫描方法, 包括:
按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;
检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述 待解码块的变换系数块在各方向上变换系数的变化规律;
若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同, 则在反 变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码 块的残差数据块重置, 使所述残差数据块对应的变换系数块为可按照预定规 则的扫描顺序扫描的变换系数块。
本发明实施例提供一种变换系数块的扫描装置, 包括:
第五检测单元, 用于检测作为待编码块的参考的已编码块的纹理, 所述 纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律; 第五重置单元, 用于若所述纹理所对应的扫描顺序与预定规则的扫描顺 序不一致, 则对待编码块的残差数据块重置, 使所述残差数据块对应的变换 系数块为按预定规则扫描的变换系数块;
第五处理单元, 用于对预置的 Z形扫描顺序和预定规则的扫描顺序进行率 失真优选处理得到优选扫描顺序;
第五扫描单元, 用于按照优选扫描顺序对待编码块的变换系数块进行扫 描;
第五编码单元, 用于将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指 示信息编入码流。
本发明实施例提供一种变换系数块的扫描装置, 包括:
第六解析单元, 用于解析码流得到指示信息;
第六扫描单元, 用于按照解析的扫描顺序对待解码块的变换系数块进行
扫描;
第六检测单元, 用于若码流的指示信息指示扫描顺序不是 Z形扫描, 则检 测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述待解码 块的变换系数块在各方向上变换系数的变化规律;
第六重置单元, 用于若所述纹理所对应的扫描顺序与所述预定规则的扫 描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则 的扫描顺序将待解码块的残差数据块重置, 使所述残差数据块对应的变换系 数块为可按照预定规则的扫描顺序扫描的变换系数块。
本发明实施例提供一种变换系数块的扫描装置, 包括:
第七检测单元, 用于检测作为待编码块的参考的已编码块的纹理, 所述 纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律; 第七重置单元, 用于若所述纹理所对应的扫描顺序与预定规则的扫描顺 序不一致, 则对待编码块的残差数据块重置, 使所述残差数据块对应的变换 系数块为按预定规则扫描的变换系数块;
第七扫描单元, 用于按照预定规则的扫描顺序对待编码块的变换系数块 进行扫描;
本发明实施例提供一种变换系数块的扫描装置, 包括:
第八扫描单元, 用于按照预定规则的扫描顺序对待解码块的变换系数块 进行扫描;
第八检测单元, 用于检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规 律;
第八重置单元, 用于若所述纹理所对应的扫描顺序与所述预定规则的扫 描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则 的扫描顺序将待解码块的残差数据块重置, 使所述残差数据块对应的变换系 数块为可按照预定规则的扫描顺序扫描的变换系数块。
上述技术方案只需要在预定的扫描顺序与 Z形扫描顺序间做选择,是二选 一的选择, 相比于在三选一的选择可以少使用一位来携带选择的信息, 因此 在将其编入编码头信息时, 会节省资源; 另外, 在选择的时候效率也更高。
附图说明
为了更清楚地说明本发明实施例的技术方案, 下面将对实施例描述中所 需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发 明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性的 前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明实施例方法流程示意图;
图 2A为本发明实施例竖直纹理的扫描顺序示意图;
图 2B为本发明实施例水平纹理的扫描顺序示意图;
图 2C为本发明实施例斜纹理的扫描顺序示意图;
图 3为本发明实施例方法流程示意图;
图 4为本发明实施例方法流程示意图;
图 5为本发明实施例方法流程示意图;
图 6为本发明实施例装置结构示意图;
图 7为本发明实施例装置结构示意图;
图 8为本发明实施例装置结构示意图;
图 9为本发明实施例装置结构示意图;
图 10为本发明实施例方法流程示意图;
图 11为本发明实施例方法流程示意图;
图 12为本发明实施例方法流程示意图;
图 13为本发明实施例方法流程示意图;
图 14为本发明实施例装置结构示意图;
图 15为本发明实施例装置结构示意图;
图 16为本发明实施例装置结构示意图;
图 17为本发明实施例装置结构示意图。
具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行 清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而 不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作 出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
本发明实施例的编码端在帧间编码过程中, 对于每一待编码块, 从各种 帧间编码类型中根据率失真准则选择最优的帧间编码类型, 同时得到运动信 息, 由运动信息及已编码的重构帧信息, 得到待编码块的预测值, 对预测值 和待编码块的像素值做差, 得到残差值, 对残差值依次进行变换、 量化、 扫 描、 熵编码操作, 编入码流, 同时将运动信息编入码流, 完成编码过程。 以 下对编码和解码过程中的扫描进行具体说明。 本发明实施例提到的变换可以 是离散余弦变换(Discrete Cosine Transform, DCT ); 也可以是多变换技术, 例如 KL变换 ( Karhunen Loeve Transform, KLT )对此本发明实施例不予限定。
一种变换系数块的扫描方法, 本实施例方案可以在编码端执行, 如图 1所 示, 包括:
101 : 检测作为待编码块的参考的已编码块的纹理, 上述纹理体现了上述 待编码块的变换系数块在各方向上变换系数的变化规律;
上述 101属于一种物理推导, 作为参考的已编码的纹理近似于当前的待编 码块的纹理, 而待编码的纹理又近似于待编码的残差纹理, 变换系数的分布 规律与残差纹理密切相关。 更具体地, 上述纹理包括水平纹理、 竖直纹理和 斜纹理; 其中斜纹理也可以看作是无纹理。
更具体地, 上述检测已解码块的纹理包括:
在执行帧间解码时, 计算变换系数块的水平方向上的水平梯度值和竖直 方向上的竖直梯度值; 水平梯度值为水平方向上各相邻像素点的差值的绝对 值的和, 竖直梯度值为竖直方向上各相邻像素点的差值的绝对值的和; 上述 作为参考的变换系数块即为上述已解码块的变化系数块;
若水平梯度值大于 N倍的竖直梯度值则确定纹理为竖直纹理,竖直梯度值 大于 N倍的水平梯度值则确定纹理为水平纹理, 否则确定纹理为斜纹理; 上述 N为第一预置值, N可以由分辨率宽度来确定, 例如分辨率宽度大于 1000时 N=2, 分辨率宽度小于 1000时 N=1.5; 以上 N的取值可以根据经验来确定, 具 体的取值本发明实施例对此不予限定。
在执行帧内解码时,若帧内预测模式方向的竖直方向的偏移量在 M以内则 确定纹理为竖直纹理,帧内预测模式方向的水平方向的偏移量在 M以内则确定 纹理为水平纹理, 否则确定纹理为斜纹理; 上述 M为第二预置值, M也可以由
分辨率宽度来确定, 例如设置成 5, 还可以设置成其他值例如 3、 4等, 对此本 发明实施例不予限定。
进一步地, 本发明实施例还提供了修正预置值的实现方式: 若已经解码 的块中, 水平纹理与竖直纹理的比值超过第三预置值则缩小 N的值, 若水平纹 理与竖直纹理的比值小于 N,则增大 N的值。第三预置值可以由以下方式得到, 通过对不同特点的变换系数的序列进行帧内编码, 统计水平、 竖直预测方向 的比例关系, 该比例关系即可以作为第三预置值。
可选地, 若存在已编码块或解码块, 那么已经编码块或解码块的纹理则 是已知的, 此时可以利用这些信息减少运算量; 上述检测变换系数块的纹理 包括: 检测待解码块设定时域或空域距离内已经编码块或解码块的纹理, 将 检测到的纹理确定为变换系数块的纹理。
102: 从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序; 在本实 施例中预置的候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序;
上述纹理对应的扫描顺序包括如图 2A〜图 2C所示的: 竖直纹理对应逐行 扫描的水平扫描顺序、 水平纹理对应逐列扫描的竖直扫描顺序、 斜纹理对应 Z 形顺序扫描的 Z形扫描顺序。 图 2A〜图 2C中以 4X4矩阵为例, 其中圓形代表变 换系数, 圓形下的数值表示变换系数其所在的坐标(即位置), 箭头方向表示 扫描方向, 即扫描顺序。 需要说明的是图 2C左边和矩阵和右边的矩阵分别代 表一种 Z形扫描顺序, Z形扫描顺序是可以自定义的, 所以可能的种类较多, 图 2C的举例也不是穷举; 因此本发明实施例对 Z形扫描顺序不予限定。
103: 对预置的 Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到 优选扫描顺序;
104: 若优选的扫描顺序为 Z形扫描顺序则按照优选扫描顺序对待编码块 的变换系数块进行扫描; 若上述优选扫描顺序为 Z形扫描顺序以外的其它扫描 顺序, 则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换 系数块; 按照上述预定规则的扫描顺序对重置后的上述待编码块的变换系数 块进行扫描;
更具体地, 上述 104中, 若上述优选扫描顺序为 Z形扫描顺序以外的其它 扫描顺序, 则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的
变换系数块; 按照上述预定规则的扫描顺序对重置后的上述待编码块的变换 系数块进行扫描包括:
若优选的扫描顺序为第一扫描顺序, 则将待编码块的变换系数转置, 按 照第二扫描顺序对转置后的上述待编码块的变换系数块进行扫描; 上述第一 扫描顺序与第二扫描顺序的扫描顺序是对称的;
若优选的扫描顺序为第二扫描顺序, 则按照第二扫描顺序对上述待编码 块的变换系数块进行扫描。
需要说明的是, 以上 "第一" 和 "第二" 用于区分两个具有对称关系的 扫描顺序, 不作其它限定, 例如: 水平扫描顺序和竖直扫描顺序之间就是两 个具有对称关系的扫描顺序, 若第一扫描顺序为水平扫描顺序则第二扫描顺 序为竖直扫描顺序, 若第一扫描顺序为竖直扫描顺序则第二扫描顺序为水平 扫描顺序。
更具体地, 上述 104中, 将待编码块的变换系数块重置为按预定规则的扫 描顺序扫描的变换系数块; 按照上述预定规则的扫描顺序对重置后的上述待 编码块的变换系数块进行扫描包括: 则将待编码块的变换系数块重置为符合 Z 形扫描顺序的变换系数块; 按照 Z形扫描顺序对重置后的上述待编码块的变换 系数块进行扫描。 若采用本方法可以不用传递 105中的指示信息, 后续实施例 将详细说明。
105: 将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指示信息编入码 流。
以上实施方式, 只需要在预定的扫描顺序与 Z形扫描顺序间做选择, 是二 选一的选择, 相比于在三选一的选择可以少使用一位来携带选择的信息, 因 此在将其编入编码头信息时, 会节省资源; 另外, 在选择的时候效率也更高。 另外通过对变换系数矩阵转置的方式, 复用相同的熵编码模型可以提高编码 效率。
更具体地, 本实施例还提供了预置候选扫描顺序的实现方式的举例, 上 述预置候选扫描顺序包括:
预先定义的扫描规则, 扫描规则确定了扫描的顺序; 或者, 预先统计两 个或两个以上的变换系数块各位置的变换系数为非零的次数, 按从大到小的
顺序排列各个非零次数对应的变换系数的位置, 将排列得到的上述变换系数 的位置的顺序确定为预置的候选扫描顺序。
在以上的预置候选扫描方式的举例的后一种实现方式本发明实施例给出 了一个举例说明: 在编码器中, 依据残差块的纹理, 量化残差可以分为三类: 水平纹理对应的量化残差、 竖直纹理对应的量化残差、 斜纹理对应的量化残 差; 确定扫描顺序的方式为: 建立与变换系数个数相同的计数器组(例如 4x4 变换则为 16个计数器), 然后用计数器进行计数, 具体为: 判断各个变换系数 上是否为零, 如果非零, 则对应位置的计数器加一; 检测的变换系数块的数 量达到设定的数量以后, 各个计数器均有其计数的数值; 此时可以从大到小 排列各个计数器的值, 将排列得到的上述变换系数的位置的顺序确定为预置 的候选扫描顺序。 使用该方法, 按照得到的顺序进行扫描时, 数值大的计数 器其所对应的变换系数位置会在扫描顺序中排在前面。
举例方案一、 以下对编码过程中的扫描环节进行具体说明:
A: 按照编码流程编码, 直到进行变换系数编码之前;
B: 若执行的是帧间编码(Inter ), 则对参考块纹理进行检测, 得到其纹 理(水平 Hor纹理、 竖直 ver纹理、 斜纹理); 若在执行的是帧内编码( Intra ) 的情况, 如果帧内预测模式( intra prediction mode, ipmode )的方向为 ver+/-5 , 其纹理为竖直纹理, 方向为 Hor+/-5 , 其纹理为水平纹理, 其余情况为斜纹理。 本实施例中设置的偏移量是 5 , 当然还可以设置成其他值, 对此本发明实施例 不予限定。 根据得到的纹理从预置的候选扫描顺序中选择与上述纹理对应的 扫描顺序。
上述 B中的检测方法可以是:
B 1: 确定检测步长。 该步骤为不同变换单元( Transform Unit , TU )设置 不同的检测步长, 例如 TU = 4时, 步长为 1 , TU = 8时, 步长为 1 , TU = 16 时, 步长为 2, TU = 32时, 步长为 4, 也可以所有大小的 TU对应步长均为 1 ;
B2: 对参考块(即作为参考的变换系数块) 中, 水平方向相邻检测步长 的每两个像素点求差值; 累加差值的绝对值得到水平梯度值;
B3 : 对参考块中, 竖直方向相邻检测步长的每两个像素点求差值; 累加
差值的绝对值得到竖直梯度值;
B4: 如果水平梯度值大于 N倍的竖直梯度值, 则确定其纹理为竖直纹理; 如果竖直梯度值大于 N倍的水平梯度值, 则确定其纹理为水平纹理; 其它情况 为斜纹理; B4之后, 还可以进一步地根据已编码块中的水平、 竖直、 斜纹理 比例分布, 判断阈值 N是否需要更新, 判断方式是判断水平梯度值与竖直梯度 值的比例是否超过预置值, 若是, 则增大预置值, 否, 则缩小预置值。 (其中 预置值由以下方式得到, 通过对不同特点的变换系数的序列进行帧内编码, 统计水平、 竖直预测方向的比例关系, 该比例关系即可以作为预置值。 步骤 C 是对预置值的一个自动修正的过程, 该过程并不是必须执行的步骤。
另外, 对于以上编码过程中的步骤 B检测的方法可以有替代的方案: 检测 待解码块设定时域或空域的距离内已经编码块或解码块的纹理, 将检测到的 纹理确定为作为待解码块的变换系数块的纹理。 更具体地, 例如将检测待解 码块周边(上、 左、 左上、 右上、 左下) 的已解码块的纹理作为当前待解码 块变换系数块的纹理。
C: 对预置的 Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优 选扫描顺序;
D: 判断优选的扫描顺序是否为 Z形扫描顺序, 如果是, 则执行 G, 如果 否, 则执行 E;
E: 如果扫描顺序为竖直, 则将变换系数转置; 如果扫描顺序为水平, 继 续;
F: 按照水平扫描顺序及相关熵编码模型对待扫描的变换系数块进行扫 描, 然后继续后续的编码过程。
G:按照 Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行编码、 扫描, 然后继续后续的编码过程。
H: 将上述进行扫描使用的扫描顺序是否为 Z形扫描顺序的指示信息编入 码流。 本步骤可以在步骤 G或 F执行过程中进行。 可以理解的是, 编码完成后 会将编码的结果(码流)发送给解码端, 对此本发明实施例其他位置不—— 说明。
对应的, 本发明实施例还提供了在解码端执行的一种变换系数块的扫描
方法, 如图 3所示, 包括:
301 : 解析码流得到指示信息;
302: 若接收到的码流的指示信息指示扫描顺序是 Z形扫描顺序, 按照 Z 形扫描顺序对待解码块的变换系数块进行扫描; 扫描的流程结束。
303 : 若接收到的码流的指示信息指示扫描顺序不是 Z形扫描顺序, 则检 测作为上述待解码块的参考的已解码块的纹理, 上述纹理体现了上述待解码 块的变换系数块在各方向上变换系数的变化规律; 从预置的候选扫描顺序中 选择与上述纹理对应的扫描顺序; 本实施例中上述预置的候选扫描顺序包含 Z 形扫描顺序以外的其它扫描顺序;
304: 按照预定规则的扫描顺序对待解码块的变换系数块进行扫描; 若选 择的扫描顺序与上述预定规则的扫描顺序相同, 扫描的流程结束。
305: 若选择的扫描顺序与上述预定规则的扫描顺序不同, 则在扫描结束 后根据上述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数 块重置为可按照选择的扫描顺序扫描的变换系数块。 可以理解的是, 本实施 例与编码端对应的, 那么上述待解码块的变换系数块曾经经过编码端按照上 述预定规则重置过。
更具体地, 上述按照预定规则的扫描顺序对待解码块的变换系数块进行 扫描; 若选择的扫描顺序与上述预定规则的扫描顺序不同, 则在扫描结束后 根据上述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数块 重置为可按照选择的扫描顺序扫描的变换系数块包括:
若选择的扫描顺序为第一扫描顺序, 按照第二扫描顺序上述待解码块的 变换系数块进行扫描; 扫描完成后将待解码块的变换系数转置; 上述第一扫 描顺序与第二扫描顺序的扫描顺序是对称的, 第二扫描顺序为上述预定规则 的扫描顺序。
举例方案二、 解码过程与编码过程扫描的方法类似:
A: 按照解码流程解码, 直到进行变换系数解析之前;
B: 解析码流, 得到指示信息, 该指示信息即编码过程的步骤 H中的指示 信息; 判断指示信息是否指示扫描顺序为 Z形扫描顺序; 若是, 执行 E; 否则 执行 C;
C: 本步骤可以参考举例方案一的步骤 B, 根据得到的纹理从预置的候选 扫描顺序中选择与上述纹理对应的扫描顺序, 然后执行 D;
D: 如果纹理方向对应竖直扫描顺序, 则按照水平扫描顺序及相关熵编码 模型对待扫描的变换系数块进行解析、 扫描, 然后对变换系数转置, 继续后 续的解码过程; 如果纹理方向对应水平扫描顺序, 则按照水平扫描顺序及相 关熵编码模型对待扫描的变换系数块进行解析、 扫描, 继续后续的解码过程;
E:按照 Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、 扫描, 然后继续后续的解码过程。
以上举例方案一和二, 只需要在水平和竖直的扫描顺序与 Z形扫描顺序间 做选择, 是二选一的选择, 相比于在水平、 竖直以及 Z形扫描顺序 (zig-zag ) 之间的三选一的选择可以少使用一位来携带选择的信息, 因此在将其编入编 码头信息时, 会节省资源; 另外, 在选择的时候效率也更高。
本发明实施例还给出了另一种变换系数块的扫描方法, 该方案在编码设 备中执行, 在以上两个方案的基础之上更进一步地不用传递指示信息, 可以 进一步地提高编码效率; 如图 4所示, 包括:
401 : 检测作为待编码块的参考的已编码块的纹理, 上述纹理体现了上述 待编码块的变换系数块在各方向上变换系数的变化规律;
402: 从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序; 本实施 例中预置的候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的其它扫描 顺序;
403: 若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫描顺序对上述待编 码块的变换系数块进行扫描; 若选择的扫描顺序为 Z形扫描顺序以外的其它扫 描顺序, 则将待编码块的变换系数块重置为符合 Z形扫描顺序的变换系数块; 按照 Z形扫描顺序对重置后的上述待编码块的变换系数块进行扫描。
对应的, 本发明实施例还提供了另一种变换系数块的扫描方法, 本方案 在解码设备中执行, 不用传递指示信息, 可以进一步地提高编码效率; 如图 5 所示, 包括:
举例方案一、 以下对编码过程中的扫描环节进行具体说明:
以下对编码过程中的扫描环节进行具体说明:
A: 按照编码流程编码, 直到进行变换系数编码之前;
B: 本步骤可以参考举例方案一的步骤 B, 根据得到的纹理从预置的候选 扫描顺序中选择与上述纹理对应的扫描顺序;
C: 按照选定的扫描顺序将变换系数的位置重置为符合 Z形扫描顺序的位 置关系;
D:按照 Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行编码、 扫描, 然后继续后续的编码过程。
501 : 检测作为上述待解码块的参考的已解码块的纹理, 上述纹理体现了 上述待解码块的变换系数块在各方向上变换系数的变化规律;
502: 从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序; 本实施 例中预置的候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的其它扫描 顺序;
503: 若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫描顺序对上述待解 码块的变换系数块进行扫描;
504: 若选择的扫描顺序为 Z形扫描顺序以外的其它扫描方式, 则将待解 码块的变换系数块从符合 Z形扫描顺序的变换系数块重置为符合上述选择的 扫描顺序的变换系数块; 按照上述选择的扫描方式对重置后的上述待解码块 的变换系数块进行扫描。
对应的解码过程与编码过程扫描的方法类似:
A: 按照解码流程解码, 直到进行变换系数解析之前;
B:按照 Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、 扫描;
C: 本步骤可以参考举例方案一的步骤 B, 根据得到的纹理从预置的候选 扫描顺序中选择与上述纹理对应的扫描顺序;
D: 如果纹理方向对应竖直扫描顺序, 将变换系数的位置重置为符合竖直 扫描顺序的位置关系; 如果纹理方向对应水平扫描顺序, 将变换系数的位置 重置为符合水平扫描顺序的位置关系; 如果纹理方向对应 Z形扫描顺序, 则不 进行该步骤操作;
E: 继续后续的解码过程;
对于单扫描方案而言变换系数的扫描顺序(即第一个扫描, 第二个扫描, 第三个扫描…)对应着唯一的频域位置关系(即(0, 0 ), ( 0, 1 ), ( 1 , 0 ) ... ), 所以在解析后扫描的点时可以根据其频域周边已经解析的点的数值来为其赋 予一个可能的值(即建立熵编码模型, 可以看作是一种预测, 从而使编码效 率更高)。对于多扫描方案来说, 由于在解析变换系数前已经确定了扫描顺序, 即已经确定了扫描顺序与频域位置的关系, 所以对于每一种扫描顺序依然可 以按照单扫描方案的方式进行。 本发明实施例在解析变换系数之前, 可以判 定是否是 zig-zag而无法区分水平和竖直,所以如果不做任何操作,在非 zig-zag 时, 无法确定扫描顺序与频域位置的关系, 也就没有办法进行熵编码模型的 建立, 也就无法解码。 上述方案通过重置的方式解决了这一问题。
以下是对本发明实施例提供的方案进行的仿真实验的结果。
则试条件: JCTVC high efficiency low delay test condition;
测试结果: 其中第三列是集成于 TMuC (新一代视频编码测试软件平台) 技术方案的结果, 第四列是本发明实施例方案的结果, 可以看出本发明实施 例方案效率较高。
Class Name Sequence Name HHI BD Rate (in HW BD Rate (in (类名) (序列名) %) %)
Kimono -0.0 -0.7
ParkScene -0.1 -0.7
Class B Cactus -0.3 -0.9
BasketballDrive -0.3 -2.5
BQTerrace -0.2 -2.1
BasketballDrill -0.2 -0.7
BQMall -0.3 -2.1
Class C
Partyscene -0.2 -1.0
RaceHorses -0.2 -0.6
Class D BasketballPass -0.4 -1.8
BQSquare -0.3 -0.8
BlowingBubbles -0.1 -1.0
RaceHorses -0.2 -0.8
Vidyol -0.2 -1.2
Class E Vidyo3 -0.2 -0.8
Vidyo4 -0.2 -1.2
Class B -0.2 -1.4
Class C -0.2 -1.1
Average Class D -0.3 -1.1
Class E -0.2 -1.1
All -0.2 -1.2
一种变换系数块的扫描装置, 如图 6上述, 包括:
第一检测单元 601 , 用于检测作为待编码块的参考的已编码块的纹理, 上 述纹理体现了上述待编码块的变换系数块在各方向上变换系数的变化规律; 第一选择单元 602, 用于从预置的候选扫描顺序中选择与上述纹理对应的 扫描顺序; 上述预置的候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序; 第一处理单元 603 , 用于对预置的 Z形扫描顺序和选择的扫描顺序进行率 失真优选处理得到优选扫描顺序;
第一重置单元 604, 用于若上述优选扫描顺序为 Z形扫描顺序以外的其它 扫描顺序, 则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的 变换系数块;
第一扫描单元 605 , 用于若优选的扫描顺序为 Z形扫描顺序则按照优选扫 描顺序对待编码块的变换系数块进行扫描; 若上述优选扫描顺序为 Z形扫描顺 序以外的其它扫描顺序, 则按照上述预定规则的扫描顺序对重置后的上述待 编码块的变换系数块进行扫描;
第一编码单元 606, 用于将进行扫描使用的扫描顺序是否为 Z形扫描顺序 的指示信息编入码流。
一种变换系数块的扫描装置, 如图 7所示, 包括:
第二解析单元 701 , 用于解析码流得到指示信息;
第二检测单元 702, 用于若接收到的码流的指示信息指示扫描顺序不是 Z
形扫描顺序, 则检测作为待解码块的参考的已编码或解码块的纹理, 上述纹 理体现了上述待解码块的变换系数块在各方向上变换系数的变化规律;
第二选择单元 703 , 用于从预置的候选扫描顺序中选择与上述纹理对应的 扫描顺序; 上述预置的候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序; 第二扫描单元 704, 用于按照预定规则的扫描顺序对待解码块的变换系数 块进行扫描;
第二重置单元 705 , 用于若选择的扫描顺序与上述预定规则的扫描顺序不 同, 则在扫描结束后根据上述选择的扫描顺序以及预定规则的扫描顺序将待 解码块的变换系数块重置为可按照选择的扫描顺序扫描的变换系数块。
一种变换系数块的扫描装置, 如图 8所示, 包括:
第三检测单元 801 , 用于检测作为待编码块的参考的已编码块的纹理, 上 述纹理体现了上述待编码块的变换系数块在各方向上变换系数的变化规律; 第三选择单元 802, 用于从预置的候选扫描顺序中选择与上述纹理对应的 扫描顺序; 上述预置的候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外 的其它扫描顺序;
第三重置单元 803 , 用于若选择的扫描顺序为 Z形扫描顺序以外的其它扫 描顺序, 则将待编码块的变换系数块重置为符合 Z形扫描顺序的变换系数块; 第三扫描单元 804, 用于若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫 描顺序对上述待编码块的变换系数块进行扫描; 或者, 按照 Z形扫描顺序对重 置后的上述待编码块的变换系数块进行扫描。
一种变换系数块的扫描装置, 如图 9所示, 包括:
第四检测单元 901 , 用于检测作为上述待解码块的参考的已解码块的纹 理, 上述纹理体现了上述待解码块的变换系数块在各方向上变换系数的变化 规律;
第四选择单元 902, 用于从预置的候选扫描顺序中选择与上述纹理对应的 扫描顺序; 上述预置的候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外 的其它扫描顺序;
第四重置单元 903 , 用于若选择的扫描顺序为 Z形扫描顺序以外的其它扫 描方式, 则将待解码块的变换系数块从符合 Z形扫描顺序的变换系数块重置为
符合上述选择的扫描顺序的变换系数块;
第四扫描单元 904, 用于若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫 描顺序对上述待解码块的变换系数块进行扫描; 或者, 按照上述选择的扫描 方式对重置后的上述待编码块的变换系数块进行扫描。
上述装置的方案只需要在水平和竖直的扫描顺序与 Z形扫描顺序间做选 择, 是二选一的选择, 相比于在水平、 竖直以及 Z形扫描顺序(zig-zag )之间 的三选一的选择可以少使用一位来携带选择的信息, 因此在将其编入编码头 信息时, 会节省资源; 另外, 在选择的时候效率也更高。 一种变换系数块的扫描方法, 本实施例方案可以在编码端执行, 如图 10 所示, 包括:
1001 : 检测作为待编码块的参考的已编码块的纹理, 上述纹理体现了上 述待编码块的变换系数块在各方向上变换系数的变化规律;
上述 1001属于一种物理推导, 作为参考的已编码的纹理近似于当前的待 编码块的纹理, 而待编码的纹理又近似于待编码的残差纹理, 变换系数的分 布规律与残差纹理密切相关。 更具体地, 上述纹理包括水平纹理、 竖直纹理 和斜纹理; 其中斜纹理也可以看作是无纹理。
更具体地, 上述检测已解码块的纹理包括:
在执行帧间解码时, 计算变换系数块的水平方向上的水平梯度值和竖直 方向上的竖直梯度值; 水平梯度值为水平方向上各相邻像素点的差值的绝对 值的和, 竖直梯度值为竖直方向上各相邻像素点的差值的绝对值的和; 上述 作为参考的变换系数块即为上述已解码块的变化系数块;
若水平梯度值大于 N倍的竖直梯度值则确定纹理为竖直纹理,竖直梯度值 大于 N倍的水平梯度值则确定纹理为水平纹理, 否则确定纹理为斜纹理; 上述 N为第一预置值, N可以由分辨率宽度来确定, 例如分辨率宽度大于 1000时 N=2, 分辨率宽度小于 1000时 N=1.5; 以上 N的取值可以根据经验来确定, 具 体的取值本发明实施例对此不予限定。
在执行帧内解码时,若帧内预测模式方向的竖直方向的偏移量在 M以内则 确定纹理为竖直纹理,帧内预测模式方向的水平方向的偏移量在 M以内则确定
纹理为水平纹理, 否则确定纹理为斜纹理; 上述 M为第二预置值, M也可以由 分辨率宽度来确定, 例如设置成 5, 还可以设置成其他值例如 3、 4等, 对此本 发明实施例不予限定。
进一步地, 本发明实施例还提供了修正预置值的实现方式: 若已经解码 的块中, 水平纹理与竖直纹理的比值超过第三预置值则缩小 N的值, 若水平纹 理与竖直纹理的比值小于 N,则增大 N的值。第三预置值可以由以下方式得到, 通过对不同特点的变换系数的序列进行帧内编码, 统计水平、 竖直预测方向 的比例关系, 该比例关系即可以作为第三预置值。
可选地, 若存在已编码块或解码块, 那么已经编码块或解码块的纹理则 是已知的, 此时可以利用这些信息减少运算量; 上述检测变换系数块的纹理 包括: 检测待解码块设定时域或空域距离内已经编码块或解码块的纹理, 将 检测到的纹理确定为变换系数块的纹理。
1002: 若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致, 则 对待编码块的残差数据块重置, 使其所对应的变换系数块为按预定规则扫描 的变换系数块;
上述纹理对应的扫描顺序包括如图 2A〜图 2C所示的: 竖直纹理对应逐行 扫描的水平扫描顺序、 水平纹理对应逐列扫描的竖直扫描顺序、 斜纹理对应 Z 形顺序扫描的 Z形扫描顺序。 图 2A〜图 2C中以 4X4矩阵为例, 其中圓形代表变 换系数, 圓形下的数值表示变换系数其所在的坐标(即位置), 箭头方向表示 扫描方向, 即扫描顺序。 需要说明的是图 2C左边和矩阵和右边的矩阵分别代 表一种 Z形扫描顺序, Z形扫描顺序是可以自定义的, 所以可能的种类较多, 图 2C的举例也不是穷举; 因此本发明实施例对 Z形扫描顺序不予限定。
1003: 对预置的 Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理 得到优选扫描顺序;
更具体地, 上述 1003中, 若所述纹理所对应的扫描顺序与预定规则的扫 描顺序不一致, 则对待编码块的残差数据块重置, 使其所对应的变换系数块 为按预定规则扫描的变换系数块; 按照预定规则的扫描顺序对所述待编码块 的变换系数块进行扫描包括:
若优选的扫描顺序为第一扫描顺序, 则将待编码块的残差数据块转置,
按照第二扫描顺序对转置后的上述待编码块的变换系数块进行扫描; 上述第 一扫描顺序与第二扫描顺序的扫描顺序是对称的;
若优选的扫描顺序为第二扫描顺序, 则按照第二扫描顺序对上述待编码 块的变换系数块进行扫描。
需要说明的是, 以上 "第一" 和 "第二" 用于区分两个具有对称关系的 扫描顺序, 不作其它限定, 例如: 水平扫描顺序和竖直扫描顺序之间就是两 个具有对称关系的扫描顺序, 若第一扫描顺序为水平扫描顺序则第二扫描顺 序为竖直扫描顺序, 若第一扫描顺序为竖直扫描顺序则第二扫描顺序为水平 扫描顺序。
更具体地, 上述 1003中, 将待编码块的残差数据块, 使其对应的变换系 数块为按预定规则的扫描顺序扫描的变换系数块; 按照上述预定规则的扫描 顺序对上述待编码块的变换系数块进行扫描包括: 则将待编码块的残差数据 块, 使其对应的变换系数块为按预定规则的扫描顺序扫描的变换系数块; 按 照预定规则的扫描顺序对上述待编码块的变换系数块进行扫描。 若采用本方 法可以不用传递 1005中的指示信息, 后续实施例将详细说明。
1004: 按照优选扫描顺序对所述待编码块的变换系数块进行扫描;
1005: 将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指示信息编入码 流。
以上实施方式, 只需要在预定的扫描顺序与 Z形扫描顺序间做选择, 是二 选一的选择, 相比于在三选一的选择可以少使用一位来携带选择的信息, 因 此在将其编入编码头信息时, 会节省资源; 另外, 在选择的时候效率也更高。 另外通过对变换系数矩阵转置的方式, 复用相同的熵编码模型可以提高编码 效率。
更具体地, 本实施例还提供了预置候选扫描顺序的实现方式的举例, 上 述预置候选扫描顺序包括:
预先定义的扫描规则, 扫描规则确定了扫描的顺序; 或者, 预先统计两 个或两个以上的变换系数块各位置的变换系数为非零的次数, 按从大到小的 顺序排列各个非零次数对应的变换系数的位置, 将排列得到的上述变换系数 的位置的顺序确定为预置的候选扫描顺序。
在以上的预置候选扫描方式的举例的后一种实现方式本发明实施例给出 了一个举例说明: 在编码器中, 依据残差块的纹理, 量化残差可以分为三类: 水平纹理对应的量化残差、 竖直纹理对应的量化残差、 斜纹理对应的量化残 差; 确定扫描顺序的方式为: 建立与变换系数个数相同的计数器组(例如 4x4 变换则为 16个计数器), 然后用计数器进行计数, 具体为: 判断各个变换系数 上是否为零, 如果非零, 则对应位置的计数器加一; 检测的变换系数块的数 量达到设定的数量以后, 各个计数器均有其计数的数值; 此时可以从大到小 排列各个计数器的值, 将排列得到的上述变换系数的位置的顺序确定为预置 的候选扫描顺序。 使用该方法, 按照得到的顺序进行扫描时, 数值大的计数 器其所对应的变换系数位置会在扫描顺序中排在前面。
举例方案一、 以下对编码过程中的扫描环节进行具体说明:
A: 按照编码流程编码, 直到进行变换系数编码之前;
B: 若执行的是帧间编码(Inter ), 则对参考块纹理进行检测, 得到其纹 理(水平 Hor纹理、 竖直 ver纹理、 斜纹理); 若在执行的是帧内编码( Intra ) 的情况, 如果帧内预测模式( intra prediction mode, ipmode )的方向为 ver+/-5 , 其纹理为竖直纹理, 方向为 Hor+/-5 , 其纹理为水平纹理, 其余情况为斜纹理。 本实施例中设置的偏移量是 5 , 当然还可以设置成其他值, 对此本发明实施例 不予限定。 根据得到的纹理从预置的候选扫描顺序中选择与上述纹理对应的 扫描顺序。
上述 B中的检测方法可以是:
B 1: 确定检测步长。 该步骤为不同变换单元( Transform Unit , TU )设置 不同的检测步长, 例如 TU = 4时, 步长为 1 , TU = 8时, 步长为 1 , TU = 16 时, 步长为 2, TU = 32时, 步长为 4, 也可以所有大小的 TU对应步长均为 1 ;
B2: 对参考块(即作为参考的变换系数块) 中, 水平方向相邻检测步长 的每两个像素点求差值; 累加差值的绝对值得到水平梯度值;
B3 : 对参考块中, 竖直方向相邻检测步长的每两个像素点求差值; 累加 差值的绝对值得到竖直梯度值;
B4: 如果水平梯度值大于 N倍的竖直梯度值, 则确定其纹理为竖直纹理;
如果竖直梯度值大于 N倍的水平梯度值, 则确定其纹理为水平纹理; 其它情况 为斜纹理; B4之后, 还可以进一步地根据已编码块中的水平、 竖直、 斜纹理 比例分布, 判断阈值 N是否需要更新, 判断方式是判断水平梯度值与竖直梯度 值的比例是否超过预置值, 若是, 则增大预置值, 否, 则缩小预置值。 (其中 预置值由以下方式得到, 通过对不同特点的变换系数的序列进行帧内编码, 统计水平、 竖直预测方向的比例关系, 该比例关系即可以作为预置值。 步骤 C 是对预置值的一个自动修正的过程, 该过程并不是必须执行的步骤。
另外, 对于以上编码过程中的步骤 B检测的方法可以有替代的方案: 检测 待解码块设定时域或空域的距离内已经编码块或解码块的纹理, 将检测到的 纹理确定为作为待解码块的变换系数块的纹理。 更具体地, 例如将检测待解 码块周边(上、 左、 左上、 右上、 左下) 的已解码块的纹理作为当前待解码 块变换系数块的纹理。
C: 如果所述纹理对应的扫描顺序为竖直, 则将变换系数转置; 如果所述 纹理对应的扫描顺序为水平, 继续;
D: 对预置的 Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理得 到优选扫描顺序;
E: 按照优选的扫描顺序及相关熵编码模型对待扫描的变换系数块进行编 码、 扫描, 然后继续后续的编码过程;
F: 将上述进行扫描使用的扫描顺序是否为 Z形扫描顺序的指示信息编入 码流。 本步骤可以在步骤 E执行过程中进行。 可以理解的是, 编码完成后会将 编码的结果(码流)发送给解码端, 对此本发明实施例其他位置不——说明。
对应的, 本发明实施例还提供了在解码端执行的一种变换系数块的扫描 方法, 如图 11所示, 包括:
1301 : 解析码流得到指示信息;
1302: 按照解析的扫描顺序对待解码块的变换系数块进行扫描、 反变换; 1303: 若码流的指示信息指示扫描顺序不是 Z形扫描, 则检测作为所述待 解码块的参考的已解码块的纹理, 所述纹理体现了所述待解码块的变换系数 块在各方向上变换系数的变化规律; 本实施例中上述纹理对应的扫描顺序包 含 Z形扫描顺序以外的其它扫描顺序;
1304: 若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将 待解码块的残差数据块重置, 使其所对应的变换系数块为可按照预定规则的 扫描顺序扫描的变换系数块。 可以理解的是, 本实施例与编码端对应的, 那 么上述待解码块的残差数据块曾经经过编码端按照上述预定规则重置过。
更具体地, 上述按照预定规则的扫描顺序对待解码块的变换系数块进行 扫描; 若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同, 则在 反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解 码块的残差数据块重置, 使其所对应的变换系数块为可按照预定规则的扫描 顺序扫描的变换系数块包括:
若选择的扫描顺序为第一扫描顺序, 按照第二扫描顺序上述待解码块的 变换系数块进行扫描; 扫描完成后将待解码块的残差数据块转置; 上述第一 扫描顺序与第二扫描顺序的扫描顺序是对称的, 第二扫描顺序为上述预定规 则的扫描顺序。
举例方案二、 解码过程与编码过程扫描的方法类似:
A: 按照解码流程解码, 直到进行变换系数解析之前;
B: 解析码流, 得到指示信息, 该指示信息即编码过程的步骤 H中的指示 信息;
C:按照解析的扫描顺序及相关熵编码模型对待扫描的变换系数块进行解 析、 扫描, 反变换;
D: 判断指示信息是否指示扫描顺序为 Z形扫描顺序, 如果不是 Z形扫描, 可以参考举例方案一的步骤 B, 根据得到的纹理方向。 若所述纹理所对应的扫 描顺序与所述预定规则的扫描顺序不同, 则将待解码块的残差数据块转置;
E: 继续后续的解码过程。
以上举例方案一和二, 只需要在水平和竖直的扫描顺序与 Z形扫描顺序间 做选择, 是二选一的选择, 相比于在水平、 竖直以及 Z形扫描顺序 (zig-zag ) 之间的三选一的选择可以少使用一位来携带选择的信息, 因此在将其编入编 码头信息时, 会节省资源; 另外, 在选择的时候效率也更高。
本发明实施例还给出了另一种变换系数块的扫描方法, 该方案在编码设
备中执行, 在以上两个方案的基础之上更进一步地不用传递指示信息, 可以 进一步地提高编码效率; 如图 12所示, 包括:
1401 : 检测作为待编码块的参考的已编码块的纹理, 上述纹理体现了上 述待编码块的变换系数块在各方向上变换系数的变化规律;
1402: 若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致, 则 对待编码块的残差数据块重置, 使其所对应的变换系数块为按预定规则扫描 的变换系数块;
1403: 按照预定规则的扫描顺序对所述待编码块的变换系数块进行扫描。 举例方案一、 以下对编码过程中的扫描环节进行具体说明:
以下对编码过程中的扫描环节进行具体说明:
A: 按照编码流程编码, 直到进行变换系数编码之前;
B: 本步骤可以参考举例方案一的步骤 B, 得到纹理方向;
C: 按照选定的扫描顺序将变换系数的位置重置为符合 Z形扫描顺序的位 置关系;
D:按照 Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行编码、 扫描, 然后继续后续的编码过程。
对应的, 本发明实施例还提供了另一种变换系数块的扫描方法, 本方案 在解码设备中执行, 不用传递指示信息, 可以进一步地提高编码效率; 如图 13所示, 包括:
1501 : 按照预定规则的扫描顺序对待解码块的变换系数块进行扫描; 1502: 检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现 了所述待解码块的变换系数块在各方向上变换系数的变化规律;
1503 : 若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将 待解码块的残差数据块重置, 使其所对应的变换系数块为可按照预定规则的 扫描顺序扫描的变换系数块。
对应的解码过程与编码过程扫描的方法类似:
A: 按照解码流程解码, 直到进行变换系数解析之前;
B:按照 Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、
扫描, 反变换;
C: 本步骤可以参考举例方案一的步骤 B, 得到纹理方向; 若所述纹理所 对应的扫描顺序与所述预定规则的扫描顺序不同, 则将待解码块的残差数据 块转置
D: 继续后续的解码过程;
将纹理检测和转置操作放在反变换操作之后进行, 不会对解码的并行性 造成影响, 减小了处理时延, 提高了解码效率。
一种变换系数块的扫描装置, 如图 14所示, 包括:
第五检测单元 1601 , 用于检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规 律;
第五重置单元 1602, 用于若所述纹理所对应的扫描顺序与预定规则的扫 描顺序不一致, 则对待编码块的残差数据块重置, 使其所对应的变换系数块 为按预定规则扫描的变换系数块;
第五处理单元 1603 ,用于对预置的 Z形扫描顺序和预定规则的扫描顺序进 行率失真优选处理得到优选扫描顺序;
第五扫描单元 1604, 用于按照优选扫描顺序对待编码块的变换系数块进 行扫描;
第五编码单元 1605 ,用于将进行扫描使用的扫描顺序是否为 Z形扫描顺序 的指示信息编入码流。
一种变换系数块的扫描装置, 如图 15所示, 包括:
第六解析单元 1701 , 用于解析码流得到指示信息;
第六扫描单元 1702, 用于按照解析的扫描顺序对待解码块的变换系数块 进行扫描;
第六检测单元 1703 , 用于若码流的指示信息指示扫描顺序不是 Z形扫描, 则检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述待 解码块的变换系数块在各方向上变换系数的变化规律;
第六重置单元 1704, 用于若所述纹理所对应的扫描顺序与所述预定规则 的扫描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定
规则的扫描顺序将待解码块的残差数据块重置, 使其所对应的变换系数块为 可按照预定规则的扫描顺序扫描的变换系数块。
一种变换系数块的扫描装置, 如图 16所示, 包括:
第七检测单元 1801 , 用于检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规 律;
第七重置单元 1802, 用于若所述纹理所对应的扫描顺序与预定规则的扫 描顺序不一致, 则对待编码块的残差数据块重置, 使其所对应的变换系数块 为按预定规则扫描的变换系数块;
第七扫描单元 1803 , 用于按照预定规则的扫描顺序对待编码块的变换系 数块进行扫描;
一种变换系数块的扫描装置, 如图 17所示, 包括:
第八扫描单元 1901 , 用于按照预定规则的扫描顺序对待解码块的变换系 数块进行扫描;
第八检测单元 1902, 用于检测作为所述待解码块的参考的已解码块的纹 理, 所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化 规律;
第八重置单元 1903 , 用于若所述纹理所对应的扫描顺序与所述预定规则 的扫描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定 规则的扫描顺序将待解码块的残差数据块重置, 使其所对应的变换系数块为 可按照预定规则的扫描顺序扫描的变换系数块。 本发明实施例提供的方法可以应用在数字信号处理领域中, 通过视频编 码器, 解码器实现。 视频编码器, 解码器广泛应用于各种通讯设备或电子设 备中, 例如: 媒体网关, 移动电话, 无线装置, 个人数据助理(PDA ), 手持 式或便携式计算机, GPS接收机 /导航器, 照相机, 视频播放器, 摄像机, 录 像机, 监控设备等等。 这类设备中包括处理器, 存储器, 以及传输数据的接 口 。 视频编解码器可以直接由数字电路或芯片例如 DSP ( digital signal processor )实现,或者由软件代码驱动一处理器执行软件代码中的流程而实现。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤 是可以通过程序来指令相关的硬件完成, 上述的程序可以存储于一种计算机 可读存储介质中, 上述提到的存储介质可以是只读存储器, 磁盘或光盘等。
以上对本发明实施例所提供的一种变换系数块的扫描方法、 装置和*** 阐述, 以上实施例的说明只是用于帮助理解本发明的方法及其核心思想; 同 时, 对于本领域的一般技术人员, 依据本发明的思想, 在具体实施方式及应 用范围上均会有改变之处, 综上, 本说明书内容不应理解为对本发明的限制。
Claims
1、 一种变换系数块的扫描方法, 其特征在于, 包括:
检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编 码块的变换系数块在各方向上变换系数的变化规律;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序; 所述预置的 候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序;
对 Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优选扫描顺 序;
若优选的扫描顺序为 Z形扫描顺序则按照优选扫描顺序对所述待编码块 的变换系数块进行扫描;
若所述优选扫描顺序为 Z形扫描顺序以外的其它扫描顺序, 则将待编码块 的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块; 按照所述预 定规则的扫描顺序对重置后的所述待编码块的变换系数块进行扫描;
将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指示信息编入码流。
2、 根据权利要求 1所述方法, 其特征在于, 所述若所述优选扫描顺序为 Z 形扫描顺序以外的其它扫描顺序, 则将待编码块的变换系数块重置为按预定 规则的扫描顺序扫描的变换系数块; 按照所述预定规则的扫描顺序对重置后 的所述待编码块的变换系数块进行扫描包括:
若优选的扫描顺序为第一扫描顺序, 则将待编码块的变换系数转置, 按 照第二扫描顺序对转置后的所述待编码块的变换系数块进行扫描; 所述第一 扫描顺序与第二扫描顺序的扫描顺序是对称的;
若优选的扫描顺序为第二扫描顺序, 则按照第二扫描顺序对所述待编码 块的变换系数块进行扫描。 —
3、根据权利要求 1或 2所述方法, 其特征在于,检测已编码块的纹理包括: 在执行帧间编码时, 计算已编码块的水平方向上的水平梯度值和竖直方 向上的竖直梯度值; 水平梯度值为水平方向上各相邻像素点的差值的绝对值 的和, 竖直梯度值为竖直方向上各相邻像素点的差值的绝对值的和;
若水平梯度值大于 N倍的竖直梯度值则确定纹理为竖直纹理,竖直梯度值 大于 N倍的水平梯度值则确定纹理为水平纹理, 否则确定纹理为斜纹理; 所述 N为第一预置值;
在执行帧内编码时,若帧内预测模式方向的竖直方向的偏移量在 M以内则 确定纹理为竖直纹理,帧内预测模式方向的水平方向的偏移量在 M以内则确定 纹理为水平纹理, 否则确定纹理为斜纹理; 所述 M为第二预置值。
4、 一种变换系数块的扫描方法, 其特征在于, 包括:
解析码流得到指示信息,若接收到的码流的指示信息指示扫描顺序不是 Z 形扫描顺序, 则检测作为所述待解码块的参考的已解码块的纹理, 所述纹理 体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序; 所述预置的 候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序;
按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;
若选择的扫描顺序与所述预定规则的扫描顺序不同, 则在扫描结束后根 据所述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数块重 置为可按照选择的扫描顺序扫描的变换系数块。
5、 根据权利要求 4所述方法, 其特征在于, 所述按照预定规则的扫描顺 序对待解码块的变换系数块进行扫描; 若选择的扫描顺序与所述预定规则的 扫描顺序不同, 则在扫描结束后根据所述选择的扫描顺序以及预定规则的扫 描顺序将待解码块的变换系数块重置为可按照选择的扫描顺序扫描的变换系 数块包括:
若选择的扫描顺序为第一扫描顺序, 按照第二扫描顺序对所述待解码块 的变换系数块进行扫描; 扫描完成后将待解码块的变换系数转置; 所述第一 扫描顺序与第二扫描顺序的扫描顺序是对称的, 第二扫描顺序为所述预定规 则的扫描顺序。
6、 根据权利要求 4或 5所述方法, 其特征在于, 检测已解码的纹理包括: 在执行帧间解码时, 计算已解码块的水平方向上的水平梯度值和竖直方 向上的竖直梯度值; 水平梯度值为水平方向上各相邻像素点的差值的绝对值 的和, 竖直梯度值为竖直方向上各相邻像素点的差值的绝对值的和;
若水平梯度值大于 N倍的竖直梯度值则确定纹理为竖直纹理,竖直梯度值 大于 N倍的水平梯度值则确定纹理为水平纹理, 否则确定纹理为斜纹理; 所述 N为第一预置值;
在执行帧内解码时,若帧内预测模式方向的竖直方向的偏移量在 M以内则 确定纹理为竖直纹理,帧内预测模式方向的水平方向的偏移量在 M以内则确定 纹理为水平纹理, 否则确定纹理为斜纹理; 所述 M为第二预置值。
7、 一种变换系数块的扫描方法, 其特征在于, 包括:
检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编 码块的变换系数块在各方向上变换系数的变化规律;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序; 所述预置的 候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的其它扫描顺序;
若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫描顺序对所述待编码块 的变换系数块进行扫描; 若选择的扫描顺序为 Z形扫描顺序以外的其它扫描顺 序, 则将待编码块的变换系数块重置为符合 Z形扫描顺序的变换系数块; 按照 Z形扫描顺序对重置后的所述待编码块的变换系数块进行扫描。
8、 一种变换系数块的扫描方法, 其特征在于, 包括:
检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述 待解码块的变换系数块在各方向上变换系数的变化规律;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序; 所述预置的 候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的其它扫描顺序;
若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫描顺序对所述待解码块 的变换系数块进行扫描;
若选择的扫描顺序为 Z形扫描顺序以外的其它扫描方式, 则将待解码块的 变换系数块从符合 Z形扫描顺序的变换系数块重置为符合所述选择的扫描顺 序的变换系数块; 按照所述选择的扫描方式对重置后的所述待解码块的变换 系数块进行扫描。
9、 一种变换系数块的扫描装置, 其特征在于, 包括:
第一检测单元, 用于检测作为待编码块的参考的已编码块的纹理, 所述 纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律; 第一选择单元, 用于从预置的候选扫描顺序中选择与所述纹理对应的扫 描顺序; 所述预置的候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序; 第一处理单元, 用于对预置的 Z形扫描顺序和选择的扫描顺序进行率失真 优选处理得到优选扫描顺序;
第一重置单元, 用于若所述优选扫描顺序为 Z形扫描顺序以外的其它扫描 顺序, 则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换 系数块;
第一扫描单元, 用于若优选的扫描顺序为 Z形扫描顺序则按照优选扫描顺 序对待编码块的变换系数块进行扫描; 若所述优选扫描顺序为 Z形扫描顺序以 外的其它扫描顺序, 则按照所述预定规则的扫描顺序对重置后的所述待编码 块的变换系数块进行扫描;
第一编码单元, 用于将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指 示信息编入码流。
10、 一种变换系数块的扫描装置, 其特征在于, 包括:
第二解析单元, 用于解析码流得到指示信息;
第二检测单元,用于若接收到的码流的指示信息指示扫描顺序不是 Z形扫 描顺序, 则检测作为待解码块的参考的已编码或解码块的纹理, 所述纹理体 现了所述待解码块的变换系数块在各方向上变换系数的变化规律;
第二选择单元, 用于从预置的候选扫描顺序中选择与所述纹理对应的扫 描顺序; 所述预置的候选扫描顺序包含 Z形扫描顺序以外的其它扫描顺序; 第二扫描单元, 用于按照预定规则的扫描顺序对待解码块的变换系数块 进行扫描;
第二重置单元, 用于若选择的扫描顺序与所述预定规则的扫描顺序不同, 则在扫描结束后根据所述选择的扫描顺序以及预定规则的扫描顺序将待解码 块的变换系数块重置为可按照选择的扫描顺序扫描的变换系数块。
11、 一种变换系数块的扫描装置, 其特征在于, 包括:
第三检测单元, 用于检测作为待编码块的参考的已编码块的纹理, 所述 纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律; 第三选择单元, 用于从预置的候选扫描顺序中选择与所述纹理对应的扫 描顺序; 所述预置的候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的 其它扫描顺序; 第三重置单元, 用于若选择的扫描顺序为 Z形扫描顺序以外的其它扫描顺 序, 则将待编码块的变换系数块重置为符合 Z形扫描顺序的变换系数块; 第三扫描单元, 用于若选择的扫描顺序为 Z形扫描顺序, 则按照 Z形扫描 顺序对所述待编码块的变换系数块进行扫描; 或者, 按照 Z形扫描顺序对重置 后的所述待编码块的变换系数块进行扫描。
12、 一种变换系数块的扫描装置, 其特征在于, 包括:
第四检测单元, 用于检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规 律;
第四选择单元, 用于从预置的候选扫描顺序中选择与所述纹理对应的扫 描顺序; 所述预置的候选扫描顺序包括 Z形扫描顺序以及 Z形扫描顺序以外的 其它扫描顺序;
第四重置单元, 用于若选择的扫描顺序为 Z形扫描顺序以外的其它扫描方 式, 则将待解码块的变换系数块从符合 Z形扫描顺序的变换系数块重置为符合 所述选择的扫描顺序的变换系数块;
第四扫描单元, 用于若选择的扫描顺序为 z形扫描顺序, 则按照 Z形扫描 顺序对所述待解码块的变换系数块进行扫描; 或者, 按照所述选择的扫描方 式对重置后的所述待编码块的变换系数块进行扫描。
13、 一种变换系数块的扫描方法, 其特征在于, 包括:
检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编 码块的变换系数块在各方向上变换系数的变化规律;
若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致, 则对待编 码块的残差数据块重置, 使所述残差数据块对应的变换系数块为按预定规则 扫描的变换系数块;
按照优选扫描顺序对所述待编码块的变换系数块进行扫描, 所述优选扫 描顺序为对 Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理得到的 扫描顺序;
将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指示信息编入码流。
14、 根据权利要求 13所述方法, 其特征在于, 所述若所述纹理所对应的 扫描顺序与预定规则的扫描顺序不一致, 则对待编码块的残差数据块重置, 使所述残差数据块对应的变换系数块为按预定规则扫描的变换系数块; 按照 优选扫描顺序对所述待编码块的变换系数块进行扫描包括:
若所述纹理所对应的扫描顺序为第一扫描顺序, 则将待编码块的残差数 据块转置, 变换后得到所述待编码块的变换系数块, 按照第二扫描顺序对转 置后的所述待编码块的变换系数块进行扫描; 所述第一扫描顺序与第二扫描 顺序的扫描顺序是对称的。
15、 根据权利要求 13或 14所述方法, 其特征在于, 检测已编码块的纹理 包括:
在执行帧间编码时, 计算已编码块的水平方向上的水平梯度值和竖直方 向上的竖直梯度值; 水平梯度值为水平方向上各相邻像素点的差值的绝对值 的和, 竖直梯度值为竖直方向上各相邻像素点的差值的绝对值的和;
若水平梯度值大于 N倍的竖直梯度值则确定纹理为竖直纹理,竖直梯度值 大于 N倍的水平梯度值则确定纹理为水平纹理, 否则确定纹理为斜纹理; 所述 N为第一预置值;或者,若水平梯度值大于竖直梯度值则确定纹理为竖直纹理, 竖直梯度值大于水平梯度值则确定纹理为水平纹理;
在执行帧内编码时,若帧内预测模式方向的竖直方向的偏移量在 M以内则 确定纹理为竖直纹理,帧内预测模式方向的水平方向的偏移量在 M以内则确定 纹理为水平纹理, 否则确定纹理为斜纹理; 所述 M为第二预置值。
16、 一种变换系数块的扫描方法, 其特征在于, 包括:
解析码流得到指示信息, 码流的指示信息指示扫描顺序;
按照解析的扫描顺序对待解码块的变换系数块进行扫描;
若码流的指示信息指示扫描顺序不是 Z形扫描, 则检测作为所述待解码块 的参考的已解码块的纹理, 所述纹理体现了所述待解码块的变换系数块在各 方向上变换系数的变化规律; 若所述纹理所对应的扫描顺序与所述预定规则 的扫描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定 规则的扫描顺序将待解码块的残差数据块重置, 使所述残差数据块对应的变 换系数块为可按照预定规则的扫描顺序扫描的变换系数块。
17、 根据权利要求 16所述方法, 其特征在于, 所述按照解析的扫描顺序 对待解码块的变换系数块进行扫描; 若所述纹理所对应的扫描顺序与所述预 定规则的扫描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以 及预定规则的扫描顺序将待解码块的残差数据块重置, 使所述残差数据块对 应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块包括:
若选择的扫描顺序为第一扫描顺序, 按照第二扫描顺序对所述待解码块 的变换系数块进行扫描; 反变换完成后将待解码块的残差数据转置; 所述第 一扫描顺序与第二扫描顺序的扫描顺序是对称的, 第二扫描顺序为所述预定 规则的扫描顺序。
18、 根据权利要求 16或 17所述方法, 其特征在于, 检测已解码的纹理包 括:
在执行帧间解码时, 计算已解码块的水平方向上的水平梯度值和竖直方 向上的竖直梯度值; 水平梯度值为水平方向上各相邻像素点的差值的绝对值 的和, 竖直梯度值为竖直方向上各相邻像素点的差值的绝对值的和;
若水平梯度值大于 N倍的竖直梯度值则确定纹理为竖直纹理,竖直梯度值 大于 N倍的水平梯度值则确定纹理为水平纹理, 否则确定纹理为斜纹理; 所述 N为第一预置值;或者,若水平梯度值大于竖直梯度值则确定纹理为竖直纹理, 竖直梯度值大于水平梯度值则确定纹理为水平纹理;
在执行帧内解码时,若帧内预测模式方向的竖直方向的偏移量在 M以内则 确定纹理为竖直纹理,帧内预测模式方向的水平方向的偏移量在 M以内则确定 纹理为水平纹理, 否则确定纹理为斜纹理; 所述 M为第二预置值。
19、 一种变换系数块的扫描方法, 其特征在于, 包括:
检测作为待编码块的参考的已编码块的纹理, 所述纹理体现了所述待编 码块的变换系数块在各方向上变换系数的变化规律;
若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致, 则对待编 码块的残差数据块重置, 使所述残差数据块对应的变换系数块为按预定规则 扫描的变换系数块;
按照预定规则的扫描顺序对所述待编码块的变换系数块进行扫描。
20、 一种变换系数块的扫描方法, 其特征在于, 包括:
按照预定规则的扫描顺序对待解码块的变换系数块进行扫描; 检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述 待解码块的变换系数块在各方向上变换系数的变化规律;
若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同, 则在反 变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码 块的残差数据块重置, 使所述残差数据块对应的变换系数块为可按照预定规 则的扫描顺序扫描的变换系数块。
21、 一种变换系数块的扫描装置, 其特征在于, 包括:
第五检测单元, 用于检测作为待编码块的参考的已编码块的纹理, 所述 纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律; 第五重置单元, 用于若所述纹理所对应的扫描顺序与预定规则的扫描顺 序不一致, 则对待编码块的残差数据块重置, 使所述残差数据块对应的变换 系数块为按预定规则扫描的变换系数块;
第五处理单元, 用于对预置的 Z形扫描顺序和预定规则的扫描顺序进行率 失真优选处理得到优选扫描顺序;
第五扫描单元, 用于按照优选扫描顺序对待编码块的变换系数块进行扫 描;
第五编码单元, 用于将进行扫描使用的扫描顺序是否为 Z形扫描顺序的指 示信息编入码流。
22、 一种变换系数块的扫描装置, 其特征在于, 包括:
第六解析单元, 用于解析码流得到指示信息;
第六扫描单元, 用于按照解析的扫描顺序对待解码块的变换系数块进行 扫描;
第六检测单元, 用于若码流的指示信息指示扫描顺序不是 Z形扫描, 则检 测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述待解码 块的变换系数块在各方向上变换系数的变化规律;
第六重置单元, 用于若所述纹理所对应的扫描顺序与所述预定规则的扫 描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则 的扫描顺序将待解码块的残差数据块重置, 使所述残差数据块对应的变换系 数块为可按照预定规则的扫描顺序扫描的变换系数块。
23、 一种变换系数块的扫描装置, 其特征在于, 包括:
第七检测单元, 用于检测作为待编码块的参考的已编码块的纹理, 所述 纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律; 第七重置单元, 用于若所述纹理所对应的扫描顺序与预定规则的扫描顺 序不一致, 则对待编码块的残差数据块重置, 使所述残差数据块对应的变换 系数块为按预定规则扫描的变换系数块;
第七扫描单元, 用于按照预定规则的扫描顺序对待编码块的变换系数块 进行扫描。
24、 一种变换系数块的扫描装置, 其特征在于, 包括:
第八扫描单元, 用于按照预定规则的扫描顺序对待解码块的变换系数块 进行扫描;
第八检测单元, 用于检测作为所述待解码块的参考的已解码块的纹理, 所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规 律;
第八重置单元, 用于若所述纹理所对应的扫描顺序与所述预定规则的扫 描顺序不同, 则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则 的扫描顺序将待解码块的残差数据块重置, 使所述残差数据块对应的变换系 数块为可按照预定规则的扫描顺序扫描的变换系数块。
Applications Claiming Priority (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110043594 | 2011-02-23 | ||
CN201110043594.0 | 2011-02-23 | ||
CN201110076616.3A CN102651816B (zh) | 2011-02-23 | 2011-03-29 | 一种变换系数块的扫描方法和装置 |
CN201110076616.3 | 2011-03-29 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2012113328A1 true WO2012113328A1 (zh) | 2012-08-30 |
Family
ID=46693700
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2012/071432 WO2012113328A1 (zh) | 2011-02-23 | 2012-02-22 | 一种变换系数块的扫描方法和装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN102651816B (zh) |
WO (1) | WO2012113328A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110741636A (zh) * | 2017-12-15 | 2020-01-31 | 谷歌有限责任公司 | 用于视频编码的变换块级扫描顺序选择 |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
NZ715990A (en) | 2013-07-24 | 2019-11-29 | Microsoft Technology Licensing Llc | Scanning orders for non-transform coding |
CN103561274B (zh) * | 2013-11-19 | 2017-02-15 | 福建师范大学 | 静止摄像头拍摄的运动目标被移除视频时域篡改检测方法 |
CN104853196B (zh) * | 2014-02-18 | 2018-10-19 | 华为技术有限公司 | 编解码方法和装置 |
EP3410710A4 (en) * | 2016-01-28 | 2019-09-11 | Nippon Hoso Kyokai | CODING DEVICE, DECODING DEVICE AND PROGRAM |
RU2707719C1 (ru) | 2016-02-12 | 2019-11-28 | Хуавей Текнолоджиз Ко., Лтд. | Способ и устройство выбора порядка сканирования |
KR102159252B1 (ko) | 2016-02-12 | 2020-10-14 | 후아웨이 테크놀러지 컴퍼니 리미티드 | 스캔 순서 선택을 위한 방법 및 장치 |
CN113453008B (zh) * | 2020-03-26 | 2022-08-02 | 腾讯科技(深圳)有限公司 | 视频解码方法、视频编码方法、相关设备及介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH08256266A (ja) * | 1995-03-17 | 1996-10-01 | Mitsubishi Electric Corp | 画像符号化方式 |
CN1585483A (zh) * | 2004-06-16 | 2005-02-23 | 浙江大学 | 视频或图像压缩中扫描变换系数的方法和装置 |
JP2007129612A (ja) * | 2005-11-07 | 2007-05-24 | Nippon Telegr & Teleph Corp <Ntt> | 直交変換係数のスキャン方法,逆スキャン方法,スキャン装置,逆スキャン装置,およびそのプログラム並びにそのプログラムを記録したコンピュータ読み取り可能な記録媒体 |
WO2009134575A2 (en) * | 2008-05-02 | 2009-11-05 | Microsoft Corporation | Multi-level representation of reordered transform coefficients |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101325707B (zh) * | 2007-06-12 | 2012-04-18 | 浙江大学 | 纹理自适应视频编解码*** |
-
2011
- 2011-03-29 CN CN201110076616.3A patent/CN102651816B/zh active Active
-
2012
- 2012-02-22 WO PCT/CN2012/071432 patent/WO2012113328A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH08256266A (ja) * | 1995-03-17 | 1996-10-01 | Mitsubishi Electric Corp | 画像符号化方式 |
CN1585483A (zh) * | 2004-06-16 | 2005-02-23 | 浙江大学 | 视频或图像压缩中扫描变换系数的方法和装置 |
JP2007129612A (ja) * | 2005-11-07 | 2007-05-24 | Nippon Telegr & Teleph Corp <Ntt> | 直交変換係数のスキャン方法,逆スキャン方法,スキャン装置,逆スキャン装置,およびそのプログラム並びにそのプログラムを記録したコンピュータ読み取り可能な記録媒体 |
WO2009134575A2 (en) * | 2008-05-02 | 2009-11-05 | Microsoft Corporation | Multi-level representation of reordered transform coefficients |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110741636A (zh) * | 2017-12-15 | 2020-01-31 | 谷歌有限责任公司 | 用于视频编码的变换块级扫描顺序选择 |
CN110741636B (zh) * | 2017-12-15 | 2023-03-21 | 谷歌有限责任公司 | 用于视频编码的变换块级扫描顺序选择 |
Also Published As
Publication number | Publication date |
---|---|
CN102651816A (zh) | 2012-08-29 |
CN102651816B (zh) | 2014-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2012113328A1 (zh) | 一种变换系数块的扫描方法和装置 | |
JP6256564B2 (ja) | Hevcビデオ符号化における論理的イントラモードネーミング | |
RU2514777C1 (ru) | Способ и устройство для кодирования и декодирования изображения с использованием крупной единицы преобразования | |
JP6073405B2 (ja) | 映像復号化方法及び装置 | |
US10003792B2 (en) | Video encoder for images | |
RU2504103C1 (ru) | Способ и устройство для кодирования и декодирования изображения посредством использования вращательного преобразования | |
JP5266342B2 (ja) | 映像イントラ予測方法及び装置 | |
RU2406255C2 (ru) | Прогнозирование коэффициентов преобразования для сжатия изображения | |
CN103348651A (zh) | 具有降低复杂性的变换单元分割的方法及装置 | |
CN105611292B (zh) | 视频解码设备和视频解码方法 | |
KR20110014839A (ko) | 영상의 부호화 방법 및 장치, 그 복호화 방법 및 장치 | |
KR20110010324A (ko) | 영상의 부호화 방법 및 장치, 영상 복호화 방법 및 장치 | |
KR20110017302A (ko) | 움직임 벡터의 정확도 조절을 이용한 영상 부호화, 복호화 방법 및 장치 | |
KR20120079194A (ko) | 코딩 유닛 단위 병렬 인트라예측을 이용한 부호화/복호화 방법 및 장치 | |
WO2012094909A1 (zh) | 变换系数块的扫描方法、装置和*** | |
WO2011124163A1 (zh) | 视频数据编码、解码方法及装置、变换处理方法及装置 | |
WO2022166370A1 (zh) | 视频编解码方法、装置、计算机程序产品、计算机可读存储介质及电子设备 | |
CN108322743B (zh) | 一种基于模式依赖特性的不可分二次变换模式的帧内快速选择方法 | |
KR101366088B1 (ko) | 인트라 예측 부호화, 복호화 방법 및 장치 | |
JP5739714B2 (ja) | 符号化装置、復号装置及びプログラム | |
KR101489222B1 (ko) | 영상의 부호화 방법 및 장치, 영상 복호화 방법 및 장치 | |
JP5298082B2 (ja) | 適応的に直交変換係数の走査順序を決定する符号化装置及び復号装置 | |
WO2021211576A1 (en) | Methods and systems for combined lossless and lossy coding | |
JP2007243859A (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: 12749748 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 12749748 Country of ref document: EP Kind code of ref document: A1 |