Abstract:
A method for interpolating a pixel during the deinterlacing of a video signal, the video signal including at least two fields of interlaced scan lines, each scan line including a series of pixels having respective intensity values, includes generating a motion value representative of the motion between successive frames about the pixel, detecting an edge direction about the pixel, performing an edge adaptive interpolation at the pixel, using the detected edge direction, and performing a motion adaptive interpolation at the pixel, using the generated motion value. Apparatus for interpolating a pixel during the deinterlacing of a video signal, the video signal including at least two fields of interlaced scan lines, each scan line including a series of pixels having respective intensity values, includes a motion value generator configured to generate a motion value representative of the motion between successive frames about the pixel, an edge direction detector configured to detect an edge direction about the pixel, an edge adaptive interpolator configured to perform an edge adaptive interpolation at the pixel, using the detected edge direction, and a motion adaptive interpolator configured to perform a motion adaptive interpolation at the pixel, using the generated motion value.

Description:
BACKGROUND 
     The invention relates generally to video image display and to deinterlacing video images. 
     Many television and video signals are interlaced, where the set of scan lines (typically 525 for NTSC color television) which make up a single video frame are not scanned or transmitted sequentially. Rather, the video frame is divided into two “fields”, each field comprising every other scan line. In television, the scan lines comprising one field are transmitted first, followed by the scan lines of the second field. 
     However, a number of display devices, such as computer monitors, are not interlaced. Rather, these devices sequentially scan the entire display area, one scan line after another. To display an interlaced scanned sequence, such as a video signal, on such progressively scanned devices, a deinterlacing process must convert each separate field into a complete display frame that can be sequentially output to the display device. The main task of a deinterlacing process is to reconstruct the missing line between each of the scan lines of an interlaced field. 
     There are two primary deinterlacing methods, each with their own strengths and weaknesses. “Inter-field” techniques simply merge the data from the second field with the data from the first field to produce a completed frame. If there is no motion in the video frame, such methods yield an ideal reconstituted picture. Vertical resolution can be as good as an original noninterlaced frame. However, if there is motion within the video signal, motion effects will generally be visible to the human eye. Motion effects arise when an object, which was in one location during the scanning of the first field, has moved when the alternating scan lines of the second field are scanned. Simply combining the interlaced scan lines of the two fields yields an unacceptable rendition of the object. 
     “Intra-field” techniques use data only from a single field to produce a complete frame. Such methods are better suited for video frames having motion. With an intra-field technique, the values for non-existent pixels are interpolated from pixel values in the scan lines above and below the non-existent pixels. While this technique produces no deleterious motion effect, since it does not incorporate motion from one field to the next, it also does not enhance vertical resolution, since it merely interpolates from existing pixel values within a single field and does not use pixel information for missing scan lines from the second field. Also, simple intra-field deinterlacing techniques (such as simple vertical interpolation) tend to generate unacceptable jagged pictures along diagonal edges. 
     SUMMARY 
     In general, in one aspect, the invention features a method for interpolating a pixel during the deinterlacing of a video signal, the video signal including at least two fields of interlaced scan lines, each scan line including a series of pixels having respective intensity values, the method including generating a motion value representative of the motion between successive frames about the pixel, detecting an edge direction about the pixel, performing an edge adaptive interpolation at the pixel, using the detected edge direction, and performing a motion adaptive interpolation at the pixel, using the generated motion value. 
     Embodiments of the invention may include one or more of the following features. The motion value can be generated by comparing segments of pixels about the pixel from successive frames. The segments can include at least two consecutive pixels in a scan line. Generating the motion value can include, for each of a plurality of pixel segments from successive frames about the pixel, calculating a plurality of differences, determining the greatest of the calculated plurality of differences, and determining the motion value from a look-up table using the greatest of the calculated plurality of differences. Whether an edge exists about the pixel can be determined and the look-up table selected from a plurality of look-up tables depending upon whether an edge exists. The motion value can be generated by comparing segments of pixels about the pixel from at least three successive frames. The pixel segments for at least one of the successive frames can be stored in a feature buffer. 
     The edge direction can be detected by forming the respective differences for a first plurality of pixel pairs, each pixel pair comprising two pixels from scan lines respectively above and below the pixel, each pixel pair for the first plurality of pixel pairs having a first common direction, calculating a first combined difference for the first plurality of pixel pairs from the respective differences for the first plurality of pixel pairs, forming the respective differences for a second plurality of pixel pairs, each pixel pair comprising two pixels from scan lines respectively above and below the pixel, each pixel pair for the second plurality of pixel pairs having a second common direction, calculating a second combined difference for the second plurality of pixel pairs from the respective differences for the second plurality of pixel pairs, and comparing the difference between the second combined difference and the first combined difference with an edge threshold to determine whether an edge exists. 
     Each of the first and second plurality of pixel pairs can include at least three pixel pairs. The calculating of the first and second combined differences can include adding the absolute values of each of the respective differences formed from each of the respective pixel pairs for the first and second plurality of pixel pairs, respectively. The first direction can be along an approximate 135 degree angle from vertical at the pixel and the second direction can be along an approximate 45 degree angle from vertical at the pixel. 
     The edge direction detection can further include forming the respective differences for a third plurality of pixel pairs, each pixel pair comprising two pixels from scan lines respectively above and below the pixel, each pixel pair for the third plurality of pixel pairs having a third common direction, calculating a third combined difference for the third plurality of pixel pairs from the respective differences for the third plurality of pixel pairs, and if an edge exists, comparing the third combined difference with the first and second combined differences to determine the edge direction. Each of the third plurality of pixel pairs can include at least three pixel pairs. The calculating of the third combined difference can include adding the absolute values of each of the respective differences formed from each of the respective pixel pairs for the third plurality of pixel pairs. The calculating of the third combined difference can further include multiplying the added absolute values with a sensitivity factor. The third direction can be substantially vertical. 
     The edge adaptive interpolation at the pixel can further include, if the edge direction is substantially vertical, then forming an intermediate pixel value by averaging at least one pixel substantially directly above and at least one pixel substantially directly below the pixel, if the edge direction is approximately 45 degrees from vertical, then forming the intermediate pixel value by averaging at least one pixel above and at least one pixel below the pixel and substantially along a 45 degree axis through the pixel, and if the edge direction is approximately 135 degrees from vertical, then forming the intermediate pixel value by averaging at least one pixel above and at least one pixel below the pixel and substantially along a 135 degree axis through the pixel. 
     The motion adaptive interpolation at the pixel can be performed by multiplying the intermediate pixel value by the motion value and adding the value of the pixel from the next field multiplied by the difference between a maximum motion value and the motion value to form a final interpolated value for the pixel. 
     In general, in another aspect, the invention features apparatus for interpolating a pixel during the deinterlacing of a video signal, the video signal including at least two fields of interlaced scan lines, each scan line including a series of pixels having respective intensity values, the apparatus including a motion value generator configured to generate a motion value representative of the motion between successive frames about the pixel, an edge direction detector configured to detect an edge direction about the pixel, an edge adaptive interpolator configured to perform an edge adaptive interpolation at the pixel, using the detected edge direction, and a motion adaptive interpolator configured to perform a motion adaptive interpolation at the pixel, using the generated motion value. 
     Embodiments of the invention may include one or more of the following features. The motion value generator can compare segments of pixels from successive frames about the pixel to generate the motion value. The segments can include at least two consecutive pixels in a scan line. The motion value generator can further include a difference calculator configured to calculate a plurality of differences for each of a plurality of pixel segments from successive frames about the pixel, a difference comparator configured to determine the greatest of the calculated plurality of differences, and a look-up table of motion value configured to be indexed by the greatest of the calculated plurality of differences from the difference comparator. The motion value generator can further include an edge detector configured to detect whether an edge exists about the pixel, where the look-up table is selected from a plurality of look-up tables depending upon whether an exists. The motion value can be generated by comparing segments of pixels about the pixel from at least three successive frames. A feature buffer can store the pixel segments for at least one of the successive frames. 
     The edge direction detector can further include a first pixel pair comparator configured to form the respective differences for a first plurality of pixel pairs, each pixel pair comprising two pixels from scan lines respectively above and below the pixel, each pixel pair for the first plurality of pixel pairs having a first common direction, a first pixel pair difference calculator configured to calculate a first combined difference for the first plurality of pixel pairs from the respective differences for the first plurality of pixel pairs, a second pixel pair comparator configured to form the respective differences for a second plurality of pixel pairs, each pixel pair comprising two pixels from scan lines respectively above and below the pixel, each pixel pair for the second plurality of pixel pairs having a second common direction, a second pixel pair difference calculator configured to calculate a second combined difference for the second plurality of pixel pairs from the respective differences for the second plurality of pixel pairs, and an edge existence logic configured to compare the difference between the second combined difference and the first combined difference with an edge threshold to determine whether an edge exists. 
     Each of the first and second plurality of pixel pairs can include at least three pixel pairs. The calculating of the first and second combined differences can include adding the absolute values of each of the respective differences formed from each of the respective pixel pairs for the first and second plurality of pixel pairs, respectively. The first direction can be along an approximate 135 degree angle from vertical at the pixel and the second direction can be along an approximate 45 degree angle from vertical at the pixel. 
     The edge direction detector can further include a third pixel pair comparator configured to form the respective differences for a third plurality of pixel pairs, each pixel pair comprising two pixels from scan lines respectively above and below the pixel, each pixel pair for the third plurality of pixel pairs having a third common direction, a third pixel pair difference calculator configured to calculate a third combined difference for the third plurality of pixel pairs from the respective differences for the third plurality of pixel pairs, and an edge direction calculator configured to compare, if an edge exists, the third combined difference with the first and second combined differences to determine the edge direction. The third plurality of pixel pairs can include at least three pixel pairs. The calculating of the third combined difference can include adding the absolute values of each of the respective differences formed from each of the respective pixel pairs for the third plurality of pixel pairs. The calculating of the third combined difference can further include multiplying the added absolute values with a sensitivity factor. The third direction can be substantially vertical. 
     The edge adaptive interpolator can further include logic configured to, if the edge direction is substantially vertical, form an intermediate pixel value by averaging at least one pixel substantially directly above and at least one pixel substantially directly below the pixel, if the edge direction is approximately 45 degrees from vertical, form the intermediate pixel value by averaging at least one pixel above and at least one pixel below the pixel and substantially along a 45 degree axis through the pixel, and if the edge direction is approximately 135 degrees from vertical, form the intermediate pixel value by averaging at least one pixel above and at least one pixel below the pixel and substantially along a 135 degree axis through the pixel. 
     The motion adaptive interpolator can include logic to multiply the intermediate pixel value by the motion value and to add the value of the pixel from the next field multiplied by the difference between a maximum motion value and the motion value to form a final interpolated value for the pixel. 
     Advantages of the invention may include one or more of the following. By smoothly combining both intra-field and inter-field values for each pixel in a frame, weighted by the detected motion at the pixel, the invention can provide for greater accuracy in deinterlacing scanned video signals and greater fidelity in the displayed image, for both static and dynamic portions of scene. Use of inter-field interpolation techniques for pixels having lower motion values allows for higher vertical resolution. Use of intra-field interpolation for pixels with higher motion values reduces unwanted motion effects. Combining both in a linear function, weighted by the detected motion at the pixel, can smoothly provide the best of both techniques. By selecting a motion value look-up table based upon whether an edge is detected at the pixel allows for more accurate motion value determinations. Determining motion values based upon segments of pixels also can increase motion detection accuracy and reduce noise and false motion determinations. Further, since each pixel in a segment will share a common motion value, segmentation sharply reduces the number of motion calculations required per frame. Use of at least three frames of segmented pixel information allows for more accurate motion determinations. Use of segmentation and feature buffers for storing segments of prior frames can reduce the bandwidth required to perform feature buffer reads and writes. It can also eliminate the need to perform segmentation calculations more than once per frame. Interpolating a pixel value along a detected edge provides further accuracy in deinterlacing a video signal. 
     These and other features and advantages of the present invention will become more apparent from the following description, drawings, and claims. 
    
    
     DRAWINGS 
     FIG. 1 is a diagram of even and odd fields in an interlaced scanned video source. 
     FIG. 2 is a flow chart of a motion and edge adaptive deinterlacing method. 
     FIG. 3 is a time diagram of inter-field pixel segments used in a motion detection method. 
     FIG. 4 is a schematic diagram of apparatus for detecting a motion value. 
     FIGS. 5 a  through  5   d  are pixel diagrams illustrating an edge detection method. 
     FIG. 6 is a schematic diagram of apparatus for detecting edges. 
     FIG. 7 is a prior art frame buffer for frame displays. 
     FIG. 8 is a frame buffer providing feature buffers for real-time motion and edge adaptive deinterlacing. 
    
    
     DESCRIPTION 
     FIG. 1 shows diagrams of an even field  10  and an odd field  12  of a typical interlaced scanned video source. Even field  10  consists of even scanning lines  0 ,  2 , and  4 , etc. while odd field  12  consists of odd scanning lines  1 ,  3 , etc. A typical NTSC television video source consists of 525 lines divided in this manner. Even field  10  is scanned at time t=t 1  while odd filed  12  is scanned at later time t=t 2 . To construct a complete frame from, e.g., the even field  10 , each missing line (e.g., line  3 ) must be reconstructed. Solid lines in FIG. 1 represent existing scanned lines in a given field, while dashed lines depict missing lines that require reconstruction. 
     As an example, each pixel element X along line  3  of even field  10  must be reconstructed. One can simply use pixel elements C 1 , C 2 , and C 3 , etc. from the next odd field  12 , but such a simple inter-field technique can introduce motion effects as described. Or one can simply interpolate the missing elements C 1 , C 2 , and C 3  using the intra-field neighboring pixel values A 1 , A 2 , A 3  and B, B 2 , B 3 , etc. But such intra-field techniques do not provide high vertical resolution and can produce jagged aliasing artifacts along diagonal edges. 
     FIG. 2 shows a flow chart of a powerful, general purpose deinterlacing method  20  that improves vertical resolution for areas of a frame that have less motion and reduces unwanted motion effects in other areas that have greater motion. First, for each pixel X a motion value is detected using the information from a succession of frames (step  22 ). In a preferred embodiment, the motion value is a 4 bit integer having values  0  through  15  proportional to the motion level of the scene around pixel X. Second, an edge direction is generated for pixel X using the intensity values of neighboring pixels around pixel X within its own frame (step  24 ). In one embodiment, the edge direction can be defined as generally 45 degrees, 135 degrees, or no edge (also 90 degrees). Third, an intermediate interpolated value for the pixel is determined by using the edge direction data and certain neighboring pixel values around pixel X (step  26 ). Fourth, a final pixel value for pixel X is defined by a linear combination of the intermediate interpolated value and the value for pixel X from the next field, each component weighted by the detected motion value (step  28 ). 
     Referring to FIGS. 3 and 4, the motion value for a pixel X is generated by analyzing groups of pixels around pixel X for a succession of fields. In one embodiment, six fields are consulted: field  0  (item  100 ) and field  1  (item  101 ) are two frames prior to the current frame, field  2  (item  102 ) and field  3  (item  103 ) are one frame prior to the current frame, and field  4  ( 104 ) and field  5  ( 105 ) comprise the current frame. In addition, segments of pixels ( 110   a  through  110   i ) from these fields, rather than individual pixels, are compared to detect the motion value. In one embodiment, each segment  110  comprises four contiguous pixels in a scanning line, averaged into one intensity value. Any number of pixels greater than one can be segmented in this manner. 
     Each segment used in the motion value calculation for pixel X is generally either adjacent to or contains pixel X. For example, segment A ( 110   a ) from field  4  of the current frame is a segment of pixels above pixel X, while segment G ( 110   g ) from the same field is a segment of pixels below pixel X. And segment D ( 110   d ) is from the next field  5  of the same frame, and contains pixel X. 
     Segmenting pixels together for performing motion detection has several advantages. First, it reduces noise and increases motion detection accuracy. Second, each of the pixels (e.g., four) within a segment will share the same motion value, so that motion calculations need be done only, e.g., once every four pixels. And third, as described further below, since motion calculations require comparing several frames of segment information, segmentation allows storage of prior field information in a more compact form, e.g., in feature buffers. 
     Referring to FIG. 4, the motion value detection method  200  is shown schematically. The motion value detection method can be implemented in any convenient manner, e.g., in software on a general purpose computer, or in dedicated hardware. In a preferred embodiment, after segmenting each required block of pixels (logical blocks  202   a  through  202   i ) the differences between respective pairs of segments of pixels adjacent (or containing) pixel X from successive fields are determined. For example, segment A ( 110   a ) from current even field  4  is subtracted (block  204   a ) from segment B ( 110   b ) of prior even field  2 , and the absolute value of the result (block  206   a ) is determined. Similarly, the absolute value (block  206   b ) of the difference (block  204   b ) of segment B ( 110   b ) of prior even field  2  and segment C ( 110   c ) of earlier even field  0  is determined. In likewise fashion, segment E ( 110   e ) is subtracted from segment D ( 110   d ), segment F ( 110   f ) is subtracted from segment E ( 110   e ), segment H ( 110   h ) is subtracted from segment G ( 110   g ), and segment I ( 110   i ) is subtracted from segment H ( 110   h ) (blocks  202   c  through  202   f ). The absolute value of each of these differences is determined next (blocks  206   c  through  206   f ). Then the maximum of these absolute difference values is determined (block  208 ). The resulting maximum difference value (Max Intersegment Difference) is then used as an index to a reloadable look-up table of motion values (block  210 ) to output a final motion value  216 . In one embodiment, each pixel (and each averaged pixel segment) has 8 bit intensity values (that is, from 0 to 255) and the motion value  216  is a 4 bit number having values from 0 to 15. 
     In one embodiment, a different look-up table can be loaded depending upon whether an edge is detected around pixel X or not. For example, the difference between segments A ( 110   a ) and G ( 110   g ) of the current even field  4  can be determined (block  204   g ), and the absolute value of the result compared against an edge threshold value in an edge detection step (block  214 ) to determine if there is a sharp difference from above and below pixel X. This determines whether there is an intra-field vertical edge at pixel X. 
     If no edge is detected, the look-up table can be a simple function: 
     Motion[ 3 : 0 ]=Max Intersegment Difference, if less than or equal to 15; and 
     Motion[ 3 : 0 ]=15 for all other values of Max Intersegment Difference. 
     If an edge (e.g., an intra-field vertical edge) is detected, the effective motion value can be reduced, for example: 
     Motion[ 3 : 0 ]=½ Max Intersegment Difference, if less than or equal to 31; and 
     Motion[ 3 : 0 ]=15 for all other values of Max Intersegment Difference. 
     Using a different look-up table (having reduced motion values) when an edge is detected can generate a more accurate interpolation result. As made clearer with respect to the interpolation calculations described below, if an edge is detected, and a reduced motion value is retrieved from the alternative look-up table, the deinterlacing calculation will generate the intensity of pixel X by taking more of its value from the next field and using less interpolation from the existing pixels surrounding pixel X in its current field, which might otherwise “soften” the edge and produce, in general, a less accurate result. 
     A variety of look-up tables for motion values can be used depending upon implementation. For example, the motion value can be a full 8 bit number, fully mapping to the scale of maximum intensity differences generated between successive pixel segments. Also, more elaborate edge detection algorithms (as described further below) can be used to select from different look-up tables depending upon edge direction. 
     After the motion value is generated (step  22  of FIG.  2 ), the direction of an edge adjacent pixel X (if any) is determined (step  24  of FIG.  2 ). Referring to FIGS. 5 a  through  5   d,  edge detection is performed on groups of pixels  250  above and below pixel X. As shown in FIG. 5 a,  scan line  252  above pixel X includes five pixels A 0  through A 5  and scan line  254  below pixel X includes five pixels B 0  through B 5 . Referring to FIG. 5 b,  the edge detection algorithm first computes the respective differences between three pairs of pixels about pixel X ( 256   a ,  256   b , and  256   c ), along a 135 degree axis (as measured from vertical), each pair comprising one pixel from scan line  252  and one from scan line  254 . The absolute values of these respective differences are then summed to yield a Diff 135  value: 
     
       
         Diff 135 =| A   0   −B   2   |+|A   1   −B   3   |+|A   2   −B   4 | 
       
     
     Similarly, referring to FIG. 5 c,  the edge detection algorithm next computes the respective differences between three pairs of pixels about pixel X ( 258   a,    258   b,  and  258   c ), along a 90 degree (or vertical) axis. The absolute values of these respective differences are then summed to yield a Diff 90  value: 
     
       
         Diff 90 =| A   1   −B   1   |+|A   2   −B   2   |+|A   3   −B   3 |·Factor 
       
     
     where Factor is a sensitivity constant that reduces the sensitivity of the Diff 90  calculation. In one embodiment, Factor=0.75. 
     And, referring to FIG. 5 d,  the edge detection algorithm next computes the respective differences between three pairs of pixels about pixel X ( 260   a,    260   b,  and  260   c ), along a 45 degree axis. The absolute values of these respective differences are then summed to yield a Diff 45  value: 
     
       
         Diff 45 =|A 2   −B   0   |+|A   3   +B   1   |+|A   4   −B   2 | 
       
     
     These three comparisons of pixel pairs along three different directions about pixel X (the pixel to be interpolated) are then compared to determine the existence and direction of an edge about pixel X. 
     First, Diff 45  and Diff 135  are compared against an edge threshold to determine if a substantially non-vertical edge exists: 
     IF |Diff 45 −Diff 135 |&gt;Edge_Threshold THEN Edge_Exist 
     where Edge_Threshold is another sensitivity factor for deciding edge existence. In one embodiment, Edge_Threshold=32. Both Edge Threshold and Factor can be adjusted to account for scenes with a higher level of detail that might generate false edge indications. In particular, edge calculations should generally not determine that small details such as thin lines are edges. The sensitivity constant Factor can account for instances where, e.g., a single thin line would generate a high 90 degree difference across pixel sets, but low 45 degree and 135 differences, thereby possibly generating a false edge. 
     The default condition for the edge detection algorithm is no edge (or a 90 degree edge). The edge detection algorithm uses the Diff 45 , Diff 90 , and Diff 135  results to determine the direction of an existing edge: 
     IF ((Diff 45 &lt;=Diff 90 ) AND (Diff 45 &lt;=Diff 135 ) AND Edge_Exist) 
     THEN Edge[ 1 : 0 ]=10; 
     ELSE 
     IF ((Diff 135 &lt;=Diff 90 ) AND (Diff 135 &lt;=Diff 45 ) AND Edge_Exist) 
     THEN Edge[ 1 : 0 ]=11; 
     ELSE Edge[ 1 : 0 ]=00. 
     where Edge[ 1 : 0 ] is a two bit binary code for edge conditions: Edge[ 1 : 0 ]=00 in binary indicates no (or a vertical) edge, Edge[ 1 : 0 ]=10 indicates an edge substantially along the 45 degree axis; and Edge[ 1 : 0 ]=11 indicates an edge substantially along the 135 degree axis. Any other convention for defining Edge can be used as well. 
     FIG. 6 represents a schematic diagram  300  for implementing the edge detection algorithm. Diff 135  is calculated first by calculating the respective differences of three pixel pairs (A 0 −B 2 , A 1 −B 3 , A 2 −B 4 ) (in logical blocks  302   a  through  302   c ), taking the absolute value of those differences (blocks  304   a  through  304   c ), and then summing the results (block  306   a ). Diff 90  is calculated by calculating the respective differences of three other pixel pairs (A 1 −B 1 , A 2 −B 2 , A 3 −B 3 ) (in blocks  302   d  through  302   f ), taking the absolute value of those differences (blocks  304   d  through  304   f ), summing the results (block  306   b ), and then multiplying by Factor  310  (block  308 ). And Diff 45  is calculated first by calculating the respective differences of three other pixel pairs (A 2 −B 0 , A 3 −B 1 , A 4 −B 2 ) (in blocks  302   g  through  302   i ), taking the absolute value of those differences (blocks  304   g  through  304   i ), and then summing the results (block  306   c ). 
     The difference between Diff 135  and Diff 45  is then determined (block  312 ), and the absolute value of the result (block  314 ) is compared with an edge threshold  318  to determine whether Edge Exist is TRUE (block  316 ). Then Diff 90 , Diff 135 , Diff 45 , and the Edge_Exist signal are provided to compare and decode logic  320  which performs the comparisons described above to produce a final Edge[ 1 : 0 ] signal  322 . 
     After Edge[ 1 : 0 ] and Motion[ 3 : 0 ] have been determined (which can be accomplished in any order or in parallel), an intermediate intra-field interpolation result M_Data for pixel X is calculated (step  26  of FIG. 2) as follows: 
     IF Edge[ 1 : 0 ]=00 (a 90 degree or no edge), 
     THEN M_Data=A 2 /2+B 2 /2; 
     IF Edge[ 1 : 0 ]=10 (a 45 degree edge), 
     THEN M_Data=A 3 /2+B 1 /2; and 
     IF Edge[ 1 : 0 ]=11 (a 135 degree edge), 
     THEN M_Data=A 1 /2+B 3 /2; 
     These calculations interpolate the value for pixel X based upon the values along the detected edge, providing for more accurate edge depiction. 
     Finally, the intra-field interpolation result is mixed with the value C 2  for pixel X obtained from the next field (e.g., odd field  12  in FIG.  1 ): 
     IF (Motion=15) THEN X=M_Data; 
     Else X=((16−Motion[ 3 : 0 ])·C+(Motion·M_Data))/16. 
     Since Motion is a 0 to 15 valued integer, if Motion is high, most of pixel X is determined by the intra-field result M_Data. If Motion is very low, all of the value of pixel X is determined from its value C in the next field. 
     By smoothly combining both intra-field and inter-field values for each pixel in a frame, weighted by the detected motion at the pixel, the present methods provide for greater accuracy in deinterlacing scanned video signals and greater fidelity in the displayed image, for both static and dynamic portions of scene. 
     In addition to the logical hardware shown in FIGS. 4 and 6, it can be useful to provide for memory storage of prior frame information for performing motion calculations. As shown in FIG. 7, for a number of video applications (for example, in typical PC graphics processors and video cards) a frame buffer  400  comprises two buffers (here termed Surface A  402  and Surface B  404 ) that hold sequential video frames. One buffer is written to by a capture processor or the like, while the other buffer is read out to the display processor  406  for display upon the video screen. This ensures that the memory being read out is not tampered with by memory writes for the next frame. Double buffers are especially useful in implementations where the input vertical synchronization is different from the output vertical synch signal. In typical double buffering, though, the display processor has no access to the prior frame of information. 
     As shown in FIG. 8, to enable motion detection for several prior frames of pixel information, one embodiment of the present invention employs two feature buffers, feature buffer A  508   a  and feature buffer B  508   b.  For each frame that is displayed, display processor  506  extracts pertinent features of the current frame and writes it back to frame buffer  500 , storing it in one of the feature buffers  508   a  or  508   b.  In this manner, the two feature buffers will store two prior frame&#39;s worth of pertinent feature information that can be used by the motion detector during motion calculations to generate motion values for each pixel of a current frame. 
     As described above, during motion detection the present invention uses segmentation to average four contiguous pixels into one averaged pixel segment. These segments are then compared, as described above. One convenient result of segmentation is that only the calculated pixel segments for a current frame need be stored in the feature buffers  508   a  and  508   b.  This reduces the bandwidth required to perform feature buffer reads and writes. It also eliminates the need to perform segmentation calculations more than once per frame. As described above, determining motion values based upon segments of pixels also can increase motion detection accuracy and reduce noise and false motion determinations. Further, since each pixel in a segment will share a common motion value, segmentation sharply reduces the number of motion calculations required per frame. As noted above, each segment can have any number of pixels: four was selected here for one embodiment of the invention. 
     Other embodiments are within the scope of the claims. For example, any of the logical blocks can be implemented in a variety of ways. For example, the functions of various blocks can be combined with one another into any other number of modules. Each module can be implemented as a software program stored on a tangible memory (e.g., random access memory, read only memory, CD-ROM memory, hard disk drive) to be read by a central processing unit to implement the functions of the present invention. Or, the modules can comprise programming instructions transmitted to a general purpose computer or to graphics processing hardware via a transmission carrier wave. Also, the modules can be implemented as hardware logic circuitry implementing the functions encompassed by the present invention. Any number of pixels can be combined into segments used for the motion detection calculations. Any number of prior frames can be used to detect motion at a pixel location. Any number of pixel pairs can be used for edge detection. Other edge directions can be determined by using different selections of pixel pairs. Different groups of pixels can be selected to determine edge directions and/or interpolate values. Different motion factors and edge thresholds can be selected to adjust the sensitivity of the calculations. The deinterlacing methods and apparatus can be used for both digital and analog video signals, in particular for noninterlaced television applications.