The Zoom method of digital picture and device
Technical field
The invention belongs to the digital video signal processing field, specifically, relate to a kind of Zoom method and device of digital picture.
Background technology
The convergent-divergent of digital picture is the function that present all Digital Video Processing chips all must be supported.At first, digital video is entering high definition after the epoch, the resolution of display device such as LCD can be up to 1920 * 1080, and this just requires the Digital Video Processing chip can well traditional SD video source (as NTSC720 * 480 and PAL720 * 576) signal be amplified to suitable dimensions to show on corresponding high-resolution display device.On the other hand, low side that some are popular or portable display device may have only very low resolution, as 640 * 480 or the like, require again will input high definition video signal dwindle accordingly.These ubiquitous application all require the Digital Video Processing chip that excellent image zooming function can be provided.
When image is exaggerated, the high-frequency information of image can constantly run off along with the increase of enlargement factor, we have such experience, i.e. image amplification can allow image blur, so a main problem is the sharpness that how to keep image when image amplifies as far as possible.And on the other hand, when image dwindles, some extra high-frequency informations can be introduced in result images, thereby cause result images to present graininess and the level and smooth sense of image is reduced, thus when image dwindles we again in the face of a problem that how to keep Image Smoothness.This awkward situation impels present Digital Video Processing chip all to need to prepare two covers usually or the different image sealer parameter of more covers is finished different amplifications or dwindled task.Give an example, the cubic polynomial method is a kind of more common image-scaling method, that is to say that the pixel of the result images of convergent-divergent obtains by original image pixels being utilized the cubic polynomial function carry out interpolation.Choose different cubic polynomial functions and can obtain different zooming effect, the image that the cubic polynomial function that has produces is smoother but also fuzzyyer, and what have is then more clear.We can choose the fuzzyyer cubic polynomial function of result when image dwindles as can be seen from the analysis of front, and select result's cubic polynomial function more clearly for use under the situation that image amplifies.If it is more discrete that image sealer situation to be processed distributes, that is to say both possibly image had been contracted very little, what possibly image is put is very big, and we can need to prepare a lot of different cubic polynomial functions and handle different situations so usually.
Above-described method is the image sealer method commonly used in the present Digital Video Processing chip.It has following shortcoming at least: 1) the required storage space of chip is bigger.This is because the employed interpolating function of image sealer in the common Digital Video Processing chip is to store in the mode of look-up table, and the look-up table that many more interpolating functions are just corresponding many more also just needs more storage space.2) chip inconvenient debugging.Because the resolution distribution of present display device is disperseed very much, have from very little 320 * 240 to full HD 1920 * 1080, and the size of input picture also varies, so the different interpolating function that the Digital Video Processing chip will be prepared can be a lot, when the debugging chip, when scaling changes, just need so to load different look-up tables, can not accomplish to observe intuitively the variation of scaled results.3) interpolating function is not easy to determine.Because the interpolating function that needs can be a lot, determine that these interpolating functions just need the designer of chip to attempt a lot of different functions under different scalings equally, this work is not only time-consuming but also require great effort.For the design efficiency that improves image sealer and the service efficiency of chip, desirable image sealer should accomplish only to use a cover look-up table (corresponding single interpolating function), and can reach in real time regulating effect intuitively easily by regulating single register under different scalings.
We introduce traditional image sealer earlier.Fig. 1 has provided the original image that a width of cloth is of a size of N * M, promptly horizontal every capable N pixel, and vertically M is capable altogether, and original pixels is with " ● " expression.When carrying out image zoom, if target image is of a size of N ' and M ', we define horizontal convergent-divergent step-length earlier
step_x=(N-1)/(N’-1)
And vertical convergent-divergent step-length
step_y=(M-1)/(M’-1)
From left to right move from upper left corner p (1, the 1) beginning of image again, whenever move and once produce a new pixel " ■ " by step_x.Rebound image Far Left and mobile downwards step_y again when moving to the rightmost pixel of image then repeat from left to right moving by step_x.Like this up to the original pixels p that arrives last cell (M, N).Check out that if be not difficult step_x and step_y are by top calculating, necessarily can be accurate to from such moving of p (1,1) beginning so and reach p (M N), and produces the individual new pixel of common N ' * M ' " ■ ".The new pixel " ■ " of this N ' * M ' has just been formed the result images of convergent-divergent.
Because input picture is a delegation to be followed delegation and enter chip in turn, need use row cache so in integrated circuit, realize image sealer, just in order to the buffer of store video images data line.If the computing of image zoom needs the multirow view data, so just need many row cache to preserve these data.Consider that image sealer at present commonly used all uses 4 * 4 original image pixels to carry out interpolation arithmetic, that is to say that each new pixel " ■ " is to be produced by 4 * 4=16 original image pixels interpolation around it, our description is also as example, so, we carry out the interpolation arithmetic of convergent-divergent with regard to needing 4 row view data, that is to say earlier the 1st of image, 2,3,4 line data are stored in 4 row caches, and from left to right carry out the corresponding new pixel " ■ " of interpolation calculation generation in turn.When the new pixel that the 1st, 2,3,4 line data of original image can produce all calculate finish after, begin to utilize the 2nd, 3,4,5 row operations of advancing again.The rest may be inferred, up to the generation of finishing all new pixels " ■ ".In the chip design of reality, because the needs that view data is read in advance, the number of row cache can be more than 4.Here, using row cache by turns has been well-known technology in the image sealer design, so we no longer are explained in detail.Below we to be presented in a new pixel " ■ " in traditional scaler be 4 * 4=16 original image pixels interpolation generation around it how.
The front we to have introduced position that new pixel " ■ " produces be to move to the lower right corner by step_x and step_y from the upper left corner of original image to determine.As shown in Figure 2,, suppose that the pixel of 4 * 4=16 original image around the A is called as a (1) for some new pixel A, a (2) ..., a (16), and they to belong to the i~i+3 of original image capable.New pixel A is offset_x apart from the lateral separation of its top left corner pixel a (6), and fore-and-aft distance is offset_y.The original image laterally and longitudinally distance between neighbor all counts 1.0, and we have 0≤offset_x<1.0 and 0≤offset_y<1.0 so.The core of the convergent-divergent computing of image utilizes a (1)~a (16) to come interpolation to produce the value of new pixel A exactly.In addition, for the ease of the realization of integrated circuit, consider that a pixel in the row cache from left to right enters in turn, we can carry out decoupling zero with horizontal and vertical calculating, promptly calculate the intermediate results of 4 row earlier longitudinally, carry out the horizontal A value that calculates subsequently again.Suppose that interpolating function is F (t), we have so:
col1=[F(1+offset_y)*a(1)+F(offset_y)*a(5)+F(1-offset_y)*a(9)+F(2-offset_y)*a(13)]/SUM_COL
col2=[F(1+offset_y)*a(2)+F(offset_y)*a(6)+F(1-offset_y)*a(10)+F(2-offset_y)*a(14)]/SUM_COL
col3=[F(1+offset_y)*a(3)+F(offset_y)*a(7)+F(1-offset_y)*a(11)+F(2-offset_y)*a(15)]/SUM_COL
col4=[F(1+offset_y)*a(4)+F(offset_y)*a(8)+F(1-offset_y)*a(12)+F(2-offset_y)*a(16)]/SUM_COL
SUM_COL=F (1+offset_y)+F (offset_)+F (1-offset_y)+F (2-offset_y) wherein
With
A=[col1*F(1+offset_x)+col2*F(offset_x)+col3*F(1-offset_x)+col4*F(2-offset_x)]/SUM_ROW
SUM_ROW=F (1+offset_x)+F (offset_x)+F (1-offset_x)+F (2-offset_x) wherein
Should be noted that a bit when the position of new pixel A in original image was in the boundary vicinity of image, we might find 4 * 4=16 original pixels around it.In this case, the user can supply 16 points by repeating boundary pixel, also can simply will directly give new pixel A from the nearest original pixels of A.The processing of these border condition is well-known technology in the image sealer design, does not do detailed argumentation at this.According to user's hobby, interpolating function F (t) can be different function, as CR splines commonly used, Mitchell function etc.The user also can produce interpolating function voluntarily based on experience.Usually interpolating function F (t) has the curve among similar Fig. 3.
In the integrated circuit of reality was realized, the numerical value of F (t) was to calculate in advance and exist in the look-up table usually.That is to say that the F in the top computing formula (offset_x), the numerical value of F (1-offset_y) etc. are the calculating of carrying out new pixel A of must arriving from look-up table.Different interpolating function F (t) can provide different image zoom results, and what have is fuzzyyer, and have more clear.The process that produces corresponding look-up table from interpolating function is a well-known technology the image sealer design in the Digital Video Processing chip, does not do detailed argumentation at this.Start introduction by us, for the effect that image sealer is obtained, the user need prepare two or more look-up tables usually, and corresponding different interpolating function F (t) handles the situation of different scalings.
Fig. 4 has provided the flow process of traditional images convergent-divergent, the reading of view data in the row cache device wherein, look-up table read and each computing unit all is well-known technology in the design of Digital Video Processing chip, so be not described in detail at this.
Introduced the implementation method of common image sealer above.This method has many shortcomings in Video processing, prepare the look-up table of different interpolating function F (t) as needs and deal with different scalings, expends the resource of chip.In the debugging of chip,, also hindered the direct feel of commissioning staff to the image zoom effect owing to the different look-up table of need reloading at different scalings.
Summary of the invention
The object of the present invention is to provide a kind of Zoom method and device of digital picture, the technical matters that the storage space required with the chip that solves existing digital image scaling device is big, chip inconvenient debugging and interpolating function are not easy to determine.
In order to achieve the above object, technical scheme of the present invention is as follows:
A kind of Zoom method of digital picture comprises the steps: video image line of input buffer; Pixel in the original image of N * M of storing in the row cache device is carried out interpolation arithmetic obtain new pixel, until the target image that this original image is scaled N ' * M '; Described interpolation arithmetic comprises: search zoom factor numerical value longitudinally in the interpolating function table; After zoom factor numerical value is revised longitudinally to this, utilize the revised numerical value of zoom factor longitudinally that pixel is carried out zoom operations longitudinally; In the interpolating function table, search horizontal zoom factor numerical value; After this horizontal zoom factor numerical value revised, utilize revised horizontal zoom factor numerical value that pixel is carried out horizontal zoom operations; Correction step wherein is: judge that whether described zoom factor numerical value is less than zero; If, then make this zoom factor numerical value multiply by one more than or equal to 0 and smaller or equal to behind 1 the coefficient as revised zoom factor numerical value; Otherwise directly with this zoom factor numerical value as revised zoom factor numerical value.
A kind of device for zooming of digital picture utilizes H * H surrounding pixel based on new pixel to come interpolation to produce new pixel; This device for zooming comprises: the row cache device, wherein store the original image of N * M; The interpolating function look-up table, H horizontal zoom factor numerical value of output and the individual zoom factor numerical value longitudinally of H; The interpolating function amending unit, to described output H horizontal zoom factor numerical value and H longitudinally zoom factor numerical value revise: when zoom factor numerical value less than 0 the time, make this zoom factor numerical value multiply by one more than or equal to 0 and smaller or equal to behind 1 the correction factor as revised zoom factor numerical value; Otherwise directly with this zoom factor numerical value as revised zoom factor numerical value; H carries out the computing unit of horizontal zoom operations to pixel, and each computing unit utilizes revised horizontal zoom factor numerical value to carry out horizontal zoom operations to being positioned at the same pixel that lists in H * H the surrounding pixel; Pixel is carried out the computing unit of vertical zoom operations, this computing unit that pixel is carried out vertical zoom operations receives from described H pixel is carried out the result of calculation of the computing unit of horizontal zoom operations, utilizes the described revised numerical value of zoom factor longitudinally that H * H surrounding pixel carried out zoom operations longitudinally.
The present invention has proposed a kind of new scheme on the realization framework basis of traditional images scaler, only need an interpolating function (corresponding look-up table), just can regulate by single register and change zooming effect in real time intuitively following of different zoom ratio situation, both save the storage space of look-up table, made things convenient for the debugging work of chip again.
Description of drawings
Fig. 1 is the synoptic diagram of original image and the definition of convergent-divergent step-length;
Fig. 2 is the synoptic diagram of the interpolation arithmetic in the image zoom;
Fig. 3 is interpolating function figure;
Fig. 4 is a traditional images convergent-divergent process flow diagram;
Fig. 5 is the image zoom process flow diagram that contains the interpolating function debugging functions of the present invention;
Fig. 6 is the structural representation of the interpolating function amending unit among Fig. 5;
Fig. 7 is the interpolating function synoptic diagram before and after revising.
Embodiment
According to Fig. 5 to Fig. 7, provide preferred embodiment of the present invention, and described in detail below, enable to understand better function of the present invention, characteristics.
Fig. 5 has provided the flow process of image zoom among the present invention.Different with the traditional process shown in Fig. 4 is that the present invention revises the data that read after reading interpolating function F (t) look-up table.Look-up table data for vertical and horizontal, add an interpolating function amending unit respectively, it revises the control also be subjected to an adjustable register of user respectively, and promptly the user shown in the figure vertically revises register SCKX and the user laterally revises register SCKY.These two registers are represented two numerical value between 0 to 1.0, i.e. 0≤SCKX≤1.0,0≤SCKY≤1.0 respectively.Fig. 6 has described the processing in the interpolating function amending unit.
In lateral interpolation function amending unit, the B1 among the figure, B2, B3, B4 are exactly the F (1+offset_y) that reads from the interpolating function look-up table, F (offset_y), F (1-offset_y), F (2-offset_y) is exactly SCKY among Fig. 5 and the user revises register SCK.Similarly, for vertical interpolating function amending unit, the B1 among the figure, B2, B3, B4 are exactly the F (1+offset_x) that reads from the interpolating function look-up table, F (offset_x), F (1-offset_x), F (2-offset_x) is exactly SCKX among Fig. 5 and the user revises register SCK.In order to adjust the image zoom sharpness of vertical and horizontal, big more SCK value correspondence is the result more clearly respectively for SCKX and SCKY.That is to say that the result of vertical image zoom is the fuzzyyest when SCKX=0, the result of vertical image zoom is the most clear when SCKX=1; The result of landscape images convergent-divergent is the fuzzyyest when SCKY=0, and the result of landscape images convergent-divergent is the most clear when SCKY=1.In the application of reality, convergent-divergent processing too clearly can cause the unsmooth of too tangible noise and image, so the user should be adjusted to suitable numerical value with SCKX and SCKY register when practical application.
As can be seen, by SCKX and SCKY, the user can independently regulate vertically and horizontal image zoom sharpness.Like this, the user only need choose a satisfactory interpolation values function when the designed image scaler, produces the look-up table of a correspondence.Under different scaling situations, the user no longer needs the interpolating function look-up table of reloading different, and it is just passable only need to regulate SCKX and SCKY.In addition, if we merge SCKX and SCKY becomes a register, so just can accomplish to have regulated image zoom result's sharpness by single register.But in practice, because the scaling of vertical and horizontal is not quite similar, bigger adjusting degree of freedom can be arranged so keep two registers.
As above our introduction all is based on and utilizes 4 * 4=16 surrounding pixel to come interpolation to produce new pixel.If the user wishes to utilize more images information to carry out interpolation arithmetic, as use each new location of pixels 6 * 6=36 original image pixels on every side, the present invention does not impose any restrictions this.In this case, the numerical value that computing unit reads from the interpolating function look-up table at every turn among Fig. 5 will be 6 rather than 4.For the interpolating function amending unit, only those 4 numerical value of 4 pixels in the middle of corresponding in these 6 numerical value are revised, this is because if 6 pixels are all similarly revised, produce ghost image near the object boundary of correction meeting in image to two pixels on the ragged edge, and the clear more this ghost image of scaled results is also obvious more.In other words, come interpolation to produce new pixel A even the user selects for use more than 4 * 4=16 original image pixels, the interpolating function amending unit is also only revised a (1)~pairing interpolation coefficient of a (16) pixel as shown in Figure 2.
As shown in Figure 7, the interpolating function F (t) that solid line is selected for the user, the present invention does not have any special requirement to F (t), and the user can be by the hobby decision of oneself.Shown in Fig. 5, the user obtains lateral interpolation coefficient F (1+offset_y) from look-up table, F (offset_y), and F (1-offset_y), F (2-offset_y), as B1, B2, B3, B4 input to the interpolating function amending unit among Fig. 6.Like this, every minus coefficient all can multiply by SCKY.Because we have stipulated that SCKY is the number between 0 to 1, so, minus coefficient is more close zero through meeting after revising, and this is equivalent to the revised F (t) that the original F (t) of solid line representative among the last figure has been changed over the dotted line correspondence, and promptly its minus part amplitude has narrowed.Equal at 1 o'clock at SCKY, revised F (t) is identical with original F (t), promptly is equivalent to and does not do correction.When SCKY=0, the minus part of F (t) all has been configured to zero.When SCKY is set, the corresponding horizontal scaled results more clearly of big more (promptly the closer to 1) SCKY.For vertical interpolation coefficient F (1+offset_x), F (offset_x), F (1-offset_x), F (2-offset_x) and vertical correction factor SCKX, its mode of operation is similar.
That is to say, carry out the horizontal intermediate result that calculates 4 row earlier, calculate A value subsequently more longitudinally.In conjunction with the accompanying drawings, suppose that interpolating function is F (t), so:
Step 1: zoom factor numerical value F (1+offset_y), F (offset_y), F (1-offset_y) and F (2-offset_y) are transformed into the revised numerical value of zoom factor longitudinally F (1+offset_y) ', F (offset_y) ', F (1-offset_y) ' and F (2-offset_y) ' longitudinally:
1) judges that at first whether zoom factor numerical value F (1+offset_y), F (offset_y), F (1-offset_y) and F (2-offset_y) are less than 0 longitudinally;
2) if four exist in the zoom factor numerical value longitudinally less than 0, the then corresponding revised numerical value of zoom factor longitudinally equals original scale coefficient numerical value and multiply by a vertical correction factor SCKY (0≤SCKY≤1.0), otherwise the revised numerical value of zoom factor longitudinally equals original scale coefficient numerical value, if promptly four only have F (1+offset_y), F (offset_y) less than 0 in the zoom factor numerical value longitudinally, then have
F(1+offset_y)’=F(1+offset_y)*SCKY;
F(offset_y)’=F(offset_y)*SCKY;
F(1-offset_y)’=F(1-offset_y);
F(2-offset_y)’=F(2-offset_y)。
Step 2:
col1=[F(1+offset_y)’*a(1)+F(offset_y)’*a(5)+F(1-offset_y)’*a(9)+F(2-offset_y)’*a(13)]/SUM_COL
col2=[F(1+offset_y)’*a(2)+F(offset_y)’*a(6)+F(1-offset_y)’*a(10)+F(2-offset_y)’*a(14)]/SUM_COL
col3=[F(1+offset_y)’*a(3)+F(offset_y)’*a(7)+F(1-offset_y)’*a(11)+F(2-offset_y)’*a(15)]/SUM_COL
col4=[F(1+offset_y)’*a(4)+F(offset_y)’*a(8)+F(1-offset_y)’*a(12)+F(2-offset_y)’*a(16)]/SUM_COL
SUM_COL=[F (1+offset_y) '+F (offset_y) '+F (1-offset_y) '+F (2-offset_y) ' wherein]
Step 3: horizontal zoom factor numerical value F (1+offset_x), F (offset_x), F (1-offset_x) and F (2-offset_x) are transformed into revised horizontal zoom factor numerical value F (1+offset_x) ', F (offset_x) ', F (1-offset_x) ' and F (2-offset_x) ':
1) judges that at first whether horizontal zoom factor numerical value F (1+offset_x), F (offset_x), F (1-offset_x) and F (2-offset_x) are less than 0;
2) if exist in four horizontal zoom factor numerical value less than 0, then corresponding revised horizontal zoom factor numerical value equals original scale coefficient numerical value and multiply by a horizontal correction factor SCKX (0≤SCKX≤1.0), otherwise revised horizontal zoom factor numerical value equals original scale coefficient numerical value, if promptly F (1+offset_x) is only arranged less than 0 in four horizontal zoom factor numerical value, then has
F(1+offset_x)’=F(1+offset_x)*SCKX;
F(offset_x)’=F(offset_x);
F(1-offset_x)’=F(1-offset_x);
F(2-offset_x)’=F(2-offset_x)。
Step 4:
A=[col1*F(1+offset_x)’+col2*F(offset_x)’+col3*F(1-offset_x)’+col4*F(2-offset_x)’]/SUM_ROW
SUM_ROW=[F (1+offset_x) '+F (offset_x) '+F (1-offset_x) '+F (2-offset_x) ' wherein]
That is to say that correction step of the present invention is: judge that whether described zoom factor numerical value is less than zero; If, then make this zoom factor numerical value multiply by one more than or equal to 0 and smaller or equal to behind 1 the correction factor as revised zoom factor numerical value; Otherwise directly with this zoom factor numerical value as revised zoom factor numerical value.
The front provides the description to preferred embodiment, so that any technician in this area can use or utilize the present invention.To this preferred embodiment, those skilled in the art can make various modifications or conversion on the basis that does not break away from the principle of the invention.Should be appreciated that these modifications or conversion do not break away from protection scope of the present invention.