[go: up one dir, main page]

CN114666600B - Data encoding method and device based on irregular template, electronic equipment and medium - Google Patents

Data encoding method and device based on irregular template, electronic equipment and medium Download PDF

Info

Publication number
CN114666600B
CN114666600B CN202210133940.2A CN202210133940A CN114666600B CN 114666600 B CN114666600 B CN 114666600B CN 202210133940 A CN202210133940 A CN 202210133940A CN 114666600 B CN114666600 B CN 114666600B
Authority
CN
China
Prior art keywords
encoding
template
coding
pixel
coded
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210133940.2A
Other languages
Chinese (zh)
Other versions
CN114666600A (en
Inventor
高文
任荟文
王苫社
马思伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University
Original Assignee
Peking University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University filed Critical Peking University
Priority to CN202210133940.2A priority Critical patent/CN114666600B/en
Publication of CN114666600A publication Critical patent/CN114666600A/en
Application granted granted Critical
Publication of CN114666600B publication Critical patent/CN114666600B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/182Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a pixel
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/184Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression

Landscapes

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

Abstract

本申请公开了一种基于不规则模板的数据编码方法、装置、电子设备及介质。通过应用本申请的技术方案,可以在获取到待编码区域之后,利用预先设计的多种不规则形状的模板分别对该待编码区域进行模板内部像素的匹配以及模板间的匹配,进而提供一种更紧凑的编码数据表达形式,改善因预测不准确带来的系数损失导致的解码重构图像质量低的问题。

Figure 202210133940

The application discloses a data encoding method, device, electronic equipment and medium based on an irregular template. By applying the technical solution of the present application, after obtaining the region to be coded, a variety of pre-designed templates of irregular shapes can be used to perform matching of pixels inside the template and between templates for the region to be coded, thereby providing a A more compact coded data expression form can improve the problem of low quality of decoded and reconstructed images caused by coefficient loss caused by inaccurate prediction.

Figure 202210133940

Description

基于不规则模板的数据编码方法、装置、电子设备及介质Data encoding method, device, electronic equipment and medium based on irregular template

技术领域technical field

本申请中涉及数据处理技术,尤其是一种基于不规则模板的数据编码方法、装置、电子设备及介质。This application relates to data processing technology, especially a data encoding method, device, electronic equipment and medium based on an irregular template.

背景技术Background technique

随着图像和视频应用的不断普及,视频轻压缩技术也在不断的迭代与创新。常见的视频轻压缩标准如DSC、VDC-M、Apple ProRes和JPEG-XS等分别被广泛应用在HDMI、DP等显示接口领域和图像视频等制作领域。With the continuous popularization of image and video applications, video light compression technology is also constantly iterating and innovating. Common video light compression standards such as DSC, VDC-M, Apple ProRes and JPEG-XS are widely used in display interface fields such as HDMI and DP, and image and video production fields.

其中,一般的视频轻压缩标准的主要目的是在满足低延时、低复杂度和主观无损的条件下实现4~16倍的数据压缩。以较为通用的DSC1编码标准为例,其压缩过程主要包含有输入输出、缓存分片、预测、量化、重构、熵编码、码率控制和码流合成等步骤。Among them, the main purpose of general video light compression standards is to achieve 4 to 16 times data compression under the conditions of low delay, low complexity and subjective losslessness. Taking the more common DSC1 coding standard as an example, its compression process mainly includes steps such as input and output, cache fragmentation, prediction, quantization, reconstruction, entropy coding, bit rate control, and bit stream synthesis.

然而,相关技术中的编码方法在像素预测过程中通常会出现有参数损失较大的问题。这也导致影响用户体验。However, the encoding method in the related art usually has a problem of large parameter loss in the process of pixel prediction. This also leads to affecting user experience.

发明内容Contents of the invention

本申请实施例提供一种基于不规则模板的数据编码方法、装置、电子设备及介质。用以解决相关技术中存在的编码方法在像素预测过程中通常会出现有参数损失较大进而导致影响用户浏览体验的问题。Embodiments of the present application provide a data encoding method, device, electronic device, and medium based on an irregular template. It is used to solve the problem that the encoding method in the related art usually has a large parameter loss during the pixel prediction process, which affects the browsing experience of the user.

其中,根据本申请实施例的一个方面,提供的一种基于不规则模板的数据编码方法,包括:Among them, according to an aspect of the embodiment of the present application, a data encoding method based on an irregular template is provided, including:

分别确定每个待编码区域对应的编码参数,所述编码参数包括所述待编码区域中的像素位置、至少一个编码模板以及参考像素队列,所述编码模板为对应于不规则形状的模板;Respectively determine encoding parameters corresponding to each area to be encoded, the encoding parameters include pixel positions in the area to be encoded, at least one encoding template, and a reference pixel queue, the encoding template is a template corresponding to an irregular shape;

基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对所述待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;Based on the predetermined intra-template matching rules, inter-encoding matching rules, and reference pixel queues, each encoding template is used to perform predictive encoding on the pixels in the region to be encoded, and an encoding result corresponding to each encoding template is obtained;

选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用所述最优预测方式对所述每个待编码区域进行预测编码。Select the prediction mode with the smallest code rate and distortion cost in the encoding result as the optimal prediction mode, and use the optimal prediction mode to perform predictive encoding on each region to be encoded.

可选地,在基于本申请上述方法的另一个实施例中,在所述确定待编码区域对应的编码参数之后,还包括:Optionally, in another embodiment based on the above method of the present application, after determining the encoding parameters corresponding to the region to be encoded, further includes:

确定每个编码模板的内部编码顺序;以及,确定各个编码模板之间的编码顺序;determining the internal encoding order of each encoding template; and, determining the encoding order among the individual encoding templates;

基于所述各个编码模板之间的编码顺序,依序对每个待编码区域进行预测编码;以及,Sequentially perform predictive coding on each region to be coded based on the coding order among the coding templates; and,

基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码。Based on the internal coding order of each coding template, sequentially perform predictive coding on each pixel in the region to be coded.

可选地,在基于本申请上述方法的另一个实施例中,所述基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码,包括:Optionally, in another embodiment based on the above-mentioned method of the present application, performing predictive coding on each pixel in the region to be coded sequentially based on the internal coding sequence of each coding template includes:

检测当前的编码模板是否为首个编码模板;Detect whether the current coding template is the first coding template;

若是,按照所述内部编码顺序,对除所述待编码区域中的首个像素之外的其他像素以像素默认值作为预测值进行预测编码,其中所述像素默认值为对应编码模板中的最大像素值的一半;If so, according to the internal encoding order, predictive encoding is performed on other pixels except the first pixel in the area to be encoded, using the pixel default value as the predicted value, wherein the pixel default value is the largest pixel in the corresponding encoding template. half of the pixel value;

若否,按照所述内部编码顺序对所述待编码区域中的像素进行预测编码。If not, perform predictive coding on the pixels in the region to be coded according to the internal coding sequence.

可选地,在基于本申请上述方法的另一个实施例中,所述基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码,包括:Optionally, in another embodiment based on the above-mentioned method of the present application, performing predictive coding on each pixel in the region to be coded sequentially based on the internal coding sequence of each coding template includes:

利用至少一个参考像素的重构值对所述待编码区域中的每个像素进行预测编码,其中所述参考像素为与当前待编码像素相邻的已编码像素Perform predictive coding on each pixel in the region to be coded by using the reconstructed value of at least one reference pixel, where the reference pixel is a coded pixel adjacent to the current pixel to be coded

可选地,在基于本申请上述方法的另一个实施例中,在所述得到每个编码模板对应的编码结果之后,还包括:Optionally, in another embodiment based on the above-mentioned method of the present application, after obtaining the coding result corresponding to each coding template, it further includes:

将每个编码模板经过平移、旋转、缩放并与当前编码区域重合后,计算编码模板对应的编码结果与对应的原始待编码区域之间,每个对应像素之间的残差值;After each encoding template is translated, rotated, scaled and coincident with the current encoding area, calculate the residual value between each corresponding pixel between the encoding result corresponding to the encoding template and the corresponding original area to be encoded;

根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板。According to the residual value, a target coding template whose coding result meets a preset residual condition is selected as an optimal coding template of the region to be coded.

可选地,在基于本申请上述方法的另一个实施例中,所述根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板,包括:Optionally, in another embodiment based on the above method of the present application, according to the residual value, the target coding template whose coding result reaches the preset residual condition is selected as the optimal coding template of the region to be coded ,include:

遍历计算每个编码模板对应的编码结果与对应的原始待编码区域之间的残差总值与残差均值,并按照各个残差总值与残差均值的大小关系,对每个编码模板进行码率和失真代价的排序;Iteratively calculate the total residual value and residual mean value between the coding result corresponding to each coding template and the corresponding original area to be coded, and perform a process for each coding template according to the relationship between the total residual value and the residual mean value. Sorting of code rate and distortion cost;

选取其中码率和失真代价最小的预测方式作为最优预测方式。The prediction method with the smallest bit rate and distortion cost is selected as the optimal prediction method.

其中,根据本申请实施例的又一个方面,提供的一种基于不规则模板的数据编码装置,其特征在于,包括:Among them, according to another aspect of the embodiment of the present application, a data encoding device based on an irregular template is provided, which is characterized in that it includes:

确定模块,被配置为分别确定每个待编码区域对应的编码参数,所述编码参数包括所述待编码区域中的像素位置、至少一个编码模板以及参考像素队列,所述编码模板为对应于不规则形状的模板;The determining module is configured to separately determine encoding parameters corresponding to each area to be encoded, the encoding parameters include pixel positions in the area to be encoded, at least one encoding template, and a reference pixel queue, the encoding templates are corresponding to different regular shaped templates;

编码模块,被配置为基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对所述待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;The encoding module is configured to use each encoding template to perform predictive encoding on the pixels in the area to be encoded based on the predetermined intra-template matching rules, inter-encoding matching rules, and reference pixel queues, to obtain the pixels corresponding to each encoding template. encoding result;

选取模块,被配置为选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用所述最优预测方式对所述每个待编码区域进行预测编码。The selection module is configured to select the prediction mode with the smallest code rate and distortion cost in the encoding result as the optimal prediction mode, and use the optimal prediction mode to perform predictive encoding on each region to be encoded.

根据本申请实施例的又一个方面,提供的一种电子设备,包括:According to still another aspect of the embodiments of the present application, an electronic device is provided, including:

存储器,用于存储可执行指令;以及memory for storing executable instructions; and

显示器,用于与所述存储器以执行所述可执行指令从而完成上述任一所述基于不规则模板的数据编码方法的操作。The display is configured to cooperate with the memory to execute the executable instructions to complete the operation of any one of the irregular template-based data encoding methods described above.

根据本申请实施例的还一个方面,提供的一种计算机可读存储介质,用于存储计算机可读取的指令,所述指令被执行时执行上述任一所述基于不规则模板的数据编码方法的操作。According to still another aspect of the embodiments of the present application, there is provided a computer-readable storage medium for storing computer-readable instructions, and when the instructions are executed, any one of the above-mentioned data encoding methods based on irregular templates is performed operation.

本申请中,可以分别确定每个待编码区域对应的编码参数,编码参数包括待编码区域中的像素位置、至少一个编码模板以及参考像素队列,编码模板为对应于不规则形状的模板;基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用最优预测方式对所述每个待编码区域进行预测编码。通过应用本申请的技术方案,可以在获取到待编码区域之后,利用预先设计的多种不规则形状的模板分别对该待编码区域进行模板内部像素的匹配以及模板间的匹配,进而提供一种更紧凑的编码数据表达形式,改善因预测不准确带来的系数损失导致的解码重构图像质量低的问题。In the present application, the encoding parameters corresponding to each area to be encoded can be respectively determined, and the encoding parameters include pixel positions in the area to be encoded, at least one encoding template and a reference pixel queue, and the encoding template is a template corresponding to an irregular shape; The determined intra-template matching rules, inter-encoding matching rules, and reference pixel queues use each encoding template to perform predictive encoding on the pixels in the area to be encoded, and obtain the encoding result corresponding to each encoding template; select the code rate and distortion in the encoding result The prediction mode with the least cost is used as the optimal prediction mode, and the optimal prediction mode is used to perform predictive encoding on each region to be encoded. By applying the technical solution of the present application, after the region to be coded is obtained, a variety of pre-designed templates of irregular shapes can be used to perform matching of pixels inside the template and between templates for the region to be coded, thereby providing a A more compact coded data expression form can improve the problem of low quality of decoded and reconstructed images caused by coefficient loss caused by inaccurate prediction.

下面通过附图和实施例,对本申请的技术方案做进一步的详细描述。The technical solutions of the present application will be described in further detail below with reference to the drawings and embodiments.

附图说明Description of drawings

构成说明书的一部分的附图描述了本申请的实施例,并且连同描述一起用于解释本申请的原理。The accompanying drawings, which constitute a part of this specification, illustrate the embodiments of the application and, together with the description, serve to explain the principles of the application.

参照附图,根据下面的详细描述,可以更加清楚地理解本申请,其中:The present application can be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

图1为本申请提出的一种基于不规则模板的数据编码方法示意图;Fig. 1 is a schematic diagram of a data encoding method based on an irregular template proposed by the present application;

图2为本申请提出的一种编码方法示意图;Fig. 2 is a schematic diagram of a coding method proposed by the present application;

图3-4为本申请提出的一种基于不规则模板的数据编码流程架构示意图;Figure 3-4 is a schematic diagram of a data encoding process architecture based on an irregular template proposed by the present application;

图5为本申请提出的一种基于不规则模板的数据编码电子装置的结构示意图;FIG. 5 is a schematic structural diagram of a data encoding electronic device based on an irregular template proposed by the present application;

图6为本申请提出的一种基于不规则模板的数据编码电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an irregular template-based data encoding electronic device proposed in the present application.

具体实施方式Detailed ways

现在将参照附图来详细描述本申请的各种示例性实施例。应注意到:除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对布置、数字表达式和数值不限制本申请的范围。Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangements of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present application unless specifically stated otherwise.

同时,应当明白,为了便于描述,附图中所示出的各个部分的尺寸并不是按照实际的比例关系绘制的。At the same time, it should be understood that, for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

以下对至少一个示例性实施例的描述实际上仅仅是说明性的,不作为对本申请及其应用或使用的任何限制。The following description of at least one exemplary embodiment is merely illustrative in nature and not intended as any limitation of the application, its application or uses.

对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,所述技术、方法和设备应当被视为说明书的一部分。Techniques, methods and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, such techniques, methods and devices should be considered part of the description.

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。It should be noted that like numerals and letters denote like items in the following figures, therefore, once an item is defined in one figure, it does not require further discussion in subsequent figures.

另外,本申请各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。In addition, the technical solutions of the various embodiments of the present application can be combined with each other, but it must be based on the realization of those skilled in the art. When the combination of technical solutions is contradictory or cannot be realized, it should be considered as a combination of technical solutions. Does not exist, nor is it within the scope of protection required by this application.

需要说明的是,本申请实施例中所有方向性指示(诸如上、下、左、右、前、后……)仅用于解释在某一特定姿态(如附图所示)下各部件之间的相对位置关系、运动情况等,如果该特定姿态发生改变时,则该方向性指示也相应地随之改变。It should be noted that all directional indications (such as up, down, left, right, front, back...) in the embodiments of the present application are only used to explain If the specific posture changes, the directional indication will also change accordingly.

下面结合图1-图4来描述根据本申请示例性实施方式的用于进行基于不规则模板的数据编码方法。需要注意的是,下述应用场景仅是为了便于理解本申请的精神和原理而示出,本申请的实施方式在此方面不受任何限制。相反,本申请的实施方式可以应用于适用的任何场景。A data encoding method based on an irregular template according to an exemplary embodiment of the present application will be described below with reference to FIGS. 1-4 . It should be noted that the following application scenarios are only shown for easy understanding of the spirit and principle of the present application, and the implementation manners of the present application are not limited in this regard. On the contrary, the embodiments of the present application can be applied to any applicable scene.

本申请还提出一种基于不规则模板的数据编码方法、装置、电子设备及介质。The application also proposes a data encoding method, device, electronic equipment and medium based on an irregular template.

图1示意性地示出了根据本申请实施方式的一种基于不规则模板的数据编码方法的流程示意图。如图1所示,该方法应用于包括:Fig. 1 schematically shows a schematic flowchart of a data encoding method based on an irregular template according to an embodiment of the present application. As shown in Figure 1, the method applies to include:

S101,分别确定每个待编码区域对应的编码参数,编码参数包括待编码区域中的像素位置、至少一个编码模板以及参考像素队列,编码模板为对应于不规则形状的模板。S101. Determine encoding parameters corresponding to each area to be encoded, the encoding parameters include pixel positions in the area to be encoded, at least one encoding template, and a reference pixel queue, and the encoding template is a template corresponding to an irregular shape.

S102,基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对所述待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果。S102. Based on the predetermined intra-template matching rule, inter-encoding matching rule, and reference pixel queue, respectively use each encoding template to perform predictive encoding on the pixels in the area to be encoded, and obtain an encoding result corresponding to each encoding template.

S103,选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用最优预测方式对每个待编码区域进行预测编码。S103. Select the prediction mode with the smallest code rate and distortion cost in the encoding result as the optimal prediction mode, and use the optimal prediction mode to perform predictive encoding on each region to be encoded.

进一步的,随着图像和视频应用的不断普及,视频轻压缩技术也在不断的迭代与创新。常见的视频轻压缩标准如DSC等显示接口领域和图像视频等制作领域。Furthermore, with the continuous popularization of image and video applications, video light compression technology is also constantly iterating and innovating. Common video light compression standards such as DSC and other display interface fields and image and video production fields.

其中,一般的视频轻压缩标准的主要目的是在满足低延时、低复杂度和主观无损的条件下实现4~16倍的数据压缩。以较为通用的DSC1编码标准为例,其压缩过程主要包含有输入输出、缓存分片、预测、量化、重构、熵编码、码率控制和码流合成等步骤。Among them, the main purpose of general video light compression standards is to achieve 4 to 16 times data compression under the conditions of low delay, low complexity and subjective losslessness. Taking the more common DSC 1 coding standard as an example, its compression process mainly includes steps such as input and output, cache fragmentation, prediction, quantization, reconstruction, entropy coding, bit rate control, and bit stream synthesis.

然而,相关技术中的编码方法在像素预测过程中通常会出现有参数损失较大的问题。这也导致影响用户体验。However, the encoding method in the related art usually has a problem of large parameter loss in the process of pixel prediction. This also leads to affecting user experience.

为了解决上述问题,本申请提出一种基于不规则模板的数据编码方法,其中包括如下步骤,其中:In order to solve the above problems, the present application proposes a data encoding method based on an irregular template, which includes the following steps, wherein:

步骤1:一种方式下,本申请可以应用于任意编码框架。其中,初始化可以用于预测和编码的模板类型,即设定用于模板编码时的一组不定形态的连续像素。将操作于待编码区域中的像素值根据至少一个模板编码模板的模板形状进行分组排列。对于无法满足模板形状的边界像素,通过对模板进行剪裁完成适配。Step 1: In one way, this application can be applied to any coding framework. Wherein, the template type that can be used for prediction and coding is initialized, that is, a group of continuous pixels of indeterminate shape is set for template coding. The pixel values operated in the region to be coded are grouped and arranged according to the template shape of at least one template coding template. For the boundary pixels that cannot meet the shape of the template, the adaptation is completed by clipping the template.

其中需要说明的是,本申请中的编码模板为对应于不规则形状的模板,例如L型模板,Z型模板、阶梯型模板、菱形模板等等。It should be noted that the coding templates in this application are templates corresponding to irregular shapes, such as L-shaped templates, Z-shaped templates, stepped templates, diamond-shaped templates, and the like.

步骤2:记录当前待编码区域(一般为数个编码模板组合而成的最小方形区域)内所有的像素位置、编码模板间相互位置以及用于参考的像素数量N。Step 2: Record all pixel positions in the current area to be encoded (generally the smallest square area composed of several encoding templates), the mutual positions between encoding templates, and the number N of pixels used for reference.

步骤3:决定编码模板内部的编码顺序(即确定每个编码模板的内部编码顺序,以使后续对待编码区域中的每个像素进行预测编码)。Step 3: Determine the coding sequence inside the coding template (that is, determine the internal coding sequence of each coding template, so as to perform predictive coding on each pixel in the area to be coded subsequently).

一种方法中,如图2所示,可以为从左上角至右下角,按Z字形循环访问编码。In one method, as shown in FIG. 2 , the encoding may be cyclically accessed in a zigzag form from the upper left corner to the lower right corner.

步骤4:决定编码模板间编码顺序(即确定各个编码模板之间的编码顺序,以使后续依序对每个待编码区域进行预测编码),一种方法中,可以为从左至右,从上至下逐一编码。Step 4: Determine the coding sequence between the coding templates (that is, determine the coding sequence between the coding templates, so that each area to be coded can be predicted and coded sequentially). In one method, it can be from left to right, from Encode one by one from top to bottom.

步骤5:进入模板内匹配模式,其中可以首先确定编码模板内编码顺序的首个像素,若该模板为编码模板之间的编码顺序中,首个被编码的模板,则当前模板的首个像素不进行预测编码。若否,则可以对其首个像素进行预测编码。Step 5: Enter the template matching mode, where the first pixel of the encoding sequence in the encoding template can be determined first. If the template is the first encoded template in the encoding order between encoding templates, then the first pixel of the current template No predictive encoding is performed. If not, the first pixel can be predictively encoded.

步骤6:按照编码模板的内部编码顺序,依次编码后续像素。一种方式中,编码时可以选择与当前像素最近的M个已编码的像素的重构值和N个在参考像素队列中的重构值进行预测,若选中其中某个重构像素作为参考像素,则只编码该像素的下标索引与预测残差。若没有选中任何参考像素,则编码像素原始值与自参考索引值。Step 6: According to the internal encoding sequence of the encoding template, encode subsequent pixels in sequence. In one way, during encoding, the reconstructed values of M coded pixels closest to the current pixel and N reconstructed values in the reference pixel queue can be selected for prediction, if one of the reconstructed pixels is selected as the reference pixel , then only the subscript index and prediction residual of the pixel are encoded. If no reference pixel is selected, encode the original pixel value and self-reference index value.

步骤7:更新参考像素队列中的重构值,可根据临近原则或累计命中率等方式进行更新。Step 7: Update the reconstruction value in the reference pixel queue, which can be updated according to the proximity principle or the cumulative hit rate.

步骤8:进入模板间匹配模式,其中包括:首先确定用于匹配的编码模板,其中编码模板经过确定的旋转、镜像等非放缩操作后应可以完全覆盖待编码模板组。Step 8: Enter the inter-template matching mode, which includes: firstly determine the coding template for matching, wherein the coding template should be able to completely cover the group of templates to be coded after undergoing certain non-zooming operations such as rotation and mirroring.

步骤9:将每个编码模板内的像素逐一与原始待编码区域中对应像素进行差值运算,记录残差。Step 9: Perform a difference operation between the pixels in each coding template and the corresponding pixels in the original region to be coded one by one, and record the residual.

步骤10:遍历计算所有有效范围内的可参考的模板组,根据残差总值与均值进行排序,选择最优的编码模板作为目标编码模板。Step 10: Traverse and calculate all reference template groups within the effective range, sort according to the total value and mean value of the residual, and select the optimal coding template as the target coding template.

步骤11:一种方式中,对于仅使用同一种模板的编码设计,允许建立动态更新的临时参考模板。具体而言,编码模板中的每一个像素位置用于记录当前一定时间范围内的编码过程中在该位置下被命中次数最多的像素值。在遍历模板的过程中,该编码模板也将作为一个参考位置被遍历计算。Step 11: In one mode, for coding designs that only use the same template, it is allowed to establish a dynamically updated temporary reference template. Specifically, each pixel position in the encoding template is used to record the pixel value that is most frequently hit at this position during the current encoding process within a certain time range. In the process of traversing the template, the encoding template will also be used as a reference position to be traversed and calculated.

本申请中,可以分别确定每个待编码区域对应的编码参数,编码参数包括待编码区域中的像素位置、至少一个编码模板以及参考像素队列,编码模板为对应于不规则形状的模板;基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用最优预测方式对所述每个待编码区域进行预测编码。通过应用本申请的技术方案,可以在获取到待编码区域之后,利用预先设计的多种不规则形状的模板分别对该待编码区域进行模板内部像素的匹配以及模板间的匹配,进而提供一种更紧凑的编码数据表达形式,改善因预测不准确带来的系数损失导致的解码重构图像质量低的问题。In the present application, the encoding parameters corresponding to each area to be encoded can be respectively determined, and the encoding parameters include pixel positions in the area to be encoded, at least one encoding template and a reference pixel queue, and the encoding template is a template corresponding to an irregular shape; The determined intra-template matching rules, inter-encoding matching rules, and reference pixel queues use each encoding template to perform predictive encoding on the pixels in the area to be encoded, and obtain the encoding result corresponding to each encoding template; select the code rate and distortion in the encoding result The prediction mode with the least cost is used as the optimal prediction mode, and the optimal prediction mode is used to perform predictive encoding on each region to be encoded. By applying the technical solution of the present application, after the region to be coded is obtained, a variety of pre-designed templates of irregular shapes can be used to perform matching of pixels inside the template and between templates for the region to be coded, thereby providing a A more compact coded data expression form can improve the problem of low quality of decoded and reconstructed images caused by coefficient loss caused by inaccurate prediction.

可选地,在基于本申请上述方法的另一个实施例中,在所述确定待编码区域对应的编码参数之后,还包括:Optionally, in another embodiment based on the above method of the present application, after determining the encoding parameters corresponding to the region to be encoded, further includes:

确定每个编码模板的内部编码顺序;以及,确定各个编码模板之间的编码顺序;determining the internal encoding order of each encoding template; and, determining the encoding order among the individual encoding templates;

基于所述各个编码模板之间的编码顺序,依序对每个待编码区域进行预测编码;以及,Sequentially perform predictive coding on each region to be coded based on the coding order among the coding templates; and,

基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码。Based on the internal coding order of each coding template, sequentially perform predictive coding on each pixel in the region to be coded.

可选地,在基于本申请上述方法的另一个实施例中,所述基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码,包括:Optionally, in another embodiment based on the above-mentioned method of the present application, performing predictive coding on each pixel in the region to be coded sequentially based on the internal coding sequence of each coding template includes:

检测当前的编码模板是否为首个编码模板;Detect whether the current coding template is the first coding template;

若是,按照所述内部编码顺序,对除所述待编码区域中的首个像素之外的其他像素以像素默认值作为预测值进行预测编码,其中所述像素默认值为对应编码模板中的最大像素值的一半;If so, according to the internal encoding order, predictive encoding is performed on other pixels except the first pixel in the area to be encoded, using the pixel default value as the predicted value, wherein the pixel default value is the largest pixel in the corresponding encoding template. half of the pixel value;

若否,按照所述内部编码顺序对所述待编码区域中的像素进行预测编码。If not, perform predictive coding on the pixels in the region to be coded according to the internal coding order.

可选地,在基于本申请上述方法的另一个实施例中,所述基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码,包括:Optionally, in another embodiment based on the above-mentioned method of the present application, performing predictive coding on each pixel in the region to be coded sequentially based on the internal coding sequence of each coding template includes:

利用至少一个参考像素的重构值对所述待编码区域中的每个像素进行预测编码,其中所述参考像素为与当前待编码像素相邻的已编码像素Perform predictive coding on each pixel in the region to be coded by using the reconstructed value of at least one reference pixel, where the reference pixel is a coded pixel adjacent to the current pixel to be coded

可选地,在基于本申请上述方法的另一个实施例中,在所述得到每个编码模板对应的编码结果之后,还包括:Optionally, in another embodiment based on the above-mentioned method of the present application, after obtaining the coding result corresponding to each coding template, it further includes:

将每个编码模板经过平移、旋转、缩放并与当前编码区域重合后,计算编码模板对应的编码结果与对应的原始待编码区域之间,每个对应像素之间的残差值;After each encoding template is translated, rotated, scaled and coincident with the current encoding area, calculate the residual value between each corresponding pixel between the encoding result corresponding to the encoding template and the corresponding original area to be encoded;

根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板。According to the residual value, a target coding template whose coding result meets a preset residual condition is selected as an optimal coding template of the region to be coded.

可选地,在基于本申请上述方法的另一个实施例中,所述根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板,包括:Optionally, in another embodiment based on the above method of the present application, according to the residual value, the target coding template whose coding result reaches the preset residual condition is selected as the optimal coding template of the region to be coded ,include:

遍历计算每个编码模板对应的编码结果与对应的原始待编码区域之间的残差总值与残差均值,并按照各个残差总值与残差均值的大小关系,对每个编码模板进行码率和失真代价的排序;Iteratively calculate the total residual value and residual mean value between the coding result corresponding to each coding template and the corresponding original area to be coded, and perform a process for each coding template according to the relationship between the total residual value and the residual mean value. Sorting of code rate and distortion cost;

选取其中码率和失真代价最小的预测方式作为最优预测方式。The prediction method with the smallest bit rate and distortion cost is selected as the optimal prediction method.

进一步的,本申请提出一种基于模板的自适应匹配算法,可以通过设计多种不同的模板类型,分别在模板间和模板内部进行像素预测。该算法在无损视频编码或轻度压缩编码的工程中通过模板内部像素匹配和模板整体平移匹配等方式在不损失主观质量的情况下实现更好的压缩性能。Furthermore, the present application proposes a template-based adaptive matching algorithm, which can perform pixel prediction between templates and inside templates by designing a variety of different template types. In lossless video coding or light compression coding, the algorithm achieves better compression performance without loss of subjective quality by means of template internal pixel matching and template overall translation matching.

一种方式中,本申请中的编码模板可以如图3所示,为一种呈不规则形状的L型编码模板。其中如图4所示,为待编码区域,其中深灰色为已编码区域,abc所在区域、123所在区域、456所在区域分别为三个模板。其中a、b、c为已经编码的可参考的历史像素。在123所在区域、456所在区域,上方数字为当前像素标号,下方数字为用于参考的像素编号。不同颜色的区域可以经过旋转或平移进行直接参考(即每个编码模板的区域可直接以另外两个编码模板的区域作为参考)。In one manner, the coding template in this application may be an irregularly shaped L-shaped coding template as shown in FIG. 3 . As shown in Figure 4, it is the area to be encoded, and the dark gray area is the encoded area, and the area where abc is located, the area where 123 is located, and the area where 456 is located are three templates. Wherein, a, b, and c are coded reference historical pixels. In the area where 123 is located and the area where 456 is located, the upper number is the current pixel label, and the lower number is the pixel number for reference. Regions of different colors can be directly referenced through rotation or translation (that is, the regions of each coding template can be directly referenced to the regions of the other two coding templates).

其中,本申请可以对视频编码中图像预测进行模式拓展提升编码性能。其中具体包括模板生成,模板组合,模板旋转、缩放、剪裁、拼接和其他用于生成模板的方法。另外,本申请还可以对每个编码模板区域内和编码模板之间进行预测、参考和其他用于生成重构像素值的方法。Among them, the present application can expand the mode of image prediction in video coding to improve the coding performance. These specifically include template generation, template combination, template rotation, scaling, clipping, splicing and other methods for generating templates. In addition, the present application can also perform prediction, reference and other methods for generating reconstructed pixel values within each coding template area and between coding templates.

通过应用本申请的技术方案,可以在获取到待编码区域之后,利用预先设计的多种不规则形状的模板分别对该待编码区域进行模板内部像素的匹配以及模板间的匹配,进而提供一种更紧凑的编码数据表达形式,改善因预测不准确带来的系数损失导致的解码重构图像质量低的问题。By applying the technical solution of the present application, after the region to be coded is obtained, a variety of pre-designed templates of irregular shapes can be used to perform matching of pixels inside the template and between templates for the region to be coded, thereby providing a A more compact coded data expression form can improve the problem of low quality of decoded and reconstructed images caused by coefficient loss caused by inaccurate prediction.

可选的,在本申请的另外一种实施方式中,如图5所示,本申请还提供一种基于不规则模板的数据编码装置。其中包括:Optionally, in another implementation manner of the present application, as shown in FIG. 5 , the present application further provides a data encoding device based on an irregular template. These include:

确定模块201,被配置为分别确定每个待编码区域对应的编码参数,所述编码参数包括所述待编码区域中的像素位置、至少一个编码模板以及参考像素队列,所述编码模板为对应于不规则形状的模板;The determination module 201 is configured to determine encoding parameters corresponding to each area to be encoded, the encoding parameters include pixel positions in the area to be encoded, at least one encoding template and a reference pixel queue, the encoding template is corresponding to Irregularly shaped templates;

编码模块202,被配置为基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对所述待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;The encoding module 202 is configured to use each encoding template to predictively encode the pixels in the area to be encoded based on the predetermined intra-template matching rules, inter-encoding matching rules, and reference pixel queues, to obtain the corresponding The encoding result;

选取模块203,被配置为选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用所述最优预测方式对所述每个待编码区域进行预测编码。The selection module 203 is configured to select the prediction mode with the smallest code rate and distortion cost in the encoding result as the optimal prediction mode, and use the optimal prediction mode to perform predictive encoding on each region to be encoded.

本申请中,可以分别确定每个待编码区域对应的编码参数,编码参数包括待编码区域中的像素位置、至少一个编码模板以及参考像素队列,编码模板为对应于不规则形状的模板;基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用最优预测方式对所述每个待编码区域进行预测编码。通过应用本申请的技术方案,可以在获取到待编码区域之后,利用预先设计的多种不规则形状的模板分别对该待编码区域进行模板内部像素的匹配以及模板间的匹配,进而提供一种更紧凑的编码数据表达形式,改善因预测不准确带来的系数损失导致的解码重构图像质量低的问题。In the present application, the encoding parameters corresponding to each area to be encoded can be respectively determined, and the encoding parameters include pixel positions in the area to be encoded, at least one encoding template and a reference pixel queue, and the encoding template is a template corresponding to an irregular shape; The determined intra-template matching rules, inter-encoding matching rules, and reference pixel queues use each encoding template to perform predictive encoding on the pixels in the area to be encoded, and obtain the encoding result corresponding to each encoding template; select the code rate and distortion in the encoding result The prediction mode with the least cost is used as the optimal prediction mode, and the optimal prediction mode is used to perform predictive encoding on each region to be encoded. By applying the technical solution of the present application, after the region to be coded is obtained, a variety of pre-designed templates of irregular shapes can be used to perform matching of pixels inside the template and between templates for the region to be coded, thereby providing a A more compact coded data expression form can improve the problem of low quality of decoded and reconstructed images caused by coefficient loss caused by inaccurate prediction.

在本申请的另外一种实施方式中,确定模块201,被配置执行的步骤包括:In another embodiment of the present application, the determination module 201 is configured to execute the steps including:

确定每个编码模板的内部编码顺序;以及,确定各个编码模板之间的编码顺序;determining the internal encoding order of each encoding template; and, determining the encoding order among the individual encoding templates;

基于所述各个编码模板之间的编码顺序,依序对每个待编码区域进行预测编码;以及,Sequentially perform predictive coding on each region to be coded based on the coding order among the coding templates; and,

基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码。Based on the internal coding order of each coding template, sequentially perform predictive coding on each pixel in the region to be coded.

在本申请的另外一种实施方式中,确定模块201,被配置执行的步骤包括:In another embodiment of the present application, the determination module 201 is configured to execute the steps including:

检测当前的编码模板是否为首个编码模板;Detect whether the current coding template is the first coding template;

若是,按照所述内部编码顺序,对除所述待编码区域中的首个像素之外的其他像素以像素默认值作为预测值进行预测编码,其中所述像素默认值为对应编码模板中的最大像素值的一半;If so, according to the internal encoding order, predictive encoding is performed on other pixels except the first pixel in the area to be encoded, using the pixel default value as the predicted value, wherein the pixel default value is the largest pixel in the corresponding encoding template. half of the pixel value;

若否,按照所述内部编码顺序对所述待编码区域中的像素进行预测编码。If not, perform predictive coding on the pixels in the region to be coded according to the internal coding sequence.

在本申请的另外一种实施方式中,确定模块201,被配置执行的步骤包括:In another embodiment of the present application, the determination module 201 is configured to execute the steps including:

利用至少一个参考像素的重构值对所述待编码区域中的每个像素进行预测编码,其中所述参考像素为与当前待编码像素相邻的已编码像素。Each pixel in the region to be coded is predictively coded by using the reconstructed value of at least one reference pixel, where the reference pixel is a coded pixel adjacent to the current pixel to be coded.

在本申请的另外一种实施方式中,确定模块201,被配置执行的步骤包括:In another embodiment of the present application, the determination module 201 is configured to execute the steps including:

将每个编码模板经过平移、旋转、缩放并与当前编码区域重合后,计算编码模板对应的编码结果与对应的原始待编码区域之间,每个对应像素之间的残差值;After each encoding template is translated, rotated, scaled and coincident with the current encoding area, calculate the residual value between each corresponding pixel between the encoding result corresponding to the encoding template and the corresponding original area to be encoded;

根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板。According to the residual value, a target coding template whose coding result meets a preset residual condition is selected as an optimal coding template of the region to be coded.

在本申请的另外一种实施方式中,确定模块201,被配置执行的步骤包括:In another embodiment of the present application, the determination module 201 is configured to execute the steps including:

遍历计算每个编码模板对应的编码结果与对应的原始待编码区域之间的残差总值与残差均值,并按照各个残差总值与残差均值的大小关系,对每个编码模板进行码率和失真代价的排序;Iteratively calculate the total residual value and residual mean value between the coding result corresponding to each coding template and the corresponding original area to be coded, and perform a process for each coding template according to the relationship between the total residual value and the residual mean value. Sorting of code rate and distortion cost;

选取其中码率和失真代价最小的预测方式作为最优预测方式Select the prediction method with the smallest bit rate and distortion cost as the optimal prediction method

图6是根据一示例性实施例示出的一种电子设备的逻辑结构框图。例如,电子设备300可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。Fig. 6 is a logical structural block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.

在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器,上述指令可由电子设备处理器执行以完成上述基于不规则模板的数据编码方法,该方法包括:分别确定每个待编码区域对应的编码参数,所述编码参数包括所述待编码区域中的像素位置、至少一个编码模板以及参考像素队列,所述编码模板为对应于不规则形状的模板;基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对所述待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用所述最优预测方式对所述每个待编码区域进行预测编码。可选地,上述指令还可以由电子设备的处理器执行以完成上述示例性实施例中所涉及的其他步骤。例如,非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium including instructions, such as a memory including instructions, the instructions can be executed by a processor of an electronic device to complete the above-mentioned data encoding method based on an irregular template, The method includes: respectively determining encoding parameters corresponding to each area to be encoded, the encoding parameters including pixel positions in the area to be encoded, at least one encoding template and a reference pixel queue, the encoding template is corresponding to an irregular shape a template; based on the predetermined intra-template matching rules, inter-encoding matching rules, and reference pixel queues, each encoding template is used to perform predictive encoding on the pixels in the region to be encoded, and an encoding result corresponding to each encoding template is obtained; Select the prediction mode with the smallest code rate and distortion cost in the encoding result as the optimal prediction mode, and use the optimal prediction mode to perform predictive encoding on each region to be encoded. Optionally, the above instructions may also be executed by a processor of the electronic device to complete other steps involved in the above exemplary embodiments. For example, the non-transitory computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.

在示例性实施例中,还提供了一种应用程序/计算机程序产品,包括一条或多条指令,该一条或多条指令可以由电子设备的处理器执行,以完成上述基于不规则模板的数据编码方法,该方法包括:分别确定每个待编码区域对应的编码参数,所述编码参数包括所述待编码区域中的像素位置、至少一个编码模板以及参考像素队列,所述编码模板为对应于不规则形状的模板;基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对所述待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用所述最优预测方式对所述每个待编码区域进行预测编码。可选地,上述指令还可以由电子设备的处理器执行以完成上述示例性实施例中所涉及的其他步骤。In an exemplary embodiment, there is also provided an application program/computer program product comprising one or more instructions executable by a processor of an electronic device to complete the above-mentioned irregular template-based data An encoding method, the method includes: respectively determining encoding parameters corresponding to each area to be encoded, the encoding parameters including pixel positions in the area to be encoded, at least one encoding template and a reference pixel queue, the encoding template is corresponding to Irregular-shaped templates; based on predetermined intra-template matching rules, inter-encoding matching rules, and reference pixel queues, each encoding template is used to perform predictive encoding on the pixels in the region to be encoded, and the pixel corresponding to each encoding template is obtained. Encoding result: selecting the prediction mode with the smallest code rate and distortion cost in the encoding result as the optimal prediction mode, and using the optimal prediction mode to perform predictive encoding on each region to be encoded. Optionally, the above instructions may also be executed by a processor of the electronic device to complete other steps involved in the above exemplary embodiments.

图6为电子设备300的示例图。本领域技术人员可以理解,示意图6仅仅是电子设备300的示例,并不构成对电子设备300的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如电子设备300还可以包括输入输出设备、网络接入设备、总线等。FIG. 6 is an example diagram of an electronic device 300 . Those skilled in the art can understand that the schematic diagram 6 is only an example of the electronic device 300, and does not constitute a limitation to the electronic device 300, and may include more or less components than those shown in the figure, or combine some components, or different components For example, the electronic device 300 may also include an input and output device, a network access device, a bus, and the like.

所称处理器302可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器302也可以是任何常规的处理器等,处理器302是电子设备300的控制中心,利用各种接口和线路连接整个电子设备300的各个部分。The so-called processor 302 may be a central processing unit (Central Processing Unit, CPU), and may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor 302 may be any conventional processor, etc. The processor 302 is the control center of the electronic device 300 and uses various interfaces and lines to connect various parts of the entire electronic device 300 .

存储器301可用于存储计算机可读指令303,处理器302通过运行或执行存储在存储器301内的计算机可读指令或模块,以及调用存储在存储器301内的数据,实现电子设备300的各种功能。存储器301可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据电子设备300的使用所创建的数据等。此外,存储器301可以包括硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)或其他非易失性/易失性存储器件。The memory 301 can be used to store computer-readable instructions 303 , and the processor 302 implements various functions of the electronic device 300 by running or executing computer-readable instructions or modules stored in the memory 301 and calling data stored in the memory 301 . The memory 301 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playback function, an image playback function, etc.); Data and the like created by use of the electronic device 300 . In addition, the memory 301 may include a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card (Flash Card), at least one magnetic disk storage device, a flash memory device, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), or other non-volatile/volatile storage devices.

