CN102651816B - Method and device for scanning transformation coefficient block - Google Patents
Method and device for scanning transformation coefficient block Download PDFInfo
- Publication number
- CN102651816B CN102651816B CN201110076616.3A CN201110076616A CN102651816B CN 102651816 B CN102651816 B CN 102651816B CN 201110076616 A CN201110076616 A CN 201110076616A CN 102651816 B CN102651816 B CN 102651816B
- Authority
- CN
- China
- Prior art keywords
- block
- scanning order
- scanning
- texture
- order
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
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
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)
Abstract
本发明实施例公开了一种变换系数块的扫描方法和装置,其中方法的实现包括:检测作为待编码块的参考的已编码块的纹理;从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;对Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优选扫描顺序;若优选的扫描顺序为Z形扫描顺序则按照优选扫描顺序对所述待编码块的变换系数块进行扫描;若所述优选扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块;按照所述预定规则的扫描顺序对重置后的所述待编码块的变换系数块进行扫描;将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。上述方案可以节省资源,效率也更高。
The embodiment of the present invention discloses a scanning method and device for a transform coefficient block, wherein the implementation of the method includes: detecting the texture of the coded block as a reference of the block to be coded; selecting the texture from the preset candidate scanning order Corresponding scanning order; perform rate-distortion optimization processing on the Z-shaped scanning order and the selected scanning order to obtain the optimal scanning order; if the preferred scanning order is the Z-shaped scanning order, then perform the transformation coefficient block of the block to be encoded according to the optimal scanning order Scanning; if the preferred scanning order is other than the zigzag scanning order, then reset the transformation coefficient block of the block to be encoded to the transformation coefficient block scanned in the scanning order of the predetermined rule; according to the predetermined rule The scanning order scans the reset transform coefficient block of the block to be encoded; and encodes the indication information whether the scanning order used for scanning is a zigzag scanning order into the code stream. The above solutions can save resources and have higher efficiency.
Description
技术领域 technical field
本发明涉及通信技术领域,特别涉及一种视频编解码中变换系数块的扫描方法和装置。The invention relates to the field of communication technology, in particular to a method and device for scanning transform coefficient blocks in video codec.
背景技术 Background technique
变换系数块的扫描是视频编解码技术的一个组成部分。变换系数块的扫描有如下的应用:视频编码端,由视频编码端对经过变换后在变换域的二维的变换系数块进行扫描,使变换系数块中的二维的变换系数转变成一维的变换系数序列。在这一过程中,需要根据当前变换系数块的变换方式选择扫描顺序,使扫描所得的一维变换系数序列更趋向于由大到小的排列,从而提高编码效率;在视频解码端,由视频解码端根据变换方式,选择反扫描顺序将一维变换系数序列转换成二维的变换系数块。Scanning of transform coefficient blocks is an integral part of video codec technology. The scanning of the transform coefficient block has the following applications: at the video encoding end, the video encoding end scans the transformed two-dimensional transform coefficient block in the transform domain, so that the two-dimensional transform coefficient in the transform coefficient block is transformed into a one-dimensional Sequence of transform coefficients. In this process, it is necessary to select the scanning order according to the transformation method of the current transformation coefficient block, so that the scanned one-dimensional transformation coefficient sequence tends to be arranged from large to small, thereby improving the coding efficiency; According to the transform mode, the decoder selects the inverse scanning order to convert the one-dimensional transform coefficient sequence into a two-dimensional transform coefficient block.
目前在视频编码端,在执行视频编码过程中,首先对预测残差进行变换操作得到变换系数,在进行变换系数扫描之前,还可以得到参考块信息,以及量化后的变换系数信息;当高频变换系数非零时,从以下三种扫描模式:Z形扫描模式,水平扫描模式以及竖直扫描模式中,通过率失真优化准则选择一组最优的扫描模式;然后使用选择的扫描模式对变换系数进行扫描,将扫描模式的选择信息编入码流,传递给解码端。At present, at the video encoding end, during the video encoding process, the prediction residual is transformed first to obtain transform coefficients. Before transform coefficient scanning, reference block information and quantized transform coefficient information can also be obtained; when high-frequency When the transform coefficient is non-zero, from the following three scan modes: Z-shape scan mode, horizontal scan mode and vertical scan mode, select a set of optimal scan modes through the rate-distortion optimization criterion; then use the selected scan mode to transform The coefficients are scanned, and the selection information of the scanning mode is encoded into the code stream and passed to the decoder.
由于在视频的编码端,需要在三种扫描模式中进行模式的选择,使编码端复杂度高;另外,需要将扫描模式的选择信息编入码流,影响了压缩编码效率。At the encoding end of the video, it is necessary to select the mode among the three scanning modes, which makes the encoding end more complex; in addition, the selection information of the scanning mode needs to be encoded into the code stream, which affects the compression encoding efficiency.
发明内容 Contents of the invention
本发明实施例提供一种变换系数块的扫描方法和装置,提高压缩编码效率。Embodiments of the present invention provide a scanning method and device for transform coefficient blocks, which improve compression coding efficiency.
本发明实施例提供一种变换系数块的扫描方法,包括:An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;Detecting the texture of the coded block used as a reference of the block to be coded, the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be coded in each direction;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;所述预置的候选扫描顺序包含Z形扫描顺序以外的其它扫描顺序;Selecting a scan order corresponding to the texture from preset candidate scan orders; the preset candidate scan orders include scan orders other than the zigzag scan order;
对Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优选扫描顺序;Performing rate-distortion optimization processing on the Z-shaped scanning order and the selected scanning order to obtain the preferred scanning order;
若优选的扫描顺序为Z形扫描顺序则按照优选扫描顺序对所述待编码块的变换系数块进行扫描;If the preferred scanning order is a zigzag scanning order, then scan the transform coefficient blocks of the block to be encoded according to the preferred scanning order;
若所述优选扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块;按照所述预定规则的扫描顺序对重置后的所述待编码块的变换系数块进行扫描;If the preferred scanning order is a scanning order other than the zigzag scanning order, reset the transform coefficient block of the block to be coded to be the transform coefficient block scanned according to the scanning order of the predetermined rule; Scanning the reset transform coefficient block of the block to be encoded;
将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。Indicating whether the scanning sequence used for scanning is a zigzag scanning sequence is encoded into the code stream.
本发明实施例提供一种变换系数块的扫描方法,包括:An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
解析码流得到指示信息,若接收到的码流的指示信息指示扫描顺序不是Z形扫描顺序,则检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;所述预置的候选扫描顺序包含Z形扫描顺序以外的其它扫描顺序;Analyzing the code stream to obtain indication information, if the received indication information of the code stream indicates that the scanning order is not a zigzag scanning order, then detecting the texture of the decoded block as a reference of the block to be decoded, the texture embodies the The change rule of the transform coefficient block in each direction of the transform coefficient block of the decoding block; select the scan order corresponding to the texture from the preset candidate scan order; the preset candidate scan order includes other than the zigzag scan order scan order;
按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;Scanning the transform coefficient blocks of the block to be decoded according to the scanning order of predetermined rules;
若选择的扫描顺序与所述预定规则的扫描顺序不同,则在扫描结束后根据所述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数块重置为可按照选择的扫描顺序扫描的变换系数块。If the selected scanning order is different from the scanning order of the predetermined rule, after the scanning is completed, the transform coefficient blocks of the block to be decoded are reset to follow the selected scanning order according to the selected scanning order and the scanning order of the predetermined rule Scanned block of transform coefficients.
本发明实施例提供一种变换系数块的扫描方法,包括:An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;Detecting the texture of the coded block used as a reference of the block to be coded, the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be coded in each direction;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;所述预置的候选扫描顺序包括Z形扫描顺序以及Z形扫描顺序以外的其它扫描顺序;Select a scan order corresponding to the texture from preset candidate scan orders; the preset candidate scan orders include Z-shaped scan orders and scan orders other than Z-shaped scan orders;
若选择的扫描顺序为Z形扫描顺序,则按照Z形扫描顺序对所述待编码块的变换系数块进行扫描;若选择的扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为符合Z形扫描顺序的变换系数块;按照Z形扫描顺序对重置后的所述待编码块的变换系数块进行扫描。If the selected scanning order is a zigzag scanning order, scan the transform coefficient block of the block to be encoded according to the zigzag scanning order; if the selected scanning order is other scanning order than the zigzag scanning order, then scan The transform coefficient block of the block is reset to a transform coefficient block conforming to the zigzag scanning order; and the reset transform coefficient block of the block to be encoded is scanned according to the zigzag scanning order.
本发明实施例提供一种变换系数块的扫描方法,包括:An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;Detecting the texture of the decoded block as a reference of the block to be decoded, the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be decoded in each direction;
从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;所述预置的候选扫描顺序包括Z形扫描顺序以及Z形扫描顺序以外的其它扫描顺序;Select a scan order corresponding to the texture from preset candidate scan orders; the preset candidate scan orders include Z-shaped scan orders and scan orders other than Z-shaped scan orders;
若选择的扫描顺序为Z形扫描顺序,则按照Z形扫描顺序对所述待解码块的变换系数块进行扫描;If the selected scanning order is a zigzag scanning order, scan the transform coefficient block of the block to be decoded according to the zigzag scanning order;
若选择的扫描顺序为Z形扫描顺序以外的其它扫描方式,则将待解码块的变换系数块从符合Z形扫描顺序的变换系数块重置为符合所述选择的扫描顺序的变换系数块;按照所述选择的扫描方式对重置后的所述待解码块的变换系数块进行扫描。If the selected scanning order is a scanning method other than the zigzag scanning order, resetting the transform coefficient block of the block to be decoded from the transform coefficient block conforming to the zigzag scanning order to the transform coefficient block conforming to the selected scanning order; Scanning the reset transform coefficient block of the block to be decoded according to the selected scanning manner.
本发明实施例提供一种变换系数块的扫描装置,包括:An embodiment of the present invention provides a scanning device for transform coefficient blocks, including:
第一检测单元,用于检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;The first detection unit is configured to detect the texture of the coded block as a reference of the block to be coded, the texture embodies the change law of the transformation coefficient of the transformation coefficient block in each direction of the block to be coded;
第一选择单元,用于从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;所述预置的候选扫描顺序包含Z形扫描顺序以外的其它扫描顺序;A first selection unit, configured to select a scan order corresponding to the texture from preset candidate scan orders; the preset candidate scan orders include scan orders other than the zigzag scan order;
第一处理单元,用于对预置的Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优选扫描顺序;The first processing unit is configured to perform rate-distortion optimization processing on the preset zigzag scanning order and the selected scanning order to obtain the preferred scanning order;
第一重置单元,用于若所述优选扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块;A first resetting unit, configured to reset the transformation coefficient block of the block to be coded to the transformation coefficient block scanned according to a predetermined scanning order if the preferred scanning order is other than the zigzag scanning order;
第一扫描单元,用于若优选的扫描顺序为Z形扫描顺序则按照优选扫描顺序对待编码块的变换系数块进行扫描;若所述优选扫描顺序为Z形扫描顺序以外的其它扫描顺序,则按照所述预定规则的扫描顺序对重置后的所述待编码块的变换系数块进行扫描;The first scanning unit is configured to scan the transformation coefficient blocks of the block to be coded according to the preferred scanning order if the preferred scanning order is a zigzag scanning order; if the preferred scanning order is a scanning order other than the zigzag scanning order, then Scanning the reset transform coefficient blocks of the block to be encoded according to the scanning order of the predetermined rule;
第一编码单元,用于将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。The first encoding unit is configured to encode indication information indicating whether the scanning order used for scanning is a zigzag scanning order into the code stream.
本发明实施例提供一种变换系数块的扫描装置,包括:An embodiment of the present invention provides a scanning device for transform coefficient blocks, including:
第二解析单元,用于解析码流得到指示信息;The second parsing unit is used to parse the code stream to obtain indication information;
第二检测单元,用于若接收到的码流的指示信息指示扫描顺序不是Z形扫描顺序,则检测作为待解码块的参考的已编码或解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;The second detection unit is configured to detect the texture of the encoded or decoded block as a reference of the block to be decoded if the received indication information of the code stream indicates that the scanning order is not a zigzag scanning order, and the texture reflects the to-be-decoded block. The change law of the transform coefficients of the transform coefficient block in each direction in the decoding block;
第二选择单元,用于从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;所述预置的候选扫描顺序包含Z形扫描顺序以外的其它扫描顺序;The second selection unit is configured to select a scanning order corresponding to the texture from preset candidate scanning orders; the preset candidate scanning orders include scanning orders other than the zigzag scanning order;
第二扫描单元,用于按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;The second scanning unit is configured to scan the transform coefficient blocks of the block to be decoded according to a scanning order of predetermined rules;
第二重置单元,用于若选择的扫描顺序与所述预定规则的扫描顺序不同,则在扫描结束后根据所述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数块重置为可按照选择的扫描顺序扫描的变换系数块。The second resetting unit is used to reset the transform coefficient block of the block to be decoded according to the selected scanning order and the scanning order of the predetermined rule after the scanning is completed if the selected scanning order is different from the scanning order of the predetermined rule. 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 transform coefficient blocks, including:
第三检测单元,用于检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;The third detection unit is configured to detect the texture of the coded block as a reference of the block to be coded, the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be coded in each direction;
第三选择单元,用于从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;所述预置的候选扫描顺序包括Z形扫描顺序以及Z形扫描顺序以外的其它扫描顺序;A third selection unit, configured to select a scan order corresponding to the texture from preset candidate scan orders; the preset candidate scan orders include Z-shaped scan orders and other scan orders other than Z-shaped scan orders;
第三重置单元,用于若选择的扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为符合Z形扫描顺序的变换系数块;The third resetting unit is used to reset the transform coefficient block of the block to be encoded to a transform coefficient block conforming to the Z-shape scan order if the selected scan order is other than the Z-shape scan order;
第三扫描单元,用于若选择的扫描顺序为Z形扫描顺序,则按照Z形扫描顺序对所述待编码块的变换系数块进行扫描;或者,按照Z形扫描顺序对重置后的所述待编码块的变换系数块进行扫描。The third scanning unit is configured to scan the transformation coefficient blocks of the block to be encoded according to the zigzag scanning order if the selected scanning order is the zigzag scanning order; The transform coefficient block of the block to be coded is scanned.
本发明实施例提供一种变换系数块的扫描装置,包括:An embodiment of the present invention provides a scanning device for transform coefficient blocks, including:
第四检测单元,用于检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;The fourth detection unit is configured to detect the texture of the decoded block as a reference of the block to be decoded, and the texture reflects the change law of the transform coefficient of the transform coefficient block of the block to be decoded in each direction;
第四选择单元,用于从预置的候选扫描顺序中选择与所述纹理对应的扫描顺序;所述预置的候选扫描顺序包括Z形扫描顺序以及Z形扫描顺序以外的其它扫描顺序;A fourth selection unit, configured to select a scan order corresponding to the texture from preset candidate scan orders; the preset candidate scan orders include Z-shaped scan orders and other scan orders other than Z-shaped scan orders;
第四重置单元,用于若选择的扫描顺序为Z形扫描顺序以外的其它扫描方式,则将待解码块的变换系数块从符合Z形扫描顺序的变换系数块重置为符合所述选择的扫描顺序的变换系数块;The fourth resetting unit is used to reset the transformation coefficient block of the block to be decoded from the transformation coefficient block conforming to the Z-shape scanning order to conforming to the selection if the selected scanning order is other than the Z-shape scanning order. Transform coefficient blocks in scan order;
第四扫描单元,用于若选择的扫描顺序为Z形扫描顺序,则按照Z形扫描顺序对所述待解码块的变换系数块进行扫描;或者,按照所述选择的扫描方式对重置后的所述待编码块的变换系数块进行扫描。The fourth scanning unit is configured to scan the transform coefficient block of the block to be decoded according to the zigzag scanning order if the selected scanning order is the zigzag scanning order; 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:
检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;Detecting the texture of the coded block used as a reference of the block to be coded, the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be coded in each direction;
若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使所述残差数据块对应的变换系数块为按预定规则扫描的变换系数块;If the scanning order corresponding to the texture is inconsistent with the scanning order of the predetermined rule, reset the residual data block of the block to be encoded, so that the transformation coefficient block corresponding to the residual data block is a transformation coefficient block scanned according to the predetermined rule ;
按照优选扫描顺序对所述待编码块的变换系数块进行扫描,所述优选扫描顺序为对Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理得到的扫描顺序;Scanning the transform coefficient blocks of the block to be encoded according to a preferred scanning order, the preferred scanning order is a scanning order obtained by performing rate-distortion optimization on the zigzag scanning order and the scanning order of predetermined rules;
将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。Indicating whether the scanning sequence used for scanning is a zigzag scanning sequence is encoded into the code stream.
本发明实施例提供一种变换系数块的扫描方法,包括:An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
解析码流得到指示信息,码流的指示信息指示扫描顺序;Analyze the code stream to obtain the instruction information, and the instruction information of the code stream indicates the scanning order;
按照解析的扫描顺序对待解码块的变换系数块进行扫描;Scanning the transform coefficient blocks of the block to be decoded according to the scanned scanning order;
若码流的指示信息指示扫描顺序不是Z形扫描,则检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使所述残差数据块对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块。If the indication information of the code stream indicates that the scanning order is not Z-shaped scanning, then detect the texture of the decoded block as a reference of the block to be decoded, and the texture reflects that the transformation coefficient block of the block to be decoded is transformed in each direction The changing law of coefficients; if the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, the residual of the block to be decoded will be converted according to the scanning order corresponding to the texture and the scanning order of the predetermined rule. The difference data block is reset, so that the transform coefficient block corresponding to the residual data block is a transform coefficient block that can be scanned according to a scanning order of a predetermined rule.
本发明实施例提供一种变换系数块的扫描方法,包括:An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;Detecting the texture of the coded block used as a reference of the block to be coded, the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be coded in each direction;
若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使所述残差数据块对应的变换系数块为按预定规则扫描的变换系数块;If the scanning order corresponding to the texture is inconsistent with the scanning order of the predetermined rule, reset the residual data block of the block to be encoded, so that the transformation coefficient block corresponding to the residual data block is a transformation coefficient block scanned according to the predetermined rule ;
按照预定规则的扫描顺序对所述待编码块的变换系数块进行扫描;Scanning the transform coefficient blocks of the block to be coded according to a scanning order of predetermined rules;
本发明实施例提供一种变换系数块的扫描方法,包括:An embodiment of the present invention provides a method for scanning a transform coefficient block, including:
按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;Scanning the transform coefficient blocks of the block to be decoded according to the scanning order of predetermined rules;
检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;Detecting the texture of the decoded block as a reference of the block to be decoded, the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be decoded in each direction;
若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使所述残差数据块对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块。If the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, the residual data block of the block to be decoded is reset according to the scanning order corresponding to the texture and the scanning order of the predetermined rule , making the transform coefficient block corresponding to the residual data block a transform coefficient block that can be scanned according to a scanning order of a predetermined rule.
本发明实施例提供一种变换系数块的扫描装置,包括:An embodiment of the present invention provides a scanning device for transform coefficient blocks, including:
第五检测单元,用于检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;The fifth detection unit is configured to detect the texture of the coded block as a reference of the block to be coded, the texture embodies the change law of the transformation coefficient of the transformation coefficient block of the block to be coded in each direction;
第五重置单元,用于若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使所述残差数据块对应的变换系数块为按预定规则扫描的变换系数块;The fifth resetting unit is configured to reset the residual data block of the block to be encoded if the scanning order corresponding to the texture is inconsistent with the scanning order of the predetermined rule, so that the transformation coefficient block corresponding to the residual data block is Transform coefficient blocks scanned according to predetermined rules;
第五处理单元,用于对预置的Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理得到优选扫描顺序;The fifth processing unit is configured to perform rate-distortion optimization processing on the preset zigzag scanning order and the scanning order of predetermined rules to obtain the preferred scanning order;
第五扫描单元,用于按照优选扫描顺序对待编码块的变换系数块进行扫描;The fifth scanning unit is configured to scan the transform coefficient block of the block to be encoded according to the preferred scanning order;
第五编码单元,用于将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。The fifth encoding unit is configured to encode indication information indicating whether the scanning order used for scanning is a zigzag scanning order into the code stream.
本发明实施例提供一种变换系数块的扫描装置,包括:An embodiment of the present invention provides a scanning device for transform coefficient blocks, including:
第六解析单元,用于解析码流得到指示信息;A sixth parsing unit, configured to parse the code stream to obtain indication information;
第六扫描单元,用于按照解析的扫描顺序对待解码块的变换系数块进行扫描;The sixth scanning unit is configured to scan the transform coefficient blocks of the block to be decoded according to the analyzed scanning order;
第六检测单元,用于若码流的指示信息指示扫描顺序不是Z形扫描,则检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;The sixth detection unit is configured to detect the texture of the decoded block as a reference of the block to be decoded if the indication information of the code stream indicates that the scanning order is not Z-scan, and the texture reflects the transformation of the block to be decoded The change law of the coefficient block transform coefficient in each direction;
第六重置单元,用于若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使所述残差数据块对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块。The sixth resetting unit is used to, if the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, according to the scanning order corresponding to the texture and the scanning order of the predetermined rule, the 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 according to a scanning order of a predetermined rule.
本发明实施例提供一种变换系数块的扫描装置,包括:An embodiment of the present invention provides a scanning device for transform coefficient blocks, including:
第七检测单元,用于检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;The seventh detection unit is used to detect the texture of the coded block as a reference of the block to be coded, and the texture embodies the change law of the transformation coefficient of the transformation coefficient block of the block to be coded in each direction;
第七重置单元,用于若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使所述残差数据块对应的变换系数块为按预定规则扫描的变换系数块;The seventh resetting unit is configured to reset the residual data block of the block to be encoded if the scanning order corresponding to the texture is not consistent with the scanning order of the predetermined rule, so that the transformation coefficient block corresponding to the residual data block is Transform coefficient blocks scanned according to predetermined rules;
第七扫描单元,用于按照预定规则的扫描顺序对待编码块的变换系数块进行扫描;The seventh scanning unit is configured to scan the transform coefficient block of the block to be coded according to a scanning order of predetermined rules;
本发明实施例提供一种变换系数块的扫描装置,包括:An embodiment of the present invention provides a scanning device for transform coefficient blocks, including:
第八扫描单元,用于按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;An eighth scanning unit, configured to scan the transform coefficient blocks of the block to be decoded according to a scanning order of predetermined rules;
第八检测单元,用于检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;The eighth detection unit is configured to detect the texture of the decoded block as a reference of the block to be decoded, the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be decoded in each direction;
第八重置单元,用于若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使所述残差数据块对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块。The eighth reset unit is used for if the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, the corresponding scanning order of the texture and the scanning order of the predetermined rule will 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 according to a scanning order of a predetermined rule.
上述技术方案只需要在预定的扫描顺序与Z形扫描顺序间做选择,是二选一的选择,相比于在三选一的选择可以少使用一位来携带选择的信息,因此在将其编入编码头信息时,会节省资源;另外,在选择的时候效率也更高。The above-mentioned technical solution only needs to choose between the predetermined scanning order and the Z-shaped scanning order, which is a choice of one of two choices. Compared with the choice of one of three choices, one less bit can be used to carry the selected information. When encoding header information, it will save resources; in addition, it will be more efficient when selecting.
附图说明 Description of drawings
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without any creative effort.
图1为本发明实施例方法流程示意图;Fig. 1 is a schematic flow chart of the method of the embodiment of the present invention;
图2A为本发明实施例竖直纹理的扫描顺序示意图;Fig. 2A is a schematic diagram of the scanning sequence of the vertical texture according to the embodiment of the present invention;
图2B为本发明实施例水平纹理的扫描顺序示意图;FIG. 2B is a schematic diagram of the scanning sequence of the horizontal texture according to the embodiment of the present invention;
图2C为本发明实施例斜纹理的扫描顺序示意图;FIG. 2C is a schematic diagram of the scanning sequence of oblique textures according to an embodiment of the present invention;
图3为本发明实施例方法流程示意图;Fig. 3 is a schematic flow chart of the method of the embodiment of the present invention;
图4为本发明实施例方法流程示意图;Fig. 4 is a schematic flow chart of the method of the embodiment of the present invention;
图5为本发明实施例方法流程示意图;Fig. 5 is a schematic flow chart of the method of the embodiment of the present invention;
图6为本发明实施例装置结构示意图;Fig. 6 is a schematic structural diagram of a device according to an embodiment of the present invention;
图7为本发明实施例装置结构示意图;Fig. 7 is a schematic diagram of the device structure of the embodiment of the present invention;
图8为本发明实施例装置结构示意图;Fig. 8 is a schematic structural diagram of the device of the embodiment of the present invention;
图9为本发明实施例装置结构示意图。Fig. 9 is a schematic diagram of the structure of the device according to the embodiment of the present invention.
图10为本发明实施例方法流程示意图;Fig. 10 is a schematic flow chart of the method of the embodiment of the present invention;
图11为本发明实施例方法流程示意图;Fig. 11 is a schematic flow chart of the method of the embodiment of the present invention;
图12为本发明实施例方法流程示意图;Fig. 12 is a schematic flow chart of the method of the embodiment of the present invention;
图13为本发明实施例方法流程示意图;Fig. 13 is a schematic flow chart of the method of the embodiment of the present invention;
图14为本发明实施例装置结构示意图;Fig. 14 is a schematic structural diagram of the device of the embodiment of the present invention;
图15为本发明实施例装置结构示意图;Fig. 15 is a schematic structural diagram of the device of the embodiment of the present invention;
图16为本发明实施例装置结构示意图;Fig. 16 is a schematic structural diagram of the device of the embodiment of the present invention;
图17为本发明实施例装置结构示意图。Fig. 17 is a schematic diagram of the structure of the device according to the embodiment of the present invention.
具体实施方式 Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
本发明实施例的编码端在帧间编码过程中,对于每一待编码块,从各种帧间编码类型中根据率失真准则选择最优的帧间编码类型,同时得到运动信息,由运动信息及已编码的重构帧信息,得到待编码块的预测值,对预测值和待编码块的像素值做差,得到残差值,对残差值依次进行变换、量化、扫描、熵编码操作,编入码流,同时将运动信息编入码流,完成编码过程。以下对编码和解码过程中的扫描进行具体说明。本发明实施例提到的变换可以是离散余弦变换(Discrete Cosine Transform,DCT);也可以是多变换技术,例如KL变换(Karhunen Loeve Transform,KLT)对此本发明实施例不予限定。During the inter-frame encoding process, the encoding end of the embodiment of the present invention, for each block to be encoded, selects the optimal inter-frame encoding type from various inter-frame encoding types according to the rate-distortion criterion, and obtains motion information at the same time. and the encoded reconstructed frame information to obtain the predicted value of the block to be encoded, and make a difference between the predicted value and the pixel value of the block to be encoded to obtain the residual value, and perform transformation, quantization, scanning, and entropy encoding operations on the residual value in sequence , into the code stream, and at the same time encode the motion information into the code stream to complete the encoding process. The scanning in the process of encoding and decoding is described in detail below. The transformation mentioned in the embodiment of the present invention may be a discrete cosine transform (Discrete Cosine Transform, DCT); it may also be a multi-transform technique, such as KL transform (Karhunen Loeve Transform, KLT), which is not limited in this embodiment of the present invention.
一种变换系数块的扫描方法,本实施例方案可以在编码端执行,如图1所示,包括:A method for scanning a transform coefficient block, the solution of this embodiment can be executed at the encoding end, as shown in Figure 1, including:
101:检测作为待编码块的参考的已编码块的纹理,上述纹理体现了上述待编码块的变换系数块在各方向上变换系数的变化规律;101: Detect the texture of the coded block used as a reference of the block to be coded, the above texture reflects the change rule of the transformation coefficient block in each direction of the transformation coefficient block of the above-mentioned block to be coded;
上述101属于一种物理推导,作为参考的已编码的纹理近似于当前的待编码块的纹理,而待编码的纹理又近似于待编码的残差纹理,变换系数的分布规律与残差纹理密切相关。更具体地,上述纹理包括水平纹理、竖直纹理和斜纹理;其中斜纹理也可以看作是无纹理。The above 101 belongs to a physical derivation. The coded texture used as a reference is similar to the texture of the current block to be coded, and the texture to be coded is similar to the residual texture to be coded. The distribution law of the transformation coefficient is closely related to the residual texture relevant. More specifically, the above-mentioned textures include horizontal textures, vertical textures and oblique textures; the oblique textures can also be regarded as no textures.
更具体地,上述检测已解码块的纹理包括:More specifically, the above-mentioned detection of the texture of the decoded block includes:
在执行帧间解码时,计算变换系数块的水平方向上的水平梯度值和竖直方向上的竖直梯度值;水平梯度值为水平方向上各相邻像素点的差值的绝对值的和,竖直梯度值为竖直方向上各相邻像素点的差值的绝对值的和;上述作为参考的变换系数块即为上述已解码块的变化系数块;When performing inter-frame decoding, calculate the horizontal gradient value in the horizontal direction and the vertical gradient value in the vertical direction of the transform coefficient block; the horizontal gradient value is the sum of the absolute values of the differences between adjacent pixels in the horizontal direction , the vertical gradient value is the sum of the absolute values of the differences between adjacent pixel points in the vertical direction; the above-mentioned transform coefficient block as a reference is the change coefficient block of the above-mentioned decoded block;
若水平梯度值大于N倍的竖直梯度值则确定纹理为竖直纹理,竖直梯度值大于N倍的水平梯度值则确定纹理为水平纹理,否则确定纹理为斜纹理;上述N为第一预置值,N可以由分辨率宽度来确定,例如分辨率宽度大于1000时N=2,分辨率宽度小于1000时N=1.5;以上N的取值可以根据经验来确定,具体的取值本发明实施例对此不予限定。If the horizontal gradient value is greater than N times the vertical gradient value, the texture is determined to be a vertical texture, and the vertical gradient value is greater than N times the horizontal gradient value, then the texture is determined to be a horizontal texture, otherwise it is determined that the texture is an oblique texture; the above N is the first The preset value, N can be determined by the resolution width, for example, N=2 when the resolution width is greater than 1000, and N=1.5 when the resolution width is less than 1000; The embodiment of the invention does not limit this.
在执行帧内解码时,若帧内预测模式方向的竖直方向的偏移量在M以内则确定纹理为竖直纹理,帧内预测模式方向的水平方向的偏移量在M以内则确定纹理为水平纹理,否则确定纹理为斜纹理;上述M为第二预置值,M也可以由分辨率宽度来确定,例如设置成5,还可以设置成其他值例如3、4等,对此本发明实施例不予限定。When performing intra-frame decoding, if the vertical offset of the intra-frame prediction mode direction is within M, the texture is determined to be a vertical texture, and the horizontal offset of the intra-frame prediction mode direction is within M, then the texture is determined It is a horizontal texture, otherwise it is determined that the texture is an oblique texture; the above M is the second preset value, and M can also be determined by the resolution width, for example, it can be set to 5, or it can be set to other values such as 3, 4, etc., for this purpose The embodiments of the invention are not limited.
进一步地,本发明实施例还提供了修正预置值的实现方式:若已经解码的块中,水平纹理与竖直纹理的比值超过第三预置值则缩小N的值,若水平纹理与竖直纹理的比值小于N,则增大N的值。第三预置值可以由以下方式得到,通过对不同特点的变换系数的序列进行帧内编码,统计水平、竖直预测方向的比例关系,该比例关系即可以作为第三预置值。Further, the embodiment of the present invention also provides an implementation method of modifying the preset value: if the ratio of the horizontal texture to the vertical texture exceeds the third preset value in the decoded block, then reduce the value of N; if the ratio of the horizontal texture to the vertical texture If the ratio of straight texture is less than N, increase the value of N. The third preset value can be obtained in the following manner. By performing intra-frame coding on the sequence of transform coefficients with different characteristics, and statistically calculating the proportional relationship between the horizontal and vertical prediction directions, the proportional relationship can be used as the third preset value.
可选地,若存在已编码块或解码块,那么已经编码块或解码块的纹理则是已知的,此时可以利用这些信息减少运算量;上述检测变换系数块的纹理包括:检测待解码块设定时域或空域距离内已经编码块或解码块的纹理,将检测到的纹理确定为变换系数块的纹理。Optionally, if there is an encoded block or a decoded block, then the texture of the encoded block or decoded block is known, and this information can be used to reduce the amount of computation; the above detection of the texture of the transform coefficient block includes: detecting the texture to be decoded The block sets the texture of the coded block or decoded block within the temporal or spatial distance, and determines the detected texture as the texture of the transform coefficient block.
102:从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;在本实施例中预置的候选扫描顺序包含Z形扫描顺序以外的其它扫描顺序;102: Select a scanning order corresponding to the above-mentioned texture from the preset candidate scanning orders; in this embodiment, the preset candidate scanning orders include scanning orders other than the zigzag scanning order;
上述纹理对应的扫描顺序包括如图2A~图2C所示的:竖直纹理对应逐行扫描的水平扫描顺序、水平纹理对应逐列扫描的竖直扫描顺序、斜纹理对应Z形顺序扫描的Z形扫描顺序。图2A~图2C中以4X4矩阵为例,其中圆形代表变换系数,圆形下的数值表示变换系数其所在的坐标(即位置),箭头方向表示扫描方向,即扫描顺序。需要说明的是图2C左边和矩阵和右边的矩阵分别代表一种Z形扫描顺序,Z形扫描顺序是可以自定义的,所以可能的种类较多,图2C的举例也不是穷举;因此本发明实施例对Z形扫描顺序不予限定。The scanning order corresponding to the above textures includes as shown in Figure 2A to Figure 2C: vertical texture corresponds to the horizontal scanning order of progressive scanning, horizontal texture corresponds to the vertical scanning order of column-by-column scanning, and oblique texture corresponds to the Z-shaped sequential scanning. shape scan order. 2A to 2C take a 4X4 matrix as an example, where the circle represents the transformation coefficient, the value under the circle represents the coordinate (ie position) of the transformation coefficient, and the direction of the arrow represents the scanning direction, that is, the scanning order. It should be noted that the matrix on the left side of Figure 2C and the matrix on the right represent a Z-shaped scanning order, and the Z-shaped scanning order can be customized, so there are many possible types, and the examples in Figure 2C are not exhaustive; therefore, this paper The embodiment of the invention does not limit the zigzag scanning sequence.
103:对预置的Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优选扫描顺序;103: Perform rate-distortion optimization processing on the preset zigzag scanning order and the selected scanning order to obtain the optimal scanning order;
104:若优选的扫描顺序为Z形扫描顺序则按照优选扫描顺序对待编码块的变换系数块进行扫描;若上述优选扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块;按照上述预定规则的扫描顺序对重置后的上述待编码块的变换系数块进行扫描;104: If the preferred scanning order is a zigzag scanning order, scan the transform coefficient blocks of the block to be encoded according to the preferred scanning order; if the above preferred scanning order is other than the zigzag scanning order, then transform The coefficient block is reset to the transform coefficient block scanned according to the scanning order of the predetermined rule; the reset transform coefficient block of the block to be encoded is scanned according to the scanning order of the predetermined rule;
更具体地,上述104中,若上述优选扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块;按照上述预定规则的扫描顺序对重置后的上述待编码块的变换系数块进行扫描包括:More specifically, in the above 104, if the above-mentioned preferred scanning order is other than the zigzag scanning order, the transform coefficient block of the block to be coded is reset to the transform coefficient block scanned according to the scanning order of the predetermined rule; according to the above Scanning the reset transform coefficient blocks of the blocks to be coded in a scanning order of predetermined rules includes:
若优选的扫描顺序为第一扫描顺序,则将待编码块的变换系数转置,按照第二扫描顺序对转置后的上述待编码块的变换系数块进行扫描;上述第一扫描顺序与第二扫描顺序的扫描顺序是对称的;If the preferred scanning order is the first scanning order, the transform coefficients of the block to be encoded are transposed, and the transposed transform coefficient blocks of the block to be encoded are scanned according to the second scanning order; the first scanning order and the second scanning order The scan order of the second scan order is symmetric;
若优选的扫描顺序为第二扫描顺序,则按照第二扫描顺序对上述待编码块的变换系数块进行扫描。If the preferred scanning order is the second scanning order, the transform coefficient blocks of the block to be encoded are scanned according to the second scanning order.
需要说明的是,以上“第一”和“第二”用于区分两个具有对称关系的扫描顺序,不作其它限定,例如:水平扫描顺序和竖直扫描顺序之间就是两个具有对称关系的扫描顺序,若第一扫描顺序为水平扫描顺序则第二扫描顺序为竖直扫描顺序,若第一扫描顺序为竖直扫描顺序则第二扫描顺序为水平扫描顺序。It should be noted that the above "first" and "second" are used to distinguish two scanning sequences with a symmetrical relationship, and there is no other limitation. For example, there are two symmetrical scanning sequences between the horizontal scanning sequence and the vertical scanning sequence. The scanning order, if the first scanning order is a horizontal scanning order, then the second scanning order is a vertical scanning order, and if the first scanning order is a vertical scanning order, then the second scanning order is a horizontal scanning order.
更具体地,上述104中,将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块;按照上述预定规则的扫描顺序对重置后的上述待编码块的变换系数块进行扫描包括:则将待编码块的变换系数块重置为符合Z形扫描顺序的变换系数块;按照Z形扫描顺序对重置后的上述待编码块的变换系数块进行扫描。若采用本方法可以不用传递105中的指示信息,后续实施例将详细说明。More specifically, in the above 104, the transform coefficient block of the block to be coded is reset to a transform coefficient block scanned according to the scanning order of the predetermined rule; the transformed coefficient block of the block to be coded after the reset is The block scanning includes: resetting the transform coefficient blocks of the block to be coded to conform to the zigzag scanning order; and scanning the reset transform coefficient blocks of the block to be coded according to the zigzag scanning order. If this method is adopted, the instruction information in step 105 may not be transmitted, which will be described in detail in subsequent embodiments.
105:将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。105: Encode the indication information of whether the scanning sequence used for scanning is a zigzag scanning sequence into the code stream.
以上实施方式,只需要在预定的扫描顺序与Z形扫描顺序间做选择,是二选一的选择,相比于在三选一的选择可以少使用一位来携带选择的信息,因此在将其编入编码头信息时,会节省资源;另外,在选择的时候效率也更高。另外通过对变换系数矩阵转置的方式,复用相同的熵编码模型可以提高编码效率。In the above implementation mode, it is only necessary to choose between the predetermined scanning order and the Z-shaped scanning order, which is a choice of one of two choices. Compared with the choice of one of three choices, one less bit can be used to carry the selected information. Therefore, in the future When encoding header information, it will save resources; in addition, it will be more efficient when selecting. In addition, by transposing the transform coefficient matrix, multiplexing the same entropy coding model can improve the coding efficiency.
更具体地,本实施例还提供了预置候选扫描顺序的实现方式的举例,上述预置候选扫描顺序包括:More specifically, this embodiment also provides an example of an implementation manner of presetting the candidate scanning order. The above preset candidate scanning order includes:
预先定义的扫描规则,扫描规则确定了扫描的顺序;或者,预先统计两个或两个以上的变换系数块各位置的变换系数为非零的次数,按从大到小的顺序排列各个非零次数对应的变换系数的位置,将排列得到的上述变换系数的位置的顺序确定为预置的候选扫描顺序。Pre-defined scanning rules, which determine the order of scanning; or, pre-count the number of non-zero transform coefficients at each position of two or more transform coefficient blocks, and arrange each non-zero For the positions of the transform coefficients corresponding to the number of times, the order of the positions of the transform coefficients obtained by arranging is determined as a preset candidate scanning order.
在以上的预置候选扫描方式的举例的后一种实现方式本发明实施例给出了一个举例说明:在编码器中,依据残差块的纹理,量化残差可以分为三类:水平纹理对应的量化残差、竖直纹理对应的量化残差、斜纹理对应的量化残差;确定扫描顺序的方式为:建立与变换系数个数相同的计数器组(例如4x4变换则为16个计数器),然后用计数器进行计数,具体为:判断各个变换系数上是否为零,如果非零,则对应位置的计数器加一;检测的变换系数块的数量达到设定的数量以后,各个计数器均有其计数的数值;此时可以从大到小排列各个计数器的值,将排列得到的上述变换系数的位置的顺序确定为预置的候选扫描顺序。使用该方法,按照得到的顺序进行扫描时,数值大的计数器其所对应的变换系数位置会在扫描顺序中排在前面。The embodiment of the present invention gives an example in the latter implementation of the above example of the preset candidate scanning mode: In the encoder, according to the texture of the residual block, the quantization residual can be divided 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 way to determine the scanning order is to establish a counter group with the same number of transform coefficients (for example, 4x4 transform is 16 counters) , and then use the counter to count, specifically: judge whether each transform coefficient is zero, if it is not zero, then add one to the counter at the corresponding position; after the number of detected transform coefficient blocks reaches the set number, each counter has its own The value of the count; at this time, the values of each counter can be arranged in descending order, and the order of the positions of the above-mentioned transformation coefficients obtained by the arrangement can be determined as the preset candidate scanning order. Using this method, when scanning is performed according to the obtained order, the position of the transformation coefficient corresponding to the counter with a large value will be arranged at the front in the scanning order.
举例方案一、以下对编码过程中的扫描环节进行具体说明:Example scheme 1. The following is a specific description of the scanning link in the encoding process:
A:按照编码流程编码,直到进行变换系数编码之前;A: Encode according to the encoding process until the transformation coefficient encoding is performed;
B:若执行的是帧间编码(Inter),则对参考块纹理进行检测,得到其纹理(水平Hor纹理、竖直ver纹理、斜纹理);若在执行的是帧内编码(Intra)的情况,如果帧内预测模式(intra prediction mode,ipmode)的方向为ver+/-5,其纹理为竖直纹理,方向为Hor+/-5,其纹理为水平纹理,其余情况为斜纹理。本实施例中设置的偏移量是5,当然还可以设置成其他值,对此本发明实施例不予限定。根据得到的纹理从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序。B: If inter-frame coding (Inter) is performed, the texture of the reference block is detected to obtain its texture (horizontal Hor texture, vertical ver texture, oblique texture); if intra-frame coding (Intra) is performed In some cases, if the direction of the intra prediction mode (ipmode) is ver+/-5, the texture is a vertical texture, the direction is Hor+/-5, and the texture is a horizontal texture, and in other cases it is an oblique texture. The offset set in this embodiment is 5, of course, it can also be set to other values, which is not limited in this embodiment of the present invention. A scanning order corresponding to the above texture is selected from preset candidate scanning orders according to the obtained texture.
上述B中的检测方法可以是:The detection method in the above B can be:
B1:确定检测步长。该步骤为不同变换单元(Transform Unit,TU)设置不同的检测步长,例如TU=4时,步长为1,TU=8时,步长为1,TU=16时,步长为2,TU=32时,步长为4,也可以所有大小的TU对应步长均为1;如果所有大小的TU都使用相同的步长那么B1这个步骤是可以省略的。B1: Determine the detection step size. This step sets different detection steps for different transformation units (Transform Unit, TU). For example, when TU=4, the step size is 1, when TU=8, the step size is 1, and when TU=16, the step size is 2. When TU=32, the step size is 4, or the corresponding step size of all sizes of TUs is 1; if all sizes of TUs use the same step size, then the step B1 can be omitted.
B2:对参考块(即作为参考的变换系数块)中,水平方向相邻检测步长的每两个像素点求差值;累加差值的绝对值得到水平梯度值;B2: In the reference block (that is, the transform coefficient block used as a reference), the difference value is calculated for every two pixels of adjacent detection steps in the horizontal direction; the absolute value of the accumulated difference value is obtained to obtain the horizontal gradient value;
B3:对参考块中,竖直方向相邻检测步长的每两个像素点求差值;累加差值的绝对值得到竖直梯度值;B3: Calculate the difference between every two pixels of the adjacent detection step in the vertical direction in the reference block; accumulate the absolute value of the difference to obtain the vertical gradient value;
B4:如果水平梯度值大于N倍的竖直梯度值,则确定其纹理为竖直纹理;如果竖直梯度值大于N倍的水平梯度值,则确定其纹理为水平纹理;其它情况为斜纹理;B4之后,还可以进一步地根据已编码块中的水平、竖直、斜纹理比例分布,判断阈值N是否需要更新,判断方式是判断水平梯度值与竖直梯度值的比例是否超过预置值,若是,则增大预置值,否,则缩小预置值。(其中预置值由以下方式得到,通过对不同特点的变换系数的序列进行帧内编码,统计水平、竖直预测方向的比例关系,该比例关系即可以作为预置值。步骤C是对预置值的一个自动修正的过程,该过程并不是必须执行的步骤。B4: If the horizontal gradient value is greater than N times the vertical gradient value, then determine its texture as vertical texture; if the vertical gradient value is greater than N times the horizontal gradient value, determine its texture as horizontal texture; otherwise it is oblique texture ; After B4, it is also possible to further judge whether the threshold N needs to be updated according to the proportion distribution of horizontal, vertical and oblique textures in the coded block. The judgment method is to judge whether the ratio of the horizontal gradient value to the vertical gradient value exceeds the preset value , if yes, increase the preset value, otherwise, decrease the preset value. (wherein the preset value is obtained by the following method, by performing intra-frame coding on the sequence of transform coefficients with different characteristics, and statistically calculating the proportional relationship between the horizontal and vertical prediction directions, the proportional relationship can be used as the preset value. Step C is to preset An automatic correction process of setting values, which is not a mandatory step.
另外,对于以上编码过程中的步骤B检测的方法可以有替代的方案:检测待解码块设定时域或空域的距离内已经编码块或解码块的纹理,将检测到的纹理确定为作为待解码块的变换系数块的纹理。更具体地,例如将检测待解码块周边(上、左、左上、右上、左下)的已解码块的纹理作为当前待解码块变换系数块的纹理。In addition, for the method of step B detection in the above encoding process, there may be an alternative solution: detect the texture of the encoded block or decoded block within the set time domain or spatial domain distance of the block to be decoded, and determine the detected texture as the The texture of the transform coefficient block for the decoded block. More specifically, for example, the texture of the decoded block surrounding (upper, left, upper left, upper right, lower left) of the block to be decoded is detected as the texture of the transform coefficient block of the current block to be decoded.
C:对预置的Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优选扫描顺序;C: performing rate-distortion optimization processing on the preset Z-shaped scanning order and the selected scanning order to obtain the optimal scanning order;
D:判断优选的扫描顺序是否为Z形扫描顺序,如果是,则执行G,如果否,则执行E;D: Determine whether the preferred scanning sequence is a Z-shaped scanning sequence, if yes, execute G, if not, execute E;
E:如果扫描顺序为竖直,则将变换系数转置;如果扫描顺序为水平,继续;E: If the scanning order is vertical, transpose the transform coefficients; if the scanning order is horizontal, continue;
F:按照水平扫描顺序及相关熵编码模型对待扫描的变换系数块进行扫描,然后继续后续的编码过程。F: Scan the transformation coefficient block to be scanned according to the horizontal scanning order and the relevant entropy coding model, and then continue the subsequent coding process.
G:按照Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行编码、扫描,然后继续后续的编码过程。G: Encode and scan the transformation coefficient blocks to be scanned according to the zigzag scanning sequence and the relevant entropy coding model, and then continue the subsequent coding process.
H:将上述进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。本步骤可以在步骤G或F执行过程中进行。可以理解的是,编码完成后会将编码的结果(码流)发送给解码端,对此本发明实施例其他位置不一一说明。H: Encode the indication information of whether the scanning sequence used for scanning is a zigzag scanning sequence into the code stream. This step can be performed during the execution of step G or F. It can be understood that, after the encoding is completed, the encoding result (code stream) will be sent to the decoding end, which will not be described in other places in this embodiment of the present invention.
对应的,本发明实施例还提供了在解码端执行的一种变换系数块的扫描方法,如图3所示,包括:Correspondingly, the embodiment of the present invention also provides a scanning method for transform coefficient blocks performed at the decoding end, as shown in FIG. 3 , including:
301:解析码流得到指示信息;301: Analyze the code stream to obtain instruction information;
302:若接收到的码流的指示信息指示扫描顺序是Z形扫描顺序,按照Z形扫描顺序对待解码块的变换系数块进行扫描;扫描的流程结束。302: If the received code stream indication information indicates that the scanning order is a zigzag scanning order, scan the transformation coefficient blocks of the block to be decoded according to the zigzag scanning order; the scanning process ends.
303:若接收到的码流的指示信息指示扫描顺序不是Z形扫描顺序,则检测作为上述待解码块的参考的已解码块的纹理,上述纹理体现了上述待解码块的变换系数块在各方向上变换系数的变化规律;从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;本实施例中上述预置的候选扫描顺序包含Z形扫描顺序以外的其它扫描顺序;303: If the received indication information of the code stream indicates that the scanning order is not a zigzag scanning order, then detect the texture of the decoded block as a reference of the block to be decoded, the texture reflects the transform coefficient block of the block to be decoded in each The change law of the transformation coefficient in the direction; select the scanning sequence corresponding to the above-mentioned texture from the preset candidate scanning sequence; in this embodiment, the above-mentioned preset candidate scanning sequence includes other scanning sequences other than the Z-shaped scanning sequence;
304:按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;若选择的扫描顺序与上述预定规则的扫描顺序相同,扫描的流程结束。304: Scan the transform coefficient blocks of the block to be decoded according to the scanning order of the predetermined rule; if the selected scanning order is the same as the scanning order of the predetermined rule, the scanning process ends.
305:若选择的扫描顺序与上述预定规则的扫描顺序不同,则在扫描结束后根据上述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数块重置为可按照选择的扫描顺序扫描的变换系数块。可以理解的是,本实施例与编码端对应的,那么上述待解码块的变换系数块曾经经过编码端按照上述预定规则重置过。305: If the selected scanning order is different from the scanning order of the above-mentioned predetermined rules, after the scanning is completed, reset the transform coefficient blocks of the block to be decoded to follow the selected scanning order according to the above-mentioned selected scanning order and the scanning order of the predetermined rules Scanned block of transform coefficients. It can be understood that this embodiment corresponds to the encoding end, so the transform coefficient block of the block to be decoded has been reset by the encoding end according to the above predetermined rule.
更具体地,上述按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;若选择的扫描顺序与上述预定规则的扫描顺序不同,则在扫描结束后根据上述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数块重置为可按照选择的扫描顺序扫描的变换系数块包括:More specifically, the transform coefficient blocks of the block to be decoded are scanned according to the scanning order of the predetermined rule; if the selected scanning order is different from the scanning order of the predetermined rule, after the scanning is completed, The scan order resets the transform coefficient blocks of the block to be decoded to transform coefficient blocks that can be scanned in the selected scan order including:
若选择的扫描顺序为第一扫描顺序,按照第二扫描顺序上述待解码块的变换系数块进行扫描;扫描完成后将待解码块的变换系数转置;上述第一扫描顺序与第二扫描顺序的扫描顺序是对称的,第二扫描顺序为上述预定规则的扫描顺序。If the selected scanning order is the first scanning order, scan the transform coefficient block of the block to be decoded according to the second scanning order; after the scanning is completed, transpose the transform coefficient block of the block to be decoded; the first scanning order and the second scanning order The scanning sequence is symmetrical, and the second scanning sequence is the scanning sequence of the above-mentioned predetermined rules.
举例方案二、解码过程与编码过程扫描的方法类似:Example 2: The decoding process is similar to the scanning method of the encoding process:
A:按照解码流程解码,直到进行变换系数解析之前;A: Decode according to the decoding process until the transformation coefficient analysis is performed;
B:解析码流,得到指示信息,该指示信息即编码过程的步骤H中的指示信息;判断指示信息是否指示扫描顺序为Z形扫描顺序;若是,执行E;否则执行C;B: Analyze the code stream to obtain the instruction information, which is the instruction information in the step H of the encoding process; judge whether the instruction information indicates that the scanning sequence is a Z-shaped scanning sequence; if so, execute E; otherwise, execute C;
C:本步骤可以参考举例方案一的步骤B,根据得到的纹理从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序,然后执行D;C: For this step, you can refer to step B of Example Scheme 1, select the scanning order corresponding to the above texture from the preset candidate scanning order according to the obtained texture, and then execute D;
D:如果纹理方向对应竖直扫描顺序,则按照水平扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、扫描,然后对变换系数转置,继续后续的解码过程;如果纹理方向对应水平扫描顺序,则按照水平扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、扫描,继续后续的解码过程;D: If the texture direction corresponds to the vertical scanning order, analyze and scan the transformation coefficient block to be scanned according to the horizontal scanning order and the relevant entropy coding model, and then transpose the transformation coefficients to continue the subsequent decoding process; if the texture direction corresponds to the horizontal Scanning order, analyze and scan the transformation coefficient blocks to be scanned according to the horizontal scanning order and related entropy coding model, and continue the subsequent decoding process;
E:按照Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、扫描,然后继续后续的解码过程。E: Analyze and scan the transformation coefficient blocks to be scanned according to the zigzag scanning sequence and the relevant entropy coding model, and then continue the subsequent decoding process.
以上举例方案一和二,只需要在水平和竖直的扫描顺序与Z形扫描顺序间做选择,是二选一的选择,相比于在水平、竖直以及Z形扫描顺序(zig-zag)之间的三选一的选择可以少使用一位来携带选择的信息,因此在将其编入编码头信息时,会节省资源;另外,在选择的时候效率也更高。The above examples of schemes 1 and 2 only need to choose between the horizontal and vertical scanning order and the Z-shaped scanning order, which is a choice between the two, compared to the horizontal, vertical and Z-shaped scanning order (zig-zag ) can use one less bit to carry the selected information, so when it is encoded into the encoding header information, it will save resources; in addition, it is more efficient when selecting.
本发明实施例还给出了另一种变换系数块的扫描方法,该方案在编码设备中执行,在以上两个方案的基础之上更进一步地不用传递指示信息,可以进一步地提高编码效率;如图4所示,包括:The embodiment of the present invention also provides another scanning method for the transform coefficient block, which is implemented in the coding device, and further improves the coding efficiency without transmitting instruction information on the basis of the above two solutions; As shown in Figure 4, including:
401:检测作为待编码块的参考的已编码块的纹理,上述纹理体现了上述待编码块的变换系数块在各方向上变换系数的变化规律;401: Detect the texture of the coded block used as a reference of the block to be coded, the above texture reflects the change rule of the transformation coefficient block in each direction of the transformation coefficient block of the above-mentioned block to be coded;
402:从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;本实施例中预置的候选扫描顺序包括Z形扫描顺序以及Z形扫描顺序以外的其它扫描顺序;402: Select a scan sequence corresponding to the above texture from the preset candidate scan sequences; the preset candidate scan sequences in this embodiment include Z-shaped scan sequences and other scan sequences other than the Z-shaped scan sequence;
403:若选择的扫描顺序为Z形扫描顺序,则按照Z形扫描顺序对上述待编码块的变换系数块进行扫描;若选择的扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为符合Z形扫描顺序的变换系数块;按照Z形扫描顺序对重置后的上述待编码块的变换系数块进行扫描。403: If the selected scanning order is a zigzag scanning order, scan the transform coefficient block of the block to be encoded according to the zigzag scanning order; if the selected scanning order is other than the zigzag scanning order, then The transform coefficient blocks of the encoding block are reset to transform coefficient blocks conforming to the zigzag scanning order; the reset transform coefficient blocks of the block to be encoded are scanned according to the zigzag scanning order.
对应的,本发明实施例还提供了另一种变换系数块的扫描方法,本方案在解码设备中执行,不用传递指示信息,可以进一步地提高编码效率;如图5所示,包括:Correspondingly, the embodiment of the present invention also provides another scanning method for the transform coefficient block. This solution is implemented in the decoding device, and the coding efficiency can be further improved without transmitting instruction information; as shown in FIG. 5 , it includes:
举例方案一、以下对编码过程中的扫描环节进行具体说明:Example scheme 1. The following is a specific description of the scanning link in the encoding process:
以下对编码过程中的扫描环节进行具体说明:The following is a specific description of the scanning link in the encoding process:
A:按照编码流程编码,直到进行变换系数编码之前;A: Encode according to the encoding process until the transformation coefficient encoding is performed;
B:本步骤可以参考举例方案一的步骤B,根据得到的纹理从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;B: For this step, refer to Step B of Example Scheme 1, and select the scan order corresponding to the above texture from the preset candidate scan orders according to the obtained texture;
C:按照选定的扫描顺序将变换系数的位置重置为符合Z形扫描顺序的位置关系;C: According to the selected scan order, reset the position of the transformation coefficients to conform to the positional relationship of the zigzag scan order;
D:按照Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行编码、扫描,然后继续后续的编码过程。D: Encoding and scanning the transformation coefficient blocks to be scanned according to the zigzag scanning sequence and the related entropy coding model, and then continue the subsequent coding process.
501:检测作为上述待解码块的参考的已解码块的纹理,上述纹理体现了上述待解码块的变换系数块在各方向上变换系数的变化规律;501: Detect the texture of the decoded block used as a reference of the block to be decoded, the texture reflects the change rule of the transform coefficient block in each direction of the transform coefficient block of the block to be decoded;
502:从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;本实施例中预置的候选扫描顺序包括Z形扫描顺序以及Z形扫描顺序以外的其它扫描顺序;502: Select a scan sequence corresponding to the above texture from the preset candidate scan sequences; the preset candidate scan sequences in this embodiment include Z-shaped scan sequences and other scan sequences other than the Z-shaped scan sequence;
503:若选择的扫描顺序为Z形扫描顺序,则按照Z形扫描顺序对上述待解码块的变换系数块进行扫描;503: If the selected scanning order is a zigzag scanning order, scan the transformation coefficient blocks of the block to be decoded according to the zigzag scanning order;
504:若选择的扫描顺序为Z形扫描顺序以外的其它扫描方式,则将待解码块的变换系数块从符合Z形扫描顺序的变换系数块重置为符合上述选择的扫描顺序的变换系数块;按照上述选择的扫描方式对重置后的上述待解码块的变换系数块进行扫描。504: If the selected scanning order is a scanning method other than the zigzag scanning order, reset the transform coefficient block of the block to be decoded from the transform coefficient block conforming to the zigzag scanning order to the transform coefficient block conforming to the above selected scanning order ; Scan the reset transform coefficient block of the block to be decoded according to the selected scanning mode.
对应的解码过程与编码过程扫描的方法类似:The corresponding decoding process is similar to the scanning method of the encoding process:
A:按照解码流程解码,直到进行变换系数解析之前;A: Decode according to the decoding process until the transformation coefficient analysis is performed;
B:按照Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、扫描;B: Analyzing and scanning the transformation coefficient blocks to be scanned according to the Z-shape scanning sequence and the relevant entropy coding model;
C:本步骤可以参考举例方案一的步骤B,根据得到的纹理从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;C: For this step, refer to Step B of Example Scheme 1, and select the scanning sequence corresponding to the above texture from the preset candidate scanning sequences according to the obtained texture;
D:如果纹理方向对应竖直扫描顺序,将变换系数的位置重置为符合竖直扫描顺序的位置关系;如果纹理方向对应水平扫描顺序,将变换系数的位置重置为符合水平扫描顺序的位置关系;如果纹理方向对应Z形扫描顺序,则不进行该步骤操作;D: If the texture direction corresponds to the vertical scanning order, reset the position of the transformation coefficient to conform to the positional relationship of the vertical scanning order; if the texture direction corresponds to the horizontal scanning order, reset the position of the transformation coefficient to conform to the position of the horizontal scanning order relationship; if the texture direction corresponds to the Z-shaped scanning order, this step is not performed;
E:继续后续的解码过程;E: continue the subsequent decoding process;
对于单扫描方案而言变换系数的扫描顺序(即第一个扫描,第二个扫描,第三个扫描...)对应着唯一的频域位置关系(即(0,0),(0,1),(1,0)...),所以在解析后扫描的点时可以根据其频域周边已经解析的点的数值来为其赋予一个可能的值(即建立熵编码模型,可以看作是一种预测,从而使编码效率更高)。对于多扫描方案来说,由于在解析变换系数前已经确定了扫描顺序,即已经确定了扫描顺序与频域位置的关系,所以对于每一种扫描顺序依然可以按照单扫描方案的方式进行。本发明实施例在解析变换系数之前,可以判定是否是zig-zag而无法区分水平和竖直,所以如果不做任何操作,在非zig-zag时,无法确定扫描顺序与频域位置的关系,也就没有办法进行熵编码模型的建立,也就无法解码。上述方案通过重置的方式解决了这一问题。For the single-scan scheme, the scanning order of the transform coefficients (ie, the first scan, the second scan, the third scan...) corresponds to a unique frequency domain position relationship (ie (0, 0), (0, 1), (1, 0)...), so when analyzing the scanned point, it can be given a possible value according to the value of the analyzed point around its frequency domain (that is, to establish an entropy coding model, you can see The operation is a kind of prediction, which makes the encoding more efficient). For the multi-scan solution, since the scan order has been determined before analyzing the transform coefficients, that is, the relationship between the scan order and the frequency domain position has been determined, each scan order can still be performed in the manner of the single-scan solution. In the embodiment of the present invention, before analyzing the transformation coefficient, it can determine whether it is zig-zag and cannot distinguish between horizontal and vertical. Therefore, if no operation is performed, the relationship between the scanning order and the frequency domain position cannot be determined when it is not zig-zag. There is no way to establish an entropy coding model, and it cannot be decoded. The above solution solves this problem by resetting.
以下是对本发明实施例提供的方案进行的仿真实验的结果。The following is the result of a simulation experiment performed on the solution provided by the embodiment of the present invention.
测试条件:JCTVC high efficiency low delay test condition;Test conditions: JCTVC high efficiency low delay test condition;
测试结果:其中第三列是集成于TMuC(新一代视频编码测试软件平台)技术方案的结果,第四列是本发明实施例方案的结果,可以看出本发明实施例方案效率较高。Test results: the third column is the result of the technical solution integrated in TMuC (new generation video coding test software platform), and the fourth column is the result of the embodiment of the present invention. It can be seen that the efficiency of the embodiment of the present invention is higher.
一种变换系数块的扫描装置,如图6上述,包括:A scanning device for a transform coefficient block, as described above in Figure 6, comprising:
第一检测单元601,用于检测作为待编码块的参考的已编码块的纹理,上述纹理体现了上述待编码块的变换系数块在各方向上变换系数的变化规律;The first detection unit 601 is configured to detect the texture of the coded block as a reference of the block to be coded, and the above texture reflects the change law of the transformation coefficient of the transformation coefficient block of the above-mentioned block to be coded in each direction;
第一选择单元602,用于从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;上述预置的候选扫描顺序包含Z形扫描顺序以外的其它扫描顺序;The first selection unit 602 is configured to select a scanning order corresponding to the above-mentioned texture from preset candidate scanning orders; the above-mentioned preset candidate scanning orders include scanning orders other than the zigzag scanning order;
第一处理单元603,用于对预置的Z形扫描顺序和选择的扫描顺序进行率失真优选处理得到优选扫描顺序;The first processing unit 603 is configured to perform rate-distortion optimization processing on the preset zigzag scanning order and the selected scanning order to obtain the preferred scanning order;
第一重置单元604,用于若上述优选扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为按预定规则的扫描顺序扫描的变换系数块;The first resetting unit 604 is configured to reset the transformation coefficient block of the block to be encoded to the transformation coefficient block scanned according to the predetermined regular scanning order if the above-mentioned preferred scanning order is other than the zigzag scanning order;
第一扫描单元605,用于若优选的扫描顺序为Z形扫描顺序则按照优选扫描顺序对待编码块的变换系数块进行扫描;若上述优选扫描顺序为Z形扫描顺序以外的其它扫描顺序,则按照上述预定规则的扫描顺序对重置后的上述待编码块的变换系数块进行扫描;The first scanning unit 605 is configured to scan the transformation coefficient blocks of the block to be coded according to the preferred scanning order if the preferred scanning order is the Z-shaped scanning order; if the above-mentioned preferred scanning order is other than the Z-shaped scanning order, then Scanning the reset transform coefficient blocks of the block to be encoded according to the scanning order of the predetermined rules;
第一编码单元606,用于将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。The first encoding unit 606 is configured to encode indication information indicating whether the scanning order used for scanning is a zigzag scanning order into the code stream.
一种变换系数块的扫描装置,如图7所示,包括:A scanning device for transform coefficient blocks, as shown in Figure 7, comprising:
第二解析单元701,用于解析码流得到指示信息;The second parsing unit 701 is configured to parse the code stream to obtain indication information;
第二检测单元702,用于若接收到的码流的指示信息指示扫描顺序不是Z形扫描顺序,则检测作为待解码块的参考的已编码或解码块的纹理,上述纹理体现了上述待解码块的变换系数块在各方向上变换系数的变化规律;The second detection unit 702 is configured to detect the texture of the encoded or decoded block as a reference of the block to be decoded if the received indication information of the code stream indicates that the scanning order is not a zigzag scanning order, and the texture reflects the above-mentioned to-be-decoded Transformation coefficients of a block The change law of the transformation coefficients of the block in each direction;
第二选择单元703,用于从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;上述预置的候选扫描顺序包含Z形扫描顺序以外的其它扫描顺序;The second selection unit 703 is configured to select a scanning order corresponding to the above-mentioned texture from preset candidate scanning orders; the above-mentioned preset candidate scanning orders include scanning orders other than the zigzag scanning order;
第二扫描单元704,用于按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;The second scanning unit 704 is configured to scan the transform coefficient blocks of the block to be decoded according to a scanning order of predetermined rules;
第二重置单元705,用于若选择的扫描顺序与上述预定规则的扫描顺序不同,则在扫描结束后根据上述选择的扫描顺序以及预定规则的扫描顺序将待解码块的变换系数块重置为可按照选择的扫描顺序扫描的变换系数块。The second reset unit 705 is configured to reset the transform coefficient blocks of the block to be decoded according to the selected scanning order and the scanning order of the predetermined rule after the scanning is completed if the selected scanning order is different from the scanning order of the predetermined rule is a block of transform coefficients that can be scanned in the selected scan order.
一种变换系数块的扫描装置,如图8所示,包括:A scanning device for transform coefficient blocks, as shown in Figure 8, comprising:
第三检测单元801,用于检测作为待编码块的参考的已编码块的纹理,上述纹理体现了上述待编码块的变换系数块在各方向上变换系数的变化规律;The third detection unit 801 is configured to detect the texture of the coded block as a reference of the block to be coded, the above texture embodies the change law of the transformation coefficient of the transformation coefficient block of the above-mentioned block to be coded in each direction;
第三选择单元802,用于从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;上述预置的候选扫描顺序包括Z形扫描顺序以及Z形扫描顺序以外的其它扫描顺序;The third selection unit 802 is configured to select a scanning order corresponding to the above-mentioned texture from preset candidate scanning orders; the above-mentioned preset candidate scanning orders include Z-shaped scanning orders and other scanning orders other than Z-shaped scanning orders;
第三重置单元803,用于若选择的扫描顺序为Z形扫描顺序以外的其它扫描顺序,则将待编码块的变换系数块重置为符合Z形扫描顺序的变换系数块;The third resetting unit 803 is configured to reset the transformation coefficient block of the block to be encoded to a transformation coefficient block conforming to the Z-shape scanning order if the selected scanning order is a scanning order other than the Z-shape scanning order;
第三扫描单元804,用于若选择的扫描顺序为Z形扫描顺序,则按照Z形扫描顺序对上述待编码块的变换系数块进行扫描;或者,按照Z形扫描顺序对重置后的上述待编码块的变换系数块进行扫描。The third scanning unit 804 is configured to scan the transform coefficient block of the block to be encoded according to the Z-shaped scanning order if the selected scanning order is the Z-shaped scanning order; or, to scan the reset above-mentioned The transform coefficient blocks of the block to be coded are scanned.
一种变换系数块的扫描装置,如图9所示,包括:A scanning device for transform coefficient blocks, as shown in Figure 9, comprising:
第四检测单元901,用于检测作为上述待解码块的参考的已解码块的纹理,上述纹理体现了上述待解码块的变换系数块在各方向上变换系数的变化规律;The fourth detection unit 901 is configured to detect the texture of the decoded block as a reference of the block to be decoded, and the texture reflects the change rule of the transform coefficient block in each direction of the transform coefficient block of the block to be decoded;
第四选择单元902,用于从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序;上述预置的候选扫描顺序包括Z形扫描顺序以及Z形扫描顺序以外的其它扫描顺序;The fourth selection unit 902 is configured to select a scanning order corresponding to the above-mentioned texture from preset candidate scanning orders; the above-mentioned preset candidate scanning orders include Z-shaped scanning orders and other scanning orders other than Z-shaped scanning orders;
第四重置单元903,用于若选择的扫描顺序为Z形扫描顺序以外的其它扫描方式,则将待解码块的变换系数块从符合Z形扫描顺序的变换系数块重置为符合上述选择的扫描顺序的变换系数块;The fourth reset unit 903 is configured to reset the transformation coefficient block of the block to be decoded from the transformation coefficient block conforming to the Z-shape scanning order to complying with the above selection if the selected scanning order is other than the Z-shape scanning order Transform coefficient blocks in scan order;
第四扫描单元904,用于若选择的扫描顺序为Z形扫描顺序,则按照Z形扫描顺序对上述待解码块的变换系数块进行扫描;或者,按照上述选择的扫描方式对重置后的上述待编码块的变换系数块进行扫描。The fourth scanning unit 904 is configured to scan the transformation coefficient block of the block to be decoded according to the zigzag scanning order if the selected scanning order is the zigzag scanning order; The transform coefficient blocks of the block to be coded are scanned.
上述装置的方案只需要在水平和竖直的扫描顺序与Z形扫描顺序间做选择,是二选一的选择,相比于在水平、竖直以及Z形扫描顺序(zig-zag)之间的三选一的选择可以少使用一位来携带选择的信息,因此在将其编入编码头信息时,会节省资源;另外,在选择的时候效率也更高。The scheme of the above-mentioned device only needs to choose between the horizontal and vertical scanning order and the Z-shaped scanning order, which is an alternative choice, compared to horizontal, vertical and Z-shaped scanning order (zig-zag) The choice of one of the three choices can use one less bit to carry the selected information, so when it is encoded into the encoding header information, it will save resources; in addition, it is more efficient when selecting.
一种变换系数块的扫描方法,本实施例方案可以在编码端执行,如图10所示,包括:A scanning method of a transform coefficient block, the solution of this embodiment can be executed at the encoding end, as shown in Figure 10, including:
1001:检测作为待编码块的参考的已编码块的纹理,上述纹理体现了上述待编码块的变换系数块在各方向上变换系数的变化规律;1001: Detect the texture of the coded block used as a reference of the block to be coded, the above texture embodies the change rule of the transformation coefficient block in each direction of the transformation coefficient block of the above-mentioned block to be coded;
上述1001属于一种物理推导,作为参考的已编码的纹理近似于当前的待编码块的纹理,而待编码的纹理又近似于待编码的残差纹理,变换系数的分布规律与残差纹理密切相关。更具体地,上述纹理包括水平纹理、竖直纹理和斜纹理;其中斜纹理也可以看作是无纹理。The above 1001 belongs to a kind of physical derivation. The coded texture used as a reference is similar to the texture of the current block to be coded, and the texture to be coded is similar to the residual texture to be coded. The distribution law of the transformation coefficient is closely related to the residual texture relevant. More specifically, the above-mentioned textures include horizontal textures, vertical textures and oblique textures; the oblique textures can also be regarded as no textures.
更具体地,上述检测已解码块的纹理包括:More specifically, the above-mentioned detection of the texture of the decoded block includes:
在执行帧间解码时,计算变换系数块的水平方向上的水平梯度值和竖直方向上的竖直梯度值;水平梯度值为水平方向上各相邻像素点的差值的绝对值的和,竖直梯度值为竖直方向上各相邻像素点的差值的绝对值的和;上述作为参考的变换系数块即为上述已解码块的变化系数块;When performing inter-frame decoding, calculate the horizontal gradient value in the horizontal direction and the vertical gradient value in the vertical direction of the transform coefficient block; the horizontal gradient value is the sum of the absolute values of the differences between adjacent pixels in the horizontal direction , the vertical gradient value is the sum of the absolute values of the differences between adjacent pixel points in the vertical direction; the above-mentioned transform coefficient block as a reference is the change coefficient block of the above-mentioned decoded block;
若水平梯度值大于N倍的竖直梯度值则确定纹理为竖直纹理,竖直梯度值大于N倍的水平梯度值则确定纹理为水平纹理,否则确定纹理为斜纹理;上述N为第一预置值,N可以由分辨率宽度来确定,例如分辨率宽度大于1000时N=2,分辨率宽度小于1000时N=1.5;以上N的取值可以根据经验来确定,具体的取值本发明实施例对此不予限定。If the horizontal gradient value is greater than N times the vertical gradient value, the texture is determined to be a vertical texture, and the vertical gradient value is greater than N times the horizontal gradient value, then the texture is determined to be a horizontal texture, otherwise it is determined that the texture is an oblique texture; the above N is the first The preset value, N can be determined by the resolution width, for example, N=2 when the resolution width is greater than 1000, and N=1.5 when the resolution width is less than 1000; The embodiment of the invention does not limit this.
在执行帧内解码时,若帧内预测模式方向的竖直方向的偏移量在M以内则确定纹理为竖直纹理,帧内预测模式方向的水平方向的偏移量在M以内则确定纹理为水平纹理,否则确定纹理为斜纹理;上述M为第二预置值,M也可以由分辨率宽度来确定,例如设置成5,还可以设置成其他值例如3、4等,对此本发明实施例不予限定。When performing intra-frame decoding, if the vertical offset of the intra-frame prediction mode direction is within M, the texture is determined to be a vertical texture, and the horizontal offset of the intra-frame prediction mode direction is within M, then the texture is determined It is a horizontal texture, otherwise it is determined that the texture is an oblique texture; the above M is the second preset value, 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 embodiments of the invention are not limited.
进一步地,本发明实施例还提供了修正预置值的实现方式:若已经解码的块中,水平纹理与竖直纹理的比值超过第三预置值则缩小N的值,若水平纹理与竖直纹理的比值小于N,则增大N的值。第三预置值可以由以下方式得到,通过对不同特点的变换系数的序列进行帧内编码,统计水平、竖直预测方向的比例关系,该比例关系即可以作为第三预置值。Further, the embodiment of the present invention also provides an implementation method of modifying the preset value: if the ratio of the horizontal texture to the vertical texture exceeds the third preset value in the decoded block, then reduce the value of N; if the ratio of the horizontal texture to the vertical texture If the ratio of straight texture is less than N, increase the value of N. The third preset value can be obtained in the following manner. By performing intra-frame coding on the sequence of transform coefficients with different characteristics, and statistically calculating the proportional relationship between the horizontal and vertical prediction directions, the proportional relationship can be used as the third preset value.
可选地,若存在已编码块或解码块,那么已经编码块或解码块的纹理则是已知的,此时可以利用这些信息减少运算量;上述检测变换系数块的纹理包括:检测待解码块设定时域或空域距离内已经编码块或解码块的纹理,将检测到的纹理确定为变换系数块的纹理。Optionally, if there is an encoded block or a decoded block, then the texture of the encoded block or decoded block is known, and this information can be used to reduce the amount of computation; the above detection of the texture of the transform coefficient block includes: detecting the texture to be decoded The block sets the texture of the coded block or decoded block within the temporal or spatial distance, and determines the detected texture as the texture of the transform coefficient block.
1002:若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使其所对应的变换系数块为按预定规则扫描的变换系数块;1002: If the scanning order corresponding to the texture is inconsistent with the scanning order of the predetermined rule, reset the residual data block of the block to be encoded so that the corresponding transformation coefficient block is a transformation coefficient block scanned according to the predetermined rule;
上述纹理对应的扫描顺序包括如图2A~图2C所示的:竖直纹理对应逐行扫描的水平扫描顺序、水平纹理对应逐列扫描的竖直扫描顺序、斜纹理对应Z形顺序扫描的Z形扫描顺序。图2A~图2C中以4X4矩阵为例,其中圆形代表变换系数,圆形下的数值表示变换系数其所在的坐标(即位置),箭头方向表示扫描方向,即扫描顺序。需要说明的是图2C左边和矩阵和右边的矩阵分别代表一种Z形扫描顺序,Z形扫描顺序是可以自定义的,所以可能的种类较多,图2C的举例也不是穷举;因此本发明实施例对Z形扫描顺序不予限定。The scanning order corresponding to the above textures includes as shown in Figure 2A to Figure 2C: vertical texture corresponds to the horizontal scanning order of progressive scanning, horizontal texture corresponds to the vertical scanning order of column-by-column scanning, and oblique texture corresponds to the Z-shaped sequential scanning. shape scan order. 2A to 2C take a 4X4 matrix as an example, where the circle represents the transformation coefficient, the value under the circle represents the coordinate (ie position) of the transformation coefficient, and the direction of the arrow represents the scanning direction, that is, the scanning order. It should be noted that the matrix on the left side of Figure 2C and the matrix on the right represent a Z-shaped scanning order, and the Z-shaped scanning order can be customized, so there are many possible types, and the examples in Figure 2C are not exhaustive; therefore, this paper The embodiment of the invention does not limit the order of the zigzag scanning.
1003:对预置的Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理得到优选扫描顺序;1003: Perform rate-distortion optimization processing on the preset zigzag scanning order and the predetermined regular scanning order to obtain the optimal scanning order;
更具体地,上述1003中,若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使其所对应的变换系数块为按预定规则扫描的变换系数块;按照预定规则的扫描顺序对所述待编码块的变换系数块进行扫描包括:More specifically, in the above step 1003, if the scanning order corresponding to the texture is inconsistent with the scanning order of the predetermined rule, the residual data block of the block to be encoded is reset so that the corresponding transform coefficient block is scanned according to the predetermined rule The transformation coefficient block of the block; scanning the transformation coefficient block of the block to be coded according to the scanning order of the predetermined rules includes:
若优选的扫描顺序为第一扫描顺序,则将待编码块的残差数据块转置,按照第二扫描顺序对转置后的上述待编码块的变换系数块进行扫描;上述第一扫描顺序与第二扫描顺序的扫描顺序是对称的;If the preferred scanning order is the first scanning order, the residual data block of the block to be encoded is transposed, and the transposed transform coefficient block of the block to be encoded is scanned according to the second scanning order; the above-mentioned first scanning order The scan order is symmetrical to the scan order of the second scan order;
若优选的扫描顺序为第二扫描顺序,则按照第二扫描顺序对上述待编码块的变换系数块进行扫描。If the preferred scanning order is the second scanning order, the transform coefficient blocks of the block to be encoded are scanned according to the second scanning order.
需要说明的是,以上“第一”和“第二”用于区分两个具有对称关系的扫描顺序,不作其它限定,例如:水平扫描顺序和竖直扫描顺序之间就是两个具有对称关系的扫描顺序,若第一扫描顺序为水平扫描顺序则第二扫描顺序为竖直扫描顺序,若第一扫描顺序为竖直扫描顺序则第二扫描顺序为水平扫描顺序。It should be noted that the above "first" and "second" are used to distinguish two scanning sequences with a symmetrical relationship, and there is no other limitation. For example, there are two symmetrical scanning sequences between the horizontal scanning sequence and the vertical scanning sequence. The scanning order, if the first scanning order is a horizontal scanning order, then the second scanning order is a vertical scanning order, and if the first scanning order is a vertical scanning order, then the second scanning order is a horizontal scanning order.
更具体地,上述1003中,将待编码块的残差数据块,使其对应的变换系数块为按预定规则的扫描顺序扫描的变换系数块;按照上述预定规则的扫描顺序对上述待编码块的变换系数块进行扫描包括:则将待编码块的残差数据块,使其对应的变换系数块为按预定规则的扫描顺序扫描的变换系数块;按照预定规则的扫描顺序对上述待编码块的变换系数块进行扫描。若采用本方法可以不用传递1005中的指示信息,后续实施例将详细说明。More specifically, in the above step 1003, the residual data block of the block to be encoded is made such that the corresponding transform coefficient block is a transform coefficient block scanned according to the scanning order of the predetermined rule; The scanning of the transformation coefficient block includes: making the residual data block of the block to be encoded, making the corresponding transformation coefficient block a transformation coefficient block scanned according to the scanning order of the predetermined rule; scanning the block to be encoded according to the scanning order of the predetermined rule The transform coefficient blocks are scanned. If this method is adopted, the indication information in step 1005 may not be transmitted, which will be described in detail in subsequent embodiments.
1004:按照优选扫描顺序对所述待编码块的变换系数块进行扫描;1004: Scan the transform coefficient blocks of the block to be encoded according to the preferred scanning order;
1005:将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。1005: Encode the indication information indicating whether the scanning sequence used for scanning is a zigzag scanning sequence into the code stream.
以上实施方式,只需要在预定的扫描顺序与Z形扫描顺序间做选择,是二选一的选择,相比于在三选一的选择可以少使用一位来携带选择的信息,因此在将其编入编码头信息时,会节省资源;另外,在选择的时候效率也更高。另外通过对变换系数矩阵转置的方式,复用相同的熵编码模型可以提高编码效率。In the above implementation mode, it is only necessary to choose between the predetermined scanning order and the Z-shaped scanning order, which is a choice of one of two choices. Compared with the choice of one of three choices, one less bit can be used to carry the selected information. Therefore, in the future When encoding header information, it will save resources; in addition, it will be more efficient when selecting. In addition, by transposing the transform coefficient matrix, multiplexing the same entropy coding model can improve the coding efficiency.
更具体地,本实施例还提供了预置候选扫描顺序的实现方式的举例,上述预置候选扫描顺序包括:More specifically, this embodiment also provides an example of an implementation manner of presetting the candidate scanning order. The above preset candidate scanning order includes:
预先定义的扫描规则,扫描规则确定了扫描的顺序;或者,预先统计两个或两个以上的变换系数块各位置的变换系数为非零的次数,按从大到小的顺序排列各个非零次数对应的变换系数的位置,将排列得到的上述变换系数的位置的顺序确定为预置的候选扫描顺序。Pre-defined scanning rules, which determine the order of scanning; or, pre-count the number of non-zero transform coefficients at each position of two or more transform coefficient blocks, and arrange each non-zero For the positions of the transform coefficients corresponding to the number of times, the order of the positions of the transform coefficients obtained by arranging is determined as a preset candidate scanning order.
在以上的预置候选扫描方式的举例的后一种实现方式本发明实施例给出了一个举例说明:在编码器中,依据残差块的纹理,量化残差可以分为三类:水平纹理对应的量化残差、竖直纹理对应的量化残差、斜纹理对应的量化残差;确定扫描顺序的方式为:建立与变换系数个数相同的计数器组(例如4x4变换则为16个计数器),然后用计数器进行计数,具体为:判断各个变换系数上是否为零,如果非零,则对应位置的计数器加一;检测的变换系数块的数量达到设定的数量以后,各个计数器均有其计数的数值;此时可以从大到小排列各个计数器的值,将排列得到的上述变换系数的位置的顺序确定为预置的候选扫描顺序。使用该方法,按照得到的顺序进行扫描时,数值大的计数器其所对应的变换系数位置会在扫描顺序中排在前面。The embodiment of the present invention gives an example in the latter implementation of the above example of the preset candidate scanning mode: In the encoder, according to the texture of the residual block, the quantization residual can be divided 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 way to determine the scanning order is to establish a counter group with the same number of transform coefficients (for example, 4x4 transform is 16 counters) , and then use the counter to count, specifically: judge whether each transform coefficient is zero, if it is not zero, then add one to the counter at the corresponding position; after the number of detected transform coefficient blocks reaches the set number, each counter has its own The value of the count; at this time, the values of each counter can be arranged in descending order, and the order of the positions of the above-mentioned transformation coefficients obtained by the arrangement can be determined as the preset candidate scanning order. Using this method, when scanning is performed according to the obtained order, the position of the transformation coefficient corresponding to the counter with a large value will be arranged at the front in the scanning order.
举例方案一、以下对编码过程中的扫描环节进行具体说明:Example scheme 1. The following is a specific description of the scanning link in the encoding process:
A:按照编码流程编码,直到进行变换系数编码之前;A: Encode according to the encoding process until the transformation coefficient encoding is performed;
B:若执行的是帧间编码(Inter),则对参考块纹理进行检测,得到其纹理(水平Hor纹理、竖直ver纹理、斜纹理);若在执行的是帧内编码(Intra)的情况,如果帧内预测模式(intra prediction mode,ipmode)的方向为ver+/-5,其纹理为竖直纹理,方向为Hor+/-5,其纹理为水平纹理,其余情况为斜纹理。本实施例中设置的偏移量是5,当然还可以设置成其他值,对此本发明实施例不予限定。根据得到的纹理从预置的候选扫描顺序中选择与上述纹理对应的扫描顺序。B: If inter-frame coding (Inter) is performed, the texture of the reference block is detected to obtain its texture (horizontal Hor texture, vertical ver texture, oblique texture); if intra-frame coding (Intra) is performed In some cases, if the direction of the intra prediction mode (ipmode) is ver+/-5, the texture is a vertical texture, the direction is Hor+/-5, and the texture is a horizontal texture, and in other cases it is an oblique texture. The offset set in this embodiment is 5, of course, it can also be set to other values, which is not limited in this embodiment of the present invention. A scanning order corresponding to the above texture is selected from preset candidate scanning orders according to the obtained texture.
上述B中的检测方法可以是:The detection method in the above B can be:
B1:确定检测步长。该步骤为不同变换单元(Transform Unit,TU)设置不同的检测步长,例如TU=4时,步长为1,TU=8时,步长为1,TU=16时,步长为2,TU=32时,步长为4,也可以所有大小的TU对应步长均为1;如果所有大小的TU都使用相同的步长那么B1这个步骤是可以省略的。B1: Determine the detection step size. This step sets different detection steps for different transformation units (Transform Unit, TU). For example, when TU=4, the step size is 1, when TU=8, the step size is 1, and when TU=16, the step size is 2. When TU=32, the step size is 4, or the corresponding step size of all sizes of TUs is 1; if all sizes of TUs use the same step size, then the step B1 can be omitted.
B2:对参考块(即作为参考的变换系数块)中,水平方向相邻检测步长的每两个像素点求差值;累加差值的绝对值得到水平梯度值;B2: In the reference block (that is, the transform coefficient block used as a reference), the difference value is calculated for every two pixels of adjacent detection steps in the horizontal direction; the absolute value of the accumulated difference value is obtained to obtain the horizontal gradient value;
B3:对参考块中,竖直方向相邻检测步长的每两个像素点求差值;累加差值的绝对值得到竖直梯度值;B3: Calculate the difference between every two pixels of the adjacent detection step in the vertical direction in the reference block; accumulate the absolute value of the difference to obtain the vertical gradient value;
B4:如果水平梯度值大于N倍的竖直梯度值,则确定其纹理为竖直纹理;如果竖直梯度值大于N倍的水平梯度值,则确定其纹理为水平纹理;其它情况为斜纹理;B4之后,还可以进一步地根据已编码块中的水平、竖直、斜纹理比例分布,判断阈值N是否需要更新,判断方式是判断水平梯度值与竖直梯度值的比例是否超过预置值,若是,则增大预置值,否,则缩小预置值。(其中预置值由以下方式得到,通过对不同特点的变换系数的序列进行帧内编码,统计水平、竖直预测方向的比例关系,该比例关系即可以作为预置值。步骤C是对预置值的一个自动修正的过程,该过程并不是必须执行的步骤。B4: If the horizontal gradient value is greater than N times the vertical gradient value, then determine its texture as vertical texture; if the vertical gradient value is greater than N times the horizontal gradient value, determine its texture as horizontal texture; otherwise it is oblique texture ; After B4, it is also possible to further judge whether the threshold N needs to be updated according to the proportion distribution of horizontal, vertical and oblique textures in the coded block. The judgment method is to judge whether the ratio of the horizontal gradient value to the vertical gradient value exceeds the preset value , if yes, increase the preset value, otherwise, decrease the preset value. (wherein the preset value is obtained by the following method, by performing intra-frame coding on the sequence of transform coefficients with different characteristics, and statistically calculating the proportional relationship between the horizontal and vertical prediction directions, the proportional relationship can be used as the preset value. Step C is to preset An automatic correction process of setting values, which is not a mandatory step.
另外,对于以上编码过程中的步骤B检测的方法可以有替代的方案:检测待解码块设定时域或空域的距离内已经编码块或解码块的纹理,将检测到的纹理确定为作为待解码块的变换系数块的纹理。更具体地,例如将检测待解码块周边(上、左、左上、右上、左下)的已解码块的纹理作为当前待解码块变换系数块的纹理。In addition, for the method of step B detection in the above encoding process, there may be an alternative solution: detect the texture of the encoded block or decoded block within the set time domain or spatial domain distance of the block to be decoded, and determine the detected texture as the The texture of the transform coefficient block for the decoded block. More specifically, for example, the texture of the decoded block surrounding (upper, left, upper left, upper right, lower left) of the block to be decoded is detected as the texture of the transform coefficient block of the current block to be decoded.
C:如果所述纹理对应的扫描顺序为竖直,则将变换系数转置;如果所述纹理对应的扫描顺序为水平,继续;C: If the scanning order corresponding to the texture is vertical, transpose the transformation coefficient; if the scanning order corresponding to the texture is horizontal, continue;
D:对预置的Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理得到优选扫描顺序;D: performing rate-distortion optimization processing on the preset zigzag scanning sequence and the scanning sequence of predetermined rules to obtain the optimal scanning sequence;
E:按照优选的扫描顺序及相关熵编码模型对待扫描的变换系数块进行编码、扫描,然后继续后续的编码过程;E: Encode and scan the transformation coefficient blocks to be scanned according to the preferred scanning order and related entropy coding model, and then continue the subsequent coding process;
F:将上述进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。本步骤可以在步骤E执行过程中进行。可以理解的是,编码完成后会将编码的结果(码流)发送给解码端,对此本发明实施例其他位置不一一说明。F: Encoding the indication information indicating whether the scanning sequence used for scanning is a zigzag scanning sequence into the code stream. This step can be performed during the execution of step E. It can be understood that, after the encoding is completed, the encoding result (code stream) will be sent to the decoding end, which will not be described in other places in this embodiment of the present invention.
对应的,本发明实施例还提供了在解码端执行的一种变换系数块的扫描方法,如图11所示,包括:Correspondingly, the embodiment of the present invention also provides a scanning method for transform coefficient blocks performed at the decoding end, as shown in FIG. 11 , including:
1301:解析码流得到指示信息;1301: Analyze the code stream to obtain instruction information;
1302:按照解析的扫描顺序对待解码块的变换系数块进行扫描、反变换;1302: Scan and inversely transform the transformation coefficient blocks of the block to be decoded according to the scanned scanning sequence;
1303:若码流的指示信息指示扫描顺序不是Z形扫描,则检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;本实施例中上述纹理对应的扫描顺序包含Z形扫描顺序以外的其它扫描顺序;1303: If the indication information of the code stream indicates that the scanning order is not zigzag scanning, then detect the texture of the decoded block as a reference of the block to be decoded, the texture reflects the transformation coefficient block of the block to be decoded in each direction Variation rules of up-conversion coefficients; in this embodiment, the scanning sequence corresponding to the above-mentioned texture includes scanning sequences other than the Z-shaped scanning sequence;
1304:若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使其所对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块。可以理解的是,本实施例与编码端对应的,那么上述待解码块的残差数据块曾经经过编码端按照上述预定规则重置过。1304: If the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, according to the scanning order corresponding to the texture and the scanning order of the predetermined rule, convert the residual data block of the block to be decoded Reset so that the corresponding transform coefficient block is a transform coefficient block that can be scanned according to a scanning order of a predetermined rule. It can be understood that this embodiment corresponds to the encoding end, so the residual data block of the block to be decoded has been reset by the encoding end according to the above predetermined rules.
更具体地,上述按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使其所对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块包括:More specifically, the transform coefficient blocks of the block to be decoded are scanned according to the scanning order of the predetermined rule; if the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, The corresponding scanning order and the scanning 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 according to the predetermined rule of scanning order, including:
若选择的扫描顺序为第一扫描顺序,按照第二扫描顺序上述待解码块的变换系数块进行扫描;扫描完成后将待解码块的残差数据块转置;上述第一扫描顺序与第二扫描顺序的扫描顺序是对称的,第二扫描顺序为上述预定规则的扫描顺序。If the selected scanning order is the first scanning order, scan the transform coefficient block of the block to be decoded according to the second scanning order; after the scanning is completed, the residual data block of the block to be decoded is transposed; the first scanning order and the second The scanning order of the scanning order is symmetrical, and the second scanning order is the scanning order of the aforementioned predetermined rule.
举例方案二、解码过程与编码过程扫描的方法类似:Example 2: The decoding process is similar to the scanning method of the encoding process:
A:按照解码流程解码,直到进行变换系数解析之前;A: Decode according to the decoding process until the transformation coefficient analysis is performed;
B:解析码流,得到指示信息,该指示信息即编码过程的步骤H中的指示信息;B: Parse the code stream to obtain instruction information, which is the instruction information in step H of the encoding process;
C:按照解析的扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、扫描,反变换;C: Analyze, scan, and inversely transform the transformation coefficient blocks to be scanned according to the analyzed scanning order and the relevant entropy coding model;
D:判断指示信息是否指示扫描顺序为Z形扫描顺序,如果不是Z形扫描,可以参考举例方案一的步骤B,根据得到的纹理方向。若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则将待解码块的残差数据块转置;D: Determine whether the instruction information indicates that the scanning sequence is a Z-scanning sequence. If it is not a Z-scanning sequence, you can refer to step B of Example Scheme 1, according to the obtained texture direction. If the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, transpose the residual data block of the block to be decoded;
E:继续后续的解码过程。E: Continue the subsequent decoding process.
以上举例方案一和二,只需要在水平和竖直的扫描顺序与Z形扫描顺序间做选择,是二选一的选择,相比于在水平、竖直以及Z形扫描顺序(zig-zag)之间的三选一的选择可以少使用一位来携带选择的信息,因此在将其编入编码头信息时,会节省资源;另外,在选择的时候效率也更高。The above examples of schemes 1 and 2 only need to choose between the horizontal and vertical scanning order and the Z-shaped scanning order, which is a choice between the two, compared to the horizontal, vertical and Z-shaped scanning order (zig-zag ) can use one less bit to carry the selected information, so when it is encoded into the encoding header information, it will save resources; in addition, it is more efficient when selecting.
本发明实施例还给出了另一种变换系数块的扫描方法,该方案在编码设备中执行,在以上两个方案的基础之上更进一步地不用传递指示信息,可以进一步地提高编码效率;如图12所示,包括:The embodiment of the present invention also provides another scanning method for the transform coefficient block, which is implemented in the coding device, and further improves the coding efficiency without transmitting instruction information on the basis of the above two solutions; As shown in Figure 12, including:
1401:检测作为待编码块的参考的已编码块的纹理,上述纹理体现了上述待编码块的变换系数块在各方向上变换系数的变化规律;1401: Detect the texture of the coded block used as a reference of the block to be coded, the above texture embodies the change rule of the transformation coefficient block in each direction of the transformation coefficient block of the above-mentioned block to be coded;
1402:若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使其所对应的变换系数块为按预定规则扫描的变换系数块;1402: If the scanning order corresponding to the texture is inconsistent with the scanning order of the predetermined rule, reset the residual data block of the block to be encoded so that the corresponding transformation coefficient block is a transformation coefficient block scanned according to the predetermined rule;
1403:按照预定规则的扫描顺序对所述待编码块的变换系数块进行扫描。1403: Scan the transform coefficient blocks of the to-be-encoded block according to a predetermined scanning order.
举例方案一、以下对编码过程中的扫描环节进行具体说明:Example scheme 1. The following is a specific description of the scanning link in the encoding process:
以下对编码过程中的扫描环节进行具体说明:The following is a specific description of the scanning link in the encoding process:
A:按照编码流程编码,直到进行变换系数编码之前;A: Encode according to the encoding process until the transformation coefficient encoding is performed;
B:本步骤可以参考举例方案一的步骤B,得到纹理方向;B: For this step, you can refer to Step B of Example Scheme 1 to obtain the texture direction;
C:按照选定的扫描顺序将变换系数的位置重置为符合Z形扫描顺序的位置关系;C: According to the selected scan order, reset the position of the transformation coefficients to conform to the positional relationship of the zigzag scan order;
D:按照Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行编码、扫描,然后继续后续的编码过程。D: Encoding and scanning the transformation coefficient blocks to be scanned according to the zigzag scanning sequence and the related entropy coding model, and then continue the subsequent coding process.
对应的,本发明实施例还提供了另一种变换系数块的扫描方法,本方案在解码设备中执行,不用传递指示信息,可以进一步地提高编码效率;如图13所示,包括:Correspondingly, the embodiment of the present invention also provides another scanning method for transform coefficient blocks. This solution is implemented in the decoding device, without transmitting instruction information, and can further improve the coding efficiency; as shown in FIG. 13 , it includes:
1501:按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;1501: Scan the transform coefficient block of the block to be decoded according to the scanning order of the predetermined rule;
1502:检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;1502: Detect the texture of the decoded block used as a reference of the block to be decoded, where the texture embodies the change law of the transform coefficient of the transform coefficient block of the block to be decoded in each direction;
1503:若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使其所对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块。1503: If the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, according to the scanning order corresponding to the texture and the scanning order of the predetermined rule, convert the residual data block of the block to be decoded to Reset so that the corresponding transform coefficient block is a transform coefficient block that can be scanned according to a scanning order of a predetermined rule.
对应的解码过程与编码过程扫描的方法类似:The corresponding decoding process is similar to the scanning method of the encoding process:
A:按照解码流程解码,直到进行变换系数解析之前;A: Decode according to the decoding process until the transformation coefficient analysis is performed;
B:按照Z形扫描顺序及相关熵编码模型对待扫描的变换系数块进行解析、扫描,反变换;B: Analyzing, scanning, and inverse transforming the transformation coefficient blocks to be scanned according to the Z-shaped scanning sequence and the relevant entropy coding model;
C:本步骤可以参考举例方案一的步骤B,得到纹理方向;若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则将待解码块的残差数据块转置C: In this step, you can refer to step B of Example Scheme 1 to obtain the texture direction; if the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, transpose the residual data block of the block to be decoded
D:继续后续的解码过程;D: continue the subsequent decoding process;
将纹理检测和转置操作放在反变换操作之后进行,不会对解码的并行性造成影响,减小了处理时延,提高了解码效率。The texture detection and transposition operations are performed after the inverse transformation operation, which will not affect the parallelism of decoding, reduce the processing delay, and improve the decoding efficiency.
一种变换系数块的扫描装置,如图14所示,包括:A scanning device for transform coefficient blocks, as shown in Figure 14, comprising:
第五检测单元1601,用于检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;The fifth detection unit 1601 is configured to detect the texture of the coded block used as a reference of the block to be coded, the texture embodies the change law of the transformation coefficient of the transformation coefficient block of the block to be coded in each direction;
第五重置单元1602,用于若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使其所对应的变换系数块为按预定规则扫描的变换系数块;The fifth resetting unit 1602 is configured to reset the residual data block of the block to be coded so that the corresponding transform coefficient block is according to the predetermined rule if the scanning order corresponding to the texture is not consistent with the predetermined rule. Scanned transform coefficient block;
第五处理单元1603,用于对预置的Z形扫描顺序和预定规则的扫描顺序进行率失真优选处理得到优选扫描顺序;The fifth processing unit 1603 is configured to perform rate-distortion optimization processing on the preset zigzag scanning order and the scanning order of predetermined rules to obtain the preferred scanning order;
第五扫描单元1604,用于按照优选扫描顺序对待编码块的变换系数块进行扫描;The fifth scanning unit 1604 is configured to scan the transformation coefficient blocks of the block to be encoded according to the preferred scanning order;
第五编码单元1605,用于将进行扫描使用的扫描顺序是否为Z形扫描顺序的指示信息编入码流。The fifth encoding unit 1605 is configured to encode indication information indicating whether the scanning order used for scanning is a zigzag scanning order into the code stream.
一种变换系数块的扫描装置,如图15所示,包括:A scanning device for transform coefficient blocks, as shown in Figure 15, comprising:
第六解析单元1701,用于解析码流得到指示信息;A sixth parsing unit 1701, configured to parse the code stream to obtain indication information;
第六扫描单元1702,用于按照解析的扫描顺序对待解码块的变换系数块进行扫描;The sixth scanning unit 1702 is configured to scan the transform coefficient blocks of the block to be decoded according to the analyzed scanning order;
第六检测单元1703,用于若码流的指示信息指示扫描顺序不是Z形扫描,则检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;The sixth detection unit 1703 is configured to detect the texture of the decoded block as a reference of the block to be decoded if the indication information of the code stream indicates that the scanning order is not Z-scan, and the texture reflects the texture of the block to be decoded The change law of the transform coefficients of the transform coefficient block in each direction;
第六重置单元1704,用于若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使其所对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块。The sixth reset unit 1704 is configured to, if the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, the scanning order corresponding to the texture and the scanning order of the predetermined rule will be The residual data block of the decoded block is reset, so that the corresponding transform coefficient block is a transform coefficient block that can be scanned according to a predetermined scanning order.
一种变换系数块的扫描装置,如图16所示,包括:A scanning device for transform coefficient blocks, as shown in Figure 16, comprising:
第七检测单元1801,用于检测作为待编码块的参考的已编码块的纹理,所述纹理体现了所述待编码块的变换系数块在各方向上变换系数的变化规律;The seventh detection unit 1801 is configured to detect the texture of the coded block as a reference of the block to be coded, the texture embodies the change law of the transformation coefficient of the transformation coefficient block in each direction of the block to be coded;
第七重置单元1802,用于若所述纹理所对应的扫描顺序与预定规则的扫描顺序不一致,则对待编码块的残差数据块重置,使其所对应的变换系数块为按预定规则扫描的变换系数块;The seventh resetting unit 1802 is configured to reset the residual data block of the block to be coded so that the corresponding transform coefficient block is according to the predetermined rule if the scanning order corresponding to the texture is not consistent with the predetermined rule. Scanned transform coefficient block;
第七扫描单元1803,用于按照预定规则的扫描顺序对待编码块的变换系数块进行扫描;The seventh scanning unit 1803 is configured to scan the transform coefficient blocks of the block to be coded according to the scanning sequence of predetermined rules;
一种变换系数块的扫描装置,如图17所示,包括:A scanning device for transform coefficient blocks, as shown in Figure 17, comprising:
第八扫描单元1901,用于按照预定规则的扫描顺序对待解码块的变换系数块进行扫描;An eighth scanning unit 1901, configured to scan the transform coefficient blocks of the block to be decoded according to a scanning sequence of predetermined rules;
第八检测单元1902,用于检测作为所述待解码块的参考的已解码块的纹理,所述纹理体现了所述待解码块的变换系数块在各方向上变换系数的变化规律;The eighth detection unit 1902 is configured to detect the texture of the decoded block as a reference of the block to be decoded, and the texture embodies the change rule of the transform coefficient of the transform coefficient block of the block to be decoded in each direction;
第八重置单元1903,用于若所述纹理所对应的扫描顺序与所述预定规则的扫描顺序不同,则在反变换结束后根据所述纹理对应的扫描顺序以及预定规则的扫描顺序将待解码块的残差数据块重置,使其所对应的变换系数块为可按照预定规则的扫描顺序扫描的变换系数块。The eighth reset unit 1903 is configured to, if the scanning order corresponding to the texture is different from the scanning order of the predetermined rule, after the inverse transformation is completed, the scanning order corresponding to the texture and the scanning order of the predetermined rule will be The residual data block of the decoded block is reset, so that the corresponding transform coefficient block is a transform coefficient block that can be scanned according to a predetermined scanning order.
本发明实施例提供的方法可以应用在数字信号处理领域中,通过视频编码器,解码器实现。视频编码器,解码器广泛应用于各种通讯设备或电子设备中,例如:媒体网关,移动电话,无线装置,个人数据助理(PDA),手持式或便携式计算机,GPS接收机/导航器,照相机,视频播放器,摄像机,录像机,监控设备等等。这类设备中包括处理器,存储器,以及传输数据的接口。视频编解码器可以直接由数字电路或芯片例如DSP(digital signalprocessor)实现,或者由软件代码驱动一处理器执行软件代码中的流程而实现。The method provided by the embodiment of the present invention can be applied in the field of digital signal processing and realized by a video encoder and a decoder. Video encoders and decoders are widely used in various communication equipment or electronic equipment, such as: media gateways, mobile phones, wireless devices, personal data assistants (PDA), handheld or portable computers, GPS receivers/navigators, cameras , video players, cameras, 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 software code driving a processor to execute a process in the software code.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件完成,上述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the method of the above-mentioned embodiments can be completed by instructing related hardware through a program, and the above-mentioned program can be stored in a computer-readable storage medium, the above-mentioned storage medium It can be read-only memory, disk or CD-ROM, etc.
以上对本发明实施例所提供的一种变换系数块的扫描方法、装置和系统进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本发明的限制。The method, device and system for scanning transform coefficient blocks provided by the embodiments of the present invention are described above in detail. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The descriptions of the above embodiments are only used To help understand the method of the present invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification does not It should be understood as a limitation of the present invention.
Claims (8)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110076616.3A CN102651816B (en) | 2011-02-23 | 2011-03-29 | Method and device for scanning transformation coefficient block |
| PCT/CN2012/071432 WO2012113328A1 (en) | 2011-02-23 | 2012-02-22 | Method and device for scanning transform coefficient block |
Applications Claiming Priority (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110043594.0 | 2011-02-23 | ||
| CN201110043594 | 2011-02-23 | ||
| CN201110076616.3A CN102651816B (en) | 2011-02-23 | 2011-03-29 | Method and device for scanning transformation coefficient block |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN102651816A CN102651816A (en) | 2012-08-29 |
| CN102651816B true CN102651816B (en) | 2014-09-17 |
Family
ID=46693700
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201110076616.3A Active CN102651816B (en) | 2011-02-23 | 2011-03-29 | Method and device for scanning transformation coefficient block |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN102651816B (en) |
| WO (1) | WO2012113328A1 (en) |
Families Citing this family (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| MX368246B (en) * | 2013-07-24 | 2019-09-25 | Microsoft Technology Licensing Llc | Scanning orders for non-transform coding. |
| CN103561274B (en) * | 2013-11-19 | 2017-02-15 | 福建师范大学 | Video time domain tamper detection method for removing moving object shot by static camera lens |
| CN104853196B (en) * | 2014-02-18 | 2018-10-19 | 华为技术有限公司 | Decoding method and device |
| WO2017131233A1 (en) * | 2016-01-28 | 2017-08-03 | 日本放送協会 | Encoding device, decoding device, and program |
| CA3014299A1 (en) | 2016-02-12 | 2017-08-17 | Huawei Technologies Co., Ltd. | Method and apparatus for scan order selection |
| CN108605132B (en) | 2016-02-12 | 2020-12-15 | 华为技术有限公司 | Method and apparatus for selecting scan order |
| US10382758B2 (en) * | 2017-12-15 | 2019-08-13 | Google Llc | Transform block-level scan order selection for video coding |
| CN113453008B (en) * | 2020-03-26 | 2022-08-02 | 腾讯科技(深圳)有限公司 | Video decoding method, video encoding method, related apparatus and medium |
| CN114786010B (en) * | 2022-03-07 | 2024-08-02 | 杭州未名信科科技有限公司 | Rate distortion optimization quantization method and device, storage medium and electronic equipment |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5926574A (en) * | 1995-03-17 | 1999-07-20 | Mitsubishi Denki Kabushiki Kaisha | Image encoding system |
| CN1585483A (en) * | 2004-06-16 | 2005-02-23 | 浙江大学 | Method and device for scanning transform coefficients in video or image compression |
| CN101325707A (en) * | 2007-06-12 | 2008-12-17 | 浙江大学 | Texture self-adaptive video coding and decoding system |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP4460521B2 (en) * | 2005-11-07 | 2010-05-12 | 日本電信電話株式会社 | Orthogonal transform coefficient scanning method, inverse scanning method, scanning device, inverse scanning device, program thereof, and computer-readable recording medium recording the program |
| US8179974B2 (en) * | 2008-05-02 | 2012-05-15 | Microsoft Corporation | Multi-level representation of reordered transform coefficients |
-
2011
- 2011-03-29 CN CN201110076616.3A patent/CN102651816B/en active Active
-
2012
- 2012-02-22 WO PCT/CN2012/071432 patent/WO2012113328A1/en not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5926574A (en) * | 1995-03-17 | 1999-07-20 | Mitsubishi Denki Kabushiki Kaisha | Image encoding system |
| CN1585483A (en) * | 2004-06-16 | 2005-02-23 | 浙江大学 | Method and device for scanning transform coefficients in video or image compression |
| CN101325707A (en) * | 2007-06-12 | 2008-12-17 | 浙江大学 | Texture self-adaptive video coding and decoding system |
Non-Patent Citations (1)
| Title |
|---|
| JP特开2007-129612A 2007.05.24 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN102651816A (en) | 2012-08-29 |
| WO2012113328A1 (en) | 2012-08-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN102651816B (en) | Method and device for scanning transformation coefficient block | |
| CN102611884B (en) | Image encoding and decoding method and encoding and decoding device | |
| JP6036964B2 (en) | Logical intra-mode naming in HEVC video coding | |
| CN107809642B (en) | Method for encoding and decoding video image, encoding device and decoding device | |
| CN106454352B (en) | Low-complexity entropy encoding/decoding method and apparatus | |
| CN103155560B (en) | To the equipment of differential motion vector coding/decoding and method and utilize this equipment and method to the equipment of encoding and decoding of video and method | |
| US20090097557A1 (en) | Image Encoding Apparatus, Image Encoding Method, Image Decoding Apparatus, and Image Decoding Method | |
| CN103096053B (en) | A kind of decoding method of pattern conversion and device | |
| JP5881747B2 (en) | Coding and decoding method and apparatus for transform coefficient | |
| CN103238322A (en) | Coding the position of the last significant coefficient of a video block individually in video coding | |
| WO2016138779A1 (en) | Intra-frame codec method, coder and decoder | |
| CN111654696B (en) | An intra-frame multi-reference line prediction method, device, storage medium and terminal | |
| CN105338351A (en) | Template coupling based intraframe prediction encoding and decoding method and apparatus, and array scanning method and apparatus | |
| US12537934B2 (en) | Video encoding method and apparatus, video decoding method and apparatus, computer program product, computer-readable storage medium, and electronic device | |
| CN113597757B (en) | Shape-Adaptive Discrete Cosine Transform with Adaptive Geometric Partitioning of Region Number | |
| CN102595113B (en) | Method, device and system for scanning conversion coefficient block | |
| CN102215392B (en) | Intra-frame predicting method or device for estimating pixel value | |
| CN104519368B (en) | Image Coding, decoding and reconstituting processing method and processing device | |
| CN112543324B (en) | Video decoding method, encoding method, codec and storage medium | |
| KR20150123177A (en) | Methods for encoding and decoding a picture and corresponding devices | |
| CN109672889A (en) | The method and device of the sequence data head of constraint | |
| WO2011124163A1 (en) | Method and device for encoding or decoding video data, method and device for transform processing | |
| CN102769751A (en) | Image Coding Method Based on Directional Block Compressive Sensing | |
| TW201501511A (en) | Prediction method and system in image compression | |
| CN119135891A (en) | Video encoding method, hardware encoder and video codec chip |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |