Abstract:
A CABAC encoding method includes: receiving first and second coefficient flags (Sig, Last); detecting coefficient flags according to positions of the detected coefficient flags and control signal (Sig_first); generating first bin and second bin (bin_val —   1 , bin_val —   2 ) corresponding to the detected coefficient flags according to the detecting result; updating a value of the second control signal (Sig_first) for the next clock cycle according to the detecting result; generating first and second position parameters (Sig/Last_pos —   1 , Sig/Last_pos —   2 ) corresponding to the positions of the first and second bins (bin_val —   1 , bin_val —   2 ); generating a first context index (Ctx_idx —   1 ) according to the control signal (Sig_first) and the first position parameter (Sig/Last_pos —   1 ) and a second context index (Ctx_idx —   2 ) according to the control signal (Sig_first), the second position parameter (Sig/Last_pos —   2 ) and the first bin (bin_val —   1 ); and encoding the first and second bins (bin_val —   1 , bin_val —   2 ) according to the first and second context indexes (Ctx_idx —   1 , Ctx_idx —   2 ) respectively to generate the bit stream.

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
       [0001]    This application is related to co-pending U.S. utility application Ser. No. ______ filed on  — , 2008, entitled CABAC decoding unit and method, the entirety of which is incorporated herein by reference. 
     
    
     BACKGROUND OF THE INVENTION 
       [0002]    1. Field of the Invention 
         [0003]    The invention relates to an encoding method, and in particular relates to a CABAC encoding method. 
         [0004]    2. Description of the Related Art 
         [0005]    The H.264/MPEG-4 Advanced Video Coding (AVC) video coding standard provides a significant compression gain over previous standards. H.264/MPEG-4 AVC is a recent video coding standard that makes use of several advanced video coding tools to provide better compression performance than existing video coding standards such as, MPEG-2, MPEG-4 and H.263. 
         [0006]    A context-based adaptive binary arithmetic coding (CABAC) has been adopted as a normative part of the H.264/MPEG-4 AVC standard. It is one of two alternative methods of entropy coding in the H.264/AVC coding standard. The other method specified in H.264/AVC is a low-complexity entropy-coding technique based on the usage of context-adaptively switched sets of variable-length codes, so-called Context-Adaptive Variable-Length Coding (CAVLC). Compared to CABAC, CAVLC offers reduced implementation costs at the price of lower compression efficiency. Thus, for TV signals in standard-definition or high-definition resolution, CABAC typically provides bit-rate savings of 10-20% relative to CAVLC at the same objective video quality. 
         [0007]    CABAC involves three key elements: 1) binarization of the input symbol stream to yield a stream of binary symbols (bins); 2) context modeling (conditional probability that a bin is 0 or 1 depending on previous bin values); and 3) binary arithmetic coding (recursive interval subdivision with subdivision according to conditional probability). 
         [0008]    However, the computational complexity of the CABAC of H.264/AVC video coding standard is a problem. The complexity of the CABAC of H.264/AVC video coding standard increases probability that the encoding speed and decoding speed is hindered. One conventional approach to the problem includes running the encoding/decoding hardware at a high frequency to handle the computational complexity problem. But, the disadvantage of the conventional approach is to raise the operational frequency of the corresponding hardware. Thus, improving CABAC encoding efficiency without raising the operational frequency of the corresponding hardware is desired. 
       BRIEF SUMMARY OF THE INVENTION 
       [0009]    A detailed description is given in the following embodiments with reference to the accompanying drawings. 
         [0010]    An embodiment of a CABAC encoder is provided. The CABAC encoder comprises a reorganizing unit, a first context formation engine, a second context formation engine and a CABAC coding engine. The reorganizing unit receives a plurality of first coefficient flags (Sig) and second coefficient flags (Last), detects at least two of the coefficient flags every clock cycle according to positions of the detected coefficient flags and a control signal (Sig_first) to generate a first bin (bin_val_ 1 ) and a second bin (bin_val_ 2 ) corresponding to the detected coefficient flags, updates a value of the next control signal (Sig_first) for a next clock cycle according to the detecting result, and generates a first position parameter (Sig/Last_pos_ 1 ) and a second position parameter (Sig/Last_pos_ 2 ) corresponding to positions of the first bin (bin_val_ 1 ) and a second bin (bin_val_ 2 ). The first context formation engine generates a first context index (Ctx_idx_ 1 ) according to the control signal (Sig_first) and the first position parameter (Sig/Last_pos_ 1 ). The second context formation engine generates a second context index (Ctx_idx_ 2 ) according to the control signal (Sig_first), the second position parameter (Sig/Last_pos_ 2 ) and the first bin (bin_val_ 1 ). The CABAC coding engine receives the first context index (Ctx_idx_ 1 ), the second context index (Ctx_idx_ 2 ), the first bin (bin_val_ 1 ) and the second bin (bin_val_ 2 ) and encodes the first bin (bin_val_ 1 ) according to the first context index (Ctx_idx_ 1 ) and encodes the second bin (bin_val_ 2 ) according to the second context index (Ctx_idx_ 2 ) to generate a bit stream. The first bin (bin_val_ 1 ) and the second bin (bin_val_ 2 ) are generated in one clock cycle, the first coefficient flag (Sig) indicates whether a corresponding coefficient value is zero, and the second coefficient flag (Last) indicates whether a coefficient map decoding process is finished. 
         [0011]    Another embodiment of a CABAC encoding method for generating a bit stream is provided. The method comprises: receiving a plurality of first coefficient flags (Sig) and second coefficient flags (Last); detecting at least two coefficient flags every clock cycle according to positions of the detected coefficient flags and a control signal (Sig_first); generating a first bin (bin_val_ 1 ) and a second bin (bin_val_ 2 ) corresponding to the detected coefficient flags according to the detecting result; updating a value of the second control signal (Sig_first) for the next clock cycle according to the detecting result; generating a first position parameter (Sig/Last_pos_ 1 ) and a second position parameter (Sig/Last_pos_ 2 ) corresponding to the positions of the first bin (bin_val_ 1 ) and second bin (bin_val_ 2 ); generating a first context index (Ctx_idx_ 1 ) according to the control signal (Sig_first) and the first position parameter (Sig/Last_pos_ 1 ) and a second context index (Ctx_idx_ 2 ) according to the control signal (Sig_first), the second position parameter (Sig/Last_pos_ 2 ) and the first bin (bin_val_ 1 ); and encoding the first bin (bin_val_ 1 ) and the second bin (bin_val_ 2 ) according to the first context index (Ctx_idx_ 1 ) and the second context index (Ctx_idx_ 2 ) respectively to generate the bit stream. The first bin (bin_val_ 1 ) and the second bin (bin_val_ 2 ) are generated in one clock cycle, the first coefficient flag (Sig) indicates whether a corresponding coefficient value is zero, and the second coefficient flag (Last) indicates whether a coefficient map decoding process is finished. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0012]    The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein: 
           [0013]      FIG. 1  is a schematic block diagram of a CABAC encoder according to an embodiment of the invention; 
           [0014]      FIG. 2  is a flow chart of a CABAC encoding method according to another embodiment of the invention; and 
           [0015]      FIG. 3  shows an electrical system according to another embodiment of the invention. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0016]    The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims. 
         [0017]    With regard to the H.264 CABAC specification, a bin may correspond to one of syntax elements including a first coefficient flag (significant_coeff_flag, Sig), a second coefficient flag (last_significant_coeff_flag, Last) and a corresponding coefficient value. The first coefficient flag (Sig), the second coefficient flag (Last) and the corresponding coefficient value, respectively present different functions or meanings. For example, first coefficient flag (Sig) represents whether the corresponding coefficient value is equal to zero. When the first coefficient flag (Sig) is one, the corresponding coefficient value is not a zero number; otherwise, the corresponding coefficient value is zero when the first coefficient flag (Sig) is zero. When the second coefficient flag (Last) is one, it means that the coefficient map encoding process in CABAC encoding operation is finished. Conversely, when the second coefficient flag (Last) is zero, the encoding process is not finished. 
         [0018]      FIG. 1  is a schematic block diagram of a CABAC encoder  100  according to an embodiment of the invention. The CABAC encoder  100  comprises a reorganizing unit  110 , context formation engines  121  and  122  and a CABAC coding engine  130 . The reorganizing unit  110  receives a plurality of first coefficient flags (Sig) and second coefficient flags (Last) and detects at least two of the coefficient flags, such as first coefficient flag (Sig) or second coefficient flags (Last), every clock cycle according to a control signal (Sig_first). For example, the reorganizing unit  110  detects two first coefficient flags (Sig) or one first coefficient flag (Sig) and one second coefficient flag (Last) every clock cycle according to the control signal (Sig_first). The reorganizing unit  110  accordingly generates a first bin (bin_val_ 1 ) and a second bin (bin_val_ 2 ) representing the two detected coefficient flags, updates a value of the control signal (Sig_first) for next clock cycle according to the detecting result, and generates a first position parameter (Sig/Last_pos_ 1 ) indicating the position of the first bin (bin_val_ 1 ) and a second position parameter (Sig/Last_pos_ 2 ) indicating the position of the second bin (bin_val_ 2 ) according to the detecting result and the control signal (Sig_first). The detailed operation of the CABAC encoder  100  is described as follows. 
         [0019]    Note that the first position parameter (Sig/Last_pos_ 1 ) can be a parameter (Sig — pos_ 1 ) or a parameter (Last_pos_ 1 ) indicating the position of the first bin (bin_val_ 1 ) corresponding to a first coefficient flag (Sig) or a second coefficient flag (Last) respectively. Similarly, the second position parameter (Sig/Last_pos_ 2 ) can be a parameter (Sig_pos_ 2 ) or a parameter (Last_pos_ 2 ). 
         [0020]    According to an embodiment of the invention, if the reorganizing unit  110  first detects the first significant flag (Sig), the reorganizing unit  110  outputs the first position parameter (Sig_pos_ 1 ) corresponding to a position of the detected first coefficient flag (Sig) to the context formation engines  121 . If the reorganizing unit  110  first detects the second significant flag (Last), the reorganizing unit  110  outputs the first position parameter (Last_pos_ 1 ) corresponding to a position of the detected second coefficient flag (Last) to the context formation engines  121 . Similarly, if the reorganizing unit  110  detects the first coefficient flag (Sig) after detecting one of the first coefficient flag or the second coefficient (Last), the reorganizing unit  110  outputs the second position parameter (Sig_pos_ 2 ) to the context formation engines  122 . If the reorganizing unit  110  detects the second significant flag (Last) after detecting one of the first coefficient flag or the second coefficient (Last), the reorganizing unit  110  outputs the second position parameter (Last_pos_ 2 ) to the context formation engines  122 . 
         [0021]    The first context formation engine  121  generates a first context index (Ctx_idx_ 1 ) according to the control signal (Sig_first) and the first parameter (Sig/Last_pos_ 1 ). The second context formation engine  122  generates a second context index (Ctx_idx_ 2 ) according to the control signal (Sig_first), the second parameter (Sig/Last_pos_ 2 ) and the first bin (bin_val_ 1 ). That is the second context formation engine  122  determines the second parameter (Sig/Last_pos_ 2 ) being one of the position parameters Sig_pos_ 2  and Last_pos_ 2  according to the first bin (bin_val_ 1 ) and the control signal (Sig_first) and outputs the second context index (Ctx_idx_ 2 ) accordingly. For example, when the control signal (Sig_first) is one and the first bin (bin_val_ 1 ) is one, the second context formation engine  122  determines the second parameter (Sig/Last_pos_ 2 ) being the second position parameter (Last_pos_ 2 ) and outputs the second context index (Ctx_idx_ 2 ) accordingly. Upon receiving the first context index (Ctx_idx_ 1 ), the second context index (Ctx_idx_ 2 ), the first bin (bin_val_ 1 ) and the second bin (bin_val_ 2 ), the CABAC coding engine  130  encodes the first bin (bin_val_ 1 ) and the second bin (bin_val_ 2 ) according to the first context index (Ctx_idx_ 1 ) and the second context index (Ctx_idx_ 2 ) respectively and generates a bitstream. 
         [0022]    The control signal (Sig_first) is used for determining the two coefficient flags detected by the reorganizing unit  110  being first coefficient flag (Sig) or second coefficient flag (Last). According to an embodiment of the invention, when the control signal (Sig_first) is one, the reorganizing unit  110  detects the first coefficient flag (Sig) and generates the first bin (bin_val_ 1 ) corresponding to the first coefficient flag (Sig). When the detected first coefficient flags (Sig) is one, the reorganizing unit  110  proceeds to detect the second coefficient flag (Last) and generates the second bin (bin_val_ 2 ) corresponding to the second coefficient flag (Last). The reorganizing unit  110  further outputs the position parameter (Sig_pos_ 1 ) and the position parameter (Last_pos_ 2 ) for the first bin (bin_val_ 1 ) and the second bin (bin_val_ 2 ) to the context formation engines  121  and  122  respectively. 
         [0023]    In the first case, when the control signal (Sig_first) is one, the first coefficient flag (Sig) is one and the second coefficient flag (Last) is zero, the value of the control signal (Sig_first) updated by the reorganizing unit  110  for the next clock cycle is one and the first position parameter (Sig_pos_ 1 ) for the next clock cycle is added one for indicating where to detect coefficient flags during the next clock cycle (case 1). For example, according to the first case, both of the position parameters of the detected first coefficient flag (Sig) and the second coefficient flag (Last), Sig_pos_ 1  and Last_pos_ 2 , are “a”. The reorganizing unit  110  then will first detect the first coefficient flag (Sig) during the next clock cycle according to the first position parameter Sig_pos_ 1  of “a+1” (Add one to the current first position parameter Sig_pos_ 1  of “a”). The value of the second position parameter Sig/Last_pos_ 2 , however, depends on the value of the first coefficient flag (Sig) detected during next cycle. For example, if the first coefficient flag (Sig) detected at position “a+1” during next cycle is one, the second position parameter Sig/Last_pos_ 2  is “a+1” and corresponds to a second coefficient flag (Last). 
         [0024]    In the second case, the control signal (Sig_first), the first coefficient flag (Sig) and the second coefficient flag (Last) are all equal to one. Since the second coefficient flag (Last) is one, the coefficient map encoding process is finished (case 2). 
         [0025]    According to another embodiment of the invention, in the third case, when the control signal (Sig_first) is one and the first coefficient flag (Sig) which is the first coefficient flag detected by the reorganizing unit  110  is zero, the next coefficient flag detected by the reorganizing unit  110  is a next first coefficient flag (Sig) and the reorganizing unit  110  generates the second bin (bin_val_ 2 ) corresponding to the next first coefficient flag (Sig) accordingly. The reorganizing unit  110  further outputs the position parameter (Sig_pos_ 1 ) and the position parameter (Sig_pos_ 2 ) for the first bin (bin_val_ 1 ) and the second bin (bin_val_ 2 ) to the context formation engines  121  and  122  respectively. For example, the position of the detected first coefficient flag (Sig) is “a” and the position of the detected next first coefficient flag (Sig) is “a+1”. 
         [0026]    In the third case, the control signal (Sig_first) is one, the first coefficient flag (Sig) is zero and the next first coefficient flag (Sig) is zero. The value of the control signal (Sig_first) updated by the reorganizing unit  110  for the next clock cycle is one and the first position parameter (Sig_pos_ 1 ) for the next cycle is added two as “a+2” (Add two to the current first position parameter Sig_pos_ 1  of “a”) for indicating where to detect coefficient flags during the next clock cycle (case 3). Similarly, the value of the second position parameter Sig/Last_pos_ 2  depends on the value of the first coefficient flag (Sig) detected during next cycle. According to the third case, the position parameter of the first coefficient flag (Sig) is “a” and that of the next first coefficient flag (Sig) is “a+1”. The reorganizing unit  110  then detect the first coefficient flag (Sig) first during the next clock cycle at position parameter “a+2”. 
         [0027]    In the fourth case, the control signal (Sig_first) is one, the first coefficient flag (Sig) is zero and the next first coefficient flag (Sig) is one. The second control signal (Sig_first) updated by the reorganizing unit  110  for the next clock cycle is zero and the first position parameter (Last_pos_ 1 ) for the next clock cycle is added one as “a+1” (Add one to the current first position parameter Sig_pos_ 1  of “a”) for indicating where to detect coefficient flags during the next clock cycle (case 4). Similarly, the value of the second position parameter Sig/Last_pos_ 2  depends on the value of the second coefficient flag (Last) detected during next cycle. For example, if the second coefficient flag (Last) detected at position “a+1” during next cycle is zero, the second position parameter Sig/Last_pos_ 2  is “a+2” and corresponds to a first coefficient flag (Sig). Otherwise, the coefficient map encoding process is finished. According to the fourth case, the position parameter of the detected first coefficient flag (Sig) is “a” and that of the next detected first coefficient flag (Sig) is “a+1”. The reorganizing unit  110  then detect the second coefficient flag (Last) during the next clock cycle at position parameter “a+1”. If the second coefficient flag (Last) detected during the next clock cycle is zero, the reorganizing unit  110  then detect another first coefficient flag (Sig) during the next clock cycle at position parameter “a+2”. 
         [0028]    According to another embodiment of the invention, when the control signal (Sig_first) is zero, the reorganizing unit  110  first detects the second coefficient flag (Last) and generates the first bin (bin_val_ 1 ) corresponding to the detected second coefficient flag (Last). 
         [0029]    In the fifth case, when the control signal (Sig_first) is zero and the detected second coefficient flag (Last) is one, the coefficient map encoding process is finished (case 5). 
         [0030]    According to another embodiment of the invention, when the detected second coefficient flag (Last) is zero, the reorganizing unit  110  then detects the first coefficient flag (Sig) and generates the second bin (bin_val_ 2 ) corresponding to the detected first coefficient flag (Sig). 
         [0031]    In the sixth case, when the control signal (Sig_first) is zero, the detected second coefficient flag (Last) is zero and first coefficient flag (Sig) is zero, the second control signal (Sig_first) updated by the reorganizing unit  110  for the next clock cycle is one and the first position parameter (Sig_pos_ 1 ) for the next clock cycle is added two as “a+2” (Add two to the current first position parameter Last_pos_ 1  of “a”) for indicating where to detect coefficient flags during the next clock cycle (case 6). For example, according to the sixth case, the position parameter of the detected second coefficient flag (Last) is “a” and the detected first coefficient flag (Sig) is “a+1”. The reorganizing unit  110  detects a next first coefficient flag (Sig) during the next clock cycle at position parameter “a+2”. 
         [0032]    In the seventh case, when the control signal (Sig_first) is zero, the detected second coefficient flag (Last) is zero and the detected first coefficient flag (Sig) is one, the second control signal (Sig_first) updated by the reorganizing unit  110  for the next clock cycle is zero and the first position parameter (Last_pos_ 1 ) for the next clock cycle is added one as “a+1” (Add one to the current first position parameter Last_pos_ 1  of “a”) for indicating where to detect coefficient flags during the next clock cycle (case 7). For example, according to the seventh case, the position parameter of the detected second coefficient flag (Last) is “a” and the position parameter of the detected first coefficient flag (Sig) is “a+1”. The reorganizing unit  110  then detects the next second coefficient flag (Last) at position parameter “a+1” during the next cycle. If the second coefficient flag (Last) at position parameter “a+1” is zero, the reorganizing unit  110  accordingly detects the first coefficient flag (Sig) at position parameter “a+2”. 
         [0033]    For clarity, the following table 1 shows the summary of the cases 1-7 described above. 
         [0000]    
       
         
               
               
               
               
               
               
             
           
               
                 TABLE 1 
               
               
                   
               
             
             
               
                 (Sig_first = 1) 
                 (Case 1) 
                 syntax: 
                 Sig 
                 Last 
                 next cycle 
               
               
                   
                   
                   
                 1 
                 0 
                 →Sig_first = 1 
               
               
                   
                   
                 sig_pos 
                 a 
                   
                 →a + 1 
               
               
                   
                   
                 last_pos 
                 a 
               
               
                   
                 (Case 2) 
                 syntax: 
                 Sig 
                 Last 
                 next cycle 
               
               
                   
                   
                   
                 1 
                 1 
                 →encoding end 
               
               
                   
                   
                 sig_pos 
                 a 
               
               
                   
                   
                 last_pos 
                 a 
               
               
                   
                 (Case 3) 
                 syntax: 
                 Sig 
                 Sig 
                 next cycle 
               
               
                   
                   
                   
                 0 
                 0 
                 →Sig_first = 1 
               
               
                   
                   
                 sig_pos 
                 a 
                 a + 1 
                 →a + 2 
               
               
                   
                   
                 last_pos 
                 a 
               
               
                   
                 (Case 4) 
                 syntax: 
                 Sig 
                 Sig 
                 next cycle 
               
               
                   
                   
                   
                 0 
                 1 
                 →Sig_first = 0 
               
               
                   
                   
                 sig_pos 
                 a 
                 a + 1 
               
               
                   
                   
                 last_pos 
                 a 
                   
                 →a + 1 
               
               
                 (Sig_first = 0) 
                 (Case 5) 
                 syntax: 
                 Last 
                 x 
                 next cycle 
               
               
                   
                   
                   
                 1 
                   
                 →encoding end 
               
               
                   
                   
                 sig_pos 
                 a + 1 
                   
                 →0 
               
               
                   
                   
                 last_pos 
                 a 
                   
                 →0 
               
               
                   
                 (Case 6) 
                 syntax: 
                 Last 
                 Sig 
                 next cycle 
               
               
                   
                   
                   
                 0 
                 0 
                 →Sig_first = 1 
               
               
                   
                   
                 sig_pos 
                 a + 1 
                   
                 →a + 2 
               
               
                   
                   
                 last_pos 
                 a 
               
               
                   
                 (Case 7) 
                 syntax: 
                 Last 
                 Sig 
                 next cycle 
               
               
                   
                   
                   
                 0 
                 1 
                 →Sig_first = 0 
               
               
                   
                   
                 sig_pos 
                 a + 1 
               
               
                   
                   
                 last_pos 
                 a 
                   
                 →a + 1 
               
               
                   
               
             
          
         
       
     
         [0034]      FIG. 2  is a flow chart of a CABAC encoding method  200  according to another embodiment of the invention. First, the reorganizing unit  110  detects a control signal (Sig_first) (step  210 ) and receives a plurality of first coefficient flags (Sig) and second coefficient flags (Last). Then, the reorganizing unit  110  detects at least two coefficient flags every clock cycle in sequence according to according to the control signal (Sig_first). 
         [0035]    For example, when the control signal (Sig_first) is one, the reorganizing unit  110  detects the first coefficient flag (Sig) (step  220 ). However, when the control signal (Sig_first) is zero, the reorganizing unit  110  detects the second coefficient flag (Last) (step  230 ). 
         [0036]    When the control signal (Sig_first) is one and the first coefficient flags (Sig) is one, the reorganizing unit  110  detects the second coefficient flag (Last) (step  241 ). When the first coefficient flag (Sig) is one and the second coefficient flag (Last) is zero (above case 1), the reorganizing unit  110  updates the control signal (Sig_first) to be one for the next clock cycle, indicating the first coefficient flag detected in the next clock cycle is a first coefficient flag (Sig) and the first position parameter (Sig_pos_ 1 ) for the next clock cycle is “a+1” if the current first and second position parameters (Sig_pos_ 1 ) and (Last_pos_ 2 ) are “a” (step  261 ). When the detected first coefficient flag (Sig) is one and the detected second coefficient flag (Last) is one (above case 2), the coefficient map encoding is finished (step  262 ). 
         [0037]    When the control signal (Sig_first) detected is one in step  210  and the first coefficient flag (Sig) detected at position parameter “a” is zero in step  220 , the reorganizing unit  110  detects a next first coefficient flag (Sig) (step  242 ) at position “a+1”. When the detected first coefficient flag (Sig) at position parameter “a” is zero and the detected next first coefficient flag (Sig) at position parameter “a+1” is zero, the reorganizing unit  110  updates the control signal (Sig_first) to be one for the next clock cycle, indicating the first flag detected in the next clock cycle is a first coefficient flag (Sig) and the first position parameter (Sig_pos_ 1 ) for the next clock cycle is “a+2” (step  263 , above case 3). 
         [0038]    When the first coefficient flag (Sig) detected in step  220  is zero and the next first coefficient flag (Sig) detected in step  242  is one, the reorganizing unit  110  updates the control signal (Sig_first) to be zero for the next clock cycle, indicating the first flag detected in the next clock cycle is a second coefficient flag (Last) and the first position parameter (Last_pos_ 1 ) for the next clock cycle is “a+1” if the current first and second position parameters (Sig_pos_ 1 ) and (Sig_pos_ 2 ) are “a” and “a+1” respectively (step  264 , above case 4). 
         [0039]    When the control signal (Sig_first) detected in step  210  is zero and the second coefficient flag (Last) detected in step  230  is one, the coefficient map encoding process is finished (step  251 , above case 5). 
         [0040]    When the control signal (Sig_first) detected in step  210  is zero and the second coefficient flag (Last) detected in step  230  is zero, the reorganizing unit  110  proceed to detect the first coefficient flag (Sig) (step  252 ). 
         [0041]    When the control signal (Sig_first) is zero, the second coefficient flag (Last) detected in step  230  is zero and the first coefficient flag (Sig) detected in step  252  is zero, the reorganizing unit  110  updates the control signal (Sig_first) to be one for the next clock cycle, indicating the first coefficient flag detected in the next clock cycle is a first coefficient flag (Sig) and the first position parameter (Sig_pos_ 1 ) for the next clock cycle is “a+2” if the current first and second position parameters (Last_pos_ 1 ) and (Sig_pos_ 2 ) are “a” and “a+1” respectively (step  265 , above case 6). 
         [0042]    Conversely, when the control signal (Sig_first) detected in step  210  is zero, the second coefficient flag (Last) detected in step  230  is zero and the first coefficient flag (Sig) detected in step  252  is one, the reorganizing unit  110  updates the control signal (Sig_first) to be zero for the next clock cycle, indicating the first flag detected in the next clock cycle is a second coefficient flag (Last) and the first position parameter (Last_pos_ 1 ) for the next clock cycle is “a+1” if the current first and second position parameters (Last_pos_ 1 ) and (Sig_pos_ 2 ) are “a” and “a+1” respectively (step  266 , above case 7). 
         [0043]    It is noted that the CABAC encoder  100  encodes at least two coefficient flags, such as the first coefficient flag (Sig) and the second coefficient flag (Last), every clock cycle in sequence according to the position thereof and the control signal (Sig_first), improving the CABAC encoding efficiency. 
         [0044]      FIG. 3  shows an electrical system  10  according to another embodiment of the invention. The electrical system  10  for display images comprises the CABAC encoder  100 , control unit  12  and so on . . . . The electronic system  10  can be a mobile phone, digital camera, PDA (personal data assistant), notebook computer, desktop computer, television, or portable DVD player, for example. However, it is not limited that the electrical system  10  is the above devices. 
         [0045]    While the invention has been described by way of example and in terms of preferred embodiment, it is to be understood that the invention is not limited to thereto. To the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.