Movatterモバイル変換


[0]ホーム

URL:


CN106972840B - Sampling rate conversion method and device - Google Patents

Sampling rate conversion method and device
Download PDF

Info

Publication number
CN106972840B
CN106972840BCN201710113085.8ACN201710113085ACN106972840BCN 106972840 BCN106972840 BCN 106972840BCN 201710113085 ACN201710113085 ACN 201710113085ACN 106972840 BCN106972840 BCN 106972840B
Authority
CN
China
Prior art keywords
original
target
sampling
sequence
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710113085.8A
Other languages
Chinese (zh)
Other versions
CN106972840A (en
Inventor
王永添
宋民
赵亚峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Siglent Technologies Co Ltd
Original Assignee
Shenzhen Siglent Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Siglent Technologies Co LtdfiledCriticalShenzhen Siglent Technologies Co Ltd
Priority to CN201710113085.8ApriorityCriticalpatent/CN106972840B/en
Publication of CN106972840ApublicationCriticalpatent/CN106972840A/en
Application grantedgrantedCritical
Publication of CN106972840BpublicationCriticalpatent/CN106972840B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The application discloses a sampling rate conversion device, which comprises a signal reconstruction controller, a filter coefficient generator and a low-pass filter, wherein the signal reconstruction controller calculates the relative position information of each target sample point in a target sequence relative to the nearest original sample point on the time dimension of the original sequence according to the original sampling frequency and a target sampling frequency, then a phase accumulator is adopted to accumulate by taking a frequency control word as a stepping value, the overflow times of the phase accumulator in each accumulation process are counted, and the required participating original sample points are determined and selected according to the overflow times; the filter coefficient generator calculates the filter coefficient of each target sampling point in real time according to the relative position information of each target sampling point; and finally, carrying out low-pass filtering on the selected participating original sampling points by using a low-pass filter according to the filtering coefficient to obtain each target sampling point, so as to obtain a target sequence and realize sampling rate conversion. Correspondingly, the application also discloses a sampling rate conversion method.

Description

Sampling rate conversion method and device
Technical Field
The present application relates to the field of electronic devices, and in particular, to a sampling rate conversion method and apparatus.
Background
For software defined radio, wireless communication, test measurement and radar detection, a proportional sample rate conversion is usually required for the digital signal after the analog-to-digital conversion or before the digital-to-analog conversion, i.e. the corresponding sample rate of the digital signal is converted from one sample rate to another. Conventional small-scale sample rate conversion typically employs a conversion method as shown in fig. 1(a), where f is the sampling rate of the conversions1Firstly carrying out interpolation processing of L times, then carrying out low-pass filtering with cut-off frequency of min (pi/L, pi/M), and then carrying out extraction processing of M times on the data after the low-pass filtering to obtain the final sampling rate of fs2The target sequence of (a), (b), (c), (d). For large-scale sample rate conversion, conventional methods use interpolation or decimation filtering based on small-scale sample rate conversion, as shown in fig. 1(b), at up-conversionThen, on the basis of fig. 1(a), the data after the M-time extraction processing is further processed by CIC interpolation filtering, and then the final target sequence y (n) is obtained; the down-sampling rate is based on the principle shown in fig. 1(c), that is, on the basis of fig. 1(a), the original sequence x (n) is further processed by CIC decimation filtering before L times of interpolation processing.
In the prior art, a complex processing process of interpolation, filtering and extraction is needed when sampling rate conversion is carried out, wherein the range of small-scale sampling rate conversion is limited, only decimal between 0 and 2 can be supported, the decimal digit can only support limited digits, the precision is limited, and rational number sampling rate conversion of any multiple cannot be supported. For the conversion of a large-scale sampling rate, the prior art needs to combine with a CIC interpolation filter or a CIC decimation filter to realize the conversion, has a relatively fixed structure, cannot simultaneously support any multiple up-sampling and any multiple down-sampling, cannot be applied to the occasions where the sampling rate needs to be changed in real time, and in addition, when the interpolation multiple or the decimation multiple is large, more hardware resources are consumed in the implementation of the hardware of the CIC filter.
Disclosure of Invention
The application provides a sampling rate conversion method and a sampling rate conversion device, which can support rational number sampling rate conversion of any multiple, can simultaneously support up-sampling and down-sampling of any multiple during large-scale conversion, and have higher conversion range and precision.
According to a first aspect of the present application, there is provided a sample rate conversion method comprising:
acquiring an original sampling frequency and a target sampling frequency;
acquiring an original sequence, wherein the original sequence is a data sequence consisting of original sampling points obtained by adopting an original sampling frequency;
calculating relative position information, namely calculating the relative position information of each target sampling point in the target sequence relative to the nearest original sampling point in the original sequence on the time dimension of the original sequence according to the original sampling frequency and the target sampling frequency, wherein each target sampling point corresponds to one piece of relative position information;
selecting original sampling points, namely selecting the participating original sampling points required for calculating each target sampling point in an original sequence;
a filter coefficient generating step of calculating the filter coefficient of each target sampling point in real time according to the relative position information of each target sampling point;
and a filtering step, namely filtering the selected participating original sampling points according to the filtering coefficient and outputting target sampling points to obtain a target sequence.
In some embodiments, the number of participating original samples required for each target sample is the same as the number of filter coefficients, and the number of filter coefficients corresponding to each target sample is equal to the length of the filter.
In some embodiments, the relative position information calculating step includes:
every time the relative position information is calculated, the phase of the phase accumulator is accumulated once by taking a frequency control word as a stepping value to obtain a phase value of the phase accumulator, wherein the frequency control word is in direct proportion to the ratio of the original sampling frequency to the target sampling frequency;
calculating the relative position information using the following calculation formula:
Figure BDA0001234990090000021
in the formula, index represents relative position information, mod (a, b) represents a modulus value of a to b; round(s) means rounding s; f. ofs1Is the original sampling frequency; f. ofs2A target sampling frequency; l is an integer and satisfies L ≦ 2N(ii) a Acc is the phase value of the phase accumulator, and the initial value is zero; n is the number of phase accumulator bits.
In some embodiments, the original sampling point selecting step comprises:
counting the total overflow times Q of the phase accumulator in the accumulation process after the phase accumulator accumulates by using an overflow times counting device, wherein Q (n) is Q (n-1) + M, and M is the overflow times value of the phase accumulator during each accumulation;
and according to the total overflow times Q, selecting continuous original sampling points with the length equal to that of the filter from the original sequence as participating original sampling points, wherein the participating original sampling points use the original sampling points X (Q) as initial original sampling points.
In some embodiments, the filter coefficients are calculated by:
Figure BDA0001234990090000022
where P is the filter length.
In some embodiments, the filtering is performed using the following equation:
Figure BDA0001234990090000023
according to a second aspect of the present application, there is provided a sample rate conversion apparatus comprising:
the signal reconstruction controller acquires an original sampling frequency and a target sampling frequency; acquiring an original sequence, wherein the original sequence is a data sequence consisting of original sampling points obtained by adopting an original sampling frequency; calculating the relative position information of each target sampling point in the target sequence relative to the nearest original sampling point in the target sequence on the time dimension of the original sequence according to the original sampling frequency and the target sampling frequency; selecting the participating original sampling points required for calculating each target sampling point;
the filter coefficient generator is used for calculating the filter coefficient of each target sampling point according to the relative position information of each target sampling point;
and the low-pass filter is used for filtering the selected original sampling points according to the filtering coefficient and outputting target sampling points to obtain a target sequence.
In some embodiments, the signal reconstruction controller comprises:
the DDS phase accumulator accumulates by taking a frequency control word as a stepping value, and when the relative position calculator operates once, the phase accumulator accumulates once, wherein the frequency control word is in direct proportion to the ratio of the original sampling frequency to the target sampling frequency;
a relative position calculator for obtaining an original sampling frequency and a target sampling frequency; acquiring an original sequence, wherein the original sequence is a data sequence consisting of original sampling points obtained by adopting an original sampling frequency; calculating the relative position information of each target sampling point in the target sequence relative to the nearest original sampling point in the target sequence on the time dimension of the original sequence according to the original sampling frequency and the target sampling frequency;
an overflow number counting device, which counts the total overflow number Q of the phase accumulator in the accumulation process after the DDS phase accumulator accumulates for each time, wherein Q (n) is Q (n-1) + M, and M is the overflow number value of the phase accumulator during each accumulation;
and the original sampling point selector selects continuous P original sampling points in the original sequence as participating original sampling points according to the total overflow times Q, and the participating original sampling points use the original sampling points X (Q) as initial original sampling points.
According to a third aspect of the present application, there is provided another sample rate conversion apparatus comprising:
a memory for storing a program;
and a processor for implementing the above sample rate conversion method by executing the program stored in the memory.
According to a fourth aspect of the present application, there is provided a computer-readable storage medium comprising a program executable by a processor to implement the sample rate conversion method described above.
The beneficial effect of this application is: according to the method, the relative position information of each target sampling point in the target sequence relative to the nearest original sampling point is skillfully calculated on the time dimension of the original sequence according to the original sampling frequency and the target sampling frequency, the required filter coefficient when each target sampling point is obtained is directly calculated in real time according to the relative position information, the required participating original sampling point is selected from the original sequence according to the total overflow frequency counted when the relative position information is calculated, then the selected participating original sampling point is filtered according to the filter coefficient, the purpose of sampling rate conversion is achieved, and signal reconstruction is achieved.
Drawings
FIG. 1 is a prior art sample rate conversion schematic;
FIG. 2 is a flow chart of a sample rate conversion method provided herein;
fig. 3 is a block diagram of a sampling rate conversion apparatus according to the present application;
fig. 4 is a block diagram of a signal reconstruction controller provided in the present application;
FIG. 5 is a schematic diagram of the up-conversion of the sampling rate conversion device provided in the present application;
FIG. 6 is a schematic diagram of the down-sampling rate conversion of the sampling rate conversion apparatus provided in the present application;
FIG. 7 is a block diagram of another sample rate conversion device according to the present application;
FIG. 8 is a comparison graph of waveforms before and after sample rate conversion of an original sequence and a target sequence according to an example of the present disclosure;
FIG. 9 is a graph of an original sequence spectrum according to an example of the present application;
fig. 10 is a sample rate converted target sequence spectrum diagram according to an example of the present application.
Detailed Description
First, an explanation will be given of the inventive concept of the present application.
Because the sampling rate conversion proportion can be an integer, can also be any decimal, can be small-proportion sampling rate conversion, can also be large-proportion sampling rate conversion, can raise the sampling frequency, also can lower the sampling frequency, this application considers various circumstances, has solved the problem that prior art can not solve.
Firstly, the method considers signal reconstruction according to the relation of input and output signal frequencies before and after sampling rate conversion, original sample points needed by outputting various sample points are selected and obtained in an original sequence in a targeted mode, and intermediate sequences are reconstructed without large-proportion interpolation filtering, so that the signal reconstruction efficiency is higher, and the purpose is stronger.
Secondly, the method considers the relationship between the frequency of input and output signals before and after sampling rate conversion to obtain a filter coefficient, and low-pass filtering is carried out on the reconstructed participating original sampling points according to the filter coefficient, so that sampling rate conversion is realized, the filter coefficient is generated in real time in the sampling rate conversion process, conversion of any times of up-sampling rate and any times of down-sampling rate is supported, and the conversion proportion can be rational numbers with any size, including integers and decimal numbers.
The present application will be described in further detail below with reference to the accompanying drawings by way of specific embodiments.
The first embodiment is as follows:
referring to fig. 2, the present application provides a sample rate conversion method comprising the steps of:
obtaining an original sampling frequency fs1And a target sampling frequency fs2
Obtaining an original sequence x (n), wherein the original sequence x (n) adopts an original sampling frequency fs1Obtaining a data sequence consisting of original sampling points;
calculating relative position information based on the original sampling frequency fs1And a target sampling frequency fs2Calculating relative position information index (n) of each target sample point in the target sequence y (n) relative to the nearest original sample point in the original sequence x (n) in the time dimension of the original sequence x (n);
an original sampling point selection step, namely selecting the participating original sampling points required for calculating each target sampling point in an original sequence x (n);
the number of the participating original sampling points required by calculating each target sampling point is the same as the number of the filter coefficients;
a filter coefficient generation step of calculating a filter coefficient of each target sampling point according to the relative position information of each target sampling point;
the number of the filter coefficients corresponding to each target sampling point is determined according to the length P of the filter, and preferably, the number of the filter coefficients corresponding to each target sampling point is equal to the length P of the filter;
and a filtering step, namely filtering the selected original sampling points according to the filtering coefficient and outputting target sampling points to obtain a target sequence.
Specifically, the relative position information calculating step includes:
every time the relative position information is calculated, the phase of the phase accumulator is accumulated once by taking a frequency control word FTW as a stepping value under the control of a clock signal to obtain a phase value of the phase accumulator, wherein the frequency control word is in direct proportion to the ratio of the original sampling frequency to the target sampling frequency; assuming that the number of bits in the phase accumulator is N, the frequency f is based on the original sampling frequencys1And a target sampling frequency fs2The corresponding frequency control word can be calculated as
FTW=round(2N×fs1/fs2) (1-1)
Where round(s) represents rounding of s.
The relative position information is calculated by the following formula,
Figure BDA0001234990090000051
wherein the above formula is a rounding formula
Figure BDA0001234990090000052
The integer part of (1);
wherein L is an integer satisfying L.ltoreq.2NGenerally, take L2NThen the method is finished; acc is the phase value of the phase accumulator, whose initial value is zero, and the phase value of the phase accumulator is calculated as follows:
Acc(n)=mod(Acc(n-1)+FTW,2N) (1-3)
where mod (a, b) represents taking the modulus of a vs. b.
Then, the formula (1-2) is expanded, and the formula (1-2) is expressed as
Figure BDA0001234990090000053
It can be seen that the original sampling frequency f is useds1And target miningSample frequency fs2The relative position information index (n) of each target sample in the target sequence y (n) with respect to the nearest original sample in the target sequence x (n) can be calculated in the time dimension of the original sequence x (n).
Specifically, the original sampling point selecting step includes:
counting the total overflow times Q of the phase accumulator in the accumulation process after the phase accumulator accumulates by using an overflow times counting device, wherein Q (n) is Q (n-1) + M, and M is the overflow times value of the phase accumulator during each accumulation;
and according to the total overflow times Q, selecting continuous original sampling points with the length equal to that of the filter from the original sequence as participating original sampling points, wherein the participating original sampling points use the original sampling points X (Q) as initial original sampling points.
In the process of solving the target sample point, the original sample point closest to the target sample point when a certain target sample point is calculated can also be represented by x (q), the original sample point x (q) closest to the target sample point is initially x (1), in the phase accumulation process of the phase accumulator, the original sample point closest to the target sample point may change with the passage of time and gradually change into x (2), x (3) and … …, and the change phenomenon is called as an overflow phenomenon. When the original sample point nearest to the target sample point changes, the target sample point crosses one original sample point to be recorded as overflow once in the time dimension of the original sequence x (n), and M represents the overflow number value of the phase accumulator during each accumulation. For each accumulation of the phase accumulator, the total overflow number Q of the phase accumulator in the accumulation process needs to be calculated, where Q (n) is Q (n-1) + M. Adjusting and calculating a starting point of each original sample point required by each target sample point according to the total overflow times Q, selecting continuous P original sample points in the original sequence as the original sample points to participate according to the total overflow times Q, wherein the original sample points X (Q) are used as the initial original sample points of the original sample points to participate.
Therefore, the total overflow time Q is closely related to the relative position information index (n), if the phase accumulator overflows when accumulating, the Q value changes, and index (n) also changes correspondingly, and when calculating index (n), the number of the target sample points crossing the original sample points is the total overflow time. Therefore, it can be said that, according to the total overflow number Q, P consecutive original samples are selected as participating original samples in the original sequence, that is, the required participating original samples are determined according to the relative position information index (n).
According to the formula (1-2) and the nyquist sampling reconstruction formula, the following filter coefficients are obtained when a certain target sample point is calculated:
Figure BDA0001234990090000061
wherein, P is the length of the filter, and the value of P can be selected to be between 8 and 32 according to the concrete software and hardware environment during implementation, and L is less than or equal to 2NN is the number of bits of the phase accumulator, and the value of index ranges from 0 to (L-1).
And according to the calculated filter coefficient h (index, k), filtering the selected participating original sample points by adopting the following formula:
Figure BDA0001234990090000071
accordingly, with reference to fig. 3, the present application provides a sample rate conversion device comprising: asignal reconstruction controller 10, afilter coefficient generator 20 and alow pass filter 30.
Asignal reconstruction controller 10 for obtaining an original sampling frequency fs1And a target sampling frequency fs2Obtaining an original sequence x (n); according to the original sampling frequency fs1And a target sampling frequency fs2Calculating relative position information index (n) of each target sample point in the target sequence y (n) relative to the nearest original sample point in the original sequence x (n) in the time dimension of the original sequence x (n); the participating original sample points { x (Q), x (Q +1),.. -, x (Q + P-1) } required for calculating each target sample point are selected.
And thefilter coefficient generator 20 calculates the filter coefficient of each target sample point by using a formula (1-4) according to the relative position information index of each target sample point, wherein the filter coefficient is generated in real time, the adaptability of the filter coefficient is strong, the real-time performance of sampling rate conversion is good, and rational number resampling of any multiple can be supported.
And the low-pass filter 30 is used for filtering the selected original sample points by using a formula (1-5) according to the filtering coefficient h (index, k), and outputting each target sample point to obtain a target sequence y (n).
Wherein, thesignal reconstruction controller 10 further comprises: a DDS phase accumulator 11, arelative position calculator 12, anoverflow number counter 13 and a rawsample point selector 14.
The DDS phase accumulator 11 accumulates the frequency control word FTW as a step value, and the DDS phase accumulator 11 accumulates the frequency control word FTW once every time therelative position calculator 12 needs to calculate the relative position information index (n).
Therelative position calculator 12 acquires the original sampling frequency fs1And a target sampling frequency fs2According to the original sampling frequency fs1And a target sampling frequency fs2Calculating the relative position information index (n) of each target sample point in the target sequence y (n) relative to the nearest original sample point in the original sequence x (n) in the time dimension.
When the DDS phase accumulator 11 finishes accumulating once, the overflow number counter 13 counts the total overflow number Q of the phase accumulator in the accumulation process, and is used to adjust the initial original sample point participating in the original sample point, where Q (n) ═ Q (n-1) + M, and M is the overflow number value of the phase accumulator during each accumulation.
An originalsampling point selector 14 that acquires an original sequence x (n); according to the total overflow times Q, continuous P original sample points are selected from the original sequence as participation original sample points, wherein the participation original sample points use an original sample point X (Q) as an initial original sample point, and the participation original sample points can be expressed as { x (Q), x (Q +1),.. once.once.x (Q + P-1) }.
It should be noted that, according to the original sampling frequency and the target sampling frequency, the present application skillfully calculates the relative position information of each target sampling point in the target sequence relative to the original sampling point nearest to the target sampling point in the time dimension of the original sequence, according to the relative position information, directly calculating the filter coefficient required by obtaining each target sampling point in real time, and selecting the required participating original sampling points from the original sequence according to the total overflow times counted when calculating the relative position information, then filtering the selected participating original sampling points according to the filter coefficient to achieve the purpose of sampling rate conversion, realizing signal reconstruction, the signal reconstruction does not need to carry out large-scale interpolation between various sample points of the original sequence, the efficiency of sampling rate conversion is greatly improved, the real-time performance of the sampling rate conversion is good, and rational number resampling of any multiple can be supported.
The relative position information calculation process of up-sampling rate conversion and down-sampling rate conversion and the calculation process of the target sampling point position will be described in detail below to explain the operation principle of the signal reconstruction controller.
FIG. 5 is a schematic diagram of the up-conversion of the sampling rate conversion device provided in the present application, when fs1<fs2. In the figure, the black filled circles represent the original samples of the original sequence x (n) with a sampling period T1=1/fs1The phase difference between two adjacent original sampling points is 2 pi, and the number of interpolation points between two adjacent original sampling points is 2NNormalization of T1 to 2N(ii) a The solid five-pointed star represents each target sample point of the target sequence y (n) and the sampling period is T2=1/fs2. The relative position information is calculated repeatedly using equation (1-2) while the DDS phase accumulator 11 is cyclically accumulating.
When the DDS phase accumulator 11 accumulates once, therelative position calculator 12 determines the position of a target sample point, and the sampling rate conversion apparatus outputs a target sample point. Specifically, as shown in fig. 5, at point a, the DDS phase accumulator 11 has an initial value of zero for the phase value Acc, and according to the formula (1-2), index (1) is 0, and the first output point at this time is y (1); and then, the DDS phase accumulator 11 accumulates by taking the frequency control word FTW as a stepping value, the DDS phase accumulator 11 reaches B, C, D, E and other positions in sequence, and target sampling points are determined to be y (2), y (3), y (4) and y (5) … in sequence.
Assuming that P is 8, 8 participating original samples need to be selected from the original samples x (n), and Q is selected in fig. 5 because the original sample has an initial point x (1)InitialQ (1) 1. Then,
When y (1) is calculated, index (1) is 0, Q (1) is 1, and y (1) is overlapped with x (1);
when y (2) is calculated, the DDS phase accumulator 11 goes from point a to point B without overflow, the original sample point closest to y (2) is x (1), index (2) is FTW, Q (2) is Q (1) +0 is 1, the selected participating original sample point still uses the original sample point x (1) as the starting original sample point, the participating original sample points are { x (1), x (2),. }, x (8) }, according to the formula (1-5),
Figure BDA0001234990090000081
when y (3) is calculated, the DDS phase accumulator 11 goes from point B to point C without overflow, the original sample point closest to y (3) is x (1), index (3) is 2FTW, M is 0, Q (3) is Q (2) +0 is 1, the selected participating original sample point still uses original sample point x (1) as the starting original sample point, the participating original sample points are { x (1), x (2),.. once.,. x (8) }, according to the formula (1-5),
Figure BDA0001234990090000082
when y (4) is calculated, the DDS phase accumulator 11 overflows once from point C to point D, spans the original sample point x (2) in the time dimension, the original sample point closest to y (4) is changed from x (1) to x (2), and index (4) ═ 3FTW-2NThe number of spillover times M is 1, Q (4) is Q (3) +1 is 2, Q is increased by 1, the selected participating original sample point starts with the original sample point x (2), and thus the participating original sample point of y (4) is calculated as { x (2), x (3),.. the., x (9) }, according to the formula (1-5),
Figure BDA0001234990090000091
by analogy, all target samples can be respectively calculated, wherein two adjacent target samples are arranged at intervals of a period T2 in the time dimension, so that the positions of all target samples are determined, and a target sequence y (n) is obtained.
It should be noted that the initial value of Q may also be a negative value or zero, so as to change the initial point of the original sampling point, for example, if Q is-3, then 8 points, namely x (-3), x (-2), x (-1), x (0), and then. The initial value of Q is different, which affects the selection of the original sample point, and thus affects the time domain characteristic and the spectrum characteristic of the target sequence y (n) output after the sampling rate conversion. Preferably, the Q value is selected such that half of the participating original samples are before the target sample and the other half are after the target sample in the time dimension.
FIG. 6 is a schematic diagram of the sample rate conversion device for down-conversion of the sample rate provided by the present application, wherein fs1>fs2. In the figure, the black filled circles represent the original samples of the original sequence x (n) with a sampling period T1=1/fs1The phase difference between two adjacent original sampling points is 2 pi, and the number of interpolation points between two adjacent original sampling points is 2N(ii) a The solid five-pointed star represents each target sample point of the target sequence y (n) and the sampling period is T2=1/fs2. The relative position information is calculated repeatedly using equation (1-2) while the DDS phase accumulator 11 is cyclically accumulating.
For up-sampling rate conversion, as with up-sampling rate conversion, a target sample is determined for each accumulation by DDS phase accumulator 11, except that DDS phase accumulator 11 overflows at least once for each accumulation.
Specifically, as shown in fig. 6, at point a, the DDS phase accumulator 11 has an initial value of zero for the phase value Acc, and according to the formula (1-2), index (1) is 0, and the first output point at this time is y (1); and then, the DDS phase accumulator 11 accumulates by taking the frequency control word FTW as a stepping value, the DDS phase accumulator 11 reaches B, C and other positions in sequence, and then target sampling points y (2), y (3), … y (n) are determined in sequence.
Assuming that P is 8, 8 participating original samples need to be selected from the original samples x (n), and Q is selected in fig. 6 because the original sample has an initial point x (1)InitialQ (1) 1. Then it is determined that,
when y (1) is calculated, index (1) is 0, Q (1) is 1, and y (1) is overlapped with x (1);
when y (2) is calculated, the DDS phase accumulator 11 overflows once from point a to point B, spans the original sample point x (2) in the time dimension, the original sample point closest to y (2) is changed from x (1) to x (2), and index (2) ═ FTW-2NThe number of spillover times M is 1, Q (2) is Q (1) +1 is 2, Q is increased by 1, the selected participating original sample point starts with the original sample point x (2), and thus the participating original sample point of y (2) is calculated as { x (2), x (3),.. the., x (9) }, according to the formula (1-5),
Figure BDA0001234990090000101
when y (3) is calculated, the DDS phase accumulator 11 overflows once again from point B to point C, spans the original sample point x (3) in the time dimension, the original sample point closest to y (3) is changed from x (2) to x (3), and index (3) ═ 2FTW-2 × 2NThe number of spillover times M is 1, Q (3) is Q (2) +1 is 3, the Q value is increased by 1, the selected participating original sample point starts with the original sample point x (3), so that the participating original sample point of y (3) is calculated as { x (3), x (3),. ·, x (10) }, according to the formula (1-5),
Figure BDA0001234990090000102
by analogy, y (1) to y (n) can be calculated respectively, wherein adjacent target samples between y (1) to y (n) are arranged at intervals of a period T2 in the time dimension, and thus the positions of the target samples are determined.
Let x be the continuous-time signal corresponding to the original sequence x (n)r(t), the innovation of the invention is as follows: it is not necessary to reconstruct x first by the method of large-scale interpolation filtering as in the prior artr(t) then from xrAnd (t) extracting (sampling) to obtain a target sequence y (n). The invention is based on the idea of designing arelative position calculator 12 which, after given initial conditions, is based on fs1And fs2The relation between the original points sequentially calculates the original points of all the subsequent target sampling points which are closest to the current output point on the time axisThe relative position information of the sampling points further determines the participation original sampling points required by calculating the target sampling points according to the position information; meanwhile, based on the position information, thefilter coefficient generator 20 generates in real time the filter coefficient required for calculating the output point.
The present embodiment can be preferably implemented by using a hardware chip, such as an FPGA or a dedicated ASIC, and the present embodiment adopts a phase accumulation technique in Direct Digital Synthesis (DDS), directly synthesizes a target sampling frequency according to a target sequence and an original sampling frequency, and can preferably implement sampling rate conversion.
Example two:
referring to fig. 7, the sampling rate conversion method according to the first embodiment can also be implemented by using software, and the present application provides a sampling rate conversion apparatus, including:
amemory 40 for storing a program;
aprocessor 50 executing the program for: according to the original sampling frequency fs1And a target sampling frequency fs2Calculating the relative position information of each target sample point in the target sequence y (n) relative to the nearest original sample point in the original sequence x (n) on the time dimension of the original sequence x (n); selecting the participating original sampling points needed for calculating each target sampling point in the original sequence x (n); calculating a filter coefficient of each target sampling point according to the relative position information of each target sampling point; and filtering the selected original sampling points according to the filter coefficient, and outputting target sampling points to obtain a target sequence.
The number of the participating original sampling points required by calculating each target sampling point is the same as the number of the filter coefficients; the number of the filter coefficients corresponding to each target sample point is determined according to the length P of the filter, and preferably, the number of the filter coefficients corresponding to each target sample point is equal to the length P of the filter.
For computational convenience, normalizing the sample period T1 of the original sequence to 1, then a simplified version of equation (1-2) for calculating relative position can be obtained:
index'(n)=index'(n-1)+T2(1-6a)
Figure BDA0001234990090000111
where index' (n) represents absolute time-position information, index (n) represents relative time-position information,
Figure BDA0001234990090000112
the integer part of index '(n) is taken, and the initial value index' (1) is taken to be zero. The absolute time position index' (n) of the nth target sample is calculated by equation (1-6a), and then the relative time position index (n) of the target sample relative to the nearest original sample is calculated by equation (1-6 b). At this time, index (n) represents a relative time value, not a phase value, 0 ≦ index (n) < 1.
In another form, the absolute position information is divided into an integer part and a decimal part, i.e., index '(n) ═ M + M, then M ═ index (n), M denotes the decimal part of index' (n), and 0 ≦ M < 1.
In FIG. 5, let T be 0 for y (1)1Let f be 1s2/fs1When 2.5, then T20.4, then, obviously, y (2) corresponds to index' (2) T according to equation (1-6a)2Index' (3) ═ 2T corresponding to y (3) of 0.42Index' (4) ═ 3T corresponding to y (4) of 0.82=1.2.....
For y (2) and y (3),
Figure BDA0001234990090000113
and
Figure BDA0001234990090000114
are all equal to zero, and for y (4), this time there is
Figure BDA0001234990090000115
According to equations (1-6b), the relative time positions are obtained, respectively: index (1) ═ 0, index (1) ═ 0.4, index (1) ═ 0.8, index (1) ═ 0.2 … …
Further, when the participating original sampling points needed for calculating each target sampling point are selected from the original sequence x (n), selecting continuous original sampling points with the length equal to that of the filter as the participating original sampling points; in addition, since the value of M indicates the number of times that the value of index' (n) exceeds 1, the value of M is used to adjust the range of sampling of the participating original samples, and Q (n) ═ Q (n-1) + M, when the participating original samples needed for calculating each target sample are selected in the original sequence, the original samples x (Q) are used as the starting original samples.
For example, referring to fig. 5, assuming that P is 8, 8 participating original samples need to be selected from the original samples x (n), and Q is selected in fig. 5 because the original sample has an initial point x (1)InitialQ (1) 1. Then it is determined that,
when y (1) is calculated, M is 0, Q (1) is 1, the selected participating original sampling point takes an original sampling point x (1) as a starting original sampling point, and the participating original sampling points are { x (1), x (2) };
when y (2) is calculated, M is 0, Q (2) is Q (1) +0 is 1, the selected participating original sample point still uses the original sample point x (1) as a starting original sample point, and the participating original sample points are { x (1), x (2), }. ·...,., x (8) };
when y (3) is calculated, M is 0, Q (3) is Q (2) +0 is 1, the selected participating original sample point still uses the original sample point x (1) as a starting original sample point, and the participating original sample points are { x (1), x (2), }..., x (8) };
when y (4) is calculated, M is 1, Q (4) is Q (3) +1 is 2, the Q value is increased by 1, and the selected participating original sample point uses the original sample point x (2) as a starting original sample point, so that the participating original sample point of y (4) is calculated as { x (2), x (3),.. once.., x (9) };
by analogy, the participating original sampling points for calculating y (1) -y (n) can be obtained respectively.
Whether or not fs2>fs1Or fs2<fs1Using the equations (1-6a), (1-6b) and index' (n) ═ M + M, the relative position of each target sample point with respect to the nearest original sample point can be determined, and then using the following equations, the required filter coefficients can be calculated in real time:
Figure BDA0001234990090000121
after the filter coefficient is obtained, the selected participating original sampling points are filtered by using the following formula, and corresponding target sampling points are obtained through calculation:
Figure BDA0001234990090000122
here, m (n) represents the value of m corresponding to the nth output sample point, and m is more than or equal to 0 and less than 1; the initial value of Q may take a positive number, 0, or some negative value.
Finally, another example of a practical application of the sample rate conversion technique of the present invention is shown.
Suppose there is a baseband signal with a bandwidth of 3.84MHz and an initial sampling rate fs1At 15.36MHz, the sample rate of the baseband signal is now increased to f by the sample rate conversion technique of the present inventions237.5MHz, then the sample rate conversion factor is fs2/fs12.3242, it can be seen that the sampling rate conversion multiple is a decimal number and the decimal place is more, and it is more difficult to realize the sampling rate conversion by the conventional interpolation filtering and decimation method.
Sampling the sampling rate conversion technique of the present invention, the original sequence x (n) and the output sequence y (n) after sampling rate conversion are shown in fig. 8, wherein the small circles on the dotted line represent the sample points of the original sequence x (n), and the asterisk points on the solid line represent the sample points of the target sequence y (n) after sampling rate conversion.
Fig. 9 is a schematic diagram of a frequency spectrum corresponding to an original sequence x (n), and fig. 10 is a schematic diagram of a frequency spectrum of an output target sequence after sample rate conversion.
As can be seen from the comparison between fig. 9 and fig. 10, the spectral quality of the output signal is very good by using the sampling rate conversion technique proposed by the present invention, that is, the image rejection is very ideal, and the signal bandwidth can be completely kept consistent.
In summary, whether up-conversion or down-conversion, four steps are required to calculate each target sample point of the output sequence y (n):
1. according to the sampling frequency fs1And a target sampling frequency fs2Calculating y (n) time position information index corresponding to each target sampling point according to the relation between the target sampling points; wherein, the calculation of index can use formula (1-2) or formula (1-6a) and (1-6b), wherein formula (1-2) is more suitable for being implemented in hardware such as programmable logic device; the equations (1-6a) and (1-6b) are more suitable for implementation in software;
2. generating in real time the filter coefficients required to calculate the output point based on the time-position information index, which can be calculated using formula (1-5) or formula (1-7); in addition, according to specific application occasions, windowing can be performed on the filter coefficients so as to improve the signal-to-noise ratio of the output sequence after sampling rate conversion;
3. selecting original sampling points with the same number as the filter coefficients according to the total overflow times Q obtained by the statistics of the overflow times counter;
4. and (3) filtering the original sampling points selected in the step (3) by using the filter coefficients generated in the step (2) to obtain corresponding target sampling points.
Those skilled in the art will appreciate that all or part of the steps of the various methods in the above embodiments may be implemented by instructions associated with hardware via a program, which may be stored in a computer-readable storage medium, and the storage medium may include: read-only memory, random access memory, magnetic or optical disk, and the like. For example, the above steps can be implemented by storing a program in a memory of the device and executing the program in the memory by the processor when sample rate conversion is required. Especially, in the practical implementation process of the present invention, all or part of the above steps may be written as an independent program, and the program may be stored in a server, a magnetic disk, an optical disk, or a flash disk, and may be downloaded and stored in the memory of the local device, or may be downloaded to update the version of the system of the local device, and the processor may execute the program in the memory to implement all or part of the functions of the above steps.
The foregoing is a more detailed description of the present application in connection with specific embodiments thereof, and it is not intended that the present application be limited to the specific embodiments thereof. It will be apparent to those skilled in the art from this disclosure that many more simple derivations or substitutions can be made without departing from the inventive concepts herein.