电子设备300集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,的计算机可读指令可存储于一计算机可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。If the integrated modules of the electronic device 300 are realized in the form of software function modules and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on such an understanding, the present invention realizes all or part of the processes in the methods of the above embodiments, and can also use computer-readable instructions to instruct related hardware to complete, and the computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned various method embodiments can be realized.

本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。Other embodiments of the present application will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the application, these modifications, uses or adaptations follow the general principles of the application and include common knowledge or conventional technical means in the technical field not disclosed in the application . The specification and examples are to be considered exemplary only, with a true scope and spirit of the application indicated by the following claims.

应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It should be understood that the present application is not limited to the precise constructions which have been described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (6)

1.一种基于不规则模板的数据编码方法,其特征在于,包括:1. A data encoding method based on an irregular template, characterized in that, comprising: 分别确定每个待编码区域对应的编码参数,所述编码参数包括所述待编码区域中的像素位置、至少一个编码模板以及参考像素队列,所述编码模板为对应于不规则形状的模板;Respectively determine encoding parameters corresponding to each area to be encoded, the encoding parameters include pixel positions in the area to be encoded, at least one encoding template, and a reference pixel queue, the encoding template is a template corresponding to an irregular shape; 基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对所述待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;Based on the predetermined intra-template matching rules, inter-encoding matching rules, and reference pixel queues, each encoding template is used to perform predictive encoding on the pixels in the region to be encoded, and an encoding result corresponding to each encoding template is obtained; 选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用所述最优预测方式对所述每个待编码区域进行预测编码;Selecting the prediction method with the smallest code rate and distortion cost in the coding result as the optimal prediction method, and using the optimal prediction method to perform predictive coding on each region to be coded; 其中,在所述确定待编码区域对应的编码参数之后,还包括:Wherein, after said determining the encoding parameters corresponding to the area to be encoded, it also includes: 确定每个编码模板的内部编码顺序;以及,确定各个编码模板之间的编码顺序;determining the internal encoding order of each encoding template; and, determining the encoding order among the individual encoding templates; 基于所述各个编码模板之间的编码顺序,依序对每个待编码区域进行预测编码;以及,Sequentially perform predictive coding on each region to be coded based on the coding order among the coding templates; and, 基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码;Sequentially perform predictive coding on each pixel in the region to be coded based on the internal coding sequence of each coding template; 其中,在所述得到每个编码模板对应的编码结果之后,还包括:Wherein, after the encoding result corresponding to each encoding template is obtained, it also includes: 将每个编码模板经过平移、旋转、缩放并与当前编码区域重合后,计算编码模板对应的编码结果与对应的原始待编码区域之间,每个对应像素之间的残差值;After each encoding template is translated, rotated, scaled and coincident with the current encoding area, calculate the residual value between each corresponding pixel between the encoding result corresponding to the encoding template and the corresponding original area to be encoded; 根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板;According to the residual value, selecting the target coding template whose coding result meets the preset residual condition as the optimal coding template of the region to be coded; 其中,所述根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板,包括:Wherein, according to the residual value, selecting the target coding template whose coding result meets the preset residual condition as the optimal coding template of the region to be coded includes: 遍历计算每个编码模板对应的编码结果与对应的原始待编码区域之间的残差总值与残差均值,并按照各个残差总值与残差均值的大小关系,对每个编码模板进行码率和失真代价的排序;Iteratively calculate the total residual value and residual mean value between the coding result corresponding to each coding template and the corresponding original area to be coded, and perform a process for each coding template according to the relationship between the total residual value and the residual mean value. Sorting of code rate and distortion cost; 选取其中码率和失真代价最小的预测方式作为最优预测方式。The prediction method with the smallest bit rate and distortion cost is selected as the optimal prediction method. 2.如权利要求1所述的方法,其特征在于,所述基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码,包括:2. The method according to claim 1, characterized in that, performing predictive coding on each pixel in the region to be coded sequentially based on the internal coding order of each coding template, comprising: 检测当前的编码模板是否为首个编码模板;Detect whether the current coding template is the first coding template; 若是,按照所述内部编码顺序,对除所述待编码区域中的首个像素之外的其他像素以像素默认值作为预测值进行预测编码,其中所述像素默认值为对应编码模板中的最大像素值的一半;If so, according to the internal encoding order, predictive encoding is performed on other pixels except the first pixel in the area to be encoded, using the pixel default value as the predicted value, wherein the pixel default value is the largest pixel in the corresponding encoding template. half of the pixel value; 若否,按照所述内部编码顺序对所述待编码区域中的像素进行预测编码。If not, perform predictive coding on the pixels in the region to be coded according to the internal coding sequence. 3.如权利要求1所述的方法,其特征在于,所述基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码,包括:3. The method according to claim 1, wherein said performing predictive coding on each pixel in the region to be coded sequentially based on the internal coding sequence of each coding template comprises: 利用至少一个参考像素的重构值对所述待编码区域中的每个像素进行预测编码,其中所述参考像素为与当前待编码像素相邻的已编码像素。Each pixel in the region to be coded is predictively coded by using the reconstructed value of at least one reference pixel, where the reference pixel is a coded pixel adjacent to the current pixel to be coded. 4.一种基于不规则模板的数据编码装置,其特征在于,包括:4. A data encoding device based on an irregular template, characterized in that it comprises: 确定模块,被配置为分别确定每个待编码区域对应的编码参数,所述编码参数包括所述待编码区域中的像素位置、至少一个编码模板以及参考像素队列,所述编码模板为对应于不规则形状的模板;The determining module is configured to separately determine encoding parameters corresponding to each area to be encoded, the encoding parameters include pixel positions in the area to be encoded, at least one encoding template, and a reference pixel queue, the encoding templates are corresponding to different Regularly shaped templates; 编码模块,被配置为基于预先确定的模板内匹配规则、编码间匹配规则以及参考像素队列,分别利用每个编码模板对所述待编码区域中的像素进行预测编码,得到每个编码模板对应的编码结果;The encoding module is configured to use each encoding template to perform predictive encoding on the pixels in the area to be encoded based on the predetermined intra-template matching rules, inter-encoding matching rules, and reference pixel queues, to obtain the pixels corresponding to each encoding template. encoding result; 选取模块,被配置为选取编码结果中码率和失真代价最小的预测方式作为最优预测方式,并利用所述最优预测方式对所述每个待编码区域进行预测编码;The selection module is configured to select the prediction mode with the smallest code rate and distortion cost in the encoding result as the optimal prediction mode, and use the optimal prediction mode to perform predictive encoding on each region to be encoded; 其中,在所述确定待编码区域对应的编码参数之后,还包括:Wherein, after said determining the encoding parameters corresponding to the area to be encoded, it also includes: 确定每个编码模板的内部编码顺序;以及,确定各个编码模板之间的编码顺序;determining the internal encoding order of each encoding template; and, determining the encoding order among the individual encoding templates; 基于所述各个编码模板之间的编码顺序,依序对每个待编码区域进行预测编码;以及,Sequentially perform predictive coding on each region to be coded based on the coding order among the coding templates; and, 基于所述每个编码模板的内部编码顺序,依序对所述待编码区域中的每个像素进行预测编码;Sequentially perform predictive coding on each pixel in the region to be coded based on the internal coding sequence of each coding template; 其中,在所述得到每个编码模板对应的编码结果之后,还包括:Wherein, after the encoding result corresponding to each encoding template is obtained, it also includes: 将每个编码模板经过平移、旋转、缩放并与当前编码区域重合后,计算编码模板对应的编码结果与对应的原始待编码区域之间,每个对应像素之间的残差值;After each encoding template is translated, rotated, scaled and coincident with the current encoding area, calculate the residual value between each corresponding pixel between the encoding result corresponding to the encoding template and the corresponding original area to be encoded; 根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板;According to the residual value, selecting the target coding template whose coding result meets the preset residual condition as the optimal coding template of the region to be coded; 其中,所述根据所述残差值,选取编码结果达到预设残差条件的目标编码模板作为所述待编码区域的最优编码模板,包括:Wherein, according to the residual value, selecting the target coding template whose coding result meets the preset residual condition as the optimal coding template of the region to be coded includes: 遍历计算每个编码模板对应的编码结果与对应的原始待编码区域之间的残差总值与残差均值,并按照各个残差总值与残差均值的大小关系,对每个编码模板进行码率和失真代价的排序;Iteratively calculate the total residual value and residual mean value between the coding result corresponding to each coding template and the corresponding original area to be coded, and perform a process for each coding template according to the relationship between the total residual value and the residual mean value. Sorting of code rate and distortion cost; 选取其中码率和失真代价最小的预测方式作为最优预测方式。The prediction method with the smallest bit rate and distortion cost is selected as the optimal prediction method. 5.一种电子设备,其特征在于,包括:5. An electronic device, characterized in that it comprises: 存储器,用于存储可执行指令;以及,memory for storing executable instructions; and, 处理器,用于与所述存储器以执行所述可执行指令从而完成权利要求1-3中任一所述基于不规则模板的数据编码方法的操作。A processor, configured to work with the memory to execute the executable instructions so as to complete the operations of the irregular template-based data encoding method in any one of claims 1-3. 6.一种计算机可读存储介质,用于存储计算机可读取的指令,其特征在于,所述指令被执行时执行权利要求1-3中任一所述基于不规则模板的数据编码方法的操作。6. A computer-readable storage medium for storing computer-readable instructions, characterized in that, when the instructions are executed, any of the irregular template-based data encoding methods in claims 1-3 is executed operate.
CN202210133940.2A 2022-02-14 2022-02-14 Data encoding method and device based on irregular template, electronic equipment and medium Active CN114666600B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210133940.2A CN114666600B (en) 2022-02-14 2022-02-14 Data encoding method and device based on irregular template, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210133940.2A CN114666600B (en) 2022-02-14 2022-02-14 Data encoding method and device based on irregular template, electronic equipment and medium

