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

📄 jpgapi.c

📁 JPEG DLL API
💻 C
📖 第 1 页 / 共 5 页
字号:
    free(jCtx);

    return JPEG_OK;
}

/*----------------------------------------------------------------------------
*Function: SsbSipJPEGEncodeDeInit

*Parameters:         *openHandle : openhandle from SsbSipJPEGEncodeInit
*Return Value:        True/False
*Implementation Notes: Deinitialize JPEG Encoder Device Driver 
-----------------------------------------------------------------------------*/
JPEG_ERRORTYPE SsbSipJPEGEncodeDeInit (void *openHandle)
{
    CloseHandle(openHandle);

    if(jCtx->encParam != NULL)
        free(jCtx->decParam);

    if(jCtx->thumbEncParam != NULL)
        free(jCtx->thumbEncParam);

    if(jCtx->ExifInfo != NULL)
        free(jCtx->ExifInfo);

    free(jCtx);
    return JPEG_OK;
}
/*----------------------------------------------------------------------------
*Function: SsbSipJPEGDisplay

*Parameters:         *openHandle : openhandle from SsbSipJPEGEncodeInit
*Return Value:        True/False
*Implementation Notes: Deinitialize JPEG Encoder Device Driver 
-----------------------------------------------------------------------------*/
void *SsbSipJPEGGetDecodeOutPhyBuf(void *openHandle)
{
    HANDLE    hJpegDrv = INVALID_HANDLE_VALUE;
    char    *phy_addr_frame;

    hJpegDrv = DeviceIoControl(openHandle, IOCTL_JPG_GET_PHY_FRMBUF, NULL, 0, &phy_addr_frame, sizeof(phy_addr_frame), NULL, NULL);
    if(hJpegDrv == INVALID_HANDLE_VALUE){
            RETAILMSG(1, (TEXT("API :: IOCTL_JPG_GET_PHY_FRMBUF failed\r\n")));
            return NULL;
    }

    printD("phy_addr_frame : 0x%x\n", phy_addr_frame);
    return phy_addr_frame;
}

/*----------------------------------------------------------------------------
*Function: SsbSipJPEGGetRGBBuf

*Parameters:         *openHandle : openhandle from SsbSipJPEGEncodeInit
*Return Value:        True/False
*Implementation Notes: Deinitialize JPEG Encoder Device Driver 
-----------------------------------------------------------------------------*/
void *SsbSipJPEGGetRGBBuf(void *openHandle, INT32 width, INT32 height)
{
    HANDLE    hJpegDrv = INVALID_HANDLE_VALUE;
    char    *addr_rgb;
    INT32    RGBSize;

    RGBSize = width*height*2;
    if(RGBSize > MAX_RGB_WIDTH*MAX_RGB_HEIGHT*2){
            RETAILMSG(1, (TEXT("API :: RGB width and height is too big\r\n")));
            return NULL;
    }

    hJpegDrv = DeviceIoControl(openHandle, IOCTL_JPG_GET_RGBBUF, NULL, 0, &addr_rgb, sizeof(addr_rgb), NULL, NULL);
    if(hJpegDrv == INVALID_HANDLE_VALUE){
            RETAILMSG(1, (TEXT("API :: IOCTL_JPG_GET_RGBBUF failed\r\n")));
            return NULL;
    }

    printD("addr_rgb : 0x%x\n", addr_rgb);
    return addr_rgb;
}

/*----------------------------------------------------------------------------
*Function: SsbSipJPEGGetRGBPhyBuf

*Parameters:         *openHandle : openhandle from SsbSipJPEGEncodeInit
*Return Value:        True/False
*Implementation Notes: Deinitialize JPEG Encoder Device Driver 
-----------------------------------------------------------------------------*/
void *SsbSipJPEGGetRGBPhyBuf(void *openHandle, INT32 width, INT32 height)
{
    HANDLE    hJpegDrv = INVALID_HANDLE_VALUE;
    char    *phy_addr_rgb;
    INT32    RGBSize;

    RGBSize = width*height*2;
    if(RGBSize > MAX_RGB_WIDTH*MAX_RGB_HEIGHT*2){
            RETAILMSG(1, (TEXT("API :: RGB width and height is too big\r\n")));
            return NULL;
    }

    hJpegDrv = DeviceIoControl(openHandle, IOCTL_JPG_GET_PHY_RGBBUF, NULL, 0, &phy_addr_rgb, sizeof(phy_addr_rgb), NULL, NULL);
    if(hJpegDrv == INVALID_HANDLE_VALUE){
            RETAILMSG(1, (TEXT("API :: IOCTL_JPG_GET_PHY_RGBBUF failed\r\n")));
            return NULL;
    }

    printD("phy_addr_rgb : 0x%x\n", phy_addr_rgb);
    return phy_addr_rgb;
}



