⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dpof.c

📁 台湾凌阳方案300万数码相机源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
{
     USHORT i,j,k,l;
     UCHAR sts = TRUE;

     if ((*ByteCount < G_DOS_FileSize) && (*PrtTyp == 0))
     {
          if (*ByteCount & 0x00000001)
          {
               l = 1;
          }
          else
          {
               l = 0;
          }

          SDRAM_Dram2Sram(*NewDramAddr,G_ucStorData,K_DPOF_SEARCH_SIZE);

          for (i = l; i < K_DPOF_SEARCH_SIZE; i++)
          {
               *ByteCount += 1;

               if ((G_ucStorData[i] == 'P') && (G_ucStorData[i + 1] == 'R') && (G_ucStorData[i + 2] == 'T') && (G_ucStorData[i + 3] == ' ') && 
                    (G_ucStorData[i + 4] == 'T') && (G_ucStorData[i + 5] == 'Y') && (G_ucStorData[i + 6] == 'P'))
               {
                    *ByteCount += 6;

                    for (j = (i + 7); j < K_DPOF_SEARCH_SIZE; j++)                        
                    {
                         *ByteCount += 1;
                       
                         if ((G_ucStorData[j] == 'S') && (G_ucStorData[j + 1] == 'T') && (G_ucStorData[j + 2] == 'D'))
                         {                                   
                              *PrtTyp = K_DPOF_STD;
                              //printf("Print type = %bx\n",K_DPOF_STD);
                              *ByteCount += 2;

                              for (k = (j + 3); k < K_DPOF_SEARCH_SIZE; k++)
                              {                         
                                   *ByteCount += 1;
                                   //Compare line-feed and return
                                   if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
                                   {
                                        *ByteCount += 1;
                                        *NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
                                        break;
                                   }
                              }

                              break;
                         }
                         else
                         {
                              if ((G_ucStorData[j] == 'I') && (G_ucStorData[j + 1] == 'D') && (G_ucStorData[j + 2] == 'X'))
                              {                                   
                                   *PrtTyp = K_DPOF_IDX;    
                                   //printf("Print type = %bx\n",K_DPOF_IDX);
                                   *ByteCount += 2;

                                   for (k = (j + 3); k < K_DPOF_SEARCH_SIZE; k++)
                                   {                         
                                        *ByteCount += 1;
                                        //Compare line-feed and return
                                        if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
                                        {
                                             *ByteCount += 1;
                                             *NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
                                             break;
                                        }
                                   }
     
                                   break;
                              }                                              
                         }
                    }

                    break;
               }
          }
     }

     if (*PrtTyp == 0)
     {
          sts = FALSE;
     }

     return sts;
}

//-----------------------------------------------------------------------------
//DPOF_FindDpofPRTQTY
//-----------------------------------------------------------------------------
UCHAR DPOF_FindDpofPRTQTY(ULONG *NewDramAddr,ULONG *ByteCount,USHORT *PrtQty) USING_0
{
     ULONG tmp_NewDramAddr;
     ULONG tmp_ByteCount;
     UCHAR search_count = 4;  //4 * 512 = 2K Byte range
     USHORT i,j,k,l;
     UCHAR sts = TRUE;
     
     tmp_NewDramAddr = *NewDramAddr;
     tmp_ByteCount = *ByteCount;

     if ((*ByteCount < G_DOS_FileSize) && (*PrtQty == 0) && (search_count > 0))
     {
          if (*ByteCount & 0x00000001)
          {
               l = 1;
          }
          else
          {
               l = 0;
          }

          SDRAM_Dram2Sram(*NewDramAddr,G_ucStorData,K_DPOF_SEARCH_SIZE);

          for (i = l; i < K_DPOF_SEARCH_SIZE; i++)
          {
               *ByteCount += 1;

               if ((G_ucStorData[i] == 'P') && (G_ucStorData[i + 1] == 'R') && (G_ucStorData[i + 2] == 'T') && (G_ucStorData[i + 3] == ' ') && 
                    (G_ucStorData[i + 4] == 'Q') && (G_ucStorData[i + 5] == 'T') && (G_ucStorData[i + 6] == 'Y'))
               {
                    *ByteCount += 6;

                    for (j = (i + 7); j < K_DPOF_SEARCH_SIZE; j++)                        
                    {
                         *ByteCount += 1;
                              
                         if ((G_ucStorData[j] >= '0') && (G_ucStorData[j] <= '9'))
                         {                                   
                              *PrtQty = (((USHORT)(G_ucStorData[j] - '0') * 100) + ((USHORT)(G_ucStorData[j + 1] - '0') * 10) + (USHORT)(G_ucStorData[j + 2] - '0'));
                              *ByteCount += 2;

                              for (k = (j + 3); k < K_DPOF_SEARCH_SIZE; k++)
                              {                         
                                   *ByteCount += 1;
                                   //Compare line-feed and return
                                   if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
                                   {
                                        *ByteCount += 1;
                                        *NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
                                        break;
                                   }
                              }

                              break;
                         }
                    }

                    break;
               }
               else
               {
                    if ((G_ucStorData[i] == 'I') && (G_ucStorData[i + 1] == 'M') && (G_ucStorData[i + 2] == 'G'))  //Find other parameter
                    {
                         *NewDramAddr = tmp_NewDramAddr;
                         *ByteCount = tmp_ByteCount;
                         *PrtQty = 1;
                         break;
                    }
               }
          }

          search_count -= 1;
     }

     if (*PrtQty == 0)
     {
          sts = FALSE;
     }

     return sts;
}

