CN116227507B - A computing device for bilinear interpolation processing - Google Patents
A computing device for bilinear interpolation processing Download PDFInfo
- Publication number
- CN116227507B CN116227507B CN202310521501.3A CN202310521501A CN116227507B CN 116227507 B CN116227507 B CN 116227507B CN 202310521501 A CN202310521501 A CN 202310521501A CN 116227507 B CN116227507 B CN 116227507B
- Authority
- CN
- China
- Prior art keywords
- data
- value
- weight
- interpolation
- low
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 230000008859 change Effects 0.000 claims description 35
- 238000000034 method Methods 0.000 description 11
- 230000008569 process Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06G—ANALOGUE COMPUTERS
- G06G7/00—Devices in which the computing operation is performed by varying electric or magnetic quantities
- G06G7/12—Arrangements for performing computing operations, e.g. operational amplifiers
- G06G7/16—Arrangements for performing computing operations, e.g. operational amplifiers for multiplication or division
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T3/4007—Scaling of whole images or parts thereof, e.g. expanding or contracting based on interpolation, e.g. bilinear interpolation
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- General Physics & Mathematics (AREA)
- Power Engineering (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Complex Calculations (AREA)
- Image Processing (AREA)
Abstract
Description
技术领域technical field
本公开涉及数据处理领域,尤其涉及一种用于进行双线性插值处理的运算装置。The disclosure relates to the field of data processing, and in particular to an arithmetic device for bilinear interpolation processing.
背景技术Background technique
双线性插值是有两个变量的插值函数的线性插值扩展,其原理是在两个方向分别进行一次线性插值。双线性插值作为数值分析中的一种插值算法,广泛应用在信号处理,数字图像和视频处理等技术领域。Bilinear interpolation is a linear interpolation extension of the interpolation function with two variables, and its principle is to perform a linear interpolation in two directions respectively. As an interpolation algorithm in numerical analysis, bilinear interpolation is widely used in technical fields such as signal processing, digital image and video processing.
发明内容Contents of the invention
有鉴于此,本公开提出了一种用于进行双线性插值处理的运算装置的技术方案。In view of this, the present disclosure proposes a technical solution of an arithmetic device for performing bilinear interpolation processing.
根据本公开的一方面,提供了一种用于进行双线性插值处理的运算装置,包括:权重输入模块、多路选择器、多个乘法器和加法器,其中,所述乘法器的输入位宽为m-1 bit;所述权重输入模块,用于利用第一低位数据u和第二低位数据v,确定各个所述乘法器分别对应的权重输入数据,并将所述权重输入数据输入对应的所述乘法器,其中,所述第一低位数据u为第一插值权重U的低位m-1 bit,所述第二低位数据v为第二插值权重V的低位m-1bit,所述第一插值权重U和所述第二插值权重V为m bit,并大于等于0且小于等于1, m为所述第一插值权重U与所述第二插值权重V对应的二进制数的位数;所述多路选择器,用于根据所述第一插值权重U和所述第二插值权重V,分别确定至少一个所述乘法器对应的待运算数据,并将所述待运算数据输入相应的所述乘法器,其中,每个所述乘法器对应的所述待运算数据为需要进行所述双线性插值处理的多个待插值数据中的一个;所述乘法器,用于根据所述待运算数据和所述权重输入数据,进行对应的乘法运算,确定乘法运算结果;所述加法器,用于对各个所述乘法器对应的所述乘法运算结果进行求和运算,确定所述多个待插值数据对应的双线性插值处理结果。According to an aspect of the present disclosure, there is provided an arithmetic device for bilinear interpolation processing, including: a weight input module, a multiplexer, a plurality of multipliers, and an adder, wherein the input of the multiplier The bit width is m-1 bit; the weight input module is configured to use the first low-order data u and the second low-order data v to determine the weight input data corresponding to each of the multipliers, and input the weight input data to The corresponding multiplier, wherein, the first low-order data u is the low-order m-1 bit of the first interpolation weight U, and the second low-order data v is the low-order m-1 bit of the second interpolation weight V, and the The first interpolation weight U and the second interpolation weight V are m bits, and are greater than or equal to 0 and less than or equal to 1, and m is the number of bits of the binary number corresponding to the first interpolation weight U and the second interpolation weight V ; The multiplexer is used to respectively determine at least one data to be operated corresponding to the multiplier according to the first interpolation weight U and the second interpolation weight V, and input the data to be operated to corresponding The multipliers, wherein, the data to be operated corresponding to each of the multipliers is one of a plurality of data to be interpolated that needs to be processed by the bilinear interpolation; the multiplier is used to The data to be calculated and the weight input data are used to perform corresponding multiplication operations to determine the multiplication results; the adder is used to sum the multiplication results corresponding to each of the multipliers to determine the multiplication results. Bilinear interpolation processing results corresponding to multiple data to be interpolated.
在一种可能的实现方式中,所述多个乘法器包括:第一乘法器、第二乘法器、第三乘法器和第四乘法器,所述权重输入数据包括:第一权重输入数据、第二权重输入数据、第三权重输入数据和第四权重输入数据;所述权重输入模块输入所述第一乘法器的所述第一权重输入数据为1-u和1-v;所述权重输入模块输入所述第二乘法器的所述第二权重输入数据为u和1-v;所述权重输入模块输入所述第三乘法器的所述第三权重输入数据为1-u和v;所述权重输入模块输入所述第四乘法器的所述第四权重输入数据为u和v。In a possible implementation manner, the multiple multipliers include: a first multiplier, a second multiplier, a third multiplier, and a fourth multiplier, and the weight input data includes: first weight input data, The second weight input data, the third weight input data and the fourth weight input data; the first weight input data that the weight input module inputs to the first multiplier is 1-u and 1-v; the weight The second weight input data that the input module inputs to the second multiplier is u and 1-v; the third weight input data that the weight input module inputs to the third multiplier is 1-u and v ; The fourth weight input data input to the fourth multiplier by the weight input module is u and v.
在一种可能的实现方式中,所述多路选择器,用于根据所述第一插值权重U和所述第二插值权重V的最高位,确定所述第一低位数据u相对于所述第一插值权重U的取值变化,以及所述第二低位数据v相对于所述第二插值权重V的取值变化;所述多路选择器,用于根据所述第一低位数据u相对于所述第一插值权重U的取值变化、所述第二低位数据v相对于所述第二插值权重V的取值变化、以及所述多个待插值数据,确定至少一个所述乘法器对应的所述待运算数据,其中,所述多个待插值数据包括:第一待插值数据、第二待插值数据、第三待插值数据和第四待插值数据。In a possible implementation manner, the multiplexer is configured to determine, according to the highest bit of the first interpolation weight U and the second interpolation weight V, the relative The value change of the first interpolation weight U, and the value change of the second low-order data v relative to the second interpolation weight V; the multiplexer is used for relatively Determine at least one multiplier based on the value change of the first interpolation weight U, the value change of the second low-order data v relative to the second interpolation weight V, and the plurality of data to be interpolated The corresponding data to be calculated, wherein the plurality of data to be interpolated includes: first data to be interpolated, second data to be interpolated, third data to be interpolated, and fourth data to be interpolated.
在一种可能的实现方式中,所述多路选择器,用于在所述第一插值权重U和所述第二插值权重V的最高位均为0时,确定所述第一低位数据u的取值相对于所述第一插值权重U的取值不变,以及所述第二低位数据v的取值相对于所述第二插值权重V的取值不变。In a possible implementation manner, the multiplexer is configured to determine the first low-order data u when the highest bits of the first interpolation weight U and the second interpolation weight V are both 0 The value of v is unchanged relative to the value of the first interpolation weight U, and the value of the second low-order data v is unchanged relative to the value of the second interpolation weight V.
在一种可能的实现方式中,所述多路选择器,用于在所述第一低位数据u的取值相对于所述第一插值权重U的取值不变,以及所述第二低位数据v的取值相对于所述第二插值权重V的取值不变时,确定所述第一乘法器对应的所述待运算数据为所述第一待插值数据,所述第二乘法器对应的所述待运算数据为所述第二待插值数据,所述第三乘法器对应的所述待运算数据为所述第三待插值数据。In a possible implementation manner, the multiplexer is configured to make the value of the first low-order data u unchanged relative to the value of the first interpolation weight U, and the second low-order When the value of the data v is unchanged relative to the value of the second interpolation weight V, it is determined that the data to be operated corresponding to the first multiplier is the first data to be interpolated, and the second multiplier The corresponding data to be operated is the second data to be interpolated, and the data to be operated corresponding to the third multiplier is the third data to be interpolated.
在一种可能的实现方式中,所述多路选择器,用于在所述第一插值权重U的最高位为1,所述第二插值权重V的最高位为0时,确定所述第一低位数据u的取值相对于所述第一插值权重U的取值发生变化,以及所述第二低位数据v的取值相对于所述第二插值权重V的取值不变。In a possible implementation, the multiplexer is configured to determine the first interpolation weight U when the highest bit of the first interpolation weight U is 1 and the highest bit of the second interpolation weight V is 0. The value of a low-order data u changes relative to the value of the first interpolation weight U, and the value of the second low-order data v does not change relative to the value of the second interpolation weight V.
在一种可能的实现方式中,所述多路选择器,用于在所述第一低位数据u的取值相对于所述第一插值权重U的取值发生变化,以及所述第二低位数据v的取值相对于所述第二插值权重V的取值不变时,确定所述第一乘法器对应的所述待运算数据为所述第二待插值数据,所述第三乘法器对应的所述待运算数据为所述第四待插值数据。In a possible implementation manner, the multiplexer is configured to change the value of the first low-order data u relative to the value of the first interpolation weight U, and the second low-order When the value of the data v is unchanged relative to the value of the second interpolation weight V, it is determined that the data to be operated corresponding to the first multiplier is the second data to be interpolated, and the third multiplier The corresponding data to be operated is the fourth data to be interpolated.
在一种可能的实现方式中,所述多路选择器,用于在所述第一插值权重U的最高位为0,所述第二插值权重V的最高位为1时,确定所述第一低位数据u的取值相对于所述第一插值权重U的取值不变,以及所述第二低位数据v的取值相对于所述第二插值权重V的取值发生变化。In a possible implementation, the multiplexer is configured to determine the first interpolation weight U when the highest bit of the first interpolation weight U is 0 and the highest bit of the second interpolation weight V is 1. The value of a low bit data u is unchanged relative to the value of the first interpolation weight U, and the value of the second low bit data v is changed relative to the value of the second interpolation weight V.
在一种可能的实现方式中,所述多路选择器,用于在所述第一低位数据u的取值相对于所述第一插值权重U的取值不变,以及所述第二低位数据v的取值相对于所述第二插值权重V的取值发生变化时,确定所述第一乘法器对应的所述待运算数据为所述第三待插值数据,所述第二乘法器对应的所述待运算数据为所述第四待插值数据。In a possible implementation manner, the multiplexer is configured to make the value of the first low-order data u unchanged relative to the value of the first interpolation weight U, and the second low-order When the value of data v changes relative to the value of the second interpolation weight V, it is determined that the data to be operated corresponding to the first multiplier is the third data to be interpolated, and the second multiplier The corresponding data to be operated is the fourth data to be interpolated.
在一种可能的实现方式中,所述多路选择器,用于在所述第一插值权重U和所述第二插值权重V的最高位均为1时,确定所述第一低位数据u的取值相对于所述第一插值权重U的取值发生变化,以及所述第二低位数据v的取值相对于所述第二插值权重V的取值发生变化。In a possible implementation manner, the multiplexer is configured to determine the first low-order data u when the highest bit of the first interpolation weight U and the second interpolation weight V are both 1 The value of v changes relative to the value of the first interpolation weight U, and the value of the second low-order data v changes relative to the value of the second interpolation weight V.
在一种可能的实现方式中,所述多路选择器,用于在所述第一低位数据u的取值相对于所述第一插值权重U的取值发生变化,以及所述第二低位数据v的取值相对于所述第二插值权重V的取值发生变化时,确定所述第一乘法器对应的所述待运算数据为所述第四待插值数据。In a possible implementation manner, the multiplexer is configured to change the value of the first low-order data u relative to the value of the first interpolation weight U, and the second low-order When the value of data v changes relative to the value of the second interpolation weight V, it is determined that the data to be operated corresponding to the first multiplier is the fourth data to be interpolated.
在一种可能的实现方式中,所述多个待插值数据是目标图像中需要进行双线性插值处理的2×2结构的四个像素数据。In a possible implementation manner, the plurality of data to be interpolated is four pixel data of a 2×2 structure in the target image that needs to be processed by bilinear interpolation.
本公开实施例的用于进行双线性插值处理的运算装置,通过权重输入模块,利用第一低位数据u和第二低位数据v,确定各个乘法器分别对应的权重输入数据,并将权重输入数据输入对应的乘法器,其中,第一低位数据u为第一插值权重U的低位m-1 bit,第二低位数据v为第二插值权重V的低位m-1 bit,第一插值权重U和第二插值权重V为m bit,并大于等于0且小于等于1;根据m-1 bit的第一低位数据u和第二低位数据v确定的权重输入数据,其位数也为m-1 bit,从而可以将乘法器的输入位宽从m bit减小为m-1 bit。利用多路选择器,可以根据第一插值权重U和第二插值权重V的取值,分别确定至少一个乘法器对应的待运算数据,其中,每个乘法器对应的待运算数据为需要进行双线性插值处理的多个待插值数据中的一个,将待运算数据输入相应的乘法器,从而可以调整乘法器对应的乘法运算结果,进而保证双线性插值处理结果的准确性。通过乘法器,可以根据待运算数据和权重输入数据,进行对应的乘法运算,确定乘法运算结果,再通过加法器,可以对各个乘法器对应的乘法运算结果进行求和运算,确定双线性插值处理结果。通过减小乘法器的输入位宽,并通过多路选择器调整待插值数据输入乘法器的逻辑,可以减少装置整体的电路面积,节约进行双线性插值处理的硬件资源消耗。In the arithmetic device for performing bilinear interpolation processing in the embodiment of the present disclosure, the weight input data corresponding to each multiplier is determined by using the first low-order data u and the second low-order data v through the weight input module, and the weight input The multiplier corresponding to the data input, wherein the first low-order data u is the low-order m-1 bit of the first interpolation weight U, the second low-order data v is the low-order m-1 bit of the second interpolation weight V, and the first interpolation weight U and the second interpolation weight V is m bit, and is greater than or equal to 0 and less than or equal to 1; the weight input data determined according to the first low-order data u and the second low-order data v of m-1 bit, the number of bits is also m-1 bit, so that the input bit width of the multiplier can be reduced from m bit to m-1 bit. Using the multiplexer, according to the values of the first interpolation weight U and the second interpolation weight V, the data to be calculated corresponding to at least one multiplier can be respectively determined, wherein the data to be calculated corresponding to each multiplier is the data to be calculated that needs to be double One of the plurality of data to be interpolated by linear interpolation is input to the corresponding multiplier, so that the multiplication result corresponding to the multiplier can be adjusted, thereby ensuring the accuracy of the bilinear interpolation processing result. Through the multiplier, the corresponding multiplication operation can be performed according to the data to be calculated and the weight input data, and the result of the multiplication operation can be determined, and then through the adder, the multiplication results corresponding to each multiplier can be summed to determine the bilinear interpolation process result. By reducing the input bit width of the multiplier and adjusting the logic of inputting data to be interpolated into the multiplier through the multiplexer, the overall circuit area of the device can be reduced, and the consumption of hardware resources for bilinear interpolation processing can be saved.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the accompanying drawings.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The accompanying drawings here are incorporated into the description and constitute a part of the present description. These drawings show embodiments consistent with the present disclosure, and are used together with the description to explain the technical solution of the present disclosure.
图1示出一种相关技术中用于进行双线性插值处理的运算装置的示意图。FIG. 1 shows a schematic diagram of an arithmetic device for bilinear interpolation processing in the related art.
图2示出根据本公开实施例的一种用于进行双线性插值处理的运算装置的框图。Fig. 2 shows a block diagram of an arithmetic device for performing bilinear interpolation processing according to an embodiment of the present disclosure.
图3示出根据本公开实施例的一种用于进行双线性插值处理的运算装置的示意图。Fig. 3 shows a schematic diagram of an arithmetic device for performing bilinear interpolation processing according to an embodiment of the present disclosure.
具体实施方式Detailed ways
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numbers in the figures indicate functionally identical or similar elements. While various aspects of the embodiments are shown in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as superior or better than other embodiments.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this article is just an association relationship describing associated objects, which means that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist simultaneously, and there exists alone B these three situations. In addition, the term "at least one" herein means any one of a variety or any combination of at least two of the more, for example, including at least one of A, B, and C, which may mean including from A, Any one or more elements selected from the set formed by B and C.
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific implementation manners. It will be understood by those skilled in the art that the present disclosure may be practiced without some of the specific details. In some instances, methods, means, components and circuits that are well known to those skilled in the art have not been described in detail so as to obscure the gist of the present disclosure.
双线性插值是有两个变量的插值函数的线性插值扩展,其原理是在两个方向分别进行一次线性插值。双线性插值作为数值分析中的一种插值算法,广泛应用在信号处理,数字图像和视频处理等技术领域。Bilinear interpolation is a linear interpolation extension of the interpolation function with two variables, and its principle is to perform a linear interpolation in two directions respectively. As an interpolation algorithm in numerical analysis, bilinear interpolation is widely used in technical fields such as signal processing, digital image and video processing.
双线性插值的一种表达式可以表示为下述公式(1)至(3):An expression of bilinear interpolation can be expressed as the following formulas (1) to (3):
result_ab=a×(1-U)+b×U (1)result_ab=a×(1-U)+b×U (1)
result_cd=c×(1-U)+d×U (2)result_cd=c×(1-U)+d×U (2)
result_abcd=result_ab×(1-V)+result_cd×V (3)result_abcd=result_ab×(1-V)+result_cd×V (3)
其中,a、b、c、d表示需要进行双线性插值处理的四个待插值数据;result_ab表示在第一方向进行线性插值的输出结果;result_cd表示在第一方向进行线性插值的输出结果;result_abcd表示在第二方向进行线性插值的输出结果,即双线性插值的输出结果;U表示在第一方向进行线性插值对应的第一插值权重,V表示第二方向进行线性插值对应的第二插值权重,U和V的取值范围为大于等于0且小于等于1。Among them, a, b, c, d represent the four data to be interpolated that need to be processed by bilinear interpolation; result_ab represents the output result of linear interpolation in the first direction; result_cd represents the output result of linear interpolation in the first direction; result_abcd indicates the output result of linear interpolation in the second direction, that is, the output result of bilinear interpolation; U indicates the first interpolation weight corresponding to linear interpolation in the first direction, and V indicates the second interpolation corresponding to linear interpolation in the second direction. Interpolation weight, the value range of U and V is greater than or equal to 0 and less than or equal to 1.
相关技术中的一种方式,根据上述公式(1)和(2),分别计算第一方向进行线性插值输出结果result_ab和result_cd,再根据上述公式(3),将这两个输出结果在第二方向进行线性插值,确定双线性插值的输出结果result_abcd。One way in the related technology is to calculate the linear interpolation output results result_ab and result_cd in the first direction according to the above formulas (1) and (2), and then calculate the two output results in the second direction according to the above formula (3). The direction is linearly interpolated to determine the output result_abcd of the bilinear interpolation.
相关技术中的另一种方式,根据上述公式(1)、(2)和(3),将双线性插值的输出结果result_abcd表示为下述公式(4):In another way in the related technology, according to the above formulas (1), (2) and (3), the output result_abcd of the bilinear interpolation is expressed as the following formula (4):
result_abcd= a×(1-U)(1-V)+b×U(1-V)+c×(1-U)V+d×UV (4)result_abcd= a×(1-U)(1-V)+b×U(1-V)+c×(1-U)V+d×UV (4)
根据上述公式(4),可以直接确定双线性插值的输出结果result_abcd。According to the above formula (4), the output result_abcd of the bilinear interpolation can be directly determined.
上述两种技术方案直接根据第一插值权重U和第二插值权重V进行双线性插值处理,没有对第一插值权重U和第二插值权重V进行优化处理。现有技术中,进行双线性插值处理时,需要将第一插值权重U和第二插值权重V输入至乘法器进行乘法运算。第一插值权重U和第二插值权重V可以表示为m bit的二进制数,其中,m为第一插值权重U和第二插值权重V对应的二进制数的位数,相应的,乘法器的输入位宽也为m bit。由于第一插值权重U和第二插值权重V的取值范围为大于等于0且小于等于1,当第一插值权重U和第二插值权重V的精度较高,即m较大时,乘法器对应的输入位宽也较大,耗费的硬件资源也会较大。The above two technical solutions directly perform bilinear interpolation processing according to the first interpolation weight U and the second interpolation weight V, without optimizing the first interpolation weight U and the second interpolation weight V. In the prior art, when performing bilinear interpolation processing, the first interpolation weight U and the second interpolation weight V need to be input to a multiplier for multiplication. The first interpolation weight U and the second interpolation weight V can be expressed as m-bit binary numbers, where m is the number of bits of the binary number corresponding to the first interpolation weight U and the second interpolation weight V, and correspondingly, the input of the multiplier The bit width is also m bit. Since the value range of the first interpolation weight U and the second interpolation weight V is greater than or equal to 0 and less than or equal to 1, when the accuracy of the first interpolation weight U and the second interpolation weight V is high, that is, when m is large, the multiplier The corresponding input bit width is also larger, and the hardware resources consumed will also be larger.
图1示出一种相关技术中用于进行双线性插值处理的运算装置的示意图。如图1所示,装置100可以用于进行双线性插值处理,装置100中包括乘法器101、乘法器102、乘法器103和乘法器104,以及加法器105。FIG. 1 shows a schematic diagram of an arithmetic device for bilinear interpolation processing in the related art. As shown in FIG. 1 , an
基于上述公式(4)可知,乘法器101可以用于确定a×(1-U)(1-V)对应的乘法运算结果,乘法器102可以用于确定b×U(1-V)对应的乘法运算结果,乘法器103可以用于确定c×(1-U)V对应的乘法运算结果,乘法器104可以用于确定d×UV对应的乘法运算结果,加法器105可以用于对各个乘法器对应的乘法运算结果进行求和运算,从而确定双线性插值处理结果。Based on the above formula (4), it can be known that the multiplier 101 can be used to determine the multiplication result corresponding to a×(1-U)(1-V), and the multiplier 102 can be used to determine the result corresponding to b×U(1-V). The multiplication result, the multiplier 103 can be used to determine the corresponding multiplication result of c×(1-U)V, the multiplier 104 can be used to determine the multiplication result corresponding to d×UV, and the adder 105 can be used for each multiplication The multiplication results corresponding to the devices are summed to determine the bilinear interpolation processing result.
其中,第一插值权重U和第二插值权重V可以用m bit的二进制数表示。相应的,乘法器的输入位宽也需要为m bit。由于第一插值权重U和第二插值权重V的取值范围为大于等于0且小于等于1,当U和V的精度较高,即m较大时,导致乘法器的输入位宽较大,需要较大的硬件资源消耗。Wherein, the first interpolation weight U and the second interpolation weight V may be represented by m-bit binary numbers. Correspondingly, the input bit width of the multiplier also needs to be m bits. Since the value range of the first interpolation weight U and the second interpolation weight V is greater than or equal to 0 and less than or equal to 1, when the precision of U and V is high, that is, when m is large, the input bit width of the multiplier is large, It requires a large consumption of hardware resources.
本公开提供了一种用于进行双线性插值处理的运算装置,可以节省硬件资源的消耗。下面详细介绍本公开提供的用于进行双线性插值处理的运算装置。The present disclosure provides an arithmetic device for bilinear interpolation processing, which can save consumption of hardware resources. The calculation device for performing bilinear interpolation processing provided by the present disclosure will be described in detail below.
图2示出根据本公开实施例的一种用于进行双线性插值处理的运算装置的框图。如图2所示,装置200包括:权重输入模块201、多路选择器202、多个乘法器203和加法器204,其中,乘法器203的输入位宽为m-1 bit。Fig. 2 shows a block diagram of an arithmetic device for performing bilinear interpolation processing according to an embodiment of the present disclosure. As shown in FIG. 2 , the
权重输入模块201,用于利用第一低位数据u和第二低位数据v,确定各个乘法器203分别对应的权重输入数据,并将权重输入数据输入对应的乘法器203,其中,第一低位数据u为第一插值权重U的低位m-1 bit,第二低位数据v为第二插值权重V的低位m-1 bit,第一插值权重U和第二插值权重V为m bit,并大于等于0且小于等于1,m为第一插值权重U与第二插值权重V对应的二进制数的位数。The weight input module 201 is configured to use the first low-order data u and the second low-order data v to determine the weight input data corresponding to each multiplier 203, and input the weight input data to the corresponding multiplier 203, wherein the first low-order data u is the low m-1 bit of the first interpolation weight U, the second low data v is the low m-1 bit of the second interpolation weight V, the first interpolation weight U and the second interpolation weight V are m bits, and are greater than or equal to 0 and less than or equal to 1, m is the number of bits of the binary number corresponding to the first interpolation weight U and the second interpolation weight V.
多路选择器202,用于根据第一插值权重U和第二插值权重V的取值,分别确定每个乘法器203对应的待运算数据,并将待运算数据输入相应的乘法器203,其中,每个乘法器203对应的待运算数据为需要进行双线性插值处理的多个待插值数据中的一个。The multiplexer 202 is used to determine the data to be operated corresponding to each multiplier 203 according to the values of the first interpolation weight U and the second interpolation weight V, and input the data to be operated to the corresponding multiplier 203, wherein , the data to be operated corresponding to each multiplier 203 is one of multiple data to be interpolated that needs to be processed by bilinear interpolation.
乘法器203,用于根据待运算数据和权重输入数据,进行对应的乘法运算,确定乘法运算结果。The multiplier 203 is configured to perform a corresponding multiplication operation according to the data to be operated and the weight input data, and determine the result of the multiplication operation.
加法器204,用于对各个乘法器203对应的乘法运算结果进行求和运算,确定多个待插值数据对应的双线性插值处理结果。The adder 204 is configured to sum the multiplication results corresponding to each multiplier 203 to determine the bilinear interpolation processing results corresponding to the plurality of data to be interpolated.
其中,双线性插值处理对应的第一插值权重U和第二插值权重V,可以表示为m bit的二进制数,U和V的取值范围为大于等于0且小于等于1。Wherein, the first interpolation weight U and the second interpolation weight V corresponding to the bilinear interpolation process can be expressed as m-bit binary numbers, and the value range of U and V is greater than or equal to 0 and less than or equal to 1.
通过权重输入模块201,可以根据第一低位数据u和第二低位数据v,也就是第一插值权重U的低位m-1 bit和第二插值权重V的低位m-1 bit,确定每个乘法器203对应的权重输入数据,并将权重输入数据分别输入每个乘法器203。权重输入模块201的具体结构,可以根据实际的使用需求进行设置,本公开对此不做具体限定。Through the weight input module 201, each multiplication can be determined according to the first low-order data u and the second low-order data v, that is, the low-order m-1 bit of the first interpolation weight U and the low-order m-1 bit of the second interpolation weight V. The weight input data corresponding to the multiplier 203, and input the weight input data to each multiplier 203 respectively. The specific structure of the weight input module 201 can be set according to actual usage requirements, which is not specifically limited in this disclosure.
在一示例中,使用9bit的二进制数来表示大于等于0且小于等于1的第一插值权重U和第二插值权重V。例如,第一插值权重U表示为:011000000,第二插值权重V表示为:001110011,相应的,可以确定第一低位数据u表示为:11000000,第二低位数据v表示为:01110011。In an example, a 9-bit binary number is used to represent the first interpolation weight U and the second interpolation weight V greater than or equal to 0 and less than or equal to 1. For example, the first interpolation weight U is expressed as: 011000000, and the second interpolation weight V is expressed as: 001110011. Correspondingly, it can be determined that the first low-order data u is expressed as: 11000000, and the second low-order data v is expressed as: 01110011.
在一示例中,使用9bit的二进制数来表示大于等于0且小于等于1的第一插值权重U。第一插值权重U的取值等于0时,可以表示为000000000;第一低位数据u为00000000,第一低位数据u的取值为0;此时,第一低位数据u的取值相对于第一插值权重U的取值不变。第一插值权重U的取值等于1时,可以表示为100000000;第一低位数据u为00000000,第一低位数据u的取值为0;此时,第一低位数据u的取值相对于第一插值权重U的取值发生变化。以此类推,第二插值权重V同样适用,此处不做赘述。In an example, a 9-bit binary number is used to represent the first interpolation weight U greater than or equal to 0 and less than or equal to 1. When the value of the first interpolation weight U is equal to 0, it can be expressed as 000000000; the first low-order data u is 00000000, and the value of the first low-order data u is 0; at this time, the value of the first low-order data u is relative to the value of the first low-order data u - The value of the interpolation weight U remains unchanged. When the value of the first interpolation weight U is equal to 1, it can be expressed as 100000000; the first low-order data u is 00000000, and the value of the first low-order data u is 0; at this time, the value of the first low-order data u is relative to the value of the first low-order data u - The value of the interpolation weight U changes. By analogy, the second interpolation weight V is also applicable, and details are not described here.
由于0和1用m bit的二进制数表示时,二者对应的低位m-1 bit相同。当第一插值权重U和/或第二插值权重V的取值等于1时,即第一插值权重U和/或第二插值权重V的最高位为1时,对应的第一低位数据u和/或第二低位数据v的取值为0,也即,第一低位数据u的取值相对于第一插值权重U取值,和/或第二低位数据v的取值相对于第二插值权重V的取值发生变化。此时,根据第一低位数据u和第二低位数据v,确定每个乘法器203对应的权重输入数据,相对于直接根据第一插值权重U和第二插值权重V确定的权重输入数据,权重输入数据的取值发生了变化,导致对应的乘法运算结果可能发生变化,进而可能影响装置200的输出结果,即影响双线性插值处理结果的准确性。Since 0 and 1 are represented by m-bit binary numbers, the corresponding low m-1 bits of the two are the same. When the value of the first interpolation weight U and/or the second interpolation weight V is equal to 1, that is, when the highest bit of the first interpolation weight U and/or the second interpolation weight V is 1, the corresponding first low-order data u and /or the value of the second low-order data v is 0, that is, the value of the first low-order data u is relative to the value of the first interpolation weight U, and/or the value of the second low-order data v is relative to the second interpolation The value of the weight V changes. At this time, according to the first low-order data u and the second low-order data v, the weight input data corresponding to each multiplier 203 is determined. Compared with the weight input data determined directly according to the first interpolation weight U and the second interpolation weight V, the weight The value of the input data has changed, resulting in a change in the corresponding multiplication result, which may affect the output result of the
在一示例中,使用9bit的二进制数来表示大于等于0且小于等于1的第一插值权重U和第二插值权重V。例如,第一插值权重U的取值等于1,且第二插值权重V的取值大于0且小于1时,基于上述公式(4)可知,双线性插值处理结果为b×(1-V)+d×V。结合上述描述可知,此时,第一低位数据u的取值相对于第一插值权重U的取值发生变化,第二低位数据v的取值相对于第二插值权重V的取值不变,如果根据第一低位数据u和第二低位数据v,确定每个乘法器203对应的权重输入数据,基于上述公式(4)进行运算,对应的运算结果为a×(1-v)+c×v=a×(1-V)+c×V。也就是说,根据第一低位数据u和第二低位数据v,确定每个乘法器203对应的权重输入数据,会导致对应的乘法运算结果发生变化,进而影响双线性插值处理结果的准确性。In an example, a 9-bit binary number is used to represent the first interpolation weight U and the second interpolation weight V greater than or equal to 0 and less than or equal to 1. For example, when the value of the first interpolation weight U is equal to 1, and the value of the second interpolation weight V is greater than 0 and less than 1, based on the above formula (4), it can be known that the bilinear interpolation result is b×(1-V )+d×V. It can be seen from the above description that at this time, the value of the first low-order data u changes relative to the value of the first interpolation weight U, and the value of the second low-order data v remains unchanged relative to the value of the second interpolation weight V. If the weight input data corresponding to each multiplier 203 is determined according to the first low-order data u and the second low-order data v, and the operation is performed based on the above formula (4), the corresponding operation result is a×(1-v)+c× v=a×(1-V)+c×V. That is to say, according to the first low-order data u and the second low-order data v, determining the weight input data corresponding to each multiplier 203 will cause the corresponding multiplication results to change, thereby affecting the accuracy of the bilinear interpolation processing results .
因此,为了保证双线性插值处理结果的准确性,可以根据第一插值权重U和第二插值权重V的取值,通过多路选择器202,在多个待插值数据中确定至少一个乘法器203对应的待运算数据,从而对至少一个乘法器203对应的乘法运算结果进行调整。Therefore, in order to ensure the accuracy of the bilinear interpolation processing results, at least one multiplier can be determined among multiple data to be interpolated through the multiplexer 202 according to the values of the first interpolation weight U and the second interpolation weight V 203 corresponding to the data to be operated, so as to adjust the multiplication result corresponding to at least one multiplier 203 .
后文会结合本公开可能的实现方式,对多路选择器202根据第一插值权重U和第二插值权重V的取值,分别确定至少一个乘法器203对应的待运算数据的过程,进行具体描述,此处不做赘述。In the following, in combination with possible implementations of the present disclosure, the process of determining the data to be calculated corresponding to at least one multiplier 203 by the multiplexer 202 according to the values of the first interpolation weight U and the second interpolation weight V will be specifically described. description, and will not be repeated here.
多路选择器202的具体结构以及数量,可以根据实际的使用需求进行设置,本公开对此不做具体限定。The specific structure and quantity of the multiplexer 202 can be set according to actual usage requirements, which is not specifically limited in the present disclosure.
根据每个乘法器203对应的待运算数据和权重输入数据,可以进行对应的乘法运算,从而确定每个乘法器203对应的乘法运算结果。后文会结合本公开可能的实现方式,对乘法器203以及对应的乘法运算进行具体描述,此处不做赘述。According to the data to be operated and the weight input data corresponding to each multiplier 203, a corresponding multiplication operation can be performed, so as to determine the multiplication operation result corresponding to each multiplier 203. The multiplier 203 and the corresponding multiplication operation will be specifically described later in combination with possible implementation manners of the present disclosure, and details are not repeated here.
乘法器203的具体结构以及数量,可以根据实际的使用需求进行设置,本公开对此不做具体限定。The specific structure and quantity of the multiplier 203 can be set according to actual usage requirements, which is not specifically limited in the present disclosure.
通过加法器204,可以对各个乘法器203输出的乘法运算结果进行求和运算,确定求和运算结果,并将求和运算结果确定为多个待插值数据对应的双线性插值处理结果。The adder 204 can sum the multiplication results output by each multiplier 203, determine the sum result, and determine the sum result as a bilinear interpolation processing result corresponding to a plurality of data to be interpolated.
加法器204的具体结构,可以根据实际的使用需求进行设置,本公开对此不做具体限定。The specific structure of the adder 204 can be set according to actual usage requirements, which is not specifically limited in the present disclosure.
本公开实施例的用于进行双线性插值处理的运算装置,通过权重输入模块,利用第一低位数据u和第二低位数据v,确定各个乘法器分别对应的权重输入数据,并将权重输入数据输入对应的乘法器,其中,第一低位数据u为第一插值权重U的低位m-1 bit,第二低位数据v为第二插值权重V的低位m-1 bit,第一插值权重U和第二插值权重V为m bit,并大于等于0且小于等于1;根据m-1 bit的第一低位数据u和第二低位数据v确定的权重输入数据,其位数也为m-1 bit,从而可以将乘法器的输入位宽从m bit减小为m-1 bit。利用多路选择器,可以根据第一插值权重U和第二插值权重V的取值,分别确定至少一个乘法器对应的待运算数据,其中,每个乘法器对应的待运算数据为需要进行双线性插值处理的多个待插值数据中的一个,将待运算数据输入相应的乘法器,从而可以调整乘法器对应的乘法运算结果,进而保证双线性插值处理结果的准确性。通过乘法器,可以根据待运算数据和权重输入数据,进行对应的乘法运算,确定乘法运算结果,再通过加法器,可以对各个乘法器对应的乘法运算结果进行求和运算,确定双线性插值处理结果。通过减小乘法器的输入位宽,并通过多路选择器调整待插值数据输入乘法器的逻辑,可以减少装置整体的电路面积,节约进行双线性插值处理的硬件资源消耗。In the arithmetic device for performing bilinear interpolation processing in the embodiment of the present disclosure, the weight input data corresponding to each multiplier is determined by using the first low-order data u and the second low-order data v through the weight input module, and the weight input The multiplier corresponding to the data input, wherein the first low-order data u is the low-order m-1 bit of the first interpolation weight U, the second low-order data v is the low-order m-1 bit of the second interpolation weight V, and the first interpolation weight U and the second interpolation weight V is m bit, and is greater than or equal to 0 and less than or equal to 1; the weight input data determined according to the first low-order data u and the second low-order data v of m-1 bit, the number of bits is also m-1 bit, so that the input bit width of the multiplier can be reduced from m bit to m-1 bit. Using the multiplexer, according to the values of the first interpolation weight U and the second interpolation weight V, the data to be calculated corresponding to at least one multiplier can be respectively determined, wherein the data to be calculated corresponding to each multiplier is the data to be calculated that needs to be double One of the plurality of data to be interpolated by linear interpolation is input to the corresponding multiplier, so that the multiplication result corresponding to the multiplier can be adjusted, thereby ensuring the accuracy of the bilinear interpolation processing result. Through the multiplier, the corresponding multiplication operation can be performed according to the data to be calculated and the weight input data, and the result of the multiplication operation can be determined, and then through the adder, the multiplication results corresponding to each multiplier can be summed to determine the bilinear interpolation process result. By reducing the input bit width of the multiplier and adjusting the logic of inputting data to be interpolated into the multiplier through the multiplexer, the overall circuit area of the device can be reduced, and the consumption of hardware resources for bilinear interpolation processing can be saved.
在一种可能的实现方式中,多个乘法器203包括:第一乘法器、第二乘法器、第三乘法器和第四乘法器,权重输入数据包括:第一权重输入数据、第二权重输入数据、第三权重输入书和第四权重输入数据;权重输入模块输入第一乘法器的第一权重输入数据为1-u和1-v;权重输入模块输入第二乘法器的第二权重输入数据为u和1-v;权重输入模块输入第三乘法器的第三权重输入数据为1-u和v;权重输入模块输入第四乘法器的第四权重输入数据为u和v。In a possible implementation manner, the multiple multipliers 203 include: a first multiplier, a second multiplier, a third multiplier, and a fourth multiplier, and the weight input data includes: the first weight input data, the second weight Input data, the third weight input book and the fourth weight input data; the weight input module inputs the first weight input data of the first multiplier to be 1-u and 1-v; the weight input module inputs the second weight of the second multiplier The input data are u and 1-v; the third weight input data input to the third multiplier by the weight input module are 1-u and v; the fourth weight input data input by the weight input module to the fourth multiplier are u and v.
图3示出根据本公开实施例的一种用于进行双线性插值处理的运算装置的示意图。如图3所示,乘法器203包括:第一乘法器2031、第二乘法器2032、第三乘法器2033和第四乘法器2034。Fig. 3 shows a schematic diagram of an arithmetic device for performing bilinear interpolation processing according to an embodiment of the present disclosure. As shown in FIG. 3 , the multiplier 203 includes: a first multiplier 2031 , a
根据上述公式(4)可以确定:第一乘法器2031中与待运算数据进行乘法运算的乘法项为(1-U)(1-V),因此,可以确定权重输入模块输入第一乘法器的第一权重输入数据为1-u和1-v;第二乘法器2032中与待运算数据进行乘法运算的乘法项为U(1-V),因此,可以确定权重输入模块输入第二乘法器的第二权重输入数据为u和1-v;第三乘法器2033中与待运算数据进行乘法运算的乘法项为(1-U)V,因此,可以确定权重输入模块输入第三乘法器的第三权重输入数据为1-u和v;第四乘法器2034中与待运算数据进行乘法运算的乘法项为UV,因此,可以确定权重输入模块输入第四乘法器的第四权重输入数据为u和v。According to the above formula (4), it can be determined that: the multiplication item in the first multiplier 2031 and the data to be calculated is (1-U)(1-V), therefore, it can be determined that the weight input module inputs the first multiplier The first weight input data is 1-u and 1-v; The multiplication item that is multiplied with the data to be operated in the
通过多路选择器202,在多个待插值数据中分别确定每个乘法器203对应的待运算数据后,将待运算数据输入至对应的乘法器203中。乘法器203可以根据待运算数据,以及该乘法器203对应的乘法项,确定对应的乘法运算结果。Through the multiplexer 202 , after determining the data to be operated corresponding to each multiplier 203 among the plurality of data to be interpolated, the data to be operated is input to the corresponding multiplier 203 . The multiplier 203 can determine the corresponding multiplication result according to the data to be operated and the multiplication item corresponding to the multiplier 203 .
在一种可能的实现方式中,多路选择器202,用于根据第一插值权重U和第二插值权重V的最高位,确定第一低位数据u相对于第一插值权重U的取值变化,以及第二低位数据v相对于第二插值权重V的取值变化;多路选择器,用于根据第一低位数据u相对于第一插值权重U的取值变化、第二低位数据v相对于第二插值权重V的取值变化、以及多个待插值数据,确定至少一个乘法器对应的待运算数据,其中,多个待插值数据包括:第一待插值数据、第二待插值数据、第三待插值数据和第四待插值数据。In a possible implementation manner, the multiplexer 202 is configured to determine the value change of the first low-order data u relative to the first interpolation weight U according to the highest bit of the first interpolation weight U and the second interpolation weight V , and the value change of the second low-order data v relative to the second interpolation weight V; the multiplexer is used to change the value of the first low-order data u relative to the first interpolation weight U, and the second low-order data v relative to Based on the value change of the second interpolation weight V and a plurality of data to be interpolated, determine data to be operated corresponding to at least one multiplier, wherein the plurality of data to be interpolated includes: first data to be interpolated, second data to be interpolated, The third data to be interpolated and the fourth data to be interpolated.
第一低位数据u相对于第一插值权重U的取值变化,指的是m-1 bit的第一低位数据u指示的取值,与m bit的第一插值权重U指示的取值,是否发生变化;第二低位数据v相对于第二插值权重V的取值变化,指的是m-1 bit的第二低位数据v指示的取值,与m bit的第二插值权重V指示的取值,是否发生变化。The value change of the first low-order data u relative to the first interpolation weight U refers to the value indicated by the first low-order data u of m-1 bits, and the value indicated by the first interpolation weight U of m bits, whether changes; the value change of the second low-order data v relative to the second interpolation weight V refers to the value indicated by the second low-order data v of m-1 bit, and the value indicated by the second interpolation weight V of m bits value, whether it has changed.
由前文可知,当第一插值权重U和/或第二插值权重V的取值等于1时,第一低位数据u和/或第二低位数据v的取值相对于第一插值权重U和/或第二插值权重V的取值发生变化。当第一插值权重U和/或第二插值权重V大于等于0且小于1时,第一低位数据u和/或第二低位数据v的取值相对于第一插值权重U和/或第二插值权重V的取值不变。As can be seen from the foregoing, when the value of the first interpolation weight U and/or the second interpolation weight V is equal to 1, the value of the first low-order data u and/or the second low-order data v is relative to the value of the first interpolation weight U and/or Or the value of the second interpolation weight V changes. When the first interpolation weight U and/or the second interpolation weight V is greater than or equal to 0 and less than 1, the value of the first low-order data u and/or the second low-order data v is relative to the first interpolation weight U and/or the second The value of the interpolation weight V remains unchanged.
由于第一插值权重U和第二插值权重V为m bit的二进制数,且取值范围为大于等于0且小于等于1。因此,可以通过第一插值权重U和第一插值权重V的最高位,快速确定第一插值权重U和第二插值权重V的取值是否等于1,从而确定第一低位数据u相对于第一插值权重U的取值变化,以及第二低位数据v相对于第二插值权重V的取值变化。Since the first interpolation weight U and the second interpolation weight V are m-bit binary numbers, and the value range is greater than or equal to 0 and less than or equal to 1. Therefore, it is possible to quickly determine whether the values of the first interpolation weight U and the second interpolation weight V are equal to 1 through the highest bit of the first interpolation weight U and the first interpolation weight V, thereby determining the relative value of the first low-order data u to the first The value of the interpolation weight U changes, and the value of the second low-order data v relative to the second interpolation weight V changes.
为了保证每个乘法器203对应的乘法运算结果正确,多路选择器202可以根据第一插值权重U和第二插值权重V的最高位,确定第一低位数据u相对于第一插值权重U的取值变化,以及第二低位数据v相对于第二插值权重V的取值变化。In order to ensure that the multiplication result corresponding to each multiplier 203 is correct, the multiplexer 202 can determine the first low-order data u relative to the first interpolation weight U according to the highest bit of the first interpolation weight U and the second interpolation weight V The value changes, and the value of the second low-order data v relative to the second interpolation weight V changes.
根据第一低位数据u相对于第一插值权重U的取值变化、第二低位数据v相对于第二插值权重V的取值变化、以及多个待插值数据,多路选择器202可以确定至少一个乘法器对应的待运算数据。According to the value change of the first low-order data u relative to the first interpolation weight U, the value change of the second low-order data v relative to the second interpolation weight V, and a plurality of data to be interpolated, the multiplexer 202 can determine at least Data to be operated corresponding to a multiplier.
其中,多个待插值数据包括:第一待插值数据a、第二待插值数据b、第三待插值数据c和第四待插值数据d。通过多路选择器202,可以在第一待插值数据a、第二待插值数据b、第三待插值数据c和第四待插值数据d中,分别确定第一乘法器2031、第二乘法器2032和第三乘法器2033对应的待运算数据。Wherein, the multiple data to be interpolated include: first data to be interpolated a, second data to be interpolated b, third data to be interpolated c, and fourth data to be interpolated d. Through the multiplexer 202, the first multiplier 2031, the
基于上述公式(4)可知,第一低位数据u的取值相对于第一插值权重U的取值发生变化,和/或第二低位数据v的取值相对于第二插值权重V的取值发生变化时,将根据第一低位数据u和第二低位数据v确定的权重输入数据,输入第四乘法器2034,其对应的乘法运算结果均为0。因此,在第一低位数据u的取值相对于第一插值权重U的取值不变,且第二低位数据v的取值相对于第二插值权重V的取值不变时,正常将第四待插值数据d输入至第四乘法器2034即可;而在第一低位数据u的取值相对于第一插值权重U的取值发生变化,和/或第二低位数据v的取值相对于第二插值权重V的取值发生变化时,将根据第一低位数据u和第二低位数据v确定的权重输入数据,输入第四乘法器2034,第四乘法器2034对应的乘法运算结果必定为0,因此,无需设置多路选择器选择对应的待运算数据。Based on the above formula (4), it can be seen that the value of the first low-order data u changes relative to the value of the first interpolation weight U, and/or the value of the second low-order data v relative to the value of the second interpolation weight V When a change occurs, the weight input data determined according to the first low-order data u and the second low-order data v is input to the
在一种可能的实现方式中,多路选择器202,用于在第一插值权重U和第二插值权重V的最高位均为0时,确定第一低位数据u的取值相对于第一插值权重U的取值不变,以及第二低位数据v的取值相对于第二插值权重V的取值不变。In a possible implementation manner, the multiplexer 202 is configured to determine that the value of the first low-order data u is relative to the first The value of the interpolation weight U remains unchanged, and the value of the second low-order data v is unchanged relative to the value of the second interpolation weight V.
在第一插值权重U和第二插值权重V的最高位均为0时,即第一插值权重U和第二插值权重V的取值均大于等于0且小于1。此时,第一低位数据u的取值相对于第一插值权重U的取值不变,且第二低位数据v的取值相对于第二插值权重V的取值不变。When the highest bits of the first interpolation weight U and the second interpolation weight V are both 0, that is, the values of the first interpolation weight U and the second interpolation weight V are both greater than or equal to 0 and less than 1. At this time, the value of the first low-order data u remains unchanged relative to the value of the first interpolation weight U, and the value of the second low-order data v remains unchanged relative to the value of the second interpolation weight V.
在一示例中,使用9bit的二进制数来表示大于等于0且小于等于1的第一插值权重U和第二插值权重V。例如,第一插值权重U的取值等于0.75时,可以表示为011000000;第二插值权重V的取值等于0.45时,可以表示为001110011。第一插值权重U和第二插值权重V的最高位均为0,即第一插值权重U和第二插值权重V的取值均大于等于0且小于1。相应的,第一低位数据u表示为11000000,第一低位数据u的取值等于0.75;第二低位数据v表示为01110011,第二低位数据v的取值等于0.45。此时,第一低位数据u的取值相对于第一插值权重U的取值不变,第二低位数据v的取值相对于第二插值权重V的取值不变。In an example, a 9-bit binary number is used to represent the first interpolation weight U and the second interpolation weight V greater than or equal to 0 and less than or equal to 1. For example, when the value of the first interpolation weight U is equal to 0.75, it may be expressed as 011000000; when the value of the second interpolation weight V is equal to 0.45, it may be expressed as 001110011. The highest bits of the first interpolation weight U and the second interpolation weight V are both 0, that is, the values of the first interpolation weight U and the second interpolation weight V are both greater than or equal to 0 and less than 1. Correspondingly, the first low-order data u is represented as 11000000, and the value of the first low-order data u is equal to 0.75; the second low-order data v is represented as 01110011, and the value of the second low-order data v is equal to 0.45. At this time, the value of the first low-order data u remains unchanged relative to the value of the first interpolation weight U, and the value of the second low-order data v remains unchanged relative to the value of the second interpolation weight V.
在一种可能的实现方式中,多路选择器202,用于在第一低位数据u的取值相对于第一插值权重U的取值不变,以及第二低位数据v的取值相对于第二插值权重V的取值不变时,确定第一乘法器2031对应的待运算数据为第一待插值数据,第二乘法器2032对应的待运算数据为第二待插值数据,第三乘法器2033对应的待运算数据为第三待插值数据,第四乘法器2034对应的待运算数据为第四待插值数据。In a possible implementation manner, the multiplexer 202 is configured to change the value of the first low-order data u relative to the value of the first interpolation weight U, and the value of the second low-order data v relative to When the value of the second interpolation weight V is constant, it is determined that the data to be operated corresponding to the first multiplier 2031 is the first data to be interpolated, the data to be operated corresponding to the
以上述图3为例,如图3所示,多路选择器202包括:第一多路选择器2021、第二多路选择器2022和第三多路选择器2023。Taking the aforementioned FIG. 3 as an example, as shown in FIG. 3 , the multiplexer 202 includes: a first multiplexer 2021 , a second multiplexer 2022 and a third multiplexer 2023 .
第一低位数据u的取值相对于第一插值权重U的取值不变,以及第二低位数据v的取值相对于第二插值权重V的取值不变,也就是说,第一低位数据u和第二低位数据v的取值,可以表示第一插值权重U和第二插值权重V的真实取值。因此,根据m-1 bit的第一低位数据u和第二低位数据v确定的权重输入数据与待运算数据进行乘法运算,相对于根据mbit的第一插值权重U和m bit的第二插值权重V确定的权重输入数据与待运算数据进行乘法运算,其对应的乘法运算结果不变。The value of the first low-order data u is unchanged relative to the value of the first interpolation weight U, and the value of the second low-order data v is unchanged relative to the value of the second interpolation weight V, that is, the first low-order The values of the data u and the second low-order data v may represent real values of the first interpolation weight U and the second interpolation weight V. Therefore, the weight input data determined according to the first low-order data u and the second low-order data v of m-1 bits are multiplied with the data to be operated, relative to the first interpolation weight U and the second interpolation weight according to m bits The weight input data determined by V is multiplied with the data to be operated, and the corresponding multiplication result remains unchanged.
当第一插值权重U和第二插值权重V的取值大于等于0且小于1时,根据上述公式(4),可以确定双线性插值处理结果result_abcd=a×(1-U)(1-V)+b×U(1-V)+c×(1-U)V+d×UV。由于第一插值权重U和第二插值权重V的取值大于等于0且小于1,第一低位数据u的取值相对于第一插值权重U的取值不变,以及第二低位数据v的取值相对于第二插值权重V的取值不变。因此,可以通过第一多路选择器2021确定第一乘法器2031对应的待运算数据为第一待插值数据a,通过第二多路选择器2022确定第二乘法器2032对应的待运算数据为第二待插值数据b,通过第三多路选择器2023确定第三乘法器2033对应的待运算数据为第三待插值数据c,以及确定第四乘法器2034对应的待运算数据为第四待插值数据d。此时,可以保证双线性插值处理结果result_abcd=a×(1-u)(1-v)+b×u(1-v)+c×(1-u)v+d×uv=a×(1-U)(1-V)+b×U(1-V)+c×(1-U)V+d×UV。When the values of the first interpolation weight U and the second interpolation weight V are greater than or equal to 0 and less than 1, according to the above formula (4), the bilinear interpolation processing result result_abcd=a×(1-U)(1- V)+b×U(1-V)+c×(1-U)V+d×UV. Since the values of the first interpolation weight U and the second interpolation weight V are greater than or equal to 0 and less than 1, the value of the first low-order data u remains unchanged relative to the value of the first interpolation weight U, and the value of the second low-order data v The value is unchanged relative to the value of the second interpolation weight V. Therefore, it can be determined by the first multiplexer 2021 that the data to be operated corresponding to the first multiplier 2031 is the first data to be interpolated a, and the data to be operated corresponding to the
在一种可能的实现方式中,多路选择器202,用于在第一插值权重U的最高位为1,第二插值权重V的最高位为0时,确定第一低位数据u的取值相对于第一插值权重U的取值发生变化,以及第二低位数据v的取值相对于第二插值权重V的取值不变。In a possible implementation manner, the multiplexer 202 is configured to determine the value of the first low-order data u when the highest bit of the first interpolation weight U is 1 and the highest bit of the second interpolation weight V is 0 The value of the first interpolation weight U changes, and the value of the second low-order data v remains unchanged relative to the value of the second interpolation weight V.
在第一插值权重U的最高位为1,第二插值权重V的最高位为0时,即第一插值权重U的取值等于1,第二插值权重V的取值大于等于0且小于1。此时,第一低位数据u的取值相对于第一插值权重U的取值发生变化,而第二低位数据v的取值相对于第二插值权重V的取值不变。When the highest bit of the first interpolation weight U is 1 and the highest bit of the second interpolation weight V is 0, that is, the value of the first interpolation weight U is equal to 1, and the value of the second interpolation weight V is greater than or equal to 0 and less than 1 . At this time, the value of the first low-order data u changes relative to the value of the first interpolation weight U, while the value of the second low-order data v remains unchanged relative to the value of the second interpolation weight V.
在一示例中,使用9bit的二进制数来表示大于等于0且小于等于1的第一插值权重U和第二插值权重V。第一插值权重U的取值等于1时,可以表示为00000000,第二插值权重V的取值等于0.45时,可以表示为001110011。第一插值权重U的最高位为1,第二插值权重V的最高位为0,即第一插值权重U的取值等于1,第二插值权重V的取值大于等于0且小于1。相应的,第一低位数据u表示为00000000,第一低位数据u的取值等于0;第二低位数据v表示为01110011,第二低位数据v的取值等于0.45。此时,第一低位数据u的取值相对于第一插值权重U的取值发生变化,第二低位数据v的取值相对于第二插值权重V的取值不变。In an example, a 9-bit binary number is used to represent the first interpolation weight U and the second interpolation weight V greater than or equal to 0 and less than or equal to 1. When the value of the first interpolation weight U is equal to 1, it may be expressed as 00000000, and when the value of the second interpolation weight V is equal to 0.45, it may be expressed as 001110011. The highest bit of the first interpolation weight U is 1, and the highest bit of the second interpolation weight V is 0, that is, the value of the first interpolation weight U is equal to 1, and the value of the second interpolation weight V is greater than or equal to 0 and less than 1. Correspondingly, the first low-order data u is represented as 00000000, and the value of the first low-order data u is equal to 0; the second low-order data v is represented as 01110011, and the value of the second low-order data v is equal to 0.45. At this time, the value of the first low-order data u changes relative to the value of the first interpolation weight U, and the value of the second low-order data v remains unchanged relative to the value of the second interpolation weight V.
在一种可能的实现方式中,多路选择器202,用于在第一低位数据u的取值相对于第一插值权重U的取值发生变化,以及第二低位数据v的取值相对于第二插值权重V的取值不变时,确定第一乘法器2031对应的待运算数据为第二待插值数据,第三乘法器2033对应的待运算数据为第四待插值数据。In a possible implementation manner, the multiplexer 202 is configured to change the value of the first low-order data u relative to the value of the first interpolation weight U, and the value of the second low-order data v relative to When the value of the second interpolation weight V remains unchanged, it is determined that the data to be calculated corresponding to the first multiplier 2031 is the second data to be interpolated, and the data to be calculated corresponding to the third multiplier 2033 is determined to be the fourth data to be interpolated.
第一低位数据u的取值相对于第一插值权重U的取值发生变化,以及第二低位数据v的取值相对于第二插值权重V的取值不变,也就是说,第一低位数据u的取值无法表示第一插值权重U的真实取值;第二低位数据v的取值可以表示第二插值权重V的真实取值。因此,根据m-1 bit的第一低位数据u确定的权重输入数据与待运算数据进行乘法运算,相对于根据m bit的第一插值权重U确定的权重输入数据与待运算数据进行乘法运算,其对应的乘法运算结果可能发生变化。The value of the first low-order data u changes relative to the value of the first interpolation weight U, and the value of the second low-order data v remains unchanged relative to the value of the second interpolation weight V, that is, the first low-order The value of the data u cannot represent the real value of the first interpolation weight U; the value of the second low-order data v can represent the real value of the second interpolation weight V. Therefore, the weight input data determined according to the first low-order data u of m-1 bits is multiplied with the data to be operated, and the weight input data determined according to the first interpolation weight U of m bits is multiplied with the data to be operated, Its corresponding multiplication result may change.
当第一插值权重U的取值等于1,第二插值权重V的取值大于等于0且小于1时,根据上述公式(4),可以确定双线性插值处理结果result_abcd=b×(1-V)+d×V。由于第一插值权重U的取值等于1,第一低位数据u的取值等于0,相对于第一插值权重U的取值发生变化;第二插值权重V的取值大于等于0且小于1,第二低位数据v的取值相对于第二插值权重V的取值不变。,因此,为了保证通过装置200进行双线性插值处理的准确性,通过第一多路选择器2021确定第一乘法器2031对应的待运算数据为第二待插值数据b,通过第三多路选择器2023确定第三乘法器2033对应的待运算数据为第四待插值数据d。此时,可以保证双线性插值处理结果result_abcd=b×(1-v)+d×v=b×(1-V)+d×V。When the value of the first interpolation weight U is equal to 1, and the value of the second interpolation weight V is greater than or equal to 0 and less than 1, according to the above formula (4), the bilinear interpolation result result_abcd=b×(1- V)+d×V. Since the value of the first interpolation weight U is equal to 1, the value of the first low-order data u is equal to 0, which changes relative to the value of the first interpolation weight U; the value of the second interpolation weight V is greater than or equal to 0 and less than 1 , the value of the second low-order data v is unchanged relative to the value of the second interpolation weight V. , Therefore, in order to ensure the accuracy of bilinear interpolation processing by the
在一种可能的实现方式中,多路选择器202,用于在第一插值权重U的最高位为0,第二插值权重V的最高位为1时,确定第一低位数据u的取值相对于第一插值权重U的取值不变,以及第二低位数据v的取值相对于第二插值权重V的取值发生变化。In a possible implementation, the multiplexer 202 is configured to determine the value of the first low-order data u when the highest bit of the first interpolation weight U is 0 and the highest bit of the second interpolation weight V is 1 Relative to the value of the first interpolation weight U, the value of the second low-order data v changes relative to the value of the second interpolation weight V.
在第一插值权重U的最高位为0,第二插值权重V的最高位为1时,即第一插值权重U的取值大于等于0且小于1,第二插值权重V的取值等于1。此时,第一低位数据u的取值相对于第一插值权重U的取值不变,而第二低位数据v的取值相对于第二插值权重V的取值发生变化。When the highest bit of the first interpolation weight U is 0 and the highest bit of the second interpolation weight V is 1, that is, the value of the first interpolation weight U is greater than or equal to 0 and less than 1, and the value of the second interpolation weight V is equal to 1 . At this time, the value of the first low-order data u remains unchanged relative to the value of the first interpolation weight U, while the value of the second low-order data v changes relative to the value of the second interpolation weight V.
在一示例中,使用9bit的二进制数来表示大于等于0且小于等于1的第一插值权重U和第二插值权重V。第一插值权重U的取值等于0.75,可以表示为011000000,第二插值权重V的取值等于1,可以表示为:100000000。第一插值权重U的最高位为0,第二插值权重V的最高位为1,即第一插值权重U的取值大于等于0且小于1,第二插值权重V的取值等于1。相应的,第一低位数据u表示为11000000,第一低位数据u的取值等于0.75;第二低位数据v表示为00000000,第二低位数据v的取值等于0。因此,第一低位数据u的取值相对于第一插值权重U的取值不变,第二低位数据v的取值相对于第二插值权重V的取值发生变化。In an example, a 9-bit binary number is used to represent the first interpolation weight U and the second interpolation weight V greater than or equal to 0 and less than or equal to 1. The value of the first interpolation weight U is equal to 0.75, which can be expressed as 011000000, and the value of the second interpolation weight V is equal to 1, which can be expressed as: 100000000. The highest bit of the first interpolation weight U is 0, the highest bit of the second interpolation weight V is 1, that is, the value of the first interpolation weight U is greater than or equal to 0 and less than 1, and the value of the second interpolation weight V is equal to 1. Correspondingly, the first low-order data u is represented as 11000000, and the value of the first low-order data u is equal to 0.75; the second low-order data v is represented as 00000000, and the value of the second low-order data v is equal to 0. Therefore, the value of the first low-order data u remains unchanged relative to the value of the first interpolation weight U, and the value of the second low-order data v changes relative to the value of the second interpolation weight V.
在一种可能的实现方式中,多路选择器202,用于在第一低位数据u的取值相对于第一插值权重U的取值不变,以及第二低位数据v的取值相对于第二插值权重V的取值发生变化时,确定第一乘法器2031对应的待运算数据为第三待插值数据,第二乘法器2032对应的待运算数据为第四待插值数据。In a possible implementation manner, the multiplexer 202 is configured to change the value of the first low-order data u relative to the value of the first interpolation weight U, and the value of the second low-order data v relative to When the value of the second interpolation weight V changes, it is determined that the data to be calculated corresponding to the first multiplier 2031 is the third data to be interpolated, and the data to be calculated corresponding to the
第一低位数据u的取值相对于第一插值权重U的取值不变,以及第二低位数据v的取值相对于第二插值权重V的取值发生变化,也就是说,第一低位数据u的取值可以表示第一插值权重U的真实取值;第二低位数据v的取值的无法表示第二插值权重V的真实取值。因此,根据m-1 bit的第二低位数据v确定的权重输入数据与待运算数据进行乘法运算,相对于根据m bit的第二插值权重V确定的权重输入数据与待运算数据进行乘法运算,其对应的乘法运算结果可能发生变化。The value of the first low-order data u remains unchanged relative to the value of the first interpolation weight U, and the value of the second low-order data v changes relative to the value of the second interpolation weight V, that is, the first low-order The value of the data u can represent the real value of the first interpolation weight U; the value of the second low-order data v cannot represent the real value of the second interpolation weight V. Therefore, the weight input data determined according to the second low-order data v of m-1 bits is multiplied with the data to be operated, and the weight input data determined according to the second interpolation weight V of m bits is multiplied with the data to be operated, Its corresponding multiplication result may change.
当第一插值权重U的取值大于等于0且小于1,第二插值权重V的取值等于1时,根据上述公式(4),可以确定双线性插值处理结果result_abcd=c×(1-U)+d×U。由于第一插值权重U的取值大于等于0且小于1,第一低位数据u的取值相对于第一插值权重U的取值不变;第二插值权重V的取值等于1,第二低位数据v的取值等于0,相对于第二插值权重V的取值发生变化。因此,为了保证通过装置200进行双线性插值处理的准确性,通过第一多路选择器2021确定第一乘法器2031对应的待运算数据为第三待插值数据c,通过第二多路选择器2022确定第二乘法器2032对应的待运算数据为第四待插值数据d。此时,可以保证双线性插值处理结果result_abcd=c×(1-u)+d×u=c×(1-U)+d×U。When the value of the first interpolation weight U is greater than or equal to 0 and less than 1, and the value of the second interpolation weight V is equal to 1, according to the above formula (4), the bilinear interpolation processing result result_abcd=c×(1- U)+d×U. Since the value of the first interpolation weight U is greater than or equal to 0 and less than 1, the value of the first low-order data u remains unchanged relative to the value of the first interpolation weight U; the value of the second interpolation weight V is equal to 1, and the second The value of the low-order data v is equal to 0, which is changed relative to the value of the second interpolation weight V. Therefore, in order to ensure the accuracy of the bilinear interpolation process performed by the
在一种可能的实现方式中,多路选择器202,用于在第一插值权重U和第二插值权重V的最高位均为1时,确定第一低位数据u的取值相对于第一插值权重U的取值发生变化,以及第二低位数据v的取值相对于第二插值权重V的取值发生变化。In a possible implementation manner, the multiplexer 202 is configured to determine that the value of the first low-order data u is relative to the first The value of the interpolation weight U changes, and the value of the second low-order data v changes relative to the value of the second interpolation weight V.
在第一插值权重U和第二插值权重V的最高位均为1时,即第一插值权重U和第二插值权重V的取值均等于1。此时,第一低位数据u的取值相对于第一插值权重U的取值发生变化,第二低位数据v的取值相对于第二插值权重V的取值发生变化。When the highest bits of the first interpolation weight U and the second interpolation weight V are both 1, that is, the values of the first interpolation weight U and the second interpolation weight V are both equal to 1. At this time, the value of the first low-order data u changes relative to the value of the first interpolation weight U, and the value of the second low-order data v changes relative to the value of the second interpolation weight V.
在一示例中,使用9bit的二进制数来表示大于等于0且小于等于1的第一插值权重U和第二插值权重V。第一插值权重U的取值等于1,可以表示为100000000;第二插值权重V的取值等于1,可以表示为100000000。第一插值权重U和第二插值权重V的最高位均为1,即第一插值权重U和第二插值权重V的取值均等于1。相应的,第一低位数据u表示为00000000,第一低位数据u的取值等于0;第二低位数据v表示为00000000,第二低位数据v的取值等于0。此时,第一低位数据u和第二低位数据v的取值,均相对于第一插值权重U和第二插值权重V的取值发生变化。In an example, a 9-bit binary number is used to represent the first interpolation weight U and the second interpolation weight V greater than or equal to 0 and less than or equal to 1. The value of the first interpolation weight U is equal to 1, which can be expressed as 100000000; the value of the second interpolation weight V is equal to 1, which can be expressed as 100000000. The highest bits of the first interpolation weight U and the second interpolation weight V are both 1, that is, the values of the first interpolation weight U and the second interpolation weight V are both equal to 1. Correspondingly, the first low-order data u is represented as 00000000, and the value of the first low-order data u is equal to 0; the second low-order data v is represented as 00000000, and the value of the second low-order data v is equal to 0. At this time, the values of the first low-order data u and the second low-order data v both change relative to the values of the first interpolation weight U and the second interpolation weight V.
在一种可能的实现方式中,多路选择器202,用于第一低位数据u的取值相对于第一插值权重U的取值发生变化,以及第二低位数据v的取值相对于第二插值权重V的取值发生变化时,确定第一乘法器2031对应的待运算数据为第四待插值数据。In a possible implementation manner, the multiplexer 202 is used to change the value of the first low-order data u relative to the value of the first interpolation weight U, and the value of the second low-order data v is relative to the value of the first interpolation weight U. When the value of the second interpolation weight V changes, it is determined that the data to be operated corresponding to the first multiplier 2031 is the fourth data to be interpolated.
第一低位数据u的取值相对于第一插值权重U的取值发生变化,以及第二低位数据v的取值相对于第二插值权重V的取值发生变化,也就是说,第一低位数据u和第二低位数据v的取值,均无法表示第一插值权重U和第二插值权重V的真实取值。因此,根据m-1 bit的第一低位数据u和第二低位数据v确定的权重输入数据与待运算数据进行乘法运算,相对于根据m bit的第一插值权重U和第二插值权重V确定的权重输入数据与待运算数据进行乘法运算,其对应的乘法运算结果可能发生变化。The value of the first low-order data u changes relative to the value of the first interpolation weight U, and the value of the second low-order data v changes relative to the value of the second interpolation weight V, that is, the first low-order The values of the data u and the second low-order data v cannot represent the real values of the first interpolation weight U and the second interpolation weight V. Therefore, the weight input data determined according to the first low-order data u and the second low-order data v of m-1 bits are multiplied with the data to be operated, compared to the first interpolation weight U and the second interpolation weight V determined according to m bits The weight input data of is multiplied with the data to be operated, and the corresponding multiplication result may change.
当第一插值权重和第二插值权重的取值均等于1时,根据上述公式(4),可以确定双线性插值处理结果result_abcd=d。由于第一插值权重和第二插值权重的取值均等于1,第一低位数据u和第二低位数据v的取值均等于0,第一低位数据u的取值相对于第一插值权重U的取值发生变化,以及第二低位数据v的取值相对于第二插值权重V的取值发生变化。因此,为了保证通过装置200进行双线性插值处理的准确性,通过第一多路选择器2021确定第一乘法器2031对应的待运算数据为第四待插值数据d。此时,可以保证双线性插值处理结果result_abcd=d。When the values of the first interpolation weight and the second interpolation weight are both equal to 1, according to the above formula (4), the bilinear interpolation processing result result_abcd=d can be determined. Since the values of the first interpolation weight and the second interpolation weight are both equal to 1, the values of the first low-order data u and the second low-order data v are both equal to 0, and the value of the first low-order data u is relative to the first interpolation weight U The value of changes, and the value of the second low-order data v changes relative to the value of the second interpolation weight V. Therefore, in order to ensure the accuracy of the bilinear interpolation process performed by the
在一种可能的实现方式中,多个待插值数据是目标图像中需要进行双线性插值处理的2×2结构的四个像素数据。In a possible implementation manner, the plurality of data to be interpolated is four pixel data of a 2×2 structure in the target image that needs to be processed by bilinear interpolation.
用于进行双线性差值的装置200可以应用于高性能处理器中的数据滤波处理,例如,图形处理器(graphics processing unit,GPU)中的texture unit单元,或需要滤波的算数运算逻辑单元。相应的,多个待插值数据可以是目标图像中需要进行双线性插值处理的2×2结构的四个像素数据。The
在一示例中,当需要放大目标图像时,目标图像上的每个像素需要根据相应的比例系数以特定的方向移动。当以非整数比例系数放大时,会存在一些像素位置没有适当的像素值,从而形成缺孔。此时,这些缺孔需要分配适当的RGB或灰度值,以便输出的放大后的目标图像中不包含无像素值的像素。可以以缺孔为中心,获取缺孔周围2×2结构的四个像素点对应的像素数据,进而将像素数据作为待插值数据输入乘法器203,进行双线性插值处理,确定对应的双线性插值处理结果,即缺孔对应的像素数据,从而可以为缺孔分配相应的RGB或灰度值。In an example, when the target image needs to be enlarged, each pixel on the target image needs to move in a specific direction according to a corresponding scale factor. When zooming in with a non-integer scale factor, there will be some pixel locations that do not have the appropriate pixel value, resulting in a hole. At this point, these holes need to be assigned appropriate RGB or grayscale values so that the output enlarged target image does not contain pixels without pixel values. With the hole as the center, the pixel data corresponding to the four pixel points of the 2×2 structure around the hole can be obtained, and then the pixel data can be input into the multiplier 203 as the data to be interpolated, and the bilinear interpolation process can be performed to determine the corresponding bilinear The result of the interpolation processing, that is, the pixel data corresponding to the hole, so that the corresponding RGB or gray value can be assigned to the hole.
本公开实施例的用于进行双线性插值处理的运算装置,通过权重输入模块,利用第一低位数据u和第二低位数据v,确定各个乘法器分别对应的权重输入数据,并将权重输入数据输入对应的乘法器,其中,第一低位数据u为第一插值权重U的低位m-1 bit,第二低位数据v为第二插值权重V的低位m-1 bit,第一插值权重U和第二插值权重V为m bit,并大于等于0且小于等于1;根据m-1 bit的第一低位数据u和第二低位数据v确定的权重输入数据,其位数也为m-1 bit,从而可以将乘法器的输入位宽从m bit减小为m-1 bit。利用多路选择器,可以根据第一插值权重U和第二插值权重V的取值,分别确定至少一个乘法器对应的待运算数据,其中,每个乘法器对应的待运算数据为需要进行双线性插值处理的多个待插值数据中的一个,将待运算数据输入相应的乘法器,从而可以调整乘法器对应的乘法运算结果,进而保证双线性插值处理结果的准确性。通过乘法器,可以根据待运算数据和权重输入数据,进行对应的乘法运算,确定乘法运算结果,再通过加法器,可以对各个乘法器对应的乘法运算结果进行求和运算,确定双线性插值处理结果。通过减小乘法器的输入位宽,并通过多路选择器调整待插值数据输入乘法器的逻辑,可以减少装置整体的电路面积,节约进行双线性插值处理的硬件资源消耗。In the arithmetic device for performing bilinear interpolation processing in the embodiment of the present disclosure, the weight input data corresponding to each multiplier is determined by using the first low-order data u and the second low-order data v through the weight input module, and the weight input The multiplier corresponding to the data input, wherein the first low-order data u is the low-order m-1 bit of the first interpolation weight U, the second low-order data v is the low-order m-1 bit of the second interpolation weight V, and the first interpolation weight U and the second interpolation weight V is m bit, and is greater than or equal to 0 and less than or equal to 1; the weight input data determined according to the first low-order data u and the second low-order data v of m-1 bit, the number of bits is also m-1 bit, so that the input bit width of the multiplier can be reduced from m bit to m-1 bit. Using the multiplexer, according to the values of the first interpolation weight U and the second interpolation weight V, the data to be calculated corresponding to at least one multiplier can be respectively determined, wherein the data to be calculated corresponding to each multiplier is the data to be calculated that needs to be double One of the plurality of data to be interpolated by linear interpolation is input to the corresponding multiplier, so that the multiplication result corresponding to the multiplier can be adjusted, thereby ensuring the accuracy of the bilinear interpolation processing result. Through the multiplier, the corresponding multiplication operation can be performed according to the data to be calculated and the weight input data, and the result of the multiplication operation can be determined, and then through the adder, the multiplication results corresponding to each multiplier can be summed to determine the bilinear interpolation process result. By reducing the input bit width of the multiplier and adjusting the logic of inputting data to be interpolated into the multiplier through the multiplexer, the overall circuit area of the device can be reduced, and the consumption of hardware resources for bilinear interpolation processing can be saved.
需要说明的是,尽管以图2和图3作为示例介绍了用于进行双线性插值处理的运算装置的电路结构如上,但本领域技术人员能够理解,本公开应不限于此。事实上,用户完全可根据个人喜好和/或实际应用场景灵活设定用于进行双线性插值处理的运算装置的具体结构,适应性增减和替换其中的电路及电器元件,只要能够基于上述过程进行双线性插值处理即可。It should be noted that although FIG. 2 and FIG. 3 are used as examples to describe the circuit structure of the arithmetic device for bilinear interpolation processing as above, those skilled in the art can understand that the present disclosure should not be limited thereto. In fact, users can flexibly set the specific structure of the computing device used for bilinear interpolation processing according to personal preferences and/or actual application scenarios, and adaptively increase, decrease, and replace the circuits and electrical components in it, as long as they can be based on the above The process can be processed by bilinear interpolation.
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。Having described various embodiments of the present disclosure above, the foregoing description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and alterations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principle of each embodiment, practical application or improvement of technology in the market, or to enable other ordinary skilled in the art to understand each embodiment disclosed herein.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310521501.3A CN116227507B (en) | 2023-05-10 | 2023-05-10 | A computing device for bilinear interpolation processing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310521501.3A CN116227507B (en) | 2023-05-10 | 2023-05-10 | A computing device for bilinear interpolation processing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116227507A CN116227507A (en) | 2023-06-06 |
CN116227507B true CN116227507B (en) | 2023-07-14 |
Family
ID=86570095
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310521501.3A Active CN116227507B (en) | 2023-05-10 | 2023-05-10 | A computing device for bilinear interpolation processing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116227507B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111161145A (en) * | 2019-12-18 | 2020-05-15 | 兰州恒达彩印包装有限责任公司 | Improved parameter optimization method of bicubic image interpolation model |
CN113657587A (en) * | 2021-08-17 | 2021-11-16 | 上海大学 | Deformable convolution acceleration method and device based on FPGA |
CN115423688A (en) * | 2022-09-29 | 2022-12-02 | 上海海事大学 | Quantum circuit diagram and quantum color image scaling method based on bilinear interpolation |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2609218B (en) * | 2021-07-22 | 2023-08-30 | Imagination Tech Ltd | Coding blocks of pixels |
-
2023
- 2023-05-10 CN CN202310521501.3A patent/CN116227507B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111161145A (en) * | 2019-12-18 | 2020-05-15 | 兰州恒达彩印包装有限责任公司 | Improved parameter optimization method of bicubic image interpolation model |
CN113657587A (en) * | 2021-08-17 | 2021-11-16 | 上海大学 | Deformable convolution acceleration method and device based on FPGA |
CN115423688A (en) * | 2022-09-29 | 2022-12-02 | 上海海事大学 | Quantum circuit diagram and quantum color image scaling method based on bilinear interpolation |
Also Published As
Publication number | Publication date |
---|---|
CN116227507A (en) | 2023-06-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11314845B2 (en) | Interpolating a sample position value by interpolating surrounding interpolated positions | |
Chen | VLSI implementation of an adaptive edge-enhanced image scalar for real-time multimedia applications | |
WO2019057093A1 (en) | Multiplication circuit, system on chip, and electronic device | |
CN110222833B (en) | Data processing circuit for neural network | |
CN107220025B (en) | Apparatus for processing multiplication and addition and method for processing multiplication and addition | |
JP2022544854A (en) | signed multiword multiplier | |
JP7346039B2 (en) | Data processing device, data processing method, and program | |
CN116227507B (en) | A computing device for bilinear interpolation processing | |
TWI514857B (en) | A low-complexity bilateral filter (bf) implementation in a data processing device | |
US11042359B2 (en) | Semiconductor device including an adder | |
JP2008067233A (en) | Digital-watermarking embedding method, program, and computer-readable recording medium | |
WO2023124371A1 (en) | Data processing apparatus and method, and chip, computer device and storage medium | |
JP4621944B2 (en) | Image filter device, method and computer program | |
JP2009049752A (en) | Video signal processing device, video signal processing method, and display device | |
US12249124B2 (en) | Super resolution device and method | |
US7015839B1 (en) | Mapping method utilizing look-up table and related apparatus | |
JP4658821B2 (en) | Bezier curve generation circuit | |
CN117764819A (en) | Image processing method, device, electronic equipment and storage medium | |
WO2023100372A1 (en) | Data processing device, data processing method, and data processing program | |
KR102435525B1 (en) | Processing Signals Having a Common Component | |
JP2020086680A (en) | Arithmetic unit | |
WO2024224534A1 (en) | Neural network processing device, neural network processing method, and neural network processing program | |
JP2005128618A (en) | Divider, exposure control device, and division method | |
CN117274403A (en) | Image processing methods and related products | |
JP2015089115A (en) | Image enlargement / reduction processing apparatus and image enlargement / reduction processing method |
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 | ||
CP03 | Change of name, title or address | ||
CP03 | Change of name, title or address |
Address after: B655, 4th Floor, Building 14, Cuiwei Zhongli, Haidian District, Beijing, 100036 Patentee after: Mole Thread Intelligent Technology (Beijing) Co.,Ltd. Country or region after: China Address before: 209, 2nd Floor, No. 31 Haidian Street, Haidian District, Beijing Patentee before: Moore Threads Technology Co., Ltd. Country or region before: China |