Claims (10)

1. A method of sample rate conversion, comprising:
acquiring an original sampling frequency and a target sampling frequency;
acquiring an original sequence, wherein the original sequence is a data sequence consisting of original sampling points obtained by adopting an original sampling frequency;
calculating relative position information, namely calculating the relative position information of each target sampling point in the target sequence relative to the nearest original sampling point in the original sequence on the time dimension of the original sequence according to the original sampling frequency and the target sampling frequency, wherein each target sampling point corresponds to one piece of relative position information;
selecting original sampling points, namely selecting continuous original sampling points with the same number as the length of the filter from an original sequence as participating original sampling points;
a filter coefficient generating step of calculating the filter coefficient of each target sampling point in real time according to the relative position information of each target sampling point;
and a filtering step, namely filtering the selected participating original sampling points according to the filtering coefficient and outputting target sampling points to obtain a target sequence.
2. The method of claim 1, wherein the number of participating original samples required for each target sample is the same as the number of filter coefficients, and the number of filter coefficients corresponding to each target sample is equal to the length of the filter.
3. The method of claim 1, wherein the relative position information calculating step comprises:
every time the relative position information is calculated, the phase of the phase accumulator is accumulated once by taking a frequency control word as a stepping value to obtain a phase value of the phase accumulator, wherein the frequency control word is in direct proportion to the ratio of the original sampling frequency to the target sampling frequency;
calculating the relative position information using the following calculation formula:
Figure FDA0002402485850000011
in the formula, index represents relative position information, mod (a, b) represents a modulus value of a to b; round(s) means rounding s; f. ofs1Is the original sampling frequency; f. ofs2A target sampling frequency; l is an integer and satisfies L ≦ 2N(ii) a Acc is the phase value of the phase accumulator, and the initial value is zero; n is the number of phase accumulator bits.
4. The method of claim 3, wherein the original sample point selecting step comprises:
counting the total overflow times Q of the phase accumulator in the accumulation process after the phase accumulator accumulates by using an overflow times counting device, wherein Q (n) is Q (n-1) + M, and M is the overflow times value of the phase accumulator during each accumulation;
and according to the total overflow times Q, selecting continuous original sampling points with the length equal to that of the filter from the original sequence as participating original sampling points, wherein the participating original sampling points use the original sampling points X (Q) as initial original sampling points.
5. The method according to any one of claims 2 to 4, wherein the filter coefficients are calculated by the formula:
Figure FDA0002402485850000021
where P is the filter length and index represents the relative position information.
6. The method of claim 5, wherein the filtering is performed using the following equation:
Figure FDA0002402485850000022
7. a sample rate conversion device, comprising:
the signal reconstruction controller acquires an original sampling frequency and a target sampling frequency; acquiring an original sequence, wherein the original sequence is a data sequence consisting of original sampling points obtained by adopting an original sampling frequency; calculating the relative position information of each target sampling point in the target sequence relative to the nearest original sampling point in the target sequence on the time dimension of the original sequence according to the original sampling frequency and the target sampling frequency; selecting continuous original sampling points with the same number as the length of the filter from the original sequence as participating original sampling points;
the filter coefficient generator is used for calculating the filter coefficient of each target sampling point according to the relative position information of each target sampling point;
and the low-pass filter is used for filtering the selected original sampling points according to the filtering coefficient and outputting target sampling points to obtain a target sequence.
8. The apparatus of claim 7, wherein the signal reconstruction controller comprises:
the DDS phase accumulator accumulates by taking a frequency control word as a stepping value, and when the relative position calculator operates once, the phase accumulator accumulates once, wherein the frequency control word is in direct proportion to the ratio of the original sampling frequency to the target sampling frequency;
a relative position calculator for obtaining an original sampling frequency and a target sampling frequency; acquiring an original sequence, wherein the original sequence is a data sequence consisting of original sampling points obtained by adopting an original sampling frequency; calculating the relative position information of each target sampling point in the target sequence relative to the nearest original sampling point in the target sequence on the time dimension of the original sequence according to the original sampling frequency and the target sampling frequency;
an overflow number counting device, which counts the total overflow number Q of the phase accumulator in the accumulation process after the DDS phase accumulator accumulates for each time, wherein Q (n) is Q (n-1) + M, and M is the overflow number value of the phase accumulator during each accumulation;
and the original sampling point selector selects continuous P original sampling points in the original sequence as participating original sampling points according to the total overflow times Q, and the participating original sampling points use the original sampling points X (Q) as initial original sampling points.
9. A sample rate conversion device, comprising:
a memory for storing a program;
a processor for implementing the method of any one of claims 1-6 by executing a program stored by the memory.
10. A computer-readable storage medium, characterized by comprising a program executable by a processor to implement the method of any one of claims 1-6.
CN201710113085.8A2017-02-282017-02-28Sampling rate conversion method and deviceActiveCN106972840B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201710113085.8ACN106972840B (en)2017-02-282017-02-28Sampling rate conversion method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201710113085.8ACN106972840B (en)2017-02-282017-02-28Sampling rate conversion method and device

