Background of the Invention
1. Field of the Invention
The present invention relates to a motion estimator for compressing image signals, and more particularly to a half pixel motion estimator for estimating the motion of half pixels by interpolating the integer pixels (pel).
2. Description of the Prior Art
Related arts for a half pixel motion compensation, which are used for an image compression, are disclosed in U.S. Pat. Nos. 5,461,423, 5,488,419, 5,489,949, and 5,493,344. U.S. Pat. No. 5,489,949 discloses in detail a method and apparatus for motion estimation utilizing an error value for determining a motion vector.
In general, a motion estimation is a method for compressing images in image processing methods for determining a motion vector, which represents a motion difference between the pixels of previous frame and the pixels of current frame in successive image signals so as to transmit only the motion vector and the differential pulse code modulation (DPCM) value instead of whole image data.
A block matching algorithm (BMA), widely used in motion estimation, is a method that uses a motion vector in order to estimate block image within the previous frame with the corresponding block image within the current image, under the assumption that a movement of image is shifted parallel in horizontal direction or vertical direction. The BMA commonly uses 8.times.8 and 16.times.16 sized blocks for motion estimation.
In order to search a block of the previous frame closely similar to the reference block of the current frame, the previous frame is searched within a constant range centering the reference block of the previous frame. Here, the constant range is a "search window", and the difference between a candidate block and the reference block within the search window is a distortion.
In addition, a "full search block matching algorithm" compares all candidate blocks with the reference block within the search window. In order to search the most similar block to the reference block, the difference between f.sub.1 (x-a, y-b) and f.sub.2 (x, y) is calculated. The minimum difference between f.sub.1 (x-a, y-b) and f.sub.2 (x, y) is designated as a motion vector. Like the above, a Mean Absolute Error (MAE) method is used to obtain a minimum error value between the blocks. MAE is achieved by the following equation 1. ##EQU1##
In equation 1, the "E.sub.abs " and the "B" are respectively a MAE value and a block size. Accordingly, the (a, b) that allows the E.sub.abs to be minimum is the motion vector.
In the apparatus for compressing and coding images like MPEG2, the motion estimation is performed by two steps in order to perform further detailed motion estimation.
As illustrated in FIG. 1A, the motion estimation is conventionally performed by the following steps. Firstly, an initial motion estimation is performed within a broad search window SW1' in integer pixel units in order to produce a first motion vector MV1'. Secondly, a half pixel is interpolated by calculating the adjacent pixels by centering the motion vector MV1' in order to perform the half pixel motion estimation within a narrow search window SW2', and more detailed motion vector MV2' is produced.
However, an interpolator, which is comprised in the motion estimator of the prior arts needs a divider for generating the half pixel. The divider has a problem that its size is increased when embodied with a semiconductor integrated circuit having an array processor arrangement.
Summary of the Invention
In view of the foregoing, it is an object of the invention to provide a half pixel motion estimator of compact and simplified structure to compress sequential image signals by utilizing a shifter for interpolating integer pixels.
To achieve the objects, the present invention provides a half pixel motion estimator for calculating an integer motion vector and corresponding absolute error value by estimating an integer motion for a macro block in the first search window, where a second search window is formed for performing a half pixel motion estimation of the macro block, where the half pixel motion estimation comprises an interpolator for generating a half pixel by summing and shifting the delayed pixels sequentially inputted from the second search window and a couple of current input pixels; and a half pixel motion estimating means, wherein the pixel data of the macro block and one horizontal line-delayed pixel data are inputted. An absolute error value of the half pixel motion is calculated by processing the data from the interpolator and received pixel data. A minimum absolute error value is selected and outputted by comparing the absolute error value from the half pixel motion estimation with the absolute error value from the integer motion estimation.
Brief Description of the Drawings
The above and other objects, features, and advantages of the present invention will be apparent from the following detailed description of the preferred embodiments of the invention in conjunction with the accompanying drawings, in which:
FIG. 1A is a conceptual diagram for explaining the two step motion estimation;
FIG. 1B is a view illustrating a conventional motion estimator;
FIG. 2A is a view illustrating 16.times.16 macro block for motion estimation;
FIG. 2B is a view illustrating a search window for half pixel motion estimation;
FIG. 3 is a conceptual diagram for explaining a half pixel motion estimation;
FIG. 4 is a block diagram illustrating a half pixel motion estimator in accordance with a preferred embodiment of the present invention;
FIGS. 5A and 5B are tables illustrating a time sequence in accordance with a preferred embodiment of the present invention:
FIG. 6 is a detailed block diagram of processing elements illustrated in FIG. 4; and
FIG. 7 is a detailed block diagram of a half pixel generating means illustrated in FIG. 4.
Description of the Preferred Embodiment
Reference will now be made in detail to the present invention, examples of which are illustrated in the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings to refer to the same or like parts.
FIG. 1A shows a conceptual diagram for explaining a further detailed motion estimation. In further detailed motion estimation, a second motion estimation on a narrow search window SW2' is performed following a first motion estimation on a broad search window SW1'.
FIG. 1B shows a block diagram of a conventional motion estimator and a motion estimator of the present invention. The motion estimator comprises a current frame buffer 1, a previous frame buffer 2, an integer pixel motion estimating means 3, a half pixel motion estimating means 4, and a vertical line delaying means 5.
In FIG. 1B, image data (pixels) within the current frame for estimating the motion are stored in the current frame buffer 1. The image data within the current frame can be accessed in macro block units. Image data within the previous frame serve as the reference image of the motion estimation, and they are stored in the previous frame buffer 2. The image data within the previous frame forms search windows SW1' and SW2' having a constant size.
The pixels of the reference block, for the current frame, from the current frame buffer 1 is inputted to the integer pixel motion estimating means 3. The pixels of candidate blocks, within the search window SW1', from the previous frame buffer 2 are inputted to the integer pixel motion estimating means 3. In integer pixel motion estimating means 3, a motion vector MV0 having a minimum absolute error (or a distortion) and an absolute error AE0 are outputted after comparing the pixels of the reference block to the pixels of the candidate blocks on the search window.
The pixels within a constant range of the motion vector MV0, which are generated from the integer pixel motion estimating means 3, are inputted to the half pixel motion estimating means 4. The half pixel motion estimating means 4 compares the pixels of the reference block inputted from the current frame buffer 1 with the pixels of the candidate blocks inputted from the previous frame buffer 2. At this time, half pixels are generated on the narrow search window SW2, and an accurate motion vector is generated by estimating the motion of the half pixels. The pixels of the reference block can be directly inputted into the half pixel motion estimating means 4, or inputted to the vertical line delaying means 5 in one line-delayed state.
FIG. 2A shows a 16.times.16 reference block in accordance with the present invention. The 16.times.16 macro block is composed of 256 pixels from a(1,1) to a(16,16).
FIG. 2B shows the search window SW2 for the half pixel motion estimation in accordance with the present invention. The search window SW2 centers candidate blocks 7 having motion vectors processed by the first motion estimation (namely an integer pixel motion estimation). Half pixels are generated by interpolating the integer pixels within the search window SW2. Accordingly, nine candidate blocks (eight half pixel candidate blocks and an integer pixel candidate block) exit in the search window. Namely, the search window SW2 is formed by extending one by one pixel centering the candidate blocks 7 from the first motion estimation; and the half pixels are generated by interpolating the pixels b(0,0)-b(17,17) of the search window SW2, thereby forming eight candidate blocks.
Finally, the half pixel motion estimation searches the motion vector having the minimum absolute error, namely a second motion vector (a final motion vector), by comparing respectively the absolute error of the candidate blocks generated in the first motion estimation to the absolute errors of the eight half pixel candidate blocks.
FIG. 3 shows certain nine integer pixels b(x,y), b(x+1,y), b(x+2,y), b(x,y+1), b(x+1,y+1), b(x+2,y+1), b(x,y+2), b(x+1,y+2), b(x+2,y+2) in the search window SW2. In FIG. 3, the dot and "x" respectively indicate integer pixels and half pixels generated by interpolating the integer pixels. Each arrow indicates half pixel motion vectors for the eight candidate blocks with b(x+1, y+1)!. Reference numerals PE1 to PE 8 on each arrow respectively indicate the processing elements for generating the half pixel motion vectors.
In FIG. 3, the b.sup.0.sub.1 indicates a half pixel (a half pixel of vertical direction), which is generated by interpolating the two adjacent integer pixels of vertical direction. Additionally, the b.sup.1.sub.0 and b.sup.1.sub.1 indicate respectively a half pixel (a half pixel of horizontal direction), which is generated by interpolating the two adjacent integer pixels of horizontal direction, and a half pixel (a half pixel of diagonal direction), which is generated by interpolating the four adjacent integer pixels forming a quadrangle.
The above b.sup.0.sub.1 (x+1,y), b.sup.1.sub.0 (x,y+1) and b.sup.1.sub.1 (x,y) are generated by the following equations.
As illustrated in FIG. 4, the half pixel motion estimator of the present invention is largely divided into an interpolator 100 and a half pixel motion estimating means 200. The interpolator 100 comprises a latch 110 and three half pixel generating means 120, 130, 140. The half pixel motion estimating means 200 comprises two latches 211, 212 and eight processing elements 221-228, eight accumulators 231-238, and a comparing and selecting means 240.
As illustrated in FIG. 2B, the two pixels from the search window SW2 are sequentially inputted from the search window SW2 to the interpolator 100 in vertical direction. One pixel is composed of 8 bit data in accordance with preferred embodiment of the present invention. Inputted two pixels are latched by the latch 110. The new two pixels and previous pixels are inputted to the clock located in the line of the lines 101-104. Namely, as illustrated in FIG. 3, when b(x,y) and b(x+1,y+1) pixels are inputted to the previous clock in the interpolator 100, and b(x,y+1) and b(x+1,y+1) pixels are subsequently inputted at the current clock, the b(x,y) and the b(x+1,y) that are latched at the previous clock respectively appears on the lines 101, 102, and the b(x,y+1) and the b(x+1,y+1) that are inputted at the current clock appears respectively on the lines 103, 104.
Accordingly, the pixels b(x,y), b(x+1,y), b(x,y+1), and b(x+1,y+1) are inputted and calculated in the diagonal half pixel generating means 120 and the half pixel of diagonal direction b.sup.1.sub.1 is outputted. The pixels b(x+1,y) and b(x+1,y+1) are inputted and calculated in the vertical half pixel generating means 130 and the half pixel of vertical direction b.sup.0.sub.1 is outputted. The pixels b(x,y+1) and b(x+1,y +1) are inputted and calculated in the horizontal half pixel generating means 140 and the horizontal half pixel b.sup.1.sub.0 is outputted.
Each half pixel generating means 120, 130, 140, as illustrated in FIG. 7, comprises an adder 151, an shifter 152, and a latch 153. As described in detail, four pixels of 8 bits and 2.sub.10 (10.sub.2) are added in the adder of the diagonal half pixel generating means 120. In the shifter of the diagonal half pixel generating means 120, an output from the adder is shifted twice. At this time, of the 10 bits outputted from the adder, only 8 bits from the Most Significant Bit (MSB) to the eighth bit are outputted from the shifter.
In addition, in adders of the vertical half pixel and horizontal half pixel generating means 130, 140, two pixels having 8 bits and 1.sub.2 are added. In the shifters of the vertical half pixel and horizontal half pixel generating means 130, 140, the outputs from the adder are shifted once. At this time, of the 9 bits output from the adder, only 8 bits from a Most Significant Bit (MSB) to the eighth bit are outputted from the shifter. Here, in order to generate an integer by shifting (namely a division), a binary digit "10.sub.2 " is added in the diagonal half pixel generating means 120 and a binary digit "1.sub.2 " is added in the vertical half pixel and horizontal half pixel generating means 130, 140.
As illustrated in FIG. 4, the pixels of the reference block are inputted sequentially in the half pixel motion estimating means 200. The pixels a(1,1) to a(16,16) of the reference block are sequentially inputted to the line 105 in vertical direction. The pixels of a vertical line that is delayed more than the line 105 are sequentially inputted in the line 106. Namely, the first vertical pixels of the reference block a(1,1) to a(1,16) are inputted in the line 106 when the second vertical pixels of the reference block a(2,1) to a(2,16) are inputted in the line 105. In addition, non-delayed input pixels of the vertical line are latched in the latch 211, thus they are delayed by one clock. The non-delayed input pixels are outputted to the processing elements 221, 222. The vertical line delayed-input pixels are latched in the latch 212 so that they are delayed again by one more clock. The delayed input pixels are outputted to the processing element 228.
In FIG. 4, the processing elements 221-228 forming four groups a, b, c, d represents the pixels of the reference block that are processed in the same time with the half pixels. Processing the pixel a(i,j)' of the reference block from the line 105 that is delayed by the latch 211 and the half pixels inputted from the interpolator 100 at the same time as the pixel a(i,j)', is performed by the processing elements 221, 222 of the group a. Processing the pixel a(i,j) of the reference block inputted through the line 105 and the half pixels inputted from the interpolator 100 at the same time as the pixel a(i,j), is performed by the processing elements 223, 224, 225 of the group b. Processing the pixel a'(i,j) of the one vertical line-delayed reference block inputted through the line 106, and the half pixels inputted from the interpolator 100 at the same time as the pixel a'(i,j), is performed by the processing elements 226, 227 of the group c. Processing the pixel a'(ij)' of the one vertical line-delayed reference block inputted through the line 106, which is delayed once more by the latch 212, and half pixels inputted from the interpolator 100 at the same time as the pixel a'(i,j)', is performed by the processing element 228 of the group d.
As illustrated in FIG. 6, each processing element 221-228 comprises a subtracter 251, a latch 252, and an absolute value calculator 253.
Calculating the differences between the pixels of the reference block and the half pixels generated by the interpolator 100 are performed by the subtracter 251. The difference is latched by the latch 252 and absolute value is calculated by the absolute value calculator 253. Like the above steps, absolute errors for each pixel are calculated by the processing elements 221-228, and the absolute errors for each pixel are continuously accumulated in the accumulators 231-238. The absolute errors between the reference block and the corresponding candidate blocks are stored in the accumulators 231-238 after performing the operation for the whole pixels of the macro block.
As illustrated in FIG. 3, each processing element 221-228 calculates errors for the half pixel motion estimation in eight directions. Accordingly, the comparing and selecting means 240 outputs a motion vector of candidate block having the minimum error after comparing the error AE0 from the first motion estimation to the errors from AE1-AE8 from accumulators 231-238.
For example, if the absolute error from the first motion estimation is the minimum error when comparing to each output from the eight accumulators 231-238, the final motion vector is the motion vector MV0 from the first motion estimation. If the absolute error from the accumulator is the minimum error, the resulting vector is the sum of the half pixel motion vector from the accumulator and the motion vector from the first motion estimation. In short, when the value of the first motion vector (MV0) is MV(m,n), the second motion vector is determined as shown in the following table 1.
As shown in Table 1, the absolute errors AE1-AE8 stored in each accumulator 231-238 are compared to the absolute error AE0 from the first motion estimation by the comparing and selecting means 240. The half pixel motion vector (-0.5, +0.5) in FIG. 3 is selected when the absolute error AE1 from the first accumulator 231 is the minimum absolute error. Accordingly, the sum of the motion vector MV(m,n) and the half pixel motion vector (-0.5, +0.5), namely MV(m-0.5,n+0.5) is the final resulting motion vector MV1.
Next, the preferred embodiment of construction like the above will be described in detail according to FIGS. 5A and 5B.
As illustrated in FIGS. 5A and 5B, the pixel couple b(0,0) and b(17,17) of the search window are respectively inputted to the interpolator 100 according to the clock. Namely, a couple of pixel data like b(0,0), b(1,0) of clock 0, b(0,1),b(1,1) of clock 1, and b(0,2),b(1,2) of clock 2 are sequentially inputted according to the order of the vertical line in the interpolator 100. The three half pixels from the clock 2 (a half pixel of diagonal direction, a half pixel of vertical direction, and a half pixel of horizontal direction) are sequentially outputted from the interpolator 100. Namely, b.sup.1.sub.1 (0,0), b.sup.0.sub.1 (1,0), and b.sup.1.sub.0 (0,1) are outputted at the clock 2, and b.sup.1.sub.1 (0,1), b.sup.0 (1,1), and b.sup.1.sub.0 (0,2) are outputted at the clock 3 from the interpolator 100.
In addition, the pixels a(1,1)-a(16,16) of the reference block in FIG. 2 are sequentially inputted in the processing elements 221-228 in the order of the vertical line according to the clock. At this time, the same pixels of the reference block are inputted according to each group a, b, c, d of the processing elements 221-228, to be processed with the outputs (namely half pixels) from the interpolator 100.
Namely, the first pixel a(1,1) of the first vertical line of the reference block is inputted at the clock 2 in the processing elements 223-225, to be processed with the half pixels b.sup.1.sub.1 (0,0), b.sup.0.sub.1 (1,0), and b.sup.1.sub.0 (0,1) outputted from the interpolator 100. The pixels "a(1,1)-b.sup.1.sub.1 (0,0)", a(0,0)-b.sup.0.sub.1 (1,0), and a(1,1)-b.sup.1.sub.0 (0,1) are processed by the third, fourth, and fifth processing elements 223, 224, 225, respectively. The absolute errors generated by the above operations are stored in the each accumulators 233-235 corresponding to each processing elements 223-225.
Next, the second pixel a(1,2) of the first vertical line of the reference block, inputted at the clock 3, is processed by the third, fourth, and fifth processing elements 223-225. The one clock-delayed first pixel a(1,1) from the latch 211 is processed by the first and second processing elements 221, 222. Namely, the pixels a(1,2)-b.sup.1.sub.1 (0,1), a(1,2)-b.sup.0.sub.1 (1,1), and a(1,2)-b.sup.1.sub.0 (0,2) are processed respectively by the third, fourth, and fifth processing elements 223-225, which output the absolute errors to the corresponding accumulators 233-235. The pixels a(1,1)-b.sup.1.sub.1 (0,1) from clock 3 is processed by the first processing element 221, which outputs the absolute error to the first accumulator 231. The absolute error value is outputted from the second processing element 222 to the second accumulator 232 after processing a(1,1)-b.sup.0.sub.1 (0,1).
In FIGS. 5A and 5B, the pixels that form the first vertical line of the reference block are sequentially processed by the processing elements 221-225, and the pixels that form the second vertical line of the reference block are also sequentially processed by the processing elements 221-225. The pixels forming the first vertical line and the second vertical line of the reference block are inputted at the same clock. Namely, when the pixel a(1,1) of the first vertical line of the reference block is delayed by one line before being inputted to the processing elements 226-228 through the line 106, compared to the half pixels inputted to the same clock, the pixels a(1,1)-b.sup.1.sub.1 (1,0) is processed by the sixth processing element 226, and the absolute error is ouputted to the sixth accumulator 236. The pixels a(1,1)-b.sup.1.sub.0 (1,1) is processed by the seventh processing element 227, and the absolute error is outputted to seventh accumulator 237. At this time, the first pixel a(1,1) of the first vertical line of the reference block delayed by one vertical line is latched by the latch 212 to be delayed again by one more clock.
At the next clock, the next pixel a(1,2) together with a(1,2)-b.sup.1.sub.1 (1,1) and a(1,2)-b.sup.1.sub.0 (1,2) is processed in the sixth and seventh processing elements 226, 227. In addition, at the same clock as the above, the latched first pixel a(1,1) together with a(1,1)-b.sup.1.sub.1 (1,1) is processed in the eighth processing element 228, and the absolute error is outputted to the eighth accumulator 238.
The operation for the whole pixels is completed when the absolute errors processed by each processing element are stored in each corresponding accumulator. Accordingly, the absolute errors for one reference block and eight half pixel candidate blocks are stored respectively in the accumulators 231-238. Finally, as shown in table 1, the motion vector having the minimum absolute error is outputted from the comparing and selecting means 240 when the whole pixels of the reference block is completely processed.
As described above, the half pixel motion estimator of the present invention has the advantage that the operation of the interpolator is performed by the shifter, and the operation for the half pixel motion estimation is performed by a sequential method, thus eliminating the need for an array processors. Accordingly, the half pixel motion estimator of the present invention of compact size with a faster processing speed can be realized, since it is comprised of a simple semiconductor integrated circuit.
While this invention has been described in connection with what is presently considered to be the most practical and preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiment, but, on the contrary, it is intended to cover various modifications and equivalent arrangements comprised within the spirit and scope of the appended claims.