Interpolation method and device, storage medium and computing equipment
By using two-dimensional or three-dimensional data tables for interpolation and designing low-order filters, the problem of slow table lookup in digital signal processing is solved, and fast data retrieval and filter design are realized, which improves processing efficiency and real-time performance .
Patent Information
- Application Number
- CN202411292757.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-17
AI Technical Summary
In digital signal processing, it is difficult for the prior art to interpolate quickly through one-dimensional data tables, resulting in the inability to quickly restore original voice, images or communication content, especially when multiple different numerical sequences need to be processed, the table checking speed is slow, affecting real-time sex.
Use two-dimensional or three-dimensional data tables for interpolation, quickly locate the required data through index parameters, reduce table lookup dimensions, improve retrieval efficiency, and obtain multiple filter coefficients by designing low-order prototype filters and cyclic shifts to reduce filters Design difficulty.
It realizes rapid table lookup and data retrieval, improves real-time and efficiency of processing, simplifies filter design, reduces table lookup delay, and can quickly obtain required data and recover audio data.
Smart Images

Figure CN119149594A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital signal processing, and more specifically, to an interpolation method, device, storage medium and computing equipment. Background Art
[0002] In the field of digital signal processing, such as that involving the processing of voice data, image data, communication data, process data (e.g., adaptive filter coefficient data), etc., people often need to obtain unknown digital data based on known digital data in order to more accurately and quickly restore the original voice, image or communication content or determine more matching process data (e.g., adaptive filter coefficient data), etc.
[0003] In the actual circuit implementation of digital signal processing, it is usually difficult to generate some complex function signals (such as trigonometric functions, filter coefficients, etc.) in near real time or at the cost of low latency. In this case, in the actual circuit implementation, the values of some sampling points of these complex functions (for example, usually equally spaced reference sampling points that meet the accuracy requirements) are usually stored in a data table in advance, and the values corresponding to the actual sampling points are obtained by searching the data table and interpolating when necessary during actual use.
[0004] In the prior art, a one-dimensional data table (i.e., the data in the data table is numbered and searched only in one dimension) is usually used as a lookup table. Therefore, when interpolation is required, all reference point data (i.e., the values of the pre-stored reference sampling points and the values corresponding to them) need to be found in the one-dimensional lookup table. For example, when multiple different numerical sequences are stored, the one-dimensional data table can be searched in sequence according to the step values corresponding to the multiple different numerical sequences, and all reference point data corresponding to the required numerical sequences can be found one by one. For example, since it is a one-dimensional table, and when multiple different numerical sequences are stored, their respective step values may not be fixed, so the table lookup operation speed is slow, resulting in the inability to quickly restore the original voice, image or communication content or determine more matching process data (e.g., adaptive filter coefficient data) through interpolation.
[0005] Therefore, it is necessary to propose an interpolation method to quickly obtain the required data. Summary of the invention
[0006] The present invention aims to solve the above-described problems.
[0007] According to a first aspect of the present invention, there is provided an interpolation method, the method comprising: Get the first parameter ratio; Acquire an original first data sequence for calculating interpolated first data based on the first parameter; Obtain the interpolated first data based on interpolation calculation to obtain an interpolated first data sequence, The original first data sequence comes from a pre-stored two-dimensional data table or a three-dimensional data table, and the first parameter is an index parameter for indicating the position of the original first data sequence in the first dimension of the two-dimensional data table or the three-dimensional data table.
[0008] Based on the above technical solution, for example, fast table lookup can be achieved. For example, due to the use of a two-dimensional data table, when looking up a table, there is no need to design complex jumping search logic (only in one dimension), nor is there a need to search the entire large table (the one-dimensional data table of the prior art), which can improve the search efficiency (for example, compared with the prior art, the delay introduced by the table lookup is reduced, and the real-time performance of subsequent processing is improved).
[0009] Based on the above technical solution, for example, multiple sub-tables (i.e., three-dimensional data tables) can also be used to further improve the retrieval efficiency. For example, the above technical solution is also convenient for partitioning the coefficient table according to application requirements, that is, adding a retrieval dimension, and first searching different sub-coefficient tables (i.e., two-dimensional data tables) according to different ratio values, which can further improve the retrieval efficiency.
[0010] Since the retrieval efficiency is improved, based on the above technical solution, the required data (ie, the interpolated first data sequence) can be quickly acquired.
[0011] Optionally, the method further comprises: Obtain a second parameter km based on the first parameter; Acquire an input sequence of second data based on the second parameter; performing a convolution calculation based on the interpolated first data sequence and the input sequence of the second data to obtain an output sequence of the second data, Among them, the first eigenvalue is the ratio between the input sampling rate Fsin of the second data and the output sampling rate Fsout of the second data, the second parameter is an index parameter for obtaining the input sequence of the second data, the first data sequence includes an FIR filter coefficient sequence, and the second data includes audio data.
[0012] Based on the above technical solution, the data to be restored (ie, the output sequence of the second data) can be quickly acquired.
[0013] Optionally, the method further comprises: Determining design parameters to obtain a set of prototype filter coefficients; Circularly shifting the coefficients in the prototype filter coefficient set to obtain a shifted filter coefficient set; The prototype filter coefficient set and the shift filter coefficient set are pre-stored in the two-dimensional data table or the three-dimensional data table, Among them, the design parameters include the cutoff frequency of the FIR filter used to determine the FIR filter coefficient sequence, the second dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set grp_num, and the third dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set taps.
[0014] Based on the above technical solution, tabulation can be made easier. For example, when tabulating, it is only necessary to design a low-order prototype filter and obtain coefficients at different phases by moving it in the time dimension, and then splice them into a table. Therefore, it is not necessary to design a high-order prototype filter, which reduces the difficulty of filter design.
[0015] For example, the prior art practice is to design a prototype filter whose cutoff frequency is Fc / M, where M is the number of phases (which can be understood as group num or grp_num. For example, in order to obtain better SNR characteristics, M can be designed to be 256, and Fc can be understood as the bandwidth of the baseband signal (for example, the maximum value of the effective audio signal frequency)). During the design, the transition band is also very narrow, and it is not easy to design a filter that meets the pass-band ripple requirements.
[0016] Based on the above technical solution, when designing a prototype filter, the cutoff frequency can be set to Fc. Since it is much larger than Fc / M used in the prior art, the transition band is wider during design, making it easier to design a filter that meets the pass-band ripple requirements.
[0017] For example, by moving the prototype filter in the time dimension, coefficients of multiple (group num) filters (ie, coefficients of a group of filters) corresponding to different time delays (phases) can be obtained, which can be stored in the form of a two-dimensional table, for example.
[0018] Optionally, the method further comprises: Obtain a third parameter delta based on the first parameter; Get the fourth parameter t cur ; Acquire a fifth parameter k and a sixth parameter k+1 based on the third parameter and the fourth parameter; Search the two-dimensional data table or the three-dimensional data table based on the fifth parameter and the sixth parameter to obtain the original first data sequence, The third parameter is a sampling interval of an output sequence of the second data.
[0019] Based on the above technical solution, for example, fast table lookup can be achieved (that is, the search efficiency can be improved as in the previous technical solution). Taking table lookup for linear interpolation calculation as an example, it is only necessary to calculate the group index number k based on the delta value, and then retrieve the coefficients of the kth and k+1th rows in the dimension of grp_num in the table, and extract them for use.
[0020] According to a second aspect of the present invention, there is provided an interpolation device, the device comprising: A first acquisition module, used to acquire a first parameter ratio; A second acquisition module, used for acquiring an original first data sequence for calculating interpolated first data based on the first parameter; A first calculation module is used to obtain the interpolated first data based on interpolation calculation to obtain an interpolated first data sequence, The original first data sequence comes from a pre-stored two-dimensional data table or a three-dimensional data table, and the first parameter is an index parameter for indicating the position of the original first data sequence in the first dimension of the two-dimensional data table or the three-dimensional data table.
[0021] Optionally, the device further comprises: A third acquisition module, used to acquire a second parameter km based on the first parameter; a fourth acquisition module, configured to acquire an input sequence of second data based on the second parameter; a second calculation module, configured to perform convolution calculation based on the interpolated first data sequence and the input sequence of the second data to obtain an output sequence of the second data, Among them, the first eigenvalue is the ratio between the input sampling rate Fsin of the second data and the output sampling rate Fsout of the second data, the second parameter is an index parameter for obtaining the input sequence of the second data, the first data sequence includes an FIR filter coefficient sequence, and the second data includes audio data.
[0022] Optionally, the device further comprises: A prototype filter acquisition module is used to determine design parameters to obtain a prototype filter coefficient set; A shift filter coefficient acquisition module, used for cyclically shifting the coefficients in the prototype filter coefficient set to obtain a shift filter coefficient set; a tabulation module, used for pre-storing the prototype filter coefficient set and the shift filter coefficient set in the two-dimensional data table or the three-dimensional data table, Among them, the design parameters include the cutoff frequency of the FIR filter used to determine the FIR filter coefficient sequence, the second dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set grp_num, and the third dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set taps.
[0023] Optionally, the device further comprises: A fifth acquisition module, configured to acquire a third parameter delta based on the first parameter; The sixth acquisition module is used to obtain the fourth parameter t cur ; A seventh acquisition module, used to acquire a fifth parameter k and a sixth parameter k+1 based on the third parameter and the fourth parameter; an eighth acquisition module, configured to search the two-dimensional data table or the three-dimensional data table based on the fifth parameter and the sixth parameter to acquire the original first data sequence, The third parameter is a sampling interval of an output sequence of the second data.
[0024] According to a third aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the above interpolation method are implemented.
[0025] According to a fourth aspect of the present invention, there is provided a computing device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above interpolation method when executing the program.
[0026] The technical effects of the technical solutions according to the second aspect, the third aspect and the fourth aspect of the present invention are the same as the technical effects of the corresponding technical solutions according to the first aspect of the present invention, and are not elaborated herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated into the specification and constitute a part of the specification, illustrate embodiments of the present invention and are used to explain the principles of the present invention together with the relevant text description. In these drawings, similar reference numerals are used to represent similar elements. The drawings described below are some embodiments of the present invention, but not all embodiments. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 An embodiment of the interpolation method according to the present invention is shown; Figure 2 An embodiment of the interpolation device according to the present invention is shown; Figure 3 An example of an asynchronous sampling rate converter ASRC used in the prior art is shown; Figure 4 Shows the combination Figure 1 and Figure 2 An example of ASRC according to the technical solution of the present invention is shown; Figure 5 Shows Figure 4 A schematic diagram of a tabulation method according to the present invention that can be used by the ASRC shown; Figure 6 A comparison diagram of the coefficient table according to the present invention and the coefficient table of the prior art is shown. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. It should be noted that the embodiments in this application and the features in the embodiments can be combined with each other arbitrarily without conflict.
[0030] Figure 1 An embodiment of the interpolation method according to the present invention is shown.
[0031] like Figure 1 As shown, the interpolation method 100 according to the present invention includes: Step S101: obtaining a first parameter ratio; Step S103: acquiring an original first data sequence for calculating interpolated first data based on the first parameter; Step S105: obtaining the interpolated first data based on interpolation calculation to obtain an interpolated first data sequence, The original first data sequence comes from a pre-stored two-dimensional data table or a three-dimensional data table, and the first parameter is an index parameter for indicating the position of the original first data sequence in the first dimension of the two-dimensional data table or the three-dimensional data table.
[0032] Based on the above technical solution, for example, fast table lookup can be achieved. For example, due to the use of a two-dimensional data table, when looking up a table, there is no need to design complex jumping search logic (only in one dimension), nor is there a need to search the entire large table (the one-dimensional data table in the prior art), which can improve the search efficiency.
[0033] Based on the above technical solution, for example, multiple sub-tables (i.e., three-dimensional data tables) can also be used to further improve the retrieval efficiency. For example, the above technical solution is also convenient for partitioning the coefficient table according to application requirements, that is, adding a retrieval dimension, and first searching different sub-coefficient tables (i.e., two-dimensional data tables) according to different ratio values, which can further improve the retrieval efficiency.
[0034] Since the retrieval efficiency is improved, based on the above technical solution, the required data (ie, the interpolated first data sequence) can be quickly acquired.
[0035] Optionally, the method 100 may further include: Step S107: Obtain a second parameter km based on the first parameter; Step S109: acquiring an input sequence of second data based on the second parameter; Step S111: performing convolution calculation based on the interpolated first data sequence and the input sequence of the second data to obtain an output sequence of the second data, Among them, the first eigenvalue is the ratio between the input sampling rate Fsin of the second data and the output sampling rate Fsout of the second data, the second parameter is an index parameter for obtaining the input sequence of the second data, the first data sequence includes an FIR filter coefficient sequence, and the second data includes audio data.
[0036] Based on the above technical solution, the data to be restored (ie, the output sequence of the second data) can be quickly acquired.
[0037] Optionally, the method 100 may further include: Step S113: Determine design parameters to obtain a prototype filter coefficient set; Step S115: cyclically shifting the coefficients in the prototype filter coefficient set to obtain a shifted filter coefficient set; Step S117: pre-storing the prototype filter coefficient set and the shift filter coefficient set in the two-dimensional data table or the three-dimensional data table, Among them, the design parameters include the cutoff frequency of the FIR filter used to determine the FIR filter coefficient sequence, the second dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set grp_num, and the third dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set taps.
[0038] Based on the above technical solution, tabulation can be made easier. For example, when tabulating, it is only necessary to design a low-order prototype filter and obtain coefficients at different phases by moving it in the time dimension, and then splice them into a table. Therefore, it is not necessary to design a high-order prototype filter, which reduces the difficulty of filter design.
[0039] For example, the prior art practice is to design a prototype filter whose cutoff frequency is Fc / M, where M is the number of phases (which can be understood as group num or grp_num. For example, in order to obtain better SNR characteristics, M can be designed to be 256, and Fc can be understood as the bandwidth of the baseband signal (for example, the maximum value of the effective audio signal frequency)). During the design, the transition band is also very narrow, and it is not easy to design a filter that meets the pass-band ripple requirements.
[0040] Based on the above technical solution, when designing a prototype filter, the cutoff frequency can be set to Fc. Since it is much larger than Fc / M used in the prior art, the transition band is wider during design, making it easier to design a filter that meets the pass-band ripple requirements.
[0041] For example, by moving the prototype filter in the time dimension, coefficients of multiple (group num) filters (ie, coefficients of a group of filters) corresponding to different time delays (phases) can be obtained, which can be stored in the form of a two-dimensional table, for example.
[0042] Optionally, the method 100 may further include: Step S119: obtaining a third parameter delta based on the first parameter; Step S121: Obtain the fourth parameter t cur ; Step S123: obtaining a fifth parameter k and a sixth parameter k+1 based on the third parameter and the fourth parameter; Step S125: searching the two-dimensional data table or the three-dimensional data table based on the fifth parameter and the sixth parameter to obtain the original first data sequence. The third parameter is a sampling interval of an output sequence of the second data.
[0043] Based on the above technical solution, for example, fast table lookup can be achieved (that is, the search efficiency can be improved as in the previous technical solution). Taking table lookup for linear interpolation calculation as an example, it is only necessary to calculate the group index number k based on the delta value, and then retrieve the coefficients of the kth and k+1th rows in the dimension of grp_num in the table, and extract them for use.
[0044] Figure 2 An embodiment of the interpolation device according to the present invention is shown.
[0045] like Figure 2 As shown, the interpolation device 200 according to the present invention comprises: A first acquisition module 202, used to acquire a first parameter ratio; A second acquisition module 204, configured to acquire, based on the first parameter, an original first data sequence for calculating interpolated first data; The first calculation module 206 is used to obtain the interpolated first data based on interpolation calculation to obtain an interpolated first data sequence. The original first data sequence comes from a pre-stored two-dimensional data table or a three-dimensional data table, and the first parameter is an index parameter for indicating the position of the original first data sequence in the first dimension of the two-dimensional data table or the three-dimensional data table.
[0046] Optionally, the apparatus 200 may further include: A third acquisition module 208, configured to acquire a second parameter km based on the first parameter; A fourth acquisition module 210, configured to acquire an input sequence of second data based on the second parameter; A second calculation module 212 is configured to perform convolution calculation based on the interpolated first data sequence and the input sequence of the second data to obtain an output sequence of the second data, Among them, the first eigenvalue is the ratio between the input sampling rate Fsin of the second data and the output sampling rate Fsout of the second data, the second parameter is an index parameter for obtaining the input sequence of the second data, the first data sequence includes an FIR filter coefficient sequence, and the second data includes audio data.
[0047] Optionally, the apparatus 200 may further include: A prototype filter acquisition module 214 is used to determine design parameters to obtain a prototype filter coefficient set; A shift filter coefficient acquisition module 216, configured to cyclically shift the coefficients in the prototype filter coefficient set to obtain a shift filter coefficient set; The tabulation module 218 is used to store the prototype filter coefficient set and the shift filter coefficient set in the two-dimensional data table or the three-dimensional data table in advance. Among them, the design parameters include the cutoff frequency of the FIR filter used to determine the FIR filter coefficient sequence, the second dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set grp_num, and the third dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set taps.
[0048] Optionally, the apparatus 200 may further include: A fifth acquisition module 220, configured to acquire a third parameter delta based on the first parameter; The sixth acquisition module 222 is used to acquire the fourth parameter t cur ; A seventh acquisition module 224, configured to acquire a fifth parameter k and a sixth parameter k+1 based on the third parameter and the fourth parameter; An eighth acquisition module 226 is configured to search the two-dimensional data table or the three-dimensional data table based on the fifth parameter and the sixth parameter to acquire the original first data sequence. The third parameter is a sampling interval of an output sequence of the second data.
[0049] According to one embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the steps of the above interpolation method are implemented.
[0050] According to one embodiment of the present invention, a computing device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above interpolation method when executing the program.
[0051] The technical effects of the various technical solutions of the interpolation device 200, computer-readable storage medium, and computing device according to the present invention are the same as the technical effects of the corresponding technical solutions of the interpolation method 100 according to the present invention, and are not elaborated herein.
[0052] In order to enable ordinary technicians in the field to more clearly understand and implement the above technical solutions according to the present invention, Figures 3 to 6 The specific implementation of the above technical solution in the asynchronous sampling rate converter ASRC (Asynchronous Sample Rate Converter) disclosed in the prior art (for details, please refer to A Stereo Asynchronous Digital Sample-Rate Converter for Digital Audio, Robert Adams and Tom Kwan, IEEE JOURNAL OF SOLID-STATE CIRCUITS, VOL.29, NO.4, APRIL 1994) is described as an embodiment.
[0053] The sampling rate conversion algorithm and system of digital signals (i.e., converting the signal from the original sampling rate Fsin (i.e., the input sampling rate Fsin of the second data mentioned in the above method 100) to the new sampling rate Fsout (i.e., the output sampling rate Fsout of the second data mentioned in the above method 100) without changing other properties of the signal) are widely used in fields requiring multiple sampling rates, such as communications, audio and video. For example, in the field of audio processing, it is often necessary to convert audio / voice data streams of different conversion rates (8kHz, 32kHz, 44.1kHz, 88.2kHz, 96kHz, 176.4kHz, 192kHz) to a 48kHz sampling rate before outputting, so as to facilitate the mixing processing of multi-channel data.
[0054] A commonly used sampling rate conversion algorithm designs a filter based on a fixed sampling rate ratio (=Fsin / Fsout=L / M), and performs interpolation and decimation before and after filtering based on integers L and M, respectively. This method is simple in concept, but can only be applied to several common fixed sampling rates, and cannot cope with sampling rate fluctuations caused by factors such as clock heterogeneity, jitter disturbance, and crystal drift. In other words, the traditional sampling rate converter architecture based on a fixed sampling rate ratio has a simple design concept, but can only be applied to several common fixed sampling rates, cannot cope with sampling rates of arbitrary values, and cannot cope with fixed sampling rate fluctuations introduced by factors such as heterogeneous clocks.
[0055] In order to overcome the shortcomings of the sampling rate conversion algorithm with a fixed sampling rate ratio, the prior art often uses ASRC to convert a digital signal with any input sampling rate into a digital signal with any output sampling rate and then output it without considering the specific values of the input sampling clock and the output sampling clock (which can be any values within the limited range allowed by the design) and clock synchronization.
[0056] Figure 3 An example of ASRC used in the prior art is shown. Figure 3As shown, this scheme is usually based on a servo tracking loop controller, an FIR coefficient interpolation calculation module and an FIR (polyphase) filter. The input data stream is stored in the input data storage area, and the FIR prototype filter coefficients are stored in the ROM storage area. When working, the ASRC uses the servo loop controller to lock Fsin and Fsout, calculate the sampling rate ratio, and extract km, delta and other index numbers for value acquisition from the ratio information. The km index number is used to locate the required input data (i.e., the input sequence of the second data mentioned in step S109 of the above method 100) and send it to the filter. The ratio value and the delta index number are output to the coefficient interpolation calculation module for interpolation calculation and locating the original filter coefficients required for interpolation calculation in the ROM (i.e., the original first data sequence mentioned in step S103 of the above method 100 - the sequence of values of the original first data point), and the interpolation calculation algorithm is used to obtain the time-varying filter coefficients (i.e., the interpolated first data sequence mentioned in step S105 of the above method 100). The coefficient interpolation calculation module is used to calculate the time-varying filter coefficients using the interpolation method. The FIR filter (for example, corresponding to the fourth acquisition module 210 and the second calculation module 212 in the device 200 according to the present invention) convolves the input data segment data and the time-varying filter coefficient coef, and outputs the data (that is, corresponding to, for example, step S111 in the above method 100). The final filtering effect actually depends on the accuracy of the time-varying filter coefficients obtained by interpolation calculation. The above technical solution has been implemented in scientific research and industry in the form of software or hardware.
[0057] Figure 3 Although the ASRC architecture of the prior art shown overcomes the disadvantage that Fsin and Fsout cannot be set to arbitrary values, it still has the following problems that are not easy to solve: (1) The prototype filter that the polyphase filter coefficient table stored in ROM relies on is difficult to design. Due to the use of a polyphase structure, if you want to obtain a higher interpolation calculation accuracy, you need to design the prototype filter into a high-order narrowband filter with small pass-band ripple and low stop-band cutoff frequency. When using the window function method and frequency sample method for design, it is difficult to effectively control the pass-band ripple. When using design methods based on iterative algorithms such as the equal ripple method, it is difficult to achieve high-order design goals. Using the cascade method, the structure becomes complicated and it is not easy to control the aliasing effect of each stage. If you want to reduce the difficulty of prototype filter design, it is difficult to ensure interpolation accuracy and filtering effect.
[0058] (2) The table lookup method is relatively complicated. It is necessary to search in a large one-dimensional coefficient table, find different prototype coefficients at different Fsout output beats, and interpolate to obtain the final time-varying coefficients. Since the large table used in the existing technology has only one dimension, it is necessary to jump from the head to the end of the table. The table lookup logic is difficult to set and understand. In addition, since there are many data items in the large table, it takes a long time to search the entire table.
[0059] In order to solve the above problems, we can combine Figure 1 and Figure 2 According to the technical solution of the present invention, Figure 3 The ASRC architecture of the prior art shown is improved.
[0060] Figure 4 Shows the combination Figure 1 and Figure 2 An example of ASRC according to the technical solution of the present invention is shown.
[0061] like Figure 4 As shown, Figure 3 Compared with the existing ASRC scheme shown in FIG. 1 , the ratio value is transmitted from the servo loop controller to the time-varying prototype filter f coefficient calculation module (for example, corresponding to the method according to the present invention). Figure 2 The time-varying prototype filter f coefficient calculation module provides a coefficient table H of the time-varying filter f (for example, the above-mentioned two-dimensional data table or three-dimensional data table pre-stored according to the present invention) to the coefficient interpolation calculation module. H is a matrix whose length and width are respectively the number of polyphase filter groups grp_num and the length of the filter taps, which will be adjusted with the ratio value. The other modules and signal interactions are the same. Figure 3 The existing ASRC scheme is shown.
[0062] Figure 5 Shows Figure 4 The illustrated diagram is a schematic diagram of a tabulation method according to the present invention that can be used by ASRC (eg, for obtaining a coefficient matrix H of a time-varying prototype filter f).
[0063] like Figure 5 As shown, in order to obtain the coefficient matrix H of the time-varying prototype filter f (for example, it includes the above-mentioned prototype filter coefficient set and the shift filter coefficient set), it includes the following steps: First, calculate the grp_num value and taps value according to the following formula (1) and formula (2).
[0064] (1) (2) Among them, the grp_num value and the taps value have a function mapping relationship with the ratio value. When downsampling, the relationship between taps and ratio is shown in formula (1), where floor represents the truncation of the integer part, and a is a fixed taps length (integer). When upsampling, the relationship between grp_num and ratio is shown in formula (2), where b is the maximum storage capacity of the coefficient storage area. In specific implementation, taps and grp_num can be calculated in real time, or several sets of fixed ratio values can be determined based on the commonly used Fsin / Fout values to calculate the corresponding taps and grp_num.
[0065] For example, if the computing performance is sufficient, the current H=H can be calculated based on the taps and grp_num values calculated in real time. cur or h=h cur , H cur or cur The number of data items is limited by b. When the computing performance is insufficient, the corresponding taps and grp_num can be calculated according to p groups of fixed ratio values, thereby obtaining p tables in the form of H or h. The number of rows and columns in each table is different. We can understand that at this time, the coefficient table is split into p sub-tables according to different ratio values.
[0066] Second, align the peak of the filter f to the time t0 of zero phase shift, which represents the current time (n-1)T x The sampling point information will be retained to the greatest extent during filtering.
[0067] Third, the prototype filter f is gradually moved rightward along the t axis (for example, the circular shift in step S115 in the above method 100 ), and after each movement, the coefficient values corresponding to the taps / 2 sampling points on both sides of the filter vertex are recorded.
[0068] Each movement is to align the filter peak to the current phase shift moment. grp_num represents the number of phases of the polyphase filter. The so-called phase refers to the phase shift (i.e., time delay) corresponding to the current moment, i.e. Figure 5 The t shown i (i=0,1,…,cur,k+1,…) values. The so-called phase number refers to the number of phases of the filter f from (n-1)T x Move to nT x During this period, the maximum number of phase shifts is performed in △ (ie, delta) steps, which is numerically equal to grp_num.
[0069] Fourth, when the filter f reaches the absolute time nT x When , the calculation is completed.
[0070] Through the above steps, we can get taps × grp_num coefficients, forming the matrix H=H taps×grp_num .
[0071] When looking up the table, first select a subtable according to the ratio value (eg, corresponding to step S101 and step S103 in the above method 100 ), and then use the previous table lookup method to search within the subtable.
[0072] Figure 6 A comparison diagram of the coefficient table H according to the present invention and the coefficient table h in the prior art is shown.
[0073] like Figure 6 As shown, H or h can be stored in ROM or RAM in a table format, so that delta can be used as an index number to directly look up the table.
[0074] Based on the above technical solution, for example, fast table lookup can be achieved. Since the prior art stores H in a one-dimensional array h, the size of the one-dimensional array h is b>= taps × grp_num, and the technical solution according to the present invention uses a two-dimensional data (coefficient) table H, when looking up the table, compared with the one-dimensional data (coefficient) table h of the prior art, there is no need to design complex jumping search logic (only in one dimension), nor is there a need to search the entire large table (the one-dimensional data table h of the prior art), which can improve the search efficiency (for example, compared with the prior art, the delay introduced by the table lookup is reduced, and the real-time performance of subsequent processing is improved).
[0075] Based on the above technical solution, for example, multiple sub-tables (i.e., three-dimensional data tables, for example, each sub-table in the total table corresponds to a coefficient table H, and each H can correspond to a different ratio) can be used to further improve the retrieval efficiency. For example, the above technical solution is also convenient for partitioning the coefficient table according to application requirements, that is, adding a retrieval dimension, and first searching different sub-coefficient tables according to different ratio values (i.e., Figure 6 The two-dimensional data table H shown in FIG. 1 can further improve the retrieval efficiency.
[0076] The above technical solution can solve the technical problem existing in the ASRC architecture of the prior art: "(2) the table lookup method is relatively complicated."
[0077] In order to solve the technical problem existing in the ASRC architecture of the prior art, "(1) the prototype filter on which the multi-phase filter coefficient table stored in the ROM depends is difficult to design", the following technical solution can be adopted.
[0078] The design of the time-varying prototype filter f can use any filter design method including window function method, frequency sample method, equiripple method, formula method, etc. Since the cutoff frequency of the prototype filter to be designed according to the above technical solution of the present invention is Fc, the order of f does not need to be very high (consistent with the taps value), so the difficulty of design implementation is lower than that of the high-order prototype filter with a cutoff frequency of Fc / M required to be designed in the prior art.
[0079] For example, a simple implementation method is to use the sinc function as the prototype filter and directly obtain the phase shift time t through the phase shift calculation formula of the sinc function (Formula (3)): i The coefficient value, composition Figure 6 Table shown.
[0080] (3) When looking up the table, according to the current Fsout beat corresponding to the time t cur The relationship between △ and Fsout can be directly converted to the time t corresponding to the current Fsout beat. cur The two most recent index numbers k and k+1 are used to look up the table in H to obtain two sets of reference coefficients coefa and coefb for linear interpolation calculation. Using delta, coefa and coefb, the time-varying filter coefficient coef corresponding to the current moment is obtained in the coefficient interpolation calculation module and sent to the subsequent filter calculation module for use.
[0081] The above table lookup method according to the present invention has at least the following advantages: (1) By only determining the two index numbers k and k+1, two sets of reference coefficients for interpolation calculation can be directly retrieved from the two-dimensional table and the three-dimensional table, without having to look up the tables one by one to obtain the reference point coefficients, thus reducing processing delay.
[0082] (2) The ratio value can be fixed to several commonly used values, so that several two-dimensional tables with different grp_num and tap can be calculated in advance. When looking up the table, you can first determine a certain two-dimensional table based on the step value ratio, and then look up the reference point coefficient in this table, thereby eliminating the trouble of adjusting the step value of the large table according to the ratio value, further reducing the processing delay.
[0083] Those skilled in the art should understand that, for the convenience of explanation, linear interpolation is used in this example, but Figure 5 and Figure 6 The tabulation, table lookup method and coefficient table shown can also be used for high-order interpolation calculations.
[0084] According to the above ASRC improvement scheme of the present invention, the prototype filter coefficient table is prepared and retrieved based on the moving filter method. The actual verification results show that the above improvement scheme of the present invention reduces the design difficulty of the coefficient table, improves the retrieval efficiency of the coefficient table, and the output result is consistent with the result of the existing method. According to the above improvement scheme of the present invention, it is also convenient to perform partition retrieval of the fixed coefficient table according to application requirements to further improve the retrieval efficiency.
[0085] The contents described above may be implemented individually or in combination in various ways, and these variations are all within the protection scope of the present invention.
[0086] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the above disclosed methods may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the present invention. Although the present invention has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that the technical solutions described in the above embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An interpolation method, It is characterized in that The method comprises: Get the first parameter ratio; Acquire an original first data sequence for calculating interpolated first data based on the first parameter; Obtain the interpolated first data based on interpolation calculation to obtain an interpolated first data sequence, The original first data sequence comes from a pre-stored two-dimensional data table or a three-dimensional data table, and the first parameter is an index parameter for indicating the position of the original first data sequence in the first dimension of the two-dimensional data table or the three-dimensional data table.
2. The method according to claim 1, It is characterized in that The method further comprises: Obtain a second parameter km based on the first parameter; Acquire an input sequence of second data based on the second parameter; performing a convolution calculation based on the interpolated first data sequence and the input sequence of the second data to obtain an output sequence of the second data, Among them, the first eigenvalue is the ratio between the input sampling rate Fsin of the second data and the output sampling rate Fsout of the second data, the second parameter is an index parameter for obtaining the input sequence of the second data, the first data sequence includes an FIR filter coefficient sequence, and the second data includes audio data.
3. The method according to claim 2, It is characterized in that The method further comprises: Determining design parameters to obtain a set of prototype filter coefficients; Circularly shifting the coefficients in the prototype filter coefficient set to obtain a shifted filter coefficient set; The prototype filter coefficient set and the shift filter coefficient set are pre-stored in the two-dimensional data table or the three-dimensional data table, Among them, the design parameters include the cutoff frequency of the FIR filter used to determine the FIR filter coefficient sequence, the second dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set grp_num, and the third dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set taps.
4. The method according to any one of claims 2 to 3, It is characterized in that The method further comprises: Obtain a third parameter delta based on the first parameter; Get the fourth parameter t cur ; Acquire a fifth parameter k and a sixth parameter k+1 based on the third parameter and the fourth parameter; Search the two-dimensional data table or the three-dimensional data table based on the fifth parameter and the sixth parameter to obtain the original first data sequence, The third parameter is a sampling interval of an output sequence of the second data.
5. An interpolation device, It is characterized in that The device comprises: A first acquisition module, used to acquire a first parameter ratio; A second acquisition module, used for acquiring an original first data sequence for calculating interpolated first data based on the first parameter; A first calculation module is used to obtain the interpolated first data based on interpolation calculation to obtain an interpolated first data sequence, The original first data sequence comes from a pre-stored two-dimensional data table or a three-dimensional data table, and the first parameter is an index parameter for indicating the position of the original first data sequence in the first dimension of the two-dimensional data table or the three-dimensional data table.
6. The device according to claim 5, It is characterized in that The device also includes: A third acquisition module, used to acquire a second parameter km based on the first parameter; a fourth acquisition module, configured to acquire an input sequence of second data based on the second parameter; a second calculation module, configured to perform convolution calculation based on the interpolated first data sequence and the input sequence of the second data to obtain an output sequence of the second data, Among them, the first eigenvalue is the ratio between the input sampling rate Fsin of the second data and the output sampling rate Fsout of the second data, the second parameter is an index parameter for obtaining the input sequence of the second data, the first data sequence includes an FIR filter coefficient sequence, and the second data includes audio data.
7. The device according to claim 6, It is characterized in that The device also includes: A prototype filter coefficient acquisition module is used to determine design parameters to obtain a prototype filter coefficient set; A shift filter coefficient acquisition module, used for cyclically shifting the coefficients in the prototype filter coefficient set to obtain a shift filter coefficient set; a tabulation module, used for pre-storing the prototype filter coefficient set and the shift filter coefficient set in the two-dimensional data table or the three-dimensional data table, Among them, the design parameters include the cutoff frequency of the FIR filter used to determine the FIR filter coefficient sequence, the second dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set grp_num, and the third dimension of the two-dimensional data table or the three-dimensional data table is the total number of filter coefficients in the filter coefficient set taps.
8. The device according to any one of claims 6 to 7, It is characterized in that The device also includes: A fifth acquisition module, configured to acquire a third parameter delta based on the first parameter; The sixth acquisition module is used to obtain the fourth parameter t cur ; A seventh acquisition module, used to acquire a fifth parameter k and a sixth parameter k+1 based on the third parameter and the fourth parameter; an eighth acquisition module, configured to search the two-dimensional data table or the three-dimensional data table based on the fifth parameter and the sixth parameter to acquire the original first data sequence, The third parameter is a sampling interval of an output sequence of the second data.
9. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, which implements the steps of the method according to any one of claims 1 to 4 when executed by a processor.
10. A computing device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the steps of the method according to any one of claims 1 to 4 are implemented when the processor executes the program.