/*----------------------------------------------------------------------------
*Function: makeExifFile

*Parameters:         *jCtx : Exif file information & thumbnail data
                    *ExifOut : result buffer of Exif file
                    *totalLen : the length of Exif file
*Return Value:
*Implementation Notes: make Exif file
-----------------------------------------------------------------------------*/
static JPEG_ERRORTYPE makeExifFile(char *ExifOut, UINT *totalLen)
{
    UCHAR *ExifInitialCount;
    UCHAR *tempExif = ExifOut;
    UINT ExifSize;
    UINT santemp;
    UCHAR * startoftiff;
    UCHAR * IFD1OffsetAddress;
    UCHAR APP1Marker[2]=    {0xff,0xe1};
    UCHAR ExifLen[4]={0};
    UCHAR Nentries[2]={8,0};
    UCHAR SubIFDNentries[2]={18,0};
    UCHAR IFD1Nentries[2]={6,0};
    UCHAR EndOfEntry[4]={0};

    //VARIABLES FOR THE MAKE OF THE CAMERA
    UCHAR  maketag[2]={0xf,0x1};    
    UCHAR  makeformat[2]={0x2,0x0};
    UCHAR  Ncomponent[4]={32,0x0,0x0,0x0};
    char  make[32];
    UCHAR makeoffchar[4];
    UCHAR * offset;

    //VARIABLES FOR THE MODEL OF THE CAMERA
    UCHAR  modeltag[2]={0x10,0x1};    
    UCHAR  modelformat[2]={0x2,0x0};
    UCHAR  NcomponentModel[4]={32,0x0,0x0,0x0};        
    char  model[32];
    UCHAR modeloffchar[4];
    
    //VARIABLES FOR THE ORIENTATION OF THE CAMERA
    UCHAR  orientationtag[2]={0x12,0x1};    
    UCHAR  orientationformat[2]={0x3,0x0};
    UCHAR  NcomponentOrientation[4]={0x1,0x0,0x0,0x0};    
    UINT  Orientation[1];
    UCHAR  Orient[4] = {0};

        
    //VARIABLES FOR THE JPEG PROCESS
    UCHAR  Processtag[2]={0x00,0x02};    
    UCHAR  Processformat[2]={0x3,0x0};
    UCHAR  NcomponentProcess[4]={0x1,0x0,0x0,0x0};    
    UINT  Process[1];
    UCHAR  Proc[4] = {0};

    //VARIABLES FOR THE X-RESOLUTION OF THE IMAGE    
    UCHAR  XResolutiontag[2]={0x1A,0x1};    
    UCHAR  XResolutionformat[2]={0x5,0x0};
    UCHAR  NcomponentXResolution[4]={0x1,0x0,0x0,0x0};    
    UINT  XResolutionNum[1];//={0x00000048};
    UINT  XResolutionDen[1];//={0x00000001};
    
    UCHAR XResolutionoffchar[4];
    UCHAR XResolutionNumChar[4];
    UCHAR XResolutionDenChar[4];

    //VARIABLES FOR THE Y-RESOLUTION OF THE IMAGE
    UCHAR  YResolutiontag[2]={0x1B,0x1};    
    UCHAR  YResolutionformat[2]={0x5,0x0};
    UCHAR  NcomponentYResolution[4]={0x1,0x0,0x0,0x0};    
    UINT  YResolutionNum[1];//={0x00000048};
    UINT  YResolutionDen[1];//={0x00000001};
    
    UCHAR YResolutionoffchar[4];
    UCHAR YResolutionNumChar[4];
    UCHAR YResolutionDenChar[4];

    //VARIABLES FOR THE RESOLUTION UNIT OF THE CAMERA
    UCHAR  RUnittag[2]={0x28,0x1};    
    UCHAR  RUnitformat[2]={0x3,0x0};
    UCHAR  NcomponentRUnit[4]={0x1,0x0,0x0,0x0};    
    UINT  RUnit[1];
    UCHAR  RUnitChar[4] = {0};

    
    //VARIABLES FOR THE VERSION NO OF THE SOFTWARE
    UCHAR  Versiontag[2]={0x31,0x1};    
    UCHAR  Versionformat[2]={0x2,0x0};
    UCHAR  NcomponentVersion[4]={32,0x0,0x0,0x0};    
    char  Version[32];//="version 1.2";
    UCHAR Versionoffchar[4];

    //VARIABLES FOR THE DATE/TIME 
    UCHAR  DateTimetag[2]={0x32,0x1};    
    UCHAR  DateTimeformat[2]={0x2,0x0};
    UCHAR  NcomponentDateTime[4]={20,0,0,0};        
    UCHAR  DateTime[32];//="2006:6:09 15:17:32";
    char  DateTimeClose[1]={0};
    UCHAR DateTimeoffchar[4];

    //VARIABLES FOR THE COPYRIGHT
    UCHAR  CopyRighttag[2]={0x98,0x82};    
    UCHAR  CopyRightformat[2]={0x2,0x0};
    UCHAR  NcomponentCopyRight[4]={32,0x0,0x0,0x0};        
    char  CopyRight[32];
    UCHAR CopyRightoffchar[4];

    //VARIABLES FOR THE OFFSET TO SUBIFD 
    UCHAR  SubIFDOffsettag[2]={0x69,0x87};    
    UCHAR  SubIFDOffsetformat[2]={0x4,0x0};
    UCHAR  NcomponentSubIFDOffset[4]={0x1,0x0,0x0,0x0};        
    UCHAR  SubIFDOffsetChar[4] = {0};


    //VARIABLES FOR THE EXPOSURE TIME     
    UCHAR  ExposureTimetag[2]={0x9A,0x82};    
    UCHAR  ExposureTimeformat[2]={0x5,0x0};
    UCHAR  NcomponentExposureTime[4]={0x1,0x0,0x0,0x0};    
    UINT  ExposureTimeNum[1];
    UINT  ExposureTimeDen[1];
    
    UCHAR ExposureTimeoffchar[4];
    UCHAR ExposureTimeNumChar[4];
    UCHAR ExposureTimeDenChar[4];

    //VARIABLES FOR THE FNUMBER    
    UCHAR  FNumbertag[2]={0x9D,0x82};    
    UCHAR  FNumberformat[2]={0x5,0x0};
    UCHAR  NcomponentFNumber[4]={0x1,0x0,0x0,0x0};    
    UINT  FNumberNum[1];
    UINT  FNumberDen[1];
    
    UCHAR FNumberoffchar[4];
    UCHAR FNumberNumChar[4];
    UCHAR FNumberDenChar[4];

    //VARIABLES FOR THE EXPOSURE PROGRAM OF THE CAMERA
    UCHAR  ExposureProgramtag[2]={0x22,0x88};    
    UCHAR  ExposureProgramformat[2]={0x3,0x0};
    UCHAR  NcomponentExposureProgram[4]={0x1,0x0,0x0,0x0};    
    UINT  ExposureProgram[1];
    UCHAR  ExposureProgramChar[4] = {0};

    //VARIABLES FOR THE ISO SPEED RATINGS OF THE CAMERA
    UCHAR  ISOSpeedRatingstag[2]={0x27,0x88};    
    UCHAR  ISOSpeedRatingsformat[2]={0x3,0x0};
    UCHAR  NcomponentISOSpeedRatings[4]={0x2,0x0,0x0,0x0};    
    unsigned short   ISOSpeedRatings[2];    
    UCHAR  ISOSpeedRatingsChar[4] = {0};

    //VARIABLES FOR THE BRIGHTNESS OF THE IMAGE    
    UCHAR  Brightnesstag[2]={0x03,0x92};    
    UCHAR  Brightnessformat[2]={0xA,0x0};
    UCHAR  NcomponentBrightness[4]={0x1,0x0,0x0,0x0};    
    int BrightnessNum[1];
    int BrightnessDen[1];
    
    UCHAR Brightnessoffchar[4];
    UCHAR BrightnessNumChar[4];
    UCHAR BrightnessDenChar[4];

    //VARIABLES FOR THE EXPOSURE Bias    
    UCHAR  ExposureBiastag[2]={0x04,0x92};    
    UCHAR  ExposureBiasformat[2]={0xA,0x0};
    UCHAR  NcomponentExposureBias[4]={0x1,0x0,0x0,0x0};    
    int ExposureBiasNum[1];//={-8};
    int ExposureBiasDen[1];//={1};
    
    UCHAR ExposureBiasoffchar[4];
    UCHAR ExposureBiasNumChar[4];
    UCHAR ExposureBiasDenChar[4];

    //VARIABLES FOR THE SUBJECT DISTANCE OF THE IMAGE    
    UCHAR  SubjectDistancetag[2]={0x06,0x92};    
    UCHAR  SubjectDistanceformat[2]={0xA,0x0};
    UCHAR  NcomponentSubjectDistance[4]={0x1,0x0,0x0,0x0};    
    int SubjectDistanceNum[1];
    int SubjectDistanceDen[1];
    
    UCHAR SubjectDistanceoffchar[4];
    UCHAR SubjectDistanceNumChar[4];
    UCHAR SubjectDistanceDenChar[4];

    //VARIABLES FOR THE METERING MODE
    UCHAR  MeteringModetag[2]={0x07,0x92};    
    UCHAR  MeteringModeformat[2]={0x3,0x0};
    UCHAR  NcomponentMeteringMode[4]={0x1,0x0,0x0,0x0};    
    UINT   MeteringMode[1];
    UCHAR  MeteringModeChar[4] = {0};

    //VARIABLES FOR THE FLASH
    UCHAR  Flashtag[2]={0x09,0x92};    
    UCHAR  Flashformat[2]={0x3,0x0};
    UCHAR  NcomponentFlash[4]={0x1,0x0,0x0,0x0};    
    UINT   Flash[1]={1};
    UCHAR  FlashChar[4] = {0};

    //VARIABLES FOR THE FOCAL LENGTH    
    UCHAR  FocalLengthtag[2]={0x0A,0x92};    
    UCHAR  FocalLengthformat[2]={0x5,0x0};
    UCHAR  NcomponentFocalLength[4]={0x1,0x0,0x0,0x0};    
    UINT FocalLengthNum[1];
    UINT FocalLengthDen[1];
    
    UCHAR FocalLengthoffchar[4];
    UCHAR FocalLengthNumChar[4];
    UCHAR FocalLengthDenChar[4];

    //VARIABLES FOR THE ISO WIDTH OF THE MAIN IMAGE            
    UCHAR  Widthtag[2]={0x02,0xA0};    
    UCHAR  Widthformat[2]={0x3,0x0};
    UCHAR  NcomponentWidth[4]={0x1,0x0,0x0,0x0};    
    UINT   Width[1];
    UCHAR  WidthChar[4] = {0};

    //VARIABLES FOR THE ISO HEIGHT OF THE MAIN IMAGE        
    UCHAR  Heighttag[2]={0x03,0xA0};    
    UCHAR  Heightformat[2]={0x3,0x0};
    UCHAR  NcomponentHeight[4]={0x1,0x0,0x0,0x0};    
    UINT   Height[1];
    UCHAR  HeightChar[4] = {0};

    //VARIABLES FOR THE COLORSPACE
    UCHAR  ColorSpacetag[2]={0x01,0xA0};    
    //char  ColorSpacetag[2]={0x54,0x56};
    UCHAR  ColorSpaceformat[2]={0x3,0x0};
    UCHAR  NcomponentColorSpace[4]={0x1,0x0,0x0,0x0};    
    UINT   ColorSpace[1];//={1};
    UCHAR  ColorSpaceChar[4] = {0};

    //VARIABLES FOR THE FocalPlaneXResolution    
    UCHAR  FocalPlaneXResolutiontag[2]={0x0E,0xA2};    
    UCHAR  FocalPlaneXResolutionformat[2]={0x5,0x0};
    UCHAR  NcomponentFocalPlaneXResolution[4]={0x1,0x0,0x0,0x0};    
    UINT FocalPlaneXResolutionNum[1];
    UINT FocalPlaneXResolutionDen[1];
    
    UCHAR FocalPlaneXResolutionoffchar[4];
    UCHAR FocalPlaneXResolutionNumChar[4];
    UCHAR FocalPlaneXResolutionDenChar[4];

    //VARIABLES FOR THE FocalPlaneYResolution     
    UCHAR  FocalPlaneYResolutiontag[2]={0x0F,0xA2};    
    UCHAR  FocalPlaneYResolutionformat[2]={0x5,0x0};
    UCHAR  NcomponentFocalPlaneYResolution[4]={0x1,0x0,0x0,0x0};    
    UINT FocalPlaneYResolutionNum[1];

⌨️ 快捷键说明

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