WO2018120290A1 - Prediction method and device based on template matching - Google Patents

Prediction method and device based on template matching Download PDF

Info

Publication number
WO2018120290A1
WO2018120290A1 PCT/CN2017/070735 CN2017070735W WO2018120290A1 WO 2018120290 A1 WO2018120290 A1 WO 2018120290A1 CN 2017070735 W CN2017070735 W CN 2017070735W WO 2018120290 A1 WO2018120290 A1 WO 2018120290A1
Authority
WO
WIPO (PCT)
Prior art keywords
template
value
distortion value
matching
motion information
Prior art date
Application number
PCT/CN2017/070735
Other languages
French (fr)
Chinese (zh)
Inventor
林永兵
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2017/076043 priority Critical patent/WO2018120420A1/en
Priority to CN201780049111.3A priority patent/CN109565601B/en
Publication of WO2018120290A1 publication Critical patent/WO2018120290A1/en
Priority to US16/452,082 priority patent/US20190320205A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/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/103Selection of coding mode or of prediction mode
    • H04N19/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction

Definitions

  • the beneficial effect is that when the codec device acquires the predicted value of the unit to be processed, when searching and predicting the to-be-processed unit by using the template matching method, the problem of mismatch between search and prediction can be avoided, thereby improving prediction accuracy and prediction.
  • the effect is to further improve the quality of the codec.
  • the third template distortion value is less than or equal to the first template distortion value, further comprising: using the third reference image as the first reference image; using the third motion information as the first The motion information; the third template distortion value is used as the first template distortion value; and the third matching template is used as the first matching template.
  • the method includes: according to the first motion information, in the first reference image, Obtaining a predicted value of the unit to be processed.
  • determining the according to the first motion information and the second motion information includes: when the second template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, the weighting is performed.
  • the predicted value is used as a predicted value of the unit to be processed.
  • the matching search of the updated current template is performed in the second reference image of the to-be-processed unit, and the second motion information of the to-be-processed unit is obtained.
  • the method further includes: updating the second template distortion value according to the weighting coefficient, where the updated second template distortion value is (1- ⁇ 0) times And the second template distortion value; correspondingly, when the second template distortion value is smaller than the first template distortion value, determining the to-before according to the first motion information and the second motion information
  • the weighted prediction value of the processing unit includes: when the updated second template distortion value is smaller than the first When the template distortion value is obtained, the weighted prediction value of the to-be-processed unit is determined according to the first motion information and the second motion information.
  • the searching unit determines the third in the image according to a position vector difference between the third matching template and the current template, and an image in which the third matching template is located.
  • the searching unit determines the third in the image according to a position vector difference between the third matching template and the current template, and an image in which the third matching template is located.
  • the updating unit is further configured to: update the second template distortion value according to the weighting coefficient, and the updated second template distortion value is (1 ⁇ 0) times the second template distortion value; correspondingly, the determining unit is configured to: when the updated second template distortion value is smaller than the first template distortion value, according to the first motion information and The second motion information determines a weighted prediction value of the to-be-processed unit.
  • T1 2T0-P1
  • Step 34 When the second template distortion value is smaller than the first template distortion value, determine a weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information.
  • the third motion information is determined according to the position vector difference of the third matching template and the current template, and the image of the third matching template, when the third template distortion value is smaller than Or equal to the first template distortion value, using the third reference image as the first reference image; using the third motion information as the first motion information; using the third template distortion value as The first template distortion value; the third matching template is used as the first matching template.
  • the matching search of the template is performed by using the updated current template T1 to obtain the backward motion information MV1 of the current block.
  • the implementation process of the prediction value of the current block is obtained by the bidirectional search and the bidirectional prediction of the template matching, and the matching search of the current module may be performed in the backward reference image ref1 first, and the current block is obtained.
  • the current template is updated to the motion information MV1, the backward prediction value P1 of the current template, and the backward prediction value P1, so that the bidirectional matching search process of the template is performed in the forward reference image, thereby obtaining the prediction value of the current block.
  • Other processes are similar and will not be described here.
  • T1 2T0-P1
  • T1 represents a pixel value of the updated current template
  • T0 represents a pixel value of the current template
  • P1′ represents a backward predicted value of the current template
  • T1 represents a pixel value of the updated current template
  • T0 represents a pixel value of the current template
  • P1′ represents a backward predicted value of the current template
  • the determining unit 803 is configured to determine, according to the first motion information and the second motion information, a weighted prediction value of the to-be-processed unit when the second template distortion value is smaller than the first template distortion value.
  • the searching unit 801 performs a matching search of the current template in the first reference image of the to-be-processed unit, and obtains the first motion information of the to-be-processed unit and the first matching template, and is further used to:

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Analysis (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

Provided are a prediction method and device based on template matching. The prediction method comprises: performing match-searching with respect to a current template in a first reference image of a to-be-processed unit, to obtain first motion information, a first matching template, and a first template distortion value of the to-be-processed unit; updating a pixel value of the current template according to a pixel value of the first matching template; performing match-searching with respect to the updated current template in a second reference image of the to-be-processed unit, to obtain second motion information, a second matching template, and a second template distortion value of the to-be-processed unit; and when the second template distortion value is less than the first template distortion value, determining a weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information, such that prediction accuracy is improved, further improving a coding and decoding effect.

Description

一种基于模板匹配的预测方法及装置Prediction method and device based on template matching 技术领域Technical field
本申请涉及视频图像技术领域,尤其涉及一种基于模板匹配的预测方法及装置。The present application relates to the field of video image technologies, and in particular, to a prediction method and apparatus based on template matching.
背景技术Background technique
视频编码压缩技术最主要性能指标是压缩率,实现以最少的带宽传输最高质量的视频内容,压缩率的提高是通过去除视频内容本身的冗余信息来实现的。视频编码压缩标准的主流技术框架,都采用基于图像块的混合视频编码方案,视频编码的主要技术包括:预测,变换和量化,熵编码,通过预测技术去除空间和时间相关性,通过变换和量化技术去除频域相关性,通过熵编码技术进一步去除码字间的信息冗余。The most important performance metric of video coding compression technology is the compression ratio, which enables the transmission of the highest quality video content with the least bandwidth. The improvement of the compression ratio is achieved by removing the redundant information of the video content itself. The mainstream technical framework of video coding compression standard adopts image block-based hybrid video coding scheme. The main technologies of video coding include: prediction, transform and quantization, entropy coding, spatial and temporal correlation through prediction technology, and transformation and quantization. The technology removes the frequency domain correlation and further removes information redundancy between codewords by entropy coding techniques.
随着视频编码压缩率的不断提高,编码码流中的运动信息的占比越来越大。基于模板匹配(template matching,TM)的运动信息预测技术,可实现在解码端导出运动信息,运动信息无需传送,大大节约编码比特,提高压缩率。基于TM的运动信息预测技术成为下一代视频编码标准的候选技术之一。As the compression ratio of video coding continues to increase, the proportion of motion information in the code stream is increasing. Based on the template matching (TM) motion information prediction technology, motion information can be derived at the decoding end, and motion information does not need to be transmitted, which greatly saves coding bits and improves compression ratio. TM-based motion information prediction technology has become one of the candidate technologies for next-generation video coding standards.
一般的,模板匹配技术中使用“L”型模板。如图1所示,当前块(curBlock)的左边相邻块和上边相邻块组成了一个“L”型模板(Template),利用这个模板,在参考图像Ref0中进行匹配搜索,即可获得该模板的运动信息。由于模板和当前块的空间位置紧邻,他们的运动信息应当保持一致,因此,模板的运动信息可作为当前块的运动信息。In general, "L" type templates are used in template matching techniques. As shown in FIG. 1, the left adjacent block and the upper adjacent block of the current block (curBlock) constitute an "L" type template, and the template is used to perform a matching search in the reference image Ref0 to obtain the The motion information of the template. Since the spatial position of the template and the current block are in close proximity, their motion information should be consistent, so the motion information of the template can be used as the motion information of the current block.
上述“L”型模板,包括当前块的左边相邻块和上边相邻块,是经过解码重构生成的,在编码端和解码端都是可获得的。因此,基于模板匹配的方法可在解码端执行以获得当前块的运动信息,而无需传送这些运动信息。The above "L" type template, including the left neighboring block and the upper neighboring block of the current block, is generated by decoding and reconstruction, and is available at both the encoding end and the decoding end. Therefore, the method based on template matching can be performed at the decoding end to obtain motion information of the current block without transmitting the motion information.
但是,上述模板匹配搜索时,仅利用前向或后向参考图像,是一种单向搜索,而后续预测时,却采用前向和后向参考图像的双向预测,使模板匹配搜索与运动预测不匹配。影响预测精度和预测效果。However, when the template matching search is performed, only the forward or backward reference image is used, which is a one-way search, and the subsequent prediction uses the bidirectional prediction of the forward and backward reference images to make the template matching search and motion prediction. Mismatch. Affects prediction accuracy and prediction results.
发明内容Summary of the invention
本申请实施例提供一种基于模板匹配的预测方法及装置,以解决模板匹配搜索与运动预测不匹配的问题,提高预测精度。The embodiment of the present application provides a prediction method and device based on template matching, so as to solve the problem that the template matching search does not match the motion prediction, and improve the prediction accuracy.
第一方面,提供一种基于模板匹配的预测方法,包括:在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,所述当前模板包括所述待处理单元的邻域中预设位置和数量的多个重构像素,所述第一模板失真值代表所述第一匹配模板和所述当前模板的差异;根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新;在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,所述第二模板失真值代表所述第二匹配模板和所述更新后的当前模板的差异;当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所 述第二运动信息,确定所述待处理单元的加权预测值。In a first aspect, a prediction method based on template matching is provided, including: performing a matching search of a current template in a first reference image of a to-be-processed unit, obtaining first motion information, a first matching template, and a first template distortion value, where the current template includes a plurality of reconstructed pixels of a preset position and number in a neighborhood of the to-be-processed unit, the first template distortion value representing the first matching template and the current a difference of the template; updating the pixel value of the current template according to the pixel value of the first matching template; performing a matching search of the updated current template in the second reference image of the to-be-processed unit, obtaining a second motion information, a second matching template, and a second template distortion value of the to-be-processed unit, where the second template distortion value represents a difference between the second matching template and the updated current template; When the second template distortion value is smaller than the first template distortion value, according to the first motion information and the Determining, by the second motion information, a weighted prediction value of the to-be-processed unit.
该有益效果在于,编解码装置在获取待处理单元的预测值时,利用模板匹配方法对所述待处理单元进行搜索和预测时,能够避免搜索和预测不匹配的问题,从而提高预测精度和预测效果,进一步提升编解码质量。The beneficial effect is that when the codec device acquires the predicted value of the unit to be processed, when searching and predicting the to-be-processed unit by using the template matching method, the problem of mismatch between search and prediction can be avoided, thereby improving prediction accuracy and prediction. The effect is to further improve the quality of the codec.
结合第一方面,一种可能的设计中,所述根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新,包括采用如下方式对所述当前的像素值进行更新:T1=(T0-ω0×P1)/(1-ω0),其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表所述第一匹配模板的像素值,ω0代表所述第一匹配模板对应的加权系数,ω0为小于1的正数。With reference to the first aspect, in a possible design, the updating, according to the pixel value of the first matching template, the pixel value of the current template, including updating the current pixel value in the following manner: T1 = (T0 - ω0 × P1) / (1 - ω0), where T1 represents the pixel value of the updated current template, T0 represents the pixel value of the current template, and P1 represents the pixel of the first matching template. The value, ω0 represents a weighting coefficient corresponding to the first matching template, and ω0 is a positive number less than one.
该有益效果在于,与现有技术相比,增加了当前模板的更新操作,在模板更新后执行的模板匹配操作相当于双向匹配搜索,能够较简单的实现模板匹配的双向搜索过程,进一步结合双向预测,提升预测精度和预测效果。The beneficial effect is that compared with the prior art, the update operation of the current template is added, and the template matching operation performed after the template update is equivalent to the two-way matching search, and the two-way search process of template matching can be implemented relatively simply, and the two-way search process is further combined. Forecast, improve forecasting accuracy and forecasting results.
结合第一方面,一种可能的设计中,所述ω0为0.5。In conjunction with the first aspect, in one possible design, the ω0 is 0.5.
该有益效果在于,设置第一匹配模板对应的加权系数为0.5得到的更新后的模板,在模板更新后执行的模板匹配操作相当于标准的双向匹配搜索过程,结合双向预测使预测精度和预测效果更好。The beneficial effect is that the updated template obtained by the first matching template with the weighting coefficient of 0.5 is set, and the template matching operation performed after the template updating is equivalent to the standard two-way matching search process, and the prediction precision and the prediction effect are combined with the bidirectional prediction. better.
结合第一方面,一种可能的设计中,所述在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,包括:在所述第一参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第一候选重构像素组合,计算所述多个第一候选重构像素组合和所述当前模板的多个第一像素差异值;根据最小的所述第一像素差异值,确定所述第一模板失真值、所述第一匹配模板;根据所述第一匹配模板和所述当前模板的位置矢量差,和所述第一匹配模板所在的图像,确定所述第一运动信息,所述第一匹配模板包括所述第一模板失真值对应的第一候选重构像素组合。With reference to the first aspect, in a possible design, the matching search of the current template is performed in the first reference image of the to-be-processed unit, and the first motion information, the first matching template, and the first The template distortion value includes: traversing a plurality of first candidate reconstructed pixel combinations having the same size and shape in the reconstructed pixel of the preset range of the first reference image, and calculating the plurality of a first candidate reconstructed pixel combination and a plurality of first pixel difference values of the current template; determining the first template distortion value, the first matching template according to the smallest first pixel difference value; Determining, by the first matching template, a position vector difference of the current template, and an image of the first matching template, determining the first motion information, where the first matching template includes the first template distortion value The first candidate reconstructs the pixel combination.
结合第一方面,一种可能的设计中,所述在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,包括:在所述第二参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第二候选重构像素组合,计算所述多个第二候选重构像素组合和所述更新后的当前模板的多个第二像素差异值;根据最小的所述第二像素差异值,确定所述第二模板失真值、所述第二匹配模板;根据所述第二匹配模板和所述更新后的当前模板的位置矢量差,和所述第二匹配模板所在的图像,确定所述第二运动信息,所述第二匹配模板包括所述第二模板失真值对应的第二候选重构像素组合。With reference to the first aspect, in a possible design, the matching search of the updated current template is performed in the second reference image of the to-be-processed unit, and the second motion information of the to-be-processed unit is obtained, The second matching template and the second template distortion value, including: traversing a plurality of second candidate reconstructed pixels having the same size and shape as the current template in the reconstructed pixels of the preset range of the second reference image Combining, calculating a plurality of second candidate pixel combinations and a plurality of second pixel difference values of the updated current template; determining the second template distortion value according to the smallest second pixel difference value And the second matching template; determining the second motion information according to the position vector difference between the second matching template and the updated current template, and the image of the second matching template, The second matching template includes a second candidate reconstructed pixel combination corresponding to the second template distortion value.
结合第一方面,一种可能的设计中,所述根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,包括:根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的第一向预测值;根据所述第二运动信息,在所述第二参考图像中,获得所述待处理单元的第二向预测值;对所述第一向预测值和所述第二向预测值进行加权计算,获得所述待处理单元的加权预测值。With reference to the first aspect, in a possible design, the determining the weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information, includes: according to the first motion information, Obtaining, in the first reference image, a first prediction value of the to-be-processed unit; and obtaining, in the second reference image, a second-direction prediction of the to-be-processed unit according to the second motion information And performing weighting calculation on the first predicted value and the second predicted value to obtain a weighted predicted value of the to-be-processed unit.
该有益效果在于,将所述待处理单元的加权预测值直接作为所述待处理单元的预测值,此时,模板匹配搜索过程实际上相当于双向搜索,在本质上同时利用了第一参考图像和第二参考图像,实现方式简单,同时能够提升预测精度和预测效果。 The beneficial effect is that the weighted prediction value of the to-be-processed unit is directly used as the predicted value of the to-be-processed unit. At this time, the template matching search process is actually equivalent to the two-way search, and the first reference image is utilized in essence at the same time. And the second reference image, the implementation is simple, and at the same time, the prediction accuracy and the prediction effect can be improved.
结合第一方面,一种可能的设计中,在所述待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息和第一匹配模板之后,还包括:在第三参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第三候选重构像素组合,计算所述多个第三候选重构像素组合和所述当前模板的多个第三像素差异值;根据最小的所述第三像素差异值,确定所述第三模板失真值、所述第三匹配模板;根据所述第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息,所述第三匹配模板包括所述第三模板失真值对应的第三候选重构像素组合。With reference to the first aspect, in a possible design, a matching search of the current template is performed in the first reference image of the to-be-processed unit, and after obtaining the first motion information of the to-be-processed unit and the first matching template, The method includes: traversing, in a reconstructed pixel of a preset range of the third reference image, traversing a plurality of third candidate reconstructed pixel combinations having the same size and shape as the current template, and calculating the plurality of third candidate reconstructed pixels Combining a plurality of third pixel difference values of the current template; determining the third template distortion value, the third matching template according to the smallest third pixel difference value; according to the third matching template and The third vector information is determined by the position vector difference of the current template, and the image of the third matching template, where the third matching template includes the third candidate reconstructed pixel corresponding to the third template distortion value. combination.
结合第一方面,一种可能的设计中,在所述根据第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息之后,当所述第三模板失真值小于或等于所述第一模板失真值时,还包括:将所述第三参考图像作为所述第一参考图像;将所述第三运动信息作为所述第一运动信息;将所述第三模板失真值作为所述第一模板失真值;将所述第三匹配模板作为所述第一匹配模板。With reference to the first aspect, in a possible design, after determining the third motion information according to the position vector difference of the third matching template and the current template, and the image of the third matching template, When the third template distortion value is less than or equal to the first template distortion value, further comprising: using the third reference image as the first reference image; using the third motion information as the first The motion information; the third template distortion value is used as the first template distortion value; and the third matching template is used as the first matching template.
结合第一方面,一种可能的设计中,当所述第二模板失真值不小于所述第一模板失真值时,包括:根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。With reference to the first aspect, in a possible design, when the second template distortion value is not less than the first template distortion value, the method includes: according to the first motion information, in the first reference image, Obtaining a predicted value of the unit to be processed.
该有益效果在于,能够在单向搜索单向预测的方式和双向搜索双向预测的方式中进行自适应选择,此时,在实现复杂度较低的情形下提高预测精度和预测效果。The beneficial effect is that the adaptive selection can be performed in the one-way search one-way prediction mode and the two-way search two-way prediction mode. At this time, the prediction accuracy and the prediction effect are improved in the case where the implementation complexity is low.
结合第一方面,一种可能的设计中,所述当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,包括:当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。With reference to the first aspect, in a possible design, when the second template distortion value is smaller than the first template distortion value, determining the according to the first motion information and the second motion information The weighted prediction value of the to-be-processed unit includes: when the second template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, the weighting is performed The predicted value is used as a predicted value of the unit to be processed.
结合第一方面,一种可能的设计中,当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。With reference to the first aspect, in a possible design, when the first template distortion value, the second template distortion value, and the third template distortion value are the first template distortion value is the smallest, according to the Determining, in the first reference image, a predicted value of the to-be-processed unit; or, when the first template distortion value, the second template distortion value, and the third template distortion In the value, when the third template distortion value is the smallest, the predicted value of the to-be-processed unit is obtained in the third reference image according to the third motion information.
该有益效果在于,能够在两个不同的单向搜索单向预测的方式、以及双向搜索双向预测的方式中进行自适应选择,此时,虽然实现复杂度较高,但是有较好的自适应选择性,从而提高预测的效果和精度。The beneficial effect is that adaptive selection can be performed in two different one-way search unidirectional prediction modes and two-way search bidirectional prediction mode. At this time, although the implementation complexity is high, there is better adaptation. Selectivity to improve the predictive effect and accuracy.
结合第一方面,一种可能的设计中,当所述第一参考图像来自于所述待处理单元的前向参考图像列表时,所述第三参考图像来自于所述待处理单元的后向参考图像列表;或者,当所述第一参考图像来自于所述待处理单元的后向参考图像列表时,所述第三参考图像来自于所述待处理单元的前向参考图像列表。In conjunction with the first aspect, in a possible design, when the first reference image is from a forward reference image list of the to-be-processed unit, the third reference image is from a backward direction of the to-be-processed unit a reference image list; or, when the first reference image is from a backward reference image list of the to-be-processed unit, the third reference image is from a forward reference image list of the to-be-processed unit.
结合第一方面,一种可能的设计中,在所述在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值之后,还包括:根据所述加权系数对所述第二模板失真值进行更新,所述更新后的第二模板失真值为(1-ω0)倍的所述第二模板失真值;对应的,所述当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,包括:当所述更新后的第二模板失真值小于所述第一 模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。With reference to the first aspect, in a possible design, the matching search of the updated current template is performed in the second reference image of the to-be-processed unit, and the second motion information of the to-be-processed unit is obtained. After the second matching template and the second template distortion value, the method further includes: updating the second template distortion value according to the weighting coefficient, where the updated second template distortion value is (1-ω0) times And the second template distortion value; correspondingly, when the second template distortion value is smaller than the first template distortion value, determining the to-before according to the first motion information and the second motion information The weighted prediction value of the processing unit includes: when the updated second template distortion value is smaller than the first When the template distortion value is obtained, the weighted prediction value of the to-be-processed unit is determined according to the first motion information and the second motion information.
该有益效果在于,根据模板更新时的加权系数对第二模板失真值进行更新,使失真值的比较结果更准确。The beneficial effect is that the second template distortion value is updated according to the weighting coefficient at the time of template update, so that the comparison result of the distortion value is more accurate.
结合第一方面,一种可能的设计中,当所述更新后的第二模板失真值不小于所述第一模板失真值时,所述方法还包括:根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。With reference to the first aspect, in a possible design, when the updated second template distortion value is not less than the first template distortion value, the method further includes: according to the first motion information, In the first reference image, the predicted value of the to-be-processed unit is obtained.
结合第一方面,一种可能的设计中,当所述更新后的第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,包括:当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述更新后的第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。With reference to the first aspect, in a possible design, when the updated second template distortion value is smaller than the first template distortion value, determining, according to the first motion information and the second motion information, The weighted prediction value of the processing unit includes: the updated second template distortion value in the first template distortion value, the updated second template distortion value, and the third template distortion value At the very least, the weighted prediction value is taken as the predicted value of the unit to be processed.
结合第一方面,一种可能的设计中,还包括:当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。With reference to the first aspect, in a possible design, the method further includes: when the first template distortion value, the updated second template distortion value, and the third template distortion value, the first template distortion When the value is minimum, obtaining a predicted value of the to-be-processed unit in the first reference image according to the first motion information; or, when the first template distortion value, the updated second template In the distortion value and the third template distortion value, when the third template distortion value is the smallest, the predicted value of the to-be-processed unit is obtained in the third reference image according to the third motion information.
第二方面,提供一种基于模板匹配的预测装置,包括:搜索单元,用于在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,所述当前模板包括所述待处理单元的邻域中预设位置和数量的多个重构像素,所述第一模板失真值代表所述第一匹配模板和所述当前模板的差异;更新单元,用于根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新;所述搜索单元,还用于在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,所述第二模板失真值代表所述第二匹配模板和所述更新后的当前模板的差异;确定单元,用于当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。In a second aspect, a template matching-based prediction apparatus is provided, including: a search unit, configured to perform a matching search of a current template in a first reference image of a to-be-processed unit, to obtain first motion information of the to-be-processed unit, a first matching template and a first template distortion value, the current template including a plurality of reconstructed pixels of a preset position and number in a neighborhood of the to-be-processed unit, the first template distortion value representing the first matching a difference between the template and the current template; an update unit, configured to update a pixel value of the current template according to a pixel value of the first matching template; the searching unit is further configured to be used in the to-be-processed unit Performing a matching search of the updated current template in the second reference image, obtaining second motion information, a second matching template, and a second template distortion value of the to-be-processed unit, where the second template distortion value represents the a difference between the second matching template and the updated current template; a determining unit, configured to: when the second template distortion value is smaller than the first template distortion value, according to the First motion information and the second motion information is determined to be the weighted prediction value processing unit.
结合第二方面,一种可能的设计中,所述更新单元在根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新时,包括采用如下方式对所述当前的像素值进行更新:T1=(T0-ω0×P1)/(1-ω0),其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表所述第一匹配模板的像素值,ω0代表所述第一匹配模板对应的加权系数,ω0为小于1的正数。With reference to the second aspect, in a possible design, the updating unit, when updating the pixel value of the current template according to the pixel value of the first matching template, includes using the following manner to the current pixel value. Update: T1=(T0-ω0×P1)/(1-ω0), where T1 represents the pixel value of the updated current template, T0 represents the pixel value of the current template, and P1 represents the first Matching the pixel value of the template, ω0 represents the weighting coefficient corresponding to the first matching template, and ω0 is a positive number less than 1.
结合第二方面,一种可能的设计中,所述ω0为0.5。In conjunction with the second aspect, in one possible design, the ω0 is 0.5.
结合第二方面,一种可能的设计中,所述搜索单元在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值时,具体用于:在所述第一参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第一候选重构像素组合,计算所述多个第一候选重构像素组合和所述当前模板的多个第一像素差异值;根据最小的所述第一像素差异值,确定所述第一模板失真值、所述第一匹配模板;根据所述第一匹配模板和所述当前模板的位置矢量差, 和所述第一匹配模板所在的图像,确定所述第一运动信息,所述第一匹配模板包括所述第一模板失真值对应的第一候选重构像素组合。With reference to the second aspect, in a possible design, the searching unit performs a matching search of the current template in the first reference image of the to-be-processed unit, and obtains the first motion information, the first matching template, and the to-be-processed unit. The first template distortion value is specifically used to: traverse the plurality of first candidate reconstructed pixel combinations having the same size and shape in the reconstructed pixel of the preset range of the first reference image, Calculating a plurality of first candidate reconstructed pixel combinations and a plurality of first pixel difference values of the current template; determining the first template distortion value, the first according to the smallest first pixel difference value Matching a template; according to a position vector difference between the first matching template and the current template, And determining, by the first matching template, the first motion template, where the first matching template includes a first candidate reconstructed pixel combination corresponding to the first template distortion value.
结合第二方面,一种可能的设计中,所述搜索单元在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值时,具体用于:在所述第二参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第二候选重构像素组合,计算所述多个第二候选重构像素组合和所述更新后的当前模板的多个第二像素差异值;根据最小的所述第二像素差异值,确定所述第二模板失真值、所述第二匹配模板;根据所述第二匹配模板和所述更新后的当前模板的位置矢量差,和所述第二匹配模板所在的图像,确定所述第二运动信息,所述第二匹配模板包括所述第二模板失真值对应的第二候选重构像素组合。With reference to the second aspect, in a possible design, the searching unit performs a matching search of the updated current template in a second reference image of the to-be-processed unit to obtain a second motion of the to-be-processed unit. The information, the second matching template, and the second template distortion value are specifically used to: traverse the plurality of the same size and shape of the current template in the reconstructed pixels of the preset range of the second reference image a second candidate reconstructed pixel combination, calculating a plurality of second candidate reconstructed pixel combinations and a plurality of second pixel difference values of the updated current template; determining, according to the smallest second pixel difference value a second template distortion value, the second matching template; determining the second motion according to a position vector difference between the second matching template and the updated current template, and an image of the second matching template Information, the second matching template includes a second candidate reconstructed pixel combination corresponding to the second template distortion value.
结合第二方面,一种可能的设计中,所述确定单元在根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值时,具体用于:根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的第一向预测值;根据所述第二运动信息,在所述第二参考图像中,获得所述待处理单元的第二向预测值;对所述第一向预测值和所述第二向预测值进行加权计算,获得所述待处理单元的加权预测值。With reference to the second aspect, in a possible design, the determining unit, when determining the weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information, is specifically used to: Determining a first motion information, in the first reference image, obtaining a first prediction value of the to-be-processed unit; and obtaining, in the second reference image, the to-be-processed according to the second motion information a second direction prediction value of the unit; performing weighting calculation on the first direction prediction value and the second direction prediction value to obtain a weighted prediction value of the to-be-processed unit.
结合第二方面,一种可能的设计中,所述搜索单元在所述待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息和第一匹配模板之后,还用于:在第三参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第三候选重构像素组合,计算所述多个第三候选重构像素组合和所述当前模板的多个第三像素差异值;根据最小的所述第三像素差异值,确定所述第三模板失真值、所述第三匹配模板;根据所述第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息,所述第三匹配模板包括所述第三模板失真值对应的第三候选重构像素组合。With reference to the second aspect, in a possible design, the search unit performs a matching search of the current template in the first reference image of the to-be-processed unit, and obtains the first motion information and the first match of the to-be-processed unit. After the template is further configured to: traverse the plurality of third candidate reconstructed pixel combinations having the same size and shape as the current template in the reconstructed pixels of the preset range of the third reference image, and calculate the plurality of a third candidate reconstructed pixel combination and a plurality of third pixel difference values of the current template; determining the third template distortion value and the third matching template according to the smallest third pixel difference value; And determining, by the third matching template, a position vector difference of the current template, and the image of the third matching template, determining the third motion information, where the third matching template includes the third template distortion value corresponding to the third Three candidate reconstructed pixel combinations.
结合第二方面,一种可能的设计中,所述搜索单元在所述根据第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息之后,当所述第三模板失真值小于或等于所述第一模板失真值时,还用于:将所述第三参考图像作为所述第一参考图像;将所述第三运动信息作为所述第一运动信息;将所述第三模板失真值作为所述第一模板失真值;将所述第三匹配模板作为所述第一匹配模板。With reference to the second aspect, in a possible design, the searching unit determines the third in the image according to a position vector difference between the third matching template and the current template, and an image in which the third matching template is located. After the motion information, when the third template distortion value is less than or equal to the first template distortion value, further used to: use the third reference image as the first reference image; and the third motion information As the first motion information; using the third template distortion value as the first template distortion value; and using the third matching template as the first matching template.
结合第二方面,一种可能的设计中,所述确定单元在所述第二模板失真值不小于所述第一模板失真值时,具体用于:根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。With reference to the second aspect, in a possible design, when the second template distortion value is not less than the first template distortion value, the determining unit is specifically configured to: according to the first motion information, in the In the first reference image, a predicted value of the unit to be processed is obtained.
结合第二方面,一种可能的设计中,所述确定单元在当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值时,具体用于:当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。With reference to the second aspect, in a possible design, the determining unit, when the second template distortion value is smaller than the first template distortion value, according to the first motion information and the second motion information, When determining the weighted prediction value of the to-be-processed unit, specifically, when the first template distortion value, the second template distortion value, and the third template distortion value, the second template distortion value is the most The weighted predicted value is used as the predicted value of the unit to be processed.
结合第二方面,一种可能的设计中,所述确定单元具体用于:当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。 With reference to the second aspect, in a possible design, the determining unit is specifically configured to: when the first template distortion value, the second template distortion value, and the third template distortion value, the first When the template distortion value is the smallest, the predicted value of the to-be-processed unit is obtained in the first reference image according to the first motion information; or, when the first template distortion value and the second template are distorted And a value of the third template distortion value, when the third template distortion value is the smallest, according to the third motion information, obtaining a predicted value of the to-be-processed unit in the third reference image.
结合第二方面,一种可能的设计中,当所述第一参考图像来自于所述待处理单元的前向参考图像列表时,所述第三参考图像来自于所述待处理单元的后向参考图像列表;或者,当所述第一参考图像来自于所述待处理单元的后向参考图像列表时,所述第三参考图像来自于所述待处理单元的前向参考图像列表。With reference to the second aspect, in a possible design, when the first reference image is from a forward reference image list of the to-be-processed unit, the third reference image is from a backward direction of the to-be-processed unit a reference image list; or, when the first reference image is from a backward reference image list of the to-be-processed unit, the third reference image is from a forward reference image list of the to-be-processed unit.
结合第二方面,一种可能的设计中,所述更新单元还用于:根据所述加权系数对所述第二模板失真值进行更新,所述更新后的第二模板失真值为(1-ω0)倍的所述第二模板失真值;对应的,所述确定单元用于当所述更新后的第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。With reference to the second aspect, in a possible design, the updating unit is further configured to: update the second template distortion value according to the weighting coefficient, and the updated second template distortion value is (1 Ω0) times the second template distortion value; correspondingly, the determining unit is configured to: when the updated second template distortion value is smaller than the first template distortion value, according to the first motion information and The second motion information determines a weighted prediction value of the to-be-processed unit.
结合第二方面,一种可能的设计中,当所述更新后的第二模板失真值不小于所述第一模板失真值时,所述确定单元还用于:根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。With reference to the second aspect, in a possible design, when the updated second template distortion value is not less than the first template distortion value, the determining unit is further configured to: according to the first motion information, In the first reference image, a predicted value of the unit to be processed is obtained.
结合第二方面,一种可能的设计中,当所述更新后的第二模板失真值小于所述第一模板失真值时,所述确定单元具体用于:当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述更新后的第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。With reference to the second aspect, in a possible design, when the updated second template distortion value is smaller than the first template distortion value, the determining unit is specifically configured to: when the first template distortion value, In the updated second template distortion value and the third template distortion value, when the updated second template distortion value is the smallest, the weighted prediction value is used as the predicted value of the to-be-processed unit.
结合第二方面,一种可能的设计中,还包括:当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。With reference to the second aspect, in a possible design, the method further includes: when the first template distortion value, the updated second template distortion value, and the third template distortion value, the first template distortion When the value is minimum, obtaining a predicted value of the to-be-processed unit in the first reference image according to the first motion information; or, when the first template distortion value, the updated second template In the distortion value and the third template distortion value, when the third template distortion value is the smallest, the predicted value of the to-be-processed unit is obtained in the third reference image according to the third motion information.
第三方面,提供一种基于模板匹配的预测设备,该设备包括处理器、存储器,其中,所述存储器中存有计算机可读程序,所述处理器通过运行所述存储器中的程序,实现第一方面涉及的基于模板匹配的预测方法。In a third aspect, a prediction device based on template matching is provided, the device includes a processor and a memory, wherein the memory stores a computer readable program, and the processor implements a program by running a program in the memory A prediction method based on template matching involved on the one hand.
第四方面,提供一种计算机存储介质,用于储存为上述第一方面所述的计算机软件指令,其包含用于执行上述方面所设计的程序。In a fourth aspect, a computer storage medium is provided for storing the computer software instructions of the first aspect described above, comprising a program designed to perform the above aspects.
应理解,本申请实施例的第二至四方面与本申请实施例的第一方面的技术方案一致,各方面及对应的可实施的设计方式所取得的有益效果相似,不再赘述。It should be understood that the second to fourth aspects of the embodiments of the present application are consistent with the technical solutions of the first aspect of the embodiments of the present application, and the beneficial effects obtained by the aspects and the corresponding implementable design manners are similar, and are not described again.
附图说明DRAWINGS
图1为模板匹配技术中“L”型模板的示意图;1 is a schematic diagram of an "L" type template in a template matching technique;
图2为模板匹配实现过程示意图;2 is a schematic diagram of a template matching implementation process;
图3为本申请实施例中基于模板匹配的预测方法流程图;3 is a flowchart of a prediction method based on template matching in an embodiment of the present application;
图4A和图4B为本申请实施例中一种获取当前块的预测值的流程图;4A and FIG. 4B are flowcharts of obtaining a predicted value of a current block according to an embodiment of the present application;
图5、图6为视频编解码装置或电子设备的示意性框图;5 and FIG. 6 are schematic block diagrams of a video codec device or an electronic device;
图7为视频编解码系统的示意性框图;7 is a schematic block diagram of a video codec system;
图8为本申请实施例中基于模板匹配的预测装置结构图;8 is a structural diagram of a prediction device based on template matching in an embodiment of the present application;
图9为本申请实施例中基于模板匹配的预测设备结构图;FIG. 9 is a structural diagram of a prediction device based on template matching according to an embodiment of the present application;
图10为本申请实施例中另一种基于模板匹配的预测方法流程图。 FIG. 10 is a flowchart of another method for predicting a template matching according to an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described in the following with reference to the accompanying drawings in the embodiments.
如图2所示,在联合探索模型(Joint exploration model,JEM)中,现有的模板匹配实现方法步骤如下所示:As shown in Figure 2, in the Joint Exploration Model (JEM), the existing template matching implementation method steps are as follows:
1.在前向参考图像ref0中,进行模板匹配搜索,得到前向运动信息MV0。1. In the forward reference image ref0, a template matching search is performed to obtain forward motion information MV0.
2.在后向参考图像ref1中,进行模板匹配搜索,得到后向运动信息MV1。2. In the backward reference image ref1, a template matching search is performed to obtain backward motion information MV1.
3.利用MV0和MV1,对当前块进行双向运动预测,获取预测值。3. Using MV0 and MV1, perform bidirectional motion prediction on the current block and obtain predicted values.
4.根据预测值,进行图像块的编码或解码。4. Encoding or decoding of the image block based on the predicted value.
由此可知,模板匹配搜索时,仅利用前向或后向参考图像,是一种单向搜索,而后续预测时,却采用前向和后向参考图像的双向预测,使模板匹配搜索与运动预测不匹配。影响预测精度和预测效果It can be seen that when the template matching search, only the forward or backward reference image is used, which is a one-way search, and the subsequent prediction uses the bidirectional prediction of the forward and backward reference images to make the template match the search and the motion. The forecast does not match. Affect prediction accuracy and prediction
本申请实施例提供一种基于模板匹配的预测方法及装置,以解决模板匹配搜索与运动预测不匹配的问题,提高预测精度。其中,方法和装置是基于同一申请构思的,由于方法及装置解决问题的原理相似,因此装置与方法的实施可以相互参见,重复之处不再赘述。The embodiment of the present application provides a prediction method and device based on template matching, so as to solve the problem that the template matching search does not match the motion prediction, and improve the prediction accuracy. The method and the device are based on the same application concept. Since the principles of the method and the device for solving the problem are similar, the implementation of the device and the method can be referred to each other, and the repeated description is not repeated.
参阅图3所示,本申请实施例提供一种基于模板匹配的预测方法,具体过程如下所示:As shown in FIG. 3, the embodiment of the present application provides a prediction method based on template matching, and the specific process is as follows:
步骤31:在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,所述当前模板包括所述待处理单元的邻域中预设位置和数量的多个重构像素,所述第一模板失真值代表所述第一匹配模板和所述当前模板的差异。Step 31: Perform a matching search of the current template in the first reference image of the to-be-processed unit, and obtain first motion information, a first matching template, and a first template distortion value of the to-be-processed unit, where the current template includes the A plurality of reconstructed pixels of a preset position and number are preset in a neighborhood of the unit to be processed, and the first template distortion value represents a difference between the first matching template and the current template.
其中,本申请中的待处理单元指的是当前块;可选的,当前模板可以是“L”型模板,包括当前块的左边相邻块和上边相邻块,当前模板可以紧邻当前块,也可以与当前块之间有一定距离,本申请中不作一。The to-be-processed unit in the present application refers to the current block; optionally, the current template may be an "L"-type template, including the left neighboring block and the upper neighboring block of the current block, and the current template may be adjacent to the current block. There may also be a certain distance from the current block, which is not made in this application.
具体的,在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,通过以下过程实现:Specifically, performing a matching search of the current template in the first reference image of the to-be-processed unit, obtaining the first motion information, the first matching template, and the first template distortion value of the to-be-processed unit, by using the following process:
S310:在所述第一参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第一候选重构像素组合,计算所述多个第一候选重构像素组合和所述当前模板的多个第一像素差异值。S310: traverse the plurality of first candidate reconstructed pixel combinations of the same size and shape in the reconstructed pixels of the preset range of the first reference image, and calculate the plurality of first candidate weights Forming a pixel combination and a plurality of first pixel difference values of the current template.
S311:根据最小的所述第一像素差异值,确定所述第一模板失真值、所述第一匹配模板.。S311: Determine, according to the smallest first pixel difference value, the first template distortion value, the first matching template.
这里,将最小的第一像素差异值确定为第一模板失真值,将最小的第一像素差异值对应的预测块确定为第一匹配模板。Here, the smallest first pixel difference value is determined as the first template distortion value, and the predicted block corresponding to the smallest first pixel difference value is determined as the first matching template.
S312:根据所述第一匹配模板和所述当前模板的位置矢量差,和所述第一匹配模板所在的图像,确定所述第一运动信息,所述第一匹配模板包括所述第一模板失真值对应的第一候选重构像素组合。S312: Determine the first motion information according to a position vector difference between the first matching template and the current template, and an image where the first matching template is located, where the first matching template includes the first template. The first candidate reconstructed pixel combination corresponding to the distortion value.
需要说明的是,本申请中的当前模板的匹配搜索过程,指的是寻找与当前模板最匹配的模板,其匹配程度用失真值大小来衡量;当前模板指向匹配模板的运动信息即为当前模 板的第一运动信息。因此,在匹配搜索完成后,可获得与当前模板最匹配的第一匹配模板,当前模板与第一匹配模板之间的失真值大小即第一模板失真值,当前模板的运动信息即第一运动信息,他们是一一对应的。It should be noted that the matching search process of the current template in the present application refers to finding a template that best matches the current template, and the matching degree is measured by the distortion value; the current template points to the motion information of the matching template is the current mode. The first motion information of the board. Therefore, after the matching search is completed, the first matching template that best matches the current template is obtained, and the distortion value between the current template and the first matching template is the first template distortion value, and the motion information of the current template is the first motion. Information, they are one-to-one correspondence.
步骤32:根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新。Step 32: Update pixel values of the current template according to pixel values of the first matching template.
具体的,根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新时,可以通过以下公式实现:Specifically, when the pixel value of the current template is updated according to the pixel value of the first matching template, the following formula may be implemented:
T1=(T0-ω0×P1)/(1-ω0)T1=(T0-ω0×P1)/(1-ω0)
其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表所述第一匹配模板的像素值,ω0代表所述第一匹配模板对应的加权系数,ω0为小于1的正数。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, P1 represents a pixel value of the first matching template, and ω0 represents a weighting coefficient corresponding to the first matching template, Ω0 is a positive number less than one.
一种可能的实施方式中,上述ω0设置为0.5,此时,根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新时,可以通过以下公式实现:In a possible implementation, the above ω0 is set to 0.5. In this case, when the pixel value of the current template is updated according to the pixel value of the first matching template, the following formula may be implemented:
T1=2T0-P1T1=2T0-P1
其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表所述第一匹配模板的像素值。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, and P1 represents a pixel value of the first matching template.
应理解,ω0的取值范围为0到1,且ω0不为1。It should be understood that ω0 has a value ranging from 0 to 1, and ω0 is not 1.
步骤33:在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,所述第二模板失真值代表所述第二匹配模板和所述更新后的当前模板的差异。Step 33: Perform a matching search of the updated current template in the second reference image of the to-be-processed unit, and obtain second motion information, a second matching template, and a second template distortion value of the to-be-processed unit, The second template distortion value represents a difference between the second matching template and the updated current template.
值得一提的是,上述第一参考图像和第二参考图像可能来自同一参考图像列表,也可能来自不同参考图像列表,第一参考图像和第二参考图像可以相同,也可以不同,本申请中不作限制。It is worth mentioning that the first reference image and the second reference image may be from the same reference image list, or may be from different reference image lists, and the first reference image and the second reference image may be the same or different, in the present application. No restrictions.
可选的,当所述第一参考图像来自于所述待处理单元的前向参考图像列表时,所述第二参考图像来自于所述待处理单元的后向参考图像列表;或者,当所述第一参考图像来自于所述待处理单元的后向参考图像列表时,所述第二参考图像来自于所述待处理单元的前向参考图像列表。Optionally, when the first reference image is from a forward reference image list of the to-be-processed unit, the second reference image is from a backward reference image list of the to-be-processed unit; or When the first reference image is from the backward reference image list of the to-be-processed unit, the second reference image is from the forward reference image list of the to-be-processed unit.
具体的,在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,通过以下过程实现:Specifically, the matching search of the updated current template is performed in the second reference image of the to-be-processed unit, and the second motion information, the second matching template, and the second template distortion value of the to-be-processed unit are obtained. Through the following process:
S320:在所述第二参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第二候选重构像素组合,计算所述多个第二候选重构像素组合和所述更新后的当前模板的多个第二像素差异值。S320: traverse the plurality of second candidate reconstructed pixel combinations of the same size and shape in the reconstructed pixels of the preset range of the second reference image, and calculate the plurality of second candidate weights Forming a pixel combination and a plurality of second pixel difference values of the updated current template.
S321:根据最小的所述第二像素差异值,确定所述第二模板失真值、所述第二匹配模板。S321: Determine the second template distortion value and the second matching template according to the smallest second pixel difference value.
这里,将最小的第二像素差异值确定为第二模板失真值,将最小的第二像素差异值对应的预测块确定为第二匹配模板。Here, the smallest second pixel difference value is determined as the second template distortion value, and the predicted block corresponding to the smallest second pixel difference value is determined as the second matching template.
S322:根据所述第二匹配模板和所述更新后的当前模板的位置矢量差,和所述第二匹配模板所在的图像,确定所述第二运动信息,所述第二匹配模板包括所述第二模板失真值对应的第二候选重构像素组合。S322: Determine the second motion information according to a position vector difference between the second matching template and the updated current template, and an image of the second matching template, where the second matching template includes the A second candidate reconstructed pixel combination corresponding to the second template distortion value.
在一些可行的实施方式中,步骤33还包括: In some possible implementations, step 33 further includes:
S323:根据前述加权系数ω0对所述第二模板失真值进行更新,具体的,比如:更新后的第二模板失真值为(1-ω0)倍的更新前的第二模板失真值。S323: Update the second template distortion value according to the foregoing weighting coefficient ω0. Specifically, for example, the updated second template distortion value is (1-ω0) times the second template distortion value before the update.
当ω0为0.5时,更新后的第二模板失真值为更新前的第二模板失真值的0.5倍。When ω0 is 0.5, the updated second template distortion value is 0.5 times the second template distortion value before the update.
应理解,由于使用和模板更新时相同的加权系数ω0,对第二模板失真值的更新和进行模板匹配时,对模板进行更新有关。It should be understood that since the same weighting coefficient ω0 is used as when the template is updated, the update of the second template distortion value and the template matching are performed, and the template is updated.
还应理解,当S323被执行时,后续步骤中的第二模板失真值均指更新后的第二模板失真值,不再赘述。It should also be understood that when S323 is executed, the second template distortion value in the subsequent step refers to the updated second template distortion value, and will not be described again.
由于对第二模板失真值根据模板更新时的加权系数进行了更新,表征了使用第二模板时的预测误差,使后续的失真值比较的结果更符合真实的失真情况,从而选择更合适的预测值,提高了编码效率。Since the second template distortion value is updated according to the weighting coefficient when the template is updated, the prediction error when using the second template is characterized, so that the result of the subsequent distortion value comparison is more in line with the real distortion condition, thereby selecting a more appropriate prediction. Values improve coding efficiency.
步骤34:当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。Step 34: When the second template distortion value is smaller than the first template distortion value, determine a weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information.
具体的,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,通过以下过程实现:Specifically, determining, according to the first motion information and the second motion information, a weighted prediction value of the to-be-processed unit, by using the following process:
S340:根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的第一向预测值。S340: Obtain, according to the first motion information, a first predicted value of the to-be-processed unit in the first reference image.
S341:根据所述第二运动信息,在所述第二参考图像中,获得所述待处理单元的第二向预测值。S341: Obtain, according to the second motion information, a second prediction value of the to-be-processed unit in the second reference image.
S342:对所述第一向预测值和所述第二向预测值进行加权计算,获得所述待处理单元的加权预测值。S342: Perform weighting calculation on the first predicted value and the second predicted value to obtain a weighted predicted value of the to-be-processed unit.
需要说明的是,对所述第一向预测值和所述第二向预测值进行加权计算时,可以对所述第一向预测值和所述第二向预测值进行加权取平均,得到所述待处理单元的加权预测值。可选的,对所述第一向预测值和所述第二向预测值求平均值,得到所述待处理单元的加权预测值。It should be noted that, when the first prediction value and the second prediction value are weighted, the first prediction value and the second prediction value may be weighted and averaged to obtain a The weighted prediction value of the processing unit is mentioned. Optionally, the first predicted value and the second predicted value are averaged to obtain a weighted predicted value of the to-be-processed unit.
一种可能的实施方式中,将所述待处理单元的加权预测值直接作为所述待处理单元的预测值,由于上述步骤32中,实现了当前模板的更新操作,此时在后续步骤33中的模板匹配搜索过程实际上相当于双向搜索,在本质上同时利用了第一参考图像和第二参考图像,实现方式简单,同时能够提升预测精度和预测效果。In a possible implementation, the weighted prediction value of the to-be-processed unit is directly used as the predicted value of the to-be-processed unit. In the above step 32, the update operation of the current template is implemented, and in the subsequent step 33, The template matching search process is actually equivalent to the two-way search, and the first reference image and the second reference image are utilized in essence at the same time, and the implementation method is simple, and the prediction precision and the prediction effect can be improved at the same time.
进一步的,一种可能的实施方式中,在所述待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息和第一匹配模板之后,还需要执行如下过程:Further, in a possible implementation manner, performing a matching search of the current template in the first reference image of the to-be-processed unit, and obtaining the first motion information of the to-be-processed unit and the first matching template, Perform the following process:
在第三参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第三候选重构像素组合,计算所述多个第三候选重构像素组合和所述当前模板的多个第三像素差异值;Composing, in a reconstructed pixel of a preset range of the third reference image, a plurality of third candidate reconstructed pixel combinations having the same size and shape as the current template, calculating the plurality of third candidate reconstructed pixel combinations and a plurality of third pixel difference values of the current template;
根据最小的所述第三像素差异值,确定所述第三模板失真值、所述第三匹配模板;这里,将最小的第三像素差异值确定为第三模板失真值,将最小的第三像素差异值对应的预测块确定为第三匹配模板。Determining, according to the smallest third pixel difference value, the third template distortion value, the third matching template; here, determining the smallest third pixel difference value as the third template distortion value, and the smallest third The prediction block corresponding to the pixel difference value is determined as the third matching template.
根据所述第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息,所述第三匹配模板包括所述第三模板失真值对应的第三候选重构像素组合。 Determining, according to the position vector difference of the third matching template and the current template, and the image of the third matching template, the third motion template, where the third matching template includes the third template distortion value Corresponding third candidate reconstructed pixel combination.
需要说明的是,当所述第一参考图像来自于所述待处理单元的前向参考图像列表时,所述第三参考图像来自于所述待处理单元的后向参考图像列表;或者,当所述第一参考图像来自于所述待处理单元的后向参考图像列表时,所述第三参考图像来自于所述待处理单元的前向参考图像列表。It should be noted that, when the first reference image is from a forward reference image list of the to-be-processed unit, the third reference image is from a backward reference image list of the to-be-processed unit; or, when When the first reference image is from the backward reference image list of the to-be-processed unit, the third reference image is from the forward reference image list of the to-be-processed unit.
进一步的,在所述根据第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息之后,当所述第三模板失真值小于或等于所述第一模板失真值时,将所述第三参考图像作为所述第一参考图像;将所述第三运动信息作为所述第一运动信息;将所述第三模板失真值作为所述第一模板失真值;将所述第三匹配模板作为所述第一匹配模板。Further, after the third motion information is determined according to the position vector difference of the third matching template and the current template, and the image of the third matching template, when the third template distortion value is smaller than Or equal to the first template distortion value, using the third reference image as the first reference image; using the third motion information as the first motion information; using the third template distortion value as The first template distortion value; the third matching template is used as the first matching template.
值得一提的是,上述第一参考图像和第三参考图像可能来自同一参考图像列表,也可能来自不同参考图像列表,第一参考图像和第三参考图像可以相同,也可以不同,本申请中不作限制。It is worth mentioning that the first reference image and the third reference image may be from the same reference image list, or may be from different reference image lists, and the first reference image and the third reference image may be the same or different, in the present application. No restrictions.
进一步的,一种可能的实施方式中,在所述根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值之前,还包括:Further, in a possible implementation, before determining the weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information, the method further includes:
比较所述第一模板失真值和所述第二模板失真值;Comparing the first template distortion value and the second template distortion value;
根据所述比较结果,确定所述待处理单元的预测值。Based on the comparison result, a predicted value of the unit to be processed is determined.
具体的,所述根据所述比较结果,确定所述待处理单元的预测值,包括以下两种情形:Specifically, the determining, according to the comparison result, the predicted value of the to-be-processed unit includes the following two situations:
情形一,当所述第一模板失真值小于或等于所述第二模板失真值时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。In the first case, when the first template distortion value is less than or equal to the second template distortion value, the predicted value of the to-be-processed unit is obtained in the first reference image according to the first motion information.
情形二,当所述第一模板失真值大于或等于所述第二模板失真值时,将所述加权预测值作为所述待处理单元的预测值。In the second case, when the first template distortion value is greater than or equal to the second template distortion value, the weighted prediction value is used as the predicted value of the to-be-processed unit.
由此可知,这种实施方式中,上述预测方法能够在单向搜索单向预测的方式和双向搜索双向预测的方式中进行自适应选择,此时,在实现复杂度较低的情形下提高预测的效果和精度。Therefore, in this embodiment, the foregoing prediction method can perform adaptive selection in a unidirectional search unidirectional prediction manner and a bidirectional search bidirectional prediction manner. At this time, the prediction is improved in a case where the implementation complexity is low. The effect and precision.
进一步的,另一种可能的实施方式中,在所述根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值之前,还包括:Further, in another possible implementation, before the determining the weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information, the method further includes:
比较所述第一模板失真值、所述第二模板失真值和所述第三模板失真值;Comparing the first template distortion value, the second template distortion value, and the third template distortion value;
根据所述比较结果,确定所述待处理单元的预测值。Based on the comparison result, a predicted value of the unit to be processed is determined.
具体的,所述根据所述比较结果,确定所述待处理单元的预测值,包括以下三种情形:Specifically, the determining, according to the comparison result, the predicted value of the to-be-processed unit includes the following three situations:
情形一,当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。Case 1, in the first template distortion value, the second template distortion value, and the third template distortion value, when the first template distortion value is the smallest, according to the first motion information, in the In the first reference image, a predicted value of the unit to be processed is obtained.
情形二:当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。Case 2: when the third template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, according to the third motion information, In the third reference image, the predicted value of the to-be-processed unit is obtained.
情形三:当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。Case 3: when the second template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, the weighted prediction value is used as the to-be-processed The predicted value of the unit.
这种实施方式中,能够在两个不同的单向搜索单向预测的方式、以及双向搜索双向预测的方式中进行自适应选择,此时,虽然实现复杂度较高,但是有较好的自适应选择性,从而提高预测的效果和精度。 In this implementation manner, adaptive selection can be performed in two different unidirectional search unidirectional prediction modes and two-way search bidirectional prediction mode. At this time, although the implementation complexity is high, there is a better self. Adapt to selectivity to improve the predictive effect and accuracy.
以下通过实际的应用场景来详细说明图3中的方法。The method in FIG. 3 will be described in detail below through actual application scenarios.
场景一scene one
场景一中通过模板匹配的双向搜索和双向预测获得当前块的预测值,具体过程如下所示:In scenario 1, the predicted value of the current block is obtained by bidirectional search and bidirectional prediction of template matching, and the specific process is as follows:
1、在当前块的前向参考图像ref0中进行当前模块的匹配搜索,得到当前块的前向运动信息MV0、当前模板的前向预测值,即第一匹配模板的像素值P1;1. Perform a matching search of the current module in the forward reference image ref0 of the current block, and obtain a forward motion information MV0 of the current block and a forward prediction value of the current template, that is, a pixel value P1 of the first matching template;
2、利用以下公式对当前模板进行更新。2. Use the following formula to update the current template.
T1=2T0-P1T1=2T0-P1
其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表当前模板的前向预测值。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, and P1 represents a forward predicted value of the current template.
3、在当前块的后向参考图像中,利用更新后的当前模板T1进行模板的匹配搜索,得到当前块的后向运动信息MV1。3. In the backward reference image of the current block, the matching search of the template is performed by using the updated current template T1 to obtain the backward motion information MV1 of the current block.
4、利用MV0和MV1,对当前块进行双向预测,得到当前块的前向预测值pred0和后向预测值pred1。4. Using MV0 and MV1, bidirectional prediction is performed on the current block, and the forward prediction value pred0 and the backward prediction value pred1 of the current block are obtained.
5、针对所述当前块的前向预测值pred0和后向预测值pred1计算平均值得到所述当前块的预测值。5. Calculate an average value for the forward predicted value pred0 and the backward predicted value pred1 of the current block to obtain a predicted value of the current block.
这样,相比于现有技术,由于增加了当前模板的更新操作,在当前模板更新后,后续步骤中的模板匹配搜索过程相当于双向搜索,本质上同时利用了前向参考图像和后向参考图像,通过简单的方式实现模板匹配的双向搜索过程,提升预测精度和预测效果。In this way, compared with the prior art, since the update operation of the current template is added, after the current template update, the template matching search process in the subsequent step is equivalent to the two-way search, essentially utilizing both the forward reference image and the backward reference. Image, the two-way search process of template matching is realized in a simple way to improve prediction accuracy and prediction effect.
需要说明的是,场景一中的步骤1-步骤3,可迭代执行多次,以便获得更高精度的运动信息。It should be noted that Steps 1 - 3 in Scene 1 can be performed iteratively multiple times in order to obtain more accurate motion information.
需要说明的是,如果步骤5中的双向预测采用加权预测的方式,如:predBi=w0*pred0+ω1*pred1),那么相应的步骤2中的模板更新过程使用的公式更改为如下形式:It should be noted that if the bidirectional prediction in step 5 adopts a weighted prediction manner, such as: predBi=w0*pred0+ω1*pred1), the formula used in the template update process in the corresponding step 2 is changed to the following form:
T1=(T0-ω0×P1)/ω1T1=(T0-ω0×P1)/ω1
式中,ω0,ω1为前向预测值pred0和后向预测值pred1对应的加权系数,并满足ω0+ω1=1。In the formula, ω0, ω1 are weighting coefficients corresponding to the forward predicted value pred0 and the backward predicted value pred1, and satisfy ω0 + ω1 = 1.
如果双向预测采用加权预测的方式,那么涉及的加权系数可根据前向预测和后向预测对应的失真值进行计算。原则上,给预测越准确的分配越大的权重即预测失真越小的分配越大的权重,比如:If the bidirectional prediction adopts the method of weighted prediction, the weighting coefficients involved may be calculated according to the distortion values corresponding to the forward prediction and the backward prediction. In principle, the more accurate the allocation is, the larger the weight, that is, the smaller the prediction distortion, the larger the weight, such as:
ω0=cost1/(cost0+cost1);ω1=cost0/(cost0+cost1),Ω0=cost1/(cost0+cost1); ω1=cost0/(cost0+cost1),
其中,cost0为前向预测对应的当前模板的失真值,cost1为后向预测对应的当前模板的失真值。Cost0 is the distortion value of the current template corresponding to the forward prediction, and cost1 is the distortion value of the current template corresponding to the backward prediction.
其中,加权预测特别适合亮度渐变的场景,本申请中基于模板匹配的预测方法可自适应计算出加权系数,在图像内部不同区域允许有不同的加权系数,这样会有更好的局部适应性,有助于进行更准确的预测。Among them, the weighted prediction is particularly suitable for the scene of brightness gradation. In this application, the prediction method based on template matching can adaptively calculate the weighting coefficient, and different weighting coefficients are allowed in different regions of the image, so that there is better local adaptability. Helps make more accurate predictions.
针对场景一中步骤3中的模板匹配搜索相当于双向搜索的原因如下:The reason for the template matching search in step 3 of scene one is equivalent to two-way search is as follows:
步骤3的模板匹配,是要在后向参考图像Ref1中寻找一个后向预测值Pred1,使得其与模板最为匹配,匹配过程就是最小化T1-Pred1。由于The template matching of step 3 is to find a backward prediction value Pred1 in the backward reference image Ref1 so that it matches the template most, and the matching process is to minimize T1-Pred1. due to
T1-Pred1=(2×T0–Pred0)–Pred1T1-Pred1=(2×T0–Pred0)–Pred1
=2×[T0–(Pred0+Pred1)/2] =2×[T0–(Pred0+Pred1)/2]
式中,(Pred0+Pred1)/2为当前块的加权预测值,而最小化(T0–(Pred0+Pred1)/2)为标准的双向匹配搜索过程。Where (Pred0+Pred1)/2 is the weighted prediction value of the current block, and the minimum (T0–(Pred0+Pred1)/2) is the standard two-way matching search process.
可见,最小化(T1-Pred1)的过程,也就相当于最小化(T0–(Pred0+Pred1)/2)的过程。因此,步骤3的匹配搜索过程实际上就是双向匹配搜索。同时,从上式中看到,此时模板差异(T1-Pred1)相当于2倍的当前模板与双向预测值之差(T0–(Pred0+Pred1)/2);因此,经过归一化,1/2*(T1-Pred1)相当于表征当前模板与双向预测值之间的差异,用于后续cost的比较。It can be seen that the process of minimizing (T1-Pred1) is equivalent to minimizing the process of (T0–(Pred0+Pred1)/2). Therefore, the matching search process of step 3 is actually a two-way matching search. At the same time, as seen from the above equation, the template difference (T1-Pred1) is equivalent to twice the difference between the current template and the bidirectional prediction value (T0–(Pred0+Pred1)/2); therefore, after normalization, 1/2*(T1-Pred1) is equivalent to characterizing the difference between the current template and the bidirectional prediction value for comparison of subsequent costs.
值得一提的是,场景一中通过模板匹配的双向搜索和双向预测获得当前块的预测值的实施过程,也可以先在后向参考图像ref1中进行当前模块的匹配搜索,得到当前块的后向运动信息MV1、当前模板的后向预测值P1,再利用后向预测值P1对当前模板进行更新,从而在前向参考图像中进行模板的双向匹配搜索过程,进而得到当前块的预测值,其他过程均相似,在此不再赘述。It is worth mentioning that in the scenario 1, the implementation process of the prediction value of the current block is obtained by the bidirectional search and the bidirectional prediction of the template matching, and the matching search of the current module may be performed in the backward reference image ref1 first, and the current block is obtained. The current template is updated to the motion information MV1, the backward prediction value P1 of the current template, and the backward prediction value P1, so that the bidirectional matching search process of the template is performed in the forward reference image, thereby obtaining the prediction value of the current block. Other processes are similar and will not be described here.
场景二Scene two
场景二中在两个不同的单向搜索和单向预测方式包括前向搜索前向预测和后向搜索后向预测、双向搜索和双向预测方式中自适应选择预测方式以获取当前块的预测值,具体过程如下所示:In scenario 2, the two different one-way search and one-way prediction modes include forward search forward prediction and backward search backward prediction, two-way search and bidirectional prediction modes, and adaptively select prediction modes to obtain prediction values of current blocks. The specific process is as follows:
1.在当前块的前向参考图像ref0中进行当前模块的匹配搜索,得到当前块的前向运动信息MV0、当前模板的前向预测值,即匹配模板的像素值,以及当前模板与当前模板的前向预测值之间的第一失真值cost0。1. Perform a matching search of the current module in the forward reference image ref0 of the current block, and obtain the forward motion information MV0 of the current block, the forward prediction value of the current template, that is, the pixel value of the matching template, and the current template and the current template. The first distortion value cost0 between the forward predicted values.
2、在当前块的后向参考图像ref1中进行当前模块的匹配搜索,得到当前块的后向运动信息MV1当前模板的后向预测值,即匹配模板的像素值,以及当前模板与当前模板的后向预测值之间的第二失真值cost2。2. Perform a matching search of the current module in the backward reference image ref1 of the current block, and obtain a backward predicted value of the current template of the backward motion information MV1 of the current block, that is, a pixel value of the matching template, and a current template and a current template. The second distortion value cost2 between the backward predicted values.
3、比较cost0、cost2的大小,从中选择较小失真值对应的预测方式来获取当前块的双向运动信息、以及当前模板与当前模板的加权预测值之间的第一失真值cost1。3. Compare the sizes of cost0 and cost2, and select a prediction mode corresponding to the smaller distortion value to obtain the bidirectional motion information of the current block and the first distortion value cost1 between the current template and the weighted prediction value of the current template.
具体的,在第一种实施方式中,若cost0小于cost2,利用以下公式对当前模板进行更新。Specifically, in the first embodiment, if cost0 is less than cost2, the current template is updated by using the following formula.
T1=2T0-P1T1=2T0-P1
其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表当前模板的前向预测值。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, and P1 represents a forward predicted value of the current template.
然后,在当前块的后向参考图像中,利用更新后的当前模板T1进行模板的匹配搜索,得到当前块的后向运动信息MV1’,更新后的当前模板的加权预测值、以及更新后的当前模板的第一失真值cost1。Then, in the backward reference image of the current block, the matching search of the template is performed by using the updated current template T1 to obtain the backward motion information MV1′ of the current block, the weighted prediction value of the updated current template, and the updated The first distortion value of the current template is cost1.
此时,当前块的双向运动信息为MV0和MV1’。At this time, the bidirectional motion information of the current block is MV0 and MV1'.
具体的,在第二种实施方式中,若cost1不小于cost2,利用以下公式对当前模板进行更新。Specifically, in the second implementation manner, if cost1 is not less than cost2, the current template is updated by using the following formula.
T1=2T0-P1′T1=2T0-P1'
其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1′代表当前模板的后向预测值。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, and P1′ represents a backward predicted value of the current template.
然后,在当前块的前向参考图像中,利用更新后的当前模板T1进行模板的匹配搜索,得到当前块的前向运动信息MV0’,更新后的当前模板的加权预测值、以及更新后的当前 模板的第一失真值cost1。Then, in the forward reference image of the current block, the matching search of the template is performed by using the updated current template T1, and the forward motion information MV0' of the current block, the weighted prediction value of the updated current template, and the updated Current The first distortion value of the template is cost1.
此时,当前块的双向运动信息为MV0’和MV1。At this time, the bidirectional motion information of the current block is MV0' and MV1.
4、从cost0和cost2中的较小者与cost1比较大小,从中选择最小失真值对应的预测方式来获取当前块的预测值。4. The smaller one of cost0 and cost2 is compared with cost1, and the prediction mode corresponding to the minimum distortion value is selected to obtain the predicted value of the current block.
具体的,在上述步骤3中的第一种实施方式情况下:Specifically, in the case of the first embodiment in the above step 3:
若cost0小于cost1,利用前向运动信息MV0,在当前块的前向参考图像中获取当前块的前向预测值,作为当前块的预测值,If cost0 is less than cost1, the forward prediction value of the current block is obtained in the forward reference image of the current block by using the forward motion information MV0 as the predicted value of the current block.
若cost0不小于cost1,利用前向运动信息MV0和后向运动信息MV1’,在当前块的前向参考图像中获取当前块的前向预测值,在前块的后向参考图像中获取当前块的后向预测值,对所述当前块的前向预测值和所述当前块的后向预测值进行加权计算得到所述当前块的预测值。If cost0 is not less than cost1, the forward motion information MV0 and the backward motion information MV1' are used to obtain the forward prediction value of the current block in the forward reference image of the current block, and the current block is obtained in the backward reference image of the previous block. The backward prediction value, weighting the forward prediction value of the current block and the backward prediction value of the current block to obtain a prediction value of the current block.
具体的,在上述步骤3中的第二种实施方式情况下:Specifically, in the case of the second embodiment in the above step 3:
若cost2小于cost1,利用后向运动信息MV1,在当前块的后向参考图像中获取当前块的后向预测值,作为当前块的预测值。If cost2 is less than cost1, the backward prediction value of the current block is obtained in the backward reference image of the current block by using the backward motion information MV1 as the predicted value of the current block.
若cost2不小于cost1,利用前向运动信息MV0’和后向运动信息MV1,在当前块的前向参考图像中获取当前块的前向预测值,在前块的后向参考图像中获取当前块的后向预测值,对所述当前块的前向预测值和所述当前块的后向预测值进行加权计算得到所述当前块的预测值。If cost2 is not less than cost1, the forward motion information MV0' and the backward motion information MV1 are used to obtain the forward prediction value of the current block in the forward reference image of the current block, and the current block is obtained in the backward reference image of the previous block. The backward prediction value, weighting the forward prediction value of the current block and the backward prediction value of the current block to obtain a prediction value of the current block.
需要说明的是,场景二中需要进行三次单向的模板匹配搜索过程,自适应性最好,预测的效果最好,但是实现复杂度较高。It should be noted that in the second scenario, the three-way template matching search process needs to be performed three times, the adaptability is the best, the prediction effect is the best, but the implementation complexity is high.
场景三Scene three
场景三中在一种确定的单向搜索和单向预测方式、双向搜索和双向预测方式中自适应选择预测方式以获取当前块的预测值,具体过程如下所示:In scenario 3, adaptively selecting a prediction mode in a determined one-way search and one-way prediction mode, a two-way search mode, and a bidirectional prediction mode to obtain a prediction value of a current block, the specific process is as follows:
具体的,在确定单向搜索和单向预测方式的方向时,可事先根据一些指标进行确定。比如,(1)在执行模板匹配搜索之前,根据前向运动矢量初始值和后向运动矢量初始值对当前模板进行匹配搜索,分别获得当前模板对应的前向预测值与当前模板的前向失真值cost0’;以及当前模板对应的后向预测值与当前模板的后向失真值cost2’,cost0’与cost2’的大小来选择,选择失真值小的对应的单向预测方式;又比如(2)根据当前块与前向参考图像和后向参考图像之间的时域距离来判定,选择时域距离小的单向预测方式。Specifically, when determining the direction of the one-way search and the one-way prediction mode, the determination may be performed according to some indicators in advance. For example, (1) before performing the template matching search, performing matching search on the current template according to the initial value of the forward motion vector and the initial value of the backward motion vector, respectively obtaining the forward prediction value corresponding to the current template and the forward distortion of the current template. The value cost0'; and the backward prediction value corresponding to the current template and the backward distortion value cost2', cost0' and cost2' of the current template are selected, and the corresponding one-way prediction mode with a small distortion value is selected; for example, (2) And determining, according to the time domain distance between the current block and the forward reference image and the backward reference image, a unidirectional prediction manner in which the time domain distance is small.
若确定的单向预测方式为前向搜索和前向预测,具体的实现流程图可参阅图4A所示:If the determined one-way prediction mode is forward search and forward prediction, the specific implementation flowchart can be seen in FIG. 4A:
1.在当前块的前向参考图像ref0中进行当前模块的匹配搜索,得到当前块的前向运动信息MV0、当前模板的前向预测值,即匹配模板的像素值,以及当前模板与当前模板的前向预测值之间的第一失真值cost0。1. Perform a matching search of the current module in the forward reference image ref0 of the current block, and obtain the forward motion information MV0 of the current block, the forward prediction value of the current template, that is, the pixel value of the matching template, and the current template and the current template. The first distortion value cost0 between the forward predicted values.
2、利用以下公式对当前模板进行更新:2. Update the current template with the following formula:
T1=2T0-P1T1=2T0-P1
其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表当前模板的前向预测值。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, and P1 represents a forward predicted value of the current template.
3、在当前块的后向参考图像中,利用更新后的当前模板T1进行模板的匹配搜索,得到更新后的当前模块的加权预测值,以及与更新后的当前模板之间的第二失真值cost1。3. In the backward reference image of the current block, the matching search of the template is performed by using the updated current template T1, and the updated weighted prediction value of the current module and the second distortion value between the updated current template and the updated current template are obtained. Cost1.
4、比较cost0、cost1的大小。 4. Compare the size of cost0 and cost1.
5、根据cost0、cost1的比较结果,从中选择较小失真值对应的预测方式来获取当前块的预测值。5. According to the comparison result of cost0 and cost1, the prediction mode corresponding to the smaller distortion value is selected to obtain the predicted value of the current block.
具体的,若cost0小于cost1,利用前向运动信息MV0,在当前块的前向参考图像中获取当前块的前向预测值,作为当前块的预测值,Specifically, if cost0 is less than cost1, the forward prediction value of the current block is obtained in the forward reference image of the current block by using the forward motion information MV0 as the predicted value of the current block.
若cost0不小于cost1,利用前向运动信息MV0和后向运动信息MV1’,在当前块的前向参考图像中获取当前块的前向预测值,在前块的后向参考图像中获取当前块的后向预测值,对所述当前块的前向预测值和所述当前块的后向预测值进行加权计算得到所述当前块的预测值。If cost0 is not less than cost1, the forward motion information MV0 and the backward motion information MV1' are used to obtain the forward prediction value of the current block in the forward reference image of the current block, and the current block is obtained in the backward reference image of the previous block. The backward prediction value, weighting the forward prediction value of the current block and the backward prediction value of the current block to obtain a prediction value of the current block.
若确定的单向预测方式为后向搜索和后向预测,具体的实现流程图可参阅图4B所示::If the determined one-way prediction mode is backward search and backward prediction, the specific implementation flowchart can be seen in FIG. 4B:
1、在当前块的后向参考图像ref1中进行当前模块的匹配搜索,得到当前块的后向运动信息MV1’、当前模板的后向预测值,即匹配模板的像素值,以及当前模板与当前模板的后向预测值之间的第三失真值cost2。1. Perform a matching search of the current module in the backward reference image ref1 of the current block, and obtain the backward motion information MV1' of the current block, the backward prediction value of the current template, that is, the pixel value of the matching template, and the current template and the current template. The third distortion value cost2 between the backward predicted values of the template.
2、利用以下公式对当前模板进行更新:2. Update the current template with the following formula:
T1=2T0-P1′T1=2T0-P1'
其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1′代表当前模板的后向预测值。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, and P1′ represents a backward predicted value of the current template.
3、在当前块的后向参考图像中,利用更新后的当前模板T1进行模板的匹配搜索,得到更新后的当前模块的加权预测值,以及与更新后的当前模板之间的第二失真值cost1。3. In the backward reference image of the current block, the matching search of the template is performed by using the updated current template T1, and the updated weighted prediction value of the current module and the second distortion value between the updated current template and the updated current template are obtained. Cost1.
4、比较cost1、cost2的大小。4. Compare the size of cost1 and cost2.
5、根据cost1、cost2的比较结果,从中选择较小失真值对应的预测方式来获取当前块的预测值。5. According to the comparison result of cost1 and cost2, the prediction mode corresponding to the smaller distortion value is selected to obtain the predicted value of the current block.
若cost2不小于cost1,利用前向运动信息MV0’和后向运动信息MV1,在当前块的前向参考图像中获取当前块的前向预测值,在前块的后向参考图像中获取当前块的后向预测值,对所述当前块的前向预测值和所述当前块的后向预测值进行加权计算得到所述当前块的预测值。If cost2 is not less than cost1, the forward motion information MV0' and the backward motion information MV1 are used to obtain the forward prediction value of the current block in the forward reference image of the current block, and the current block is obtained in the backward reference image of the previous block. The backward prediction value, weighting the forward prediction value of the current block and the backward prediction value of the current block to obtain a prediction value of the current block.
若cost2小于cost1,利用后向运动信息MV1,在当前块的后向参考图像中获取当前块的后向预测值,作为当前块的预测值。If cost2 is less than cost1, the backward prediction value of the current block is obtained in the backward reference image of the current block by using the backward motion information MV1 as the predicted value of the current block.
需要说明的是,场景三相比于场景二,减少了一次模板匹配搜索过程,降低了复杂度的同时,提高预测精度。It should be noted that, compared with the second scenario, the scenario 3 reduces the template matching search process, reduces the complexity, and improves the prediction accuracy.
根据上述预测方法得到预测值,进行图像块的编码或解码。The predicted value is obtained according to the above prediction method, and encoding or decoding of the image block is performed.
图5是视频编解码装置或电子设备50的示意性框图,该装置或者电子设备可以并入根据本申请的实施例的预测设备。图6是根据本申请实施例的用于视频编码的示意性装置图。下面将说明图5和图6中的单元。5 is a schematic block diagram of a video codec device or electronic device 50 that may incorporate a predictive device in accordance with an embodiment of the present application. FIG. 6 is a schematic diagram of an apparatus for video encoding in accordance with an embodiment of the present application. The units in Figs. 5 and 6 will be explained below.
电子设备50可以例如是无线通信系统的移动终端或者用户设备。应理解,可以在可能需要对视频图像进行编码和解码,或者编码,或者解码的任何电子设备或者装置内实施本申请的实施例。The electronic device 50 can be, for example, a mobile terminal or user equipment of a wireless communication system. It should be understood that embodiments of the present application may be implemented in any electronic device or device that may require encoding and decoding, or encoding, or decoding of a video image.
装置50可以包括用于并入和保护设备的壳30。装置50还可以包括形式为液晶显示器的显示器32。在本申请的其它实施例中,显示器可以是适合于显示图像或者视频的任何适当的显示器技术。装置50还可以包括小键盘34。在本申请的其它实施例中,可以运用任何适当的数据或者用户接口机制。例如,可以实施用户接口为虚拟键盘或者数据录入系统 作为触敏显示器的一部分。装置可以包括麦克风36或者任何适当的音频输入,该音频输入可以是数字或者模拟信号输入。装置50还可以包括如下音频输出设备,该音频输出设备在本申请的实施例中可以是以下各项中的任何一项:耳机38、扬声器或者模拟音频或者数字音频输出连接。装置50也可以包括电池40,在本申请的其它实施例中,设备可以由任何适当的移动能量设备,比如太阳能电池、燃料电池或者时钟机构生成器供电。装置还可以包括用于与其它设备的近程视线通信的红外线端口42。在其它实施例中,装置50还可以包括任何适当的近程通信解决方案,比如蓝牙无线连接或者USB/火线有线连接。 Device 50 can include a housing 30 for incorporating and protecting the device. Device 50 may also include display 32 in the form of a liquid crystal display. In other embodiments of the present application, the display may be any suitable display technology suitable for displaying images or video. Device 50 may also include a keypad 34. In other embodiments of the present application, any suitable data or user interface mechanism can be utilized. For example, the user interface can be implemented as a virtual keyboard or data entry system As part of a touch-sensitive display. The device may include a microphone 36 or any suitable audio input, which may be a digital or analog signal input. The device 50 may also include an audio output device, which in the embodiment of the present application may be any of the following: an earphone 38, a speaker, or an analog audio or digital audio output connection. Device 50 may also include battery 40, and in other embodiments of the present application, the device may be powered by any suitable mobile energy device, such as a solar cell, fuel cell, or clock mechanism generator. The device may also include an infrared port 42 for short-range line of sight communication with other devices. In other embodiments, device 50 may also include any suitable short range communication solution, such as a Bluetooth wireless connection or a USB/Firewire wired connection.
装置50可以包括用于控制装置50的控制器56或者处理器。控制器56可以连接到存储器58,该存储器在本申请的实施例中可以存储形式为图像的数据和音频的数据,和/或也可以存储用于在控制器56上实施的指令。控制器56还可以连接到适合于实现音频和/或视频数据的编码和解码或者由控制器56实现的辅助编码和解码的编码解码器54。 Device 50 may include a controller 56 or processor for controlling device 50. The controller 56 can be coupled to a memory 58, which in the embodiments of the present application can store data in the form of data and audio in the form of images, and/or can also store instructions for execution on the controller 56. The controller 56 can also be coupled to a codec 54 suitable for implementing encoding and decoding of audio and/or video data or assisted encoding and decoding by the controller 56.
装置50还可以包括用于提供用户信息并且适合于提供用于在网络认证和授权用户的认证信息的读卡器48和智能卡46,例如UICC和UICC读取器。The apparatus 50 may also include a card reader 48 and a smart card 46, such as a UICC and a UICC reader, for providing user information and for providing authentication information for authenticating and authorizing users on the network.
装置50还可以包括无线电接口电路52,该无线电接口电路连接到控制器并且适合于生成例如用于与蜂窝通信网络、无线通信系统或者无线局域网通信的无线通信信号。装置50还可以包括天线44,该天线连接到无线电接口电路52用于向其它(多个)装置发送在无线电接口电路52生成的射频信号并且用于从其它(多个)装置接收射频信号。 Apparatus 50 may also include a radio interface circuit 52 coupled to the controller and adapted to generate, for example, a wireless communication signal for communicating with a cellular communication network, a wireless communication system, or a wireless local area network. Apparatus 50 may also include an antenna 44 coupled to radio interface circuitry 52 for transmitting radio frequency signals generated at radio interface circuitry 52 to other apparatus(s) and for receiving radio frequency signals from other apparatus(s).
在本申请的一些实施例中,装置50包括能够记录或者检测单帧的相机,编码解码器54或者控制器接收到这些单帧并对它们进行处理。在本申请的一些实施例中,装置可以在传输和/或存储之前从另一设备接收待处理的视频图像数据。在本申请的一些实施例中,装置50可以通过无线或者有线连接接收图像用于编码/解码。In some embodiments of the present application, device 50 includes a camera capable of recording or detecting a single frame, and codec 54 or controller receives these single frames and processes them. In some embodiments of the present application, the device may receive video image data to be processed from another device prior to transmission and/or storage. In some embodiments of the present application, device 50 may receive images for encoding/decoding via a wireless or wired connection.
图7是根据本申请实施例的另一视频编解码系统10的示意性框图。如图7所示,视频编解码系统10包含源装置12及目的地装置14。源装置12产生经编码视频数据。因此,源装置12可被称作视频编码装置或视频编码设备。目的地装置14可解码由源装置12产生的经编码视频数据。因此,目的地装置14可被称作视频解码装置或视频解码设备。源装置12及目的地装置14可为视频编解码装置或视频编解码设备的实例。源装置12及目的地装置14可包括广泛范围的装置,包含台式计算机、移动计算装置、笔记本(例如,膝上型)计算机、平板计算机、机顶盒、智能电话等手持机、电视、相机、显示装置、数字媒体播放器、视频游戏控制台、车载计算机,或其类似者。FIG. 7 is a schematic block diagram of another video codec system 10 in accordance with an embodiment of the present application. As shown in FIG. 7, video codec system 10 includes source device 12 and destination device 14. Source device 12 produces encoded video data. Thus, source device 12 may be referred to as a video encoding device or a video encoding device. Destination device 14 may decode the encoded video data produced by source device 12. Thus, destination device 14 may be referred to as a video decoding device or a video decoding device. Source device 12 and destination device 14 may be examples of video codec devices or video codec devices. Source device 12 and destination device 14 may include a wide range of devices including desktop computers, mobile computing devices, notebook (eg, laptop) computers, tablet computers, set top boxes, smart phones, etc., televisions, cameras, display devices , digital media player, video game console, on-board computer, or the like.
目的地装置14可经由信道16接收来自源装置12的编码后的视频数据。信道16可包括能够将经编码视频数据从源装置12移动到目的地装置14的一个或多个媒体及/或装置。在一个实例中,信道16可包括使源装置12能够实时地将编码后的视频数据直接发射到目的地装置14的一个或多个通信媒体。在此实例中,源装置12可根据通信标准(例如,无线通信协议)来调制编码后的视频数据,且可将调制后的视频数据发射到目的地装置14。所述一个或多个通信媒体可包含无线及/或有线通信媒体,例如射频(RF)频谱或一根或多根物理传输线。所述一个或多个通信媒体可形成基于包的网络(例如,局域网、广域网或全球网络(例如,因特网))的部分。所述一个或多个通信媒体可包含路由器、交换器、基站,或促进从源装置12到目的地装置14的通信的其它设备。Destination device 14 may receive the encoded video data from source device 12 via channel 16. Channel 16 may include one or more media and/or devices capable of moving encoded video data from source device 12 to destination device 14. In one example, channel 16 may include one or more communication media that enable source device 12 to transmit encoded video data directly to destination device 14 in real time. In this example, source device 12 may modulate the encoded video data in accordance with a communication standard (eg, a wireless communication protocol) and may transmit the modulated video data to destination device 14. The one or more communication media may include wireless and/or wired communication media, such as a radio frequency (RF) spectrum or one or more physical transmission lines. The one or more communication media may form part of a packet-based network (eg, a local area network, a wide area network, or a global network (eg, the Internet)). The one or more communication media may include routers, switches, base stations, or other devices that facilitate communication from source device 12 to destination device 14.
在另一实例中,信道16可包含存储由源装置12产生的编码后的视频数据的存储媒体。在此实例中,目的地装置14可经由磁盘存取或卡存取来存取存储媒体。存储媒体可包含 多种本地存取式数据存储媒体,例如蓝光光盘、DVD、CD-ROM、快闪存储器,或用于存储经编码视频数据的其它合适数字存储媒体。In another example, channel 16 can include a storage medium that stores encoded video data generated by source device 12. In this example, destination device 14 can access the storage medium via disk access or card access. Storage media can contain A variety of local access data storage media, such as Blu-ray Disc, DVD, CD-ROM, flash memory, or other suitable digital storage medium for storing encoded video data.
在另一实例中,信道16可包含文件服务器或存储由源装置12产生的编码后的视频数据的另一中间存储装置。在此实例中,目的地装置14可经由流式传输或下载来存取存储于文件服务器或其它中间存储装置处的编码后的视频数据。文件服务器可以是能够存储编码后的视频数据且将所述编码后的视频数据发射到目的地装置14的服务器类型。实例文件服务器包含web服务器(例如,用于网站)、文件传送协议(FTP)服务器、网络附加存储(NAS)装置,及本地磁盘驱动器。In another example, channel 16 can include a file server or another intermediate storage device that stores encoded video data generated by source device 12. In this example, destination device 14 may access the encoded video data stored at a file server or other intermediate storage device via streaming or download. The file server may be a server type capable of storing encoded video data and transmitting the encoded video data to the destination device 14. The instance file server includes a web server (eg, for a website), a file transfer protocol (FTP) server, a network attached storage (NAS) device, and a local disk drive.
目的地装置14可经由标准数据连接(例如,因特网连接)来存取编码后的视频数据。数据连接的实例类型包含适合于存取存储于文件服务器上的编码后的视频数据的无线信道(例如,Wi-Fi连接)、有线连接(例如,DSL、缆线调制解调器等),或两者的组合。编码后的视频数据从文件服务器的发射可为流式传输、下载传输或两者的组合。Destination device 14 can access the encoded video data via a standard data connection (e.g., an internet connection). An instance type of a data connection includes a wireless channel (eg, a Wi-Fi connection), a wired connection (eg, DSL, cable modem, etc.), or both, suitable for accessing encoded video data stored on a file server. combination. The transmission of the encoded video data from the file server may be streaming, downloading, or a combination of both.
本申请的技术不限于无线应用场景,示例性的,可将所述技术应用于支持以下应用等多种多媒体应用的视频编解码:空中电视广播、有线电视发射、卫星电视发射、流式传输视频发射(例如,经由因特网)、存储于数据存储媒体上的视频数据的编码、存储于数据存储媒体上的视频数据的解码,或其它应用。在一些实例中,视频编解码系统10可经配置以支持单向或双向视频发射,以支持例如视频流式传输、视频播放、视频广播及/或视频电话等应用。The technology of the present application is not limited to a wireless application scenario. Illustratively, the technology can be applied to video codecs supporting various multimedia applications such as aerial television broadcasting, cable television transmission, satellite television transmission, and streaming video. Transmission (eg, via the Internet), encoding of video data stored on a data storage medium, decoding of video data stored on a data storage medium, or other application. In some examples, video codec system 10 may be configured to support one-way or two-way video transmission to support applications such as video streaming, video playback, video broadcasting, and/or video telephony.
在图7的实例中,源装置12包含视频源18、视频编码器20及输出接口22。在一些实例中,输出接口22可包含调制器/解调器(调制解调器)及/或发射器。视频源18可包含视频俘获装置(例如,视频相机)、含有先前俘获的视频数据的视频存档、用以从视频内容提供者接收视频数据的视频输入接口,及/或用于产生视频数据的计算机图形系统,或上述视频数据源的组合。In the example of FIG. 7, source device 12 includes video source 18, video encoder 20, and output interface 22. In some examples, output interface 22 can include a modulator/demodulator (modem) and/or a transmitter. Video source 18 may include a video capture device (eg, a video camera), a video archive containing previously captured video data, a video input interface to receive video data from a video content provider, and/or a computer for generating video data. A graphics system, or a combination of the above video data sources.
视频编码器20可编码来自视频源18的视频数据。在一些实例中,源装置12经由输出接口22将编码后的视频数据直接发射到目的地装置14。编码后的视频数据还可存储于存储媒体或文件服务器上以供目的地装置14稍后存取以用于解码及/或播放。 Video encoder 20 may encode video data from video source 18. In some examples, source device 12 transmits the encoded video data directly to destination device 14 via output interface 22. The encoded video data may also be stored on a storage medium or file server for later access by the destination device 14 for decoding and/or playback.
在图7的实例中,目的地装置14包含输入接口28、视频解码器30及显示装置32。在一些实例中,输入接口28包含接收器及/或调制解调器。输入接口28可经由信道16接收编码后的视频数据。显示装置32可与目的地装置14整合或可在目的地装置14外部。一般来说,显示装置32显示解码后的视频数据。显示装置32可包括多种显示装置,例如液晶显示器(LCD)、等离子体显示器、有机发光二极管(OLED)显示器或其它类型的显示装置。In the example of FIG. 7, destination device 14 includes an input interface 28, a video decoder 30, and a display device 32. In some examples, input interface 28 includes a receiver and/or a modem. Input interface 28 can receive the encoded video data via channel 16. Display device 32 may be integral with destination device 14 or may be external to destination device 14. In general, display device 32 displays the decoded video data. Display device 32 may include a variety of display devices such as liquid crystal displays (LCDs), plasma displays, organic light emitting diode (OLED) displays, or other types of display devices.
视频编码器20及视频解码器30可根据视频压缩标准(例如,高效率视频编解码H.265标准)而操作,且可遵照HEVC测试模型(HM)。H.265标准的文本描述ITU-TH.265(V3)(04/2015)于2015年4月29号发布,可从http://handle.itu.int/11.1002/1000/12455下载,所述文件的全部内容以引用的方式并入本文中。 Video encoder 20 and video decoder 30 may operate in accordance with a video compression standard (eg, the High Efficiency Video Codec H.265 standard) and may conform to the HEVC Test Model (HM). A textual description of the H.265 standard is published on April 29, 2015, ITU-T.265(V3) (04/2015), available for download from http://handle.itu.int/11.1002/1000/12455 The entire contents of the document are incorporated herein by reference.
基于上述方法实施例,如图8所示,本申请实施例提供一种基于模板匹配的预测装置800,如图8所示,该装置800包括搜索单元801、更新单元802和确定单元803,其中:Based on the foregoing method embodiment, as shown in FIG. 8, the embodiment of the present application provides a template matching based prediction apparatus 800. As shown in FIG. 8, the apparatus 800 includes a searching unit 801, an updating unit 802, and a determining unit 803. :
搜索单元801,用于在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,所述当前模板包括所 述待处理单元的邻域中预设位置和数量的多个重构像素,所述第一模板失真值代表所述第一匹配模板和所述当前模板的差异;The searching unit 801 is configured to perform a matching search of the current template in the first reference image of the to-be-processed unit, and obtain the first motion information, the first matching template, and the first template distortion value of the to-be-processed unit, where the current template is Including Determining a plurality of reconstructed pixels of a preset position and number in a neighborhood of the processing unit, where the first template distortion value represents a difference between the first matching template and the current template;
更新单元802,用于根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新;The updating unit 802 is configured to update, according to a pixel value of the first matching template, a pixel value of the current template.
所述搜索单元801,还用于在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,所述第二模板失真值代表所述第二匹配模板和所述更新后的当前模板的差异;The searching unit 801 is further configured to perform a matching search of the updated current template in the second reference image of the to-be-processed unit, to obtain second motion information, a second matching template, and a second template distortion value, the second template distortion value representing a difference between the second matching template and the updated current template;
确定单元803,用于当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。The determining unit 803 is configured to determine, according to the first motion information and the second motion information, a weighted prediction value of the to-be-processed unit when the second template distortion value is smaller than the first template distortion value.
可选的,所述更新单元802在根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新时,符合下述表达式:Optionally, the updating unit 802 meets the following expression when updating the pixel value of the current template according to the pixel value of the first matching template:
T1=(T0-ω0×P1)/(1-ω0),T1=(T0-ω0×P1)/(1-ω0),
其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表所述第一匹配模板的像素值,ω0代表所述第一匹配模板对应的加权系数,ω0为小于1的正数。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, P1 represents a pixel value of the first matching template, and ω0 represents a weighting coefficient corresponding to the first matching template, Ω0 is a positive number less than one.
应理解,ω0的取值范围为0到1,且ω0不为1。It should be understood that ω0 has a value ranging from 0 to 1, and ω0 is not 1.
可选的,所述ω0为0.5。Optionally, the ω0 is 0.5.
可选的,所述搜索单元801在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值时,具体用于:Optionally, the searching unit 801 performs a matching search of the current template in the first reference image of the to-be-processed unit, and obtains the first motion information, the first matching template, and the first template distortion value of the to-be-processed unit, Specifically used for:
在所述第一参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第一候选重构像素组合,计算所述多个第一候选重构像素组合和所述当前模板的恶不露多个第一像素差异值;Calculating, in the reconstructed pixels of the preset range of the first reference image, a plurality of first candidate reconstructed pixel combinations having the same size and shape as the current template, and calculating the plurality of first candidate reconstructed pixels Combining the sum of the current template and the plurality of first pixel difference values;
根据最小的所述第一像素差异值,确定所述第一模板失真值、所述第一匹配模板;Determining, according to the smallest first pixel difference value, the first template distortion value, the first matching template;
根据所述第一匹配模板和所述当前模板的位置矢量差,和所述第一匹配模板所在的图像,确定所述第一运动信息,所述第一匹配模板包括所述第一模板失真值对应的第一候选重构像素组合。Determining the first motion information according to a position vector difference between the first matching template and the current template, and an image in which the first matching template is located, where the first matching template includes the first template distortion value Corresponding first candidate reconstructed pixel combination.
可选的,所述搜索单元801在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值时,具体用于:Optionally, the searching unit 801 performs a matching search of the updated current template in the second reference image of the to-be-processed unit, and obtains second motion information, a second matching template, and When the second template distortion value is used, it is specifically used to:
在所述第二参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第二候选重构像素组合,计算所述多个第二候选重构像素组合和所述更新后的当前模板的多个第二像素差异值;Composing, in the reconstructed pixels of the preset range of the second reference image, a plurality of second candidate reconstructed pixel combinations having the same size and shape as the current template, and calculating the plurality of second candidate reconstructed pixels Combining and a plurality of second pixel difference values of the updated current template;
根据最小的所述第二像素差异值,确定所述第二模板失真值、所述第二匹配模板;Determining, according to the smallest second pixel difference value, the second template distortion value and the second matching template;
根据所述第二匹配模板和所述更新后的当前模板的位置矢量差,和所述第二匹配模板所在的图像,确定所述第二运动信息,所述第二匹配模板包括所述第二模板失真值对应的第二候选重构像素组合。Determining the second motion information according to a position vector difference between the second matching template and the updated current template, and an image of the second matching template, where the second matching template includes the second A second candidate reconstructed pixel combination corresponding to the template distortion value.
可选的,所述确定单元803在根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值时,具体用于:Optionally, the determining unit 803 is configured to: when determining the weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information, specifically:
根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的第一向预测值; Obtaining, in the first reference image, a first predicted value of the to-be-processed unit according to the first motion information;
根据所述第二运动信息,在所述第二参考图像中,获得所述待处理单元的第二向预测值;Obtaining, in the second reference image, a second prediction value of the to-be-processed unit according to the second motion information;
对所述第一向预测值和所述第二向预测值进行加权计算,获得所述待处理单元的加权预测值。Weighting the first predicted value and the second predicted value to obtain a weighted predicted value of the to-be-processed unit.
可选的,所述搜索单元801在所述待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息和第一匹配模板之后,还用于:Optionally, the searching unit 801 performs a matching search of the current template in the first reference image of the to-be-processed unit, and obtains the first motion information of the to-be-processed unit and the first matching template, and is further used to:
在第三参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第三候选重构像素组合,计算所述多个第三候选重构像素组合和所述当前模板的多个第三像素差异值;Composing, in a reconstructed pixel of a preset range of the third reference image, a plurality of third candidate reconstructed pixel combinations having the same size and shape as the current template, calculating the plurality of third candidate reconstructed pixel combinations and a plurality of third pixel difference values of the current template;
根据最小的所述第三像素差异值,确定所述第三模板失真值、所述第三匹配模板;Determining, according to the smallest third pixel difference value, the third template distortion value and the third matching template;
根据所述第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息,所述第三匹配模板包括所述第三模板失真值对应的第三候选重构像素组合。Determining, according to the position vector difference of the third matching template and the current template, and the image of the third matching template, the third motion template, where the third matching template includes the third template distortion value Corresponding third candidate reconstructed pixel combination.
可选的,所述搜索单元801在所述根据第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息之后,当所述第三模板失真值小于或等于所述第一模板失真值时,还用于:Optionally, after the determining, by the searching unit 801, the location information difference according to the third matching template and the current template, and the image of the third matching template, determining the third motion information, when When the third template distortion value is less than or equal to the first template distortion value, it is also used to:
将所述第三参考图像作为所述第一参考图像;Using the third reference image as the first reference image;
将所述第三运动信息作为所述第一运动信息;Using the third motion information as the first motion information;
将所述第三模板失真值作为所述第一模板失真值;Using the third template distortion value as the first template distortion value;
将所述第三匹配模板作为所述第一匹配模板。The third matching template is used as the first matching template.
可选的,所述确定单元803在所述根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值之前,还用于:Optionally, the determining unit 803 is further configured to: before determining, according to the first motion information and the second motion information, the weighted prediction value of the to-be-processed unit:
比较所述第一模板失真值和所述第二模板失真值。Comparing the first template distortion value and the second template distortion value.
可选的,所述确定单元803在当所述比较的结果为所述第二模板失真值不小于所述第一模板失真值时,具体用于:Optionally, when the result of the comparison is that the second template distortion value is not less than the first template distortion value, the determining unit 803 is specifically configured to:
根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。And obtaining, according to the first motion information, a predicted value of the to-be-processed unit in the first reference image.
可选的,所述确定单元803在所述根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值之前,还用于:Optionally, the determining unit 803 is further configured to: before determining, according to the first motion information and the second motion information, the weighted prediction value of the to-be-processed unit:
比较所述第一模板失真值、所述第二模板失真值和所述第三模板失真值。Comparing the first template distortion value, the second template distortion value, and the third template distortion value.
可选的,所述确定单元803在当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值时,具体用于:Optionally, the determining unit 803 determines, according to the first motion information and the second motion information, that the to-be-processed unit is when the second template distortion value is smaller than the first template distortion value. When weighting the predicted value, it is specifically used to:
当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。When the second template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, the weighted prediction value is used as a prediction of the to-be-processed unit value.
可选的,所述确定单元803用于:Optionally, the determining unit 803 is configured to:
当所述比较的结果为所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,When the result of the comparison is the first template distortion value, the second template distortion value, and the third template distortion value, when the first template distortion value is the smallest, according to the first motion information, Obtaining a predicted value of the to-be-processed unit in the first reference image; or
当所述比较的结果为所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获 得所述待处理单元的预测值。When the result of the comparison is the first template distortion value, the second template distortion value, and the third template distortion value, when the third template distortion value is the smallest, according to the third motion information, In the third reference image, obtained The predicted value of the unit to be processed is obtained.
可选的,当所述第一参考图像来自于所述待处理单元的前向参考图像列表时,所述第三参考图像来自于所述待处理单元的后向参考图像列表;或者,当所述第一参考图像来自于所述待处理单元的后向参考图像列表时,所述第三参考图像来自于所述待处理单元的前向参考图像列表。Optionally, when the first reference image is from a forward reference image list of the to-be-processed unit, the third reference image is from a backward reference image list of the to-be-processed unit; or When the first reference image is from the backward reference image list of the to-be-processed unit, the third reference image is from the forward reference image list of the to-be-processed unit.
可选的,所述更新单元802还用于根据前述加权系数ω0对所述第二模板失真值进行更新,具体的,比如:更新后的第二模板失真值为(1-ω0)倍的更新前的第二模板失真值。Optionally, the updating unit 802 is further configured to update the second template distortion value according to the foregoing weighting coefficient ω0, specifically, for example, the updated second template distortion value is (1-ω0) times the update. The second template distortion value before.
当ω0为0.5时,更新后的第二模板失真值为更新前的第二模板失真值的0.5倍。When ω0 is 0.5, the updated second template distortion value is 0.5 times the second template distortion value before the update.
应理解,由于使用和模板更新时相同的加权系数ω0,对第二模板失真值的更新和进行模板匹配时,对模板进行更新有关。It should be understood that since the same weighting coefficient ω0 is used as when the template is updated, the update of the second template distortion value and the template matching are performed, and the template is updated.
还应理解,当所述更新单元802还用于根据前述加权系数ω0对所述第二模板失真值进行更新时,其它单元执行后续步骤时的第二模板失真值均指更新后的第二模板失真值,不再赘述。It should also be understood that when the updating unit 802 is further configured to update the second template distortion value according to the foregoing weighting coefficient ω0, the second template distortion value when the other unit performs the subsequent step refers to the updated second template. Distortion value, no longer repeat.
由于对第二模板失真值根据模板更新时的加权系数进行了更新,表征了使用第二模板时的预测误差,使后续的失真值比较的结果更符合真实的失真情况,从而选择更合适的预测值,提高了编码效率。Since the second template distortion value is updated according to the weighting coefficient when the template is updated, the prediction error when using the second template is characterized, so that the result of the subsequent distortion value comparison is more in line with the real distortion condition, thereby selecting a more appropriate prediction. Values improve coding efficiency.
本申请实施例中的装置800的各个单元的功能实现以及交互方式可以进一步参照相关方法实施例的描述,在此不再赘述。For the function implementation and the interaction mode of the respective units of the device 800 in the embodiment of the present application, reference may be made to the description of the related method embodiments, and details are not described herein again.
应理解以上装置800中的各个单元的划分仅仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。例如,以上各个单元可以为单独设立的处理元件,也可以集成在编解码设备的某一个芯片中实现,此外,也可以以程序代码的形式存储于编解码设备的存储元件中,由编解码设备的某一个处理元件调用并执行以上各个单元的功能。此外各个单元可以集成在一起,也可以独立实现。这里所述的处理元件可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤或以上各个单元可以通过处理器元件中的硬件的集成逻辑电路或者软件形式的指令完成。该处理元件可以是通用处理器,例如中央处理器(英文:centralprocessingunit,简称:CPU),还可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(英文:application-specificintegratedcircuit,简称:ASIC),或,一个或多个微处理器(英文:digitalsignalprocessor,简称:DSP),或,一个或者多个现场可编程门阵列(英文:field-programmablegatearray,简称:FPGA)等。It should be understood that the division of each unit in the above device 800 is only a division of a logical function, and the actual implementation may be integrated into one physical entity in whole or in part, or may be physically separated. For example, each of the above units may be a separately set processing element, or may be integrated in one chip of the codec device, or may be stored in a storage element of the codec device in the form of program code, by the codec device. One of the processing elements invokes and performs the functions of each of the above units. In addition, the individual units can be integrated or implemented independently. The processing elements described herein can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method or each of the above units may be completed by an integrated logic circuit of hardware in the processor element or an instruction in a form of software. The processing element may be a general purpose processor, such as a central processing unit (CPU), or may be one or more integrated circuits configured to implement the above method, for example: one or more specific integrated circuits ( English: application-specific integrated circuit (abbreviation: ASIC), or one or more microprocessors (English: digital signal processor, referred to as: DSP), or one or more field programmable gate arrays (English: field-programmablegatearray, referred to as: FPGA) and so on.
根据同一发明构思,本申请实施例还提供一种基于模板匹配的预测设备900,如图9所示,该设备900包括处理器901和存储器902,执行本申请方案的程序代码保存在存储器902中,用于指令处理器901执行图3、图4A、图4B所示的预测方法。According to the same inventive concept, the embodiment of the present application further provides a template matching based prediction device 900. As shown in FIG. 9, the device 900 includes a processor 901 and a memory 902. The program code for executing the solution of the present application is stored in the memory 902. The instruction processor 901 executes the prediction method shown in FIG. 3, FIG. 4A, and FIG. 4B.
本申请还可以通过对处理器进行设计编程,将图3、图4A、图4B所示的方法所对应的代码固化到芯片内,从而使芯片在运行时能够执行图3、图4A、图4B所示的方法。The application can also perform programming programming on the processor to solidify the code corresponding to the method shown in FIG. 3, FIG. 4A and FIG. 4B into the chip, so that the chip can execute FIG. 3, FIG. 4A and FIG. 4B during operation. The method shown.
可以理解的是,本申请实施例上述设备900中涉及的处理器可以是一个CPU,DSP,ASIC,或一个或多个用于控制本申请方案程序执行的集成电路。计算机系统中包括的一个或多个存储器,可以是只读存储器(英文:read-onlymemory,简称ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(英文:randomaccessmemory,简称:RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是磁盘存储器。这 些存储器通过总线与处理器相连接,或者也可以通过专门的连接线与处理器连接。It is to be understood that the processor involved in the foregoing apparatus 900 may be a CPU, a DSP, an ASIC, or one or more integrated circuits for controlling the execution of the program of the present application. One or more memories included in the computer system, which may be read-only memory (ROM: ROM) or other types of static storage devices that can store static information and instructions, random access memory (English: random accessmemory, Abbreviation: RAM) or other types of dynamic storage devices that can store information and instructions, or disk storage. This These memories are connected to the processor via a bus or can also be connected to the processor via a dedicated cable.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令处理器完成,所述的程序可以存储于计算机可读存储介质中,所述存储介质是非短暂性(英文:non-transitory)介质,例如随机存取存储器,只读存储器,快闪存储器,硬盘,固态硬盘,磁带(英文:magnetic tape),软盘(英文:floppy disk),光盘(英文:optical disc)及其任意组合。It will be understood by those skilled in the art that all or part of the steps of implementing the above embodiments may be performed by a program, and the program may be stored in a computer readable storage medium, which is non-transitory ( English: non-transitory) media, such as random access memory, read-only memory, flash memory, hard disk, solid state disk, magnetic tape (English: magnetic tape), floppy disk (English: floppy disk), CD (English: optical disc) And any combination thereof.
本发明的一个具体实施例对JVET-D1001,“Algorithm Description of Joint Exploration Test Model 4”中帧率上转换(FRUC)的实现方案(可从http://phenix.int-evry.fr/jvet/下载,该参考文献的全部内容以引用的方式并入本文),进行了改进,如图10所述所示,具体的各可行的实施方式详见前文所述,不再赘述。A specific embodiment of the present invention implements frame rate up-conversion (FRUC) in JVET-D1001, "Algorithm Description of Joint Exploration Test Model 4" (available from http://phenix.int-evry.fr/jvet/ The entire contents of this reference are incorporated herein by reference, and are modified as shown in FIG. 10, and the specific possible implementations are described in detail above and will not be described again.
本申请是参照本申请实施例的方法和设备各自的流程图和方框图来描述的。应理解可由计算机程序指令实现流程图和方框图中的每一流程和方框、以及流程图和方框图中的流程和方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和方框图一个方框或多个方框中指定的功能的装置。 The present application is described with reference to the respective flowcharts and block diagrams of the method and apparatus of the embodiments of the present application. It will be understood that each flow and block of the flowchart illustrations. FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. A device that implements the functions specified in one or more blocks of a flowchart or a plurality of flows and block diagrams.

Claims (32)

  1. 一种基于模板匹配的预测方法,其特征在于,包括:A prediction method based on template matching, which is characterized in that it comprises:
    在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,所述当前模板包括所述待处理单元的邻域中预设位置和数量的多个重构像素,所述第一模板失真值代表所述第一匹配模板和所述当前模板的差异;Performing a matching search of the current template in the first reference image of the to-be-processed unit, obtaining first motion information, a first matching template, and a first template distortion value of the to-be-processed unit, where the current template includes the to-be-processed unit a plurality of reconstructed pixels of a preset position and number in a neighborhood, the first template distortion value representing a difference between the first matching template and the current template;
    根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新;Updating a pixel value of the current template according to a pixel value of the first matching template;
    在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,所述第二模板失真值代表所述第二匹配模板和所述更新后的当前模板的差异;Performing a matching search of the updated current template in the second reference image of the to-be-processed unit, obtaining second motion information, a second matching template, and a second template distortion value of the to-be-processed unit, where The second template distortion value represents a difference between the second matching template and the updated current template;
    当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。And when the second template distortion value is smaller than the first template distortion value, determining a weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新,包括采用如下方式对所述当前的像素值进行更新:The method according to claim 1, wherein the updating the pixel value of the current template according to the pixel value of the first matching template comprises: updating the current pixel value in the following manner:
    T1=(T0-ω0×P1)/(1-ω0),T1=(T0-ω0×P1)/(1-ω0),
    其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表所述第一匹配模板的像素值,ω0代表所述第一匹配模板对应的加权系数,ω0为小于1的正数。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, P1 represents a pixel value of the first matching template, and ω0 represents a weighting coefficient corresponding to the first matching template, Ω0 is a positive number less than one.
  3. 根据权利要求2所述的方法,其特征在于,所述ω0为0.5。The method of claim 2 wherein said ω0 is 0.5.
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,包括:The method according to any one of claims 1 to 3, wherein the matching search of the current template is performed in the first reference image of the to-be-processed unit, and the first motion information of the to-be-processed unit is obtained. A matching template and first template distortion values, including:
    在所述第一参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第一候选重构像素组合,计算所述多个第一候选重构像素组合和所述当前模板的多个第一像素差异值;Calculating, in the reconstructed pixels of the preset range of the first reference image, a plurality of first candidate reconstructed pixel combinations having the same size and shape as the current template, and calculating the plurality of first candidate reconstructed pixels Combining and a plurality of first pixel difference values of the current template;
    根据最小的所述第一像素差异值,确定所述第一模板失真值、所述第一匹配模板;Determining, according to the smallest first pixel difference value, the first template distortion value, the first matching template;
    根据所述第一匹配模板和所述当前模板的位置矢量差,和所述第一匹配模板所在的图像,确定所述第一运动信息,所述第一匹配模板包括所述第一模板失真值对应的第一候选重构像素组合。Determining the first motion information according to a position vector difference between the first matching template and the current template, and an image in which the first matching template is located, where the first matching template includes the first template distortion value Corresponding first candidate reconstructed pixel combination.
  5. 根据权利要求1至4任一项所述的方法,其特征在于,所述在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,包括:The method according to any one of claims 1 to 4, wherein the matching search of the updated current template is performed in a second reference image of the to-be-processed unit, and the to-be-processed unit is obtained. The second motion information, the second matching template, and the second template distortion value, including:
    在所述第二参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第二候选重构像素组合,计算所述多个第二候选重构像素组合和所述更新后的当前模板的多个第二像素差异值;Composing, in the reconstructed pixels of the preset range of the second reference image, a plurality of second candidate reconstructed pixel combinations having the same size and shape as the current template, and calculating the plurality of second candidate reconstructed pixels Combining and a plurality of second pixel difference values of the updated current template;
    根据最小的所述第二像素差异值,确定所述第二模板失真值、所述第二匹配模板;Determining, according to the smallest second pixel difference value, the second template distortion value and the second matching template;
    根据所述第二匹配模板和所述更新后的当前模板的位置矢量差,和所述第二匹配模板所在的图像,确定所述第二运动信息,所述第二匹配模板包括所述第二模板失真值对应的第二候选重构像素组合。 Determining the second motion information according to a position vector difference between the second matching template and the updated current template, and an image of the second matching template, where the second matching template includes the second A second candidate reconstructed pixel combination corresponding to the template distortion value.
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,包括:The method according to any one of claims 1 to 5, wherein the determining the weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information comprises:
    根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的第一向预测值;Obtaining, in the first reference image, a first predicted value of the to-be-processed unit according to the first motion information;
    根据所述第二运动信息,在所述第二参考图像中,获得所述待处理单元的第二向预测值;Obtaining, in the second reference image, a second prediction value of the to-be-processed unit according to the second motion information;
    对所述第一向预测值和所述第二向预测值进行加权计算,获得所述待处理单元的加权预测值。Weighting the first predicted value and the second predicted value to obtain a weighted predicted value of the to-be-processed unit.
  7. 根据权利要求1至6任一项所述的方法,其特征在于,在所述待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息和第一匹配模板之后,还包括:The method according to any one of claims 1 to 6, wherein a matching search of the current template is performed in the first reference image of the to-be-processed unit, and the first motion information and the first After matching the template, it also includes:
    在第三参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第三候选重构像素组合,计算所述多个第三候选重构像素组合和所述当前模板的多个第三像素差异值;Composing, in a reconstructed pixel of a preset range of the third reference image, a plurality of third candidate reconstructed pixel combinations having the same size and shape as the current template, calculating the plurality of third candidate reconstructed pixel combinations and a plurality of third pixel difference values of the current template;
    根据最小的所述第三像素差异值,确定所述第三模板失真值、所述第三匹配模板;Determining, according to the smallest third pixel difference value, the third template distortion value and the third matching template;
    根据所述第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息,所述第三匹配模板包括所述第三模板失真值对应的第三候选重构像素组合。Determining, according to the position vector difference of the third matching template and the current template, and the image of the third matching template, the third motion template, where the third matching template includes the third template distortion value Corresponding third candidate reconstructed pixel combination.
  8. 根据权利要求7所述的方法,其特征在于,在所述根据第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息之后,当所述第三模板失真值小于或等于所述第一模板失真值时,还包括:The method according to claim 7, wherein after the third motion information is determined according to the position vector difference of the third matching template and the current template, and the image of the third matching template And when the third template distortion value is less than or equal to the first template distortion value, the method further includes:
    将所述第三参考图像作为所述第一参考图像;Using the third reference image as the first reference image;
    将所述第三运动信息作为所述第一运动信息;Using the third motion information as the first motion information;
    将所述第三模板失真值作为所述第一模板失真值;Using the third template distortion value as the first template distortion value;
    将所述第三匹配模板作为所述第一匹配模板。The third matching template is used as the first matching template.
  9. 根据权利要求5至8任一项所述的方法,其特征在于,当所述第二模板失真值不小于所述第一模板失真值时,所述方法还包括:The method according to any one of claims 5 to 8, wherein when the second template distortion value is not less than the first template distortion value, the method further comprises:
    根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。And obtaining, according to the first motion information, a predicted value of the to-be-processed unit in the first reference image.
  10. 根据权利要求7至8任一项所述的方法,其特征在于,所述当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,包括:The method according to any one of claims 7 to 8, wherein when the second template distortion value is smaller than the first template distortion value, according to the first motion information and the second The motion information determines a weighted prediction value of the to-be-processed unit, including:
    当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。When the second template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, the weighted prediction value is used as a prediction of the to-be-processed unit value.
  11. 根据权利要求10所述的方法,其特征在于,还包括:The method of claim 10, further comprising:
    当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,When the first template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, according to the first motion information, in the first reference Obtaining a predicted value of the to-be-processed unit in an image; or
    当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。 And when the third template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, according to the third motion information, in the third reference In the image, the predicted value of the unit to be processed is obtained.
  12. 根据权利要求7至11任一项所述的方法,其特征在于,包括:The method according to any one of claims 7 to 11, comprising:
    当所述第一参考图像来自于所述待处理单元的前向参考图像列表时,所述第三参考图像来自于所述待处理单元的后向参考图像列表;或者,当所述第一参考图像来自于所述待处理单元的后向参考图像列表时,所述第三参考图像来自于所述待处理单元的前向参考图像列表。When the first reference image is from a forward reference image list of the to-be-processed unit, the third reference image is from a backward reference image list of the to-be-processed unit; or, when the first reference When the image is from the backward reference image list of the to-be-processed unit, the third reference image is from the forward reference image list of the to-be-processed unit.
  13. 根据权利要求2至12任一项所述的方法,其特征在于,在所述在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值之后,还包括:The method according to any one of claims 2 to 12, wherein the matching search of the updated current template is performed in the second reference image of the to-be-processed unit, and the to-be-processed is obtained. After the second motion information, the second matching template, and the second template distortion value of the unit, the method further includes:
    根据所述加权系数对所述第二模板失真值进行更新,所述更新后的第二模板失真值为(1-ω0)倍的所述第二模板失真值;And updating the second template distortion value according to the weighting coefficient, where the updated second template distortion value is (1-ω0) times the second template distortion value;
    对应的,所述当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,包括:Correspondingly, when the second template distortion value is smaller than the first template distortion value, determining, according to the first motion information and the second motion information, a weighted prediction value of the to-be-processed unit, including :
    当所述更新后的第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。And when the updated second template distortion value is smaller than the first template distortion value, determining a weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information.
  14. 根据权利要求13所述的方法,其特征在于,当所述更新后的第二模板失真值不小于所述第一模板失真值时,所述方法还包括:The method according to claim 13, wherein when the updated second template distortion value is not less than the first template distortion value, the method further comprises:
    根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。And obtaining, according to the first motion information, a predicted value of the to-be-processed unit in the first reference image.
  15. 根据权利要求13或14所述的方法,其特征在于,当所述更新后的第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值,包括:The method according to claim 13 or 14, wherein when the updated second template distortion value is smaller than the first template distortion value, according to the first motion information and the second motion information Determining the weighted prediction value of the to-be-processed unit, including:
    当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述更新后的第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。When the updated second template distortion value is the smallest among the first template distortion value, the updated second template distortion value, and the third template distortion value, the weighted prediction value is taken as The predicted value of the processing unit is mentioned.
  16. 根据权利要求15所述的方法,其特征在于,还包括:The method of claim 15 further comprising:
    当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,And when the first template distortion value is the smallest among the first template distortion value, the updated second template distortion value, and the third template distortion value, according to the first motion information, Obtaining a predicted value of the to-be-processed unit in the first reference image; or
    当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。And when the third template distortion value is the smallest among the first template distortion value, the updated second template distortion value, and the third template distortion value, according to the third motion information, In the third reference image, the predicted value of the to-be-processed unit is obtained.
  17. 一种基于模板匹配的预测装置,其特征在于,包括:A prediction device based on template matching, comprising:
    搜索单元,用于在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值,所述当前模板包括所述待处理单元的邻域中预设位置和数量的多个重构像素,所述第一模板失真值代表所述第一匹配模板和所述当前模板的差异;a search unit, configured to perform a matching search of the current template in the first reference image of the to-be-processed unit, to obtain first motion information, a first matching template, and a first template distortion value of the to-be-processed unit, where the current template includes a plurality of reconstructed pixels of a preset position and number in a neighborhood of the to-be-processed unit, where the first template distortion value represents a difference between the first matching template and the current template;
    更新单元,用于根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新;An updating unit, configured to update, according to a pixel value of the first matching template, a pixel value of the current template;
    所述搜索单元,还用于在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值,所述第二模板失真值代表所述第二匹配模板和所述更新后的当前模板的差异;The searching unit is further configured to perform a matching search of the updated current template in a second reference image of the to-be-processed unit, to obtain second motion information, a second matching template, and a second a second template distortion value, the second template distortion value representing a difference between the second matching template and the updated current template;
    确定单元,用于当所述第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。 a determining unit, configured to determine, according to the first motion information and the second motion information, a weighted prediction value of the to-be-processed unit when the second template distortion value is smaller than the first template distortion value.
  18. 根据权利要求17所述的装置,其特征在于,所述更新单元在根据所述第一匹配模板的像素值对所述当前模板的像素值进行更新时,包括采用如下方式对所述当前的像素值进行更新:The device according to claim 17, wherein the updating unit, when updating the pixel value of the current template according to the pixel value of the first matching template, comprises: using the following manner to the current pixel The value is updated:
    T1=(T0-ω0×P1)/(1-ω0),T1=(T0-ω0×P1)/(1-ω0),
    其中,T1代表所述更新后的当前模板的像素值,T0代表所述当前模板的像素值,P1代表所述第一匹配模板的像素值,ω0代表所述第一匹配模板对应的加权系数,ω0为小于1的正数。Wherein, T1 represents a pixel value of the updated current template, T0 represents a pixel value of the current template, P1 represents a pixel value of the first matching template, and ω0 represents a weighting coefficient corresponding to the first matching template, Ω0 is a positive number less than one.
  19. 根据权利要求18所述的装置,其特征在于,所述ω0为0.5。The apparatus of claim 18 wherein said ω0 is 0.5.
  20. 根据权利要求17至19任一项所述的装置,其特征在于,所述搜索单元在待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息、第一匹配模板和第一模板失真值时,具体用于:The device according to any one of claims 17 to 19, wherein the search unit performs a matching search of the current template in the first reference image of the to-be-processed unit, and obtains the first motion information of the to-be-processed unit. When the first matching template and the first template distortion value are used, specifically:
    在所述第一参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第一候选重构像素组合,计算所述多个第一候选重构像素组合和所述当前模板的多个第一像素差异值;Calculating, in the reconstructed pixels of the preset range of the first reference image, a plurality of first candidate reconstructed pixel combinations having the same size and shape as the current template, and calculating the plurality of first candidate reconstructed pixels Combining and a plurality of first pixel difference values of the current template;
    根据最小的所述第一像素差异值,确定所述第一模板失真值、所述第一匹配模板;Determining, according to the smallest first pixel difference value, the first template distortion value, the first matching template;
    根据所述第一匹配模板和所述当前模板的位置矢量差,和所述第一匹配模板所在的图像,确定所述第一运动信息,所述第一匹配模板包括所述第一模板失真值对应的第一候选重构像素组合。Determining the first motion information according to a position vector difference between the first matching template and the current template, and an image in which the first matching template is located, where the first matching template includes the first template distortion value Corresponding first candidate reconstructed pixel combination.
  21. 根据权利要求17至20任一项所述的装置,其特征在于,所述搜索单元在所述待处理单元的第二参考图像中进行所述更新后的当前模板的匹配搜索,获得所述待处理单元的第二运动信息、第二匹配模板和第二模板失真值时,具体用于:The device according to any one of claims 17 to 20, wherein the searching unit performs a matching search of the updated current template in a second reference image of the to-be-processed unit, and obtains the waiting When the second motion information, the second matching template, and the second template distortion value of the processing unit are used, specifically:
    在所述第二参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状的多个第二候选重构像素组合,计算所述多个第二候选重构像素组合和所述更新后的当前模板的多个第二像素差异值;Composing, in the reconstructed pixels of the preset range of the second reference image, a plurality of second candidate reconstructed pixel combinations having the same size and shape as the current template, and calculating the plurality of second candidate reconstructed pixels Combining and a plurality of second pixel difference values of the updated current template;
    根据最小的所述第二像素差异值,确定所述第二模板失真值、所述第二匹配模板;Determining, according to the smallest second pixel difference value, the second template distortion value and the second matching template;
    根据所述第二匹配模板和所述更新后的当前模板的位置矢量差,和所述第二匹配模板所在的图像,确定所述第二运动信息,所述第二匹配模板包括所述第二模板失真值对应的第二候选重构像素组合。Determining the second motion information according to a position vector difference between the second matching template and the updated current template, and an image of the second matching template, where the second matching template includes the second A second candidate reconstructed pixel combination corresponding to the template distortion value.
  22. 根据权利要求17至21任一项所述的装置,其特征在于,所述确定单元在根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值时,具体用于:The apparatus according to any one of claims 17 to 21, wherein the determining unit determines a weighted prediction value of the to-be-processed unit according to the first motion information and the second motion information, Specifically used for:
    根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的第一向预测值;Obtaining, in the first reference image, a first predicted value of the to-be-processed unit according to the first motion information;
    根据所述第二运动信息,在所述第二参考图像中,获得所述待处理单元的第二向预测值;Obtaining, in the second reference image, a second prediction value of the to-be-processed unit according to the second motion information;
    对所述第一向预测值和所述第二向预测值进行加权计算,获得所述待处理单元的加权预测值。Weighting the first predicted value and the second predicted value to obtain a weighted predicted value of the to-be-processed unit.
  23. 根据权利要求17至22任一项所述的装置,其特征在于,所述搜索单元在所述待处理单元的第一参考图像中进行当前模板的匹配搜索,获得所述待处理单元的第一运动信息和第一匹配模板之后,还用于:The device according to any one of claims 17 to 22, wherein the search unit performs a matching search of the current template in the first reference image of the to-be-processed unit, and obtains the first of the to-be-processed unit. After the motion information and the first matching template, it is also used to:
    在第三参考图像的预设范围的重构像素中,遍历和所述当前模板具有相同尺寸和形状 的多个第三候选重构像素组合,计算所述多个第三候选重构像素组合和所述当前模板的多个第三像素差异值;In the reconstructed pixels of the preset range of the third reference image, the traversal and the current template have the same size and shape And calculating, by the plurality of third candidate reconstructed pixel combinations, the plurality of third candidate reconstructed pixel combinations and the plurality of third pixel difference values of the current template;
    根据最小的所述第三像素差异值,确定所述第三模板失真值、所述第三匹配模板;Determining, according to the smallest third pixel difference value, the third template distortion value and the third matching template;
    根据所述第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息,所述第三匹配模板包括所述第三模板失真值对应的第三候选重构像素组合。Determining, according to the position vector difference of the third matching template and the current template, and the image of the third matching template, the third motion template, where the third matching template includes the third template distortion value Corresponding third candidate reconstructed pixel combination.
  24. 根据权利要求23所述的装置,其特征在于,所述搜索单元在所述根据第三匹配模板和所述当前模板的位置矢量差,和所述第三匹配模板所在的图像,确定所述第三运动信息之后,当所述第三模板失真值小于或等于所述第一模板失真值时,还用于:The apparatus according to claim 23, wherein said searching unit determines said number in said image according to a position vector difference of said third matching template and said current template, and said image of said third matching template After the three motion information, when the third template distortion value is less than or equal to the first template distortion value, it is further used for:
    将所述第三参考图像作为所述第一参考图像;Using the third reference image as the first reference image;
    将所述第三运动信息作为所述第一运动信息;Using the third motion information as the first motion information;
    将所述第三模板失真值作为所述第一模板失真值;Using the third template distortion value as the first template distortion value;
    将所述第三匹配模板作为所述第一匹配模板。The third matching template is used as the first matching template.
  25. 根据权利要求21至24任一项所述的装置,其特征在于,在当所述第二模板失真值不小于所述第一模板失真值时,所述确定单元具体用于:The device according to any one of claims 21 to 24, wherein when the second template distortion value is not less than the first template distortion value, the determining unit is specifically configured to:
    根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。And obtaining, according to the first motion information, a predicted value of the to-be-processed unit in the first reference image.
  26. 根据权利要求23至25任一项所述的装置,其特征在于,当所述第二模板失真值小于所述第一模板失真值时,所述确定单元具体用于:The device according to any one of claims 23 to 25, wherein when the second template distortion value is smaller than the first template distortion value, the determining unit is specifically configured to:
    当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。When the second template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, the weighted prediction value is used as a prediction of the to-be-processed unit value.
  27. 根据权利要求26所述的装置,其特征在于,所述确定单元具体用于:The device according to claim 26, wherein the determining unit is specifically configured to:
    当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,When the first template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, according to the first motion information, in the first reference Obtaining a predicted value of the to-be-processed unit in an image; or
    当所述第一模板失真值、所述第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。And when the third template distortion value is the smallest among the first template distortion value, the second template distortion value, and the third template distortion value, according to the third motion information, in the third reference In the image, the predicted value of the unit to be processed is obtained.
  28. 根据权利要求23至27任一项所述的装置,其特征在于,包括:The device according to any one of claims 23 to 27, comprising:
    当所述第一参考图像来自于所述待处理单元的前向参考图像列表时,所述第三参考图像来自于所述待处理单元的后向参考图像列表;或者,当所述第一参考图像来自于所述待处理单元的后向参考图像列表时,所述第三参考图像来自于所述待处理单元的前向参考图像列表。When the first reference image is from a forward reference image list of the to-be-processed unit, the third reference image is from a backward reference image list of the to-be-processed unit; or, when the first reference When the image is from the backward reference image list of the to-be-processed unit, the third reference image is from the forward reference image list of the to-be-processed unit.
  29. 根据权利要求18至28任一项所述的装置,其特征在于,所述更新单元还用于:The device according to any one of claims 18 to 28, wherein the updating unit is further configured to:
    根据所述加权系数对所述第二模板失真值进行更新,所述更新后的第二模板失真值为(1-ω0)倍的所述第二模板失真值;And updating the second template distortion value according to the weighting coefficient, where the updated second template distortion value is (1-ω0) times the second template distortion value;
    对应的,所述确定单元用于当所述更新后的第二模板失真值小于所述第一模板失真值时,根据所述第一运动信息和所述第二运动信息,确定所述待处理单元的加权预测值。Correspondingly, the determining unit is configured to determine, according to the first motion information and the second motion information, that the to-be-processed when the updated second template distortion value is smaller than the first template distortion value The weighted prediction of the unit.
  30. 根据权利要求29所述的装置,其特征在于,当所述更新后的第二模板失真值不小于所述第一模板失真值时,所述确定单元还用于:The apparatus according to claim 29, wherein when the updated second template distortion value is not less than the first template distortion value, the determining unit is further configured to:
    根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值。 And obtaining, according to the first motion information, a predicted value of the to-be-processed unit in the first reference image.
  31. 根据权利要求29或30所述的装置,其特征在于,当所述更新后的第二模板失真值小于所述第一模板失真值时,所述确定单元具体用于:The device according to claim 29 or 30, wherein, when the updated second template distortion value is smaller than the first template distortion value, the determining unit is specifically configured to:
    当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述更新后的第二模板失真值最小时,将所述加权预测值作为所述待处理单元的预测值。When the updated second template distortion value is the smallest among the first template distortion value, the updated second template distortion value, and the third template distortion value, the weighted prediction value is taken as The predicted value of the processing unit is mentioned.
  32. 根据权利要求31所述的装置,其特征在于,还包括:The device according to claim 31, further comprising:
    当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述第一模板失真值最小时,根据所述第一运动信息,在所述第一参考图像中,获得所述待处理单元的预测值;或者,And when the first template distortion value is the smallest among the first template distortion value, the updated second template distortion value, and the third template distortion value, according to the first motion information, Obtaining a predicted value of the to-be-processed unit in the first reference image; or
    当所述第一模板失真值、所述更新后的第二模板失真值和所述第三模板失真值中,所述第三模板失真值最小时,根据所述第三运动信息,在所述第三参考图像中,获得所述待处理单元的预测值。 And when the third template distortion value is the smallest among the first template distortion value, the updated second template distortion value, and the third template distortion value, according to the third motion information, In the third reference image, the predicted value of the to-be-processed unit is obtained.
PCT/CN2017/070735 2016-12-26 2017-01-10 Prediction method and device based on template matching WO2018120290A1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/CN2017/076043 WO2018120420A1 (en) 2016-12-26 2017-03-09 Prediction method and device based on template matching
CN201780049111.3A CN109565601B (en) 2016-12-26 2017-03-09 Template matching-based prediction method and device
US16/452,082 US20190320205A1 (en) 2016-12-26 2019-06-25 Template matching-based prediction method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CNPCT/CN2016/112200 2016-12-26
CN2016112200 2016-12-26

Publications (1)

Publication Number Publication Date
WO2018120290A1 true WO2018120290A1 (en) 2018-07-05

Family

ID=62706691

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/070735 WO2018120290A1 (en) 2016-12-26 2017-01-10 Prediction method and device based on template matching

Country Status (1)

Country Link
WO (1) WO2018120290A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109544509A (en) * 2018-10-22 2019-03-29 中国地质大学(武汉) One kind is based on the matched workpiece localization method of secondary template, equipment and storage equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090180538A1 (en) * 2008-01-16 2009-07-16 The Regents Of The University Of California Template matching scheme using multiple predictors as candidates for intra-prediction
CN101931803A (en) * 2009-06-26 2010-12-29 华为技术有限公司 Method, device and equipment for acquiring motion information of video image and template constructing method
CN102067601A (en) * 2008-04-11 2011-05-18 汤姆森特许公司 Methods and apparatus for template matching prediction (TMP) in video encoding and decoding
CN102215407A (en) * 2010-04-09 2011-10-12 华为技术有限公司 Bilaterally predicted block acquisition method, device and image decoding method
CN102215386A (en) * 2010-04-09 2011-10-12 华为技术有限公司 Video image block processing method and device
CN105791823A (en) * 2009-12-08 2016-07-20 汤姆森特许公司 Methods and apparatus for adaptive template matching prediction for video encoding and decoding

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090180538A1 (en) * 2008-01-16 2009-07-16 The Regents Of The University Of California Template matching scheme using multiple predictors as candidates for intra-prediction
CN102067601A (en) * 2008-04-11 2011-05-18 汤姆森特许公司 Methods and apparatus for template matching prediction (TMP) in video encoding and decoding
CN101931803A (en) * 2009-06-26 2010-12-29 华为技术有限公司 Method, device and equipment for acquiring motion information of video image and template constructing method
CN105791823A (en) * 2009-12-08 2016-07-20 汤姆森特许公司 Methods and apparatus for adaptive template matching prediction for video encoding and decoding
CN102215407A (en) * 2010-04-09 2011-10-12 华为技术有限公司 Bilaterally predicted block acquisition method, device and image decoding method
CN102215386A (en) * 2010-04-09 2011-10-12 华为技术有限公司 Video image block processing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109544509A (en) * 2018-10-22 2019-03-29 中国地质大学(武汉) One kind is based on the matched workpiece localization method of secondary template, equipment and storage equipment

Similar Documents

Publication Publication Date Title
US11039144B2 (en) Method and apparatus for image coding and decoding through inter-prediction
US11558623B2 (en) Bidirectional inter prediction method and terminal based on motion vector difference reduction
WO2019001024A1 (en) Method for determining motion vector predicted value and related device
US11818379B2 (en) Picture encoding and decoding method and apparatus for video sequence
WO2019114294A1 (en) Image coding and encoding method, device and system, and storage medium
WO2019169949A1 (en) Method for generating predicted motion vector and related apparatus
WO2019109955A1 (en) Interframe prediction method and apparatus, and terminal device
WO2019091372A1 (en) Image prediction method and device
WO2018120420A1 (en) Prediction method and device based on template matching
WO2018119609A1 (en) Template matching-based encoding and decoding method and device
WO2018120290A1 (en) Prediction method and device based on template matching
JP7388610B2 (en) Video encoding method, video decoding method, and terminal
JP6968228B2 (en) Methods and equipment for image coding and decoding via inter-prediction
KR20240027618A (en) Context-based image coding
BR112019006146B1 (en) VIDEO ENCODING METHOD, VIDEO DECODING METHOD, AND TERMINAL

Legal Events

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

Ref document number: 17886031

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: 17886031

Country of ref document: EP

Kind code of ref document: A1