Publications (2)

Publication Number Publication Date
CN114666600A CN114666600A (en) 2022-06-24
CN114666600B true CN114666600B (en) 2023-04-07

Family

ID=82027121

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210133940.2A Active CN114666600B (en) 2022-02-14 2022-02-14 Data encoding method and device based on irregular template, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN114666600B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101557514B (en) * 2008-04-11 2011-02-09 华为技术有限公司 A method, device and system for encoding and decoding inter-frame prediction
CN102801995B (en) * 2012-06-25 2016-12-21 北京大学深圳研究生院 A kind of multi-view video motion based on template matching and disparity vector prediction method
WO2017201141A1 (en) * 2016-05-17 2017-11-23 Arris Enterprises Llc Template matching for jvet intra prediction
WO2019010634A1 (en) * 2017-07-11 2019-01-17 华为技术有限公司 Decoding method and apparatus based on template matching
CN110267041B (en) * 2019-06-28 2021-11-09 Oppo广东移动通信有限公司 Image encoding method, image encoding device, electronic device, and computer-readable storage medium

Also Published As

Publication number Publication date
CN114666600A (en) 2022-06-24

Similar Documents

Publication Publication Date Title
CN108022212B (en) High-resolution picture generation method, generation device and storage medium
US10681367B2 (en) Intra-prediction video coding method and device
US20240406401A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN109816739A (en) Picture compression method, apparatus, computer equipment and computer readable storage medium
JP2014506042A (en) Display data encoding method and system
WO2025036071A1 (en) Video coding method, apparatus and device, storage medium, and program product
WO2023098820A1 (en) Point cloud coding method and apparatus, point cloud decoding method and apparatus, and communication device
CN109587561B (en) Video processing method and device, electronic equipment and storage medium
CN114666600B (en) Data encoding method and device based on irregular template, electronic equipment and medium
WO2025092831A1 (en) Processing method, processing device, and storage medium
US20240121439A1 (en) Point cloud attribute information encoding method and apparatus, point cloud attribute information decoding method and apparatus, and related device
CN109561315B (en) Motion estimation method and device, electronic equipment and storage medium
CN107977923A (en) Image processing method, device, electronic equipment and computer-readable recording medium
CN118262360A (en) SAM-based text segmentation method, device, equipment and storage medium
WO2024234593A1 (en) Data encoding method and apparatus, data decoding method and apparatus, computer device, and storage medium
JP2021013145A (en) Video transmission device and video transmission method
CN116389743A (en) Image encoding method, image encoding device, chip, terminal, storage medium, and program product
US11132762B2 (en) Content aware image fitting
CN107392972B (en) A kind of image background weakening method, mobile terminal and computer readable storage medium
CN113592712A (en) Image processing method, device, equipment, storage medium and cloud VR system
CN116233426A (en) Attribute quantification, dequantization method, device and equipment
JP2021174404A (en) Data generation device, training device, and data generation method
CN118573876B (en) Video encoding method, apparatus, computer device, readable storage medium, and program product
WO2024120431A1 (en) Point cloud coding method, point cloud decoding method, and related devices
CN118736204A (en) Image processing method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant