📄 jpgapi.c
字号:
memcpy (tempExif, NcomponentModel, 4); //sanjeev
tempExif += 4 ;
//write model
// strcpy(model,tpJEInfo->Model);
memcpy(model,jCtx->ExifInfo->Model,32);
santemp=(int)(offset);
modeloffchar[0]=(unsigned char)santemp;
modeloffchar[1]=(unsigned char)(santemp>>8);
modeloffchar[2]=(unsigned char)(santemp>>16);
modeloffchar[3]=(unsigned char)(santemp>>24);
//write the model offset into the bitstream
memcpy (tempExif, modeloffchar, 4);
tempExif += 4 ;
memcpy (startoftiff+santemp, model, 32);
offset+=32;
///////////////ENTRY NO 3 :ORIENTATION OF CAMERA////////////////////////
//write orientation tag
memcpy (tempExif, orientationtag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, orientationformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentOrientation, 4);
tempExif += 4 ;
//write orientation mode
Orientation[0] =jCtx->ExifInfo->Orientation;
Orient[0] = (unsigned char)(Orientation[0]);
Orient[1] = (unsigned char)(Orientation[0]>>8);
Orient[2] = (unsigned char)(Orientation[0]>>16);
Orient[3] = (unsigned char)(Orientation[0]>>24);
memcpy (tempExif, Orient, 4);
tempExif += 4 ;
///////////////ENTRY NO 4 :JPEG PROCESS////////////////////////
//write orientation tag
memcpy (tempExif, Processtag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, Processformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentProcess, 4);
tempExif += 4 ;
//write orientation mode
Process[0] =jCtx->ExifInfo->Process;
Proc[0] = (unsigned char)(Process[0]);
Proc[1] = (unsigned char)(Process[0]>>8);
Proc[2] = (unsigned char)(Process[0]>>16);
Proc[3] = (unsigned char)(Process[0]>>24);
memcpy (tempExif, Proc, 4);
tempExif += 4 ;
///////////////ENTRY NO 5 :VERSION OF software////////////////////////
//write VERSION tag
memcpy (tempExif, Versiontag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, Versionformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentVersion, 4); //sanjeev
tempExif += 4 ;
santemp=(int)(offset);
Versionoffchar[0]=(unsigned char)santemp;
Versionoffchar[1]=(unsigned char)(santemp>>8);
Versionoffchar[2]=(unsigned char)(santemp>>16);
Versionoffchar[3]=(unsigned char)(santemp>>24);
//write the VERSION offset into the bitstream
memcpy (tempExif, Versionoffchar, 4);
tempExif += 4 ;
// strcpy(Version,jCtx->ExifInfo->Version);
memcpy(Version,jCtx->ExifInfo->Version,32);
memcpy (startoftiff+santemp, Version, 32);
offset+=32;
///////////////ENTRY NO 6 :Date/Time////////////////////////
//write model tag
memcpy (tempExif, DateTimetag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, DateTimeformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentDateTime, 4); //sanjeev
tempExif += 4 ;
//write Date/Time
//strcpy(DateTime,jCtx->ExifInfo->DateTime);
memcpy(DateTime,jCtx->ExifInfo->DateTime,20);
santemp=(int)(offset);
DateTimeoffchar[0]=(unsigned char)santemp;
DateTimeoffchar[1]=(unsigned char)(santemp>>8);
DateTimeoffchar[2]=(unsigned char)(santemp>>16);
DateTimeoffchar[3]=(unsigned char)(santemp>>24);
//write the model offset into the bitstream
memcpy (tempExif, DateTimeoffchar, 4);
tempExif += 4 ;
memcpy (startoftiff+santemp, DateTime, 19);
memcpy (startoftiff+santemp+19, DateTimeClose, 1);
offset+=32;
///////////////ENTRY NO 7 :COPYRIGHT INFO////////////////////////
//write model tag
memcpy (tempExif, CopyRighttag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, CopyRightformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentCopyRight, 4); //sanjeev
tempExif += 4 ;
// strcpy(CopyRight,jCtx->ExifInfo->CopyRight);////="copyright 2006";);
memcpy(CopyRight,jCtx->ExifInfo->CopyRight,32);
santemp=(int)(offset);
CopyRightoffchar[0]=(unsigned char)santemp;
CopyRightoffchar[1]=(unsigned char)(santemp>>8);
CopyRightoffchar[2]=(unsigned char)(santemp>>16);
CopyRightoffchar[3]=(unsigned char)(santemp>>24);
//write the model offset into the bitstream
memcpy (tempExif, CopyRightoffchar, 4);
tempExif += 4 ;
memcpy (startoftiff+santemp, CopyRight, 32);
offset+=32;
///////////////ENTRY NO 8 :OFFSET TO THE SubIFD ////////////////////////
//write SubIFD tag
memcpy (tempExif, SubIFDOffsettag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, SubIFDOffsetformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentSubIFDOffset, 4);
tempExif += 4 ;
//write the offset to the SubIFD
santemp=(int)(tempExif-startoftiff+8);
SubIFDOffsetChar[0] = (unsigned char)(santemp);
SubIFDOffsetChar[1] = (unsigned char)(santemp>>8);
SubIFDOffsetChar[2] = (unsigned char)(santemp>>16);
SubIFDOffsetChar[3] = (unsigned char)(santemp>>24);
memcpy (tempExif, SubIFDOffsetChar, 4);
tempExif += 4 ;
// since it was the last directory entry, so next 4 bytes contains an offset to the IFD1.
//since we dont know the offset lets put 0x0000 as an offset, later when get to know the
//actual offset we will revisit here and put the actual offset.
santemp=0x0000;
SubIFDOffsetChar[0] = (unsigned char)(santemp);
SubIFDOffsetChar[1] = (unsigned char)(santemp>>8);
SubIFDOffsetChar[2] = (unsigned char)(santemp>>16);
SubIFDOffsetChar[3] = (unsigned char)(santemp>>24);
IFD1OffsetAddress = tempExif;
memcpy (tempExif, SubIFDOffsetChar, 4);
tempExif += 4 ;
/////////////EXIF SUBIFD STARTS HERE//////////////////////////////////
//write no of entries in SubIFD
memcpy (tempExif, SubIFDNentries, 2);
tempExif += 2 ;
///////////////ENTRY NO 1 : EXPOSURE TIME////////////////////////
//write EXPOSURE TIME tag
memcpy (tempExif, ExposureTimetag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, ExposureTimeformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentExposureTime, 4);
tempExif += 4 ;
//write EXPOSURE TIME
santemp=(int)(offset);
ExposureTimeoffchar[0]=(unsigned char)santemp;
ExposureTimeoffchar[1]=(unsigned char)(santemp>>8);
ExposureTimeoffchar[2]=(unsigned char)(santemp>>16);
ExposureTimeoffchar[3]=(unsigned char)(santemp>>24);
//write the X-Resolution offset into the bitstream
memcpy (tempExif, ExposureTimeoffchar, 4);
tempExif += 4 ;
ExposureTimeNum[0]=jCtx->ExifInfo->ExposureTimeNum;
ExposureTimeDen[0]=jCtx->ExifInfo->ExposureTimeDen;
ExposureTimeNumChar[0]=(unsigned char)ExposureTimeNum[0];
ExposureTimeNumChar[1]=(unsigned char)(ExposureTimeNum[0]>>8);
ExposureTimeNumChar[2]=(unsigned char)(ExposureTimeNum[0]>>16);
ExposureTimeNumChar[3]=(unsigned char)(ExposureTimeNum[0]>>24);
ExposureTimeDenChar[0]=(unsigned char)ExposureTimeDen[0];
ExposureTimeDenChar[1]=(unsigned char)(ExposureTimeDen[0]>>8);
ExposureTimeDenChar[2]=(unsigned char)(ExposureTimeDen[0]>>16);
ExposureTimeDenChar[3]=(unsigned char)(ExposureTimeDen[0]>>24);
//WRITE THE EXPOSURE TIME NUMERATOR
memcpy (startoftiff+santemp, ExposureTimeNumChar, 4);
memcpy (startoftiff+santemp+4, ExposureTimeDenChar, 4);
offset+=32;
///////////////ENTRY NO 2 : F NUMBER////////////////////////
//write FNumber tag
memcpy (tempExif, FNumbertag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, FNumberformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentFNumber, 4); //sanjeev
tempExif += 4 ;
//write F NUMBER
santemp=(int)(offset);
FNumberoffchar[0]=(unsigned char)santemp;
FNumberoffchar[1]=(unsigned char)(santemp>>8);
FNumberoffchar[2]=(unsigned char)(santemp>>16);
FNumberoffchar[3]=(unsigned char)(santemp>>24);
//write the F NUMBER into the bitstream
memcpy (tempExif, FNumberoffchar, 4);
tempExif += 4 ;
FNumberNum[0]=jCtx->ExifInfo->FNumberNum;
FNumberDen[0]=jCtx->ExifInfo->FNumberDen;
FNumberNumChar[0]=(unsigned char)FNumberNum[0];
FNumberNumChar[1]=(unsigned char)(FNumberNum[0]>>8);
FNumberNumChar[2]=(unsigned char)(FNumberNum[0]>>16);
FNumberNumChar[3]=(unsigned char)(FNumberNum[0]>>24);
FNumberDenChar[0]=(unsigned char)FNumberDen[0];
FNumberDenChar[1]=(unsigned char)(FNumberDen[0]>>8);
FNumberDenChar[2]=(unsigned char)(FNumberDen[0]>>16);
FNumberDenChar[3]=(unsigned char)(FNumberDen[0]>>24);
//WRITE THE FNumber NUMERATOR
memcpy (startoftiff+santemp, FNumberNumChar, 4);
memcpy (startoftiff+santemp+4, FNumberDenChar, 4);
offset+=32;
///////////////ENTRY NO 3 :EXPOSURE PROGRAM////////////////////////
//write ExposureProgram tag
memcpy (tempExif, ExposureProgramtag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, ExposureProgramformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentExposureProgram, 4);
tempExif += 4 ;
//write orientation mode
ExposureProgram[0] =jCtx->ExifInfo->ExposureProgram;
ExposureProgramChar[0] = (unsigned char)(ExposureProgram[0]);
ExposureProgramChar[1] = (unsigned char)(ExposureProgram[0]>>8);
ExposureProgramChar[2] = (unsigned char)(ExposureProgram[0]>>16);
ExposureProgramChar[3] = (unsigned char)(ExposureProgram[0]>>24);
memcpy (tempExif, ExposureProgramChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 4 :ISOSpeedRatings ////////////////////////
//write ISOSpeedRatings tag
memcpy (tempExif, ISOSpeedRatingstag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, ISOSpeedRatingsformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentISOSpeedRatings, 4);
tempExif += 4 ;
//write orientation mode
ISOSpeedRatings[0] = 1;
ISOSpeedRatings[1] = 2;
ISOSpeedRatingsChar[0] = (unsigned char)(ISOSpeedRatings[0]);
ISOSpeedRatingsChar[1] = (unsigned char)(ISOSpeedRatings[0]>>8);
ISOSpeedRatingsChar[2] = (unsigned char)(ISOSpeedRatings[1]);
ISOSpeedRatingsChar[3] = (unsigned char)(ISOSpeedRatings[1]>>8);
memcpy (tempExif, ISOSpeedRatingsChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 5 : BRIGHTNESS OF THE IMAGE////////////////////////
//write BRIGHTNESS tag
memcpy (tempExif, Brightnesstag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, Brightnessformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentBrightness, 4); //sanjeev
tempExif += 4 ;
//write X - Resolution
santemp=(int)(offset);
Brightnessoffchar[0]=(unsigned char)santemp;
Brightnessoffchar[1]=(unsigned char)(santemp>>8);
Brightnessoffchar[2]=(unsigned char)(santemp>>16);
Brightnessoffchar[3]=(unsigned char)(santemp>>24);
//write the X-Resolution offset into the bitstream
memcpy (tempExif, Brightnessoffchar, 4);
tempExif += 4 ;
BrightnessNum[0] = jCtx->ExifInfo->BrightnessNum;
BrightnessDen[0] = jCtx->ExifInfo->BrightnessDen;
BrightnessNumChar[0]=(unsigned char)BrightnessNum[0];
BrightnessNumChar[1]=(unsigned char)(BrightnessNum[0]>>8);
BrightnessNumChar[2]=(unsigned char)(BrightnessNum[0]>>16);
BrightnessNumChar[3]=(unsigned char)(BrightnessNum[0]>>24);
BrightnessDenChar[0]=(unsigned char)BrightnessDen[0];
BrightnessDenChar[1]=(unsigned char)(BrightnessDen[0]>>8);
BrightnessDenChar[2]=(unsigned char)(BrightnessDen[0]>>16);
BrightnessDenChar[3]=(unsigned char)(BrightnessDen[0]>>24);
//WRITE THE X - RESOLUTION NUMERATOR
memcpy (startoftiff+santemp, BrightnessNumChar, 4);
memcpy (startoftiff+santemp+4, BrightnessDenChar, 4);
offset+=48;
///////////////ENTRY NO 6 : EXPOSURE BIAS OF THE IMAGE////////////////////////
//write BRIGHTNESS tag
memcpy (tempExif, ExposureBiastag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, ExposureBiasformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentExposureBias, 4); //sanjeev
tempExif += 4 ;
//write EXPOSURE BIAS
santemp=(int)(offset);
ExposureBiasoffchar[0]=(unsigned char)santemp;
ExposureBiasoffchar[1]=(unsigned char)(santemp>>8);
ExposureBiasoffchar[2]=(unsigned char)(santemp>>16);
ExposureBiasoffchar[3]=(unsigned char)(santemp>>24);
//write the EXPOSURE BIAS offset into the bitstream
memcpy (tempExif, ExposureBiasoffchar, 4);
tempExif += 4 ;
ExposureBiasNum[0]=jCtx->ExifInfo->ExposureBiasNum;
ExposureBiasDen[0]=jCtx->ExifInfo->ExposureBiasDen;
ExposureBiasNumChar[0]=(unsigned char)ExposureBiasNum[0];
ExposureBiasNumChar[1]=(unsigned char)(ExposureBiasNum[0]>>8);
ExposureBiasNumChar[2]=(unsigned char)(ExposureBiasNum[0]>>16);
ExposureBiasNumChar[3]=(unsigned char)(ExposureBiasNum[0]>>24);
ExposureBiasDenChar[0]=(unsigned char)ExposureBiasDen[0];
ExposureBiasDenChar[1]=(unsigned char)(ExposureBiasDen[0]>>8);
ExposureBiasDenChar[2]=(unsigned char)(ExposureBiasDen[0]>>16);
ExposureBiasDenChar[3]=(unsigned char)(ExposureBiasDen[0]>>24);
//WRITE THE EXPOSURE BIAS NUMERATOR
memcpy (startoftiff+santemp, ExposureBiasNumChar, 4);
memcpy (startoftiff+santemp+4, ExposureBiasDenChar, 4);
offset+=48;
///////////////ENTRY NO 7 : SUBJECT DISTANCE////////////////////////
//write SUBJECT DISTANCE tag
memcpy (tempExif, SubjectDistancetag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, SubjectDistanceformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentSubjectDistance, 4); //sanjeev
tempExif += 4 ;
//write SUBJECT DISTANCE
santemp=(int)(offset);
SubjectDistanceoffchar[0]=(unsigned char)santemp;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -