Data processing method, device, electronic device and storage medium
By enlarging the square root calculation data and performing offline square root lookup table calculation on a low-power platform, the problems of long square root calculation time and large memory usage in the existing technology are solved, and efficient data processing is achieved.
Patent Information
- Application Number
- CN202111220739.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-20
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-10-20
AI Technical Summary
Existing software implementation methods based on iterative algorithms for square root calculations take a long time to calculate and occupy a large amount of memory on low-power platforms, and cannot run effectively.
Amplify the square root calculation data through the preset amplification coefficient to determine the reference data, and use the pre-generated offline square root table to perform table lookup calculation based on the threshold coefficient and amplification factor, and update the data to be processed.
It achieves efficient processing of square root calculation data on a low-power platform, reduces storage and computing overhead, and improves data processing efficiency.
Smart Images

Figure CN113961168B
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of signal processing technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art
[0002] The square root operation sqrt(x) is a commonly used numerical calculation rule. However, it is difficult to calculate the exact square root operation result. The existing square root operation implementation methods are generally software implementation methods based on iterative algorithms, such as CORDIC. However, this software implementation method based on iterative algorithms has a large amount of calculation, which makes the square root calculation take a long time, and the memory occupied during calculation is also large. It is more applicable to CPUs with floating-point units, such as computers and servers, but cannot be effectively run on low-power platforms such as Soc or FPGA. Summary of the invention
[0003] The embodiments of the present invention provide a data processing method, device, electronic device and storage medium to reduce the time required for data processing and improve the efficiency of data processing.
[0004] In a first aspect, an embodiment of the present invention provides a data processing method, the method comprising:
[0005] Determine the data to be processed, and if the data to be processed includes square root operation data, amplify the square root operation data based on a preset amplification factor to determine reference data corresponding to the square root operation data;
[0006] Comparing the reference data with each preset threshold value respectively, and determining a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient;
[0007] Obtaining a pre-generated offline square root table corresponding to a set discrete numerical interval, and determining a table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data;
[0008] The data processing result corresponding to the square root operation data is determined based on the table lookup value result, the target threshold coefficient and the preset amplification coefficient, and the data to be processed is updated based on the data processing result.
[0009] Optionally, comparing the reference data with respective preset threshold values, and determining a target threshold coefficient based on the comparison result, includes:
[0010] Compare the reference data with each preset threshold value respectively, and determine a minimum threshold value greater than the reference data among the preset threshold values based on the comparison result;
[0011] The threshold coefficient corresponding to the minimum threshold value is determined as the target threshold coefficient.
[0012] Optionally, the method further includes:
[0013] Calculating each preset threshold value based on each threshold coefficient, the preset amplification coefficient and the maximum value within the set discrete value interval;
[0014] The preset threshold values are calculated based on the threshold coefficients, the preset amplification coefficients and the maximum value in the set discrete value interval, satisfying the following formula:
[0015]
[0016] Among them, THR l is the preset threshold value, F1 is the preset amplification factor, M is the maximum value in the set discrete value interval, and l is the threshold factor.
[0017] Optionally, determining a table lookup numerical result based on the target threshold coefficient, the offline square root table, and the reference data includes:
[0018] Determine a table lookup index value based on the target threshold coefficient and the reference data;
[0019] Determine a table lookup numerical result based on the table lookup index value and the offline square root table;
[0020] The offline square root table includes each table item index value and a table item result corresponding to each table item index value.
[0021] Optionally, the table lookup index value is determined based on the target threshold coefficient and the reference data, satisfying the following formula:
[0022] index = round(x′ / 4 l )
[0023] Wherein, index is the table lookup index value, x′ is the reference data, l is the target threshold coefficient, and round() indicates rounding according to the set number of bits.
[0024] Optionally, the determining the data processing result corresponding to the square root operation data based on the table lookup value result, the target threshold coefficient and the preset amplification coefficient includes:
[0025] Based on the preset amplification factor and the target threshold factor, calculating the shift dimension corresponding to the square root operation data;
[0026] Determine a data processing result corresponding to the square root operation data based on the shift dimension and the table lookup numerical result;
[0027] Wherein, based on the shift dimension and the table lookup numerical result, the data processing result corresponding to the square root operation data is determined to satisfy the following formula:
[0028] out=y / shift
[0029] Among them, out is the data processing result, y is the table lookup value result, and shift is the shift dimension.
[0030] Optionally, the calculation of the shift dimension corresponding to the reference data based on the preset amplification factor and the target threshold factor satisfies the following formula:
[0031] shift=sqrt(F1) / 2 l
[0032] Among them, F1 is the preset amplification coefficient, l is the target threshold coefficient, sqrt() represents square root calculation, and shift is the shift dimension corresponding to the reference data.
[0033] In a second aspect, an embodiment of the present invention further provides a data processing device, the device comprising:
[0034] A numerical amplification module, used for determining the data to be processed, and if the data to be processed includes square root operation data, amplifying the square root operation data based on a preset amplification coefficient to determine the reference data corresponding to the square root operation data;
[0035] A threshold comparison module, used to compare the reference data with each preset threshold value, and determine a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient;
[0036] A table lookup module, used to obtain a pre-generated offline square root table corresponding to a set discrete numerical interval, and determine a table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data;
[0037] A numerical synthesis module is used to determine a data processing result corresponding to the square root operation data based on the table lookup numerical result, the target threshold coefficient and the preset amplification coefficient, and to update the data to be processed based on the data processing result.
[0038] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0039] one or more processors;
[0040] a storage device for storing one or more programs,
[0041] When the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method provided by any embodiment of the present invention.
[0042] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a data processing method as provided in any embodiment of the present invention.
[0043] The embodiments of the above invention have the following advantages or beneficial effects:
[0044] When it is determined that the data to be processed includes square root operation data, the square root operation data is amplified based on the preset amplification coefficient, the reference data corresponding to the square root operation data is determined, the reference data is compared with each preset threshold value calculated by each threshold coefficient, and the target threshold coefficient is determined in each preset threshold value based on the comparison result, and then the table lookup numerical result is determined based on the target threshold coefficient, the pre-generated offline square root table and the reference data, and the data processing result corresponding to the square root operation data is determined according to the table lookup numerical result and the preset amplification coefficient, so as to update the data to be processed based on the data processing result, and the determination of the data processing result based on the offline square root table is realized. Since the offline square root table occupies a small storage space, the method can complete the processing of the data to be processed based on small storage and small computing overhead, thereby improving the data processing efficiency. In addition, the method can also be effectively run on low-power Soc or FPGA platforms, solving the technical problem that low-power Soc or FPGA platforms in the prior art cannot process square root operation data. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required to describe the embodiments. Obviously, the drawings introduced are only drawings of a part of the embodiments to be described in the present invention, rather than all the drawings. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 A flowchart of a data processing method provided in Embodiment 1 of the present invention;
[0047] Figure 2A A flowchart of a data processing method provided in Embodiment 2 of the present invention;
[0048] Figure 2B A flowchart of another data processing method provided in Embodiment 2 of the present invention;
[0049] Figure 3 A schematic diagram of the structure of a data processing device provided in Embodiment 3 of the present invention;
[0050] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0051] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0052] Before introducing the data processing method provided by this embodiment, the application scenario of the data processing method is first exemplified. For example, in the design and development of communication receiver solutions, it is often necessary to convert the power value obtained by conjugate multiplication or square accumulation into an amplitude value, which requires the use of a square root operation; or, when calculating the root mean square value of a signal, it is necessary to perform a square root operation on the mean square value (average power) of the signal; or, when calculating the root mean square error (RMSE) of a signal, it is necessary to perform a square root operation on the mean square error (MSE) of the signal, etc.
[0053] Embodiment 1
[0054] Figure 1 This is a flow chart of a data processing method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case where the data to be processed includes square root operation data and the square root operation data is processed. The method can be executed by a data processing device, which can be implemented by hardware and / or software. The method specifically includes the following steps:
[0055] S110, determining data to be processed, and if the data to be processed includes square root operation data, amplifying the square root operation data based on a preset amplification coefficient to determine reference data corresponding to the square root operation data.
[0056] The data to be processed may be current data that needs to be processed on a low-power Soc, FPGA or other platform, or a computer or server. Exemplarily, when processing a request, an application may send a data processing request to a processor of a low-power Soc, FPGA or other platform, wherein the data processing request may include the data to be processed, so that the low-power Soc, FPGA or other platform processes the data to be processed.
[0057] In this embodiment, after the data to be processed is obtained, it is determined whether the data to be processed includes square root operation data. If so, the square root operation data is further amplified. Exemplarily, the square root operation data can be data in the design and development of communication receiver solutions, for example, a power value whose amplitude value needs to be calculated, an average power whose root mean square value needs to be calculated, a mean square error whose root mean square error needs to be calculated, etc.
[0058] Specifically, the square root operation data is amplified based on the preset amplification factor, which may be: multiplying the square root operation data by the preset amplification factor, and determining the multiplication result as the reference data corresponding to the square root operation data. The preset amplification factor may be an even power of 2, such as 2 16 In this embodiment, the preset magnification factor can be used to limit the minimum value of the square root operation data, that is, the minimum value of the square root operation data processed by the data processing method provided by this embodiment is not less than the preset magnification factor. Optionally, a maximum threshold value can also be set to limit the maximum value of the square root operation data. Exemplarily, Among them, F1 and F2 represent the preset amplification coefficient and the maximum threshold value respectively, which respectively determine the minimum value and the maximum value of the square root operation data that can be solved by this method, and x represents the square root operation data.
[0059] For example, the preset magnification factor is 2 16 For example, the amplification process of the square root operation data can be: x'=x*F1, where x' is the reference data corresponding to the square root operation data, that is, the amplification result of the square root operation data, F1 is the preset amplification coefficient, and x is the square root operation data. For example, x=0.5, x'=0.5*2 16 =32768.
[0060] S120. Compare the reference data with each preset threshold value respectively, and determine a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient.
[0061] In this embodiment, after the square root operation data is amplified, it is necessary to further perform numerical conversion processing on the reference data obtained by the amplification process, so as to map the square root operation data to a set discrete numerical range of the offline square root table.
[0062] Specifically, the reference data is compared with the preset threshold values calculated by each threshold coefficient, and the target threshold coefficient is determined in each preset threshold coefficient according to the comparison result. In an optional implementation, the reference data is compared with each preset threshold value, and the target threshold coefficient is determined based on the comparison result, which can be: the reference data is compared with each preset threshold value, and based on the comparison result, the minimum threshold value greater than the reference data is determined in each preset threshold value; and the threshold coefficient corresponding to the minimum threshold value is determined as the target threshold coefficient.
[0063] That is, the reference data is compared with each preset threshold value, and the minimum threshold coefficient that makes the preset threshold value greater than the reference data is found, and the minimum threshold coefficient is determined as the target threshold coefficient. In the comparison process, the reference data can be compared with each preset threshold value one by one in the order of the preset threshold values from small to large, and then when the preset threshold value greater than the reference data is compared for the first time, the corresponding threshold coefficient can be determined as the target threshold coefficient, so that the minimum threshold value can be quickly determined without comparing all the preset threshold values at once, thereby improving the data processing efficiency.
[0064] Exemplarily, the method further includes calculating each preset threshold value based on each threshold coefficient, the preset amplification coefficient and the maximum value in the set discrete numerical interval; the calculation of each preset threshold value based on each threshold coefficient, the preset amplification coefficient and the maximum value in the set discrete numerical interval satisfies the following formula:
[0065]
[0066] Among them, THR l is the preset threshold value, F1 is the preset amplification factor, M is the maximum value in the set discrete value interval, and l is the threshold factor.
[0067] In this optional implementation, the discrete value interval is set as the range of discrete values for calculating the square root value in the offline square root table. For example, the discrete value interval is set to [1,255], and the maximum value in the discrete value interval is set as the upper limit of the discrete value interval, such as 255 in the above example. Through the above formula, the preset threshold value corresponding to each threshold coefficient can be calculated, and then each preset threshold value can be compared with the reference data. For example, l = 0, ...; l = 3, l = 4, x′=32768, then the target threshold value is 65536 and the target threshold coefficient is 4.
[0068] S130, obtaining a pre-generated offline square root table corresponding to a set discrete numerical interval, and determining a table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data.
[0069] Among them, the offline square root table can be a square root table containing the square root results corresponding to each number within a set discrete numerical interval. The discrete numerical interval can be set according to actual needs. It should be noted that the larger the discrete numerical interval is set, the more table items are stored in the offline square root table, the more memory is occupied, and the higher the precision of the processing result of the square root operation data; the smaller the discrete numerical interval is set, the fewer table items are stored in the offline square root table, the smaller the memory is occupied, and the lower the precision of the processing result of the square root operation data. Exemplarily, the discrete numerical interval can be [1,255].
[0070] In this embodiment, the offline square root table can be stored in the form of a two-dimensional array, which may include table items and table item contents. For example, the offline square root table may be a two-dimensional offline table sqrttable(M,2), where the table item may be sqrttable(i,1)=i, and the table item content may be qrttable(i,2)=sqrt(i), where i=1,2,..,M, and M is the maximum value in a set discrete value interval.
[0071] Specifically, obtaining the pre-generated offline square root table corresponding to the set discrete numerical interval may be: reading the offline square root table corresponding to the set discrete numerical interval from the memory or the local disk, and if the offline square root table does not exist in the memory or the local disk, then generating the offline square root table corresponding to the set discrete numerical interval. That is, before processing each data to be processed, the method may generate an offline square root table once and store it in the memory or the local disk, and then directly read the generated offline square root table when processing each data to be processed, without generating it again.
[0072] Furthermore, after obtaining the offline square root table, the reference data can be numerically converted based on the target threshold coefficient to determine the mapping value of the square root operation data within the set discrete numerical range corresponding to the offline square root table, and then the corresponding table lookup numerical result is searched in the offline square root table based on the mapping value.
[0073] S140, determining a data processing result corresponding to the square root operation data based on the table lookup value result, the target threshold coefficient and the preset amplification coefficient, and updating the data to be processed based on the data processing result.
[0074] After the table lookup numerical result is determined, the data processing result corresponding to the square root operation data can be calculated by comprehensively considering the table lookup numerical result, the target threshold coefficient and the preset amplification coefficient.
[0075] Exemplarily, the determining the data processing result corresponding to the square root operation data based on the table lookup numerical result, the target threshold coefficient and the preset amplification coefficient includes: calculating the shift dimension corresponding to the square root operation data based on the preset amplification coefficient and the target threshold coefficient; determining the data processing result corresponding to the square root operation data based on the shift dimension and the table lookup numerical result; wherein, the determining the data processing result corresponding to the square root operation data based on the shift dimension and the table lookup numerical result satisfies the following formula:
[0076] out = y / shift
[0077] Wherein, out is the data processing result, y is the table lookup value result, and shift is the shift dimension. For example, y=11.3137, shift=16, Optionally, the calculation of the shift dimension corresponding to the reference data based on the preset amplification factor and the target threshold factor satisfies the following formula:
[0078] shift=sqrt(F1) / 2 l
[0079] Among them, F1 is the preset amplification coefficient, l is the target threshold coefficient, sqrt() represents the square root value calculation, and shift is the shift dimension corresponding to the reference data. Through this formula, the shift dimension corresponding to the reference data can be accurately calculated, and then based on the shift dimension and the table lookup value result, the data processing result of the square root operation data can be determined, that is, the approximate calculation result of the square root operation data. For example, F1=2 16 ,l=4,shift=16.
[0080] Furthermore, the data to be processed may be updated by the data processing result. For example, the data processing result may be used as the data to be processed, so as to perform subsequent numerical calculations based on the data to be processed, or to return the data to the application.
[0081] The technical solution of this embodiment, when it is determined that the data to be processed includes square root operation data, the square root operation data is amplified based on the preset amplification coefficient, the reference data corresponding to the square root operation data is determined, the reference data is compared with each preset threshold value calculated by each threshold coefficient, and the target threshold coefficient is determined in each preset threshold value based on the comparison result, and then the table lookup numerical result is determined based on the target threshold coefficient, the pre-generated offline square root table and the reference data, and the data processing result corresponding to the square root operation data is determined according to the table lookup numerical result and the preset amplification coefficient, so as to update the data to be processed based on the data processing result, and the determination of the data processing result based on the offline square root table is realized. Since the offline square root table occupies a small storage space, the method can complete the processing of the data to be processed based on small storage and small computing overhead, thereby improving the data processing efficiency. In addition, the method can also be effectively run on low-power Soc or FPGA platforms, solving the technical problem that low-power Soc or FPGA platforms in the prior art cannot process square root operation data.
[0082] Embodiment 2
[0083] Figure 2A A flowchart of a data processing method provided for Embodiment 2 of the present invention. In this embodiment, based on the above embodiments, optionally, the table lookup numerical result is determined based on the target threshold coefficient, the offline square root table and the reference data, including: determining a table lookup index value based on the target threshold coefficient and the reference data; determining a table lookup numerical result based on the table lookup index value and the offline square root table; wherein the offline square root table includes each table item index value and a table item result corresponding to each table item index value. Explanations of terms that are the same as or corresponding to the above embodiments are not repeated here. See Figure 2A The data processing method provided in this embodiment includes the following steps:
[0084] S210: Determine the data to be processed. If the data to be processed includes square root operation data, amplify the square root operation data based on a preset amplification factor to determine reference data corresponding to the square root operation data.
[0085] S220. Compare the reference data with each preset threshold value respectively, and determine a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient.
[0086] S230. Obtain a pre-generated offline square root table corresponding to a set discrete numerical interval, and determine a table lookup index value based on the target threshold coefficient and the reference data, wherein the offline square root table includes each table item index value and a table item result corresponding to each table item index value.
[0087] In this embodiment, the index value to be searched in the offline square root table, i.e., the table lookup index value, can be calculated by the target threshold coefficient and the reference data. Optionally, the table lookup index value is determined based on the target threshold coefficient and the reference data, satisfying the following formula:
[0088] index = round(x′ / 4 l )
[0089] Among them, index is the table lookup index value, x' is the reference data, l is the target threshold coefficient, and round() indicates rounding according to the set number of digits. For example, using the above example, x'=32768, l=4, index=128. Through this formula, the table lookup index value can be accurately calculated, and then the table lookup value result corresponding to the square root operation data can be found in the offline square root table based on the table lookup index value.
[0090] S240: Determine a table lookup numerical result based on the table lookup index value and the offline square root table.
[0091] Specifically, the table lookup index value may be matched with each table item index value in the offline square root table, and the table item result corresponding to the matched table item index value may be determined as the table lookup value result.
[0092] For example, the table lookup result is y=sqrt_able(index,2). For example, index=128, y=sqrttable(128,2)=sqrt(128)=11.3137.
[0093] S250, determining a data processing result corresponding to the square root operation data based on the table lookup value result, the target threshold coefficient and the preset amplification coefficient, and updating the data to be processed based on the data processing result.
[0094] Optionally, this embodiment further provides a data processing method, which includes the following steps:
[0095] Step 1: obtaining the data to be processed x. If the data to be processed includes square root operation data, amplifying the square root operation data by a preset amplification coefficient to obtain reference data x′;
[0096] Step 2: Convert the reference data to a discrete value interval corresponding to the offline square root table, including: (1) converting the reference data x′ to each preset threshold value THR lCompare and determine the target threshold coefficient l corresponding to the smallest preset threshold value greater than the reference data x′; (2) calculate the table index value index based on the target threshold coefficient l and the reference data x′; (3) calculate the shift dimension shift based on the preset magnification factor F1 and the target threshold coefficient l;
[0097] Step 3: Look up the table lookup value result y in the offline square root table according to the table lookup index value index;
[0098] Step 4, calculating the data processing result out corresponding to the square root operation data x based on the shift dimension shift and the table lookup value result y;
[0099] Step 5: Update the data to be processed based on the data processing result.
[0100] For example, Figure 2B As shown in the figure, a flow chart of another data processing method is shown. First, the square root operation data x is converted into a numerical interval to obtain a table lookup index value index; then, in the table lookup module, the table lookup numerical result corresponding to the square root operation data is searched based on the pre-generated offline square root table; finally, based on the found table lookup numerical result and the shift dimension, the data processing result of the square root operation data is determined, and the data processing result is output as an output signal.
[0101] The technical solution of this embodiment, when it is determined that the data to be processed includes square root operation data, the square root operation data is amplified based on the preset amplification coefficient, the reference data corresponding to the square root operation data is determined, the reference data is compared with each preset threshold value calculated by each threshold coefficient, the target threshold coefficient is determined in each preset threshold value based on the comparison result, and then the table lookup index value is determined based on the target threshold coefficient and the reference data, the table lookup numerical result is determined in the offline square root table through the table lookup index value, the data processing result corresponding to the square root operation data is determined according to the table lookup numerical result and the preset amplification coefficient, and the data to be processed is updated based on the data processing result, so as to realize the determination of the data processing result based on querying the offline square root table. Since the offline square root table occupies a small storage space, the method can complete the processing of the data to be processed based on small storage and small computing overhead, thereby improving the data processing efficiency. In addition, the method can also be effectively run on low-power Soc or FPGA platforms, solving the technical problem that low-power Soc or FPGA platforms in the prior art cannot process square root operation data.
[0102] Embodiment 3
[0103] Figure 3This is a structural schematic diagram of a data processing device provided in Example 3 of the present invention. This embodiment is applicable to the situation where the data to be processed includes square root operation data and data processing is performed on the square root operation data. The device specifically includes: a numerical amplification module 310, a threshold comparison module 320, a table lookup module 330 and a numerical integration module 340.
[0104] The numerical amplification module 310 is used to determine the data to be processed, and if the data to be processed includes square root operation data, amplify the square root operation data based on a preset amplification coefficient to determine the reference data corresponding to the square root operation data;
[0105] A threshold comparison module 320, configured to compare the reference data with each preset threshold value, and determine a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient;
[0106] A table lookup module 330, configured to obtain a pre-generated offline square root table corresponding to a set discrete numerical interval, and determine a table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data;
[0107] The numerical synthesis module 340 is used to determine the data processing result corresponding to the square root operation data based on the table lookup numerical result, the target threshold coefficient and the preset amplification coefficient, and update the data to be processed based on the data processing result.
[0108] Optionally, the threshold comparison module 320 includes a coefficient determination unit, which is used to compare the reference data with each preset threshold value respectively, and determine a minimum threshold value greater than the reference data among each preset threshold value based on the comparison result; and determine the threshold coefficient corresponding to the minimum threshold value as the target threshold coefficient.
[0109] Optionally, the device further includes a threshold calculation module, which is used to calculate each preset threshold value based on each threshold coefficient, the preset amplification coefficient and the maximum value in the set discrete numerical interval; the calculation of each preset threshold value based on each threshold coefficient, the preset amplification coefficient and the maximum value in the set discrete numerical interval satisfies the following formula:
[0110]
[0111] Among them, THR l is the preset threshold value, F1 is the preset amplification factor, M is the maximum value in the set discrete value interval, and l is the threshold factor.
[0112] Optionally, the table lookup module 330 includes an index search unit, which is used to determine the table lookup index value based on the target threshold coefficient and the reference data; determine the table lookup numerical result based on the table lookup index value and the offline square root table; wherein the offline square root table includes each table item index value and the table item result corresponding to each table item index value.
[0113] Optionally, the index search unit is specifically used to determine the table lookup index value according to the following formula:
[0114] index = round(x′ / 4 l )
[0115] Wherein, index is the table lookup index value, x′ is the reference data, l is the target threshold coefficient, and round() indicates rounding according to the set number of bits.
[0116] Optionally, the numerical synthesis module 340 includes a result determination unit, which is used to calculate the shift dimension corresponding to the square root operation data based on the preset amplification factor and the target threshold coefficient; and determine the data processing result corresponding to the square root operation data based on the shift dimension and the table lookup numerical result; wherein, the data processing result corresponding to the square root operation data is determined based on the shift dimension and the table lookup numerical result, and satisfies the following formula:
[0117] out=y / shift
[0118] Among them, out is the data processing result, y is the table lookup value result, and shift is the shift dimension.
[0119] Optionally, the result determination unit calculates the shift dimension corresponding to the reference data based on the following formula:
[0120] shift=sqrt(F1) / 2 l
[0121] Among them, F1 is the preset amplification coefficient, l is the target threshold coefficient, sqrt() represents square root calculation, and shift is the shift dimension corresponding to the reference data.
[0122] In this embodiment, when it is determined that the data to be processed includes the square root operation data, the square root operation data is amplified based on the preset amplification coefficient, the reference data corresponding to the square root operation data is determined, and the reference data is compared with the preset threshold values calculated by the threshold comparison module respectively through each threshold coefficient, and the target threshold coefficient is determined in each preset threshold value based on the comparison result, and then the table lookup module is used to determine the table lookup numerical result based on the target threshold coefficient, the pre-generated offline square root table and the reference data, and the numerical synthesis module is used to determine the data processing result corresponding to the square root operation data according to the table lookup numerical result and the preset amplification coefficient, so as to update the data to be processed based on the data processing result, and the determination of the data processing result based on the offline square root table is realized. Since the offline square root table occupies a small storage space, the method can complete the processing of the data to be processed based on small storage and small computing overhead, thereby improving the data processing efficiency. In addition, the method can also be effectively run on a low-power Soc or FPGA platform, solving the technical problem that the low-power Soc or FPGA platform in the prior art cannot process the square root operation data.
[0123] The data processing device provided in the embodiment of the present invention can execute the data processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0124] It is worth noting that the various units and modules included in the above system are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present invention.
[0125] Embodiment 4
[0126] Figure 4 It is a structural schematic diagram of an electronic device provided in Embodiment 4 of the present invention. Figure 4 A block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 4 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention. The device 12 is typically an electronic device that performs data processing functions.
[0127] like Figure 4 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 connecting the various components (including the memory 28 and the processing unit 16).
[0128] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
[0129] The electronic device 12 typically includes a variety of computer readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0130] The memory 28 may include computer device readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer storage media. By way of example only, the storage device 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, usually called a "hard drive"). Although Figure 4 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a read-only optical disk (Compact Disc-Read Only Memory, CD-ROM), a digital video disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product 40, which has a set of program modules 42, which are configured to perform the functions of various embodiments of the present invention. The program product 40 may be stored in, for example, the memory 28, and such program modules 42 include, but are not limited to, one or more application programs, other program modules, and program data, each of which or some combination may include the implementation of a network environment. The program module 42 generally performs the functions and / or methods in the embodiments described in the present invention.
[0131] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, mouse, camera, etc., and display), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 22. In addition, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 through a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) devices, tape drives, and data backup storage devices.
[0132] The processor 16 executes various functional applications and data processing by running the program stored in the memory 28, for example, implementing the data processing method provided in the above embodiment of the present invention, including:
[0133] Determine the data to be processed, and if the data to be processed includes square root operation data, amplify the square root operation data based on a preset amplification factor to determine reference data corresponding to the square root operation data;
[0134] Comparing the reference data with each preset threshold value respectively, and determining a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient;
[0135] Obtaining a pre-generated offline square root table corresponding to a set discrete numerical interval, and determining a table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data;
[0136] The data processing result corresponding to the square root operation data is determined based on the table lookup value result, the target threshold coefficient and the preset amplification coefficient, and the data to be processed is updated based on the data processing result.
[0137] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the data processing method provided by any embodiment of the present invention.
[0138] Embodiment 5
[0139] Embodiment 5 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the data processing method provided in any embodiment of the present invention are implemented. The method includes:
[0140] Determine the data to be processed, and if the data to be processed includes square root operation data, amplify the square root operation data based on a preset amplification factor to determine reference data corresponding to the square root operation data;
[0141] Comparing the reference data with each preset threshold value respectively, and determining a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient;
[0142] Obtaining a pre-generated offline square root table corresponding to a set discrete numerical interval, and determining a table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data;
[0143] The data processing result corresponding to the square root operation data is determined based on the table lookup value result, the target threshold coefficient and the preset amplification coefficient, and the data to be processed is updated based on the data processing result.
[0144] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0145] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0146] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0147] Computer program code for performing the operation of embodiments of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0148] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A data processing method, It is characterized in that The method comprises: Determine the data to be processed, and if the data to be processed includes square root operation data, amplify the square root operation data based on a preset amplification factor to determine the reference data corresponding to the square root operation data; Comparing the reference data with each preset threshold value respectively, and determining a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient; Obtaining a pre-generated offline square root table corresponding to a set discrete numerical interval, and determining a table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data; Determine a data processing result corresponding to the square root operation data based on the table lookup value result, the target threshold coefficient and the preset amplification coefficient, and update the data to be processed based on the data processing result; The method further comprises: Calculating each preset threshold value based on each threshold coefficient, the preset amplification coefficient and the maximum value within the set discrete value interval; The preset threshold values are calculated based on the threshold coefficients, the preset amplification coefficients and the maximum value in the set discrete value interval, satisfying the following formula: ; in, is the preset threshold value, is the preset magnification factor, is the maximum value within the set discrete value interval, and l is the threshold coefficient; The determining of the data processing result corresponding to the square root operation data based on the table lookup value result, the target threshold coefficient and the preset amplification coefficient includes: Based on the preset amplification factor and the target threshold factor, calculating the shift dimension corresponding to the square root operation data; Determine a data processing result corresponding to the square root operation data based on the shift dimension and the table lookup numerical result; Wherein, based on the shift dimension and the table lookup numerical result, the data processing result corresponding to the square root operation data is determined to satisfy the following formula: ; in, is the data processing result, is the table lookup value result, is the shift dimension; The shift dimension corresponding to the reference data is calculated based on the preset amplification factor and the target threshold factor, satisfying the following formula: ; in, is the preset magnification factor, is the target threshold coefficient, Indicates the calculation of square root value. is the shift dimension corresponding to the reference data; Wherein, the data to be processed is the current data that needs to be processed on a low-power Soc, FPGA platform, or a computer or server; The square root operation data are data used in the design and development of communication receiver solutions, including: power values for which amplitude values need to be calculated, average power for which root mean square values need to be calculated, and mean square deviation for which root mean square errors need to be calculated.
2. The method according to claim 1, It is characterized in that The step of comparing the reference data with the preset threshold values respectively and determining the target threshold coefficient based on the comparison result includes: Compare the reference data with each preset threshold value respectively, and determine a minimum threshold value greater than the reference data among the preset threshold values based on the comparison result; The threshold coefficient corresponding to the minimum threshold value is determined as the target threshold coefficient.
3. The method according to claim 1, It is characterized in that The determining of the table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data includes: Determine a table lookup index value based on the target threshold coefficient and the reference data; Determine a table lookup numerical result based on the table lookup index value and the offline square root table; The offline square root table includes each table item index value and a table item result corresponding to each table item index value.
4. The method according to claim 3, It is characterized in that The table lookup index value is determined based on the target threshold coefficient and the reference data, satisfying the following formula: ; in, is the table lookup index value, is the reference data, is the target threshold coefficient, Indicates that rounding is performed according to the set number of digits.
5. A data processing device, It is characterized in that The device comprises: A numerical amplification module, used for determining the data to be processed, and if the data to be processed includes square root operation data, amplifying the square root operation data based on a preset amplification coefficient to determine the reference data corresponding to the square root operation data; A threshold comparison module, used to compare the reference data with each preset threshold value, and determine a target threshold coefficient based on the comparison result, wherein each preset threshold value is calculated based on each threshold coefficient; A table lookup module, used to obtain a pre-generated offline square root table corresponding to a set discrete numerical interval, and determine a table lookup numerical result based on the target threshold coefficient, the offline square root table and the reference data; A numerical synthesis module, used to determine a data processing result corresponding to the square root operation data based on the table lookup numerical result, the target threshold coefficient and the preset amplification coefficient, and update the data to be processed based on the data processing result; The device further comprises a threshold calculation module, which is used to calculate each preset threshold value based on each threshold coefficient, the preset amplification coefficient and the maximum value in the set discrete value interval; The preset threshold values are calculated based on the threshold coefficients, the preset amplification coefficients and the maximum value in the set discrete value interval, satisfying the following formula: ; in, is the preset threshold value, is the preset magnification factor, is the maximum value within the set discrete value interval, and l is the threshold coefficient; The numerical synthesis module includes a result determination unit, which is used to calculate the shift dimension corresponding to the square root operation data based on the preset amplification factor and the target threshold factor; Determine a data processing result corresponding to the square root operation data based on the shift dimension and the table lookup numerical result; Wherein, based on the shift dimension and the table lookup numerical result, the data processing result corresponding to the square root operation data is determined to satisfy the following formula: ; in, is the data processing result, is the table lookup value result, is the shift dimension; The result determination unit calculates the shift dimension corresponding to the reference data based on the following formula: ; in, is the preset magnification factor, is the target threshold coefficient, Indicates the calculation of square root value. is the shift dimension corresponding to the reference data; Wherein, the data to be processed is the current data that needs to be processed on a low-power Soc, FPGA platform, or a computer or server; The square root operation data are data used in the design and development of communication receiver solutions, including: power values for which amplitude values need to be calculated, average power for which root mean square values need to be calculated, and mean square deviation for which root mean square errors need to be calculated.
6. An electronic device, It is characterized in that The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the data processing method as described in any one of claims 1 to 4 is implemented.
