Spectrum Processing Method, Apparatus, Computer Device, and Readable Storage Medium
By determining minimum difference frequency points and using an adaptive sampling factor for resampling, the method reduces processor energy consumption and improves accuracy in frequency spectrum processing.
Patent Information
- Application Number
- CN202310880274.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-17
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2043-07-17
AI Technical Summary
During the display spectrum processing, existing processors consume too much energy and have limited performance due to calculating a large number of sample points.
By determining the minimum difference frequency of multiple display frequencies, determining the adaptive sampling factor based on the minimum difference frequency and the number of sampling points, resampling and conversion are performed, calculating the amplitude corresponding to each display frequencies, and reducing the number of frequency points calculated by the processor.
Under the conditions that meet the Fourier transform regulations, users can customize the number of sampling points, reduce the processor calculation amount, improve the accuracy of the corresponding amplitude of the frequency point, and reduce energy consumption.
Smart Images

Figure CN116842346B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of spectrum processing, and in particular, to a spectrum processing method, apparatus, computer device, and readable storage medium. Background Art
[0002] Currently, when a processor processes a display spectrum, it needs to calculate a large number of sampling points, which brings a significant overhead to the processor. However, the performance of the processor is limited, and calculating a large number of sampling points will cause the processor to consume too much energy. There is a problem of high energy consumption in the process of displaying the spectrum by existing processors. Summary of the Invention
[0003] To solve the above technical problems, embodiments of the present application provide a spectrum processing method, apparatus, computer device, and readable storage medium.
[0004] In a first aspect, an embodiment of the present application provides a spectrum processing method, and the method includes:
[0005] Determine a plurality of display frequencies, and obtain a minimum difference frequency point according to the plurality of display frequencies;
[0006] Determine an adaptive sampling factor according to the minimum difference frequency point and the number of sampling points;
[0007] Resample the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time-domain signal;
[0008] Perform conversion according to the resampled time-domain signal to obtain a frequency-domain signal;
[0009] Calculate the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points.
[0010] In an embodiment, the obtaining a minimum difference frequency point according to the plurality of display frequencies includes:
[0011] Calculate the difference frequency points between adjacent two of the plurality of display frequencies;
[0012] Determine the minimum difference frequency point from the plurality of difference frequency points.
[0013] In an embodiment, the determining an adaptive sampling factor according to the minimum difference frequency point and the number of sampling points includes:
[0014] Multiply the minimum difference frequency point by the number of sampling points to obtain a first product;
[0015] Divide the original sampling rate by the first product to obtain a first quotient value;
[0016] Round up the first quotient value, and use the rounded result as the adaptive sampling factor.
[0017] In one embodiment, the resampling the original time-domain signal according to the adaptive sampling factor and bit depth to obtain a resampled time-domain signal includes:
[0018] Divide the bit depth by a first preset value to obtain a second quotient value;
[0019] Subtract a second preset value from the signal amount of the resampled signal to obtain a first difference;
[0020] Multiply the second quotient value by the first difference to obtain a second product;
[0021] Multiply the second product by the adaptive sampling factor to obtain a third product;
[0022] Add a third preset value to the third product to obtain a first sum value;
[0023] Multiply the first sum value by the first original time-domain signal array to obtain a first corrected signal array;
[0024] Convert the first corrected signal array into binary to obtain a first binary number;
[0025] Add a fourth preset value to the third product to obtain a second sum value;
[0026] Multiply the second sum value by the second original time-domain signal array to obtain a second corrected signal array;
[0027] Convert the second corrected signal array into binary to obtain a second binary number;
[0028] Concatenate the first binary number and the second binary number to obtain a third binary number;
[0029] Convert the third binary number into decimal to obtain the resampled time-domain signal.
[0030] In one embodiment, the converting the resampled time-domain signal to obtain a frequency-domain signal includes:
[0031] Perform an indefinite integral operation on the resampled time-domain signal to obtain the frequency-domain signal.
[0032] In one embodiment, the calculating the amplitude corresponding to each display frequency according to the adaptive sampling factor, original sampling rate, each display frequency, and number of sampling points includes:
[0033] Multiply each display frequency, number of sampling points, and adaptive sampling factor to obtain a fourth product;
[0034] Divide the fourth product by the original sampling rate to obtain a third quotient value;
[0035] Multiply the third quotient value by the frequency domain signal to obtain a corrected frequency domain signal;
[0036] Add a fifth preset value to the corrected frequency domain signal to obtain a third sum value;
[0037] Perform polar coordinate operation on the corrected frequency domain signal to obtain the amplitudes corresponding to the respective display frequencies.
[0038] In a second aspect, an embodiment of the present application provides a spectrum processing method device, and the spectrum processing method device includes:
[0039] A frequency point module, configured to determine a plurality of the display frequencies, and obtain the minimum difference frequency point according to the plurality of adjacent two display frequencies;
[0040] An adaptive module, configured to determine the adaptive sampling factor according to the minimum difference frequency point and the number of sampling points;
[0041] A resampling module, configured to perform the resampling on the original time domain signal according to the adaptive sampling factor and the bit depth to obtain the resampled time domain signal;
[0042] A frequency domain module, configured to perform conversion according to the resampled time domain signal to obtain the frequency domain signal;
[0043] A calculation module, configured to calculate the amplitudes corresponding to the respective display frequencies according to the adaptive sampling factor, the original sampling rate, the respective display frequencies, and the number of sampling points.
[0044] In an embodiment, in the spectrum processing device, the calculation module is further configured to multiply the respective display frequencies, the number of sampling points, and the adaptive sampling factor to obtain a fourth product;
[0045] Divide the fourth product by the original sampling rate to obtain a third quotient value;
[0046] Multiply the third quotient value by the frequency domain signal to obtain a corrected frequency domain signal;
[0047] Add a fifth preset value to the corrected frequency domain signal to obtain a third sum value;
[0048] Perform polar coordinate operation on the corrected frequency domain signal to obtain the amplitudes corresponding to the respective display frequencies.
[0049] In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor. The memory is used to store a computer program, and the computer program executes the spectrum processing method provided in the first aspect when running on the processor.
[0050] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program executes the spectrum processing method provided in the first aspect when running on a processor.
[0051] For the spectrum processing method provided in the present application above, by determining a plurality of display frequencies, obtaining a minimum difference frequency point according to the plurality of display frequencies; determining an adaptive sampling factor according to the minimum difference frequency point and the number of sampling points; resampling the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time-domain signal; performing a conversion according to the resampled time-domain signal to obtain a frequency-domain signal; calculating the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points. When meeting the requirement that it must be a power of 2 in the Fourier transform, the user can customize the number of sampling points, which is equivalent to being able to reduce the number of sampling points, thereby reducing the number of frequency points that the processor needs to calculate. An adaptive sampling factor is obtained through the minimum difference frequency point and the number of sampling points, which can adapt to various sampling rates and calculate the amplitude corresponding to the frequency, so that these amplitudes do not overlap, improving the accuracy of the processor in processing the amplitudes corresponding to the display frequencies that need to be calculated. By allowing the user to customize the number of sampling points, the problem of excessive energy consumption caused by the processor having to calculate a large number of frequency points is also solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] To more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings required in the embodiments. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the protection scope of the present application. In each drawing, similar components are numbered similarly.
[0053] Figure 1 Shows a flowchart of a spectrum processing method provided by an embodiment of the present application;
[0054] Figure 2 Shows a flowchart of obtaining a minimum difference frequency point provided by an embodiment of the present application;
[0055] Figure 3 Shows a flowchart of determining an adaptive sampling factor provided by an embodiment of the present application;
[0056] Figure 4 Shows a flowchart of calculating a resampled time-domain signal provided by an embodiment of the present application;
[0057] Figure 5 It shows a flowchart for calculating a frequency-domain signal provided by an embodiment of the present application;
[0058] Figure 6 It shows a flowchart for calculating the amplitude corresponding to each display frequency provided by an embodiment of the present application;
[0059] Figure 7 It shows a schematic structural diagram of a spectrum processing device provided by an embodiment of the present application;
[0060] Figure 8 It shows a schematic structural diagram of a computer device provided by an embodiment of the present application.
[0061] Icons: 700 - spectrum processing device, 701 - frequency point module, 702 - adaptive module, 703 - resampling module, 704 - frequency domain module, 705 - calculation module, 800 - computer device, 801 - transceiver, 802 - processor, 803 - memory. Detailed implementation manners
[0062] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments.
[0063] Generally, the components of the embodiments of the present application described and shown in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application claimed, but only represents the selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.
[0064] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are only intended to represent specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be construed as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.
[0065] In addition, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0066] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present application pertain. The terms (such as those defined in a commonly used dictionary) will be interpreted to have the same meaning as the contextual meaning in the relevant technical field and will not be interpreted to have an idealized meaning or an overly formal meaning unless clearly defined in various embodiments of the present application.
[0067] Embodiment 1
[0068] An embodiment of the present application provides a spectrum processing method, which can be applied in electronics and acoustics. Electronics includes radio communication. The spectrum processing method will be described below.
[0069] See Figure 1 , the spectrum processing method includes:
[0070] Step S1, determine a plurality of display frequencies, and obtain the minimum difference frequency point according to the plurality of display frequencies.
[0071] In this embodiment, the user can input a plurality of display frequencies through the display interface. For example, the user inputs a plurality of display frequencies such as 30, 50, 100, 200... through the display interface, and the minimum difference frequency point can be calculated according to the plurality of display frequencies such as 30, 50, 100, 200.
[0072] See Figure 2 , obtaining the minimum difference frequency point according to the plurality of display frequencies in step S1 includes:
[0073] Step S101, calculate the difference frequency points between adjacent two of the plurality of display frequencies;
[0074] In this embodiment, the plurality of display frequencies are 30, 50, 100, 200... respectively. The smallest of the display frequencies is 30, and the difference between the display frequencies 30 and 50 is 20, that is, the difference frequency point between two adjacent display frequencies among the above plurality of display frequencies is 20. Step S102, determine the minimum difference frequency point from the plurality of difference frequency points.
[0075] In this embodiment, the multiple display frequencies are 30, 50, 100, and 200 respectively. The minimum of the display frequencies is 30. The difference between the display frequencies of 30 and 50 is 20. The difference between the display frequencies of 50 and 100 is 50. The difference between the display frequencies of 200 and 100 is 100. That is, the minimum difference frequency point between two adjacent display frequencies among the above multiple display frequencies is 20. Use the minimum difference frequency point 20 between 30 and 50 to replace the minimum frequency 30 that needs to be displayed, and obtain the minimum difference frequency point 20. After replacement, it becomes: 20, 50, 100, 200. By replacing the minimum frequency with the minimum difference frequency point, the amplitudes corresponding to the display frequencies will not overlap, ensuring the accuracy of sampling.
[0076] Step S2: Determine an adaptive sampling factor according to the minimum difference frequency point and the number of sampling points.
[0077] In this embodiment, according to the adaptive sampling factor, the sampling distance can be calculated at various sampling rates, and the sampling rates include the original sampling rate.
[0078] See Figure 3 , in step S2, determining the adaptive sampling factor according to the minimum difference frequency point and the number of sampling points includes:
[0079] Step S201: Multiply the minimum difference frequency point by the number of sampling points to obtain a first product.
[0080] In this embodiment, the number of sampling points is data obtained by user-defined. For example, in the Fourier transform in the prior art, the number of sampling points is required to be a power of 2, while for the number of sampling points in this embodiment, the user can define the size.
[0081] Step S202: Divide the original sampling rate by the first product to obtain a first quotient value.
[0082] In this embodiment, the original sampling rate is data obtained by user-defined. For example, the original sampling rate can be a sampling rate within the range of 44.1 kHz - 96 kHz. Specifically, the original sampling rate can be 44.1 kHz.
[0083] The sampling rate is a basic attribute of a signal. Common sampling rates include 44.1 kHz. The original sampling rate refers to how many signal samples the computer originally collects per second.
[0084] Step S203: Round up the first quotient value, and use the rounded result as the adaptive sampling factor.
[0085] In this embodiment, the first quotient value is rounded up. Specifically, for example, if the first quotient value is 24.3, after rounding up, the first quotient value is 25.
[0086] Exemplarily, the formula for calculating the adaptive sampling factor is specifically:
[0087]
[0088] wherein, the padding is the adaptive sampling factor, the ceil is rounding up, is the original sampling rate, is the minimum difference frequency point, and N is the number of sampling points.
[0089] According to the adaptive sampling factor, the sampling distance at various sampling rates can be adapted. These various sampling rates can include the original sampling rate, so as to resample the signal; the number of sampling points is customized according to requirements, which can reduce the computational amount of the processor for calculating the display frequency, achieving the purpose of reducing the energy consumption of the processor for calculating the display frequency.
[0090] Step S3, resample the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time-domain signal.
[0091] In this embodiment, the maximum sampling rate of the Fourier transform input signal is deduced by the inverse Fourier transform formula, and the sampling distance between the original sampling rate and the maximum sampling rate is calculated by the adaptive sampling factor. The inverse deduction process is specifically: the maximum sampling rate of the Fourier transform input signal is deduced according to the following conversion formula between the Fourier transform output value and the display frequency:
[0092] Conversion formula between the Fourier transform output value and the display frequency: Fn=(n - 1)*Fs / N, where Fn represents the signal frequency, Fs represents the sampling frequency, N represents the number of sampling points, and in the Fourier transform, the range of n is from 1 to N.
[0093] For example, multiple display frequencies of 30, 50, 100, and 200 are obtained. It can be known that the minimum display frequency is 30. Let N be 1024. According to the maximum sampling rate = minimum display frequency * number of sampling points, at this time, the maximum sampling rate of the Fourier transform input signal is 30 * 1024. Since the maximum sampling rate and the original sampling rate are not the same, the adaptive sampling factor is required to calculate the sampling distance between the original sampling rate and the maximum sampling rate, obtain the original time-domain signal, and perform resampling. Specifically, the computer program obtains the data of the adaptive sampling factor, the maximum sampling rate, and the original sampling rate, and calculates the sampling distance.
[0094] The bit depth refers to the number of bits occupied by each sampling point in the display frequency. For example, the bit depth of CD audio quality is 16 bits, which means each sampling point occupies 16 bits.
[0095] See Figure 4 , step S3 includes: resampling the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time-domain signal.
[0096] Step S301, divide the bit depth by a first preset value to obtain a second quotient value.
[0097] In this embodiment, the bit depth is data obtained by user definition. For example, the bit depth can be 18, and the first preset value is a user-defined value. For example, the first preset value can be 8.
[0098] Step S302, subtract a second preset value from the signal amount of the resampled signal to obtain a first difference.
[0099] In this embodiment, the signal amount of the resampled signal is data obtained by user definition. For example, the signal amount of the resampled signal can be within the range of 1 - N, and the second preset value is a user-defined value. For example, the second preset value can be 1.
[0100] Step S303, multiply the second quotient value by the first difference to obtain a second product.
[0101] Step S304, multiply the second product by the adaptive sampling factor to obtain a third product.
[0102] Step S305, add a third preset value to the third product to obtain a first sum value.
[0103] In this embodiment, the third preset value is a user-defined value. For example, the third preset value can be 2.
[0104] Step S306, multiply the first sum value by the first original time-domain signal array to obtain a first corrected signal array.
[0105] In this embodiment, the first original time-domain signal array refers to , the first corrected signal array refers to the product of the first original time-domain signal array and the first sum value.
[0106] Step S307, perform binary conversion on the first corrected signal array to obtain a first binary number.
[0107] In this embodiment, for example, the first correction signal array is buffer[1, 2, 3, 4], where buffer[2] with the serial number 2 is 3. The low 8 bits are reserved after converting 3 into binary. Using the conversion method from decimal to binary: the method of "dividing by 2 and taking the remainders, arranging in reverse order", the binary of 3 is 00000011.
[0108] Step S308, add the fourth preset value to the third product to obtain a second sum value.
[0109] In this embodiment, the fourth preset value is a custom value. For example, the fourth preset value can be 3.
[0110] Step S309, multiply the second sum value by the second original time-domain signal array to obtain a second correction signal array;
[0111] In this embodiment, the second original time-domain signal array refers to , and the second correction signal array refers to the product of the second original time-domain signal array and the second sum value.
[0112] Step S310, perform binary conversion on the second correction signal array to obtain a second binary number;
[0113] In this embodiment, for example, the second correction signal array is buffer[1, 2, 3, 4], where buffer[2] with the serial number 3 is 4. The low 8 bits are reserved after converting 4 into binary. Using the conversion method from decimal to binary: the method of "dividing by 2 and taking the remainders, arranging in reverse order", the binary of 4 is 00000100.
[0114] Step S311, splice the first binary number and the second binary number to obtain a third binary number.
[0115] In this embodiment, splicing the above 00000011 and 00000100 to obtain 0000001100000100. Left
[0116] Step S312, convert the third binary number into decimal to obtain the resampled time-domain signal.
[0117] In this embodiment, for 0000001100000100 from right to left, multiply by 2 to the power of n - 1 in turn and then add them, where n is the position number of the digit from right to left. Specifically, 0 * 2 1-1 + 0 * 2 2-1 + 1 * 2 3-1 + … + 1 * 2 9-1 + 1 * 2 10-1=772, it can be seen that the decimal value of 0000001100000100 is 772.
[0118] Exemplarily, the formula for calculating the resampled time-domain signal is specifically:
[0119]
[0120] Wherein, the is the resampled time-domain signal, the is the bit depth, n is the amount of the resampled signal, is the adaptive sampling factor, the is the binary conversion, the is the original time-domain signal, and "<<8" in the above formula represents a bit operation on the , shifting 8 bits to the left; shifting the calculation result of the 8 bits to the left to the front of the calculation result of , so as to splice the calculation result of the with to obtain the third binary number, and converting the third binary number to decimal to obtain the resampled time-domain signal.
[0121] Step S4, perform conversion according to the resampled time-domain signal to obtain a frequency-domain signal.
[0122] In this embodiment, by inputting the resampled time-domain signal into the Fourier transform formula, the frequency-domain signal is obtained.
[0123] See Figure 5 , step S401, perform conversion according to the resampled time-domain signal to obtain a frequency-domain signal.
[0124] In this embodiment, perform indefinite integral operation on the resampled time-domain signal to obtain the frequency-domain signal.
[0125] Exemplarily, the specific calculation formula of the frequency-domain signal is:
[0126]
[0127] Wherein, the is the frequency-domain signal, the is the resampled time-domain signal, and the is the formula summarized according to the Fourier transform.
[0128] Step S5, calculate the amplitudes corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points.
[0129] In this embodiment, each display frequency has a corresponding amplitude, and the corresponding amplitude can be obtained by calculating through the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points.
[0130] See Figure 6 , and calculate the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points. It includes:
[0131] Step S501: Divide the fourth product by the original sampling rate to obtain a third quotient value.
[0132] In this embodiment, the original sampling rate can be 44.1 kHz.
[0133] Step S502: Multiply the third quotient value by the frequency domain signal to obtain a corrected frequency domain signal.
[0134] In this embodiment, after multiplying the third quotient value by the frequency domain signal, the obtained is the value of n in the original frequency domain signal y n in.
[0135] Step S503: Add a fifth preset value to the corrected frequency domain signal to obtain a third sum value.
[0136] In this embodiment, the fifth preset value is a custom value. For example, the fifth preset value can be 1.
[0137] Step S504: Perform polar coordinate operation on the corrected frequency domain signal to obtain the amplitude corresponding to each display frequency.
[0138] In this embodiment, the radial coordinate in the polar coordinate operation is the amplitude, and the polar angle is the display frequency. The computer program displays the corresponding amplitude through the polar coordinates of the display frequency and the amplitude.
[0139] To calculate the amplitude corresponding to each display frequency, exemplarily, the specific calculation formula is:
[0140]
[0141] Among them, the is the display frequency, the is the amplitude corresponding to the display frequency, the display frequency , i = {1, 2, 3…i}, the amplitude , i = {1, 2, 3…i}, the N is the number of sampling points, the padding is the adaptive sampling factor, the is the original sampling rate, 1 in the above formula is the fifth preset value, y in the above formula is the frequency domain signal, and abs is the polar coordinate operation. The amplitude corresponding to the display frequency can be calculated through the frequency domain signal, the adaptive sampling factor, and the number of sampling points. Since the number of sampling points is defined by the user; according to the original Fourier transform, the number of sampling points should be greater than twice the display frequency. Specifically, the original sampling rate is 44.1 kHz. To ensure that the amplitudes of the display frequencies 10 and 20 do not overlap, using the Fourier transform formula: the original sampling rate divided by the display amplitude equals the number of sampling points, that is, 44.1 kHz divided by 10 = 4410. That is, at least the number of sampling points to the 13th power of 2 is required. In this application, the number of sampling points, when meeting the requirement that it must be a power of 2 in the Fourier transform, is set to 1024 and can also meet the demand. This solution reduces the computational amount of calculating the amplitude corresponding to the display frequency.
[0142] The spectrum processing method provided in this embodiment determines multiple frequencies to be displayed, obtains the minimum difference frequency point according to two adjacent frequencies, determines the adaptive sampling factor according to the minimum difference frequency point and the number of sampling points, resamples the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain the resampled time-domain signal, and performs conversion on the resampled time-domain signal to obtain the frequency domain signal; calculates the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points. When meeting the requirement that it must be a power of 2 in the Fourier transform, the user can customize the number of sampling points, which is equivalent to reducing the number of sampling points, thereby reducing the number of frequency points that the processor needs to calculate. The adaptive sampling factor is obtained through the minimum difference frequency point and the number of sampling points, and it can adapt to various sampling rates to calculate the amplitude corresponding to the frequency, so that these amplitudes do not overlap, improving the accuracy of the processor in processing the amplitude corresponding to each display frequency that needs to be calculated.
[0143] Embodiment 2
[0144] In addition, an embodiment of the present application provides a spectrum processing device, which is applied to a computer device.
[0145] As Figure 7 shown, the spectrum processing device 700 includes:
[0146] A frequency point module 701, configured to determine multiple display frequencies, and obtain the minimum difference frequency point according to multiple adjacent two display frequencies;
[0147] An adaptive module 702, configured to determine the adaptive sampling factor according to the minimum difference frequency point and the number of sampling points;
[0148] A resampling module 703, configured to perform the resampling on the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain the resampled time-domain signal;
[0149] A frequency-domain module 704, configured to perform a conversion according to the resampled time-domain signal to obtain the frequency-domain signal;
[0150] A calculation module 705, configured to calculate the amplitudes corresponding to the respective display frequencies according to the adaptive sampling factor, the original sampling rate, the respective display frequencies, and the number of sampling points.
[0151] Optionally, the frequency point module is further configured to calculate difference frequency points between adjacent two of the multiple display frequencies; and determine the minimum difference frequency point from the multiple difference frequency points.
[0152] Optionally, the adaptive module is further configured to multiply the minimum difference frequency point by the number of sampling points to obtain a first product; divide the original sampling rate by the first product to obtain a first quotient value; round up the first quotient value, and use the rounded-up result as the adaptive sampling factor.
[0153] Optionally, the resampling module is further configured to divide the bit depth by a first preset value to obtain a second quotient value; subtract a second preset value from the signal amount of the resampled signal to obtain a first difference; multiply the second quotient value by the first difference to obtain a second product; multiply the second product by the adaptive sampling factor to obtain a third product; add a third preset value to the third product to obtain a first sum value; multiply the first sum value by a first original time-domain signal array to obtain a first corrected signal array; perform binary conversion on the first corrected signal array to obtain a first binary number; add a fourth preset value to the third product to obtain a second sum value; multiply the second sum value by a second original time-domain signal array to obtain a second corrected signal array; perform binary conversion on the second corrected signal array to obtain a second binary number; splice the first binary number and the second binary number to obtain a third binary number; convert the third binary number to a decimal number to obtain the resampled time-domain signal.
[0154] Optionally, the frequency-domain module is further configured to perform an indefinite integral operation on the resampled time-domain signal to obtain the frequency-domain signal.
[0155] Optionally, the calculation module is further configured to multiply each display frequency, the number of sampling points, and the adaptive sampling factor to obtain a fourth product; divide the fourth product by the original sampling rate to obtain a third quotient; multiply the third quotient by the frequency domain signal to obtain a corrected frequency domain signal; add a fifth preset value to the corrected frequency domain signal to obtain a third sum; perform polar coordinate operation on the corrected frequency domain signal to obtain the amplitude corresponding to each display frequency.
[0156] The spectrum processing apparatus 700 provided in this embodiment can implement the spectrum processing method provided in Embodiment 1. To avoid repetition, details are not described herein again.
[0157] The spectrum processing apparatus provided in this embodiment determines multiple frequencies to be displayed, obtains the minimum difference frequency point according to two adjacent frequencies, determines the adaptive sampling factor according to the minimum difference frequency point and the number of sampling points, resamples the original time domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time domain signal, and performs conversion on the resampled time domain signal to obtain a frequency domain signal; calculates the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points. When meeting the requirement that the number must be a power of 2 in the Fourier transform, the user can customize the number of sampling points, which is equivalent to reducing the number of sampling points, thereby reducing the number of frequency points that the processor needs to calculate. The adaptive sampling factor is obtained through the minimum difference frequency point and the number of sampling points, and can adapt to various sampling rates to calculate the amplitude corresponding to the frequency, so that these amplitudes do not overlap, improving the accuracy of the processor in processing the amplitude corresponding to each display frequency to be calculated. At the same time, by the user's customizing the number of sampling points, the problem of excessive energy consumption caused by the processor's calculation of a large number of frequency points is solved.
[0158] Embodiment 3
[0159] In addition, an embodiment of the present application provides a computer device, including a memory and a processor. The memory stores a computer program, and when the computer program runs on the processor, it executes the spectrum processing method provided in Embodiment 1.
[0160] Specifically, referring to Figure 8 , the computer device 800 includes a transceiver 801, a bus interface, and a processor 802. The processor 802 is configured to: determine multiple display frequencies, and obtain the minimum difference frequency point according to the multiple display frequencies; determine the adaptive sampling factor according to the minimum difference frequency point and the number of sampling points; resample the original time domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time domain signal; perform conversion on the resampled time domain signal to obtain a frequency domain signal; calculate the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points.
[0161] In one embodiment, the processor 802 is further configured to: calculate the difference frequency points between two adjacent display frequencies among the multiple display frequencies; determine the minimum difference frequency point from the multiple difference frequency points.
[0162] In one embodiment, the processor 802 is further configured to: multiply the minimum difference frequency point by the number of sampling points to obtain a first product; divide the original sampling rate by the first product to obtain a first quotient; round up the first quotient, and use the rounded result as the adaptive sampling factor.
[0163] In one embodiment, the processor 802 is further configured to: divide the bit depth by a first preset value to obtain a second quotient; subtract a second preset value from the signal amount of the resampled signal to obtain a first difference; multiply the second quotient by the first difference to obtain a second product; multiply the second product by the adaptive sampling factor to obtain a third product; add a third preset value to the third product to obtain a first sum; multiply the first sum by the first original time-domain signal array to obtain a first corrected signal array; perform binary conversion on the first corrected signal array to obtain a first binary number; add a fourth preset value to the third product to obtain a second sum; multiply the second sum by the second original time-domain signal array to obtain a second corrected signal array; perform binary conversion on the second corrected signal array to obtain a second binary number; splice the first binary number and the second binary number to obtain a third binary number; convert the third binary number to decimal to obtain the resampled time-domain signal.
[0164] In one embodiment, the processor 802 is further configured to: perform an indefinite integral operation on the resampled time-domain signal to obtain the frequency-domain signal.
[0165] In one embodiment, the processor 802 is further configured to: multiply each display frequency, the number of sampling points, and the adaptive sampling factor to obtain a fourth product; divide the fourth product by the original sampling rate to obtain a third quotient; multiply the third quotient by the frequency-domain signal to obtain a corrected frequency-domain signal; add a fifth preset value to the corrected frequency-domain signal to obtain a third sum; perform polar coordinate operation on the corrected frequency-domain signal to obtain the amplitude corresponding to each display frequency.
[0166] In the embodiment of the present application, the computer device 800 further includes: a memory 803. In Figure 8Among them, the bus architecture may include any number of interconnected buses and bridges, specifically, various circuits of one or more processors represented by processor 802 and memory represented by memory 803 are linked together. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art, and thus will not be further described herein. The bus interface provides an interface. The transceiver 801 may be multiple components, that is, including a transmitter and a receiver, and provides a unit for communicating with various other devices on the transmission medium. The processor 802 is responsible for managing the bus architecture and general processing, and the memory 803 may store data used by the processor 802 when performing operations.
[0167] The computer device 800 provided by the embodiment of the present application can execute the steps of the spectrum processing method provided in Embodiment 1 of the above method. To avoid repetition, it will not be elaborated herein.
[0168] The computer device provided in this embodiment determines multiple frequencies to be displayed, obtains the minimum difference frequency point according to two adjacent frequencies, determines the adaptive sampling factor according to the minimum difference frequency point and the number of sampling points, resamples the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain the resampled time-domain signal, and performs conversion according to the resampled time-domain signal to obtain the frequency-domain signal; calculates the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points. By satisfying the requirement that it must be a power of 2 in the Fourier transform, the user can customize the number of sampling points, which is equivalent to reducing the number of sampling points, thereby reducing the number of frequency points that the processor needs to calculate. The adaptive sampling factor is obtained through the minimum difference frequency point and the number of sampling points, and it can adapt to various sampling rates to calculate the amplitude corresponding to the frequency, so that these amplitudes do not overlap, improving the accuracy of the processor in processing the amplitudes corresponding to the display frequencies that need to be calculated. At the same time, by allowing the user to customize the number of sampling points, the problem of excessive energy consumption caused by the processor having to calculate a large number of frequency points is also solved.
[0169] Embodiment 4
[0170] The present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the spectrum processing method provided in Embodiment 1.
[0171] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM for short), a random access memory (RAM for short), a magnetic disk, or an optical disc, etc.
[0172] The computer-readable storage medium provided in this embodiment can implement the spectrum processing method provided in Embodiment 1. To avoid repetition, it will not be elaborated here.
[0173] It should be noted that in this article, the terms "including", "comprising" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or terminal including that element.
[0174] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described embodiment method can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. Based on this understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to enable a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0175] The embodiments of the present application have been described above with reference to the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all belong to the protection scope of the present application.
Claims
1. A spectrum processing method, characterized in that, The method includes: Determine a plurality of display frequencies, and obtain a minimum difference frequency point according to the plurality of display frequencies; Determine an adaptive sampling factor according to the minimum difference frequency point and the number of sampling points; Resample the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time-domain signal; Perform conversion according to the resampled time-domain signal to obtain a frequency-domain signal; Calculate the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points; The determining the adaptive sampling factor according to the minimum difference frequency point and the number of sampling points includes: Multiply the minimum difference frequency point by the number of sampling points to obtain a first product; Divide the original sampling rate by the first product to obtain a first quotient value; Round up the first quotient value, and use the rounded result as the adaptive sampling factor; The resampling the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time-domain signal includes: Divide the bit depth by a first preset value to obtain a second quotient value; Subtract a second preset value from the signal amount of the resampled signal to obtain a first difference; Multiply the second quotient value by the first difference to obtain a second product; Multiply the second product by the adaptive sampling factor to obtain a third product; Add a third preset value to the third product to obtain a first sum value; Multiply the first sum value by the first original time-domain signal array to obtain a first corrected signal array; Perform binary conversion on the first corrected signal array to obtain a first binary number; Add a fourth preset value to the third product to obtain a second sum value; Multiply the second sum value by the second original time-domain signal array to obtain a second corrected signal array; Perform binary conversion on the second corrected signal array to obtain a second binary number; Concatenate the first binary number and the second binary number to obtain a third binary number; Convert the third binary number to decimal to obtain the resampled time-domain signal; The calculating the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points includes: Multiply each display frequency, the number of sampling points, and the adaptive sampling factor to obtain a fourth product; Divide the fourth product by the original sampling rate to obtain a third quotient value; Multiply the third quotient value by the frequency-domain signal to obtain a corrected frequency-domain signal; Add a fifth preset value to the corrected frequency-domain signal to obtain a third sum value; Perform polar coordinate operation on the corrected frequency-domain signal to obtain the amplitude corresponding to each display frequency.
2. The spectrum processing method according to claim 1, wherein The obtaining the minimum difference frequency point according to the plurality of display frequencies includes: Calculate the difference frequency points between adjacent two of the plurality of display frequencies; Determine the minimum difference frequency point from the plurality of difference frequency points.
3. The spectrum processing method according to claim 1, characterized in that The performing conversion according to the resampled time-domain signal to obtain a frequency-domain signal includes: Perform indefinite integral operation on the resampled time-domain signal to obtain the frequency-domain signal.
4. A spectrum processing device, characterized in that, The device includes; A frequency point module, configured to determine a plurality of display frequencies, and obtain a minimum difference frequency point according to the plurality of display frequencies; An adaptive module, configured to determine an adaptive sampling factor according to the minimum difference frequency point and the number of sampling points; A resampling module, configured to resample the original time-domain signal according to the adaptive sampling factor and the bit depth to obtain a resampled time-domain signal; A frequency-domain module, configured to perform a conversion according to the resampled time-domain signal to obtain a frequency-domain signal; A calculation module, configured to calculate the amplitude corresponding to each display frequency according to the adaptive sampling factor, the original sampling rate, each display frequency, and the number of sampling points; The adaptive module is further configured to multiply the minimum difference frequency point by the number of sampling points to obtain a first product; divide the original sampling rate by the first product to obtain a first quotient; round up the first quotient, and use the rounded result as the adaptive sampling factor; The resampling module is further configured to divide the bit depth by a first preset value to obtain a second quotient; subtract a second preset value from the signal volume of the resampled signal to obtain a first difference; multiply the second quotient by the first difference to obtain a second product; Multiply the second product by the adaptive sampling factor to obtain a third product; add a third preset value to the third product to obtain a first sum; multiply the first sum by the first original time-domain signal array to obtain a first corrected signal array; perform binary conversion on the first corrected signal array to obtain a first binary number; add a fourth preset value to the third product to obtain a second sum; multiply the second sum by the second original time-domain signal array to obtain a second corrected signal array; perform binary conversion on the second corrected signal array to obtain a second binary number; splice the first binary number and the second binary number to obtain a third binary number; convert the third binary number to decimal to obtain the resampled time-domain signal; The calculation module is further configured to multiply each display frequency, the number of sampling points, and the adaptive sampling factor to obtain a fourth product; divide the fourth product by the original sampling rate to obtain a third quotient; multiply the third quotient by the frequency-domain signal to obtain a corrected frequency-domain signal; add a fifth preset value to the corrected frequency-domain signal to obtain a third sum; perform polar coordinate operation on the corrected frequency-domain signal to obtain the amplitude corresponding to each display frequency.
5. A computer device, characterized in that, It includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the spectrum processing method according to any one of claims 1-3 are implemented.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the spectrum processing method according to any one of claims 1-3 are implemented.
Citation Information
Patent Citations
Frequency calibration device and method for programmable oscillator
CN103677079A
Digital demodulating and measurement analysis method
CN105302935A