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

📄 exifhdr.c

📁 台湾凌阳方案300万数码相机源代码
💻 C
📖 第 1 页 / 共 5 页
字号:

     //Joe@2003.3.24 20:05 modify begin
     /*Header0.APP1.Exif_FNumberValue[0] = 0x14000000; //20/10
     //Header0.APP1.Exif_FNumberValue[0] = EXIFHDR_ByteSwapOfULONG(0x00000014); //20/10
     */
     Header0.APP1.Exif_FNumberValue[0] = EXIFHDR_ByteSwapOfULONG(0x1e);	//3.0mm
     //Joe@2003.3.24 20:05 modify end

     Header0.APP1.Exif_FNumberValue[1] = 0x0a000000;
     //Header0.APP1.Exif_FNumberValue[1] = EXIFHDR_ByteSwapOfULONG(0x0000000a);

     EXIFHDR_Fill_Text(Text_NowDateTime,Header0.APP1.Exif_DateTimeOriginalValue,20);

     EXIFHDR_Fill_Text(Text_NowDateTime,Header0.APP1.Exif_DateTimeDigitilizedValue,20);

     Header0.APP1.Exif_CompressedBitsPerPixelValue[0] = 0x02000000; //2/1
     //Header0.APP1.Exif_CompressedBitsPerPixelValue[0] = EXIFHDR_ByteSwapOfULONG(0x00000002); //2/1

     Header0.APP1.Exif_CompressedBitsPerPixelValue[1] = 0x01000000;
     //Header0.APP1.Exif_CompressedBitsPerPixelValue[1] = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.Exif_ExposureBiasValue[0] = 0x00000000;
     //Header0.APP1.Exif_ExposureBiasValue[0] = EXIFHDR_ByteSwapOfULONG(0x00000000);

     Header0.APP1.Exif_ExposureBiasValue[1] = 0x0a000000;
     //Header0.APP1.Exif_ExposureBiasValue[1] = EXIFHDR_ByteSwapOfULONG(0x0000000a);

     Header0.APP1.Exif_MaxApertureValue[0] = 0x02000000;
     //Header0.APP1.Exif_MaxApertureValue[0] = EXIFHDR_ByteSwapOfULONG(0x00000002);

     Header0.APP1.Exif_MaxApertureValue[1] = 0x01000000;
     //Header0.APP1.Exif_MaxApertureValue[1] = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.Exif_FocalLengthValue[0] = 0x51000000;
     //Header0.APP1.Exif_FocalLengthValue[0] = EXIFHDR_ByteSwapOfULONG(0x00000051);

     Header0.APP1.Exif_FocalLengthValue[1] = 0x0a000000;
     //Header0.APP1.Exif_FocalLengthValue[1] = EXIFHDR_ByteSwapOfULONG(0x0000000a);

     Header0.APP1.NumberOfInteroperability = 0x0200;
     //Header0.APP1.NumberOfInteroperability = EXIFHDR_ByteSwapOfUSHORT(0x0002);

     Header0.APP1.InteroperabilityIndexTag.tag = 0x0100;
     //Header0.APP1.InteroperabilityIndexTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x0001);

     Header0.APP1.InteroperabilityIndexTag.type = 0x0200;
     //Header0.APP1.InteroperabilityIndexTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0002);

     Header0.APP1.InteroperabilityIndexTag.count = 0x04000000;
     //Header0.APP1.InteroperabilityIndexTag.count = EXIFHDR_ByteSwapOfULONG(0x00000004);

     Header0.APP1.InteroperabilityIndexTag.valueoffset = 0x52393800;   //"R98"
     //Header0.APP1.InteroperabilityIndexTag.valueoffset = EXIFHDR_ByteSwapOfULONG(0x00383952);   //"R98"

     Header0.APP1.InteroperabilityVersionTag.tag = 0x0200;
     //Header0.APP1.InteroperabilityVersionTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x0002);

     Header0.APP1.InteroperabilityVersionTag.type = 0x0700;
     //Header0.APP1.InteroperabilityVersionTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0007);

     Header0.APP1.InteroperabilityVersionTag.count = 0x04000000;
     //Header0.APP1.InteroperabilityVersionTag.count = EXIFHDR_ByteSwapOfULONG(0x00000004);

     Header0.APP1.InteroperabilityVersionTag.valueoffset = 0x30313030;
     //Header0.APP1.InteroperabilityVersionTag.valueoffset = EXIFHDR_ByteSwapOfULONG(0x30303130);

     Header0.APP1.NextInteroperabilityIFDOffset = 0x00000000;
     //Header0.APP1.NextInteroperabilityIFDOffset = EXIFHDR_ByteSwapOfULONG(0x00000000);

     Header0.APP1.IFD1_NumberOfInteroperability = 0x0800;
     //Header0.APP1.IFD1_NumberOfInteroperability = EXIFHDR_ByteSwapOfUSHORT(0x0008);

     Header0.APP1.IFD1_CompressionTag.tag = 0x0301;
     //Header0.APP1.IFD1_CompressionTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x0103);

     Header0.APP1.IFD1_CompressionTag.type = 0x0300;     //short
     //Header0.APP1.IFD1_CompressionTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0003);     //short

     Header0.APP1.IFD1_CompressionTag.count = 0x01000000;
     //Header0.APP1.IFD1_CompressionTag.count = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_CompressionTag.valueoffset = 0x06000000;   //value,thumbnail is JPEG compressed
     //Header0.APP1.IFD1_CompressionTag.valueoffset = EXIFHDR_ByteSwapOfULONG(0x00000006);   //value,thumbnail is JPEG compressed

     Header0.APP1.IFD1_OrientationTag.tag = 0x1201;
     //Header0.APP1.IFD1_OrientationTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x0112);

     Header0.APP1.IFD1_OrientationTag.type = 0x0300;    //short
     //Header0.APP1.IFD1_OrientationTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0003);    //short

     Header0.APP1.IFD1_OrientationTag.count = 0x01000000;
     //Header0.APP1.IFD1_OrientationTag.count = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_OrientationTag.valueoffset = 0x01000000;   //value
     //Header0.APP1.IFD1_OrientationTag.valueoffset = EXIFHDR_ByteSwapOfULONG(0x00000001);   //value

     Header0.APP1.IFD1_XResolutionTag.tag = 0x1a01;
     //Header0.APP1.IFD1_XResolutionTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x011a);

     Header0.APP1.IFD1_XResolutionTag.type = 0x0500;    //rational
     //Header0.APP1.IFD1_XResolutionTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0005);    //rational

     Header0.APP1.IFD1_XResolutionTag.count = 0x01000000;
     //Header0.APP1.IFD1_XResolutionTag.count = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_XResolutionTag.valueoffset = //offset
          M_ByteSwapOfDword((ULONG) ((USHORT) Header0.APP1.IFD1_XResolutionValue - (USHORT) &Header0.APP1.Tiff_ByteOrder));
     //Header0.APP1.IFD1_XResolutionTag.valueoffset = //offset
     //     EXIFHDR_ByteSwapOfULONG((ULONG) ((USHORT) Header0.APP1.IFD1_XResolutionValue - (USHORT) &Header0.APP1.Tiff_ByteOrder));

     Header0.APP1.IFD1_YResolutionTag.tag = 0x1b01;
     //Header0.APP1.IFD1_YResolutionTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x011b);

     Header0.APP1.IFD1_YResolutionTag.type = 0x0500;    //rational
     //Header0.APP1.IFD1_YResolutionTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0005);    //rational

     Header0.APP1.IFD1_YResolutionTag.count = 0x01000000;
     //Header0.APP1.IFD1_YResolutionTag.count = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_YResolutionTag.valueoffset = //offset
          M_ByteSwapOfDword((ULONG) ((USHORT) Header0.APP1.IFD1_YResolutionValue - (USHORT) &Header0.APP1.Tiff_ByteOrder));
     //Header0.APP1.IFD1_YResolutionTag.valueoffset = //offset
     //     EXIFHDR_ByteSwapOfULONG((ULONG) ((USHORT) Header0.APP1.IFD1_YResolutionValue - (USHORT) &Header0.APP1.Tiff_ByteOrder));

     Header0.APP1.IFD1_ResolutionUnitTag.tag = 0x2801;
     //Header0.APP1.IFD1_ResolutionUnitTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x0128);

     Header0.APP1.IFD1_ResolutionUnitTag.type = 0x0300; //short
     //Header0.APP1.IFD1_ResolutionUnitTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0003); //short

     Header0.APP1.IFD1_ResolutionUnitTag.count = 0x01000000;
     //Header0.APP1.IFD1_ResolutionUnitTag.count = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_ResolutionUnitTag.valueoffset = 0x02000000;    //value
     //Header0.APP1.IFD1_ResolutionUnitTag.valueoffset = EXIFHDR_ByteSwapOfULONG(0x00000002);    //value

     Header0.APP1.IFD1_JPEGInterChangeFormatTag.tag = 0x0102;
     //Header0.APP1.IFD1_JPEGInterChangeFormatTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x0201);

     Header0.APP1.IFD1_JPEGInterChangeFormatTag.type = 0x0400; //long
     //Header0.APP1.IFD1_JPEGInterChangeFormatTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0004); //long

     Header0.APP1.IFD1_JPEGInterChangeFormatTag.count = 0x01000000;
     //Header0.APP1.IFD1_JPEGInterChangeFormatTag.count = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_JPEGInterChangeFormatTag.valueoffset =
          M_ByteSwapOfDword((ULONG) ((USHORT) Header0.THUMB_SOI.Marker - (USHORT) &Header0.APP1.Tiff_ByteOrder));
     //Header0.APP1.IFD1_JPEGInterChangeFormatTag.valueoffset =
     //     EXIFHDR_ByteSwapOfULONG((ULONG) ((USHORT) Header0.THUMB_SOI.Marker - (USHORT) &Header0.APP1.Tiff_ByteOrder));

     Header0.APP1.IFD1_JPEGInterChangeFormatLengthTag.tag = 0x0202;
     //Header0.APP1.IFD1_JPEGInterChangeFormatLengthTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x0202);

     Header0.APP1.IFD1_JPEGInterChangeFormatLengthTag.type = 0x0400; //long
     //Header0.APP1.IFD1_JPEGInterChangeFormatLengthTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0004); //long

     Header0.APP1.IFD1_JPEGInterChangeFormatLengthTag.count = 0x01000000;
     //Header0.APP1.IFD1_JPEGInterChangeFormatLengthTag.count = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_JPEGInterChangeFormatLengthTag.valueoffset = M_ByteSwapOfDword(K_THUMBNAIL_STRUCTURE_SIZE);    //value
     //Header0.APP1.IFD1_JPEGInterChangeFormatLengthTag.valueoffset = EXIFHDR_ByteSwapOfULONG(K_THUMBNAIL_STRUCTURE_SIZE);    //value

     Header0.APP1.IFD1_YCbCrPositioningTag.tag = 0x1302;
     //Header0.APP1.IFD1_YCbCrPositioningTag.tag = EXIFHDR_ByteSwapOfUSHORT(0x0213);

     Header0.APP1.IFD1_YCbCrPositioningTag.type = 0x0300;  //short
     //Header0.APP1.IFD1_YCbCrPositioningTag.type = EXIFHDR_ByteSwapOfUSHORT(0x0003);  //short

     Header0.APP1.IFD1_YCbCrPositioningTag.count = 0x01000000;
     //Header0.APP1.IFD1_YCbCrPositioningTag.count = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_YCbCrPositioningTag.valueoffset = 0x02000000;    //value
     //Header0.APP1.IFD1_YCbCrPositioningTag.valueoffset = EXIFHDR_ByteSwapOfULONG(0x00000002);    //value

     Header0.APP1.IFD1_NextIFDOffset = 0x00000000;
     //Header0.APP1.IFD1_NextIFDOffset = EXIFHDR_ByteSwapOfULONG(0x00000000);

     Header0.APP1.IFD1_XResolutionValue[0] = 0x48000000;     //72 dpi
     //Header0.APP1.IFD1_XResolutionValue[0] = EXIFHDR_ByteSwapOfULONG(0x00000048);     //72 dpi

     Header0.APP1.IFD1_XResolutionValue[1] = 0x01000000;
     //Header0.APP1.IFD1_XResolutionValue[1] = EXIFHDR_ByteSwapOfULONG(0x00000001);

     Header0.APP1.IFD1_YResolutionValue[0] = 0x48000000;     //72 dpi
     //Header0.APP1.IFD1_YResolutionValue[0] = EXIFHDR_ByteSwapOfULONG(0x00000048);     //72 dpi

     Header0.APP1.IFD1_YResolutionValue[1] = 0x01000000;
     //Header0.APP1.IFD1_YResolutionValue[1] = EXIFHDR_ByteSwapOfULONG(0x00000001);
	//patch4.5@ada@improve power to shot performance end