//-----------------------------------------------------------------------------
//DPOF_FindDpofIMGFMT
//-----------------------------------------------------------------------------
UCHAR DPOF_FindDpofIMGFMT(ULONG *NewDramAddr,ULONG *ByteCount,UCHAR *ImgFmt) USING_0
{
     USHORT i,j,k,l;
     UCHAR sts = TRUE;

     if ((*ByteCount < G_DOS_FileSize) && (*ImgFmt == 0))
     {
          if (*ByteCount & 0x00000001)
          {
               l = 1;
          }
          else
          {
               l = 0;
          }

          SDRAM_Dram2Sram(*NewDramAddr,G_ucStorData,K_DPOF_SEARCH_SIZE);

          for (i = l; i < K_DPOF_SEARCH_SIZE; i++)
          {
               *ByteCount += 1;

               if ((G_ucStorData[i] == 'I') && (G_ucStorData[i + 1] == 'M') && (G_ucStorData[i + 2] == 'G') && (G_ucStorData[i + 3] == ' ') && 
                    (G_ucStorData[i + 4] == 'F') && (G_ucStorData[i + 5] == 'M') && (G_ucStorData[i + 6] == 'T'))
               {
                    *ByteCount += 6;
     
                    for (j = (i + 7); j < K_DPOF_SEARCH_SIZE; j++)                        
                    {
                         *ByteCount += 1;
                                  
                         if ((G_ucStorData[j] == 'C') && (G_ucStorData[j + 1] == 'I') && (G_ucStorData[j + 2] == 'F') &&
                              (G_ucStorData[j + 3] == 'F') && (G_ucStorData[j + 4] == '1'))
                         {                                   
                              *ImgFmt = K_DPOF_CIFF1_IMAGE;
                              *ByteCount += 3;

                              for (k = (j + 4); k < K_DPOF_SEARCH_SIZE; k++)
                              {                         
                                   *ByteCount += 1;
                                   //Compare line-feed and return
                                   if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
                                   {
                                        *ByteCount += 1;
                                        *NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
                                        break;
                                   }
                              }
     
                              break;
                         }
                         else
                         {                         
                              if ((G_ucStorData[j] == 'E') && (G_ucStorData[j + 1] == 'X') && (G_ucStorData[j + 2] == 'I') &&
                                   (G_ucStorData[j + 3] == 'F') && (G_ucStorData[j + 4] == '1'))
                              {                                   
                                   *ByteCount += 4;

                                   for (k = (j + 5); k < K_DPOF_SEARCH_SIZE; k++)
                                   {                         
                                        *ByteCount += 1;
                                        //Compare EXIF1 -J or -T type
                                        if (G_ucStorData[k] == 'J')
                                        {
                                             *ImgFmt = K_DPOF_EXIF1_J_IMAGE;
                                             break;
                                        }
                                        else
                                        {
                                             if (G_ucStorData[k] == 'T')
                                             {
                                                  *ImgFmt = K_DPOF_EXIF1_T_IMAGE;
                                                  break;
                                             }
                                        }
                                   }
          
                                   for (; k < K_DPOF_SEARCH_SIZE; k++)
                                   {                         
                                        *ByteCount += 1;
                                        //Compare line-feed and return
                                        if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
                                        {
                                             *ByteCount += 1;
                                             *NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
                                             break;
                                        }
                                   }
     
                                   break;
                              }
                              else
                              {
                                   if ((G_ucStorData[j] == 'E') && (G_ucStorData[j + 1] == 'X') && (G_ucStorData[j + 2] == 'I') &&
                                        (G_ucStorData[j + 3] == 'F') && (G_ucStorData[j + 4] == '2'))
                                   {                                   
                                        *ByteCount += 4;
          
                                        for (k = (j + 5); k < K_DPOF_SEARCH_SIZE; k++)
                                        {                         
                                             *ByteCount += 1;
                                             //Compare EXIF2 -J or -T type
                                             if (G_ucStorData[k] == 'J')
                                             {
                                                  *ImgFmt = K_DPOF_EXIF2_J_IMAGE;
                                                  break;
                                             }
                                             else
                                             {
                                                  if (G_ucStorData[k] == 'T')
                                                  {
                                                       *ImgFmt = K_DPOF_EXIF2_T_IMAGE;
                                                       break;
                                                  }
                                             }
                                        }
               
                                        for (; k < K_DPOF_SEARCH_SIZE; k++)
                                        {                         
                                             *ByteCount += 1;
                                             //Compare line-feed and return
                                             if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
                                             {
                                                  *ByteCount += 1;
                                                  *NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
                                                  break;
                                             }
                                        }
     
                                        break;
                                   }
                                   else
                                   {          
                                        if ((G_ucStorData[j] == 'J') && (G_ucStorData[j + 1] == 'F') && (G_ucStorData[j + 2] == 'I') &&
                                             (G_ucStorData[j + 3] == 'F'))
                                        {                                   
                                             *ImgFmt = K_DPOF_JFIF_IMAGE;
                                             *ByteCount += 3;

                                             for (k = (j + 4); k < K_DPOF_SEARCH_SIZE; k++)
                                             {                         
                                                  *ByteCount += 1;
                                                  //Compare line-feed and return
                                                  if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
                                                  {
                                                       *ByteCount += 1;
                                                       *NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
                                                       break;
                                                  }
                                             }
                    
                                             break;
                                        }
                                        else
                                        {
                                             if ((G_ucStorData[j] == 'F') && (G_ucStorData[j + 1] == 'P') && (G_ucStorData[j + 2] == 'X') &&
                                       

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -