Abstract:
A method of temporal error concealment for generating the image data of the missing macro-blocks in the current frame by using the previous frame and the correct data of the current frame is disclosed. The method includes the steps: first using Optimal Regression Plane to estimate the space motion vectors for each block in the missing macro-blocks; selecting appropriate motion vectors from the estimated space motion vectors and the correct temporal motion vectors in the previous frame as the candidate motion vectors; dividing the missing macro-block into sub-blocks with optimal size; fine tuning the candidate motion vectors as the predicted motion vectors; and using the predicted motion vectors to generate the predicted image data for the missing macro-block and further concealing the effect of the missing macro-blocks upon the image quality of the current frame. The method reduces the computation time, speeds up the process, and improves the image quality.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates generally to a seamless wireless video transmission for multimedia applications, and more particularly, to a temporal error concealment (TEC) method for concealing a temporal error of an image frame caused by a missing macroblock. 
     2. The Prior Arts 
     Image transmission service including video meeting, website browsing, image file transmission, is a very important service provided by communication and IT enterprises. Typically, an original image file desired to be transmitted is often too large to be effectively transmitted over the internet, or often occupies too much memory space of the storage device. As such, an image file is often performed with a coding process with a high compression ratio and a low loss ratio before transmission for reducing the size of the image data. Such a coding process may be selected from TIFF, JPEG, MJEP, MPEG, H.264/AVC, in accordance with the demands of the system for the image compression ratio, the loss ratio, so as to obtain an optimal algorithm for static images or continuous images. 
     However, when being transmitted, the encoded image file is often interfered by the transmission interface or the electrical system of the receiving end. Such interferences usually cause damages or errors of the image file data, so that the receiving end becomes incapable of decoding and recovering the encoded image file back to original by a predetermined corresponding decoding method. 
     In accordance with psychology of vision, an individual edge would not affect visional recognition. However, such an individual edge may be mutually affected with edges adjacent thereto so as to generate a composition effect. In this concern, human vision is more sensitive to edge distortions. Generally, edge distortions include blurred edges and newly created false edges. As such, it is very important to maintain original edges and avoid the creation of false edges when executing an image process. 
     A method of recovering or obtaining image data of a missing macroblock according to image data of correct macroblocks of a same frame of the missing macroblock is generally called the SEC method. 
     There are many algorithms of conventional technologies have been proposed for SEC, such as bilinear interpolation (BI), directional interpolation (DI), and best neighborhood matching (BNM). However, all these SEC methods require a large amount of interpolation computation, and often consume much time, and therefore are often believed to be less efficient. Such SEC methods are usually applied for a first image of consecutive images, because the first image has no previous frame to refer to. 
     A further method proposed as another solution is called the TEC method. According to the TED method, a motion vector of a missing macroblock can be achieved by referring to a correct image data of a previous frame. Then, a reference frame is moved according to the motion vector, and therefore the image data of the missing macroblock can be thus obtained. In such a way, the negative affection to the entire image frame caused by the missing macroblock can be concealed. 
     In conventional TEC methods, a zero motion vector, neighboring motion vectors (motion vectors), an available motion vector of a spatially corresponding macroblock in a previous frame, or a median (or an average) of spatially adjacent motion vectors can be used. A TEC method called motion field interpolation method is recently proposed. According to the motion field interpolation method, a best motion vector is determined from the above candidate motion vectors by the boundary matching algorithm (BMA), which calculates the minimum sum of absolute differences (SAD) along the one-pixel-wide boundary between the missing macroblock and its candidate replacements in the H.264 JM decoder. 
     However, the conventional technology usually calculates an optimal motion vector by complex computation, which requires a large amount of computation and consumes much time, and negatively affects the overall decoding efficiency. 
     As such, an efficient TEC method which is demanded for obtaining decoded images while reducing the amount of computation, as a solution to the difficulty of the conventional technology. 
     SUMMARY OF THE INVENTION 
     A primary objective of the present invention is to provide a temporal error concealment (TEC) method for obtaining an image data of a missing macroblock by referring to a correct image data of a previous image frame and a correct image data of the current image frame, thus concealing a spatial error image data of the missing macroblock of an encoded image frame. 
     A further objective of the present invention is to provide a TEC method. The TEC method uses a multiple polynomial regression equation to construct an optimal regression (OR) plane of the motion vectors of the missing block according to boundary blocks of the missing macroblock, so as to predict a spatial motion vector of each block of the missing macroblock. The predicted spatial motion vectors serve as highly spatial correlated motion vectors. 
     A still further objective of the present invention is to provide a TEC method for selecting an optimal candidate motion vector. With respect to high spatially correlated spatial motion vectors and high temporally correlated temporal motion vectors of corresponding blocks in a previous frame, the TEC method estimates each spatial motion vector and each temporal motion vector by adjacent external boundary matching errors (AEBME), according to a boundary matching algorithm (BMA), so as to select an motion vector having a least AEBME as a candidate motion vector. 
     A further objective of the present invention is to provide a TEC method. The TEC method includes dividing the missing macroblock into blocks of 16×16, 8×16, 16×8, or 8×8 pixels according to the Laplacian distribution of a motion field composed by candidate motion vectors. Then the TEC method selects blocks of a maximum probability according to the Bayes principle and a Laplacian-modeled motion filed, i.e., blocks of 16×16, 8×16, 16×8, or 8×8 pixels. If the missing macroblock has a relatively regular motion, then larger blocks, e.g., blocks of 16×16 pixels, are more suitable for subsequent motion refinement. On the contrary, if the missing macroblock has a relatively complex motion, the smaller blocks, e.g., blocks of 8×8 pixels, are more suitable for subsequent motion refinement. 
     A furthermore objective of the present invention is to provide a TEC method, for fine tuning candidate motion vectors to obtain motion vectors of the missing macroblocks, by a rapid searching comparison. With respect to sub-macroblocks of a best missing macroblock of the blocks of different sizes, the TEC method utilizes a spiral scanning path starting from an average motion vector to achieve a first AEBME, sequentially according to the corresponding AEBME values, along motion vectors of all boundary blocks, thus obtaining an adaptive search range (ASR). If the ASR is equal to or less than a threshold value, the motion vector is taken as a motion vector of the missing macroblock, and the threshold value is determined by a proximity of the AEBME value to an original residual value of a sum of absolute differences (SAD). The image data of the missing macroblock can be obtained by moving the candidate macroblock to the position of the missing macroblock according to the motion vector, and thus concealing the negative affection caused by the missing macroblock to the entire image frame. 
     The TEC method according to the present invention not only saves the computation time and accelerates the processing speed, but also provides a high efficient image decoding method. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The present invention will be apparent to those skilled in the art by reading the following detailed description of a preferred embodiment thereof, with reference to the attached drawings, in which: 
         FIG. 1  is a flow chart illustrating a TEC method according to an embodiment of the present invention; 
         FIG. 2  is a schematic diagram illustrating boundary blocks according to an embodiment of the present invention; 
         FIG. 3  is a schematic diagram illustrating boundary blocks according to an embodiment of the present invention; 
         FIG. 4  is a schematic diagram illustrating a boundary matching algorithm (BMA) and related blocks according to a conventional technology; 
         FIG. 5  is a schematic diagram illustrating boundary blocks according to an embodiment of the present invention; 
         FIG. 6  is a schematic diagram illustrating a spiral scanning path according to an embodiment of the present invention; and 
         FIG. 7  is a data plot diagram of the TEC method of the present invention. 
     
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention. 
     We assume that all missing macroblocks have been accurately detected, and all boundary blocks surrounding the missing macroblock contain correct image data including motion vectors. Referring to  FIG. 1 , there is shown a flow chart illustrating a TEC method according to an embodiment of the present invention. The flow chart includes steps S 100  through S 280 , to be discussed in more details herebelow. 
     First, at step S 100 , an optimal regression (OR) plane is set up according to motion vectors of the boundary blocks. An N-pixel-wide block group surrounding the missing macroblock includes a plurality of N×N pixel-wide blocks, in which N is a positive integer. As shown in the drawing, the embodiment is exemplified with N=4 for illustration. However, in other embodiments, N can be any other positive integers other than 4. 
       FIG. 2  is a schematic diagram illustrating boundary blocks according to an embodiment of the present invention. Referring to  FIG. 2 , it shows a missing macroblock  20  including 16 missing blocks, i.e., DB 1 , DB 2 , . . . , DB 16 . The missing blocks are surrounded by 16 boundary blocks, i.e., BB 1 , BB 2 , . . . , BB 16 . Further, each of the boundary blocks BB 1 , BB 2 , . . . , BB 16 , has a corresponding motion vectors, motion vector 1  through motion vector 16 , respectively, for representing a temporal correlation with a previous frame. 
     For convenience of illustration, a coordinate system is set up in  FIG. 2 , in which a center of the missing macroblock  20  is set as an origin of coordinate, i.e., P 0  (0, 0), and a pixel is defined as a unit of length. In this case, coordinates of the boundary blocks BB 1  through BB 16  are: 
     BB 1  (x 1 , y 1 )=(−6, 10) 
     BB 2  (x 2 , y 2 )=(−2, 10) 
     BB 3  (x 3 , y 3 )=(2, 10) 
     BB 4  (x 4 , y 4 )=(6, 10) 
     BB 5  (x 5 , y 5 )=(10, 6) 
     BB 6  (x 6 , y 6 )=(10, 2) 
     BB 7  (x 7 , y 7 )=(10, −2) 
     BB 8  (x 8 , y 8 )=(10, −6) 
     BB 9  (x 9 , y 9 )=(6, −10) 
     BB 10  (x 10 , y 10 )=(2, −10) 
     BB 11  (x 11 , y 11 )=(−2, −10) 
     BB 12  (x 12 , y 12 )=(−6, −10) 
     BB 13  (x 13 , y 13 )=(−10, −6) 
     BB 14  (x 14 , y 14 )=(−10, −2) 
     BB 15  (x 15 , y 15 )=(−10, 2) 
     BB 16  (x 16 , y 16 )=(−10, 6); 
     and the motion vectors thereof are marked at centers of the corresponding boundary blocks. 
     The OR plane is constructed by a multiple polynomial regression model of equation (1): Z(x, y)=c+a 1 x+a 2 x 2 +b 1 y+b 2 y 2 , in which Z represents the motion vectors, and a 1 , a 2 , b 1 , b 2 , c are coefficients to be determined. 
     After regression analysis, an equation (2) as following can be obtained. 
     
       
         
           
             
               
                 
                   
                     Z 
                     ⁡ 
                     
                       ( 
                       
                         x 
                         , 
                         y 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       
                         [ 
                         
                             
                         
                         ⁢ 
                         
                           
                             1 
                             106496 
                           
                           ⁢ 
                           
                             
                               ∑ 
                               
                                 i 
                                 = 
                                 1 
                               
                               16 
                             
                             ⁢ 
                             
                               
                                 MV 
                                 i 
                               
                               · 
                               
                                 ( 
                                 
                                   
                                     27 
                                     ⁢ 
                                     
                                       x 
                                       i 
                                       2 
                                     
                                   
                                   + 
                                   
                                     25 
                                     ⁢ 
                                     
                                       y 
                                       i 
                                       2 
                                     
                                   
                                   - 
                                   3120 
                                 
                                 ) 
                               
                             
                           
                         
                         ] 
                       
                       ⁢ 
                       
                         x 
                         2 
                       
                     
                     + 
                     
                         
                       
                         
                           
                             [ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 1 
                                 960 
                               
                               ⁢ 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   16 
                                 
                                 ⁢ 
                                 
                                   
                                     MV 
                                     i 
                                   
                                   · 
                                   
                                     x 
                                     i 
                                   
                                 
                               
                             
                             ] 
                           
                           ⁢ 
                           x 
                         
                         + 
                         
                           
                             [ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 1 
                                 106496 
                               
                               ⁢ 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   16 
                                 
                                 ⁢ 
                                 
                                   
                                     MV 
                                     i 
                                   
                                   · 
                                   
                                     ( 
                                     
                                       
                                         25 
                                         ⁢ 
                                         
                                           x 
                                           i 
                                           2 
                                         
                                       
                                       + 
                                       
                                         25 
                                         ⁢ 
                                         
                                           y 
                                           i 
                                           2 
                                         
                                       
                                       - 
                                       3120 
                                     
                                     ) 
                                   
                                 
                               
                             
                             ] 
                           
                           ⁢ 
                           
                             y 
                             2 
                           
                         
                         + 
                         
                             
                           
                             
                               
                                 [ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     1 
                                     960 
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         i 
                                         = 
                                         1 
                                       
                                       16 
                                     
                                     ⁢ 
                                     
                                       
                                         MV 
                                         i 
                                       
                                       · 
                                       
                                         y 
                                         i 
                                       
                                     
                                   
                                 
                                 ] 
                               
                               ⁢ 
                               y 
                             
                             - 
                             
                               
                                 1 
                                 512 
                               
                               ⁢ 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   16 
                                 
                                 ⁢ 
                                 
                                   
                                     MV 
                                     i 
                                   
                                   · 
                                   
                                     ( 
                                     
                                       
                                         15 
                                         ⁢ 
                                         
                                           x 
                                           i 
                                           2 
                                         
                                       
                                       + 
                                       
                                         15 
                                         ⁢ 
                                         
                                           y 
                                           i 
                                           2 
                                         
                                       
                                       - 
                                       1832 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
     A curved plane defined by the equation (2) is the desired OR plane.  FIG. 3  is a schematic diagram illustrating boundary blocks according to an embodiment of the present invention. Referring to  FIG. 3 , at step S 110 , corresponding predicted spatial motion vectors of the missing blocks DB 1  through DB 16  can be obtained by the equation (2). 
     At step S 120 , temporal motion vectors are set up according to a previous image frame, i.e., taking motion vectors of the missing macroblock in the previous image frame at corresponding positions as high temporal correlated motion vectors. 
     At step S 130 , candidate motion vectors are constructed according to the boundary matching algorithm (BMA). As discussed above, the spatial motion vectors are obtained at step S 110 , the temporal VMs are obtained at step S 120 , and now at the current step, a quantitative difference between each spatial motion vector and each temporal motion vector can be estimated by the adjacent external boundary matching errors (AEBME). The motion vector having a least AEBME is selected as the candidate motion vector. 
       FIG. 4  is a schematic diagram illustrating a boundary matching algorithm (BMA) and related blocks according to a conventional technology. Referring to FIG.  4 , the 16 missing blocks of the missing macroblock  20  are renamed with A 00 , A 01 , A 110 , A 11 , B 00 , B 01 , B 10 , B 11 , C 00 , C 01 , C 10 , C 11 , D 00 , D 01 , D 10 , D 11 , for the convenience of illustration. 
     The missing blocks A 11 , B 11 , C 11 , D 11  locate at an inside layer of the missing macroblock  20 , and are not neighboring to the boundary blocks having correct image data. The rest missing blocks locate at an outside layer of the missing macroblock  20 , and are neighboring to the boundary blocks having correct image data. In the current embodiment, only the missing blocks A 00 , A 01 , A 10 , A 11  are illustrated, and the other missing blocks can be learnt by referring to the illustration of the missing blocks A 00 , A 01 , A 10 , A 11 , according to the symmetrical relation between the missing blocks. 
     The missing block A 00  is neighboring to the boundary blocks BB 1  and BB 16 , and an AEBME 00  value can be obtained according to equation (3): 
                       A   ⁢           ⁢   E   ⁢           ⁢   B   ⁢           ⁢   M   ⁢           ⁢     E   00       =         ∑     i   =   1     M     ⁢       ∑     x   =     x   0           x   0     -   N   -   1       ⁢              A   00     ⁡     (     x   ,       y   0     +   i       )       -     R   ⁡     (       x   +   v     ,       y   0     +   i   +   u       )                  +       ∑     i   =   1     M     ⁢       ∑     y   =     y   0           y   0     -     (     N   -   1     )         ⁢              A   00     ⁡     (         x   0     -   i     ,   y     )       -     R   ⁡     (         x   0     -   i   +   v     ,     y   +   u       )                      ,           (   3   )               
in which A 00 (x, y) represents the pixels of the missing block A 00  in the present frame, R(x, y) represents the pixels of the previous frame, (x 0 , y 0 ) is the coordinate of the missing block A 00 , (v, u) represents the spatial or temporal motion vector, N represents a quantity of the missing blocks (i.e., 4 in the current embodiment), and M represents a pixel width of the external boundary (i.e., 4 pixels in the current embodiment).
 
     The missing block A 10  is neighboring to the boundary blocks BB 15 , and an AEBME 10  value can be obtained according to equation (4): 
                       A   ⁢           ⁢   E   ⁢           ⁢   B   ⁢           ⁢   M   ⁢           ⁢     E   10       =       ∑     i   =   1     M     ⁢       ∑     y   =     y   0           y   0     -     (     N   -   1     )         ⁢              A   10     ⁡     (         x   0     -   i     ,   y     )       -     R   ⁡     (         x   0     -   i   +   v     ,     y   +   u       )                    ,           (   4   )               
in which, A 10 (x, y) represents the pixels of the missing block A 10  in the present frame. Similarly, an AEBME 01  value of the missing block A 01  neighboring to the boundary block BB 2  can be obtained in like manner.
 
     The missing blocks A 11 , B 11 , C 11 , D 11  in the inside layer are not neighboring to any blocks having correct image data, and therefore they are determined with candidate motion vectors by majority decision according to missing blocks adjacent thereto. 
     At step S 140 , according to a complexity of each candidate motion vector of the missing macroblock, the missing blocks are divided into a plurality of sub-macroblocks having optimal sizes, e.g., sub-macroblocks having 16×16, 16×8, 8×16, or 8×8 pixels as shown in  FIG. 5 , in which T 1  represents 16×16 sub-macroblocks, T 2  represents 16×8 sub-macroblocks, T 3  represents 8×16 sub-macroblocks, and T 4  represents 8×8 sub-macroblocks. According to the Laplacian distribution of the motion field constituted by the candidate motion vectors, one having the maximum probability is selected from the T 1 , T 2 , T 3 , and T 4  sub-macroblocks by Bayes principle. If the missing macroblock has a relatively regular motion, then larger sub-macroblocks, e.g., sub-macroblocks of 16×16 pixels, are more suitable for subsequent motion refinement. On the contrary, if the missing macroblock has a relatively complex motion, the smaller sub-macroblocks, e.g., sub-macroblocks of 8×8 pixels, are more suitable for subsequent motion refinement. 
     The sub-macroblock having the maximum probability can be determined by equation (5): 
                 T   ^     =     max   ⁢     {     P   ⁡     (       T   j     |   mv     )       }         ,     
     ⁢       j   ∈     {     1   ,   2   ,   3   ,   4     }       =       max   ⁢     {       P   ⁡     (       T   j     ⋂   mv     )         P   ⁡     (   mv   )         }       =     max   ⁢     {         P   ⁡     (     mv   |     T   j       )       ⁢     P   ⁡     (     T   j     )           P   ⁡     (   mv   )         }           ,         
in which P(T j ) represents a probability of a sub-macroblock T j , and mv represents a motion vector motion vector.
 
     Equation (5) can be further expressed in a form of equation (6): 
                             T   ^     ′     =     max   ⁢     {     P   ⁡     (     mv   |     T   j       )       }                   =     max   ⁢     {       ∏     k   =   1       N   j       ⁢           ⁢     P   ⁡     (       mv   k     |     B     k   ,   j         )         }                     =     max   ⁢     {       ∏     k   =   1       N   j       ⁢           ⁢     [       ∏       mv   k     ∈     B     k   ,   j           ⁢           ⁢       P   ⁡     (       mv   k   x     |     B     k   ,   j         )       ·     P   ⁡     (       mv   k   y     |     B     k   ,   j         )           ]       }         ,                 (   6   )               
in which B k,j  represents the kth partition in the sub-macroblock T j , mv k  represents the motion vectors of the partition B k , mv k   x  represents a horizontal component of the motion vector (mv k ), mv k   y  represents a vertical component of the motion vector (mv k ), N j  represents the number of partitions in the missing macroblock, in which N j =1 corresponding T 1 , N j =2 corresponding T 2 , N j =2 corresponding T 3 , N j =4 corresponding T 4 .
 
     According to equation (6), equation (7) can be obtained by the Laplacian-modeled motion field: 
                             T   ^     ′     =     max   ⁢     {       ∏     k   =   1       N   j       ⁢           ⁢     [       ∏       mv   k     ∈     B     k   ,   j           ⁢           ⁢       P   ⁡     (       mv   k   x     |     B     k   ,   j         )       ·     P   ⁡     (       mv   k   y     |     B     k   ,   j         )           ]       }                     =     max   ⁢     {       ∏     k   =   1       N   j       ⁢           ⁢     [             ∏       mv   k     ∈     B     k   ,   j           ⁢           ⁢       1     2   ⁢     σ   k   x         ⁢       exp   ⁡     (       -            mv   k   x     -     μ   k   x                σ   k   x       )       ·                     1     2   ⁢     σ   k   y         ⁢     exp   ⁡     (       -            mv   k   y     -     μ   k   y                σ   k   y       )               ]       }         ,                 (   7   )               
in which μ k   x  represents the average horizontal component, μ k   y  represents the average vertical component, while σ k   x  and σ k   y  can be expressed by:
 
                 σ   k   x     =       1       2   ⁢   a         ⁢       ∑       mv   k     ∈     B     k   ,   j           ⁢            mv   k   x     -     μ   k   x                  ;       μ   k   x     =     median   ⁢     {     mv   k   x     }                         σ   k   y     =       1       2   ⁢   a         ⁢       ∑       mv   k     ∈     B     k   ,   j           ⁢            mv   k   y     -     μ   k   y                  ;       μ   k   y     =     median   ⁢       {     mv   k   y     }     .               
When taking a natural log to the above equation, we obtain equation (8):
 
     
       
         
           
             
               
                 T 
                 ^ 
               
               ′ 
             
             ≈ 
             
               
                 max 
                 j 
               
               ⁢ 
               
                 
                   { 
                   
                     
                       ∑ 
                       
                         k 
                         = 
                         1 
                       
                       
                         N 
                         j 
                       
                     
                     ⁢ 
                     
                       ( 
                       
                         
                           
                             - 
                             aln 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             σ 
                             k 
                             x 
                           
                         
                         - 
                         
                           aln 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             σ 
                             k 
                             y 
                           
                         
                       
                       ) 
                     
                   
                   } 
                 
                 . 
               
             
           
         
       
     
     At step S 150 , motion refinements are applied to the motion vectors of the sub-macroblocks of the missing macroblock. An adaptive search range (ASR) is obtained according to a first adjacent external boundary matching error (AEBME) at the starting point of a spiral scanning path, along with all of the motion vector values. If the ASR is equal to or less than a threshold value, the motion vector is taken as a motion vector of the missing macroblock, and the threshold value is determined by a proximity of the AEBME value to an original residual value of a sum of absolute differences (SAD). 
     The ASR is determined by equation (9) according to the AEBME: 
                     ASR   =                  AEBME   ⁡     (     u   ,   v     )       -   μ          μ     ×     max   ⁡     (       D   x     ,     D   y       )       ×     W   λ       +   ɛ       ,           (   9   )               
in which AEBME(u, v) represents the first adjacent external boundary matching error at the starting point, μ represents the original residual values of the SAD, W represents the maximum search size, and λ and ε are constant factors (λ=32 and ε=0). Further, D X  and D Y  can be expressed by equation (10):
 
 D   x =max| X ( MVs )− u| 
 
 D   y =max| Y ( MVs )− v|   (10)
 
in which X(MVs) represents the X component of the motion vector, and Y(MVs) represents the Y component of the motion vector.
 
     The dynamic threshold (DT a ) is expressed by equation (11):
 
 DT   a   =μ+N×α   (11),
 
in which N is the total number of pixels, and α is a constant factor for each pixel.
 
     Generally, μ is unavailable, and therefore α is needed in addition for calculating the dynamic threshold (DT a ). 
       FIG. 6  is a schematic diagram illustrating a spiral scanning path according to an embodiment of the present invention. Referring to  FIG. 6 , the spiral scanning path starts from a starting point marked with 0 (in the current embodiment, the starting point is an average motion vector of the candidate motion vectors), in sequence along indication of the arrows, to sequentially perform refinement, so as to search for the best motion vector. For example, the motion vector shown in  FIG. 6  marked with 2 represents a desired motion vector, and therefore the motion refinement process processes only three motion vectors. The rest motion vectors are not to be further processed, and therefore the total computation for searching comparison process can be saved. The spiral scanning path of the present invention saves processing time. However, it should be noted that the spiral scanning path is an embodiment for illustrating the present invention without restrict the scope of the present invention and the spirit of the present invention. Any other path starting from a center point and spreading outwardly in a spiral manner should be construed as within the scope of the present invention. 
     As such, the motion vector of the missing macroblock is obtained at step S 150 . 
     Finally, at step S 180 , the image data of the missing macroblock can be obtained by moving the candidate macroblock to the position of the missing macroblock according to the motion vector, and thus concealing the negative affection caused by the missing macroblock to the entire image frame. 
     The experimental environment of the present invention is based upon the H.264 reference software of Joint Model (JM), provided by the JVT committee (Joint Video Team of ISO/IEC MPEG and ITU-T VCEG). Several standard video streams including CIF (352×288) and QCIF (176×144) are tested for evaluating the video quality. The high resolution video stream is encoded at 1 I-frame, with random packet lost errors at different specified loss ratios (different rates) generated by a Flexible Macroblock Ordering (FMO) technique, which are assumed to be caused by transmission errors. Different random packet lost errors are used simultaneously at each different specified loss ratio. 
     The average peak signal-to-noise ratio (PSNR) of a video stream is employed to give a quantitative evaluation of the quality of the reconstructed image. It is assumed that there is no packet lost from the initial decoded frame. In order to illustrate the performance of the TEC method of the present invention, the performance of the proposed TEC method is compared to the JM method by using several standard video sequences at 1%, 5%, and 10% error rates respectively. 
       FIG. 7  is a data plot diagram of the TEC method of the present invention. As shown in  FIG. 7 , the TEC method of the present invention performs a better image quality than the conventional JM method. For example, regarding the standard video stream “Container”, in a condition of having an error rate of about 1%, the PSNR of the TEC method is better than the JM method for 1.0 dB; in a condition of having an error rate of about 5%, the PSNR of the TEC method is better than the JM method for 1.7 dB; and in a condition of having an error rate of about 10%, the PSNR of the TEC method is better than the JM method for 2.0 dB. Meanwhile, the TEC method of the present invention improves the computation speed for about 1.12 times comparing with the conventional method. Other standard video streams, such as “football”, “foreman” are also illustrated in  FIG. 7 . 
     Table 1 shows the image quality factors of TEC method. In table 1, the ΔPSNR represents PSNR differences between the present invention with variable block sizes and the conventional method without variable block sizes, in conditions of having an error rate of 5%, 10%, and 20%. For example, in a condition of having an error rate of 10%, the ΔPSNR with respect to “Container” is 0.02 dB, the ΔPSNR with respect to “Foreman” is 0.03 dB, and the ΔPSNR with respect to “Football” is 0.04 dB, (i.e., 0.02 dB, 0.03 dB, and 0.04 dB, respectively). It can be learnt from table 1 that the TEC method employing variable block sizes of the present invention is adapted for significantly improve the image quality of video products. 
     
       
         
               
               
               
               
             
           
               
                 TABLE 1 
               
               
                   
               
               
                 ΔPSNR 
                 Error Rate 5% 
                 Error Rate 10% 
                 Error Rate 20% 
               
               
                   
               
             
             
               
                 Container 
                 0.01 
                 0.02 
                 0.04 
               
               
                 Foreman 
                 0.01 
                 0.03 
                 0.08 
               
               
                 Football 
                 0.02 
                 0.04 
                 0.09 
               
               
                   
               
             
          
         
       
     
     The TEC method according to the present invention not only saves the computation time and accelerates the processing speed, but also provides a high efficient image decoding method. 
     Although the present invention has been described with reference to the preferred embodiments thereof, it is apparent to those skilled in the art that a variety of modifications and changes may be made without departing from the scope of the present invention which is intended to be defined by the appended claims.