Publications (2)

Publication NumberPublication Date
CN106972840A CN106972840A (en)2017-07-21
CN106972840Btrue CN106972840B (en)2020-05-05

Family

ID=59328499

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201710113085.8AActiveCN106972840B (en)2017-02-282017-02-28Sampling rate conversion method and device

Country Status (1)

CountryLink
CN (1)CN106972840B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110708070A (en)*2019-08-152020-01-17北京航天驭星科技有限公司Resampling method and device
CN112290907B (en)*2020-09-182022-07-01天津理工大学中环信息学院 Analog filtering method and device based on embedded system
CN115083427B (en)*2022-06-092023-06-16珠海海奇半导体有限公司 An audio resampling method, audio processing equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1126320C (en)*1997-02-262003-10-29艾利森公司 sample rate converter
JP2009141445A (en)*2007-12-042009-06-25Hitachi Ltd Sampling rate conversion device and sampling rate conversion method
CN103188186A (en)*2011-12-272013-07-03安立股份有限公司Resampling processing device and method and digital modulation signal producing device
CN104202016A (en)*2014-08-292014-12-10哈尔滨工业大学Any times variable signal up-sampling implementation method and system based on look-up table method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
KR20160033916A (en)*2014-09-192016-03-29한국전자통신연구원Sampling rate converter and method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1126320C (en)*1997-02-262003-10-29艾利森公司 sample rate converter
JP2009141445A (en)*2007-12-042009-06-25Hitachi Ltd Sampling rate conversion device and sampling rate conversion method
CN103188186A (en)*2011-12-272013-07-03安立股份有限公司Resampling processing device and method and digital modulation signal producing device
CN104202016A (en)*2014-08-292014-12-10哈尔滨工业大学Any times variable signal up-sampling implementation method and system based on look-up table method