//Thumbnail SOI
     Header0.THUMB_SOI.Marker[0] = 0xff;
     Header0.THUMB_SOI.Marker[1] = 0xd8;

//Thumbnail DQT
//     EXIFHDR_DQT(G_QtableIndex,&Header0.THUMB_DQT);  //ada@0225
     EXIFHDR_DQT(G_Image_QTableIndex,&Header0.THUMB_DQT);

//Thumbnail DHT
     EXIFHDR_DHT(&Header0.THUMB_DHT);

//Thumbnail SOF
     EXIFHDR_SOF(&Header0.THUMB_SOF,G_ucThumbnailWidth,G_ucThumbnailHeight);

//Thumbnail SOS
     EXIFHDR_SOS(&Header0.THUMB_SOS);

     EXIFHDR_Load_ExifHeader0_SRAM2DRAM(&Header0.SOI,pDramHdrAddr);
}

//-----------------------------------------------------------------------------
//EXIFHDR_Initialize_ExifHeader1
//-----------------------------------------------------------------------------
void EXIFHDR_Initialize_ExifHeader1(PULONG pDramHdrAddr) USING_0
{
     struct Exif_Header1 Header1;

//----- Header 1 -----
//EXIF COM
     EXIFHDR_ThumbOdd_COM(&Header1);

     EXIFHDR_Load_ExifHeader1_SRAM2DRAM(&Header1.ODD_COM,pDramHdrAddr);
}

