The apparatus and method of the sampling frequency conversion of digitized video
Technical field
The present invention relates to the digital image panntographic technology, especially a kind of apparatus and method of sampling frequency conversion of digitized video.
Background technology
With the benefit of image digitization is to be that digital image signal is beneficial to transmission, stores and this digitized video is further handled.Yet,, therefore often need carry out sampling frequency conversion (sample rateconversion) because the output format of digitized video may be different from digitized video form originally.For example, the digitized video of 800*600 pixel is converted to the digitized video of 1024*768 pixel.
Figure 1 shows that the schematic diagram of the sampling frequency conversion that utilizes interpolation method (interpolation) to handle digitized video.As shown in the drawing, the discrete signal of Fig. 1 (A) (for example digital image signal of one dimension) uses suitable interpolating function (Interpolating function) (for example shown in Fig. 1 (B), (E)) can correspondence to go out continuous signal as Fig. 1 (C), (F).Then, use new sampling frequency, can produce the discrete signal of new sampling frequency sampling of continuous signal.For a total digital image signal, can be after directions X be implemented the primary sample frequency inverted, implement one in the y direction again and blow the sampling frequency conversion and get final product.For example, desire converts the digitized video of 800*600 pixel to the digitized video of 1024*768 pixel, can implement the primary sample frequency inverted to directions X, obtain the digitized video of a 1024*600 pixel, and then this digitized video implemented the primary sample frequency inverted to the y direction, can obtain the digitized video of 1024*768 pixel.The simplest interpolating function can be the linear interpolation function, and other are advised function complicated functions such as (spline function) as song and also can.
But digitized video has two serious problems when using interpolation method to carry out the sampling frequency conversion.The firstth, the alias effect (alias effect) during contract drawing as shown in Figure 2 (scaling down), the secondth, the problem of image definition during amplification as shown in Figure 3 (scaling up).Fig. 2 (A) is the frequency spectrum of original digital signal, and its sampling frequency is fS.Change into the frequency spectrum of the continuous signal of Fig. 2 (B) via interpolating function, wherein, each frequency content in the frequency band does not have great change originally, otherwise continuous signal is with serious distortion.When using new sampling frequency fS ' than low frequency to resample, the radio-frequency component that surpasses 1/2 frequency of new sampling frequency will fold back low frequency part, thereby cause the alias composition, promptly as the oblique line part of Fig. 2 (C).This alias composition will have a strong impact on the digitized video quality.
In addition, in the digitized video of present required processing, except some is the image of real world (for example photo), also the image of some is the digitized video (image that for example mixes literal and figure) that application software is synthesized.Fig. 3 (A) promptly shows in the synthetic digitized video to have the discrete signal of knowing the border.Fig. 3 (B) is the continuous signal after Fig. 3 (A) changes through interpolating function, and Fig. 3 (C) is with the discrete signal after resampling than high sampling frequency.If interpolating function is undesirable, after the video conversion, it is fuzzyyer that the border often becomes.
Fig. 4 is the another kind of schematic diagram of handling the sampling frequency conversion.The method is used Digital Signal Processing, and (digital signal processing, prior art DSP) is implemented the sampling frequency conversion of one dimension digital signal.As mentioned above, for the digital image signal of two dimension, its sampling frequency conversion can be implemented the primary sample frequency inverted in the y direction again after directions X is implemented the primary sample frequency inverted.Therefore, below explanation, all the sampling frequency with the one dimension digital signal is converted to example.Digital signal processor shown in Figure 4 comprises a upconverter (expander) 41, a low pass filter (low pass ilter, LPF) 42 and one frequency demultiplier (decimator) 43.U shown in Figure 4
kThe sequence of expression input signal, the time sequencing (time index) of its subscript k representation signal, x
kThe output signal sequence of expression upconverter 41, y
kThe output signal sequence of expression
low pass filter 42, z
kThe sequence of expression frequency demultiplier 43 output signals.Wherein, upconverter 41 satisfies formula (1)
That is the output signal of upconverter 41, with input signal sequence u
kIn the middle of, between per two documents, insert M-1 0, to reach the purpose of M times of raising frequency.This output sequence x
k, handle the output z that obtains through low pass filter 42
k, satisfy formula (2)
H wherein
iImpulse response (impulse response) for low pass filter 42.Because x
iMajor part is zero, and formula (2) further abbreviation is formula (3), with the required operand of attenuating filter 42:
y
kM+1=h
l·u
k+h
l+M·u
k-1+h
l+2M·u
k-2+… (3)
Frequency demultiplier 43 satisfies formula (4):
z
k=y
kM (4)
That is the output signal of frequency demultiplier 43, with the burst y of input frequency demultiplier 43
k, get a document with every N document, obtain output signal sequence z
k, to reach the purpose of N times of frequency reducing.
The impulse response h of low pass filter 42
i, can use Z
-Conversion (Z
-Transform) be rewritten as multinomial H (z), the transfer function of its low pass filter 42
Impulse response with polynomial repressentation burst or system, there are following 2 points at its convenient place: one is the output signal sequence of system, must be with convolution (convolution) expression (for example formula (2)) of input signal sequence and its impulse response, if the input of system and output signal, and the impulse response of system, all with Z
-Conversion is rewritten as multinomial, then just (for example formula (2) can be rewritten as Y (z)=H (z) X (z) for the polynomial multiplication of input and system's transfer function in output, wherein X (z) and Y (z) are respectively input signal sequence and output signal sequence and change the multinomial of gained via Z-, and H (z) is the transfer function of low pass filter).When a plurality of systems serial connection, the polynomial repressentation method is more apparent convenient.Its two for the frequency response of system can directly be tried to achieve by the Z-conversion (transfer function is the system of H (z), and its frequency response is H (e
Jw)), therefore, use the Z-conversion, when the frequency response of analytical system, most convenient.
About Z
-The sampling frequency conversion of conversion, Design of Filter and fixed conversion multiplying power is the prior art (can consult Oppenheim, Schafer and Buck, " Discrete-Time Signal Processing ") of Digital Signal Processing.Therefore, if required conversion multiplying power is fixed,, can effectively lower the alias effect as long as the prior art of Applied Digital signal processing designs the transfer function H (z) of suitable low pass filter.And in order to strengthen image definition, can design several different transfer function H (z), have the frequency compensation of varying strength separately, and be selected according to required definition by the user.
When system handles sampling frequency conversion, its conversion multiplying power must be adjustable, and during a certain multiplying power of on-fixed, desire to continue to use aforesaid way, and it may way comprise two kinds: one is fixing raising frequency multiplying power M, transfer frequency reducing multiplying power N; It is two for transferring raising frequency multiplying power M, fixedly frequency reducing multiplying power N.Yet, when system needs large-scale frequency inverted (for example the convergent-divergent multiplying power from 25% to 200%), this two all can't contain all multiplying powers with fixing low pass filter.Generally speaking, produce the alias phenomenon for avoiding the output signal after the frequency reducing, the frequency band of the low pass filter institute filtering of previous stage need be adjusted according to frequency reducing multiplying power N.When Fig. 5 (A) and Fig. 5 (B) promptly were presented at two kinds of different frequency reducing multiplying power N, low pass filter was a frequency range of avoiding alias filtering that phenomenon is answered, and wherein Fig. 5 (A) is 3 situation for frequency reducing multiplying power N, and Fig. 5 (B) is 9 situation for frequency reducing multiplying power N.Learn by diagram, when N not simultaneously, required low pass filter is also different, so the impulse response that first method (fixedly raising frequency multiplying power M, transfer frequency reducing multiplying power N) can't fixed low-pass filters.If use second method (transferring raising frequency multiplying power M, fixedly frequency reducing multiplying power N), when image amplifies, because the sampling frequency height of defeated eight signals of the sampling frequency of output signal, so output signal has wideer frequency band.With Fig. 5 (C) is example, the central oblique line part that indicates, and the frequency band that has for output signal, but be not the existing frequency band of original image.Desire filtering oblique line part, or carry out appropriate signals at this frequency band and handle, the then frequency response of low pass filter is with relevant with parameter M.So locate also can't use fixing low pass filter.
With one can be example with digitized video system with 1% the free convergent-divergent of accuracy in 25% and 200% ratio, if each convergent-divergent multiplying power, all need one group of low pass filter, then this system must store 175 groups of low pass filter impulse responses, very expends memory.Rational way, the convergent-divergent multiplying power can be cut into several different range, six scopes such as 25% to 35%, 36% to 50%, 51% to 70%, 71% to 99%, 101% to 140% and 141% to 200% for example, each range fit suitable low pass filter impulse response.But if consider the necessary modulation of the sharpness of image output, each convergent-divergent multiplying power scope must provide five groups of low pass filter impulse responses, selects for the user, so still need store 30 groups of low pass filter impulse responses.
In addition, the convergent-divergent multiplying power is cut into several different range, though can reduce required low pass filter sum, all convergent-divergent multiplying powers all had the optimum filtering effect in the middle of the employed filter of each scope certainly will can't make this scope.For example, the low pass filter that designs at 42% multiplying power is 36% o'clock in multiplying power, and it is 36% low pass filter that designs that its effect must be not so good as at the rate of repairing.Be to be noted that: because the attenuation that stops frequency band (stopband) of low pass filter is limited, therefore the radio-frequency component through overdamping so can fold back low frequency, causes the alias effect herein.When the conversion multiplying power of image fixedly the time, can be at alias effect some Frequency Design bigger attenuation more serious to visual impact, these frequency contents of filtering as far as possible fully, all the other frequencies are then used general attenuation.Yet, when the conversion multiplying power of image not fixedly the time, can't expect in advance and stop in the middle of the frequency band, which frequency content will be because of the alias effect, be folded to the serious frequency location of visual impact,, must increase the exponent number of low pass filter for head it off, make the pad value of the everywhere that stops frequency band becoming lower, vision is exerted an influence to guarantee that the alias effect is unlikely.But this mode will further increase cost.
Summary of the invention
Because the problems referred to above, the purpose of this invention is to provide the demand that need not increase memory, can handle the apparatus and method that the sampling frequency of the digitized video of various convergent-divergent multiplying powers is changed.
Another object of the present invention is under the prerequisite of image-zooming variable power, proposes a kind of effective inhibition alias effect, guarantees the apparatus and method of sampling frequency conversion of the digitized video of video conversion quality.
For reaching above-mentioned purpose, the device of the sampling frequency of digitized video of the present invention conversion comprises: a upconverter receives a signal of video signal, and according to the image-zooming ratio with the frequency upgrading M of signal of video signal doubly, produces up-conversion signal; One low pass filter, the up-conversion signal of the upconverter of reception variable power, and output filtering signal behind the filtering high-frequency signal; And a frequency demultiplier, receive the trap signal of low pass filter, and the frequency of trap signal is reduced N doubly, produce output signal.
The device of the sampling frequency conversion of digitized video of the present invention, wherein low pass filter contains factor 1+z
-1+ ... + z
-(N-1)And factor 1+z
-1+ ... + z
-(M-1)
The method of the sampling frequency conversion of digitized video of the present invention, row and the row to image carry out the sampling frequency conversion respectively, and each sampling frequency conversion comprises the following step:
The raising frequency step promotes M doubly according to the image-zooming ratio with the sampling frequency of one dimension image data, produces up-conversion signal;
Signal filtrating step utilizes transfer function to comprise factor 1+z
-1+ ... + z
-(N-1)With the low pass filter of factor with aforementioned up-conversion signal filtering radio-frequency component after the output filtering signal; And
The frequency reducing step receives aforementioned trap signal, and sampling frequency is reduced N doubly, produces output signal;
Wherein aforementioned MA changes according to the image-zooming size, and aforementioned N value is for fixing.
Description of drawings
Figure 1 shows that the schematic diagram of the sampling frequency conversion that utilizes interpolation method to handle digitized video;
Alias effect when Figure 2 shows that contract drawing;
Figure 3 shows that image fog effect when amplifying;
Fig. 4 is the another kind of calcspar of implementing the sampling frequency conversion with digital signal processor;
When Fig. 5 promptly is presented at two kinds of different frequency reducing multiplying power N, the frequency range of filtering that low pass filter is answered, wherein Fig. 5 (A) is 3 situation for frequency reducing multiplying power N, and Fig. 5 (B) is 9 situation for frequency reducing multiplying power N;
Figure 6 shows that an Organization Chart of the sampling frequency conversion equipment of digitized video of the present invention;
Figure 7 shows that the another Organization Chart of the sampling frequency conversion equipment of digitized video of the present invention;
Figure 8 shows that another Organization Chart of the sampling frequency conversion equipment of digitized video of the present invention;
Fig. 9 shows that low pass filter comprises the frequency response situation of factor;
Figure 10 shows that low pass filter comprises the frequency response situation of factor;
Figure 11 is the flow chart of the sampling frequency conversion method of digitized video of the present invention.
Component parameters explanation among the figure:
60 sampling frequency conversion equipments
61 repeat M upconverter
62,65,71 low pass filters
63 fixing multiplying power frequency demultipliers
64 variable power upconverters
Embodiment
Figure 6 shows that the Organization Chart of the sampling frequency conversion equipment of digitized video of the present invention.As shown in the drawing, the sampling frequency conversion equipment 60 of digitized video of the present invention comprises M upconverter of repetition 61, a low pass filter 62, and the fixing multiplying power frequency demultiplier 63 of a variable power.Sampling frequency conversion equipment 60 of the present invention is to repeat the multiplying power M of M upconverter 61 according to the adjustment of image-zooming ratio, and the multiplying power N of frequency demultiplier 63 is fixed.Wherein, repeat M upconverter 61 with input signal U
kEvery bit repeats M time, to reach the raising frequency action.That is
x
KM+l=u
k, l=0 wherein ... M-1 (6)
Therefore, repeat the output signal x of M upconverter 61
k, can be considered digitized video is directly improved image analytic degree M doubly in sampling maintenance (Sample-and-Hold) mode.Visually, x
kWith former image U
kDo not have notable difference.x
kObtain low-pass filter signal y via low pass filter 62
k, obtain output signal z via fixing multiplying power frequency demultiplier 63 again
k, be equivalent to x
kBe fixed as the contract drawing of N via multiplying power, be converted to digitized video Z
kBecause the sampling frequency of output signal is low than the sampling frequency of input signal, therefore, the frequency band of the required filtering of low pass filter, only relevant with frequency reducing multiplying power N.And N of the present invention is a fixed value, so low filter 62 does not need according to different frequency reducing multiplying power design different parameters.
Framework shown in Figure 7 and Fig. 6 equivalence.Wherein the upconverter 64 of Fig. 7 is connected in series with low pass filter 65, and its function is identical with repetition M upconverter 61 of Fig. 6.In the middle of Fig. 7, upconverter 64 is with input signal u
kIn the middle of, between per 2, insert M-1 0, to reach the purpose of M times of raising frequency. that is
And low pass filter 65, its impulse response is continuous N 1, that is its transfer function is: 1+z
-1+ ... + z
-(M-1)Therefore its output signal is
L=0 wherein ... M-1 (8)
Learn the framework shown in Fig. 6 (A) and Fig. 6 (B) equivalence thus.
Fig. 8 is another Organization Chart of the present invention.As shown in the figure, the low pass filter 71 in the middle of the sampling frequency conversion equipment 70 of the present invention is equivalent to the low pass filter 65 of Fig. 6 and being connected in series of low pass filter 62.Because the transfer function of low pass filter 65 is 1+z
-1+ ... + z
-(M-1), if the impulse response of low pass filter 62 is f
i, that is its transfer function F (z) is
Then the transfer function H (z) of low pass filter 71 is
H(z)=(1+z
-1+…+z
-(M-1))·F(z) (10)
That is H (z) has specific factor 1+z
-1+ ... + z
-(M-1)
Though framework shown in Figure 8 and Fig. 6,7 equivalences, yet, because the multiplying power M and the on-fixed multiplying power of upconverter 64 are not the functions of fixing with making the transfer function H (z) of low pass filter 71, cause difficulty in the enforcement and make.Therefore, reasonably embodiment should implement required low-pass filtering in the serial connection mode as Fig. 6,7.
Because in the pleasing to the eye image block to constant brightness, any small brightness changes all very responsive, therefore, the alias that the image of elimination constant brightness produces because of the sampling frequency conversion, very important.The decay that stops frequency band of general low pass filter is limited, still can fold back low frequency through the radio-frequency component of overdamping, causes the alias effect.Yet, owing to have 1+z in the middle of the H (z)
-1+ ... + z
-(M-1)Factor, and factor 1+z
-1+ ... + z
-(M-1)Frequency response is that zero position is in harmony is after the raising frequency, and DC can produce all frequency locations (with reference to figure 9) of picture frequency.Therefore, even the decay that stops frequency band of low pass filter 71 is limited, the still filtering fully of all picture frequencys that DC produces.Therefore, the image of constant brightness, after frequency demultiplier 63 frequency reducings, image can not produce any alias effect.
In addition, sampling frequency conversion equipment of the present invention is not in order to produce ultra-low frequency alias effect, and low pass filter 71 must include the specific factor.If the fixedly multiplying power of frequency demultiplier 63 is N, then the transfer function H (z) of low pass filter 71 must have specific factor 1+z
-1+ ... + z
-(M-1), that is H (z) is formula (11):
H(z)=(1+z
-1+…+z
-(N-1))·G(z) (11)
Wherein, 1+z
-1+ ... + z
-(N-1)Frequency response, the frequency location at its zero point is all frequency locations (with reference to Figure 10) that can fold back DC after the frequency reducing.And G (z) is that H (z) is by factor 1+z
-1+ ... + z
-(N-1)After dividing exactly, merchant's formula of gained.So, be low pass filtering device 71 filterings in advance earlier via the frequency content that can cause ultra-low frequency alias effect after frequency demultiplier 63 frequency reducings.Because low pass filter 62 is equivalent to be connected in series low pass filter 65 and low pass filter 62, that is H (z)=(1+z
-1+ ... + z
-(M-1)) F (z), therefore, aforementioned factor 1+z
-1+ ... + z
-(N-1)Must be able to divide exactly F (z), that is 1+z
-1+ ... + z
-(N-1)Factor for F (z).
If with Fig. 6,7 frameworks of being carried, carry out the sampling frequency conversion of digital image signal, the input function x of the low pass filter 62 of this moment
iNo longer be in every M sampled signal, have only a signal non-vanishing, other M-1 signal is zero.If low pass filter 62 directly calculates according to formula (12), its operand will increase to M doubly.
The present invention is in order to address this problem prior coefficient f with low pass filter 62
iAdd up and obtain
And, because as i during, f more than or equal to L
i=0, so we can look the S of this moment
i=1 (i more than or equal to L time).And, need only the S that calculated in advance goes out low pass filter 62 because the result of formula (15) can understand
iData can significantly reduce the operand of low pass filter 62.
=(f
o·x
KM+l+f
1·x
KM+l-1+…+f
l·x
KM)+(f
l+1·x
(K-1)M+(M-1)+f
l+2·x
(K-1)M+(M-2)+…+f
l+M·x
(K-1)M)+(f
l+M+1·x
(K-2)M+(M-1)+f
l+M+2·x
(K-2)M+(M-2)+…+f
l+2M·x
(K-2)M)+…=(f
0+f
1+…+f
l)·u
k+(f
l+1+f
l+2+…+f
l+M)·u
K-1+(f
l+M+1+f
l+M+2+…+f
l+2M)·u
K-2+…=S
l·u
K+(S
l+M-S
l)·u
K-1+(S
l+2M-S
l+M)·u
K-2+…
(15)
Therefore, the operand of low pass filter 62 of the present invention and the operand of existing low pass filter (with reference to formula (3)) relatively under, only need carry out subtraction (S earlier one time obtaining before each counts hi
i-S
I-M).
Below the concrete instance of digitized video free convergent-divergent in 25% and 200% ratio can be illustrated action of the present invention with one.Because digitized video needs free convergent-divergent in 25% and 200% ratio, M can be defined as from 25 to 200 parameter, and changes according to scaling, this moment, N set 100 for.The present invention can use the low pass filter of L=400
, wherein F (z) contains factor 1+z
-1+ ... + z
-99The coefficient design of F (z) can be used the central any prior art of digital processing field.When the coefficient design is finished, calculate earlier
Data.
If desire is with the digitized video contract drawing 77% of a 800*600 at this moment, then M can set 77 for.At first, (i, each row j) are considered as one-dimensional signal and carry out sampling frequency conversion with the pixel u of input image.That is after the present invention changes the signal of each row earlier, change signal of each row again.Generally speaking, if V (i k) is the image data after the row conversion, then V (i, k) be formula (16): v (i, k)=S
lU (i, t)+(S
M+l-S
l) u (i, t-1)+(S
2M+l-S
77+l) u (i, t-2)+... (16)
Wherein, the scope formula from 0 to 799 of i, and the scope of k from 0 to 461 (600*77%-1).T then is the merchant of kN divided by M (being that 100k is divided by 77) herein, and 1 is remainder.S
iSubscript i be no more than 400, surpass and then to be considered as S
i=S
399=1.Therefore, can calculate image data after the conversion of each row according to formula (16).
After each row converts, be implemented on V (i, each row j) again with same method.If y (k j) is the image data after the row conversion, then y (k, j) be formula (17): y (k, j)=S
lV (t, j)+(S
M+l-S
l) v (t-1, j)+(S
2M+l-S
77+l) v (t-2, j)+... (17)
Wherein, the scope formula from 0 to 615 (800*77%-1) of k, and the scope of j from 0 to 461.T then is the merchant of kN divided by M (being that 100k is divided by 77) herein, and 1 is remainder.S
iSubscript i be no more than 400, surpass and then to be considered as S
i=S
399=1.Y (i, j) be contract drawing 77% after, each pixel of digitized video.Figure 11 shows the flow chart of the sampling frequency conversion method of digitized video of the present invention, and is as shown in the drawing, and the sampling frequency conversion method of digitized video of the present invention is changed each row of image earlier, and then each row is changed.Below describe this flow chart in detail:
Step S100: beginning.
Step S102: the one dimension data that reads image.
Step S104: according to scaling this one dimension data is carried out raising frequency, and produce M up-conversion signal doubly.
Step S106: the high-frequency signal of up-conversion signal is filtered, produce trap signal.
Step S108: the fixed-frequency of trap signal is fallen N doubly, produce the one dimension converting data.
Step S110: according to scaling another dimension data of this one dimension converting data is carried out raising frequency, and produce M up-conversion signal doubly.
Step S112: the high-frequency signal of up-conversion signal is filtered, produce trap signal.
Step S114: the fixed-frequency of trap signal is fallen V doubly, produce converting data.
Step S116: finish.
Though more than with embodiment the present invention is described, therefore do not limit scope of the present invention, only otherwise break away from main idea of the present invention, the sector person can carry out various distortion or change.For example, after though embodiment is rank of advanced units conversion, go conversion again, but also can be advanced after the every trade conversion, be listed as conversion again, or according to Fig. 7, though embodiment is the scaling change of raising frequency multiplying power M according to image, and frequency reducing multiplying power N is for fixing, but also fixing raising frequency multiplying power M, and frequency reducing multiplying power N changes according to the scaling of image.