Abstract:
A method for determining the synchronization code under a standard mobile imaging architecture is provided. This method is essentially to solve any possible error occurring as transferring the images among the mobile devices. If any error is occurred to the transferred bit stream, it will cause fault in the image data. Consequently, the present invention provides an approach to compare every input data with iterative comparison operation, so as to obtain the position of synchronization codes under SMIA. Therefore, the correct synchronization code will solve the possible error translation.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    A method for determining synchronization code under the Standard Mobile Image Architecture (SMIA), in particular, for using iterative comparison operations to obtain the correct position of the synchronization code, so as to correctly translate the received image data. 
         [0003]    2. Description of Related Art 
         [0004]    Because of the rapid market growth of mobile phones or other portable devices with camera function, the Standard Mobile Image Architecture (SMIA) provides a standard for transferring image data over mobile devices, wherein the SMIA is an image process architecture specifically applicable on mobile devices, which offers better performance between SMIA-compliant sensor and connected SMIA-compliant host, and specifies elements including housing, mechanical interconnection, functionality, register set and interface. 
         [0005]    When transferring images among mobile devices, according the aforementioned SMIA that defines eleven types of image data format, in which synchronization code includes bit codes for the start of a frame, such as SOF (frame start synchronization code); the end of a frame, such as EOF (frame end synchronization code); start bit of the line in an image pixel array, such as SOL (line start synchronization code); and end bit of the line, such as EOL (line end synchronization code). When transmitting, the transmissions of data as well as synchronization code both start from the lowest significant bit (LSB). Refer to Table 1 for each synchronization code, in which SOL, EOL, SOF, EOF and logical channel are specified. 
         [0000]    
       
         
               
               
               
             
           
               
                   
                 TABLE 1 
               
               
                   
                   
               
               
                   
                 Synchronization Code 
                 Value 
               
               
                   
                   
               
             
             
               
                   
                 Line Start Code (SOL) 
                 FF H 00 H 00 H X0 H   
               
               
                   
                   
                 (X: number of channels) 
               
               
                   
                 Line End Code (EOL) 
                 FF H 00 H 00 H X1 H   
               
               
                   
                 Frame Start Code (SOF) 
                 FF H 00 H 00 H X2 H   
               
               
                   
                 Frame End Code (EOF) 
                 FF H 00 H 00 H X3 H   
               
               
                   
                 Logical Channel 
                 FF H 00 H 00 H 0X H  to FF H 00 H 00 H 7X H   
               
               
                   
                   
               
             
          
         
       
     
         [0006]      FIG. 1  shows a frame diagram of the SMIA, which takes a VGA image file as an example, the data shown in the diagram (for VGA format, 480 lines from line  1  to line  480 ) is the image file data defined between frame end code (EOF) and frame start code (SOF), and a frame blanking period is defined outside the frame; meanwhile, a line blanking is also defined between line end code (EOL) and line start code (SOL). 
         [0007]    The arrangement of data in the memory is illustrated in  FIG. 2 , wherein the transmission of each byte starts from the maximum significant bit (MSB), and the least significant bit (LSB) is the last one transferred. The arrangement in the memory is shown as bits  31 - 24 ,  23 - 16 ,  15 - 8  and  7 - 0 ; but when transferring image data under SMIA, bit stream thereof is output from the camera module in the mobile device; and before transferring any data, the least significant bit (LSB) will be transferred first, as the bit flow shown in the figure, reversing the positions of MSB and LSB, thus starting from LSB, e.g.  24 - 31 ,  16 - 23 ,  8 - 15  and  0 - 7 . 
         [0008]    As shown in  FIG. 3 , in the data received by a receiver, each frame starts from a frame start code (SOF), and ends at a frame end code (EOF), in which each line therein starts from a line start code (SOL) and ends at a line end code (EOL), forming a bit stream configuration illustrated in  FIG. 1 , wherein the first line start code is replaced by a frame start code, and the last line end code is substituted by a frame end code. The above-mentioned logical channels separate the interlaced data into different data flows, in which there are 0 to 7 channels in quantity. 
       SUMMARY OF THE INVENTION 
       [0009]    In the aforementioned prior art, eleven image data formats all specify number of bits in a single line data. When transferring, upon data number error or even synchronization code error accidentally occurs in a bit flow, the receiving side may not able to translate image data from the bit flow, causing a series of unrecoverable errors in the following steps. In view of this, the present invention provides a decoder which offers secure operations, even when the receiving side encounters data number error or even synchronization code error. 
         [0010]    The inventive method of determining synchronization code under SMIA is directed to the aforementioned issues, and provides a solution which, in essential, by means of iteratively using comparison operations, compares the synchronization code of each input data, until synchronization code is correctly matched, hence obtaining correct position of the data, avoiding the occurrence of translation error. 
         [0011]    The preferred embodiment includes the following steps. The decoder starts to receive data. Data transmission starts from the LSB; after having entered into the decoder, it is reversed and sorted into the original data type. In order to perform comparison operation onto the synchronization code with LSB first, the present invention reverses it again then stores it into a register. Next, through comparison operations with different offsets, compare the data so as to find the correct synchronization code with LSB first. 
         [0012]    The principal embodiment finds the correct synchronization code by means of at most 8 times comparison operations. It is possible to design 8 kinds of comparators; each has a synchronization code with one offset, performing at most 8 different comparison operations, in order to obtain the correct synchronization code position. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0013]      FIG. 1  is an image data diagram of prior art under SMIA; 
           [0014]      FIG. 2  is a bit flow data conversion diagram of prior art under SMIA; 
           [0015]      FIG. 3  is a bit flow diagram of prior art transferred under SMIA; 
           [0016]      FIG. 4  is a flowchart of the inventive method for determining synchronization code under SMIA; 
           [0017]      FIG. 5  is a diagram of an embodiment of the invention method for determining synchronization code under SMIA; and 
           [0018]      FIG. 6  is a bit value diagram of the comparison operations used by the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
       [0019]    Image transmissions among mobile devices are based on a SMIA, in which the image data formats defined therein have a plurality of synchronization codes, including a frame start code (SOF) specifying the frame start position, and a frame end code (EOF) specifying the frame end position, whereas the data in each line of the image being decided by a line start code (SOL) at the start position and a line end code (EOL) at the end position. However, during image transmission, it is inevitable to encounter error situations. A continuously transmitted data flow may result in an entire erroneous condition because of an error in one bit. The inventive method of determining synchronization code is, through iterative comparison operations, compare each data to find the correct position of synchronization code, then translate the image data defined by each synchronization code, avoiding the error caused by a certain bit error. 
         [0020]    Since the transmission of image data under SMIA starts from the Least Significant Bit (LSB); i.e. the “LSB first” transmission scheme, thus upon reception at the decoder, the data will be automatically arranged in original bit flow order under SMIA, that is, data with the Maximum Significant Bit (MSB) as the start bit. In order to translate each synchronization code, the present invention compares the synchronization code with LSB first, and because that the bit flow generated by data error or synchronization code error may offset 0 to 7 bits, a synchronization code finder formed by a plurality of comparison circuits is provided so as to locate possible offsets by a plurality of comparison operations, which in the preferred embodiment is 8, including a state of 0 offset. 
         [0021]    Due to possible occurrence of error in data number, the bit flow offset varies over time, the aforementioned synchronization code finder thus needs to search once again in terms of every possible offset of in each clock. 
         [0022]    According to the above-mentioned data offset issues needed to be solved, the inventive method of determining synchronization code can be shown as the flowchart illustrated in  FIG. 4 , which includes step S 401 , indicating the decoder starts to receive data, and, under SMIA, data transmission is required to start from the Least Significant Bit (LSB first), thus when arriving at the decoder, it will be automatically reversed in order, recovering into original data type, i.e. the data starting with Maximum Significant Bit (MSB first). 
         [0023]    Because that the inventive method of determining synchronization code mainly performs comparison operation based on the synchronization code with LSB first, it is necessary, as step S 403 , to reverse the received data in order, facilitating the comparison operation in bit flow form with LSB first. Subsequently, as step S 405 , these bit flows are all stored into storage media like registers, and next, by means of comparison operations with different offsets, search the data for the correct synchronization code with LSB first, as step S 407 . In practical implementation, it is possible to use a plurality of comparators to execute comparison operations, and within each comparator there exists a built-in set of synchronization code values with possible offsets. Each comparator sequentially performs comparison operations, deciding whether it matches the synchronization code of the LSB in the received incoming data. 
         [0024]    Regarding to the workflow concerning the plurality of comparison operations, if the result of the first comparison operation does not match, then perform one bit offset (step S 409 ), conducting the next comparison operation, and determining again if this matches such a offset amount; if not, repeat another bit offset and so on, until the correct synchronization code with LSB first is located, obtaining the correct synchronization code position (step S 411 ). When the correct offset is found, reverse the data into the data format with MSB first, then output it in a data type of byte. 
         [0025]    Since the aforementioned preferred embodiment transmits data based on a byte type using 8 bits as one set, the possible offsets ranges from 0 (no offset) to 7 bits of offset, therefore the objective of the present invention is directed not only to search for the correct synchronization code with at most 8 comparison operations, but also designs 8 comparators, each has a synchronization code with one offset condition, performing 8 different comparison operation, so as to locate the correct position of synchronization code. 
         [0026]    To implement the workflow illustrated in  FIG. 4 , the present invention provides an embodiment for the invention method of determining synchronization code under SMIA, as shown in  FIG. 5 . 
         [0027]    The data receiving unit  51  receives the data signal between mobile devices under SMIA, and since the image under SMIA is transmitted in a data type of LSB first, thus, as soon as entering into the decoder, it will be converted into a data type of MSB first. While the present invention is directed to the synchronization code with LSB first for performing comparison operation, it is necessary to execute order transformation by the first data sorting unit  53  shown in the figure, generating the data type of LSB first, then temporarily stored into the storage unit  55 . 
         [0028]    Thereafter, perform the first comparison operation on the LSB first data by the first comparison unit  501 , deciding whether the LSB first data matches the offset set in the first comparison unit; if not, then send the data to the second comparison unit  502  for performing the second comparison operation. Similarly, if not, send the data to the third comparison unit  503  for performing the third comparison operation, etc., and at most through the comparison operations from the fourth comparison operation in the fourth comparison unit  504 , the fifth comparison operation in the fifth comparison unit  505 , the sixth comparison operation in the sixth comparison unit  506 , the seventh comparison operation in the seventh comparison unit  507  and the eighth comparison operation in the eighth comparison unit  508 . Once the position of the synchronization code with LSB first is located, the subsequent operations will be skipped, indicating the correct position is found, which means the acquisition of correctly translated bit flow. Finally, convert the LSB first data into data of general type by means of the second data sorting unit  57 , i.e. the data type of MSB first. 
         [0029]      FIG. 6  shows a bit value diagram of the comparison operations used by the present invention. Suppose the synchronization code with LSB first should be 4 bytes, such as 00000000 11111111 00000000 00000000. However, due to data error, or some error in the synchronization code specifying the image data, the received synchronization code with LSB first may generate an offset of 4 bits, which thus become 0000 00001111 11110000 00000000 0000 spanning over 5 bytes. Therefore, the present invention needs to provide comparators accommodating at least 5 byte data, or employing comparison operations with at least 5 bytes. 
         [0030]    For example, if the received synchronization code with LSB first has an offset of 4 bits, such as ****0000 00001111 11110000 00000000 0000**** shown in data  60 . At this moment, the bit values used by each comparator or comparison operation are required to be as below, wherein * represents the portion without value: 
         [0031]    for data  601  used in the first comparison operation:
       00000000 11111111 00000000 00000000 ********       
 
         [0033]    for data  602  used in the second comparison operation:
       *0000000 01111111 10000000 00000000 0*******       
 
         [0035]    for data  603  used in the third comparison operation:
       **000000 00111111 11000000 00000000 00******       
 
         [0037]    for data  604  used in the fourth comparison operation:
       ***00000 00011111 11100000 00000000 000*****       
 
         [0039]    for data  605  used in the fifth comparison operation:
       ****0000 00001111 11110000 00000000 0000****       
 
         [0041]    for data  606  used in the sixth comparison operation:
       *****000 00000111 11111000 00000000 00000***       
 
         [0043]    for data  607  used in the seventh comparison operation:
       ******00 00000011 11111100 00000000 000000**       
 
         [0045]    for data  608  used in the eighth comparison operation:
       *******0 00000001 11111110 00000000 0000000*       
 
         [0047]    As can be seen from the above bit values used by each comparison operation, every situation of different offsets has been fully contemplated. In actual operation, it will first go through the first comparison operation; if it does not match the received bit value, then perform the second comparison operation which offsets one bit, and so on, until the correct result is obtained and stop the rest of operations. 
         [0048]    In summary, the inventive method of determining synchronization code under SMIA considers the conditions of synchronization code offset generated upon the occurrence of data error during transmission, hence by using iterative comparison operation to find the correct synchronization code position, thus obtaining the correctly translated data. 
         [0049]    The above-mentioned descriptions represent merely the preferred embodiment of the present invention, without any intention to delineate the scope of the present invention thereto. Therefore, all equivalent changes, alternations or modifications in structure made by utilizing, or based on, the disclosed specification and appended figures of the present invention are reasonably considered to fall within the scope of the present invention.