//-----------------------------------------------------------------------------
//EXIFHDR_Initialize_ExifHeader2
//-----------------------------------------------------------------------------
void EXIFHDR_Initialize_ExifHeader2(PULONG pDramHdrAddr) USING_0
{
     struct Exif_Header2 Header2;

//----- Header 2 -----
//EXIF COM
     EXIFHDR_ThumbEven_COM(&Header2);

     EXIFHDR_Load_ExifHeader2_SRAM2DRAM(&Header2.EVEN_COM,pDramHdrAddr);
}

//-----------------------------------------------------------------------------
//EXIFHDR_Initialize_ExifHeader3
//-----------------------------------------------------------------------------
void EXIFHDR_Initialize_ExifHeader3(PULONG pDramHdrAddr) USING_0
{
     struct Exif_Header3 Header3;
     USHORT width,height;

//----- Header3 -----

//EXIF DQT
     EXIFHDR_DQT(G_Image_QTableIndex,&Header3.DQT);

//EXIF DHT
     EXIFHDR_DHT(&Header3.DHT);

//EXIF SOF

        if(G_CameraOptions.ImageSize == K_UIOPTION_IMGSIZE_HIGH)
        {
        	width = K_SENSOR_CaptureWidth;
		height = K_SENSOR_CaptureHeight; //hx@2003.5.38 updata for mito keep same rate 0.8
        }
	#if(INTERPOLATION_OPTION == 1)
			else if(G_CameraOptions.ImageSize == K_UIOPTION_IMGSIZE_INTERPOLATION)
			{
						width = K_SNAP_Resolution_Interpolation_Width;
						height = K_SNAP_Resolution_Interpolation_Height;
			}
#endif
        else if(G_CameraOptions.ImageSize == K_UIOPTION_IMGSIZE_MIDDLE)
        {
                width = K_SNAP_Resolution_Middle_Width;//File_GetActImageLength( K_SNAP_Resolution_Middle_Width, G_Image_HSubSample, G_Image_SrcDataType ) >> G_Image_HSubSample;
                height = K_SNAP_Resolution_Middle_Height;//File_GetActImageLength( G_Image_SensorHeight, G_Image_VSubSample, G_Image_SrcDataType ) >> G_Image_VSubSample;
        }
        else
        {
	        width = K_SNAP_Resolution_Low_Width;
	        height = K_SNAP_Resolution_Low_Height;
        }


     EXIFHDR_SOF(&Header3.SOF,width,height);

//EXIF SOS
     EXIFHDR_SOS(&Header3.SOS);

//----Copy all header to DRAM(from K_SDRAM_EXIF_AreaAddr,23K bytes space)
     EXIFHDR_Load_ExifHeader3_SRAM2DRAM(&Header3.DQT,pDramHdrAddr);
}

//-----------------------------------------------------------------------------
//EXIFHDR_ThumbOdd_COM
//-----------------------------------------------------------------------------
void EXIFHDR_ThumbOdd_COM(struct Exif_Header1 *hdr1) USING_0
{
     hdr1->ODD_COM.Marker[0] = 0xff;
     hdr1->ODD_COM.Marker[1] = 0xfe;

⌨️ 快捷键说明

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