WO2008025300A1 - A method for encoding/decoding, the corresponding apparatus for encoding/decoding and a method or apparatus for searching optimum matching block - Google Patents

A method for encoding/decoding, the corresponding apparatus for encoding/decoding and a method or apparatus for searching optimum matching block Download PDF

Info

Publication number
WO2008025300A1
WO2008025300A1 PCT/CN2007/070608 CN2007070608W WO2008025300A1 WO 2008025300 A1 WO2008025300 A1 WO 2008025300A1 CN 2007070608 W CN2007070608 W CN 2007070608W WO 2008025300 A1 WO2008025300 A1 WO 2008025300A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
block
motion vector
primary
residual
Prior art date
Application number
PCT/CN2007/070608
Other languages
French (fr)
Chinese (zh)
Inventor
Yun He
Xiaozhong Xu
Jianhua Zheng
Xinjian Meng
Shujuan Shi
Xiaozhen Zheng
Original Assignee
Huawei Technologies Co., Ltd.
Tsinghua University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co., Ltd., Tsinghua University filed Critical Huawei Technologies Co., Ltd.
Priority to CN2007800003205A priority Critical patent/CN101518089B/en
Publication of WO2008025300A1 publication Critical patent/WO2008025300A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • H04N19/517Processing of motion vectors by encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods 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/13Adaptive entropy coding, e.g. adaptive variable length coding [AVLC] or context adaptive binary arithmetic coding [CABAC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/189Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
    • H04N19/192Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding the adaptation method, adaptation tool or adaptation type being iterative or recursive
    • H04N19/194Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding the adaptation method, adaptation tool or adaptation type being iterative or recursive involving only two passes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/61Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding in combination with predictive coding

Definitions

  • the present invention relates to image coding techniques in the field of multimedia, and more particularly to an image coding method, a decoding method, an encoder, a decoder, a codec method, a codec, and a method and apparatus for finding a best matching block between multi-view images.
  • an embodiment of the present invention provides an image coding method, a decoding method, an encoder, a decoder, a codec method, and a codec, so as to eliminate correlation between residual images and improve coding efficiency.
  • B Perform secondary prediction on the primary residual image to obtain a secondary residual image and a secondary motion vector, and write the secondary residual image, the secondary motion vector, and the primary motion vector into the compressed code stream.
  • a secondary prediction module configured to receive a primary residual image from the primary prediction module, perform secondary prediction on the received primary residual image, and obtain a secondary residual image and a secondary motion vector
  • a primary reconstruction module configured to receive a primary residual image from the secondary reconstruction module and a primary motion vector from the decoding module, and perform motion compensation on the primary residual image according to the received primary motion vector to obtain a reconstructed image.
  • the second type of encoder provided in the embodiment of the present invention includes: a primary prediction module and a coding module, wherein the encoder further includes: a secondary prediction module, where
  • FIG. 2 is a schematic diagram of the relationship between the current image to be encoded and the reference image.
  • the strong correlation between the video sequences captured by the plurality of cameras and the residual images generated by the different video sequences after the predictive coding are still highly correlated. Selecting an image with strong correlation with the current image to be encoded, and using the residual image corresponding to the selected image as a reference image, predicting the residual image corresponding to the current image to be encoded, and then predicting The obtained quadratic residual image is subjected to a subsequent encoding operation, thereby eliminating the correlation between the residual images, further reducing the redundancy between the images, and reducing the amount of data.
  • Figure 1 is a sequence diagram of video sequences captured by multiple cameras.
  • the abscissa in Figure 1 indicates the shooting of different cameras.
  • the video sequence, view 1 represents video sequence 1
  • view 2 represents video sequence 2
  • four video sequences are listed in Figure 1
  • the ordinate indicates that each video sequence is also increasing over time.
  • the reference image can not only select the encoded image in the current video sequence, but also select the encoded image in other video sequences, as shown in FIG.
  • FIG. 4 is a diagram showing the relationship between four images in the second prediction. As shown in FIG. 4, in this step, the first residual block N' in B2' is predicted with A2' as the reference image, and the best matching block M is found in A2', and the quadratic residual block is obtained.
  • the four images shown in FIG. 2 are still taken as an example, and assuming that the macroblock N of the current image to be encoded B2 is reconstructed, the quadratic residual block obtained after the inverse transform is obtained.
  • Step 503 Perform motion compensation on the obtained primary residual residual block as a reference image in the encoding according to the primary motion vector obtained in step 301, obtain a reconstructed image block, and store the reconstructed image block.
  • the reconstructed image of image ⁇ 2 is obtained as a reference image of other images to be encoded.
  • the image may be stored in the optical disc, in the hard disk, or in the network, or directly transmitted to the receiving end, but in any case, when we need to use or view these images, we need Decode it before it can be used. The following will be combined with the map
  • the four images shown in FIG. 2 are still taken as an example, and it is assumed that the current image to be decoded is B2, and when the macroblock N is decoded, the second obtained after decoding from the compressed code stream
  • the current decoding process of other macroblocks is the same.
  • A2' is a secondary reference image at the time of encoding.
  • the previous decoded image A2 is obtained when the step 602 is performed at the time of decoding, that is, after the A2 corresponding residual image is decoded. Rebuild the image.
  • Step 603 Perform motion compensation on the obtained primary residual vector for the obtained primary residual block as the primary reference image at the time of encoding, obtain a reconstructed image block, and store the reconstructed image block.
  • the primary prediction module is configured to read the reference image set once from the primary reconstruction module, and select the best matching block from the reference image set for the current to-be-coded block in units of macroblocks or blocks.
  • the selected best matching block predicts the current block to be coded, obtains a residual block and a corresponding primary motion vector, outputs the primary residual block to the secondary prediction module, and outputs the primary motion vector to the coding module, and simultaneously One motion vector Stored for use by a rebuild module.
  • the primary reconstruction module is configured to receive a primary residual block from the secondary reconstruction module, and read a motion vector stored by the prediction module once, and perform motion compensation in a reference image during encoding according to the read one motion vector. , the reconstructed image block is obtained, and the reconstructed image block is stored.
  • the reconstructed image of the current coded picture is obtained from all the reconstructed image blocks of the stored current coded image, which can be used as a reference image for other predictions.
  • the set of the first reference image is the first five frames of images
  • the five frames of images required for the next image to be encoded may be the image of the first four frames plus the reconstructed image.
  • the first image of the frame is the first image. Can be deleted.
  • the quadratic reconstruction module is configured to receive the secondary motion vector from the decoding module and the secondary residual block from the inverse transform module, and according to the received secondary motion vector, the secondary reference of the secondary residual block at the time of encoding Motion compensation is performed in the image, and a residual block is obtained, which is output to a reconstruction module, and the primary residual block is stored.
  • the motion vector (Mx, My can be obtained without directly using A2' as the reference image. ).
  • the first disparity vector (Mlx, Mly) generated in the prediction can be retained for the second prediction.
  • the primary disparity vector (Mlx, Mly) is written into the code stream as a quadratic disparity vector of the second prediction. This method can also be used for other macroblocks.
  • N ' - ; or some coefficients of ⁇ ⁇ ' can also be used to predict some coefficients of ⁇ , such as DC (Direct Current) coefficient of ⁇ ⁇ to predict the DC coefficient of N, by AC (AC , Alternating Current ) Coefficient to predict the AC coefficient of N, etc.
  • DC Direct Current
  • AC Alternating Current
  • the obtained secondary motion vector is stored for use in image reconstruction.
  • Step 1003 Entropy coding the quadratic residual block transform coefficient matrix, and the primary motion vector obtained by one prediction and the secondary motion vector obtained by the secondary prediction, and writing together into the compressed code stream;
  • the block transform coefficient matrix performs image reconstruction as a reference image of other images to be encoded.
  • Step 1101 according to the quadratic motion vector obtained in step 1002, transforming the coefficient matrix of the quadratic residual block, and using the quadratic reference image transform coefficient matrix as the reference image during encoding,
  • the line quadratic motion compensation obtains a residual block transform coefficient matrix.
  • the four images shown in FIG. 2 are still taken as an example, and assuming that the macroblock N of the current image to be encoded B2 is reconstructed, the quadratic residual block transform coefficient matrix obtained after the second prediction is obtained.
  • This reconstruction process for other macroblocks is the same.
  • N1 is obtained by inverse transform in step 1101.
  • the decoding method corresponds to the encoding method, and after performing entropy decoding on the compressed code stream, a motion vector and a secondary motion vector are obtained, and the current block to be decoded of the image to be decoded, that is, a quadratic residual block transform. Coefficient matrix.
  • the inverse transformation of the obtained residual block transform coefficient matrix corresponds to the step In the conversion at the time of encoding in step 1002, N is inversely transformed in step 1202 to obtain N'.
  • N is inversely transformed in step 1202 to obtain N'.
  • the decoding process of the current block to be decoded ends.
  • the reconstructed image of the original image is obtained for subsequent use according to all the reconstructed image blocks of B2 stored.
  • the reconstructed image obtained at the same time can also serve as a reference image for other images to be decoded.
  • the encoding process is: current image to be encoded ⁇ one prediction module ⁇ transformation module ⁇ secondary prediction module ⁇ encoding module ⁇ code stream; the process of reconstruction is: secondary reconstruction module ⁇ inverse transformation module ⁇ primary reconstruction module ⁇ current image Rebuild the image.
  • One of the prediction modules is generated The secondary motion vector generated by the primary motion vector and the secondary prediction module is directly output to the coding module, and the secondary motion vector generated by the secondary prediction module is used in the secondary reconstruction, and the primary prediction vector is used in one reconstruction. The resulting motion vector.
  • the primary reconstruction module is configured to receive a primary residual block from the inverse transform module, and read a motion vector stored by the prediction module once, and perform motion compensation in a reference image during encoding according to the read one motion vector. A reconstructed image block is obtained and the reconstructed image block is stored.
  • the reference image may be empty, that is, when the first image is encoded, the subsequent encoding process may be directly performed without prediction.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

A method for image/video encoding. It comprises following steps: making motion-compensated prediction for present image to get the first residual images and the first motion vectors. Then making the second motion-compensated prediction for the first residual images to get the second residual images and the second motion vectors. Encoding the second residual images and the second motion vectors and the first motion vectors into bit stream, or after the entropy coding, then encoding them into bit stream. Furthermore, the corresponding apparatus for image/video encoding and/or decoding are disclosed. The solutioin can get rid of the relativity among the residual images.

Description

编 /解码方法、 编 /解码器及寻找最佳匹配块的方法及装置 技术领域  Editing/decoding method, encoder/decoder and method and device for finding the best matching block
本发明涉及多媒体领域中的图像编码技术 ,尤其涉及图像编码方法、 解码方法、 编码器、 解码器、 编解码方法、 编解码器, 以及在多视图像 间寻找最佳匹配块的方法及装置。 发明背景  The present invention relates to image coding techniques in the field of multimedia, and more particularly to an image coding method, a decoding method, an encoder, a decoder, a codec method, a codec, and a method and apparatus for finding a best matching block between multi-view images. Background of the invention
目前的视频编码标准如国际电信联盟 ( ITU , International Telecommunication Union )制定的 H.261、 H.263、 H.263+、 H.264标准, 以及运动图像专家组 ( MPEG, Moving Picture Experts Group )制定的 MPEG-1、 MPEG-2、 MPEG-3、 MPEG-4等,都是建立在混合编码( Hybrid Coding )框架之上的。 所谓混合编码框架是一种混合时间空间的视频图 像编码方法, 编码时, 先进行帧内、 帧间的预测, 得到预测值, 以消除 时间域的相关性; 然后根据预测值与原始图像实际值的差值, 得到残差 图像, 对残差图像采用离散余弦变换法或其它的变换法进行二维变换, 以消除空间域的相关性; 最后对变换后的数据进行熵编码, 以消除统计 上的冗余度 , 将熵编码后的数据与解码所需的包括运动矢量在内的一些 边信息, 一起组成一个压缩后的码流, 供后续传输和存储用, 达到压缩 视频图像的目的。 相应地, 在解码时, 按照熵解码、 反变换以及预测补 偿等一系列解码过程重建出图像。  Current video coding standards such as the H.261, H.263, H.263+, and H.264 standards developed by the International Telecommunication Union (ITU) and the Moving Picture Experts Group (MPEG) MPEG-1, MPEG-2, MPEG-3, MPEG-4, etc. are all built on the Hybrid Coding framework. The hybrid coding framework is a video image coding method with mixed time space. When encoding, first perform intra-frame and inter-frame prediction, and obtain prediction values to eliminate the correlation in the time domain. Then, based on the predicted values and the actual values of the original images. The difference is obtained, and the residual image is obtained. The residual image is subjected to two-dimensional transform by discrete cosine transform method or other transform method to eliminate the correlation of the spatial domain. Finally, the transformed data is entropy encoded to eliminate the statistical The redundancy, together with the entropy-encoded data and some side information including the motion vector required for decoding, form a compressed code stream for subsequent transmission and storage, and achieve the purpose of compressing the video image. Accordingly, at the time of decoding, an image is reconstructed in accordance with a series of decoding processes such as entropy decoding, inverse transform, and predictive compensation.
混合编码框架中包括了帧内编码和帧间编码两种不同的编码方法。 进行帧内编码时, 对原始图像进行二维变换, 然后在变换域中对变换系 数进行量化, 最后进行熵编码; 或者在给定帧内充分利用相邻块的空间 相关性, 在对一给定块编码时, 首先可以^^据周围的块对该给定块进行 预测, 然后对预测值与实际值的差值进行二维变换、 量化及熵编码。 进 行帧间编码时, 采用运动估计得到运动矢量, 然后采用基于运动补偿的 帧间预测, 得到预测值与原始图像实际值的差值, 即残差图像, 对残差 图像进行二维变换, 然后在变换域中对变换系数进行量化, 最后进行熵 编码。 The hybrid coding framework includes two different coding methods: intraframe coding and interframe coding. When intra-coding is performed, the original image is two-dimensionally transformed, then the transform coefficients are quantized in the transform domain, and finally entropy encoded; or the spatial correlation of adjacent blocks is fully utilized in a given frame, When encoding a block, you can first make a block for the given block based on the surrounding block. The prediction then performs two-dimensional transformation, quantization and entropy coding on the difference between the predicted value and the actual value. When performing inter-frame coding, the motion vector is obtained by motion estimation, and then the inter-frame prediction based on motion compensation is used to obtain the difference between the predicted value and the actual value of the original image, that is, the residual image, and the residual image is two-dimensionally transformed, and then The transform coefficients are quantized in the transform domain, and finally entropy encoded.
可见, 上述帧内编码与帧间编码中, 都采用了预测技术。 预测技术 充分利用了帧内以及帧间的空间、 时间相关性, 在消除相关性的基础上 减小码率, 并提高压缩码流与原始图像的数据量压缩比。 尤其在混合编 码框架中, 帧间预测是减小图像时间相关性的有效方法, 特别是在最近 的视频标准 H.264的高级视频编码( H.264/AVC, Advanced Video Coding ) 中, 帧间预测采用了范围更广的块尺寸划分, 包括从 16x16到 4x4, 以 及多参考图像帧等技术, 因此应用广泛。 如在单个照相机拍摄到的视频 序列中, 相邻图像之间存在着很大的相关性, 即冗余度。 通过利用已经 编码过的图像与当前编码图像之间的相关性 , 将已经编码的图像恢复成 重建图像, 作为参考图像对当前编码图像进行预测, 并根据预测值与当 前编码图像实际值之间的差值,得到残差图像,并对残差图像进行编码, 从而可消除相邻图像之间的相关性, 减少编码的数据量。  It can be seen that the above prediction techniques are used in both intraframe coding and interframe coding. The prediction technology makes full use of the spatial and temporal correlation between frames and frames, reduces the code rate based on the elimination of correlation, and improves the data compression ratio of the compressed code stream to the original image. Especially in the hybrid coding framework, interframe prediction is an effective method to reduce the temporal correlation of images, especially in the recent video standard H.264 Advanced Video Coding (H.264/AVC, Advanced Video Coding), inter-frame The prediction uses a wider range of block sizes, from 16x16 to 4x4, and multiple reference image frames, so it is widely used. As in a video sequence captured by a single camera, there is a large correlation between adjacent images, namely redundancy. By using the correlation between the already encoded image and the current encoded image, the already encoded image is restored to the reconstructed image, and the current encoded image is predicted as the reference image, and based on the predicted value and the current value of the currently encoded image. The difference is obtained, and the residual image is obtained, and the residual image is encoded, thereby eliminating the correlation between adjacent images and reducing the amount of encoded data.
同样在多视视频领域, 如多个摄像机对同一个对象进行拍摄时, 所 拍到的多个视频序列的图像之间也存在着较大的相关性, 尤其当摄像机 之间位置较接近时, 相关性更强。 因此在对多个视频序列同时编码时, 可以利用当前视频序列中或其它视频序列中已编码的图像作为参考图 像对当前待编码图像进行预测,得到残差图像,并对残差图像进行编码, 从而消除多个视频序列的图像之间的相关性 , 有效降低图像之间的冗余 度。  Also in the field of multi-view video, when multiple cameras shoot the same object, there is a large correlation between the images of the multiple video sequences captured, especially when the cameras are located close to each other. More relevant. Therefore, when encoding a plurality of video sequences simultaneously, the currently encoded image may be predicted by using the encoded image in the current video sequence or other video sequences as a reference image to obtain a residual image, and the residual image is encoded. Thereby eliminating the correlation between the images of the plurality of video sequences, effectively reducing the redundancy between the images.
上述编码方法中, 对当前待编码图像只进行了一次预测, 然后便对 产生的残差图像进行编码。 而事实上, 在多视视频领域, 当前待编码图 像经过一次预测后产生的残差图像与参考图像所对应的残差图像之间 仍然具有较强的相关性 , 按照现有的编码方法对多个视频序列的图像进 行编码时, 无法消除残差图像之间的相关性, 因此也就无法更好的提高 编码效率。 发明内容 In the above encoding method, only one prediction is performed on the current image to be encoded, and then The resulting residual image is encoded. In fact, in the field of multi-view video, there is still a strong correlation between the residual image generated by the current image to be encoded and the residual image corresponding to the reference image, and the existing coding method is more When the images of the video sequences are encoded, the correlation between the residual images cannot be eliminated, and thus the coding efficiency cannot be improved. Summary of the invention
有鉴于此, 本发明实施例中提供一种图像编码方法、 解码方法、 编 码器、 解码器、 编解码方法及编解码器, 以便消除残差图像之间的相关 性, 提高编码效率。  In view of this, an embodiment of the present invention provides an image coding method, a decoding method, an encoder, a decoder, a codec method, and a codec, so as to eliminate correlation between residual images and improve coding efficiency.
此外, 本发明实施例中还提供两种图像编码方法、 一种解码方法、 两种编码器及一种解码器, 以便消除残差图像之间的相关性, 并进一步 提高编码效率。  In addition, two image encoding methods, one decoding method, two encoders and a decoder are also provided in the embodiment of the present invention, so as to eliminate correlation between residual images and further improve coding efficiency.
最后 , 本发明实施例中又提供两种在多视图像间寻找最佳匹配块的 方法及四种在多视图像间寻找最佳匹配块的装置 , 以便利用残差图像之 间的相关性, 提高最佳匹配块的搜索效率。  Finally, in the embodiment of the present invention, two methods for finding the best matching block between multi-view images and four devices for finding the best matching block among the multi-view images are provided, so as to utilize the correlation between the residual images. Improve the search efficiency of the best matching block.
本发明实施例所提供的第一种图像编码方法, 包括:  The first image coding method provided by the embodiment of the present invention includes:
A、 对当前待编码图像进行一次预测, 得到一次残差图像及一次运 动矢量;  A. Performing a prediction on the current image to be encoded to obtain a residual image and a motion vector;
B、 对一次残差图像进行二次预测, 得到二次残差图像及二次运动 矢量, 并将二次残差图像、 二次运动矢量及一次运动矢量写入压缩码流 中。  B. Perform secondary prediction on the primary residual image to obtain a secondary residual image and a secondary motion vector, and write the secondary residual image, the secondary motion vector, and the primary motion vector into the compressed code stream.
本发明实施例所提供的第一种图像解码方法, 包括:  The first image decoding method provided by the embodiment of the present invention includes:
A、 从压缩码流中解码得到一次运动矢量、 二次运动矢量和二次残 差图像; B、 根据二次运动矢量, 对二次残差图像进行运动补偿, 得到一次 残差图像, 并根据一次运动矢量, 对一次残差图像进行运动补偿, 得到 重建图像。 A. Decoding from the compressed code stream to obtain a motion vector, a quadratic motion vector, and a quadratic residual image; B. Perform motion compensation on the second residual image according to the secondary motion vector to obtain a residual image, and perform motion compensation on the primary residual image according to the primary motion vector to obtain a reconstructed image.
本发明实施例所提供的第一种编码器, 包括: 一次预测模块和编码 模块, 并且该编码器还包括: 二次预测模块, 其中,  The first type of encoder provided by the embodiment of the present invention includes: a primary prediction module and an encoding module, and the encoder further includes: a secondary prediction module, where
一次预测模块, 用于对当前待编码图像进行一次预测, 得到一次残 差图像和一次运动矢量;  a prediction module, configured to perform a prediction on the current image to be encoded, to obtain a residual image and a motion vector;
二次预测模块, 用于接收来自所述一次预测模块的一次残差图像, 对所接收的一次残差图像进行二次预测 , 得到二次残差图像及二次运动 矢量;  a secondary prediction module, configured to receive a primary residual image from the primary prediction module, perform secondary prediction on the received primary residual image, and obtain a secondary residual image and a secondary motion vector;
编码模块, 用于接收来自所述一次预测模块的一次运动矢量和来自 所述二次预测模块的二次运动矢量和二次残差图像, 并将所接收的一次 运动矢量、 二次运动矢量及二次残差图像写入压缩码流中。  An encoding module, configured to receive a primary motion vector from the primary prediction module and a secondary motion vector and a secondary residual image from the secondary prediction module, and receive the received primary motion vector, secondary motion vector, and The secondary residual image is written into the compressed code stream.
本发明实施例所提供的第一种解码器, 包括: 解码模块、 一次重建 模块, 并且该解码器还包括: 二次重建模块, 其中,  The first decoder provided by the embodiment of the present invention includes: a decoding module, a primary reconstruction module, and the decoder further includes: a secondary reconstruction module, where
解码模块, 用于从压缩码流中解码得到一次运动矢量、 二次运动矢 量及二次残差图像;  a decoding module, configured to decode a motion vector, a secondary motion vector, and a secondary residual image from the compressed code stream;
二次重建模块, 用于接收来自所述解码模块的二次残差图像和二次 运动矢量,根据所接收的二次运动矢量,对二次残差图像进行运动补偿, 得到一次残差图像;  a quadratic reconstruction module, configured to receive a secondary residual image and a secondary motion vector from the decoding module, perform motion compensation on the secondary residual image according to the received secondary motion vector, to obtain a residual image;
一次重建模块, 用于接收来自所述二次重建模块的一次残差图像及 来自解码模块的一次运动矢量, 根据所接收的一次运动矢量, 对一次残 差图像进行运动补偿, 得到重建图像。  And a primary reconstruction module, configured to receive a primary residual image from the secondary reconstruction module and a primary motion vector from the decoding module, and perform motion compensation on the primary residual image according to the received primary motion vector to obtain a reconstructed image.
本发明实施例所提供的编解码方法, 包括:  The coding and decoding method provided by the embodiment of the present invention includes:
A、 对当前待编码图像进行一次预测, 得到一次残差图像及一次运 动矢量, 并对一次残差图像进行二次预测, 得到二次残差图像及二次运 动矢量,将二次残差图像、二次运动矢量及一次运动矢量写入压缩码流;A. Perform a prediction on the current image to be encoded, and obtain a residual image and a single operation. a motion vector, and performing a second prediction on the primary residual image to obtain a secondary residual image and a secondary motion vector, and writing the secondary residual image, the secondary motion vector, and the primary motion vector into the compressed code stream;
B、 接收所述压缩码流, 并从压缩码流中解码得到一次运动矢量、 二次运动矢量和二次残差图像; 根据二次运动矢量, 对二次残差图像进 行运动补偿, 得到一次残差图像, 并根据一次运动矢量, 对一次残差图 像进行运动补偿, 得到重建图像。 B. receiving the compressed code stream, and decoding a motion vector, a quadratic motion vector, and a quadratic residual image from the compressed code stream; performing motion compensation on the second residual image according to the secondary motion vector, and obtaining once The residual image is subjected to motion compensation for the primary residual image according to the primary motion vector to obtain a reconstructed image.
本发明实施例所提供的编解码器, 包括: 编码单元和解码单元, 其 中,  A codec according to an embodiment of the present invention includes: a coding unit and a decoding unit, where
编码单元, 用于对当前待编码图像进行一次预测, 得到一次残差图 像及一次运动矢量, 并对一次残差图像进行二次预测, 得到二次残差图 像及二次运动矢量, 将二次残差图像、 二次运动矢量及一次运动矢量写 入压缩码流;  a coding unit, configured to perform a prediction on the current image to be encoded, obtain a residual image and a motion vector, and perform a second prediction on the first residual image to obtain a secondary residual image and a secondary motion vector, which will be quadratic The residual image, the secondary motion vector, and the primary motion vector are written into the compressed code stream;
解码单元, 用于接收所述压缩码流, 并从压缩码流中解码得到一次 运动矢量、 二次运动矢量和二次残差图像; 根据二次运动矢量, 对二次 残差图像进行运动补偿, 得到一次残差图像, 并根据一次运动矢量, 对 一次残差图像进行运动补偿, 得到重建图像。  a decoding unit, configured to receive the compressed code stream, and obtain a motion vector, a quadratic motion vector, and a quadratic residual image from the compressed code stream; perform motion compensation on the second residual image according to the secondary motion vector , obtaining a residual image, and performing motion compensation on the primary residual image according to the primary motion vector to obtain a reconstructed image.
本发明实施例中所提供的第二种图像编码方法, 包括:  The second image encoding method provided in the embodiment of the present invention includes:
A、 对第一帧待编码图像进行编码后的当前待编码图像进行一次预 测, 得到一次残差图像及一次运动矢量;  A. Performing a prediction on the current image to be encoded encoded by the image to be encoded in the first frame to obtain a residual image and a motion vector;
B、 以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 进行视差估计时, 根据已编码图像中对应位置块的一次运动矢量, 在二 次参考图像中找到对应块, 将该对应块作为最佳匹配块, 并将所述一次 运动矢量作为在二次参考图像中的二次运动矢量 , 用该最佳匹配块对当 前宏块或块进行预测, 得到二次残差块, 将一次运动矢量和二次残差块 和 /或二次运动矢量写入压缩码流中。 本发明实施例中所提供的第三种图像编码方法, 包括:B. In the macroblock or block unit, when performing disparity estimation for each macroblock or block in the primary residual image, find a corresponding in the secondary reference image according to the primary motion vector of the corresponding position block in the encoded image. Blocking, using the corresponding block as a best matching block, and using the primary motion vector as a secondary motion vector in the secondary reference image, and predicting the current macroblock or block by using the best matching block to obtain a second The residual block writes the primary motion vector and the secondary residual block and/or the secondary motion vector into the compressed code stream. A third image encoding method provided in the embodiment of the present invention includes:
A、 对第一帧待编码图像进行编码后的当前待编码图像进行一次预 测, 得到一次残差图像及一次运动矢量; A. Performing a prediction on the current image to be encoded encoded by the image to be encoded in the first frame to obtain a residual image and a motion vector;
B、 以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 进行视差估计时, 根据已编码图像中对应位置块的一次运动矢量, 在二 次参考图像中找到对应块, 以该块作为搜索中心起始点, 寻找最佳匹配 块, 用该最佳匹配块对当前宏块或块进行预测, 并得到二次残差块及对 应的二次运动矢量, 将一次运动矢量、 二次残差块和二次运动矢量写入 压缩码流中。  B. In the macroblock or block unit, when performing disparity estimation for each macroblock or block in the primary residual image, find a corresponding in the secondary reference image according to the primary motion vector of the corresponding position block in the encoded image. Block, using the block as a starting point of the search center, searching for the best matching block, using the best matching block to predict the current macroblock or block, and obtaining a quadratic residual block and a corresponding secondary motion vector, which will be a motion Vectors, quadratic residual blocks, and quadratic motion vectors are written into the compressed code stream.
本发明实施例中提供的第二种图像解码方法, 包括:  The second image decoding method provided in the embodiment of the present invention includes:
A、 从压缩码流中解码得到一次运动矢量、 二次运动矢量和二次残 差图像;  A. Decoding from the compressed code stream to obtain a motion vector, a quadratic motion vector, and a quadratic residual image;
B、 以宏块或块为单位, 针对二次残差图像中的每个宏块或块, 根 据该宏块或块对应的二次运动矢量, 或 该宏块或块对应的作为二次 运动矢量的一次运动矢量, 对该二次残差块进行运动补偿, 得到一次残 差块, 并 ^居该一次残差块对应的一次运动矢量, 对该一次残差块进行 运动补偿, 得到重建图像块, 将二次残差图像的所有重建图像块合成重 建图像。  B, in macroblock or block unit, for each macroblock or block in the quadratic residual image, according to the secondary motion vector corresponding to the macroblock or block, or the corresponding secondary motion of the macroblock or block The primary motion vector of the vector is motion-compensated for the second residual block to obtain a residual block, and the primary motion vector corresponding to the primary residual block is compensated for, and the first residual block is motion compensated to obtain a reconstructed image. Block, all reconstructed image blocks of the secondary residual image are combined to reconstruct the image.
本发明实施例中所提供的第二种编码器, 包括: 一次预测模块和编 码模块, 其特征在于, 该编码器还包括: 二次预测模块, 其中,  The second type of encoder provided in the embodiment of the present invention includes: a primary prediction module and a coding module, wherein the encoder further includes: a secondary prediction module, where
一次预测模块 ,用于对第一帧之后的当前待编码图像进行一次预测 , 得到一次残差图像和一次运动矢量;  a prediction module, configured to perform a prediction on the current image to be encoded after the first frame, to obtain a residual image and a motion vector;
二次预测模块, 用于接收来自一次预测模块的一次残差图像, 对所 接收的一次残差图像以宏块或块为单位, 针对一次残差图像中的每一个 宏块或块, 进行视差估计时, 根据已编码图像中对应位置块的一次运动 矢量, 在二次参考图像中找到对应块, 将该对应块作为最佳匹配块, 并 将所述一次运动矢量作为在二次参考图像中的二次运动矢量 , 用该最佳 匹配块对当前宏块或块进行预测, 得到二次残差块; a secondary prediction module, configured to receive a primary residual image from a primary prediction module, and perform a parallax for each macroblock or block in the primary residual image in units of macroblocks or blocks for the received primary residual image. Estimating, based on a motion of the corresponding position block in the encoded image Vector, finding a corresponding block in the secondary reference image, using the corresponding block as a best matching block, and using the primary motion vector as a secondary motion vector in the secondary reference image, using the best matching block for the current The macroblock or block performs prediction to obtain a quadratic residual block;
编码模块, 用于接收来自所述一次预测模块的一次运动矢量和来自 所述二次预测模块的二次残差图像和 /或二次运动矢量,并将所接收的一 次运动矢量和二次残差图像和 /或二次运动矢量写入压缩码流中。  An encoding module, configured to receive a primary motion vector from the primary prediction module and a secondary residual image and/or a secondary motion vector from the secondary prediction module, and receive the received primary motion vector and the second residual The difference image and/or the secondary motion vector are written into the compressed code stream.
本发明实施例中所提供的第三种编码器, 包括: 一次预测模块和编 码模块, 其特征在于, 该编码器还包括: 二次预测模块, 其中,  The third encoder provided in the embodiment of the present invention includes: a primary prediction module and a coding module, wherein the encoder further includes: a secondary prediction module, where
一次预测模块 ,用于对第一帧之后的当前待编码图像进行一次预测 , 得到一次残差图像和一次运动矢量;  a prediction module, configured to perform a prediction on the current image to be encoded after the first frame, to obtain a residual image and a motion vector;
二次预测模块, 用于接收来自一次预测模块的一次残差图像, 对所 接收的一次残差图像以宏块或块为单位, 针对一次残差图像中的每一个 宏块或块, 进行视差估计时, 根据已编码图像中对应位置块的一次运动 矢量, 在二次参考图像中找到对应块, 以该块作为搜索中心起始点, 寻 找最佳匹配块, 用该最佳匹配块对当前宏块或块进行预测, 得到二次残 差块及对应的二次运动矢量;  a secondary prediction module, configured to receive a primary residual image from a primary prediction module, and perform a parallax for each macroblock or block in the primary residual image in units of macroblocks or blocks for the received primary residual image. In the estimation, according to the primary motion vector of the corresponding position block in the encoded image, the corresponding block is found in the secondary reference image, and the block is used as the search center starting point to find the best matching block, and the current matching macro is used to match the current macro. The block or block performs prediction to obtain a quadratic residual block and a corresponding secondary motion vector;
编码模块, 用于接收来自所述一次预测模块的一次运动矢量和来自 所述二次预测模块的二次残差图像和二次运动矢量, 并将所接收的一次 运动矢量、 二次残差图像和二次运动矢量写入压缩码流中。  An encoding module, configured to receive a primary motion vector from the primary prediction module and a secondary residual image and a secondary motion vector from the secondary prediction module, and receive the received primary motion vector and the secondary residual image And the secondary motion vector is written into the compressed code stream.
本发明实施例中所提供的第二种解码器, 包括: 解码模块、 一次重 建模块, 其特征在于, 该解码器还包括: 二次重建模块, 其中,  The second decoder provided in the embodiment of the present invention includes: a decoding module and a primary reconstruction module, wherein the decoder further includes: a secondary reconstruction module, where
解码模块, 用于从压缩码流中解码得到一次运动矢量、 二次运动矢 量及二次残差图像;  a decoding module, configured to decode a motion vector, a secondary motion vector, and a secondary residual image from the compressed code stream;
二次重建模块, 用于接收来自所述解码模块的二次残差图像和二次 运动矢量或作为二次运动矢量的一次运动矢量 , 根据所接收的二次运动 矢量或作为二次运动矢量的一次运动矢量, 对二次残差图像进行运动补 偿, 得到一次残差图像; a quadratic reconstruction module, configured to receive a secondary residual image and a secondary motion vector from the decoding module or a primary motion vector as a secondary motion vector, according to the received secondary motion The vector or the primary motion vector of the secondary motion vector performs motion compensation on the secondary residual image to obtain a residual image;
一次重建模块, 用于接收来自所述二次重建模块的一次残差图像及 来自所述解码模块的一次运动矢量, 根据所接收的一次运动矢量, 对一 次残差图像进行运动补偿, 得到重建图像。  a primary reconstruction module, configured to receive a primary residual image from the secondary reconstruction module and a primary motion vector from the decoding module, and perform motion compensation on the primary residual image according to the received primary motion vector to obtain a reconstructed image. .
本发明实施例中提供的第一种在多视图像间寻找最佳匹配块的方 法, 包括:  The first method for finding the best matching block among the multi-view images provided in the embodiment of the present invention includes:
对当前图像的宏块或块进行一次和 /或二次视差估计时,根据已编码 图像中对应位置块的一次运动矢量, 在当前宏块或块的参考图像中找到 对应块, 将该对应块作为当前宏块或块的一次和 /或二次最佳匹配块。  When performing primary and/or secondary disparity estimation on the macroblock or block of the current image, finding a corresponding block in the reference image of the current macroblock or block according to the primary motion vector of the corresponding position block in the encoded image, and the corresponding block As the primary and/or second best matching block of the current macroblock or block.
本发明实施例中提供的第二种在多视图像间寻找最佳匹配块的方 法, 包括:  The second method for finding the best matching block among the multi-view images provided in the embodiment of the present invention includes:
对当前图像的宏块或块进行一次和 /或二次视差估计时,根据已编码 图像中对应位置块的一次运动矢量, 在当前宏块或块的参考图像中找到 对应块, 以该对应块作为搜索中心起始点, 寻找当前宏块或块的一次和 /或二次最佳匹配块。  When performing one-time and/or quadratic disparity estimation on the macroblock or block of the current image, finding a corresponding block in the reference image of the current macroblock or block according to the primary motion vector of the corresponding position block in the encoded image, with the corresponding block As the starting point of the search center, find the primary and/or secondary best matching block of the current macroblock or block.
本发明实施例中提供的第一种在多视图像间寻找最佳匹配块的装 置, 包括:  The first device for finding the best matching block among the multi-view images provided in the embodiment of the present invention includes:
一次预测模块, 用于对当前待编码图像以宏块或块为单位, 针对当 前待编码图像中的每一个宏块或块, 进行视差估计时, 根据已编码图像 中对应位置块的一次运动矢量, 在参考图像中找到对应块, 将该对应块 作为最佳匹配块。  a prediction module, configured to: in a macroblock or a block for the current image to be encoded, for each macroblock or block in the current image to be encoded, when performing disparity estimation, according to a motion vector of a corresponding position block in the encoded image Find the corresponding block in the reference image and use the corresponding block as the best matching block.
本发明实施例中提供的第二种在多视图像间寻找最佳匹配块的装 置, 包括:  The second device for finding the best matching block among the multi-view images provided in the embodiment of the present invention includes:
一次预测模块, 用于对当前待编码图像以宏块或块为单位, 针对当 前待编码图像中的每一个宏块或块, 进行视差估计时, 根据已编码图像 中对应位置块的一次运动矢量, 在参考图像中找到对应块, 以该块作为 搜索中心起始点, 寻找最佳匹配块。 a prediction module, configured to use a macroblock or a block as a unit for the current image to be encoded, For each macroblock or block in the pre-coded image, when performing disparity estimation, according to the primary motion vector of the corresponding position block in the encoded image, find the corresponding block in the reference image, and use the block as the starting point of the search center to find the most Good match block.
本发明实施例中提供的第三种在多视图像间寻找最佳匹配块的装 置, 包括:  The third device for finding the best matching block among the multi-view images provided in the embodiment of the present invention includes:
二次预测模块, 用于对所接收的一次残差图像以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 进行视差估计时, 根据已编码 图像中对应位置块的一次运动矢量, 在二次参考图像中找到对应块, 将 该对应块作为最佳匹配块。  a secondary prediction module, configured to perform, in a macroblock or a block, the received residual residual image, for each macroblock or block in the primary residual image, according to the corresponding position block in the encoded image The primary motion vector finds the corresponding block in the secondary reference image, and uses the corresponding block as the best matching block.
本发明实施例中提供的第四种在多视图像间寻找最佳匹配块的装 置, 包括:  The fourth device for finding the best matching block among the multi-view images provided in the embodiment of the present invention includes:
二次预测模块, 用于对所接收的一次残差图像以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 进行视差估计时, 根据已编码 图像中对应位置块的一次运动矢量, 在二次参考图像中找到对应块, 以 该块作为搜索中心起始点, 寻找最佳匹配块。  a secondary prediction module, configured to perform, in a macroblock or a block, the received residual residual image, for each macroblock or block in the primary residual image, according to the corresponding position block in the encoded image The primary motion vector finds the corresponding block in the secondary reference image, and uses the block as the starting point of the search center to find the best matching block.
从上述方案可以看出 , 本发明通过将各个视频序列中某些已经编码 过的图像所对应的残差图像作为参考图像, 对当前待编码图像经过预测 编码后产生的残差图像进行预测 , 再将预测后获得的二次残差图像进行 后续编码操作, 从而消除残差图像之间的相关性, 进一步降低图像之间 的冗余度, 减少码流的数据量, 提高编码效率。 附图简要说明  As can be seen from the foregoing solution, the present invention predicts a residual image generated by predicting and encoding the current image to be encoded by using a residual image corresponding to some of the already encoded images in each video sequence as a reference image, and then The secondary residual image obtained after the prediction is subjected to a subsequent encoding operation, thereby eliminating the correlation between the residual images, further reducing the redundancy between the images, reducing the data amount of the code stream, and improving the encoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
图 1为多个摄像机拍摄的视频序列的顺序示意图。  Figure 1 is a sequence diagram of a video sequence taken by multiple cameras.
图 2为当前待编码图像与参考图像之间的关系示意图。  FIG. 2 is a schematic diagram of the relationship between the current image to be encoded and the reference image.
图 3为本发明实施例一中图像编码方法的流程图。 图 4为图 3所示流程中二次预测时四个图像之间的关系示意图。 图 5为图 3所示流程中图像重建的流程图。 FIG. 3 is a flowchart of an image encoding method according to Embodiment 1 of the present invention. FIG. 4 is a schematic diagram showing the relationship between four images in the second prediction in the flow shown in FIG. 3. FIG. 5 is a flow chart of image reconstruction in the flow shown in FIG.
图 6为本发明实施例一中图像解码方法的流程图。  FIG. 6 is a flowchart of an image decoding method according to Embodiment 1 of the present invention.
图 7为本发明实施例一中编码器与解码器的关系示意图。  FIG. 7 is a schematic diagram showing the relationship between an encoder and a decoder according to Embodiment 1 of the present invention.
图 8为本发明实施例一中编码器的结构示意图。  FIG. 8 is a schematic structural diagram of an encoder according to Embodiment 1 of the present invention.
图 9为本发明实施例一中解码器的结构示意图。  FIG. 9 is a schematic structural diagram of a decoder according to Embodiment 1 of the present invention.
图 10为本发明实施例二中图像编码方法的流程图。  FIG. 10 is a flowchart of an image encoding method according to Embodiment 2 of the present invention.
图 11为图 10所示流程中图像重建的流程图。  Figure 11 is a flow chart of image reconstruction in the flow shown in Figure 10.
图 12为本发明实施例二中图像解码方法的流程图。  FIG. 12 is a flowchart of an image decoding method according to Embodiment 2 of the present invention.
图 13为本发明实施例二中编码器的结构示意图。  FIG. 13 is a schematic structural diagram of an encoder according to Embodiment 2 of the present invention.
图 14为本发明实施例二中解码器的结构示意图。  FIG. 14 is a schematic structural diagram of a decoder according to Embodiment 2 of the present invention.
图 15为本发明实施例三中编码器的结构示意图。  FIG. 15 is a schematic structural diagram of an encoder according to Embodiment 3 of the present invention.
图 16为本发明实施例三中解码器的结构示意图。  FIG. 16 is a schematic structural diagram of a decoder in Embodiment 3 of the present invention.
图 17为在图 8所示编码器和图 9所示解码器的基础上组装成的编解 码器。 实施本发明的方式  Fig. 17 is a codec assembled on the basis of the encoder shown in Fig. 8 and the decoder shown in Fig. 9. Mode for carrying out the invention
本发明实施例中 , 利用多个摄像机所拍摄出来的视频序列之间的较 强相关性 , 以及不同视频序列在预测编码后产生的残差图像之间仍有很 大相关性的特点, 从各个视频序列已经编码过的图像中选择与当前待编 码图像相关性强的图像, 并将所选择图像对应的残差图像作为参考图 像, 对当前待编码图像对应的残差图像进行预测, 再将预测得到的二次 残差图像进行后续编码操作, 从而消除残差图像之间的相关性, 进一步 降低图像之间的冗余度, 减少数据量。  In the embodiment of the present invention, the strong correlation between the video sequences captured by the plurality of cameras and the residual images generated by the different video sequences after the predictive coding are still highly correlated. Selecting an image with strong correlation with the current image to be encoded, and using the residual image corresponding to the selected image as a reference image, predicting the residual image corresponding to the current image to be encoded, and then predicting The obtained quadratic residual image is subjected to a subsequent encoding operation, thereby eliminating the correlation between the residual images, further reducing the redundancy between the images, and reducing the amount of data.
为了描述上清晰起见 , 本发明实施例中将对原始图像进行帧间预测 并产生残差图像的过程, 即运动估计, 称为一次预测, 所产生的残差图 像称为一次残差图像, 对应的运动矢量称为一次运动矢量, 相应的还有 一次残差块, 一次参考图像、 一次运动补偿等; 将本发明中在一次预测 的^ 5出上, 对一次残差图像以已编码图像对应的一次残差图像为参考图 像进行的帧间预测称为二次预测, 所产生的残差图像称为二次残差图 像, 对应的运动矢量称为二次运动矢量, 相应的还有二次残差块, 二次 参考图像、 二次运动补偿等。 For the sake of clarity of description, the original image will be inter-predicted in the embodiment of the present invention. And the process of generating the residual image, that is, the motion estimation, called the first prediction, the generated residual image is called the primary residual image, and the corresponding motion vector is called the primary motion vector, and the corresponding residual block is once again. Reference image, primary motion compensation, etc.; in the present invention, on the primary prediction, the inter prediction of the primary residual image with the primary residual image corresponding to the encoded image as the reference image is called secondary prediction. The generated residual image is called a quadratic residual image, and the corresponding motion vector is called a secondary motion vector, and correspondingly, a secondary residual block, a secondary reference image, a secondary motion compensation, and the like.
其中, 在对一次残差图像进行二次预测时, 本发明实施例采用了两 种实现方式, 即:  In the second prediction of the primary residual image, the embodiment of the present invention adopts two implementation manners, namely:
方式一, 对一次残差图像直接进行二次预测, 之后对二次预测产生 的二次残差图像进行变换或不进行变换, 然后和一次运动矢量及二次运 动矢量进行后续编码操作。  In the first method, the primary residual image is directly predicted twice, and then the secondary residual image generated by the secondary prediction is transformed or not transformed, and then the subsequent motion operation is performed with the primary motion vector and the secondary motion vector.
方式二, 对一次残差图像首先进行变换, 对经过变换后的一次残差 图像进行二次预测, 之后对二次预测产生的二次残差图像, 连同一次运 动矢量及二次运动矢量进行后续编码操作。  In the second method, the primary residual image is first transformed, the transformed primary residual image is subjected to secondary prediction, and then the secondary residual image generated by the secondary prediction is further followed by the primary motion vector and the secondary motion vector. Encoding operation.
即对于二次预测来说, 方式一是先预测再变换, 或只预测不变换; 方式二是先变换再预测。  That is to say, for the second prediction, the first method is to predict the retransformation first, or to predict only the non-transformation; the second method is to transform and re-predict.
以下实施例均以对多个视频序列同时编码的情况为例, 对本发明实 施例中的编码方法、 解码方法、 编码器、 解码器、 编解码方法及编解码 器进行伴细描述。  In the following embodiments, the encoding method, the decoding method, the encoder, the decoder, the encoding and decoding method, and the codec in the embodiment of the present invention are described in detail by taking the case of simultaneously encoding a plurality of video sequences as an example.
对于不同摄像机拍摄到的多个视频序列 , 可以排列成一个二维图像 阵列, 如图 1所示, 图 1为多个摄像机拍摄的视频序列的顺序示意图, 图 1中横坐标表示不同摄像机拍摄的视频序列, 视 1表示视频序列 1 , 视 2表示视频序列 2, 依次类推, 图 1中列出了 4个视频序列, 纵坐标 表示随时间变化各个视频序列也在增加。 其中, 在间隔较短的一段时间 内, 尤其同一时刻, 不同摄像机拍摄到的多个图像之间存在着很强的相 关性。 极端情况下, 不同摄像机所拍摄到的视频序列有可能完全相同。 因此参考图像不仅可以选取当前视频序列中已编码的图像, 而且也可以 选取其它视频序列中已编码的图像, 如图 2所示, 图 2为当前待编码图 像与参考图像之间的关系示意图。 对于摄像机 A在 T1时刻拍摄的视频 图像 A1和 T2时刻拍摄的视频图像 A2, 以及摄像机 B在 T1时刻拍摄 的视频图像 B1和 T2时刻拍摄的视频图像 B2, 假设已对 Al、 A2以及 B1进行编码, 在对 B2进行编码时, 可以选取同视频序列中的 B1作为 参考图像,也可以选取非同视频序列中的 A1或 A2作为参考图像。 实际 应用中, 参考图像也可以有很多, 并且还可以选取同视频序列中或其它 视频序列中的其它图像。 For multiple video sequences captured by different cameras, they can be arranged into a two-dimensional image array. As shown in Figure 1, Figure 1 is a sequence diagram of video sequences captured by multiple cameras. The abscissa in Figure 1 indicates the shooting of different cameras. The video sequence, view 1 represents video sequence 1, view 2 represents video sequence 2, and so on, four video sequences are listed in Figure 1, and the ordinate indicates that each video sequence is also increasing over time. Among them, in a short interval Inside, especially at the same time, there is a strong correlation between multiple images captured by different cameras. In extreme cases, the video sequences captured by different cameras may be identical. Therefore, the reference image can not only select the encoded image in the current video sequence, but also select the encoded image in other video sequences, as shown in FIG. 2, FIG. 2 is a schematic diagram of the relationship between the current image to be encoded and the reference image. For the video image A2 taken at the time of the video images A1 and T2 taken by the camera A at time T1, and the video image B2 taken at the time of the video images B1 and T2 taken by the camera B at time T1, it is assumed that Al, A2, and B1 have been encoded. When encoding B2, B1 in the same video sequence may be selected as the reference image, or A1 or A2 in the different video sequence may be selected as the reference image. In practical applications, there may be many reference images, and other images in the same video sequence or in other video sequences may also be selected.
实施例一:  Embodiment 1:
本实施例中, 对方式一中的实现方式进行伴细描述。 即直接对一次 预测产生的一次残差图像进行二次预测, 并对二次预测产生的二次残差 图像进行后续编码处理。 图 3为本发明实施例一中图像编码方法的流程 图。 一般情况下, 在对当前待编码图像的原始图像进行帧间预测时, 都 是以宏块或块为单位进行预测, 并在最后的块中携带有当前待编码图像 结束的标志, 然后再开始对下一个待编码图像进行同样的帧间预测。 因 此本实施例中的图像编码方法流程以当前待编码图像的一个宏块的编 码过程为例, 对本发明的编码方法进行伴细说明。 如图 3所示, 该流程 包括如下步骤:  In this embodiment, the implementation manner in the first method is described in detail. That is, the primary residual image generated by the primary prediction is directly predicted, and the secondary residual image generated by the secondary prediction is subjected to subsequent encoding processing. FIG. 3 is a flow chart of an image encoding method according to Embodiment 1 of the present invention. In general, when inter-prediction is performed on the original image of the current image to be encoded, the prediction is performed in units of macroblocks or blocks, and the flag of the end of the current image to be encoded is carried in the last block, and then starts. Perform the same inter prediction on the next image to be encoded. Therefore, the image encoding method in this embodiment takes the encoding process of one macroblock of the current image to be encoded as an example, and the encoding method of the present invention is described in detail. As shown in Figure 3, the process includes the following steps:
步骤 301 , 对当前待编码块进行帧间预测, 即一次预测, 得到一次 残差块及一次运动矢量。  Step 301: Perform inter prediction on the current block to be coded, that is, one prediction, and obtain a residual block and a motion vector.
本步骤中, 进行帧间预测时, 可以采用 H.264/AVC标准中所提供的 方法, 也可以采用其它标准中的方法。 一般情况下, 首先给定参考图像集合, 如同视频序列中的前几帧, 或相邻视频序列中同时刻的几帧等, 根据具体情况, 可按照不同的方式 选取参考图像, 此处的参考图像, 即一次参考图像, 为已编码图像的重 建图像, 具体图像重建过程参见后面图 4所示的流程。 之后在参考图像 集合中遍历寻找当前待编码块的最佳匹配块, 用该最佳匹配块对当前待 编码的块进行预测, 得到一次残差块及运动矢量。 其中, 若找到最佳匹 配块的参考图像为其它视频序列中同一时刻已编码图像的重建图像, 则 得到的矢量称视差矢量, 运动矢量和视差矢量都是指当前块的预测块在 参考图像中相对于当前块的位移。 为了描述简洁, 通常情况下, 将运动 矢量和视差矢量统称为运动矢量。 In this step, when inter-frame prediction is performed, the method provided in the H.264/AVC standard may be used, or the methods in other standards may be used. In general, the reference image set is given first, like the first few frames in the video sequence, or several frames in the adjacent video sequence, etc. According to the specific situation, the reference image may be selected according to different manners, where reference is made here. The image, that is, the primary reference image, is the reconstructed image of the encoded image. For the specific image reconstruction process, refer to the flow shown in FIG. 4 later. Then, the best matching block of the current block to be coded is traversed in the reference image set, and the block to be encoded is predicted by using the best matching block to obtain a residual block and a motion vector. Wherein, if the reference image of the best matching block is the reconstructed image of the encoded image at the same time in other video sequences, the obtained vector is called the disparity vector, and the motion vector and the disparity vector refer to the prediction block of the current block in the reference image. The displacement relative to the current block. For the sake of brevity, in general, motion vectors and disparity vectors are collectively referred to as motion vectors.
现仍以图 2所示的四个图像为例进行描述, 假设当前待编码图像为 B2, 则在对 B2的一个宏块 N编码时, 可以将 Al、 A2以及 B1的重建 图像作为参考图像, 在各个参考图像中进行运动估计, 即一次预测, 并 最后在 B1 中找到了最佳匹配块 K, 得到一次预测的残差块即一次残差 块为 N' = N - K , 且对应的运动矢量即一次运动矢量为(Kx,Ky ), 并将 该一次运动矢量进行存储, 供后续编码以及重建图像时使用, 同时执行 步骤 302。 对于其它宏块的一次预测方法与此相同。  The four images shown in FIG. 2 are still taken as an example. If the current image to be encoded is B2, the reconstructed image of Al, A2, and B1 can be used as a reference image when encoding a macroblock N of B2. Motion estimation is performed in each reference image, that is, one prediction, and finally the best matching block K is found in B1, and the residual block obtained once for prediction, that is, the first residual block is N' = N - K , and the corresponding motion The vector, that is, the primary motion vector is (Kx, Ky), and the primary motion vector is stored for subsequent encoding and reconstruction of the image, and step 302 is performed. The same prediction method for other macroblocks is the same.
步骤 302, 对所得到的一次残差块进行帧间预测, 即二次预测, 得 到二次残差块及二次运动矢量。  Step 302: Perform inter prediction, that is, secondary prediction on the obtained primary residual block, and obtain a quadratic residual block and a secondary motion vector.
本步骤中, 为了消除残差图像之间的相关性, 对残差图像以已编码 图像的残差图像作为参考图像, 即二次参考图像, 进行二次预测。 预测 方法与一次预测相似。 此处的参考图像为已编码图像对应残差图像的重 建图像, 具体图像重建过程参见后面图 4所示的流程。  In this step, in order to eliminate the correlation between the residual images, the residual image is subjected to secondary prediction using the residual image of the encoded image as a reference image, that is, a secondary reference image. The prediction method is similar to one prediction. The reference image here is a reconstructed image of the residual image corresponding to the encoded image. For the specific image reconstruction process, refer to the flow shown in FIG. 4 later.
仍以图 2所示的四个图像为例,假设 A2以 A1的重建图像作为参考 图像, 得到一次残差图像 Α2' , B2以 B1的重建图像作为参考图像, 得 到一次残差图像 B2'。 图 4为二次预测时四个图像之间的关系示意图。 如图 4所示, 本步骤中^殳以 A2'作为参考图像对 B2'中的一次残差块 N'进行预测, 并在 A2'中找到最佳匹配块 M , 得到二次残差块为 N" = Ν' - Μ , 对应的运动矢量即二次运动矢量为 ( Mx,My ), 并将该二 次运动矢量进行存储, 供后续编码以及重建图像时使用, 同时执行步骤 303。 其中, A2'为已编码图像对应残差图像的重建图像。 对于其它宏块 的二次预测方法与此相同。 Still taking the four images shown in FIG. 2 as an example, it is assumed that A2 uses the reconstructed image of A1 as a reference image to obtain a residual image Α2', and B2 uses the reconstructed image of B1 as a reference image. Go to the residual image B2' once. Figure 4 is a diagram showing the relationship between four images in the second prediction. As shown in FIG. 4, in this step, the first residual block N' in B2' is predicted with A2' as the reference image, and the best matching block M is found in A2', and the quadratic residual block is obtained. N" = Ν' - Μ , the corresponding motion vector, that is, the secondary motion vector is (Mx, My), and the secondary motion vector is stored for subsequent encoding and reconstruction of the image, and step 303 is performed. A2' is a reconstructed image of the coded image corresponding residual image. The second prediction method for other macroblocks is the same.
步骤 303, 对所得到的二次残差块进行变换, 并将变换后的变换系 数阵以及一次预测得到一次运动矢量和二次预测得到的二次运动矢量 进行熵编码, 并一起写入压缩码流中; 同时利用变换后的系数阵进行图 像重建, 作为其它待编码图像的参考图像。  Step 303: Perform transform on the obtained quadratic residual block, and entropy encode the transformed transform coefficient matrix and the secondary motion vector obtained by one prediction and the secondary motion, and write the compressed code together In the stream; image reconstruction is performed simultaneously using the transformed coefficient matrix as a reference image of other images to be encoded.
本步骤中, 对二次残差块进行变换时, 包括变换及量化, 进行熵编 码时, 也可以包括对变换后的系数阵进行重排序等操作, 具体实现方式 现有技术中有很多种, 此处不再伴细介绍。 其中, 熵编码只是采用较多 的一种方法, 实际应用中, 还可以有其它的编码方法。  In this step, when the quadratic residual block is transformed, including transform and quantization, and entropy coding may be performed, operations such as reordering the transformed coefficient matrix may be included, and the specific implementation manner is various in the prior art. It is not covered here. Among them, entropy coding only uses a more method, and in practice, there may be other coding methods.
至此, 该宏块的编码过程结束。 实际应用中, 该宏块的编码结束之 后, 当前待编码图像会判断自身图像中是否存在未进行上述编码的宏 块, 如果存在, 则继续执行上述步骤 301至步骤 303的过程; 否则, 该 帧图像编码结束。 后续帧图像继续作为当前待编码图像执行上述过程。 其中, 利用变换后的变换系数阵进行图像重建的过程参考下面图 5所示 流程。  At this point, the encoding process of the macroblock ends. In an actual application, after the encoding of the macroblock is completed, the current image to be encoded may determine whether there is a macroblock in the image that is not subjected to the foregoing encoding, and if yes, continue the process of step 301 to step 303; otherwise, the frame The image encoding ends. The subsequent frame image continues to perform the above process as the current image to be encoded. The process of image reconstruction using the transformed transform coefficient matrix refers to the flow shown in FIG. 5 below.
图 5为图 3所示图像编码方法中的图像重建流程示意图。 以当前待 解码图像的一个宏块的重建过程为例 , 该流程包括如下步骤:  FIG. 5 is a schematic diagram of an image reconstruction process in the image encoding method shown in FIG. 3. Taking the reconstruction process of a macroblock of the current image to be decoded as an example, the process includes the following steps:
步骤 501 , 对变换后的变换系数阵进行反变换, 得到二次残差块。 本步骤中, 对变换后的变换系数阵进行反变换时, 包括反量化及反 变换。 此处的反变换对应于步骤 303中编码时的变换。 Step 501: Perform inverse transformation on the transformed transform coefficient matrix to obtain a quadratic residual block. In this step, when inverse transform is performed on the transformed transform coefficient matrix, inverse quantization and inverse transform are included. The inverse transform here corresponds to the transform at the time of encoding in step 303.
步骤 502, 据步骤 302中得到的二次运动矢量, 对所得到的二次 残差块, 在编码时作为参考图像的残差图像, 即二次参考图像中, 进行 运动补偿, 得到一次残差块, 并对该一次残差块进行存储。  Step 502: According to the secondary motion vector obtained in step 302, perform motion compensation on the obtained secondary residual block as a residual image of the reference image, that is, in the secondary reference image, to obtain a residual. Block, and store the one-time residual block.
本步骤中, 仍以图 2所示的四个图像为例进行描述, 并假设对当前 待编码图像 B2的宏块 N进行重建, 则对于反变换后得到的二次残差块 In this step, the four images shown in FIG. 2 are still taken as an example, and assuming that the macroblock N of the current image to be encoded B2 is reconstructed, the quadratic residual block obtained after the inverse transform is obtained.
N" ,根据步骤 302中存储的 N"对应的二次运动矢量(Mx,My ), 从在先 重建的参考残差图像 A2'中寻找到对应的补偿块 M, 然后得到一次残差 块 N' = N" + M , 对该一次残差块进行存储, 并执行步骤 503。 其它宏块 的本次重建过程与此相同。 N", according to the secondary motion vector (Mx, My) corresponding to N" stored in step 302, the corresponding compensation block M is found from the previously reconstructed reference residual image A2', and then the residual block N is obtained once. ' = N" + M , the primary residual block is stored, and step 503 is performed. The current reconstruction process of other macroblocks is the same.
当 B2所有宏块的二次残差块都重建完毕, ^^据所存储的 B2的所有 一次残差块, 得到残差图像 B2'的重建图像, 作为其它待编码图像的二 次参考图像。  When the quadratic residual blocks of all the macroblocks of B2 are reconstructed, the reconstructed image of the residual image B2' is obtained as the second reference image of the other image to be encoded according to the stored residual block of B2.
步骤 503 , 据步骤 301 中得到的一次运动矢量, 对所得到的一次 残差块在编码时作为参考图像的一次参考图像中进行运动补偿 , 得到重 建图像块, 并对该重建图像块进行存储。  Step 503: Perform motion compensation on the obtained primary residual residual block as a reference image in the encoding according to the primary motion vector obtained in step 301, obtain a reconstructed image block, and store the reconstructed image block.
本步骤中, 在对步骤 303中 B2'的残差块 N'进行解码时, 据步骤 301中存储的一次运动矢量(Kx,Ky )从在先重建的参考图像 B1中寻找 到补偿块 K, 得到重建图像 ¾ Ν = Ν' + Κ , 并对该重建图像块 Ν进行存 储。 其它宏块的本次重建过程与此相同。  In this step, when decoding the residual block N' of B2' in step 303, the compensation block K is found from the previously reconstructed reference image B1 according to the primary motion vector (Kx, Ky) stored in step 301. A reconstructed image is obtained 3⁄4 Ν = Ν' + Κ , and the reconstructed image block 存储 is stored. This reconstruction process for other macroblocks is the same.
当 Β2所有宏块的一次残差块都重建完毕, ^^据所存储的 Β2的所有 重建图像块, 得到图像 Β2的重建图像, 作为其它待编码图像的一次参 考图像。 在实际应用中, 对图像进行编码后, 有可能存储在光盘中、硬盘中, 或网络中, 或直接传输给接收端, 但无论哪种情况, 当我们需要使用或 观看这些图像时, 都需要对其进行解码, 然后才能使用。 下面将结合图When all the residual blocks of all the macroblocks of Β2 are reconstructed, according to all the reconstructed image blocks of Β2 stored, the reconstructed image of image Β2 is obtained as a reference image of other images to be encoded. In practical applications, after encoding the image, it may be stored in the optical disc, in the hard disk, or in the network, or directly transmitted to the receiving end, but in any case, when we need to use or view these images, we need Decode it before it can be used. The following will be combined with the map
6对本发明中的图像解码方法进行详细描述。 6 The image decoding method in the present invention will be described in detail.
图 6为本发明实施例一中图像解码方法的流程图。 此处, 也以当前 待解码图像的一个宏块的解码过程为例, 对本发明的解码方法进行伴细 说明。 如图 6所示, 该流程包括如下步骤:  FIG. 6 is a flowchart of an image decoding method according to Embodiment 1 of the present invention. Here, the decoding process of the macroblock of the current image to be decoded is taken as an example, and the decoding method of the present invention is described in detail. As shown in Figure 6, the process includes the following steps:
步骤 601, 对压缩码流进行熵解码, 得到一次运动矢量和二次运动 矢量, 并对熵解码后的变换系数阵进行反变换, 得到二次残差块。  Step 601: Entropy decoding the compressed code stream to obtain a motion vector and a quadratic motion vector, and inverse transforming the entropy decoded transform coefficient matrix to obtain a quadratic residual block.
本步骤中,解码方法与编码方法相对应,对压缩码流进行熵解码后, 首先得到一次运动矢量和二次运动矢量; 之后可以对熵解码后的图像数 据进行重排序, 并对排序后的图像数据进行反变换, 其中反变换过程中 可以包括反量化、 反变换等, 得到本次待解码图像的当前待解码块, 即 二次残差块。  In this step, the decoding method corresponds to the encoding method. After entropy decoding the compressed code stream, the motion vector and the secondary motion vector are first obtained. Then, the entropy decoded image data can be reordered, and the sorted The image data is inverse transformed, wherein the inverse transform process may include inverse quantization, inverse transform, etc., to obtain a current block to be decoded of the image to be decoded, that is, a secondary residual block.
步骤 602, 据得到的二次运动矢量, 对所得到的二次残差块, 在 编码时作为二次参考图像的残差图像中进行运动补偿 , 得到一次残差 块, 并对该一次残差块进行存储。  Step 602: Perform motion compensation on the obtained residual residual block as a residual image of the secondary reference image at the time of encoding according to the obtained secondary motion vector, obtain a residual block, and obtain the primary residual. The block is stored.
本步骤中, 仍以图 2所示的四个图像为例进行描述, 并假设当前待 解码图像为 B2, 则对其中的宏块 N进行解码时, 对于从压缩码流解码 后得到的二次残差块 N" , 根据解码得到的 N"对应的二次运动矢量 ( Mx,My ), 从在先解码后的残差图像 A2'中, 寻找到对应的补偿块 M, 然后得到一次残差块 N' = N" + M , 对该一次残差块进行存储, 并执行 步骤 603。 其它宏块的本次解码过程与此相同。  In this step, the four images shown in FIG. 2 are still taken as an example, and it is assumed that the current image to be decoded is B2, and when the macroblock N is decoded, the second obtained after decoding from the compressed code stream The residual block N", according to the decoded N" corresponding secondary motion vector (Mx, My), finds the corresponding compensation block M from the previously decoded residual image A2', and then obtains a residual Block N' = N" + M , the primary residual block is stored, and step 603 is performed. The current decoding process of other macroblocks is the same.
当 B2所有宏块的二次残差块都解码完毕, ^^据所存储的 B2的所有 一次残差块, 得到一次残差图像的重建图像, 可作为其它待解码图像的 二次参考图像。 When the secondary residual block of all macroblocks of B2 is decoded, ^^ is stored according to all the stored B2 One residual block, a reconstructed image of the residual image is obtained, which can be used as a secondary reference image of other images to be decoded.
其中, A2'为编码时的二次参考图像, 此时作为解码时的二次参考 图像, 由在先的已解码图像 A2在解码时执行步骤 602时得到, 即 A2 对应残差图像解码后的重建图像。  Wherein, A2' is a secondary reference image at the time of encoding. At this time, as the secondary reference image at the time of decoding, the previous decoded image A2 is obtained when the step 602 is performed at the time of decoding, that is, after the A2 corresponding residual image is decoded. Rebuild the image.
步骤 603, 据得到的一次运动矢量, 对所得到的一次残差块, 在 编码时作为一次参考图像的图像中进行运动补偿, 得到重建图像块, 并 对该重建图像块进行存储。  Step 603: Perform motion compensation on the obtained primary residual vector for the obtained primary residual block as the primary reference image at the time of encoding, obtain a reconstructed image block, and store the reconstructed image block.
本步骤中, 在对步骤 602中 B2'的残差块 N'进行解码时, 据解码 得到的 N'对应的一次运动矢量(Kx,Ky )从在先解码后的参考图像 B1 中, 寻找到补偿块 K, 得到重建图像 ¾ N = N' + K , 对该重建图像块进 行存储。 其它宏块的本次解码过程与此相同。  In this step, when decoding the residual block N' of B2' in step 602, the primary motion vector (Kx, Ky) corresponding to N' obtained by decoding is found from the previously decoded reference image B1. Compensating block K, obtaining a reconstructed image 3⁄4 N = N' + K , and storing the reconstructed image block. This decoding process of other macroblocks is the same.
至此, 当前待解码块的解码过程结束。 当 B2所有宏块的一次残差 块都解码完毕, 根据所存储的 B2的所有重建图像块, 得到原始图像的 重建图像, 供后续使用。 同时得到的重建图像还可作为其它待解码图像 的一次参考图像。  So far, the decoding process of the current block to be decoded ends. When all the residual blocks of all macroblocks of B2 are decoded, the reconstructed image of the original image is obtained for subsequent use according to all the reconstructed image blocks of B2 stored. The reconstructed image obtained at the same time can also serve as a reference image for other images to be decoded.
其中, B1为编码时的一次参考图像, 此时作为解码时的一次参考图 像, 由在先的已解码图像 A2在解码时执行步骤 603时得到 ,即 A2解码 后的重建图像。  Here, B1 is a primary reference image at the time of encoding, and is obtained as a primary reference image at the time of decoding, and is obtained by performing the step 603 at the time of decoding by the prior decoded image A2, that is, the reconstructed image after A2 decoding.
上面对本发明中图像编码方法以及解码方法进行了详细描述, 下面 再对本发明中编解码系统进行一个详细描述。 图 7为实施例一中基于以 上图像编码方法和解码方法的编解器和解码器的关系示意图。  The image encoding method and the decoding method in the present invention have been described in detail above, and a detailed description will be given below of the codec system of the present invention. Fig. 7 is a diagram showing the relationship between a codec and a decoder based on the above image encoding method and decoding method in the first embodiment.
其中, 编码器用于将原始图像进行编码, 生成压缩码流供后续传输 和存储用。 编码过程包括: 对当前待编码图像进行一次预测, 得到一次 残差图像和一次运动矢量, 以已编码图像对应的残差图像为参考图像, 对得到的一次残差图像进行二次预测 , 得到二次残差图像及二次运动矢 量, 对该二次残差图像以及相应的二次运动矢量、 一次运动矢量进行后 续编码处理。 The encoder is used to encode the original image to generate a compressed code stream for subsequent transmission and storage. The encoding process includes: performing a prediction on the current image to be encoded, and obtaining once The residual image and the primary motion vector, the residual image corresponding to the encoded image is used as a reference image, and the obtained primary residual image is subjected to secondary prediction to obtain a secondary residual image and a secondary motion vector, and the second residual is obtained. The difference image and the corresponding secondary motion vector and the primary motion vector are subjected to subsequent encoding processing.
解码器用于对图像的压缩码流进行解码, 得到原始图像的重建图像 供后续使用。 解码过程包括: 根据从码流中解出的二次运动矢量, 对从 码流中解出的二次残差图像, 从编码时作为二次参考图像的重建残差图 像中进行运动补偿, 得到一次残差图像, 根据从码流中解出的一次运动 矢量 , 对该一次残差图像从编码时作为一次参考图像的重建图像中进行 运动补偿, 得到原始图像的重建图像。  The decoder is used to decode the compressed code stream of the image to obtain a reconstructed image of the original image for subsequent use. The decoding process includes: performing motion compensation on the quadratic residual image solved from the code stream from the reconstructed residual image as the secondary reference image at the time of encoding according to the secondary motion vector solved from the code stream The primary residual image is motion-compensated from the reconstructed image as the primary reference image from the time of encoding based on the primary motion vector solved from the code stream to obtain a reconstructed image of the original image.
其中, 编码器与解码器的内部结构分别如图 8和图 9所示。  The internal structure of the encoder and the decoder are shown in Figures 8 and 9, respectively.
图 8为本发明实施例一中编码器的结构示意图。 如图 8所示, 该编 码器包括: 一次预测模块、 二次预测模块、 变换模块、 编码模块、 反变 换模块、 二次重建模块以及一次重建模块。  FIG. 8 is a schematic structural diagram of an encoder according to Embodiment 1 of the present invention. As shown in FIG. 8, the encoder includes: a primary prediction module, a secondary prediction module, a transformation module, an encoding module, an inverse transformation module, a secondary reconstruction module, and a primary reconstruction module.
并且, 编码流程为: 当前待编码图像→一次预测模块→二次预测模 块→变换模块→编码模块→码流; 重建时流程为: 反变换模块→二次重 建模块→一次重建模块→当前图像的重建图像。 其中一次预测模块产生 的一次运动矢量和二次预测模块产生的二次运动矢量直接输出给编码 模块, 二次重建时, 采用的是二次预测模块产生的二次运动矢量, 一次 重建时, 采用的是一次预测模块产生的一次运动矢量。  Moreover, the encoding process is: current image to be encoded → one prediction module → secondary prediction module → transformation module → coding module → code stream; the process of reconstruction is: inverse transformation module → secondary reconstruction module → primary reconstruction module → current image Rebuild the image. The primary motion vector generated by one prediction module and the secondary motion vector generated by the secondary prediction module are directly output to the coding module, and the secondary motion vector generated by the secondary prediction module is used in the secondary reconstruction, and is used in one reconstruction. Is a motion vector generated by a prediction module.
其中 ,一次预测模块用于从一次重建模块中读取一次参考图像集合, 对当前待编码图像以宏块或块为单位, 对当前待编码块从参考图像集合 中选取最佳匹配块, 用所选取的最佳匹配块对当前待编码块进行预测, 得到一次残差块及对应的一次运动矢量 , 将一次残差块输出给二次预测 模块, 将一次运动矢量输出给编码模块, 同时对该一次运动矢量进行存 储, 供一次重建模块使用。 The primary prediction module is configured to read the reference image set once from the primary reconstruction module, and select the best matching block from the reference image set for the current to-be-coded block in units of macroblocks or blocks. The selected best matching block predicts the current block to be coded, obtains a residual block and a corresponding primary motion vector, outputs the primary residual block to the secondary prediction module, and outputs the primary motion vector to the coding module, and simultaneously One motion vector Stored for use by a rebuild module.
二次预测模块用于接收来自一次预测模块的一次残差块, 从二次重 建模块中读取二次参考图像集合, 对所接收的一次残差块从二次参考图 像集合中选取最佳匹配块, 用所选取的最佳匹配块对该一次残差块进行 预测,得到二次残差块及二次运动矢量,将二次残差块输出给变换模块, 将二次运动矢量输出给编码模块, 同时对该二次运动矢量进行存储, 供 二次重建模块使用。  The secondary prediction module is configured to receive a primary residual block from the primary prediction module, read the secondary reference image set from the secondary reconstruction module, and select the best match from the secondary reference image set for the received primary residual block. Block, predicting the primary residual block by using the selected best matching block, obtaining a secondary residual block and a secondary motion vector, outputting the secondary residual block to the transform module, and outputting the secondary motion vector to the coding The module stores the secondary motion vector for use by the secondary reconstruction module.
变换模块用于接收来自二次预测模块的二次残差块, 并对所接收的 二次残差块进行变换及量化, 进一步压缩图像码率, 并将变换及量化后 的变换系数阵输出给编码模块及反变换模块。  The transform module is configured to receive the secondary residual block from the secondary prediction module, transform and quantize the received secondary residual block, further compress the image code rate, and output the transformed and quantized transform coefficient matrix to Encoding module and inverse transform module.
编码模块可以包括重排序及熵编码等编码过程, 用于接收来自变换 模块的变换系数阵, 连同来自一次预测模块的一次运动矢量和来自二次 预测模块的二次运动矢量一起进行熵编码, 写入码流中。  The encoding module may include an encoding process such as reordering and entropy encoding for receiving a transform coefficient matrix from the transform module, together with the primary motion vector from the primary prediction module and the secondary motion vector from the secondary prediction module, entropy encoding, writing In the code stream.
上述一次预测模块和二次预测模块两个模块中用到的一次参考图像 和二次参考图像分别为已编码图像的重建图像及已编码图像对应残差 图像的重建图像, 而且在对当前待编码图像进行编码时, 为了为后续编 码图像提供参考图像, 也需要对当前待编码图像的已编码图像进行重 建, 因此本解码器中包括前面所说的反变换模块、 即二次重建模块和一 次重建模块。  The primary reference image and the secondary reference image used in the two modules of the primary prediction module and the secondary prediction module are respectively a reconstructed image of the encoded image and a reconstructed image of the corresponding image of the encoded image, and are currently encoded When the image is encoded, in order to provide a reference image for the subsequent encoded image, it is also necessary to reconstruct the encoded image of the current image to be encoded, so the decoder includes the inverse transform module described above, that is, the secondary reconstruction module and one reconstruction. Module.
其中, 反变换模块用于接收来自变换模块的变换、 量化后的变换系 数阵, 并对所接收的变换系数阵进行反量化和反变换, 得到当前编码图 像的二次残差块, 输出给二次重建模块。  The inverse transform module is configured to receive the transformed and quantized transform coefficient matrix from the transform module, and perform inverse quantization and inverse transform on the received transform coefficient matrix to obtain a quadratic residual block of the current encoded image, and output the same to the second Secondary reconstruction module.
二次重建模块用于接收来自反变换模块的二次残差块, 并读取二次 预测模块所存储的二次运动矢量, 根据所读取的二次运动矢量, 在编码 时的二次参考图像中进行运动补偿, 得到一次残差块输出给一次重建模 块, 并将该一次残差块进行存储。 The quadratic reconstruction module is configured to receive the secondary residual block from the inverse transform module, and read the secondary motion vector stored by the secondary prediction module, according to the read secondary motion vector, the secondary reference at the time of encoding Motion compensation in the image, get a residual block output to a re-modeling Block, and store the one-time residual block.
若当前编码图像所有的二次残差块都重建结束, 则根据所存储的当 前编码图像的所有一次残差块得到当前编码图像的一次残差图像, 可作 为其它预测所需的二次参考图像。 若作为二次参考图像的集合为前五帧 图像, 则下一个待编码图像进行二次预测所需的五帧图像可以为前四帧 图像加上本次重建得到的图像, 最前面的一帧图像此时可以被删除。  If all the secondary residual blocks of the current coded image are reconstructed, the first residual image of the current coded image is obtained according to all the first time residual blocks of the stored current coded image, and can be used as a secondary reference image required for other predictions. . If the set of secondary reference images is the first five frames of images, the five frames of images required for the second prediction of the next image to be encoded may be the images of the first four frames plus the reconstructed image, the first frame. The image can now be deleted.
一次重建模块用于接收来自二次重建模块的一次残差块, 并读取一 次预测模块所存储的一次运动矢量, 根据所读取的一次运动矢量, 在编 码时的一次参考图像中进行运动补偿, 得到重建图像块, 并将该重建图 像块进行存储。  The primary reconstruction module is configured to receive a primary residual block from the secondary reconstruction module, and read a motion vector stored by the prediction module once, and perform motion compensation in a reference image during encoding according to the read one motion vector. , the reconstructed image block is obtained, and the reconstructed image block is stored.
若当前编码图像所有的一次残差块都重建结束, 则根据所存储的当 前编码图像的所有重建图像块得到当前编码图像的重建图像, 可作为其 它预测所需的一次参考图像。 若作为一次参考图像的集合为前五帧图 像, 则下一个待编码图像进行一次预测所需的五帧图像可以为前四帧图 像加上本次重建得到的图像, 最前面的一帧图像此时可以被删除。  If all the residual blocks of the current coded picture are reconstructed, the reconstructed image of the current coded picture is obtained from all the reconstructed image blocks of the stored current coded image, which can be used as a reference image for other predictions. If the set of the first reference image is the first five frames of images, the five frames of images required for the next image to be encoded may be the image of the first four frames plus the reconstructed image. The first image of the frame is the first image. Can be deleted.
其中对第一个图像进行编码时, 参考图像可以为空, 即对第一个图 像进行编码时, 可不经过预测, 而直接进行后续编码处理。  When the first image is encoded, the reference image may be empty, that is, when the first image is encoded, the subsequent encoding process may be directly performed without prediction.
图 9为本发明实施例一中解码器的结构示意图。 如图 9所示, 该解 码器包括: 解码模块、 反变换模块、 二次重建模块以及一次重建模块。  FIG. 9 is a schematic structural diagram of a decoder according to Embodiment 1 of the present invention. As shown in FIG. 9, the decoder includes: a decoding module, an inverse transform module, a secondary reconstruction module, and a primary reconstruction module.
并且, 解码流程为: 解码模块→反变换模块→二次重建模块→一次 重建模块→当前图像的重建图像。 其中二次重建时的二次运动矢量和一 次重建时的一次运动矢量都是前续解码模块解码之后得到的。  Moreover, the decoding process is: decoding module → inverse transform module → secondary reconstruction module → primary reconstruction module → reconstructed image of the current image. The secondary motion vector in the case of secondary reconstruction and the primary motion vector in the case of one reconstruction are obtained after decoding of the preceding decoding module.
其中, 解码模块用于对压缩码流进行熵解码、 重排序等, 得到当前 待解码图像中当前待解码块的一次运动矢量、 二次运动矢量以及二次残 差块变换系数阵等, 并将二次残差块变换系数阵输出给反变换模块, 将 二次运动矢量输出给二次重建模块, 一次运动矢量输出给一次重建模 块。 The decoding module is configured to perform entropy decoding, reordering, and the like on the compressed code stream, to obtain a primary motion vector, a secondary motion vector, and a quadratic residual block transform coefficient matrix of the current to-be-decoded block in the current image to be decoded, and The quadratic residual block transform coefficient matrix is output to the inverse transform module, The secondary motion vector is output to the secondary reconstruction module, and the primary motion vector is output to the reconstruction module once.
反变换模块用于接收来自解码模块二次残差块变换系数阵 , 并对所 接收的二次残差块变换系数阵进行反量化及反变换等, 得到二次残差 块, 输出给二次重建模块。  The inverse transform module is configured to receive a quadratic residual block transform coefficient matrix from the decoding module, and perform inverse quantization and inverse transform on the received quadratic residual block transform coefficient matrix to obtain a quadratic residual block, and output the second residual block. Rebuild the module.
二次重建模块用于接收来自解码模块的二次运动矢量和来自反变换 模块的二次残差块, 并根据所接收的二次运动矢量, 对二次残差块在编 码时的二次参考图像中进行运动补偿, 得到一次残差块, 输出给一次重 建模块, 并将该一次残差块进行存储。  The quadratic reconstruction module is configured to receive the secondary motion vector from the decoding module and the secondary residual block from the inverse transform module, and according to the received secondary motion vector, the secondary reference of the secondary residual block at the time of encoding Motion compensation is performed in the image, and a residual block is obtained, which is output to a reconstruction module, and the primary residual block is stored.
若当前待解码图像所有的二次残差块都重建结束, 则根据所存储的 当前待解码图像的所有一次残差块得到当前待解码图像的一次残差图 像, 可作为其它解码所需的二次参考图像。  If all the secondary residual blocks of the current to-be-decoded image are reconstructed, the first residual image of the current image to be decoded is obtained according to the stored first residual residual block of the currently-to-be-decoded image, which can be used as the second required for other decoding. Secondary reference image.
一次重建模块用于接收来自解码模块的一次运动矢量和来自一次重 建模块的一次残差块, 并根据所接收的一次运动矢量, 对一次残差块在 编码时的一次参考图像中进行运动补偿, 得到重建图像块, 并对该重建 图像块进行保存。  The primary reconstruction module is configured to receive a primary motion vector from the decoding module and a primary residual block from the primary reconstruction module, and perform motion compensation on a reference image of the primary residual block at the time of encoding according to the received primary motion vector. A reconstructed image block is obtained and the reconstructed image block is saved.
若当前待解码图像所有的一次残差块都重建结束, 则根据所存储的 当前待解码图像的所有重建图像块, 得到原始图像的重建图像, 供后续 使用。 同时得到的重建图像还可作为其它待解码图像的一次参考图像。  If all the residual residual blocks of the current image to be decoded are reconstructed, the reconstructed image of the original image is obtained for subsequent use according to all the reconstructed image blocks of the stored current image to be decoded. The reconstructed image obtained at the same time can also serve as a reference image for other images to be decoded.
上面结合实施例对本发明编码方法、 解码方法及编解码系统的一般 情况进行了描述。 实际应用中, 步骤 302中在对一次残差块 N'进行二次 预测时, 为了在 A2'中找到最佳匹配块 M, 可以不用直接以 A2'作为参 考图像, 得到运动矢量(Mx,My )。  The general description of the encoding method, the decoding method, and the codec system of the present invention has been described above with reference to the embodiments. In practical applications, in the second prediction of the residual block N' in step 302, in order to find the best matching block M in A2', the motion vector (Mx, My can be obtained without directly using A2' as the reference image. ).
因为若存在 B1以 A1为参考图像进行了一次预测, 并假设在 B1中 与 B2的宏块 N所处位置对应的宏块为 Nl, 且 N1在 A1中的最佳匹配 块为 Ml, 对应的一次视差矢量为 (Mlx,Mly ), 又有 Ml在 B2中对应 位置处的宏块为 M, 则二次残差块为 Ν" = Ν'- M, 且可以将一次视差 矢量(Mlx,Mly)作为 N'在 A2'中的二次视差矢量( Mx,My )。 若一次 视差矢量(Mlx,Mly) 已经写入码流, 则本次无需再写入码流中。 设 B1以 A1为参考图像进行一次预测时, 只是在寻找最佳参考图像时进行 的, 则可以将该次预测中产生的一次视差矢量(Mlx,Mly)保留下来, 供二次预测时, 将该一次视差矢量(Mlx,Mly)作为二次预测的二次视 差矢量写入码流中。 对于其它宏块也可以采用该方法处理。 Because if there is B1 with A1 as the reference image, a prediction is made, and it is assumed that the macroblock corresponding to the position of the macroblock N of B2 in B1 is N1, and the best match of N1 in A1 The block is M1, the corresponding primary disparity vector is (Mlx, Mly), and the macroblock of the corresponding position of M1 in B2 is M, then the quadratic residual block is Ν" = Ν'-M, and can be once The disparity vector (Mlx, Mly) is used as the quadratic disparity vector (Mx, My) of N' in A2'. If the first disparity vector (Mlx, Mly) has been written into the code stream, it is not necessary to write the code stream again this time. Let B1 make a prediction with A1 as the reference image, but only when searching for the best reference image, then the first disparity vector (Mlx, Mly) generated in the prediction can be retained for the second prediction. The primary disparity vector (Mlx, Mly) is written into the code stream as a quadratic disparity vector of the second prediction. This method can also be used for other macroblocks.
同样, 在步骤 502中重建时, 或步骤 602中解码时, 保留图像 B1 在参考图像 A1中所有的视差矢量, 在对当前图像 B2待解码宏块 N进 行解码时, 首先解码获得一次运动矢量(Kx,Ky), 并根据解码获得的二 次残差块 N"以及宏块 N在 B1中对应位置的宏块 N1所对应的视差矢量 (Mlx,Mly), 将(Mlx,Mly)作为 N的二次运动矢量,在参考图像 A2' 中寻找到对应的补偿块 M, 得到一次残差块 N' = N" + M, 再由一次运 动矢量( Kx,Ky )在 B1中寻找到补偿块 K,得到重建图像块 N = N' + K。 对于其它宏块也可以采用该方法处理。  Similarly, when reconstructing in step 502, or decoding in step 602, all the disparity vectors of image B1 in reference image A1 are preserved. When decoding the current image B2 to be decoded macroblock N, decoding is first obtained to obtain a motion vector ( Kx, Ky), and according to the secondary residual block N" obtained by decoding and the disparity vector (Mlx, Mly) corresponding to the macroblock N1 of the corresponding position of the macroblock N in B1, (Mlx, Mly) is taken as N The secondary motion vector finds the corresponding compensation block M in the reference image A2', and obtains a residual block N' = N" + M, and then finds the compensation block K in B1 by the primary motion vector (Kx, Ky). , get the reconstructed image block N = N' + K. This method can also be used for other macroblocks.
或者在上述过程中得到( Mlx,Mly )之后,并不将该矢量直接作为 N' 在 A2'中的视差矢量(Mx,My), 而是可以根据该视差矢量在 A2'中找到 宏块 M, 然后以 M作为搜索的中心起始点, 在 M的附近搜索最佳匹配 块 Μ', 然后再得到 M'对应的视差矢量( Mx,My ), 则解码时同实施 例一或实施例二中所述的方法。 当然 M'也有可能与 M相同, 此时也可 以仍以 (Mlx,Mly)作为 N'在 A2'中的视差矢量。  Or after obtaining (Mlx, Mly) in the above process, the vector is not directly used as the disparity vector (Mx, My) of N' in A2', but the macroblock M can be found in A2' according to the disparity vector. Then, using M as the central starting point of the search, searching for the best matching block Μ' near M, and then obtaining the disparity vector (Mx, My) corresponding to M', then decoding is the same as in the first embodiment or the second embodiment. Said method. Of course, M' may also be the same as M. At this time, (Mlx, Mly) can still be used as the disparity vector of N' in A2'.
相应的在图 8所示的编码器中, 可以进一步包括一个视差矢量存储 模块, 用于存储一次预测中所产生的视差矢量, 当进行二次预测时可以 从该视差矢量存储模块中检索所需的视差矢量, 作为二次运动矢量, 或 者作为最佳匹配块的搜索中心点。 具体实现过程同上述方法中介绍。 Correspondingly in the encoder shown in FIG. 8, a parallax vector storage may be further included. a module, configured to store a disparity vector generated in one prediction, and may retrieve a required disparity vector from the disparity vector storage module when performing secondary prediction, as a secondary motion vector, or as a search center of a best matching block point. The specific implementation process is described in the above method.
实施例二:  Embodiment 2:
本实施例中, 对方式二中的实现方式进行伴细描述, 即在进行二次 预测之前,先对一次残差图像进行变换,然后对变换后的一次残差图像, 在二次参考图像对应的变换后的二次参考图像中进行二次预测 , 之后对 二次预测后产生的二次残差图像进行后续编码处理。  In this embodiment, the implementation manner in the second method is described in detail, that is, before performing the secondary prediction, the residual residual image is first transformed, and then the transformed primary residual image is corresponding to the secondary reference image. The second prediction is performed in the transformed secondary reference image, and then the secondary residual image generated after the secondary prediction is subjected to subsequent encoding processing.
本实施例中, 为了和方式一区别, 将对一次残差图像进行变换后产 生的一次残差图像称为一次残差图像变换系数阵, 相应地, 将对一次残 差块进行变换后产生的一次残差块称为一次残差块变换系数阵, 将对一 次残差图像变换系数阵进行二次预测产生的二次残差图像称为二次残 差图像变换系数阵, 相应地, 将对一次残差块变换系数阵进行二次预测 产生的二次残差块称为二次残差块变换系数阵, 此外, 还有二次参考图 像变换系数阵等。 同样, 在解码端, 将从压缩码流中解码得到的二次残 差图像称为二次残差图像变换系数阵, 对二次残差图像进行二次重建后 产生的一次残差图像称为一次残差图像变换系数阵, 相应地, 将从压缩 码流中解码得到二次残差图像中的二次残差块称为二次残差块变换系 数阵, 将对二次残差块进行二次重建后产生的一次残差块称为一次残差 块变换系数阵。  In this embodiment, in order to distinguish from the mode, the primary residual image generated by transforming the primary residual image is referred to as a primary residual image transform coefficient matrix, and correspondingly, the primary residual block is transformed. The primary residual block is called the primary residual block transform coefficient matrix, and the secondary residual image generated by the secondary prediction of the primary residual image transform coefficient matrix is called a quadratic residual image transform coefficient matrix, and correspondingly, The quadratic residual block generated by the quadratic residual block transform coefficient matrix for secondary prediction is called a quadratic residual block transform coefficient matrix, and there is also a quadratic reference image transform coefficient matrix and the like. Similarly, at the decoding end, the secondary residual image decoded from the compressed code stream is referred to as a quadratic residual image transform coefficient matrix, and the primary residual image generated after the secondary reconstruction of the secondary residual image is called The residual residual image transform coefficient matrix, correspondingly, the quadratic residual block in the quadratic residual image decoded from the compressed code stream is called a quadratic residual block transform coefficient matrix, and the second residual block is performed. The primary residual block generated after the second reconstruction is called the primary residual block transform coefficient matrix.
图 10为实施例二中图像编码方法的流程图。本实施例中的图像编码 方法流程仍以当前待编码图像的一个宏块的编码过程为例, 如图 10所 示, 该流程包括如下步骤:  FIG. 10 is a flowchart of an image encoding method in Embodiment 2. The image encoding method in this embodiment still takes the encoding process of a macroblock of the current image to be encoded as an example. As shown in FIG. 10, the process includes the following steps:
步骤 1001 , 对当前待编码块进行一次预测, 得到一次残差块及一次 运动矢量。 本步骤中的具体实现过程可以同实施例一中图 3所示步骤 301。 步骤 1002, 对得到的一次残差块进行变换, 得到一次残差块变换系 数阵, 对该一次残差块变换系数阵进行二次预测, 得到二次残差块变换 系数阵, 及二次运动矢量。 Step 1001: Perform a prediction on the current block to be coded to obtain a residual block and a motion vector. The specific implementation process in this step may be the same as the step 301 shown in FIG. 3 in the first embodiment. Step 1002: Perform a transformation on the obtained first residual block to obtain a residual block transform coefficient matrix, perform secondary prediction on the primary residual block transform coefficient matrix, obtain a quadratic residual block transform coefficient matrix, and quadratic motion. Vector.
本步骤中,仍以 B2'中的一次残差块 N'为例, 首先将 N'进行变换及 量化, 得到变换后的变换系数阵 Ν' , 并假设 Μ为参考图像 A2'中对应 的最佳匹配块, 对应的二次运动矢量为 (Mx,My ), 且 M经变换后的对 应变换系数阵为^ Ϊ , 则可以由^ Ϊ对 N进行预测, 得到二次残差块变换 系数阵 N ' = - ;或者也可以由^ ϊ'的某些系数对 Ν的某些系数进行 预测, 如由^ Ϊ的直流(DC, Direct Current )系数来预测 N的 DC系数, 由 的交流( AC, Alternating Current ) 系数来预测 N的 AC系数等, 具体的预测方法根据实际情况而定。 同时, 将得到的二次运动矢量进行 存储, 供图像重建时使用。  In this step, the first residual block N' in B2' is taken as an example. First, N' is transformed and quantized to obtain a transformed transform coefficient matrix Ν', and Μ is assumed to be the corresponding maximum in the reference image A2'. For a good matching block, the corresponding quadratic motion vector is (Mx, My), and the transformed transform coefficient matrix of M is ^ Ϊ, then N can be predicted by N , to obtain a quadratic residual block transform coefficient matrix. N ' = - ; or some coefficients of ^ ϊ ' can also be used to predict some coefficients of Ν, such as DC (Direct Current) coefficient of ^ 预测 to predict the DC coefficient of N, by AC (AC , Alternating Current ) Coefficient to predict the AC coefficient of N, etc. The specific prediction method depends on the actual situation. At the same time, the obtained secondary motion vector is stored for use in image reconstruction.
步骤 1003, 对二次残差块变换系数阵, 以及一次预测得到的一次运 动矢量和二次预测得到的二次运动矢量进行熵编码, 并一起写入压缩码 流中; 同时利用二次残差块变换系数阵进行图像重建, 作为其它待编码 图像的参考图像。  Step 1003: Entropy coding the quadratic residual block transform coefficient matrix, and the primary motion vector obtained by one prediction and the secondary motion vector obtained by the secondary prediction, and writing together into the compressed code stream; The block transform coefficient matrix performs image reconstruction as a reference image of other images to be encoded.
其中, 利用二次残差块变换系数阵进行图像重建的过程参考下面图 11所示流程。  The process of image reconstruction using the quadratic residual block transform coefficient matrix refers to the flow shown in FIG. 11 below.
图 11为图 10所示图像编码方法中的图像重建流程示意图。 以当前 待解码图像的一个宏块的重建过程为例 , 该流程包括如下步骤:  FIG. 11 is a schematic diagram of an image reconstruction process in the image encoding method shown in FIG. Taking the reconstruction process of a macroblock of the current image to be decoded as an example, the process includes the following steps:
步骤 1101 , 据步骤 1002中得到的二次运动矢量, 对二次残差块 变换系数阵, 在编码时作为参考图像的二次参考图像变换系数阵中, 进 行二次运动补偿, 得到一次残差块变换系数阵。 Step 1101, according to the quadratic motion vector obtained in step 1002, transforming the coefficient matrix of the quadratic residual block, and using the quadratic reference image transform coefficient matrix as the reference image during encoding, The line quadratic motion compensation obtains a residual block transform coefficient matrix.
本步骤中, 仍以图 2所示的四个图像为例进行描述, 并假设对当前 待编码图像 B2的宏块 N进行重建, 则对于二次预测后得到的二次残差 块变换系数阵 N" , 根据步骤 1002 中存储的 对应的二次运动矢量 ( Mx,My ) ,从在先重建的参考残差图像 A2'的变换系数阵中寻找到对应 的补偿块^ Ϊ , 然后得到一次残差块变换系数阵 N = " + 。 其它宏块 的本次重建过程与此相同。  In this step, the four images shown in FIG. 2 are still taken as an example, and assuming that the macroblock N of the current image to be encoded B2 is reconstructed, the quadratic residual block transform coefficient matrix obtained after the second prediction is obtained. N", according to the corresponding secondary motion vector (Mx, My) stored in step 1002, find the corresponding compensation block ^ 从 from the transform coefficient matrix of the previously reconstructed reference residual image A2', and then obtain a residual The difference block transform coefficient matrix N = " + . This reconstruction process for other macroblocks is the same.
步骤 1102, 对所得到的一次残差块变换系数阵进行反变换, 得到一 次一次残差块, 并对所得到的一次残差块进行存储。  Step 1102: Perform inverse transformation on the obtained primary residual block transform coefficient matrix to obtain a primary residual block, and store the obtained primary residual block.
本步骤中, 对变换后的变换系数阵进行反变换时对应于步骤 1002 中编码时的变换, 则步骤 1101中 经过反变换后得到 N'。  In this step, when the inverse transform of the transformed transform coefficient matrix is performed, corresponding to the transform at the time of encoding in step 1002, N1 is obtained by inverse transform in step 1101.
当 B2所有宏块的二次残差块变换系数阵都重建完毕, 根据所存储 的 B2的所有一次残差块,得到一次残差图像 B2'的重建图像,作为其它 待编码图像的二次参考图像。  When the quadratic residual block transform coefficient matrix of all macroblocks of B2 is reconstructed, a reconstructed image of the residual image B2' is obtained according to all stored residual blocks of B2, as a secondary reference of other images to be encoded. image.
步骤 1103, 据步骤 1001 中得到的一次运动矢量, 对所得到的一 次残差块在编码时作为参考图像的一次参考图像中进行一次运动补偿 , 得到重建图像块, 并对该重建图像块进行存储。  Step 1103, according to the primary motion vector obtained in step 1001, perform motion compensation on the obtained primary residual block as a reference image in the reference image at the time of encoding, obtain a reconstructed image block, and store the reconstructed image block. .
本步骤中,在对步骤 1102中 B2'的残差块 N'进行解码时,根据步骤 1001 中存储的一次运动矢量(Kx,Ky )从在先重建的参考图像 B1 中寻 找到补偿块 K, 得到重建图像 ¾ N = N' + K , 并对该重建图像块 N进行 存储。 其它宏块的本次重建过程与此相同。  In this step, when decoding the residual block N' of B2' in step 1102, the compensation block K is found from the previously reconstructed reference image B1 according to the primary motion vector (Kx, Ky) stored in step 1001. A reconstructed image is obtained 3⁄4 N = N' + K and the reconstructed image block N is stored. This reconstruction process for other macroblocks is the same.
当 B2所有宏块的一次残差块都重建完毕, ^^据所存储的 B2的所有 重建图像块, 得到图像 B2的重建图像, 作为其它待编码图像的一次参 考图像。 图 12为本发明实施例二中图像解码方法的流程图。此处,也以当前 待解码图像的一个宏块的解码过程为例, 如图 12所示, 该流程包括如 下步骤: When all the residual blocks of all macroblocks of B2 are reconstructed, according to all the reconstructed image blocks of B2 stored, the reconstructed image of image B2 is obtained as a reference image of other images to be encoded. FIG. 12 is a flowchart of an image decoding method according to Embodiment 2 of the present invention. Here, the decoding process of one macroblock of the current image to be decoded is taken as an example. As shown in FIG. 12, the process includes the following steps:
步骤 1201 , 对压缩码流进行熵解码得到一次运动矢量和二次运动矢 量, 以及二次残差块变换系数阵。  Step 1201: Entropy decoding the compressed code stream to obtain a motion vector and a quadratic motion vector, and a quadratic residual block transform coefficient matrix.
本步骤中,解码方法与编码方法相对应,对压缩码流进行熵解码后, 得到一次运动矢量和二次运动矢量, 以及本次待解码图像的当前待解码 块, 即二次残差块变换系数阵。  In this step, the decoding method corresponds to the encoding method, and after performing entropy decoding on the compressed code stream, a motion vector and a secondary motion vector are obtained, and the current block to be decoded of the image to be decoded, that is, a quadratic residual block transform. Coefficient matrix.
步骤 1202, 据得到的二次运动矢量, 对所得到的二次残差块变换 系数阵, 在编码时作为二次参考图像的残差图像变换系数阵中进行运动 补偿, 得到一次残差块变换系数阵。  Step 1202: According to the obtained quadratic motion vector, perform motion compensation on the obtained quadratic residual block transform coefficient matrix, and perform motion compensation in the residual image transform coefficient matrix of the secondary reference image at the time of encoding, to obtain a residual block transform. Coefficient matrix.
本步骤中, 仍以图 2所示的四个图像为例进行描述, 并假设当前待 解码图像为 B2, 则对其中的宏块 N进行解码时, 对于从压缩码流解码 后得到的二次残差块变换系数阵 , 根据解码得到的 对应的二次运 动矢量(Mx,My ), 从在先解码后的残差图像 A2'的变换系数阵中, 寻找 到对应的补偿块^ Ϊ , 然后得到一次残差块变换系数阵 N = " + 。 其 它宏块的本次解码过程与此相同。  In this step, the four images shown in FIG. 2 are still taken as an example, and it is assumed that the current image to be decoded is B2, and when the macroblock N is decoded, the second obtained after decoding from the compressed code stream The residual block transform coefficient matrix, according to the corresponding quadratic motion vector (Mx, My) obtained by decoding, finds the corresponding compensation block ^ 中 from the transform coefficient matrix of the previously decoded residual image A2', and then Obtain a residual block transform coefficient matrix N = " + . This decoding process of other macroblocks is the same.
其中, A2'为编码时的二次参考图像, 此时作为解码时的二次参考 图像, 由在先的已解码图像 A2在解码时执行步骤 1203时得到 , 即 A2 对应残差图像解码后的重建图像。 在执行本步骤时, 首先对 A2'进行变 换, 得到 A2'的变换系数阵。  Wherein, A2' is a secondary reference image at the time of encoding. At this time, as the secondary reference image at the time of decoding, the previous decoded image A2 is obtained when the step 1203 is performed at the time of decoding, that is, after the A2 corresponding residual image is decoded. Rebuild the image. When this step is performed, A2' is first transformed to obtain a transform coefficient matrix of A2'.
步骤 1203, 对所得到的一次残差块变换系数阵进行反变换, 得到一 次一次残差块, 并对所得到的一次残差块进行存储。  Step 1203: Perform inverse transformation on the obtained primary residual block transform coefficient matrix to obtain a primary residual block, and store the obtained primary residual block.
本步骤中 , 对得到的一次残差块变换系数阵进行反变换时对应于步 骤 1002中编码时的变换, 则步骤 1202中 N经过反变换后得到 N'。 当 B2所有宏块的二次残差块变换系数阵都解码完毕, 根据所存储 的 B2的所有一次残差块,得到一次残差图像 B2'的重建图像,作为其它 待解码图像的二次参考图像。 In this step, the inverse transformation of the obtained residual block transform coefficient matrix corresponds to the step In the conversion at the time of encoding in step 1002, N is inversely transformed in step 1202 to obtain N'. When the quadratic residual block transform coefficient matrix of all macroblocks of B2 is decoded, a reconstructed image of the residual image B2' is obtained according to all stored residual blocks of B2, as a secondary reference of other images to be decoded. image.
步骤 1204, 据得到的一次运动矢量, 对所得到的一次残差块, 在 编码时作为一次参考图像的图像中进行运动补偿, 得到重建图像块, 并 对该重建图像块进行存储。  Step 1204: According to the obtained primary motion vector, perform motion compensation on the obtained primary residual block as an image of the primary reference image at the time of encoding, obtain a reconstructed image block, and store the reconstructed image block.
本步骤中, 在对步骤 1203 中 B2'的残差块 N'进行解码时, ^居解 码得到的 N'对应的一次运动矢量(Kx,Ky )从在先解码后的参考图像 B1中, 寻找到补偿块 K,得到重建图像块N = N' + K ,对该重建图像块 进行存储。 其它宏块的本次解码过程与此相同。  In this step, when decoding the residual block N' of B2' in step 1203, the primary motion vector (Kx, Ky) corresponding to N' obtained by decoding is searched from the previously decoded reference image B1. To the compensation block K, a reconstructed image block N = N' + K is obtained, and the reconstructed image block is stored. This decoding process of other macroblocks is the same.
至此, 当前待解码块的解码过程结束。 当 B2所有宏块的一次残差 块都解码完毕, 根据所存储的 B2的所有重建图像块, 得到原始图像的 重建图像, 供后续使用。 同时得到的重建图像还可作为其它待解码图像 的一次参考图像。  So far, the decoding process of the current block to be decoded ends. When all the residual blocks of all macroblocks of B2 are decoded, the reconstructed image of the original image is obtained for subsequent use according to all the reconstructed image blocks of B2 stored. The reconstructed image obtained at the same time can also serve as a reference image for other images to be decoded.
上述对本发明中又一种图像编码方法和解码方法进行了详细描述, 下面再对本发明中基于上述图像编码方法和解码方法的编码器和解码 器进行伴细说明。  Further, the image encoding method and the decoding method in the present invention are described in detail. Hereinafter, the encoder and the decoder based on the image encoding method and the decoding method in the present invention will be described in detail.
图 13为本发明实施例二中编码器的结构示意图。 如图 13所示, 该 编码器包括: 一次预测模块、 变换模块、 二次预测模块、 编码模块、 二 次重建模块、 反变换模块以及一次重建模块。  FIG. 13 is a schematic structural diagram of an encoder according to Embodiment 2 of the present invention. As shown in FIG. 13, the encoder includes: a primary prediction module, a transformation module, a secondary prediction module, an encoding module, a secondary reconstruction module, an inverse transformation module, and a primary reconstruction module.
并且, 编码流程为: 当前待编码图像→一次预测模块→变换模块→ 二次预测模块→编码模块→码流; 重建时流程为: 二次重建模块→反变 换模块→一次重建模块→当前图像的重建图像。 其中一次预测模块产生 的一次运动矢量和二次预测模块产生的二次运动矢量直接输出给编码 模块, 二次重建时, 采用的是二次预测模块产生的二次运动矢量, 一次 重建时, 采用的是一次预测模块产生的一次运动矢量。 Moreover, the encoding process is: current image to be encoded → one prediction module → transformation module → secondary prediction module → encoding module → code stream; the process of reconstruction is: secondary reconstruction module → inverse transformation module → primary reconstruction module → current image Rebuild the image. One of the prediction modules is generated The secondary motion vector generated by the primary motion vector and the secondary prediction module is directly output to the coding module, and the secondary motion vector generated by the secondary prediction module is used in the secondary reconstruction, and the primary prediction vector is used in one reconstruction. The resulting motion vector.
其中 ,一次预测模块用于从一次重建模块中读取一次参考图像集合, 对当前待编码图像以宏块或块为单位, 对当前待编码块从参考图像集合 中选取最佳匹配块, 用所选取的最佳匹配块对当前待编码块进行预测, 得到一次残差块及对应的一次运动矢量, 将一次残差块输出给变换模 块,将一次运动矢量输出给编码模块, 同时对该一次运动矢量进行存储, 供一次重建模块使用。  The primary prediction module is configured to read the reference image set once from the primary reconstruction module, and select the best matching block from the reference image set for the current to-be-coded block in units of macroblocks or blocks. The selected best matching block predicts the current block to be coded, obtains a residual block and a corresponding primary motion vector, outputs a residual block to the transform module, and outputs a motion vector to the coding module, and simultaneously performs the motion. The vector is stored for use by a rebuild module.
变换模块用于接收来自一次预测模块的一次残差块, 并对所接收的 一次残差块进行变换, 得到一次残差块变换系数阵输出给二次预测模 块, 并将从二次重建模块中读取的二次参考图像进行变换, 得到二次参 考图像变换系数阵, 输出给二次预测模块。  The transform module is configured to receive a residual block from the primary prediction module, and transform the received residual residual block to obtain a residual block transform coefficient matrix output to the secondary prediction module, and the secondary reconstruction module The read secondary reference image is transformed to obtain a quadratic reference image transform coefficient matrix, which is output to the secondary prediction module.
二次预测模块用于接收来自一次预测模块的一次残差块变换系数阵 以及二次参考图像变换系数阵, 以二次参考图像变换系数阵中最佳匹配 块的变换系数阵对该一次残差块变换系数阵进行预测 , 得到二次残差块 变换系数阵以及二次运动矢量,输出给编码模块及二次重建模块。 同时, 对该二次运动矢量进行存储, 供二次重建模块使用。  The secondary prediction module is configured to receive a primary residual block transform coefficient matrix and a secondary reference image transform coefficient matrix from the primary prediction module, and use the transform coefficient matrix of the best matching block in the quadratic reference image transform coefficient matrix to the primary residual The block transform coefficient matrix is predicted, and a quadratic residual block transform coefficient matrix and a quadratic motion vector are obtained, which are output to an encoding module and a quadratic reconstruction module. At the same time, the secondary motion vector is stored for use by the secondary reconstruction module.
编码模块可以包括重排序及熵编码等编码过程, 用于接收来自二次 预测模块的二次残差块变换系数阵及二次运动矢量, 连同来自一次预测 模块的一次运动矢量一起进行熵编码, 写入码流中。  The encoding module may include an encoding process such as reordering and entropy encoding, and is configured to receive a quadratic residual block transform coefficient matrix and a secondary motion vector from the secondary prediction module, and perform entropy encoding together with a primary motion vector from the primary prediction module. Write to the stream.
二次重建模块用于接收来自二次预测模块的二次残差块变换系数 阵, 并根据从二次预测模块读取的二次运动矢量, 对所接收的二次残差 块变换系数阵 , 在编码时的二次参考图像变换系数阵中进行运动补偿 , 得到一次残差块系数阵输出给反变换模块。 反变换模块用于接收来自二次重建模块的一次残差块变换系数阵, 并对所接收的一次残差块变换系数阵进行反变换, 得到一次残差块, 输 出给一次重建模块, 并将该一次残差块进行存储。 The quadratic reconstruction module is configured to receive a quadratic residual block transform coefficient matrix from the secondary prediction module, and transform the coefficient matrix of the received quadratic residual block according to the secondary motion vector read from the secondary prediction module, The motion compensation is performed in the quadratic reference image transform coefficient matrix at the time of encoding, and the residual block coefficient matrix output is obtained to the inverse transform module. The inverse transform module is configured to receive a residual block transform coefficient matrix from the quadratic reconstruction module, and inversely transform the received residual block transform coefficient matrix to obtain a residual block, which is output to a reconstruction module, and This one-time residual block is stored.
若当前编码图像所有的二次残差块变换系数阵都重建并反变换结 束, 则根据所存储的当前编码图像的所有一次残差块得到当前编码图像 的一次残差图像, 可作为其它预测所需的二次参考图像。  If all the quadratic residual block transform coefficient arrays of the current coded image are reconstructed and the inverse transform ends, the first residual image of the current coded image is obtained according to all the first residual blocks of the stored current coded image, and can be used as other predictions. The required secondary reference image.
一次重建模块用于接收来自反变换模块的一次残差块, 并读取一次 预测模块所存储的一次运动矢量, 根据所读取的一次运动矢量, 在编码 时的一次参考图像中进行运动补偿, 得到重建图像块, 并将该重建图像 块进行存储。  The primary reconstruction module is configured to receive a primary residual block from the inverse transform module, and read a motion vector stored by the prediction module once, and perform motion compensation in a reference image during encoding according to the read one motion vector. A reconstructed image block is obtained and the reconstructed image block is stored.
若当前编码图像所有的一次残差块都重建结束, 则根据所存储的当 前编码图像的所有重建图像块得到当前编码图像的重建图像, 可作为其 它预测所需的一次参考图像。  If all the residual blocks of the current coded picture are reconstructed, the reconstructed image of the current coded picture is obtained from all the reconstructed image blocks of the stored current coded image, which can be used as a reference image for other predictions.
其中对第一个图像进行编码时, 参考图像可以为空, 即对第一个图 像进行编码时, 可不经过预测, 而直接进行后续编码处理。  When the first image is encoded, the reference image may be empty, that is, when the first image is encoded, the subsequent encoding process may be directly performed without prediction.
图 14为本发明实施例二中解码器的结构示意图。 如图 14所示, 该 解码器包括: 解码模块、 二次重建模块、 反变换模块、 一次重建模块以 及变换模块。  FIG. 14 is a schematic structural diagram of a decoder according to Embodiment 2 of the present invention. As shown in FIG. 14, the decoder includes: a decoding module, a quadratic reconstruction module, an inverse transform module, a primary reconstruction module, and a transformation module.
并且, 解码流程为: 解码模块→二次重建模块→反变换模块→一次 重建模块→当前图像的重建图像。 其中二次重建时的二次运动矢量和一 次重建时的一次运动矢量都是解码模块解码之后得到的。  Moreover, the decoding process is: decoding module→secondary reconstruction module→inverse transformation module→one reconstruction module→reconstructed image of the current image. The secondary motion vector in the case of secondary reconstruction and the primary motion vector in the case of one reconstruction are obtained after decoding by the decoding module.
其中, 解码模块, 用于对压缩码流进行熵解码, 得到当前待解码图 像中当前待解码块的一次运动矢量、 二次运动矢量以及二次残差块变换 系数阵等 , 并将二次残差块变换系数阵以及二次运动矢量输出给二次重 建模块, 将一次运动矢量输出给一次重建模块。 二次重建模块用于接收来自编码模块的二次残差块变换系数阵以及 二次运动矢量, 并接收来自变换模块的该二次残差块变换系数阵编码时 的二次参考图像变换系数阵, 根据所接收的二次运动矢量, 将二次残差 块变换系数阵在编码时的二次参考图像变换系数阵中进行运动补偿 , 得 到一次残差块系数阵, 输出给反变换模块。 The decoding module is configured to perform entropy decoding on the compressed code stream to obtain a primary motion vector, a secondary motion vector, and a quadratic residual block transform coefficient matrix of the current to-be-decoded block in the current image to be decoded, and the second residual The difference block transform coefficient matrix and the quadratic motion vector are output to the quadratic reconstruction module, and the primary motion vector is output to the reconstruction module once. The quadratic reconstruction module is configured to receive a quadratic residual block transform coefficient matrix and a quadratic motion vector from the encoding module, and receive the quadratic reference image transform coefficient matrix when the quadratic residual block transform coefficient matrix encoding from the transform module is received According to the received quadratic motion vector, the quadratic residual block transform coefficient matrix is motion-compensated in the quadratic reference image transform coefficient matrix at the time of encoding, and a residual block coefficient matrix is obtained, which is output to the inverse transform module.
其中, 二次参考图像变换系数阵为经过二次重建模块和反变换模块 后已解码出的一次残差图像, 变换模块用于读取该一次残差图像, 并对 所读取的一次残差图像进行变换 , 将变换后的变换系数阵输出给二次重 建模块。  The secondary reference image transform coefficient matrix is a primary residual image that has been decoded after being subjected to the secondary reconstruction module and the inverse transform module, and the transform module is configured to read the primary residual image and read the residual once. The image is transformed, and the transformed transform coefficient matrix is output to the quadratic reconstruction module.
反变换模块用于接收来自二次重建模块的一次残差块变换系数阵, 并对所接收的一次残差块变换系数阵进行反变换, 得到一次残差块, 输 出给一次重建图像, 并将该一次残差块进行存储。  The inverse transform module is configured to receive a residual block transform coefficient matrix from the quadratic reconstruction module, and inversely transform the received residual block transform coefficient matrix to obtain a residual block, which is output to a reconstructed image, and This one-time residual block is stored.
若当前待解码图像所有的二次残差块变换系数阵都重建并反变换结 束, 则根据所存储的当前待解码图像的所有一次残差块, 得到当前待解 码图像的一次残差图像, 可作为其它解码所需的二次参考图像。  If all the secondary residual block transform coefficient arrays of the current image to be decoded are reconstructed and the inverse transform ends, the first residual image of the current image to be decoded is obtained according to the stored first residual residual block of the currently decoded image, As a secondary reference image required for other decoding.
一次重建模块用于接收来自反变换模块的一次残差块, 并读取一次 预测模块所存储的一次运动矢量, 根据所读取的一次运动矢量, 在编码 时的一次参考图像中进行运动补偿, 得到重建图像块, 并将该重建图像 块进行存储。  The primary reconstruction module is configured to receive a primary residual block from the inverse transform module, and read a motion vector stored by the prediction module once, and perform motion compensation in a reference image during encoding according to the read one motion vector. A reconstructed image block is obtained and the reconstructed image block is stored.
若当前待解码图像所有的一次残差块都重建结束, 则根据所存储的 当前待解码图像的所有重建图像块, 得到当前待解码图像的重建图像, 可作为其它解码所需的一次参考图像。  If all the residual blocks of the current image to be decoded are reconstructed, the reconstructed image of the current image to be decoded is obtained according to all the reconstructed image blocks of the currently decoded image to be decoded, and can be used as a reference image for other decoding.
其中, 实施例二中的编码器, 在对图像重建的过程中, 经过二次重 建模块之后, 得到一次残差块变换系数阵, 在将该一次残差块变换系数 阵输出给反变换模块的同时, 可以对其进行存储, 并根据所存储当前编 码图像的所有一次残差块变换系数阵, 得到一次残差图像变换系数阵, 作为输入二次预测模块的二次参考图像变换系数阵 , 则变换模块在对一 次残差块变换系数阵进行变换后, 不必再对其进行存储, 且该二次参考 图像变换系数阵也无需由二次参考图像经过变换模块变换后得到。 同 样, 在解码器中, 也可以作同样处理, 此时解码器中可无需包含变换模 块。 The encoder in the second embodiment obtains a residual block transform coefficient matrix after the second reconstruction module in the process of reconstructing the image, and outputs the primary residual block transform coefficient matrix to the inverse transform module. At the same time, it can be stored and based on the current compilation All the residual block transform coefficient arrays of the code image are obtained, and a residual image transform coefficient matrix is obtained. As a secondary reference image transform coefficient matrix of the input quadratic prediction module, the transform module transforms the first residual block transform coefficient matrix. After that, it is not necessary to store it, and the quadratic reference image transform coefficient matrix does not need to be obtained by transforming the secondary reference image through the transform module. Similarly, in the decoder, the same processing can be performed, and the transform module does not need to be included in the decoder.
本实施例中在进行变换时或变换模块执行变换时, 可以包括变换和 量化, 进行后续编码时或编码模块执行编码时, 也可以包括重排序及熵 编码,或者其它编码方式; 同样反变换时,或反变换模块执行反变换时, 与变换时或变换模块对应, 也可以包括反量化和反变换, 前序解码时, 或解码模块执行解码时, 与后续编码或编码模块相对应, 可包括熵解码 及重排序, 或者其它解码方式。  In this embodiment, when performing transform or when transform module performs transform, it may include transform and quantization, and may perform re-sequencing and entropy coding, or other coding modes when performing subsequent coding or coding module execution; Or when the inverse transform module performs the inverse transform, corresponding to the transform or transform module, may also include inverse quantization and inverse transform, when pre-decoding, or when the decoding module performs decoding, corresponding to the subsequent encoding or encoding module, may include Entropy decoding and reordering, or other decoding methods.
实施例三  Embodiment 3
本实施例中,可以同时应用实施例一中的图像编码方法、解码方法, 以及实施例二中的图像编码方法、 解码方法。 相应的, 编码器和解码器 兼具有上述实施例一和实施例二中的编码器和解码器的两种实现功能, 是在实施例二的基础上加上了实施例一中的实现方式。 图 15 为本发明 实施例三中编码器的结构示意图。 该编码器包括: 一次预测模块、 变换 模块、 二次预测模块、 编码模块、 二次重建模块、 反变换模块以及一次 重建模块。 其中包括虚线部分表示的编码流程: 当前待编码图像→一次 预测模块→二次预测模块→变换模块→编码模块→码流; 重建时流程: 反变换模块→二次重建模块→一次重建模块→当前图像的重建图像。 以 及实线部分表示的编码流程: 当前待编码图像→一次预测模块→变换模 块→二次预测模块→编码模块→码流; 重建时流程: 二次重建模块→反 变换模块→一次重建模块→当前图像的重建图像。 其中一次预测模块产生的一次运动矢量和二次预测模块产生的二次 运动矢量直接输出给编码模块, 二次重建时, 采用的是二次预测模块产 生的二次运动矢量, 一次重建时, 采用的是一次预测模块产生的一次运 动矢量。 In this embodiment, the image encoding method and the decoding method in the first embodiment and the image encoding method and the decoding method in the second embodiment can be simultaneously applied. Correspondingly, the encoder and the decoder have the two implementation functions of the encoder and the decoder in the first embodiment and the second embodiment, and the implementation manner in the first embodiment is added to the second embodiment. . FIG. 15 is a schematic structural diagram of an encoder according to Embodiment 3 of the present invention. The encoder comprises: a primary prediction module, a transformation module, a secondary prediction module, an encoding module, a secondary reconstruction module, an inverse transformation module, and a primary reconstruction module. The coding process represented by the dotted line part is included: current image to be coded → primary prediction module → secondary prediction module → transformation module → coding module → code stream; reconstruction process: inverse transformation module → secondary reconstruction module → primary reconstruction module → current The reconstructed image of the image. And the coding process represented by the solid line part: current image to be encoded → one prediction module → transformation module → secondary prediction module → coding module → code stream; reconstruction process: secondary reconstruction module → inverse transformation module → primary reconstruction module → current The reconstructed image of the image. The primary motion vector generated by one prediction module and the secondary motion vector generated by the secondary prediction module are directly output to the coding module, and the secondary motion vector generated by the secondary prediction module is used in the secondary reconstruction, and is used in one reconstruction. Is a motion vector generated by a prediction module.
图 16为本发明实施例三中解码器的结构示意图。该解码器包括: 解 码模块、 二次重建模块、 反变换模块、 一次重建模块以及变换模块。 其 中包括虚线部分表示的解码流程: 解码模块→反变换模块→二次重建模 块→一次重建模块→当前图像的重建图像。 以及实线部分表示的解码流 程: 解码模块→二次预测模块→反变换模块→一次预测模块→当前图像 的重建图像。  FIG. 16 is a schematic structural diagram of a decoder in Embodiment 3 of the present invention. The decoder comprises: a decoding module, a secondary reconstruction module, an inverse transformation module, a primary reconstruction module, and a transformation module. The decoding process represented by the dotted line portion is included: decoding module → inverse transform module → quadratic re-modeling block → one-time reconstruction module → reconstructed image of the current image. And the decoding process represented by the solid line part: decoding module → secondary prediction module → inverse transform module → primary prediction module → reconstructed image of the current image.
其中解码时, 二次重建时的二次运动矢量和一次重建时的一次运动 矢量都是解码模块解码之后得到的。  In the decoding, the secondary motion vector at the time of secondary reconstruction and the primary motion vector at the time of one reconstruction are obtained after decoding by the decoding module.
其中 , 编码器和解码器采用实线部分的流程还是虚线部分的流程, 可以根据实际控制, 或者根据编解码效果, 或者根据其它实际情况分别 进行, 采用哪种编码方式, 就要对应哪种解码方式, 可以在编码器编码 时, 以图像帧为单位, 或者以宏块为单位等, 设置一个标志位, 采用哪 种编码方式, 便用标志位进行标记; 解码器在对压缩码流进行解码时, 可根据解码标志执行相应的解码过程。 其中编码器和解码器中的各个功 能模块根据实际所采用的实现方式, 执行相应的功能, 如采用实线部分 的实现方式时, 按照实施例二中执行; 采用虚线部分的实现方式时, 按 照实施例一中执行。  Wherein, the encoder and the decoder adopt the flow of the solid line part or the flow of the dotted line part, which may be performed according to actual control, or according to the codec effect, or according to other actual conditions, and which encoding mode is used, which decoding is required In the mode, when the encoder is encoded, the image frame is used as a unit, or a macroblock is used as a unit, a flag bit is set, and which encoding mode is used, the flag bit is used for marking; the decoder decodes the compressed code stream. The corresponding decoding process can be performed according to the decoding flag. The function modules in the encoder and the decoder perform corresponding functions according to the actual implementation manner. For example, when the implementation of the solid line part is adopted, the implementation is performed according to the second embodiment; when the implementation of the dotted line part is adopted, Executed in the first embodiment.
实际编码过程中, 关于熵编码环节, 还可以有其它的编码方法, 同 理, 熵解码环节也可以为其它的解码方法, 其中, 解码方法与编码方法 相对应。 并且, 也可以不进行熵编码或其它编码过程, 而直接将一次运 动矢量、 二次运动矢量及二次残差图像写入压缩码流中。 上述三个实施例中的解码器, 在进行二次重建时, 所输入的二次残 差图像也可以是进行熵编码之后的压缩码流, 此时需要在编码器中增加 一个解码模块, 用于接收编码模块生成的压缩码流, 从压缩码流中解码 得到二次残差图像、 二次运动矢量及一次运动矢量, 则重建过程可以同 解码器中的过程。 In the actual coding process, there may be other coding methods for the entropy coding step. Similarly, the entropy decoding link may also be other decoding methods, wherein the decoding method corresponds to the coding method. Moreover, the primary motion vector, the secondary motion vector, and the secondary residual image may be directly written into the compressed code stream without performing entropy coding or other encoding processes. In the decoder of the above three embodiments, when the secondary reconstruction is performed, the input secondary residual image may also be a compressed code stream after entropy coding. In this case, a decoding module needs to be added to the encoder. After receiving the compressed code stream generated by the encoding module and decoding the second residual image, the secondary motion vector and the primary motion vector from the compressed code stream, the reconstruction process may be the same as the process in the decoder.
其中, 本发明所提供的图像编码方法和图像解码方法可以同时使用 构成编解码方法, 包括:  The image encoding method and the image decoding method provided by the present invention can be used simultaneously to form a codec method, including:
编码时, 对当前待编码图像进行一次预测, 得到一次残差图像及一 次运动矢量, 并对一次残差图像进行二次预测, 得到二次残差图像及二 次运动矢量, 将二次残差图像、 二次运动矢量及一次运动矢量写入压缩 码流中发送出去。  When encoding, the current image to be encoded is predicted once, and a residual image and a motion vector are obtained once, and a residual image is secondarily predicted to obtain a secondary residual image and a secondary motion vector, and the second residual is obtained. The image, the secondary motion vector, and the primary motion vector are written into the compressed code stream for transmission.
解码时, 接收压缩码流, 并从压缩码流中解码得到一次运动矢量、 二次运动矢量和二次残差图像; 根据二次运动矢量, 对二次残差图像进 行运动补偿, 得到一次残差图像, 并根据一次运动矢量, 对一次残差图 像进行运动补偿, 得到重建图像。  During decoding, the compressed code stream is received, and a motion vector, a quadratic motion vector, and a quadratic residual image are decoded from the compressed code stream; and the second residual image is motion compensated according to the secondary motion vector to obtain a residual The difference image is subjected to motion compensation for the primary residual image according to the primary motion vector to obtain a reconstructed image.
对于编码和解码的具体实现过程, 也可以同实施例一至实施例三所 描述的几种方法。  For the specific implementation process of encoding and decoding, several methods described in the first embodiment to the third embodiment are also possible.
本发明所提供的编码器和解码器也可以组装成一个编解码器使用。 如图 17所示, 图 17为在实施例一中图 8所示的编码器和图 9所示的解 码器的基础上组装成的编解码器, 该编解码器包括: 编码单元和解码单 元。  The encoder and decoder provided by the present invention can also be assembled into a codec for use. As shown in FIG. 17, FIG. 17 is a codec assembled on the basis of the encoder shown in FIG. 8 and the decoder shown in FIG. 9 in the first embodiment, the codec comprising: a coding unit and a decoding unit. .
其中, 编码单元, 用于对当前待编码图像进行一次预测, 得到一次 残差图像及一次运动矢量, 并对一次残差图像进行二次预测, 得到二次 残差图像及二次运动矢量, 将二次残差图像、 二次运动矢量及一次运动 矢量写入压缩码流中发送出去。 解码单元, 用于接收压缩码流, 并从压缩码流中解码得到一次运动 矢量、 二次运动矢量和二次残差图像; 根据二次运动矢量, 对二次残差 图像进行运动补偿, 得到一次残差图像, 并根据一次运动矢量, 对一次 残差图像进行运动补偿, 得到重建图像, 并且解码单元进一步用于为编 码单元提供作为参考图像的重建图像。 The coding unit is configured to perform a prediction on the current image to be encoded, obtain a residual image and a motion vector, and perform a second prediction on the first residual image to obtain a secondary residual image and a secondary motion vector. The quadratic residual image, the secondary motion vector, and the primary motion vector are written into the compressed code stream for transmission. a decoding unit, configured to receive a compressed code stream, and obtain a motion vector, a quadratic motion vector, and a quadratic residual image from the compressed code stream; perform motion compensation on the second residual image according to the secondary motion vector, The residual image is once, and the residual image is motion compensated according to the primary motion vector to obtain a reconstructed image, and the decoding unit is further configured to provide the reconstructed image as a reference image for the encoding unit.
其中, 编码单元可以包括: 一次预测模块、 二次预测模块、 变换模 块以及编码模块; 解码单元可以包括: 解码模块、 反变换模块、 二次重 建模块以及一次重建模块。  The coding unit may include: a primary prediction module, a secondary prediction module, a transformation module, and an encoding module; the decoding unit may include: a decoding module, an inverse transform module, a secondary reconstruction module, and a primary reconstruction module.
该编解码器对于图 8所示的编码器来说进一步包括了解码模块, 用 于在为编码过程提供参考图像的重建图像时, 从编码生成的压缩码流中 解码得到二次残差图像以及一次运动矢量和二次运动矢量 , 然后对该二 次残差图像进行反变换, 在进行图像重建时, 所需要的二次运动矢量可 以是二次预测模块存储的二次运动矢量, 也可以是解码模块解码得到的 二次运动矢量, 同理, 所需要的一次运动矢量可以是一次预测模块存储 的一次运动矢量, 也可以是解码模块解码得到的一次运动矢量, 如果完 成由解码模块得到的话, 则一次预测模块和二次预测模块可以不对所产 生的一次运动矢量和二次运动矢量进行存储。  The codec further includes a decoding module for the encoder shown in FIG. 8 for decoding a quadratic residual image from the compressed stream generated by the encoding when the reconstructed image of the reference image is provided for the encoding process. a motion vector and a quadratic motion vector, and then inversely transforming the second residual image. When performing image reconstruction, the required secondary motion vector may be a secondary motion vector stored by the secondary prediction module, or may be The secondary motion vector obtained by the decoding module is decoded. Similarly, the required primary motion vector may be a motion vector stored by the prediction module, or may be a motion vector decoded by the decoding module. If the decoding module obtains the motion vector, Then, the primary prediction module and the secondary prediction module may not store the generated primary motion vector and secondary motion vector.
该编解码器对于图 9所示的解码器来说, 进行解码的部分主要由解 码模块、 反变换模块、 二次重建模块以及一次重建模块来完成, 并且各 个模块的功能与连接关系和图 9所示的模块功能与连接关系相同。  The codec for the decoder shown in FIG. 9 is mainly decoded by the decoding module, the inverse transform module, the secondary reconstruction module, and the primary reconstruction module, and the functions and connection relationships of the respective modules and FIG. The module functions shown are the same as the connection relationship.
当前对于图 17所示的编解码器还可以有其它的结构变形,或者可以 不包括变换模块以及反变换模块等 , 解码模块与编码模块也同样可以有 很多编码方式及解码方式。  Currently, the codec shown in FIG. 17 may have other structural modifications, or may not include a transform module and an inverse transform module. The decoding module and the encoding module may also have many encoding modes and decoding modes.
同样, 对于实施例二和实施例三中的编码器和解码器也可以组装成 编解码器。 并且还可以有各种结构变形等。 从上述各个实施例可见, 本发明通过将各个视频序列中某些已经编 码过的图像所对应的残差图像作为参考图像, 对当前待编码图像经过预 测编码后产生的残差图像进行预测, 再将预测后获得的二次残差图像进 行后续编码操作, 从而消除残差图像之间的相关性, 进一步降低图像之 间的冗余度, 减少码流的数据量, 提高编码效率。 Also, the encoder and decoder in the second embodiment and the third embodiment can be assembled into a codec. And there are also various structural deformations and the like. As can be seen from the above embodiments, the present invention predicts a residual image generated by predicting and encoding an image to be encoded by using a residual image corresponding to some already encoded images in each video sequence as a reference image, and then The secondary residual image obtained after the prediction is subjected to a subsequent encoding operation, thereby eliminating the correlation between the residual images, further reducing the redundancy between the images, reducing the data amount of the code stream, and improving the encoding efficiency.
此外 , 在对当前待编码图像经过预测编码后产生的残差图像进行预 测时, 对当前待编码图像的一次残差图像以宏块或块为单位, 在作为二 次参考图像的残差图像中寻找最佳匹配块, 寻找最佳匹配块时, 通过利 用已编码图像中对应位置块的一次视差矢量, 在二次参考图像中找到对 应块, 将该对应块作为最佳匹配块, 并将所参照的一次视差矢量作为在 二次参考图像中的二次视差矢量, 从而可以减少码流的数据量; 或者在 找到对应块后, 以该块作为搜索中心起始点, 寻找最佳匹配块, 从而进 一步提高编码效率。  In addition, when predicting a residual image generated after the current image to be encoded is subjected to predictive coding, the primary residual image of the current image to be encoded is in units of macroblocks or blocks, and is used as a residual image of the secondary reference image. Finding the best matching block, looking for the best matching block, finding the corresponding block in the secondary reference image by using the first-order disparity vector of the corresponding position block in the encoded image, and using the corresponding block as the best matching block, and The reference one-time disparity vector is used as the quadratic disparity vector in the secondary reference image, so that the data amount of the code stream can be reduced; or after finding the corresponding block, the block is used as the search center starting point to find the best matching block, thereby Further improve coding efficiency.
最后,本发明还可以对一次残差图像变换后的变换系数阵进行预测, 从而为消除残差图像之间相关性的方法, 提供了更多的选择, 使编码更 灵活 , 从而可以最大限度的消除残差图像之间的相关性。  Finally, the present invention can also predict the transform coefficient array after one residual image transformation, thereby providing more options for eliminating the correlation between residual images, and making the coding more flexible, thereby maximizing the Eliminate correlation between residual images.
上述各实施例只是本发明思想的一种展示 , 而非限定本发明的保护 范围。 凡在本发明的精神和原则之内, 所做的任何修改、 等同替换、 改 进等, 均应包含在本发明的保护范围之内。  The above embodiments are merely illustrative of the inventive concept and are not intended to limit the scope of the invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

Claims

权利要求书 Claim
1、 一种图像编码方法, 其特征在于, 该方法包括: An image encoding method, the method comprising:
A、 对当前待编码图像进行一次预测, 得到一次残差图像及一次运 动矢量;  A. Performing a prediction on the current image to be encoded to obtain a residual image and a motion vector;
B、 对一次残差图像进行二次预测, 得到二次残差图像及二次运动 矢量, 并将二次残差图像、 二次运动矢量及一次运动矢量写入压缩码流 中。  B. Perform secondary prediction on the primary residual image to obtain a secondary residual image and a secondary motion vector, and write the secondary residual image, the secondary motion vector, and the primary motion vector into the compressed code stream.
2、 如权利要求 1所述的方法, 其特征在于, 所述步骤 B具体包括: 以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 在作为二 次参考图像的残差图像集合中寻找最佳匹配块, 用该最佳匹配块对当前 宏块或块进行预测, 并得到二次残差块及对应的二次运动矢量, 将二次 残差块、 二次运动矢量及一次运动矢量写入压缩码流中。  2. The method according to claim 1, wherein the step B specifically comprises: in a macroblock or a block, for each macroblock or block in the primary residual image, as a secondary reference image Find the best matching block in the residual image set, use the best matching block to predict the current macroblock or block, and obtain the quadratic residual block and the corresponding secondary motion vector, and the second residual block, The secondary motion vector and the primary motion vector are written into the compressed code stream.
3、 如权利要求 2所述的方法, 其特征在于, 步骤 B中所述在作为 二次参考图像的残差图像集合中寻找最佳匹配块为: 进行视差估计时 , 根据已编码图像中对应位置块的一次运动矢量 , 在二次参考图像中找到 对应块, 将该对应块作为最佳匹配块, 并将所述一次运动矢量作为在二 次参考图像中的二次运动矢量;  The method according to claim 2, wherein the finding the best matching block in the residual image set as the secondary reference image in step B is: when performing the disparity estimation, according to the corresponding in the encoded image a primary motion vector of the position block, finding a corresponding block in the secondary reference image, using the corresponding block as a best matching block, and using the primary motion vector as a secondary motion vector in the secondary reference image;
或者  Or
进行视差估计时, 根据已编码图像中对应位置块的一次运动矢量, 在二次参考图像中找到对应块, 以该对应块作为搜索中心起始点, 寻找 最佳匹配块。  When the disparity estimation is performed, the corresponding block is found in the secondary reference image according to the primary motion vector of the corresponding position block in the encoded image, and the corresponding block is used as the search center starting point to find the best matching block.
4、 如权利要求 1所述的方法, 其特征在于, 步骤 B之前进一步包 括: 以宏块或块为单位, 对一次残差图像中的每个宏块或块进行变换, 得到变换后的一次残差块; 所述步骤 B为: 针对每个变换后的一次残差块, 在作为二次参考图 像的残差图像变换后的图像中寻找最佳匹配块, 用该最佳匹配块对当前 变换后的一次残差块进行预测 , 并得到二次残差块及对应的二次运动矢 量, 将二次残差块、 二次运动矢量及一次运动矢量写入压缩码流中。 The method according to claim 1, wherein the step B further comprises: transforming each macroblock or block in the primary residual image in units of macroblocks or blocks to obtain a transformed one time. Residual block The step B is: searching for a best matching block in the image after the residual image transformed as the secondary reference image for each transformed residual residual block, and using the best matching block for the current transformed one. The residual block performs prediction, and obtains a quadratic residual block and a corresponding secondary motion vector, and writes the secondary residual block, the secondary motion vector, and the primary motion vector into the compressed code stream.
5、如权利要求 2至 4中任意一项所述的方法, 其特征在于, 所述二 次参考图像为: 已编码图像对应一次残差图像的重建图像。  The method according to any one of claims 2 to 4, wherein the secondary reference image is: a reconstructed image of the encoded image corresponding to the primary residual image.
6、如权利要求 1至 4中任意一项所述的方法, 其特征在于, 步骤 B 中写入压缩码流之前, 进一步包括: 对二次残差图像、 二次运动矢量以 及一次运动矢量进行熵编码。  The method according to any one of claims 1 to 4, wherein before the compressing the code stream is written in the step B, the method further comprises: performing the second residual image, the secondary motion vector, and the primary motion vector Entropy coding.
7、 一种图像解码方法, 其特征在于, 该方法包括:  7. An image decoding method, the method comprising:
A、 从压缩码流中解码得到一次运动矢量、 二次运动矢量和二次残 差图像;  A. Decoding from the compressed code stream to obtain a motion vector, a quadratic motion vector, and a quadratic residual image;
B、 根据二次运动矢量, 对二次残差图像进行运动补偿, 得到一次 残差图像, 并根据一次运动矢量, 对一次残差图像进行运动补偿, 得到 重建图像。  B. Perform motion compensation on the second residual image according to the secondary motion vector to obtain a residual image, and perform motion compensation on the primary residual image according to the primary motion vector to obtain a reconstructed image.
8、 如权利要求 7所述的方法, 其特征在于, 所述步骤 B为: 以宏 块或块为单位, 针对二次残差图像中的每个宏块或块, 根据该宏块或块 对应的二次运动矢量,对该二次残差块进行运动补偿,得到一次残差块, 并根据该一次残差块对应的一次运动矢量, 对该一次残差块进行运动补 偿, 得到重建图像块, 将二次残差图像的所有重建图像块合成所述重建 图像。  The method according to claim 7, wherein the step B is: according to the macroblock or the block, for each macroblock or block in the secondary residual image, according to the macroblock or block Corresponding secondary motion vector, performing motion compensation on the second residual block to obtain a residual block, and performing motion compensation on the primary residual block according to the primary motion vector corresponding to the primary residual block to obtain a reconstructed image Block, synthesize all reconstructed image blocks of the secondary residual image into the reconstructed image.
9、 如权利要求 8所述的方法, 其特征在于, 步骤 B所述根据该一 次残差块对应的一次运动矢量, 对该一次残差块进行运动补偿之前, 进 一步包括: 对得到的一次残差块进行反变换, 得到反变换后的一次残差 块。 The method according to claim 8, wherein the step B: before performing motion compensation on the primary residual block according to the primary motion vector corresponding to the primary residual block, further comprising: The difference block is inverse transformed to obtain a first residual block after the inverse transform.
10、 一种编码器, 包括: 一次预测模块和编码模块, 其特征在于, 该编码器还包括: 二次预测模块, 其中, An encoder, comprising: a primary prediction module and an encoding module, wherein the encoder further comprises: a secondary prediction module, wherein
一次预测模块, 用于对当前待编码图像进行一次预测, 得到一次残 差图像和一次运动矢量;  a prediction module, configured to perform a prediction on the current image to be encoded, to obtain a residual image and a motion vector;
二次预测模块, 用于接收来自所述一次预测模块的一次残差图像, 对所接收的一次残差图像进行二次预测 , 得到二次残差图像及二次运动 矢量;  a secondary prediction module, configured to receive a primary residual image from the primary prediction module, perform secondary prediction on the received primary residual image, and obtain a secondary residual image and a secondary motion vector;
编码模块, 用于接收来自所述一次预测模块的一次运动矢量和来自 所述二次预测模块的二次运动矢量和二次残差图像, 并将所接收的一次 运动矢量、 二次运动矢量及二次残差图像写入压缩码流中。  An encoding module, configured to receive a primary motion vector from the primary prediction module and a secondary motion vector and a secondary residual image from the secondary prediction module, and receive the received primary motion vector, secondary motion vector, and The secondary residual image is written into the compressed code stream.
11、 如权利要求 10所述的编码器, 其特征在于, 该编码器还包括: 二次重建模块, 用于接收来自所述二次预测模块的二次残差图像, 并读取二次预测模块中得到的二次运动矢量, 根据该二次运动矢量, 对 所接收的二次残差图像进行运动补偿, 得到一次残差图像, 所述一次残 差图像用于所述二次预测模块进行二次预测时的参考图像;  The encoder according to claim 10, wherein the encoder further comprises: a quadratic reconstruction module, configured to receive a quadratic residual image from the secondary prediction module, and read a secondary prediction a secondary motion vector obtained in the module, performing motion compensation on the received secondary residual image according to the secondary motion vector, to obtain a primary residual image, wherein the primary residual image is used by the secondary prediction module a reference image at the time of secondary prediction;
一次重建模块, 用于接收来自所述二次重建模块的一次残差图像, 并读取一次预测模块中得到的一次运动矢量, 根据该一次运动矢量, 对 所接收的一次残差图像进行运动补偿, 得到重建图像, 所述重建图像用 于所述一次预测模块进行一次预测时的参考图像。  a primary reconstruction module, configured to receive a primary residual image from the secondary reconstruction module, and read a primary motion vector obtained in the prediction module, and perform motion compensation on the received primary residual image according to the primary motion vector And obtaining a reconstructed image, where the reconstructed image is used for a reference image when the primary prediction module performs one prediction.
12、如权利要求 11所述的编码器, 其特征在于, 所述编码器进一步 包括: 变换模块和反变换模块, 其中,  The encoder according to claim 11, wherein the encoder further comprises: a transform module and an inverse transform module, where
变换模块, 用于接收来自二次预测模块的二次残差图像, 对所接收 的二次残差图像进行变换 , 将变换后的二次残差图像输出给编码模块和 反变换模块;  a transform module, configured to receive a secondary residual image from the secondary prediction module, transform the received secondary residual image, and output the transformed secondary residual image to the encoding module and the inverse transform module;
反变换模块, 用于接收来自变换模块的二次残差图像, 对所接收的 二次残差图像进行反变换, 得到反变换后的二次残差图像, 输出给二次 重建模块。 An inverse transform module, configured to receive a secondary residual image from the transform module, for the received The quadratic residual image is inversely transformed to obtain an inversely transformed quadratic residual image, which is output to the quadratic reconstruction module.
13、如权利要求 11所述的编码器, 其特征在于, 所述编码器进一步 包括: 变换模块和反变换模块, 其中,  The encoder according to claim 11, wherein the encoder further comprises: a transform module and an inverse transform module, where
变换模块, 用于接收来自一次预测模块的一次残差图像, 对一次残 差图像进行变换 , 将变换后的一次残差图像输出给二次预测模块;  a transform module, configured to receive a residual residual image from the primary prediction module, transform the primary residual image, and output the transformed primary residual image to the secondary prediction module;
反变换模块, 用于接收来自二次重建模块的一次残差图像, 对所接 收的一次残差图像进行反变换 , 将反变换后的一次残差图像输出给一次 重建模块。  The inverse transform module is configured to receive a primary residual image from the secondary reconstruction module, inversely transform the received primary residual image, and output the inverse transformed primary residual image to a reconstruction module.
14、 一种解码器, 该解码器包括: 解码模块、 一次重建模块, 其特 征在于, 该解码器还包括: 二次重建模块, 其中,  A decoder, the decoder comprising: a decoding module, a primary reconstruction module, wherein the decoder further comprises: a secondary reconstruction module, wherein
解码模块, 用于从压缩码流中解码得到一次运动矢量、 二次运动矢 量及二次残差图像;  a decoding module, configured to decode a motion vector, a secondary motion vector, and a secondary residual image from the compressed code stream;
二次重建模块, 用于接收来自所述解码模块的二次残差图像和二次 运动矢量,根据所接收的二次运动矢量,对二次残差图像进行运动补偿, 得到一次残差图像;  a quadratic reconstruction module, configured to receive a secondary residual image and a secondary motion vector from the decoding module, perform motion compensation on the secondary residual image according to the received secondary motion vector, to obtain a residual image;
一次重建模块, 用于接收来自所述二次重建模块的一次残差图像及 来自解码模块的一次运动矢量, 根据所接收的一次运动矢量, 对一次残 差图像进行运动补偿, 得到重建图像。  And a primary reconstruction module, configured to receive a primary residual image from the secondary reconstruction module and a primary motion vector from the decoding module, and perform motion compensation on the primary residual image according to the received primary motion vector to obtain a reconstructed image.
15、如权利要求 14所述的解码器, 其特征在于, 该解码器进一步包 括: 反变换模块, 用于接收来自解码模块的二次残差图像, 对所接收的 二次残差图像进行反变换, 并将反变换后的二次残差图像输出给二次重 建模块。  The decoder according to claim 14, wherein the decoder further comprises: an inverse transform module, configured to receive a quadratic residual image from the decoding module, and perform inverse on the received quadratic residual image Transform, and output the inverse transformed quadratic residual image to the quadratic reconstruction module.
16、如权利要求 14所述的解码器, 其特征在于, 该解码器进一步包 括: 反变换模块, 用于接收来自二次重建模块的一次残差图像, 并对所 接收的一次残差图像进行反变换, 将反变换后的一次残差图像输出给一 次重建模块。 The decoder according to claim 14, wherein the decoder further comprises: an inverse transform module, configured to receive a primary residual image from the secondary reconstruction module, and The received residual residual image is inversely transformed, and the inverse transformed primary residual image is output to the primary reconstruction module.
17、 一种编解码方法, 其特征在于, 该方法包括:  17. A codec method, the method comprising:
A、 对当前待编码图像进行一次预测, 得到一次残差图像及一次运 动矢量, 并对一次残差图像进行二次预测, 得到二次残差图像及二次运 动矢量,将二次残差图像、二次运动矢量及一次运动矢量写入压缩码流; A. Perform a prediction on the current image to be encoded, obtain a residual image and a motion vector, and perform a second prediction on the first residual image to obtain a quadratic residual image and a secondary motion vector, and obtain a quadratic residual image. , the secondary motion vector and the primary motion vector are written into the compressed code stream;
B、 接收所述压缩码流, 并从压缩码流中解码得到一次运动矢量、 二次运动矢量和二次残差图像; 根据二次运动矢量, 对二次残差图像进 行运动补偿, 得到一次残差图像, 并根据一次运动矢量, 对一次残差图 像进行运动补偿, 得到重建图像。 B. receiving the compressed code stream, and decoding a motion vector, a quadratic motion vector, and a quadratic residual image from the compressed code stream; performing motion compensation on the second residual image according to the secondary motion vector, and obtaining once The residual image is subjected to motion compensation for the primary residual image according to the primary motion vector to obtain a reconstructed image.
18、 一种编解码器, 其特征在于, 该编解码器包括: 编码单元和解 码单元, 其中,  18. A codec, the codec comprising: a coding unit and a decoding unit, where
编码单元, 用于对当前待编码图像进行一次预测, 得到一次残差图 像及一次运动矢量, 并对一次残差图像进行二次预测, 得到二次残差图 像及二次运动矢量, 将二次残差图像、 二次运动矢量及一次运动矢量写 入压缩码流中;  a coding unit, configured to perform a prediction on the current image to be encoded, obtain a residual image and a motion vector, and perform a second prediction on the first residual image to obtain a secondary residual image and a secondary motion vector, which will be quadratic The residual image, the secondary motion vector, and the primary motion vector are written into the compressed code stream;
解码单元, 用于接收所述压缩码流, 并从压缩码流中解码得到一次 运动矢量、 二次运动矢量和二次残差图像; 根据二次运动矢量, 对二次 残差图像进行运动补偿, 得到一次残差图像, 并根据一次运动矢量, 对 一次残差图像进行运动补偿, 得到重建图像。  a decoding unit, configured to receive the compressed code stream, and obtain a motion vector, a quadratic motion vector, and a quadratic residual image from the compressed code stream; perform motion compensation on the second residual image according to the secondary motion vector , obtaining a residual image, and performing motion compensation on the primary residual image according to the primary motion vector to obtain a reconstructed image.
19、如权利要求 18所示的编解码器, 其特征在于, 所述编码单元包 括:  The codec of claim 18, wherein the encoding unit comprises:
一次预测模块, 用于对当前待编码图像进行一次预测, 得到一次残 差图像和一次运动矢量;  a prediction module, configured to perform a prediction on the current image to be encoded, to obtain a residual image and a motion vector;
二次预测模块, 用于接收来自一次预测模块的一次残差图像, 对所 接收的一次残差图像进行二次预测, 得到二次残差图像及二次运动矢 量; a secondary prediction module, configured to receive a residual image from a prediction module, The received residual residual image is subjected to secondary prediction to obtain a secondary residual image and a secondary motion vector;
编码模块, 用于接收来自一次预测模块的一次运动矢量和来自二次 预测模块的二次运动矢量和二次残差图像, 并将所接收的一次运动矢 量、 二次运动矢量及二次残差图像写入压缩码流中。  An encoding module, configured to receive a primary motion vector from a primary prediction module and a secondary motion vector and a secondary residual image from the secondary prediction module, and receive the received primary motion vector, secondary motion vector, and quadratic residual The image is written to the compressed code stream.
20、如权利要求 19所述编解码器,其特征在于,所述解码单元包括: 解码模块, 用于从压缩码流中解码得到一次运动矢量、 二次运动矢 量及二次残差图像;  The codec according to claim 19, wherein the decoding unit comprises: a decoding module, configured to decode, obtain a primary motion vector, a secondary motion vector, and a secondary residual image from the compressed code stream;
二次重建模块, 用于接收来自解码模块的二次残差图像和二次运动 矢量, 根据所接收的二次运动矢量, 对二次残差图像进行运动补偿, 得 到一次残差图像;  a quadratic reconstruction module, configured to receive a secondary residual image and a secondary motion vector from the decoding module, and perform motion compensation on the secondary residual image according to the received secondary motion vector to obtain a residual image;
一次重建模块, 用于接收来自二次重建模块的一次残差图像及来自 解码模块的一次运动矢量, 根据所接收的一次运动矢量, 对一次残差图 像进行运动补偿, 得到重建图像。  The primary reconstruction module is configured to receive a primary residual image from the secondary reconstruction module and a primary motion vector from the decoding module, and perform motion compensation on the primary residual image according to the received primary motion vector to obtain a reconstructed image.
21、 一种图像编码方法, 其特征在于, 该方法包括:  21. An image encoding method, the method comprising:
A、 对第一帧待编码图像进行编码后的当前待编码图像进行一次预 测, 得到一次残差图像及一次运动矢量;  A. Performing a prediction on the current image to be encoded encoded by the image to be encoded in the first frame to obtain a residual image and a motion vector;
B、 以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 进行视差估计时, 根据已编码图像中对应位置块的一次运动矢量, 在二 次参考图像中找到对应块, 将该对应块作为最佳匹配块, 并将所述一次 运动矢量作为在二次参考图像中的二次运动矢量 , 用该最佳匹配块对当 前宏块或块进行预测, 得到二次残差块; 将一次运动矢量和二次残差块 和 /或二次运动矢量写入压缩码流中。  B. In the macroblock or block unit, when performing disparity estimation for each macroblock or block in the primary residual image, find a corresponding in the secondary reference image according to the primary motion vector of the corresponding position block in the encoded image. Blocking, using the corresponding block as a best matching block, and using the primary motion vector as a secondary motion vector in the secondary reference image, and predicting the current macroblock or block by using the best matching block to obtain a second Residual block; Writes a primary motion vector and a secondary residual block and/or a secondary motion vector into the compressed code stream.
22、 如权利要求 21所述的方法, 其特征在于, 步骤 A中所述对当 前待编码图像进行一次预测 , 得到一次残差图像及一次运动矢量包括: 以宏块或块为单位, 针对当前待编码图像中的每一个宏块或块, 进行视 差估计时, 根据已编码图像中对应位置块的一次运动矢量, 在当前宏块 或块的参考图像中找到对应块, 将该对应块作为最佳匹配块, 并将所述 一次运动矢量作为当前宏块或块在参考图像中的一次运动矢量, 用该最 佳匹配块对当前宏块或块进行预测, 得到一次残差块; The method according to claim 21, wherein the step of predicting the current image to be encoded in step A, obtaining a residual image and a motion vector include: In the macroblock or block unit, when performing disparity estimation for each macroblock or block in the current image to be encoded, according to the primary motion vector of the corresponding position block in the encoded image, in the reference image of the current macroblock or block Finding a corresponding block, using the corresponding block as a best matching block, and using the primary motion vector as a primary motion vector of the current macroblock or block in the reference image, and using the best matching block to predict the current macroblock or block , get a residual block;
或者, 进行视差估计时, 根据已编码图像中对应位置块的一次运动 矢量, 在当前宏块或块的参考图像中找到对应块, 以该块作为搜索中心 起始点, 寻找最佳匹配块, 用该最佳匹配块对当前宏块或块进行预测, 并得到一次残差块及对应的一次运动矢量。  Or, when performing the disparity estimation, according to the primary motion vector of the corresponding position block in the encoded image, find the corresponding block in the reference image of the current macroblock or the block, and use the block as the starting point of the search center to find the best matching block, The best matching block predicts the current macroblock or block and obtains a residual block and a corresponding primary motion vector.
23、 一种图像编码方法, 其特征在于, 该方法包括:  23. An image encoding method, the method comprising:
A、 对第一帧待编码图像进行编码后的当前待编码图像进行一次预 测, 得到一次残差图像及一次运动矢量;  A. Performing a prediction on the current image to be encoded encoded by the image to be encoded in the first frame to obtain a residual image and a motion vector;
B、 以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 进行视差估计时, 根据已编码图像中对应位置块的一次运动矢量, 在二 次参考图像中找到对应块, 以该块作为搜索中心起始点, 寻找最佳匹配 块, 用该最佳匹配块对当前宏块或块进行预测, 并得到二次残差块及对 应的二次运动矢量; 将一次运动矢量、 二次残差块和二次运动矢量写入 压缩码流中。  B. In the macroblock or block unit, when performing disparity estimation for each macroblock or block in the primary residual image, find a corresponding in the secondary reference image according to the primary motion vector of the corresponding position block in the encoded image. Block, using the block as a starting point of the search center, searching for the best matching block, using the best matching block to predict the current macroblock or block, and obtaining a quadratic residual block and a corresponding secondary motion vector; Vectors, quadratic residual blocks, and quadratic motion vectors are written into the compressed code stream.
24、 如权利要求 23所述的方法, 其特征在于, 步骤 A中所述对当 前待编码图像进行一次预测 , 得到一次残差图像及一次运动矢量包括: 以宏块或块为单位, 针对当前待编码图像中的每一个宏块或块, 进行视 差估计时, 根据已编码图像中对应位置块的一次运动矢量, 在当前宏块 或块的参考图像中找到对应块, 将该对应块作为最佳匹配块, 并将所述 一次运动矢量作为当前宏块或块在参考图像中的一次运动矢量, 用该最 佳匹配块对当前宏块或块进行预测, 得到一次残差块; 或者, 进行视差估计时, 根据已编码图像中对应位置块的一次运动 矢量, 在当前宏块或块的参考图像中找到对应块, 以该块作为搜索中心 起始点, 寻找最佳匹配块, 用该最佳匹配块对当前宏块或块进行预测, 并得到一次残差块及对应的一次运动矢量。 The method according to claim 23, wherein in step A, the current image to be encoded is predicted once, and the first residual image and the primary motion vector are obtained: in a macroblock or a block, for the current When performing the disparity estimation for each macroblock or block in the image to be encoded, according to the primary motion vector of the corresponding position block in the encoded image, the corresponding block is found in the reference image of the current macroblock or the block, and the corresponding block is regarded as the most Preferably, the first motion vector is used as a primary motion vector of the current macroblock or block in the reference image, and the current macroblock or block is predicted by the best matching block to obtain a residual block; Or, when performing the disparity estimation, according to the primary motion vector of the corresponding position block in the encoded image, find the corresponding block in the reference image of the current macroblock or the block, and use the block as the starting point of the search center to find the best matching block, The best matching block predicts the current macroblock or block and obtains a residual block and a corresponding primary motion vector.
25、 一种图像解码方法, 其特征在于, 该方法包括:  25. An image decoding method, the method comprising:
A、 从压缩码流中解码得到一次运动矢量、 二次运动矢量和二次残 差图像;  A. Decoding from the compressed code stream to obtain a motion vector, a quadratic motion vector, and a quadratic residual image;
B、 以宏块或块为单位, 针对二次残差图像中的每个宏块或块, 根 据该宏块或块对应的二次运动矢量, 或 ^居该宏块或块对应的作为二次 运动矢量的一次运动矢量, 对该二次残差块进行运动补偿, 得到一次残 差块, 并 ^居该一次残差块对应的一次运动矢量, 对该一次残差块进行 运动补偿, 得到重建图像块, 将二次残差图像的所有重建图像块合成重 建图像。  B, in macroblock or block unit, for each macroblock or block in the quadratic residual image, according to the secondary motion vector corresponding to the macroblock or block, or the corresponding macroblock or block corresponding to the second The primary motion vector of the secondary motion vector is motion-compensated for the second residual block, and the residual block is obtained once, and the primary motion vector corresponding to the primary residual block is obtained, and the motion compensation is performed on the primary residual block to obtain motion compensation. The image block is reconstructed, and all reconstructed image blocks of the secondary residual image are combined to reconstruct the image.
26、 一种编码器, 包括: 一次预测模块和编码模块, 其特征在于, 该编码器还包括: 二次预测模块, 其中,  An encoder, comprising: a primary prediction module and an encoding module, wherein the encoder further comprises: a secondary prediction module, wherein
一次预测模块 ,用于对第一帧之后的当前待编码图像进行一次预测 , 得到一次残差图像和一次运动矢量;  a prediction module, configured to perform a prediction on the current image to be encoded after the first frame, to obtain a residual image and a motion vector;
二次预测模块, 用于接收来自一次预测模块的一次残差图像, 对所 接收的一次残差图像以宏块或块为单位, 针对一次残差图像中的每一个 宏块或块, 进行视差估计时, 根据已编码图像中对应位置块的一次运动 矢量, 在二次参考图像中找到对应块, 将该对应块作为最佳匹配块, 并 将所述一次运动矢量作为在二次参考图像中的二次运动矢量, 用该最佳 匹配块对当前宏块或块进行预测, 得到二次残差块;  a secondary prediction module, configured to receive a primary residual image from a primary prediction module, and perform a parallax for each macroblock or block in the primary residual image in units of macroblocks or blocks for the received primary residual image. In the estimation, according to the primary motion vector of the corresponding position block in the encoded image, the corresponding block is found in the secondary reference image, the corresponding block is taken as the best matching block, and the primary motion vector is used as the secondary reference image. a quadratic motion vector, using the best matching block to predict the current macroblock or block to obtain a quadratic residual block;
编码模块, 用于接收来自所述一次预测模块的一次运动矢量和来自 所述二次预测模块的二次残差图像和 /或二次运动矢量,并将所接收的一 次运动矢量和二次残差图像和 /或二次运动矢量写入压缩码流中。 An encoding module, configured to receive a primary motion vector from the primary prediction module and a secondary residual image and/or a secondary motion vector from the secondary prediction module, and receive the received one The secondary motion vector and the secondary residual image and/or the secondary motion vector are written into the compressed code stream.
27、 如权利要求 26所述的编码器, 其特征在于, 该编码器还包括: 二次重建模块, 用于接收来自二次预测模块的二次残差图像, 并读 取二次预测模块中得到的二次运动矢量或作为二次运动矢量的一次预 测模块中得到的一次运动矢量 , 根据所述二次运动矢量或所述作为二次 运动矢量的一次运动矢量, 对所接收的二次残差图像进行运动补偿, 得 到一次残差图像, 用于所述二次预测模块进行二次预测时的参考图像; 一次重建模块, 用于接收来自二次重建模块的一次残差图像, 并读 取一次预测模块中得到的一次运动矢量, 根据该一次运动矢量, 对所接 收的一次残差图像进行运动补偿, 得到重建图像, 用于所述一次预测模 块进行一次预测时的参考图像。  The encoder according to claim 26, wherein the encoder further comprises: a quadratic reconstruction module, configured to receive a quadratic residual image from the secondary prediction module, and read the secondary prediction module The obtained quadratic motion vector or the primary motion vector obtained in the primary prediction module as the secondary motion vector, according to the secondary motion vector or the primary motion vector as the secondary motion vector, the received secondary residual Performing motion compensation on the difference image to obtain a residual image for the reference image when the secondary prediction module performs secondary prediction; a primary reconstruction module, configured to receive a residual residual image from the secondary reconstruction module, and read The primary motion vector obtained in the primary prediction module performs motion compensation on the received primary residual image according to the primary motion vector to obtain a reconstructed image, which is used for the reference image when the primary prediction module performs one prediction.
28、 一种编码器, 包括: 一次预测模块和编码模块, 其特征在于, 该编码器还包括: 二次预测模块, 其中,  An encoder, comprising: a primary prediction module and an encoding module, wherein the encoder further comprises: a secondary prediction module, wherein
一次预测模块 ,用于对第一帧之后的当前待编码图像进行一次预测 , 得到一次残差图像和一次运动矢量;  a prediction module, configured to perform a prediction on the current image to be encoded after the first frame, to obtain a residual image and a motion vector;
二次预测模块, 用于接收来自一次预测模块的一次残差图像, 对所 接收的一次残差图像以宏块或块为单位, 针对一次残差图像中的每一个 宏块或块, 进行视差估计时, 根据已编码图像中对应位置块的一次运动 矢量, 在二次参考图像中找到对应块, 以该块作为搜索中心起始点, 寻 找最佳匹配块, 用该最佳匹配块对当前宏块或块进行预测, 得到二次残 差块及对应的二次运动矢量;  a secondary prediction module, configured to receive a primary residual image from a primary prediction module, and perform a parallax for each macroblock or block in the primary residual image in units of macroblocks or blocks for the received primary residual image. In the estimation, according to the primary motion vector of the corresponding position block in the encoded image, the corresponding block is found in the secondary reference image, and the block is used as the search center starting point to find the best matching block, and the current matching macro is used to match the current macro. The block or block performs prediction to obtain a quadratic residual block and a corresponding secondary motion vector;
编码模块, 用于接收来自所述一次预测模块的一次运动矢量和来自 所述二次预测模块的二次残差图像和二次运动矢量, 并将所接收的一次 运动矢量、 二次残差图像和二次运动矢量写入压缩码流中。  An encoding module, configured to receive a primary motion vector from the primary prediction module and a secondary residual image and a secondary motion vector from the secondary prediction module, and receive the received primary motion vector and the secondary residual image And the secondary motion vector is written into the compressed code stream.
29、 如权利要求 28所述的编码器, 其特征在于, 该编码器还包括: 二次重建模块, 用于接收来自二次预测模块的二次残差图像, 并读 取二次预测模块中得到的二次运动矢量, 根据所述二次运动矢量, 对所 接收的二次残差图像进行运动补偿, 得到一次残差图像, 所述一次残差 图像用于所述二次预测模块进行二次预测时的参考图像; The encoder according to claim 28, wherein the encoder further comprises: a quadratic reconstruction module, configured to receive a quadratic residual image from the secondary prediction module, and read a secondary motion vector obtained in the secondary prediction module, and according to the secondary motion vector, the received secondary residual Performing motion compensation on the difference image to obtain a primary residual image, where the primary residual image is used for a reference image when the secondary prediction module performs secondary prediction;
一次重建模块, 用于接收来自二次重建模块的一次残差图像, 并读 取一次预测模块中得到的一次运动矢量, 根据该一次运动矢量, 对所接 收的一次残差图像进行运动补偿, 得到重建图像, 所述重建图像用于所 述一次预测模块进行一次预测时的参考图像。  a reconstruction module, configured to receive a residual image from the secondary reconstruction module, and read a motion vector obtained in the prediction module once, and perform motion compensation on the received primary residual image according to the primary motion vector, Reconstructing an image, the reconstructed image being used for a reference image when the primary prediction module performs one prediction.
30、 一种解码器, 该解码器包括: 解码模块、 一次重建模块, 其特 征在于, 该解码器还包括: 二次重建模块, 其中,  30. A decoder, the decoder comprising: a decoding module, a primary reconstruction module, wherein the decoder further comprises: a secondary reconstruction module, wherein
解码模块, 用于从压缩码流中解码得到一次运动矢量、 二次运动矢 量及二次残差图像;  a decoding module, configured to decode a motion vector, a secondary motion vector, and a secondary residual image from the compressed code stream;
二次重建模块, 用于接收来自所述解码模块的二次残差图像和二次 运动矢量或作为二次运动矢量的一次运动矢量 , 根据所接收的二次运动 矢量或作为二次运动矢量的一次运动矢量, 对二次残差图像进行运动补 偿, 得到一次残差图像;  a quadratic reconstruction module, configured to receive a secondary residual image and a secondary motion vector from the decoding module or a primary motion vector as a secondary motion vector, according to the received secondary motion vector or as a secondary motion vector One motion vector, motion compensation of the second residual image to obtain a residual image;
一次重建模块, 用于接收来自所述二次重建模块的一次残差图像及 来自所述解码模块的一次运动矢量, 根据所接收的一次运动矢量, 对一 次残差图像进行运动补偿, 得到重建图像。  a primary reconstruction module, configured to receive a primary residual image from the secondary reconstruction module and a primary motion vector from the decoding module, and perform motion compensation on the primary residual image according to the received primary motion vector to obtain a reconstructed image. .
31、 一种在多视图像间寻找最佳匹配块的方法, 其特征在于, 该方 法包括:  31. A method of finding a best matching block between multi-view images, the method comprising:
对当前图像的宏块或块进行一次和 /或二次视差估计时,根据已编码 图像中对应位置块的一次运动矢量, 在当前宏块或块的参考图像中找到 对应块, 将该对应块作为当前宏块或块的一次和 /或二次最佳匹配块。  When performing primary and/or secondary disparity estimation on the macroblock or block of the current image, finding a corresponding block in the reference image of the current macroblock or block according to the primary motion vector of the corresponding position block in the encoded image, and the corresponding block As the primary and/or second best matching block of the current macroblock or block.
32、 一种在多视图像间寻找最佳匹配块的方法, 其特征在于, 该方 法包括: 32. A method for finding a best matching block between multi-view images, characterized in that The law includes:
对当前图像的宏块或块进行一次和 /或二次视差估计时,根据已编码 图像中对应位置块的一次运动矢量, 在当前宏块或块的参考图像中找到 对应块, 以该对应块作为搜索中心起始点, 寻找当前宏块或块的一次和 /或二次最佳匹配块。  When performing one-time and/or quadratic disparity estimation on the macroblock or block of the current image, finding a corresponding block in the reference image of the current macroblock or block according to the primary motion vector of the corresponding position block in the encoded image, with the corresponding block As the starting point of the search center, find the primary and/or secondary best matching block of the current macroblock or block.
33、 一种在多视图像间寻找最佳匹配块的装置, 其特征在于, 该装 置包括:  33. An apparatus for finding a best matching block between multi-view images, the apparatus comprising:
一次预测模块, 用于对当前待编码图像以宏块或块为单位, 针对当 前待编码图像中的每一个宏块或块, 进行视差估计时, 根据已编码图像 中对应位置块的一次运动矢量, 在参考图像中找到对应块, 将该对应块 作为最佳匹配块。  a prediction module, configured to: in a macroblock or a block for the current image to be encoded, for each macroblock or block in the current image to be encoded, when performing disparity estimation, according to a motion vector of a corresponding position block in the encoded image Find the corresponding block in the reference image and use the corresponding block as the best matching block.
34、 一种在多视图像间寻找最佳匹配块的装置, 其特征在于, 该装 置包括:  34. An apparatus for finding a best matching block between multi-view images, the apparatus comprising:
一次预测模块, 用于对当前待编码图像以宏块或块为单位, 针对当 前待编码图像中的每一个宏块或块, 进行视差估计时, 根据已编码图像 中对应位置块的一次运动矢量, 在参考图像中找到对应块, 以该块作为 搜索中心起始点, 寻找最佳匹配块。  a prediction module, configured to: in a macroblock or a block for the current image to be encoded, for each macroblock or block in the current image to be encoded, when performing disparity estimation, according to a motion vector of a corresponding position block in the encoded image Find the corresponding block in the reference image and use the block as the starting point of the search center to find the best matching block.
35、 一种在多视图像间寻找最佳匹配块的装置, 其特征在于, 该装 置包括:  35. An apparatus for finding a best matching block between multi-view images, the apparatus comprising:
二次预测模块, 用于对所接收的一次残差图像以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 进行视差估计时, 根据已编码 图像中对应位置块的一次运动矢量, 在二次参考图像中找到对应块, 将 该对应块作为最佳匹配块。  a secondary prediction module, configured to perform, in a macroblock or a block, the received residual residual image, for each macroblock or block in the primary residual image, according to the corresponding position block in the encoded image The primary motion vector finds the corresponding block in the secondary reference image, and uses the corresponding block as the best matching block.
36、 一种在多视图像间寻找最佳匹配块的装置, 其特征在于, 该装 置包括: 二次预测模块, 用于对所接收的一次残差图像以宏块或块为单位, 针对一次残差图像中的每一个宏块或块, 进行视差估计时, 根据已编码 图像中对应位置块的一次运动矢量, 在二次参考图像中找到对应块, 以 该块作为搜索中心起始点, 寻找最佳匹配块。 36. An apparatus for finding a best matching block between multi-view images, the apparatus comprising: a secondary prediction module, configured to perform, in a macroblock or a block, the received residual residual image, for each macroblock or block in the primary residual image, according to the corresponding position block in the encoded image The primary motion vector finds the corresponding block in the secondary reference image, and uses the block as the starting point of the search center to find the best matching block.
PCT/CN2007/070608 2006-09-01 2007-08-31 A method for encoding/decoding, the corresponding apparatus for encoding/decoding and a method or apparatus for searching optimum matching block WO2008025300A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2007800003205A CN101518089B (en) 2006-09-01 2007-08-31 Coding/decoding methods, coders/decoders, and method and device for finding optimally matched modules

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CNA2006101279737A CN101137065A (en) 2006-09-01 2006-09-01 Image coding method, decoding method, encoder, decoder, coding/decoding method and encoder/decoder
CN200610127973.7 2006-09-01

Publications (1)

Publication Number Publication Date
WO2008025300A1 true WO2008025300A1 (en) 2008-03-06

Family

ID=39135512

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2007/070608 WO2008025300A1 (en) 2006-09-01 2007-08-31 A method for encoding/decoding, the corresponding apparatus for encoding/decoding and a method or apparatus for searching optimum matching block

Country Status (2)

Country Link
CN (2) CN101137065A (en)
WO (1) WO2008025300A1 (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159875B (en) * 2007-10-15 2011-10-05 浙江大学 Double forecast video coding/decoding method and apparatus
CN101262607B (en) * 2008-04-11 2011-06-15 浙江大学 Two-folded prediction video coding and decoding method and device
JP2010258739A (en) * 2009-04-24 2010-11-11 Sony Corp Image processing apparatus, method and program
CN102726043B (en) * 2009-11-06 2016-03-02 弗劳恩霍夫应用研究促进协会 hybrid video coding
CN102098519B (en) * 2009-12-09 2013-04-17 浙江大学 Video encoding method and decoding method as well as encoding and decoding device
CN102055974B (en) * 2010-10-14 2013-04-17 华为技术有限公司 Data compressing and uncompressing method, data compressing and uncompressing device and data compressing and uncompressing system
US8867852B2 (en) 2012-01-19 2014-10-21 Sharp Kabushiki Kaisha Decoding a picture based on a reference picture set on an electronic device
US20150181232A1 (en) * 2012-07-18 2015-06-25 Sony Corporation Image processing device and method
KR102563706B1 (en) * 2016-09-30 2023-08-03 후아웨이 테크놀러지 컴퍼니 리미티드 Video encoding method, decoding method and terminal
WO2018170793A1 (en) * 2017-03-22 2018-09-27 华为技术有限公司 Method and apparatus for decoding video data, and method and apparatus for encoding video data
CN110309143B (en) * 2018-03-21 2021-10-22 华为技术有限公司 Data similarity determination method and device and processing equipment
WO2020046086A1 (en) * 2018-09-02 2020-03-05 엘지전자 주식회사 Method and apparatus for processing image signal
CN115514973B (en) * 2018-09-05 2024-05-31 Lg电子株式会社 Apparatus for decoding/encoding video signal and transmitting data
CN109495745B (en) * 2018-11-20 2021-03-30 北京工业大学 Lossless compression decoding method based on inverse quantization/inverse transformation
WO2021056205A1 (en) * 2019-09-24 2021-04-01 北京大学 Video processing method and device, and storage medium
CN117939163A (en) * 2024-03-22 2024-04-26 广东工业大学 Compressed sensing video reconstruction method and system based on double-flow feature extraction

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1136540A (en) * 1995-05-24 1996-11-27 唐山市迁西燕兴陶瓷厂 Sepiolite clay glazed tile
CN1137211A (en) * 1995-03-15 1996-12-04 大宇电子株式会社 Improved motion compensation method for use in image encoding system
CN1194544A (en) * 1997-01-31 1998-09-30 日本胜利株式会社 Coding and decoding device with movement compensation
CN1207634A (en) * 1997-07-31 1999-02-10 日本胜利株式会社 Digital video signal inter-block interpolative predictive encoding/decoding apparatus and method providing high efficiency of encoding
CN1237856A (en) * 1998-01-22 1999-12-08 日本胜利株式会社 Motion image coding string changer and its method
CN1505900A (en) * 2001-12-25 2004-06-16 松下电器产业株式会社 Moving picture compression/coding apparatus and motion vector detection method
CN1550109A (en) * 2001-08-28 2004-11-24 ��ʽ����Ntt����Ħ Moving picture encoding/transmission system, moving picture encoding/transmission method, and encoding apparatus, decoding apparatus, encoding method decoding method and program usable for the same

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1194544C (en) * 2003-04-25 2005-03-23 北京工业大学 Video encoding method based on prediction time and space domain conerent movement vectors

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1137211A (en) * 1995-03-15 1996-12-04 大宇电子株式会社 Improved motion compensation method for use in image encoding system
CN1136540A (en) * 1995-05-24 1996-11-27 唐山市迁西燕兴陶瓷厂 Sepiolite clay glazed tile
CN1194544A (en) * 1997-01-31 1998-09-30 日本胜利株式会社 Coding and decoding device with movement compensation
CN1207634A (en) * 1997-07-31 1999-02-10 日本胜利株式会社 Digital video signal inter-block interpolative predictive encoding/decoding apparatus and method providing high efficiency of encoding
CN1237856A (en) * 1998-01-22 1999-12-08 日本胜利株式会社 Motion image coding string changer and its method
CN1550109A (en) * 2001-08-28 2004-11-24 ��ʽ����Ntt����Ħ Moving picture encoding/transmission system, moving picture encoding/transmission method, and encoding apparatus, decoding apparatus, encoding method decoding method and program usable for the same
CN1505900A (en) * 2001-12-25 2004-06-16 松下电器产业株式会社 Moving picture compression/coding apparatus and motion vector detection method

Also Published As

Publication number Publication date
CN101137065A (en) 2008-03-05
CN101518089A (en) 2009-08-26
CN101518089B (en) 2010-12-01

Similar Documents

Publication Publication Date Title
WO2008025300A1 (en) A method for encoding/decoding, the corresponding apparatus for encoding/decoding and a method or apparatus for searching optimum matching block
RU2696252C1 (en) Output of reference mode values and encoding and decoding of information representing prediction modes
KR100597402B1 (en) Method for scalable video coding and decoding, and apparatus for the same
US8619854B2 (en) Scalable video encoding and decoding method using switching pictures and apparatus thereof
JP4991699B2 (en) Scalable encoding and decoding methods for video signals
US7310371B2 (en) Method and/or apparatus for reducing the complexity of H.264 B-frame encoding using selective reconstruction
US7961788B2 (en) Method and apparatus for video encoding and decoding, and recording medium having recorded thereon a program for implementing the method
JP3861698B2 (en) Image information encoding apparatus and method, image information decoding apparatus and method, and program
US8165411B2 (en) Method of and apparatus for encoding/decoding data
JP4685849B2 (en) Scalable video coding and decoding method and apparatus
KR20110071231A (en) Encoding method, decoding method and apparatus thereof
WO2008088140A1 (en) Method and apparatus for encoding and decoding based on intra prediction
KR20070011788A (en) Apparatus and method for adaptive variable block-size transform and the appartus and the method for video encoding/decoding thereof
JP4799547B2 (en) Encoding method and encoding apparatus for picture sequence using predictive picture and non-predictive picture each including multi-macroblock
TW200952499A (en) Apparatus and method for computationally efficient intra prediction in a video coder
US20090016443A1 (en) Inter mode determination method for video encoding
WO2012098845A1 (en) Image encoding method, image encoding device, image decoding method, and image decoding device
US20070133689A1 (en) Low-cost motion estimation apparatus and method thereof
JP4289126B2 (en) Data processing apparatus and method and encoding apparatus
US20110090968A1 (en) Low-Cost Video Encoder
JP4349109B2 (en) Image data processing apparatus, method thereof, and encoding apparatus
KR20240072202A (en) Video coding and decoding
Cheung et al. Distributed source coding application to low-delay free viewpoint switching in multiview video compression
WO2010151783A1 (en) Low complexity b to p-slice transcoder
JP4642033B2 (en) A method for obtaining a reference block of an image by an encoding method in which the number of reference frames is fixed.

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 200780000320.5

Country of ref document: CN

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

Ref document number: 07801019

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 07801019

Country of ref document: EP

Kind code of ref document: A1