Also Published As

Publication numberPublication date
CN106972840A (en)2017-07-21

Similar Documents

PublicationPublication DateTitle
CN106972832B (en)Digital down converter capable of resampling by any multiple
AU2013223996B2 (en)Low delay real-to-complex conversion in overlapping filter banks for partially complex processing
CN106972840B (en)Sampling rate conversion method and device
CN105991137A (en)Systems and methods of variable fractional rate digital resampling
CN105745706A (en)Device, method, and program for expanding frequency band
CN103346756A (en)Space-time self-adaptive filtering method and device
CN109655644B (en)Method and device for reducing random wave signal output jitter
RU2731251C2 (en)Method and device for sample rate conversion of fetch stream
JP4449007B2 (en) Sampling frequency converter
CN110753013B (en)Method and device for realizing USB telemetering signal down-sampling rate and electronic equipment
CN115587561A (en)Method and apparatus for signal resampling
US8949303B2 (en)Filter
CN110247642A (en)A kind of FIR filtering method and filter
CN106972833B (en)Digital up-converter capable of resampling by any multiple
CN107977043A (en)A kind of choosing method of variable fraction time sampling rate
JP5573901B2 (en) Sampling rate converter
WO2012122908A1 (en)Method and system for generating analogue radio frequency signal
JP2010130185A (en)Sampling rate conversion circuit
CN106301287A (en) A kind of resampling method and device
JP4249425B2 (en) Interpolator
CN110690909B (en)Low-complexity dynamic non-uniform channelized user separation method
US8781259B2 (en)Re-sampling method and apparatus
JP5573926B2 (en) Sampling rate converter
CN113872566B (en)Modulation filtering device and method with continuously adjustable bandwidth
EP1458097A1 (en)Arbitrary sampling rate conversion

Legal Events

DateCodeTitleDescription
PB01Publication
SE01Entry into force of request for substantive examination
CB02Change of applicant information

Address after:518000 Guangdong Province, Baoan District, Baoan District, Xin'an Street, Xingdong Community, 68 District, Antongda Industrial Factory Area, 4 factories, 3 floors, 5 office buildings, 1-3 floors

Applicant after:Shenzhen dingyang Technology Co., Ltd

Address before:Shenzhen City, Guangdong province Baoan District 518000 District 68 road left three Antongda Industrial Park, 4 floor

Applicant before:SHENZHEN CITY SIGLENT TECHNOLOGIES Co.,Ltd.

CB02Change of applicant information
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp