Normalize line endings and whitespace
This commit is contained in:
parent
0442bca235
commit
81f826db2b
55
.gitattributes
vendored
Normal file
55
.gitattributes
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
.git* export-ignore
|
||||||
|
|
||||||
|
* text=auto
|
||||||
|
* whitespace=!indent,trail,space
|
||||||
|
|
||||||
|
*.py text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.cpp text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.hpp text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.cxx text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.hxx text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.mm text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.c text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.h text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.i text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.java text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.cu text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.cl text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
|
||||||
|
*.cmake text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.cmakein text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
*.in text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
CMakeLists.txt text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
|
||||||
|
*.rst text whitespace=tab-in-indent,trail,space,fix
|
||||||
|
|
||||||
|
*.png binary
|
||||||
|
*.jepg binary
|
||||||
|
*.jpg binary
|
||||||
|
*.exr binary
|
||||||
|
*.ico binary
|
||||||
|
|
||||||
|
*.a binary
|
||||||
|
*.so binary
|
||||||
|
*.dll binary
|
||||||
|
|
||||||
|
*.pdf binary
|
||||||
|
*.pbxproj binary
|
||||||
|
*.vec binary
|
||||||
|
*.doc binary
|
||||||
|
|
||||||
|
*.css_t text
|
||||||
|
*.qrc text
|
||||||
|
*.qss text
|
||||||
|
*.S text
|
||||||
|
|
||||||
|
*.xml -text
|
||||||
|
*.yml -text
|
||||||
|
|
||||||
|
*.vcproj text eol=crlf merge=union
|
||||||
|
*.cproject text eol=crlf merge=union
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
||||||
|
*.cmd.tmpl text eol=crlf
|
||||||
|
|
||||||
|
*.sh text eol=lf
|
28
3rdparty/include/dshow/audevcod.h
vendored
28
3rdparty/include/dshow/audevcod.h
vendored
@ -9,20 +9,20 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum _tagSND_DEVICE_ERROR {
|
typedef enum _tagSND_DEVICE_ERROR {
|
||||||
SNDDEV_ERROR_Open = 1,
|
SNDDEV_ERROR_Open = 1,
|
||||||
SNDDEV_ERROR_Close = 2,
|
SNDDEV_ERROR_Close = 2,
|
||||||
SNDDEV_ERROR_GetCaps = 3,
|
SNDDEV_ERROR_GetCaps = 3,
|
||||||
SNDDEV_ERROR_PrepareHeader = 4,
|
SNDDEV_ERROR_PrepareHeader = 4,
|
||||||
SNDDEV_ERROR_UnprepareHeader = 5,
|
SNDDEV_ERROR_UnprepareHeader = 5,
|
||||||
SNDDEV_ERROR_Reset = 6,
|
SNDDEV_ERROR_Reset = 6,
|
||||||
SNDDEV_ERROR_Restart = 7,
|
SNDDEV_ERROR_Restart = 7,
|
||||||
SNDDEV_ERROR_GetPosition = 8,
|
SNDDEV_ERROR_GetPosition = 8,
|
||||||
SNDDEV_ERROR_Write = 9,
|
SNDDEV_ERROR_Write = 9,
|
||||||
SNDDEV_ERROR_Pause = 10,
|
SNDDEV_ERROR_Pause = 10,
|
||||||
SNDDEV_ERROR_Stop = 11,
|
SNDDEV_ERROR_Stop = 11,
|
||||||
SNDDEV_ERROR_Start = 12,
|
SNDDEV_ERROR_Start = 12,
|
||||||
SNDDEV_ERROR_AddBuffer = 13,
|
SNDDEV_ERROR_AddBuffer = 13,
|
||||||
SNDDEV_ERROR_Query = 14
|
SNDDEV_ERROR_Query = 14
|
||||||
} SNDDEV_ERR;
|
} SNDDEV_ERR;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
18
3rdparty/include/dshow/bdatypes.h
vendored
Executable file → Normal file
18
3rdparty/include/dshow/bdatypes.h
vendored
Executable file → Normal file
@ -10,20 +10,20 @@ extern "C" {
|
|||||||
|
|
||||||
/*--- DirectShow Reference - DirectShow Enumerated Types */
|
/*--- DirectShow Reference - DirectShow Enumerated Types */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MEDIA_TRANSPORT_PACKET,
|
MEDIA_TRANSPORT_PACKET,
|
||||||
MEDIA_ELEMENTARY_STREAM,
|
MEDIA_ELEMENTARY_STREAM,
|
||||||
MEDIA_MPEG2_PSI,
|
MEDIA_MPEG2_PSI,
|
||||||
MEDIA_TRANSPORT_PAYLOAD
|
MEDIA_TRANSPORT_PAYLOAD
|
||||||
} MEDIA_SAMPLE_CONTENT;
|
} MEDIA_SAMPLE_CONTENT;
|
||||||
/*--- DirectShow Reference - DirectShow Structures */
|
/*--- DirectShow Reference - DirectShow Structures */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DWORD dwOffset;
|
DWORD dwOffset;
|
||||||
DWORD dwPacketLength;
|
DWORD dwPacketLength;
|
||||||
DWORD dwStride;
|
DWORD dwStride;
|
||||||
} MPEG2_TRANSPORT_STRIDE;
|
} MPEG2_TRANSPORT_STRIDE;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ULONG ulPID;
|
ULONG ulPID;
|
||||||
MEDIA_SAMPLE_CONTENT MediaSampleContent ;
|
MEDIA_SAMPLE_CONTENT MediaSampleContent ;
|
||||||
} PID_MAP;
|
} PID_MAP;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
228
3rdparty/include/dshow/ddraw.h
vendored
228
3rdparty/include/dshow/ddraw.h
vendored
@ -322,7 +322,7 @@ typedef struct IDirectDrawGammaControl *LPDIRECTDRAWGAMMACONTROL;
|
|||||||
#define DDSCAPS_OPTIMIZED 0x80000000
|
#define DDSCAPS_OPTIMIZED 0x80000000
|
||||||
|
|
||||||
typedef struct _DDSCAPS {
|
typedef struct _DDSCAPS {
|
||||||
DWORD dwCaps; /* capabilities of surface wanted */
|
DWORD dwCaps; /* capabilities of surface wanted */
|
||||||
} DDSCAPS,*LPDDSCAPS;
|
} DDSCAPS,*LPDDSCAPS;
|
||||||
|
|
||||||
/* DDSCAPS2.dwCaps2 */
|
/* DDSCAPS2.dwCaps2 */
|
||||||
@ -368,21 +368,21 @@ typedef struct _DDSCAPS {
|
|||||||
#define DDSCAPS2_STEREOSURFACELEFT 0x00080000
|
#define DDSCAPS2_STEREOSURFACELEFT 0x00080000
|
||||||
|
|
||||||
typedef struct _DDSCAPS2 {
|
typedef struct _DDSCAPS2 {
|
||||||
DWORD dwCaps; /* capabilities of surface wanted */
|
DWORD dwCaps; /* capabilities of surface wanted */
|
||||||
DWORD dwCaps2; /* additional capabilities */
|
DWORD dwCaps2; /* additional capabilities */
|
||||||
DWORD dwCaps3; /* reserved capabilities */
|
DWORD dwCaps3; /* reserved capabilities */
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwCaps4; /* low word is the depth for a volume texture */
|
DWORD dwCaps4; /* low word is the depth for a volume texture */
|
||||||
DWORD dwVolumeDepth;
|
DWORD dwVolumeDepth;
|
||||||
} DUMMYUNIONNAME1;
|
} DUMMYUNIONNAME1;
|
||||||
} DDSCAPS2,*LPDDSCAPS2;
|
} DDSCAPS2,*LPDDSCAPS2;
|
||||||
|
|
||||||
typedef struct _DDSCAPSEX {
|
typedef struct _DDSCAPSEX {
|
||||||
DWORD dwCaps2;
|
DWORD dwCaps2;
|
||||||
DWORD dwCaps3;
|
DWORD dwCaps3;
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwCaps4;
|
DWORD dwCaps4;
|
||||||
DWORD dwVolumeDepth;
|
DWORD dwVolumeDepth;
|
||||||
} DUMMYUNIONNAME1;
|
} DUMMYUNIONNAME1;
|
||||||
} DDSCAPSEX,*LPDDSCAPSEX;
|
} DDSCAPSEX,*LPDDSCAPSEX;
|
||||||
|
|
||||||
@ -712,12 +712,12 @@ typedef DDCAPS *LPDDCAPS;
|
|||||||
|
|
||||||
typedef struct _DDCOLORKEY
|
typedef struct _DDCOLORKEY
|
||||||
{
|
{
|
||||||
DWORD dwColorSpaceLowValue;/* low boundary of color space that is to
|
DWORD dwColorSpaceLowValue;/* low boundary of color space that is to
|
||||||
* be treated as Color Key, inclusive
|
* be treated as Color Key, inclusive
|
||||||
*/
|
*/
|
||||||
DWORD dwColorSpaceHighValue;/* high boundary of color space that is
|
DWORD dwColorSpaceHighValue;/* high boundary of color space that is
|
||||||
* to be treated as Color Key, inclusive
|
* to be treated as Color Key, inclusive
|
||||||
*/
|
*/
|
||||||
} DDCOLORKEY,*LPDDCOLORKEY;
|
} DDCOLORKEY,*LPDDCOLORKEY;
|
||||||
|
|
||||||
/* ddCKEYCAPS bits */
|
/* ddCKEYCAPS bits */
|
||||||
@ -746,40 +746,40 @@ typedef struct _DDPIXELFORMAT {
|
|||||||
DWORD dwFlags; /* 4: pixel format flags */
|
DWORD dwFlags; /* 4: pixel format flags */
|
||||||
DWORD dwFourCC; /* 8: (FOURCC code) */
|
DWORD dwFourCC; /* 8: (FOURCC code) */
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwRGBBitCount; /* C: how many bits per pixel */
|
DWORD dwRGBBitCount; /* C: how many bits per pixel */
|
||||||
DWORD dwYUVBitCount; /* C: how many bits per pixel */
|
DWORD dwYUVBitCount; /* C: how many bits per pixel */
|
||||||
DWORD dwZBufferBitDepth; /* C: how many bits for z buffers */
|
DWORD dwZBufferBitDepth; /* C: how many bits for z buffers */
|
||||||
DWORD dwAlphaBitDepth; /* C: how many bits for alpha channels*/
|
DWORD dwAlphaBitDepth; /* C: how many bits for alpha channels*/
|
||||||
DWORD dwLuminanceBitCount;
|
DWORD dwLuminanceBitCount;
|
||||||
DWORD dwBumpBitCount;
|
DWORD dwBumpBitCount;
|
||||||
} DUMMYUNIONNAME1;
|
} DUMMYUNIONNAME1;
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwRBitMask; /* 10: mask for red bit*/
|
DWORD dwRBitMask; /* 10: mask for red bit*/
|
||||||
DWORD dwYBitMask; /* 10: mask for Y bits*/
|
DWORD dwYBitMask; /* 10: mask for Y bits*/
|
||||||
DWORD dwStencilBitDepth;
|
DWORD dwStencilBitDepth;
|
||||||
DWORD dwLuminanceBitMask;
|
DWORD dwLuminanceBitMask;
|
||||||
DWORD dwBumpDuBitMask;
|
DWORD dwBumpDuBitMask;
|
||||||
} DUMMYUNIONNAME2;
|
} DUMMYUNIONNAME2;
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwGBitMask; /* 14: mask for green bits*/
|
DWORD dwGBitMask; /* 14: mask for green bits*/
|
||||||
DWORD dwUBitMask; /* 14: mask for U bits*/
|
DWORD dwUBitMask; /* 14: mask for U bits*/
|
||||||
DWORD dwZBitMask;
|
DWORD dwZBitMask;
|
||||||
DWORD dwBumpDvBitMask;
|
DWORD dwBumpDvBitMask;
|
||||||
} DUMMYUNIONNAME3;
|
} DUMMYUNIONNAME3;
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwBBitMask; /* 18: mask for blue bits*/
|
DWORD dwBBitMask; /* 18: mask for blue bits*/
|
||||||
DWORD dwVBitMask; /* 18: mask for V bits*/
|
DWORD dwVBitMask; /* 18: mask for V bits*/
|
||||||
DWORD dwStencilBitMask;
|
DWORD dwStencilBitMask;
|
||||||
DWORD dwBumpLuminanceBitMask;
|
DWORD dwBumpLuminanceBitMask;
|
||||||
} DUMMYUNIONNAME4;
|
} DUMMYUNIONNAME4;
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwRGBAlphaBitMask; /* 1C: mask for alpha channel */
|
DWORD dwRGBAlphaBitMask; /* 1C: mask for alpha channel */
|
||||||
DWORD dwYUVAlphaBitMask; /* 1C: mask for alpha channel */
|
DWORD dwYUVAlphaBitMask; /* 1C: mask for alpha channel */
|
||||||
DWORD dwLuminanceAlphaBitMask;
|
DWORD dwLuminanceAlphaBitMask;
|
||||||
DWORD dwRGBZBitMask; /* 1C: mask for Z channel */
|
DWORD dwRGBZBitMask; /* 1C: mask for Z channel */
|
||||||
DWORD dwYUVZBitMask; /* 1C: mask for Z channel */
|
DWORD dwYUVZBitMask; /* 1C: mask for Z channel */
|
||||||
} DUMMYUNIONNAME5;
|
} DUMMYUNIONNAME5;
|
||||||
/* 20: next structure */
|
/* 20: next structure */
|
||||||
} DDPIXELFORMAT,*LPDDPIXELFORMAT;
|
} DDPIXELFORMAT,*LPDDPIXELFORMAT;
|
||||||
|
|
||||||
#ifndef MAKEFOURCC
|
#ifndef MAKEFOURCC
|
||||||
@ -980,79 +980,79 @@ typedef struct _DDPIXELFORMAT {
|
|||||||
|
|
||||||
typedef struct _DDSURFACEDESC
|
typedef struct _DDSURFACEDESC
|
||||||
{
|
{
|
||||||
DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/
|
DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/
|
||||||
DWORD dwFlags; /* 4: determines what fields are valid*/
|
DWORD dwFlags; /* 4: determines what fields are valid*/
|
||||||
DWORD dwHeight; /* 8: height of surface to be created*/
|
DWORD dwHeight; /* 8: height of surface to be created*/
|
||||||
DWORD dwWidth; /* C: width of input surface*/
|
DWORD dwWidth; /* C: width of input surface*/
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
LONG lPitch; /* 10: distance to start of next line (return value only)*/
|
LONG lPitch; /* 10: distance to start of next line (return value only)*/
|
||||||
DWORD dwLinearSize;
|
DWORD dwLinearSize;
|
||||||
} DUMMYUNIONNAME1;
|
} DUMMYUNIONNAME1;
|
||||||
DWORD dwBackBufferCount;/* 14: number of back buffers requested*/
|
DWORD dwBackBufferCount;/* 14: number of back buffers requested*/
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/
|
DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/
|
||||||
DWORD dwZBufferBitDepth;/*18: depth of Z buffer requested*/
|
DWORD dwZBufferBitDepth;/*18: depth of Z buffer requested*/
|
||||||
DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/
|
DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/
|
||||||
} DUMMYUNIONNAME2;
|
} DUMMYUNIONNAME2;
|
||||||
DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/
|
DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/
|
||||||
DWORD dwReserved; /* 20:reserved*/
|
DWORD dwReserved; /* 20:reserved*/
|
||||||
LPVOID lpSurface; /* 24:pointer to the associated surface memory*/
|
LPVOID lpSurface; /* 24:pointer to the associated surface memory*/
|
||||||
DDCOLORKEY ddckCKDestOverlay;/* 28: CK for dest overlay use*/
|
DDCOLORKEY ddckCKDestOverlay;/* 28: CK for dest overlay use*/
|
||||||
DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/
|
DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/
|
||||||
DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/
|
DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/
|
||||||
DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/
|
DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/
|
||||||
DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/
|
DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/
|
||||||
DDSCAPS ddsCaps; /* 68: direct draw surface caps */
|
DDSCAPS ddsCaps; /* 68: direct draw surface caps */
|
||||||
} DDSURFACEDESC,*LPDDSURFACEDESC;
|
} DDSURFACEDESC,*LPDDSURFACEDESC;
|
||||||
|
|
||||||
typedef struct _DDSURFACEDESC2
|
typedef struct _DDSURFACEDESC2
|
||||||
{
|
{
|
||||||
DWORD dwSize; /* 0: size of the DDSURFACEDESC2 structure*/
|
DWORD dwSize; /* 0: size of the DDSURFACEDESC2 structure*/
|
||||||
DWORD dwFlags; /* 4: determines what fields are valid*/
|
DWORD dwFlags; /* 4: determines what fields are valid*/
|
||||||
DWORD dwHeight; /* 8: height of surface to be created*/
|
DWORD dwHeight; /* 8: height of surface to be created*/
|
||||||
DWORD dwWidth; /* C: width of input surface*/
|
DWORD dwWidth; /* C: width of input surface*/
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
LONG lPitch; /*10: distance to start of next line (return value only)*/
|
LONG lPitch; /*10: distance to start of next line (return value only)*/
|
||||||
DWORD dwLinearSize; /*10: formless late-allocated optimized surface size */
|
DWORD dwLinearSize; /*10: formless late-allocated optimized surface size */
|
||||||
} DUMMYUNIONNAME1;
|
} DUMMYUNIONNAME1;
|
||||||
DWORD dwBackBufferCount;/* 14: number of back buffers requested*/
|
DWORD dwBackBufferCount;/* 14: number of back buffers requested*/
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/
|
DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/
|
||||||
DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/
|
DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/
|
||||||
DWORD dwSrcVBHandle;/* 18:source used in VB::Optimize */
|
DWORD dwSrcVBHandle;/* 18:source used in VB::Optimize */
|
||||||
} DUMMYUNIONNAME2;
|
} DUMMYUNIONNAME2;
|
||||||
DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/
|
DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/
|
||||||
DWORD dwReserved; /* 20:reserved*/
|
DWORD dwReserved; /* 20:reserved*/
|
||||||
LPVOID lpSurface; /* 24:pointer to the associated surface memory*/
|
LPVOID lpSurface; /* 24:pointer to the associated surface memory*/
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DDCOLORKEY ddckCKDestOverlay; /* 28: CK for dest overlay use*/
|
DDCOLORKEY ddckCKDestOverlay; /* 28: CK for dest overlay use*/
|
||||||
DWORD dwEmptyFaceColor; /* 28: color for empty cubemap faces */
|
DWORD dwEmptyFaceColor; /* 28: color for empty cubemap faces */
|
||||||
} DUMMYUNIONNAME3;
|
} DUMMYUNIONNAME3;
|
||||||
DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/
|
DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/
|
||||||
DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/
|
DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/
|
||||||
DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/
|
DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/
|
||||||
|
|
||||||
__extension__ union {
|
__extension__ union {
|
||||||
DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/
|
DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/
|
||||||
DWORD dwFVF; /* 48: vertex format description of vertex buffers */
|
DWORD dwFVF; /* 48: vertex format description of vertex buffers */
|
||||||
} DUMMYUNIONNAME4;
|
} DUMMYUNIONNAME4;
|
||||||
DDSCAPS2 ddsCaps; /* 68: DDraw surface caps */
|
DDSCAPS2 ddsCaps; /* 68: DDraw surface caps */
|
||||||
DWORD dwTextureStage; /* 78: stage in multitexture cascade */
|
DWORD dwTextureStage; /* 78: stage in multitexture cascade */
|
||||||
} DDSURFACEDESC2,*LPDDSURFACEDESC2;
|
} DDSURFACEDESC2,*LPDDSURFACEDESC2;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _DDARGB {
|
typedef struct _DDARGB {
|
||||||
BYTE blue;
|
BYTE blue;
|
||||||
BYTE green;
|
BYTE green;
|
||||||
BYTE red;
|
BYTE red;
|
||||||
BYTE alpha;
|
BYTE alpha;
|
||||||
} DDARGB, *LPDDARGB;
|
} DDARGB, *LPDDARGB;
|
||||||
|
|
||||||
typedef struct _DDRGBA {
|
typedef struct _DDRGBA {
|
||||||
BYTE red;
|
BYTE red;
|
||||||
BYTE green;
|
BYTE green;
|
||||||
BYTE blue;
|
BYTE blue;
|
||||||
BYTE alpha;
|
BYTE alpha;
|
||||||
} DDRGBA, *LPDDRGBA;
|
} DDRGBA, *LPDDRGBA;
|
||||||
|
|
||||||
|
|
||||||
@ -1066,22 +1066,22 @@ typedef struct _DDRGBA {
|
|||||||
#define DDCOLOR_COLORENABLE 0x00000040
|
#define DDCOLOR_COLORENABLE 0x00000040
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
DWORD dwFlags;
|
DWORD dwFlags;
|
||||||
LONG lBrightness;
|
LONG lBrightness;
|
||||||
LONG lContrast;
|
LONG lContrast;
|
||||||
LONG lHue;
|
LONG lHue;
|
||||||
LONG lSaturation;
|
LONG lSaturation;
|
||||||
LONG lSharpness;
|
LONG lSharpness;
|
||||||
LONG lGamma;
|
LONG lGamma;
|
||||||
LONG lColorEnable;
|
LONG lColorEnable;
|
||||||
DWORD dwReserved1;
|
DWORD dwReserved1;
|
||||||
} DDCOLORCONTROL,*LPDDCOLORCONTROL;
|
} DDCOLORCONTROL,*LPDDCOLORCONTROL;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD red[256];
|
WORD red[256];
|
||||||
WORD green[256];
|
WORD green[256];
|
||||||
WORD blue[256];
|
WORD blue[256];
|
||||||
} DDGAMMARAMP,*LPDDGAMMARAMP;
|
} DDGAMMARAMP,*LPDDGAMMARAMP;
|
||||||
|
|
||||||
typedef BOOL (CALLBACK *LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID);
|
typedef BOOL (CALLBACK *LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID);
|
||||||
@ -1161,7 +1161,7 @@ typedef struct _DDBLTFX
|
|||||||
{
|
{
|
||||||
DWORD dwFillColor; /* color in RGB or Palettized */
|
DWORD dwFillColor; /* color in RGB or Palettized */
|
||||||
DWORD dwFillDepth; /* depth value for z-buffer */
|
DWORD dwFillDepth; /* depth value for z-buffer */
|
||||||
DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */
|
DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */
|
||||||
LPDIRECTDRAWSURFACE lpDDSPattern; /* Surface to use as pattern */
|
LPDIRECTDRAWSURFACE lpDDSPattern; /* Surface to use as pattern */
|
||||||
} DUMMYUNIONNAME5;
|
} DUMMYUNIONNAME5;
|
||||||
DDCOLORKEY ddckDestColorkey; /* DestColorkey override */
|
DDCOLORKEY ddckDestColorkey; /* DestColorkey override */
|
||||||
|
36
3rdparty/include/dshow/dsound.h
vendored
36
3rdparty/include/dshow/dsound.h
vendored
@ -932,14 +932,14 @@ DECLARE_INTERFACE_(IDirectSoundNotify,IUnknown)
|
|||||||
#define DS3D_DEFAULTCONEOUTSIDEVOLUME DSBVOLUME_MAX
|
#define DS3D_DEFAULTCONEOUTSIDEVOLUME DSBVOLUME_MAX
|
||||||
|
|
||||||
typedef struct _DS3DLISTENER {
|
typedef struct _DS3DLISTENER {
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
D3DVECTOR vPosition;
|
D3DVECTOR vPosition;
|
||||||
D3DVECTOR vVelocity;
|
D3DVECTOR vVelocity;
|
||||||
D3DVECTOR vOrientFront;
|
D3DVECTOR vOrientFront;
|
||||||
D3DVECTOR vOrientTop;
|
D3DVECTOR vOrientTop;
|
||||||
D3DVALUE flDistanceFactor;
|
D3DVALUE flDistanceFactor;
|
||||||
D3DVALUE flRolloffFactor;
|
D3DVALUE flRolloffFactor;
|
||||||
D3DVALUE flDopplerFactor;
|
D3DVALUE flDopplerFactor;
|
||||||
} DS3DLISTENER, *LPDS3DLISTENER;
|
} DS3DLISTENER, *LPDS3DLISTENER;
|
||||||
|
|
||||||
typedef const DS3DLISTENER *LPCDS3DLISTENER;
|
typedef const DS3DLISTENER *LPCDS3DLISTENER;
|
||||||
@ -1019,16 +1019,16 @@ DECLARE_INTERFACE_(IDirectSound3DListener,IUnknown)
|
|||||||
* IDirectSound3DBuffer interface
|
* IDirectSound3DBuffer interface
|
||||||
*/
|
*/
|
||||||
typedef struct _DS3DBUFFER {
|
typedef struct _DS3DBUFFER {
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
D3DVECTOR vPosition;
|
D3DVECTOR vPosition;
|
||||||
D3DVECTOR vVelocity;
|
D3DVECTOR vVelocity;
|
||||||
DWORD dwInsideConeAngle;
|
DWORD dwInsideConeAngle;
|
||||||
DWORD dwOutsideConeAngle;
|
DWORD dwOutsideConeAngle;
|
||||||
D3DVECTOR vConeOrientation;
|
D3DVECTOR vConeOrientation;
|
||||||
LONG lConeOutsideVolume;
|
LONG lConeOutsideVolume;
|
||||||
D3DVALUE flMinDistance;
|
D3DVALUE flMinDistance;
|
||||||
D3DVALUE flMaxDistance;
|
D3DVALUE flMaxDistance;
|
||||||
DWORD dwMode;
|
DWORD dwMode;
|
||||||
} DS3DBUFFER, *LPDS3DBUFFER;
|
} DS3DBUFFER, *LPDS3DBUFFER;
|
||||||
|
|
||||||
typedef const DS3DBUFFER *LPCDS3DBUFFER;
|
typedef const DS3DBUFFER *LPCDS3DBUFFER;
|
||||||
|
28
3rdparty/include/dshow/dvdmedia.h
vendored
28
3rdparty/include/dshow/dvdmedia.h
vendored
@ -24,24 +24,24 @@
|
|||||||
#define AMCONTROL_PAD_TO_16x9 0x00000004
|
#define AMCONTROL_PAD_TO_16x9 0x00000004
|
||||||
|
|
||||||
enum AM_MPEG2Level {
|
enum AM_MPEG2Level {
|
||||||
AM_MPEG2Level_Low = 1,
|
AM_MPEG2Level_Low = 1,
|
||||||
AM_MPEG2Level_Main,
|
AM_MPEG2Level_Main,
|
||||||
AM_MPEG2Level_High1440,
|
AM_MPEG2Level_High1440,
|
||||||
AM_MPEG2Level_High
|
AM_MPEG2Level_High
|
||||||
};
|
};
|
||||||
enum AM_MPEG2Profile {
|
enum AM_MPEG2Profile {
|
||||||
AM_MPEG2Profile_Simple = 1,
|
AM_MPEG2Profile_Simple = 1,
|
||||||
AM_MPEG2Profile_Main,
|
AM_MPEG2Profile_Main,
|
||||||
AM_MPEG2Profile_SNRScalable,
|
AM_MPEG2Profile_SNRScalable,
|
||||||
AM_MPEG2Profile_SpatiallyScalable,
|
AM_MPEG2Profile_SpatiallyScalable,
|
||||||
AM_MPEG2Profile_High
|
AM_MPEG2Profile_High
|
||||||
};
|
};
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AM_RATE_ChangeRate = 1,
|
AM_RATE_ChangeRate = 1,
|
||||||
AM_RATE_FullDataRateMax = 2,
|
AM_RATE_FullDataRateMax = 2,
|
||||||
AM_RATE_ReverseDecode = 3,
|
AM_RATE_ReverseDecode = 3,
|
||||||
AM_RATE_DecoderPosition = 4,
|
AM_RATE_DecoderPosition = 4,
|
||||||
AM_RATE_DecoderVersion = 5
|
AM_RATE_DecoderVersion = 5
|
||||||
} AM_PROPERTY_DVD_RATE_CHANGE;
|
} AM_PROPERTY_DVD_RATE_CHANGE;
|
||||||
|
|
||||||
typedef struct tagVIDEOINFOHEADER2 {
|
typedef struct tagVIDEOINFOHEADER2 {
|
||||||
|
4
3rdparty/include/dshow/evcode.h
vendored
4
3rdparty/include/dshow/evcode.h
vendored
@ -58,8 +58,8 @@ extern "C" {
|
|||||||
#define EC_USER 0x8000
|
#define EC_USER 0x8000
|
||||||
/*--- DirectShow Reference - DirectShow Structures */
|
/*--- DirectShow Reference - DirectShow Structures */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
HRESULT hrStatus;
|
HRESULT hrStatus;
|
||||||
void *pData;
|
void *pData;
|
||||||
} AM_WMT_EVENT_DATA;
|
} AM_WMT_EVENT_DATA;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
120
3rdparty/include/dshow/ksuuids.h
vendored
120
3rdparty/include/dshow/ksuuids.h
vendored
@ -5,187 +5,187 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIATYPE_MPEG2_PACK,
|
OUR_GUID_ENTRY(MEDIATYPE_MPEG2_PACK,
|
||||||
0x36523B13,0x8EE5,0x11d1,0x8C,0xA3,0x00,0x60,0xB0,0x57,0x66,0x4A)
|
0x36523B13,0x8EE5,0x11d1,0x8C,0xA3,0x00,0x60,0xB0,0x57,0x66,0x4A)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIATYPE_MPEG2_PES,
|
OUR_GUID_ENTRY(MEDIATYPE_MPEG2_PES,
|
||||||
0xe06d8020,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x5f,0x6c,0xbb,0xea)
|
0xe06d8020,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x5f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_WMDRM_TRANSPORT,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_WMDRM_TRANSPORT,
|
||||||
0x18BEC4EA,0x4676,0x450e,0xB4,0x78,0x0C,0xD8,0x4C,0x54,0xB3,0x27)
|
0x18BEC4EA,0x4676,0x450e,0xB4,0x78,0x0C,0xD8,0x4C,0x54,0xB3,0x27)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_VIDEO,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_VIDEO,
|
||||||
0xe06d8026,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x5f,0x6c,0xbb,0xea)
|
0xe06d8026,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x5f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(FORMAT_MPEG2_VIDEO,
|
OUR_GUID_ENTRY(FORMAT_MPEG2_VIDEO,
|
||||||
0xe06d80e3,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x5f,0x6c,0xbb,0xea)
|
0xe06d80e3,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x5f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(FORMAT_VIDEOINFO2,
|
OUR_GUID_ENTRY(FORMAT_VIDEOINFO2,
|
||||||
0xf72a76A0L,0xeb0a,0x11d0,0xac,0xe4,0x0,0x0,0xc0,0xcc,0x16,0xba)
|
0xf72a76A0L,0xeb0a,0x11d0,0xac,0xe4,0x0,0x0,0xc0,0xcc,0x16,0xba)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_PROGRAM,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_PROGRAM,
|
||||||
0xe06d8022,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d8022,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_TRANSPORT,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_TRANSPORT,
|
||||||
0xe06d8023,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d8023,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_AUDIO,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_AUDIO,
|
||||||
0xe06d802b,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d802b,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_DOLBY_AC3,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_DOLBY_AC3,
|
||||||
0xe06d802c,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d802c,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_SUBPICTURE,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_SUBPICTURE,
|
||||||
0xe06d802d,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d802d,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_LPCM_AUDIO,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_LPCM_AUDIO,
|
||||||
0xe06d8032,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d8032,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIATYPE_DVD_ENCRYPTED_PACK,
|
OUR_GUID_ENTRY(MEDIATYPE_DVD_ENCRYPTED_PACK,
|
||||||
0xed0b916a,0x044d,0x11d1,0xaa,0x78,0x00,0xc0,0x04f,0xc3,0x1d,0x60)
|
0xed0b916a,0x044d,0x11d1,0xaa,0x78,0x00,0xc0,0x04f,0xc3,0x1d,0x60)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIATYPE_DVD_NAVIGATION,
|
OUR_GUID_ENTRY(MEDIATYPE_DVD_NAVIGATION,
|
||||||
0xe06d802e,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d802e,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_NAVIGATION_PCI,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_NAVIGATION_PCI,
|
||||||
0xe06d802f,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d802f,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_NAVIGATION_DSI,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_NAVIGATION_DSI,
|
||||||
0xe06d8030,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d8030,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER,
|
||||||
0xe06d8031,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d8031,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(FORMAT_MPEG2Video,
|
OUR_GUID_ENTRY(FORMAT_MPEG2Video,
|
||||||
0xe06d80e3,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d80e3,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(FORMAT_DolbyAC3,
|
OUR_GUID_ENTRY(FORMAT_DolbyAC3,
|
||||||
0xe06d80e4,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d80e4,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(FORMAT_MPEG2Audio,
|
OUR_GUID_ENTRY(FORMAT_MPEG2Audio,
|
||||||
0xe06d80e5,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d80e5,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(FORMAT_DVD_LPCMAudio,
|
OUR_GUID_ENTRY(FORMAT_DVD_LPCMAudio,
|
||||||
0xe06d80e6,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d80e6,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSPROPSETID_AC3,
|
OUR_GUID_ENTRY(AM_KSPROPSETID_AC3,
|
||||||
0xBFABE720,0x6E1F,0x11D0,0xBC,0xF2,0x44,0x45,0x53,0x54,0x00,0x00)
|
0xBFABE720,0x6E1F,0x11D0,0xBC,0xF2,0x44,0x45,0x53,0x54,0x00,0x00)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSPROPSETID_DvdSubPic,
|
OUR_GUID_ENTRY(AM_KSPROPSETID_DvdSubPic,
|
||||||
0xac390460,0x43af,0x11d0,0xbd,0x6a,0x00,0x35,0x05,0xc1,0x03,0xa9)
|
0xac390460,0x43af,0x11d0,0xbd,0x6a,0x00,0x35,0x05,0xc1,0x03,0xa9)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSPROPSETID_CopyProt,
|
OUR_GUID_ENTRY(AM_KSPROPSETID_CopyProt,
|
||||||
0x0E8A0A40,0x6AEF,0x11D0,0x9E,0xD0,0x00,0xA0,0x24,0xCA,0x19,0xB3)
|
0x0E8A0A40,0x6AEF,0x11D0,0x9E,0xD0,0x00,0xA0,0x24,0xCA,0x19,0xB3)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSPROPSETID_TSRateChange,
|
OUR_GUID_ENTRY(AM_KSPROPSETID_TSRateChange,
|
||||||
0xa503c5c0,0x1d1d,0x11d1,0xad,0x80,0x44,0x45,0x53,0x54,0x0,0x0)
|
0xa503c5c0,0x1d1d,0x11d1,0xad,0x80,0x44,0x45,0x53,0x54,0x0,0x0)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSPROPSETID_MPEG4_MediaType_Attributes,
|
OUR_GUID_ENTRY(AM_KSPROPSETID_MPEG4_MediaType_Attributes,
|
||||||
0xff6c4bfa,0x7a9,0x4c7b,0xa2,0x37,0x67,0x2f,0x9d,0x68,0x6,0x5f)
|
0xff6c4bfa,0x7a9,0x4c7b,0xa2,0x37,0x67,0x2f,0x9d,0x68,0x6,0x5f)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_CAPTURE,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_CAPTURE,
|
||||||
0x65E8773DL,0x8F56,0x11D0,0xA3,0xB9,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
0x65E8773DL,0x8F56,0x11D0,0xA3,0xB9,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_RENDER,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_RENDER,
|
||||||
0x65E8773EL,0x8F56,0x11D0,0xA3,0xB9,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
0x65E8773EL,0x8F56,0x11D0,0xA3,0xB9,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_DATACOMPRESSOR,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_DATACOMPRESSOR,
|
||||||
0x1E84C900L,0x7E70,0x11D0,0xA5,0xD6,0x28,0xDB,0x04,0xC1,0x00,0x00)
|
0x1E84C900L,0x7E70,0x11D0,0xA5,0xD6,0x28,0xDB,0x04,0xC1,0x00,0x00)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_AUDIO,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_AUDIO,
|
||||||
0x6994AD04L,0x93EF,0x11D0,0xA3,0xCC,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
0x6994AD04L,0x93EF,0x11D0,0xA3,0xCC,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_VIDEO,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_VIDEO,
|
||||||
0x6994AD05L,0x93EF,0x11D0,0xA3,0xCC,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
0x6994AD05L,0x93EF,0x11D0,0xA3,0xCC,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_TVTUNER,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_TVTUNER,
|
||||||
0xa799a800L,0xa46d,0x11d0,0xa1,0x8c,0x00,0xa0,0x24,0x01,0xdc,0xd4)
|
0xa799a800L,0xa46d,0x11d0,0xa1,0x8c,0x00,0xa0,0x24,0x01,0xdc,0xd4)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_CROSSBAR,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_CROSSBAR,
|
||||||
0xa799a801L,0xa46d,0x11d0,0xa1,0x8c,0x00,0xa0,0x24,0x01,0xdc,0xd4)
|
0xa799a801L,0xa46d,0x11d0,0xa1,0x8c,0x00,0xa0,0x24,0x01,0xdc,0xd4)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_TVAUDIO,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_TVAUDIO,
|
||||||
0xa799a802L,0xa46d,0x11d0,0xa1,0x8c,0x00,0xa0,0x24,0x01,0xdc,0xd4)
|
0xa799a802L,0xa46d,0x11d0,0xa1,0x8c,0x00,0xa0,0x24,0x01,0xdc,0xd4)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_VBICODEC,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_VBICODEC,
|
||||||
0x07dad660L,0x22f1,0x11d1,0xa9,0xf4,0x00,0xc0,0x4f,0xbb,0xde,0x8f)
|
0x07dad660L,0x22f1,0x11d1,0xa9,0xf4,0x00,0xc0,0x4f,0xbb,0xde,0x8f)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_SPLITTER,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_SPLITTER,
|
||||||
0x0A4252A0L,0x7E70,0x11D0,0xA5,0xD6,0x28,0xDB,0x04,0xC1,0x00,0x00)
|
0x0A4252A0L,0x7E70,0x11D0,0xA5,0xD6,0x28,0xDB,0x04,0xC1,0x00,0x00)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(IID_IKsInterfaceHandler,
|
OUR_GUID_ENTRY(IID_IKsInterfaceHandler,
|
||||||
0xD3ABC7E0L,0x9A61,0x11D0,0xA4,0x0D,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
0xD3ABC7E0L,0x9A61,0x11D0,0xA4,0x0D,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(IID_IKsDataTypeHandler,
|
OUR_GUID_ENTRY(IID_IKsDataTypeHandler,
|
||||||
0x5FFBAA02L,0x49A3,0x11D0,0x9F,0x36,0x00,0xAA,0x00,0xA2,0x16,0xA1)
|
0x5FFBAA02L,0x49A3,0x11D0,0x9F,0x36,0x00,0xAA,0x00,0xA2,0x16,0xA1)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(IID_IKsPin,
|
OUR_GUID_ENTRY(IID_IKsPin,
|
||||||
0xb61178d1L,0xa2d9,0x11cf,0x9e,0x53,0x00,0xaa,0x00,0xa2,0x16,0xa1)
|
0xb61178d1L,0xa2d9,0x11cf,0x9e,0x53,0x00,0xaa,0x00,0xa2,0x16,0xa1)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(IID_IKsControl,
|
OUR_GUID_ENTRY(IID_IKsControl,
|
||||||
0x28F54685L,0x06FD,0x11D2,0xB2,0x7A,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
0x28F54685L,0x06FD,0x11D2,0xB2,0x7A,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(IID_IKsPinFactory,
|
OUR_GUID_ENTRY(IID_IKsPinFactory,
|
||||||
0xCD5EBE6BL,0x8B6E,0x11D1,0x8A,0xE0,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
0xCD5EBE6BL,0x8B6E,0x11D1,0x8A,0xE0,0x00,0xA0,0xC9,0x22,0x31,0x96)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_INTERFACESETID_Standard,
|
OUR_GUID_ENTRY(AM_INTERFACESETID_Standard,
|
||||||
0x1A8766A0L,0x62CE,0x11CF,0xA5,0xD6,0x28,0xDB,0x04,0xC1,0x00,0x00)
|
0x1A8766A0L,0x62CE,0x11CF,0xA5,0xD6,0x28,0xDB,0x04,0xC1,0x00,0x00)
|
||||||
|
|
||||||
#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1)
|
#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1)
|
||||||
OUR_GUID_ENTRY(MEDIATYPE_MPEG2_SECTIONS,
|
OUR_GUID_ENTRY(MEDIATYPE_MPEG2_SECTIONS,
|
||||||
0x455f176c,0x4b06,0x47ce,0x9a,0xef,0x8c,0xae,0xf7,0x3d,0xf7,0xb5)
|
0x455f176c,0x4b06,0x47ce,0x9a,0xef,0x8c,0xae,0xf7,0x3d,0xf7,0xb5)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_VERSIONED_TABLES,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_VERSIONED_TABLES,
|
||||||
0x1ed988b0,0x3ffc,0x4523,0x87,0x25,0x34,0x7b,0xee,0xc1,0xa8,0xa0)
|
0x1ed988b0,0x3ffc,0x4523,0x87,0x25,0x34,0x7b,0xee,0xc1,0xa8,0xa0)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_ATSC_SI,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_ATSC_SI,
|
||||||
0xb3c7397c,0xd303,0x414d,0xb3,0x3c,0x4e,0xd2,0xc9,0xd2,0x97,0x33)
|
0xb3c7397c,0xd303,0x414d,0xb3,0x3c,0x4e,0xd2,0xc9,0xd2,0x97,0x33)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_DVB_SI,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_DVB_SI,
|
||||||
0xe9dd31a3,0x221d,0x4adb,0x85,0x32,0x9a,0xf3,0x9,0xc1,0xa4,0x8)
|
0xe9dd31a3,0x221d,0x4adb,0x85,0x32,0x9a,0xf3,0x9,0xc1,0xa4,0x8)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_ISDB_SI,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_ISDB_SI,
|
||||||
0xe89ad298,0x3601,0x4b06,0xaa,0xec,0x9d,0xde,0xed,0xcc,0x5b,0xd0)
|
0xe89ad298,0x3601,0x4b06,0xaa,0xec,0x9d,0xde,0xed,0xcc,0x5b,0xd0)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_TIF_SI,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_TIF_SI,
|
||||||
0xec232eb2,0xcb96,0x4191,0xb2,0x26,0xe,0xa1,0x29,0xf3,0x82,0x50)
|
0xec232eb2,0xcb96,0x4191,0xb2,0x26,0xe,0xa1,0x29,0xf3,0x82,0x50)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2DATA,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2DATA,
|
||||||
0xc892e55b,0x252d,0x42b5,0xa3,0x16,0xd9,0x97,0xe7,0xa5,0xd9,0x95)
|
0xc892e55b,0x252d,0x42b5,0xa3,0x16,0xd9,0x97,0xe7,0xa5,0xd9,0x95)
|
||||||
#endif
|
#endif
|
||||||
/* ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) ||
|
/* ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) ||
|
||||||
(NTDDI_VERSION >= NTDDI_WS03SP1) */
|
(NTDDI_VERSION >= NTDDI_WS03SP1) */
|
||||||
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_WINXP)
|
#if (NTDDI_VERSION >= NTDDI_WINXP)
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_TRANSPORT_STRIDE,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_TRANSPORT_STRIDE,
|
||||||
0x138aa9a4,0x1ee2,0x4c5b,0x98,0x8e,0x19,0xab,0xfd,0xbc,0x8a,0x11)
|
0x138aa9a4,0x1ee2,0x4c5b,0x98,0x8e,0x19,0xab,0xfd,0xbc,0x8a,0x11)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_UDCR_TRANSPORT,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_UDCR_TRANSPORT,
|
||||||
0x18BEC4EA,0x4676,0x450e,0xB4,0x78,0x0C,0xD8,0x4C,0x54,0xB3,0x27)
|
0x18BEC4EA,0x4676,0x450e,0xB4,0x78,0x0C,0xD8,0x4C,0x54,0xB3,0x27)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_PBDA_TRANSPORT_RAW,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_PBDA_TRANSPORT_RAW,
|
||||||
0x0d7aed42,0xcb9a,0x11db,0x97,0x5,0x0,0x50,0x56,0xc0,0x0,0x8)
|
0x0d7aed42,0xcb9a,0x11db,0x97,0x5,0x0,0x50,0x56,0xc0,0x0,0x8)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_PBDA_TRANSPORT_PROCESSED,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_MPEG2_PBDA_TRANSPORT_PROCESSED,
|
||||||
0xaf748dd4,0xd80,0x11db,0x97,0x5,0x0,0x50,0x56,0xc0,0x0,0x8)
|
0xaf748dd4,0xd80,0x11db,0x97,0x5,0x0,0x50,0x56,0xc0,0x0,0x8)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_DTS,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_DTS,
|
||||||
0xe06d8033,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d8033,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(MEDIASUBTYPE_SDDS,
|
OUR_GUID_ENTRY(MEDIASUBTYPE_SDDS,
|
||||||
0xe06d8034,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
0xe06d8034,0xdb46,0x11cf,0xb4,0xd1,0x00,0x80,0x05f,0x6c,0xbb,0xea)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSPROPSETID_DVD_RateChange,
|
OUR_GUID_ENTRY(AM_KSPROPSETID_DVD_RateChange,
|
||||||
0x3577eb09,0x9582,0x477f,0xb2,0x9c,0xb0,0xc4,0x52,0xa4,0xff,0x9a)
|
0x3577eb09,0x9582,0x477f,0xb2,0x9c,0xb0,0xc4,0x52,0xa4,0xff,0x9a)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSPROPSETID_DvdKaraoke,
|
OUR_GUID_ENTRY(AM_KSPROPSETID_DvdKaraoke,
|
||||||
0xae4720ae,0xaa71,0x42d8,0xb8,0x2a,0xff,0xfd,0xf5,0x8b,0x76,0xfd)
|
0xae4720ae,0xaa71,0x42d8,0xb8,0x2a,0xff,0xfd,0xf5,0x8b,0x76,0xfd)
|
||||||
|
|
||||||
OUR_GUID_ENTRY(AM_KSPROPSETID_FrameStep,
|
OUR_GUID_ENTRY(AM_KSPROPSETID_FrameStep,
|
||||||
0xc830acbd,0xab07,0x492f,0x88,0x52,0x45,0xb6,0x98,0x7c,0x29,0x79)
|
0xc830acbd,0xab07,0x492f,0x88,0x52,0x45,0xb6,0x98,0x7c,0x29,0x79)
|
||||||
#endif /* NTDDI_VERSION >= NTDDI_WINXP */
|
#endif /* NTDDI_VERSION >= NTDDI_WINXP */
|
||||||
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_WS03SP1)
|
#if (NTDDI_VERSION >= NTDDI_WS03SP1)
|
||||||
OUR_GUID_ENTRY(AM_KSCATEGORY_VBICODEC_MI,
|
OUR_GUID_ENTRY(AM_KSCATEGORY_VBICODEC_MI,
|
||||||
0x9c24a977,0x951,0x451a,0x80,0x6,0xe,0x49,0xbd,0x28,0xcd,0x5f)
|
0x9c24a977,0x951,0x451a,0x80,0x6,0xe,0x49,0xbd,0x28,0xcd,0x5f)
|
||||||
#endif /* NTDDI_VERSION >= NTDDI_WS03SP1 */
|
#endif /* NTDDI_VERSION >= NTDDI_WS03SP1 */
|
||||||
|
|
||||||
|
8
3rdparty/include/dshow/strmif.h
vendored
8
3rdparty/include/dshow/strmif.h
vendored
@ -2097,12 +2097,12 @@ typedef LONGLONG REFERENCE_TIME;
|
|||||||
DWORD dwMerit;
|
DWORD dwMerit;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
ULONG cPins;
|
ULONG cPins;
|
||||||
const REGFILTERPINS *rgPins;
|
const REGFILTERPINS *rgPins;
|
||||||
};
|
};
|
||||||
struct {
|
struct {
|
||||||
ULONG cPins2;
|
ULONG cPins2;
|
||||||
const REGFILTERPINS2 *rgPins2;
|
const REGFILTERPINS2 *rgPins2;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} REGFILTER2;
|
} REGFILTER2;
|
||||||
|
1784
3rdparty/libjasper/jas_cm.c
vendored
1784
3rdparty/libjasper/jas_cm.c
vendored
File diff suppressed because it is too large
Load Diff
56
3rdparty/libjasper/jas_debug.c
vendored
56
3rdparty/libjasper/jas_debug.c
vendored
@ -83,22 +83,22 @@ static int jas_dbglevel = 0;
|
|||||||
/* Set the library debug level. */
|
/* Set the library debug level. */
|
||||||
int jas_setdbglevel(int dbglevel)
|
int jas_setdbglevel(int dbglevel)
|
||||||
{
|
{
|
||||||
int olddbglevel;
|
int olddbglevel;
|
||||||
|
|
||||||
/* Save the old debug level. */
|
/* Save the old debug level. */
|
||||||
olddbglevel = jas_dbglevel;
|
olddbglevel = jas_dbglevel;
|
||||||
|
|
||||||
/* Change the debug level. */
|
/* Change the debug level. */
|
||||||
jas_dbglevel = dbglevel;
|
jas_dbglevel = dbglevel;
|
||||||
|
|
||||||
/* Return the old debug level. */
|
/* Return the old debug level. */
|
||||||
return olddbglevel;
|
return olddbglevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the library debug level. */
|
/* Get the library debug level. */
|
||||||
int jas_getdbglevel()
|
int jas_getdbglevel()
|
||||||
{
|
{
|
||||||
return jas_dbglevel;
|
return jas_dbglevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -108,30 +108,30 @@ int jas_getdbglevel()
|
|||||||
/* Perform formatted output to standard error. */
|
/* Perform formatted output to standard error. */
|
||||||
int jas_eprintf(const char *fmt, ...)
|
int jas_eprintf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
ret = vfprintf(stderr, fmt, ap);
|
ret = vfprintf(stderr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump memory to a stream. */
|
/* Dump memory to a stream. */
|
||||||
int jas_memdump(FILE *out, void *data, size_t len)
|
int jas_memdump(FILE *out, void *data, size_t len)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t j;
|
size_t j;
|
||||||
uchar *dp;
|
uchar *dp;
|
||||||
dp = data;
|
dp = data;
|
||||||
for (i = 0; i < len; i += 16) {
|
for (i = 0; i < len; i += 16) {
|
||||||
fprintf(out, "%04x:", (int)i);
|
fprintf(out, "%04x:", (int)i);
|
||||||
for (j = 0; j < 16; ++j) {
|
for (j = 0; j < 16; ++j) {
|
||||||
if (i + j < len) {
|
if (i + j < len) {
|
||||||
fprintf(out, " %02x", dp[i + j]);
|
fprintf(out, " %02x", dp[i + j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(out, "\n");
|
fprintf(out, "\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
136
3rdparty/libjasper/jas_getopt.c
vendored
136
3rdparty/libjasper/jas_getopt.c
vendored
@ -91,78 +91,78 @@ char *jas_optarg = 0;
|
|||||||
|
|
||||||
static jas_opt_t *jas_optlookup(jas_opt_t *opts, char *name)
|
static jas_opt_t *jas_optlookup(jas_opt_t *opts, char *name)
|
||||||
{
|
{
|
||||||
jas_opt_t *opt;
|
jas_opt_t *opt;
|
||||||
|
|
||||||
for (opt = opts; opt->id >= 0 && opt->name; ++opt) {
|
for (opt = opts; opt->id >= 0 && opt->name; ++opt) {
|
||||||
if (!strcmp(opt->name, name)) {
|
if (!strcmp(opt->name, name)) {
|
||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jas_getopt(int argc, char **argv, jas_opt_t *opts)
|
int jas_getopt(int argc, char **argv, jas_opt_t *opts)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
int id;
|
int id;
|
||||||
int hasarg;
|
int hasarg;
|
||||||
jas_opt_t *opt;
|
jas_opt_t *opt;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (!jas_optind) {
|
if (!jas_optind) {
|
||||||
jas_optind = JAS_MIN(1, argc);
|
jas_optind = JAS_MIN(1, argc);
|
||||||
}
|
}
|
||||||
while (jas_optind < argc) {
|
while (jas_optind < argc) {
|
||||||
s = cp = argv[jas_optind];
|
s = cp = argv[jas_optind];
|
||||||
if (*cp == '-') {
|
if (*cp == '-') {
|
||||||
/* We are processing an option. */
|
/* We are processing an option. */
|
||||||
++jas_optind;
|
++jas_optind;
|
||||||
if (*++cp == '-') {
|
if (*++cp == '-') {
|
||||||
/* We are processing a long option. */
|
/* We are processing a long option. */
|
||||||
++cp;
|
++cp;
|
||||||
if (*cp == '\0') {
|
if (*cp == '\0') {
|
||||||
/* This is the end of the options. */
|
/* This is the end of the options. */
|
||||||
return JAS_GETOPT_EOF;
|
return JAS_GETOPT_EOF;
|
||||||
}
|
}
|
||||||
if (!(opt = jas_optlookup(opts, cp))) {
|
if (!(opt = jas_optlookup(opts, cp))) {
|
||||||
if (jas_opterr) {
|
if (jas_opterr) {
|
||||||
jas_eprintf("unknown long option %s\n", s);
|
jas_eprintf("unknown long option %s\n", s);
|
||||||
}
|
}
|
||||||
return JAS_GETOPT_ERR;
|
return JAS_GETOPT_ERR;
|
||||||
}
|
}
|
||||||
hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
|
hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
|
||||||
id = opt->id;
|
id = opt->id;
|
||||||
} else {
|
} else {
|
||||||
/* We are processing a short option. */
|
/* We are processing a short option. */
|
||||||
if (strlen(cp) != 1 ||
|
if (strlen(cp) != 1 ||
|
||||||
!(opt = jas_optlookup(opts, cp))) {
|
!(opt = jas_optlookup(opts, cp))) {
|
||||||
if (jas_opterr) {
|
if (jas_opterr) {
|
||||||
jas_eprintf("unknown short option %s\n", s);
|
jas_eprintf("unknown short option %s\n", s);
|
||||||
}
|
}
|
||||||
return JAS_GETOPT_ERR;
|
return JAS_GETOPT_ERR;
|
||||||
}
|
}
|
||||||
hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
|
hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
|
||||||
id = opt->id;
|
id = opt->id;
|
||||||
}
|
}
|
||||||
if (hasarg) {
|
if (hasarg) {
|
||||||
/* The option has an argument. */
|
/* The option has an argument. */
|
||||||
if (jas_optind >= argc) {
|
if (jas_optind >= argc) {
|
||||||
if (jas_opterr) {
|
if (jas_opterr) {
|
||||||
jas_eprintf("missing argument for option %s\n", s);
|
jas_eprintf("missing argument for option %s\n", s);
|
||||||
}
|
}
|
||||||
return JAS_GETOPT_ERR;
|
return JAS_GETOPT_ERR;
|
||||||
}
|
}
|
||||||
jas_optarg = argv[jas_optind];
|
jas_optarg = argv[jas_optind];
|
||||||
++jas_optind;
|
++jas_optind;
|
||||||
} else {
|
} else {
|
||||||
/* The option does not have an argument. */
|
/* The option does not have an argument. */
|
||||||
jas_optarg = 0;
|
jas_optarg = 0;
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
} else {
|
} else {
|
||||||
/* We are not processing an option. */
|
/* We are not processing an option. */
|
||||||
return JAS_GETOPT_EOF;
|
return JAS_GETOPT_EOF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return JAS_GETOPT_EOF;
|
return JAS_GETOPT_EOF;
|
||||||
}
|
}
|
||||||
|
2176
3rdparty/libjasper/jas_icc.c
vendored
2176
3rdparty/libjasper/jas_icc.c
vendored
File diff suppressed because it is too large
Load Diff
886
3rdparty/libjasper/jas_iccdata.c
vendored
886
3rdparty/libjasper/jas_iccdata.c
vendored
@ -64,454 +64,454 @@
|
|||||||
|
|
||||||
uchar jas_iccprofdata_srgb[] =
|
uchar jas_iccprofdata_srgb[] =
|
||||||
{
|
{
|
||||||
0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f,
|
0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f,
|
||||||
0x02, 0x10, 0x00, 0x00, 0x6d, 0x6e, 0x74, 0x72,
|
0x02, 0x10, 0x00, 0x00, 0x6d, 0x6e, 0x74, 0x72,
|
||||||
0x52, 0x47, 0x42, 0x20, 0x58, 0x59, 0x5a, 0x20,
|
0x52, 0x47, 0x42, 0x20, 0x58, 0x59, 0x5a, 0x20,
|
||||||
0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06,
|
0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06,
|
||||||
0x00, 0x31, 0x00, 0x00, 0x61, 0x63, 0x73, 0x70,
|
0x00, 0x31, 0x00, 0x00, 0x61, 0x63, 0x73, 0x70,
|
||||||
0x4d, 0x53, 0x46, 0x54, 0x00, 0x00, 0x00, 0x00,
|
0x4d, 0x53, 0x46, 0x54, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x49, 0x45, 0x43, 0x20, 0x73, 0x52, 0x47, 0x42,
|
0x49, 0x45, 0x43, 0x20, 0x73, 0x52, 0x47, 0x42,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6,
|
||||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d,
|
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d,
|
||||||
0x48, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
|
0x48, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x11, 0x63, 0x70, 0x72, 0x74,
|
0x00, 0x00, 0x00, 0x11, 0x63, 0x70, 0x72, 0x74,
|
||||||
0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00, 0x33,
|
0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00, 0x33,
|
||||||
0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x01, 0x84,
|
0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x01, 0x84,
|
||||||
0x00, 0x00, 0x00, 0x6c, 0x77, 0x74, 0x70, 0x74,
|
0x00, 0x00, 0x00, 0x6c, 0x77, 0x74, 0x70, 0x74,
|
||||||
0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x14,
|
0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x14,
|
||||||
0x62, 0x6b, 0x70, 0x74, 0x00, 0x00, 0x02, 0x04,
|
0x62, 0x6b, 0x70, 0x74, 0x00, 0x00, 0x02, 0x04,
|
||||||
0x00, 0x00, 0x00, 0x14, 0x72, 0x58, 0x59, 0x5a,
|
0x00, 0x00, 0x00, 0x14, 0x72, 0x58, 0x59, 0x5a,
|
||||||
0x00, 0x00, 0x02, 0x18, 0x00, 0x00, 0x00, 0x14,
|
0x00, 0x00, 0x02, 0x18, 0x00, 0x00, 0x00, 0x14,
|
||||||
0x67, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x02, 0x2c,
|
0x67, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x02, 0x2c,
|
||||||
0x00, 0x00, 0x00, 0x14, 0x62, 0x58, 0x59, 0x5a,
|
0x00, 0x00, 0x00, 0x14, 0x62, 0x58, 0x59, 0x5a,
|
||||||
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x14,
|
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x14,
|
||||||
0x64, 0x6d, 0x6e, 0x64, 0x00, 0x00, 0x02, 0x54,
|
0x64, 0x6d, 0x6e, 0x64, 0x00, 0x00, 0x02, 0x54,
|
||||||
0x00, 0x00, 0x00, 0x70, 0x64, 0x6d, 0x64, 0x64,
|
0x00, 0x00, 0x00, 0x70, 0x64, 0x6d, 0x64, 0x64,
|
||||||
0x00, 0x00, 0x02, 0xc4, 0x00, 0x00, 0x00, 0x88,
|
0x00, 0x00, 0x02, 0xc4, 0x00, 0x00, 0x00, 0x88,
|
||||||
0x76, 0x75, 0x65, 0x64, 0x00, 0x00, 0x03, 0x4c,
|
0x76, 0x75, 0x65, 0x64, 0x00, 0x00, 0x03, 0x4c,
|
||||||
0x00, 0x00, 0x00, 0x86, 0x76, 0x69, 0x65, 0x77,
|
0x00, 0x00, 0x00, 0x86, 0x76, 0x69, 0x65, 0x77,
|
||||||
0x00, 0x00, 0x03, 0xd4, 0x00, 0x00, 0x00, 0x24,
|
0x00, 0x00, 0x03, 0xd4, 0x00, 0x00, 0x00, 0x24,
|
||||||
0x6c, 0x75, 0x6d, 0x69, 0x00, 0x00, 0x03, 0xf8,
|
0x6c, 0x75, 0x6d, 0x69, 0x00, 0x00, 0x03, 0xf8,
|
||||||
0x00, 0x00, 0x00, 0x14, 0x6d, 0x65, 0x61, 0x73,
|
0x00, 0x00, 0x00, 0x14, 0x6d, 0x65, 0x61, 0x73,
|
||||||
0x00, 0x00, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x24,
|
0x00, 0x00, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x24,
|
||||||
0x74, 0x65, 0x63, 0x68, 0x00, 0x00, 0x04, 0x30,
|
0x74, 0x65, 0x63, 0x68, 0x00, 0x00, 0x04, 0x30,
|
||||||
0x00, 0x00, 0x00, 0x0c, 0x72, 0x54, 0x52, 0x43,
|
0x00, 0x00, 0x00, 0x0c, 0x72, 0x54, 0x52, 0x43,
|
||||||
0x00, 0x00, 0x04, 0x3c, 0x00, 0x00, 0x08, 0x0c,
|
0x00, 0x00, 0x04, 0x3c, 0x00, 0x00, 0x08, 0x0c,
|
||||||
0x67, 0x54, 0x52, 0x43, 0x00, 0x00, 0x04, 0x3c,
|
0x67, 0x54, 0x52, 0x43, 0x00, 0x00, 0x04, 0x3c,
|
||||||
0x00, 0x00, 0x08, 0x0c, 0x62, 0x54, 0x52, 0x43,
|
0x00, 0x00, 0x08, 0x0c, 0x62, 0x54, 0x52, 0x43,
|
||||||
0x00, 0x00, 0x04, 0x3c, 0x00, 0x00, 0x08, 0x0c,
|
0x00, 0x00, 0x04, 0x3c, 0x00, 0x00, 0x08, 0x0c,
|
||||||
0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00,
|
0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
|
0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
|
||||||
0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39,
|
0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39,
|
||||||
0x39, 0x38, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65,
|
0x39, 0x38, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65,
|
||||||
0x74, 0x74, 0x2d, 0x50, 0x61, 0x63, 0x6b, 0x61,
|
0x74, 0x74, 0x2d, 0x50, 0x61, 0x63, 0x6b, 0x61,
|
||||||
0x72, 0x64, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61,
|
0x72, 0x64, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61,
|
||||||
0x6e, 0x79, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
|
0x6e, 0x79, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
|
||||||
0x73, 0x52, 0x47, 0x42, 0x20, 0x49, 0x45, 0x43,
|
0x73, 0x52, 0x47, 0x42, 0x20, 0x49, 0x45, 0x43,
|
||||||
0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e,
|
0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e,
|
||||||
0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x12, 0x73, 0x52, 0x47,
|
0x00, 0x00, 0x00, 0x00, 0x12, 0x73, 0x52, 0x47,
|
||||||
0x42, 0x20, 0x49, 0x45, 0x43, 0x36, 0x31, 0x39,
|
0x42, 0x20, 0x49, 0x45, 0x43, 0x36, 0x31, 0x39,
|
||||||
0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x00, 0x00,
|
0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xf3, 0x51, 0x00, 0x01, 0x00, 0x00,
|
0x00, 0x00, 0xf3, 0x51, 0x00, 0x01, 0x00, 0x00,
|
||||||
0x00, 0x01, 0x16, 0xcc, 0x58, 0x59, 0x5a, 0x20,
|
0x00, 0x01, 0x16, 0xcc, 0x58, 0x59, 0x5a, 0x20,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x6f, 0xa2, 0x00, 0x00, 0x38, 0xf5,
|
0x00, 0x00, 0x6f, 0xa2, 0x00, 0x00, 0x38, 0xf5,
|
||||||
0x00, 0x00, 0x03, 0x90, 0x58, 0x59, 0x5a, 0x20,
|
0x00, 0x00, 0x03, 0x90, 0x58, 0x59, 0x5a, 0x20,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x99,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x99,
|
||||||
0x00, 0x00, 0xb7, 0x85, 0x00, 0x00, 0x18, 0xda,
|
0x00, 0x00, 0xb7, 0x85, 0x00, 0x00, 0x18, 0xda,
|
||||||
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x24, 0xa0, 0x00, 0x00, 0x0f, 0x84,
|
0x00, 0x00, 0x24, 0xa0, 0x00, 0x00, 0x0f, 0x84,
|
||||||
0x00, 0x00, 0xb6, 0xcf, 0x64, 0x65, 0x73, 0x63,
|
0x00, 0x00, 0xb6, 0xcf, 0x64, 0x65, 0x73, 0x63,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16,
|
||||||
0x49, 0x45, 0x43, 0x20, 0x68, 0x74, 0x74, 0x70,
|
0x49, 0x45, 0x43, 0x20, 0x68, 0x74, 0x74, 0x70,
|
||||||
0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69,
|
0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69,
|
||||||
0x65, 0x63, 0x2e, 0x63, 0x68, 0x00, 0x00, 0x00,
|
0x65, 0x63, 0x2e, 0x63, 0x68, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x16, 0x49, 0x45, 0x43, 0x20, 0x68, 0x74, 0x74,
|
0x16, 0x49, 0x45, 0x43, 0x20, 0x68, 0x74, 0x74,
|
||||||
0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e,
|
0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e,
|
||||||
0x69, 0x65, 0x63, 0x2e, 0x63, 0x68, 0x00, 0x00,
|
0x69, 0x65, 0x63, 0x2e, 0x63, 0x68, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
|
0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e,
|
||||||
0x49, 0x45, 0x43, 0x20, 0x36, 0x31, 0x39, 0x36,
|
0x49, 0x45, 0x43, 0x20, 0x36, 0x31, 0x39, 0x36,
|
||||||
0x36, 0x2d, 0x32, 0x2e, 0x31, 0x20, 0x44, 0x65,
|
0x36, 0x2d, 0x32, 0x2e, 0x31, 0x20, 0x44, 0x65,
|
||||||
0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x52, 0x47,
|
0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x52, 0x47,
|
||||||
0x42, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x75, 0x72,
|
0x42, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x75, 0x72,
|
||||||
0x20, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x2d,
|
0x20, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x2d,
|
||||||
0x20, 0x73, 0x52, 0x47, 0x42, 0x00, 0x00, 0x00,
|
0x20, 0x73, 0x52, 0x47, 0x42, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x2e, 0x49, 0x45, 0x43, 0x20, 0x36, 0x31, 0x39,
|
0x2e, 0x49, 0x45, 0x43, 0x20, 0x36, 0x31, 0x39,
|
||||||
0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x20, 0x44,
|
0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x20, 0x44,
|
||||||
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x52,
|
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x52,
|
||||||
0x47, 0x42, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x75,
|
0x47, 0x42, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x75,
|
||||||
0x72, 0x20, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20,
|
0x72, 0x20, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20,
|
||||||
0x2d, 0x20, 0x73, 0x52, 0x47, 0x42, 0x00, 0x00,
|
0x2d, 0x20, 0x73, 0x52, 0x47, 0x42, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
|
0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c,
|
||||||
0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
|
0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
|
||||||
0x65, 0x20, 0x56, 0x69, 0x65, 0x77, 0x69, 0x6e,
|
0x65, 0x20, 0x56, 0x69, 0x65, 0x77, 0x69, 0x6e,
|
||||||
0x67, 0x20, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74,
|
0x67, 0x20, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74,
|
||||||
0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x49,
|
0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x49,
|
||||||
0x45, 0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d,
|
0x45, 0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d,
|
||||||
0x32, 0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x32, 0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x52,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x52,
|
||||||
0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
|
0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
|
||||||
0x20, 0x56, 0x69, 0x65, 0x77, 0x69, 0x6e, 0x67,
|
0x20, 0x56, 0x69, 0x65, 0x77, 0x69, 0x6e, 0x67,
|
||||||
0x20, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69,
|
0x20, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69,
|
||||||
0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45,
|
0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45,
|
||||||
0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32,
|
0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32,
|
||||||
0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x76, 0x69, 0x65, 0x77,
|
0x00, 0x00, 0x00, 0x00, 0x76, 0x69, 0x65, 0x77,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xa4, 0xfe,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xa4, 0xfe,
|
||||||
0x00, 0x14, 0x5f, 0x2e, 0x00, 0x10, 0xcf, 0x14,
|
0x00, 0x14, 0x5f, 0x2e, 0x00, 0x10, 0xcf, 0x14,
|
||||||
0x00, 0x03, 0xed, 0xcc, 0x00, 0x04, 0x13, 0x0b,
|
0x00, 0x03, 0xed, 0xcc, 0x00, 0x04, 0x13, 0x0b,
|
||||||
0x00, 0x03, 0x5c, 0x9e, 0x00, 0x00, 0x00, 0x01,
|
0x00, 0x03, 0x5c, 0x9e, 0x00, 0x00, 0x00, 0x01,
|
||||||
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x4c, 0x09, 0x56, 0x00, 0x50, 0x00, 0x00,
|
0x00, 0x4c, 0x09, 0x56, 0x00, 0x50, 0x00, 0x00,
|
||||||
0x00, 0x57, 0x1f, 0xe7, 0x6d, 0x65, 0x61, 0x73,
|
0x00, 0x57, 0x1f, 0xe7, 0x6d, 0x65, 0x61, 0x73,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x02, 0x8f, 0x00, 0x00, 0x00, 0x02,
|
0x00, 0x00, 0x02, 0x8f, 0x00, 0x00, 0x00, 0x02,
|
||||||
0x73, 0x69, 0x67, 0x20, 0x00, 0x00, 0x00, 0x00,
|
0x73, 0x69, 0x67, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x43, 0x52, 0x54, 0x20, 0x63, 0x75, 0x72, 0x76,
|
0x43, 0x52, 0x54, 0x20, 0x63, 0x75, 0x72, 0x76,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x0f,
|
0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x0f,
|
||||||
0x00, 0x14, 0x00, 0x19, 0x00, 0x1e, 0x00, 0x23,
|
0x00, 0x14, 0x00, 0x19, 0x00, 0x1e, 0x00, 0x23,
|
||||||
0x00, 0x28, 0x00, 0x2d, 0x00, 0x32, 0x00, 0x37,
|
0x00, 0x28, 0x00, 0x2d, 0x00, 0x32, 0x00, 0x37,
|
||||||
0x00, 0x3b, 0x00, 0x40, 0x00, 0x45, 0x00, 0x4a,
|
0x00, 0x3b, 0x00, 0x40, 0x00, 0x45, 0x00, 0x4a,
|
||||||
0x00, 0x4f, 0x00, 0x54, 0x00, 0x59, 0x00, 0x5e,
|
0x00, 0x4f, 0x00, 0x54, 0x00, 0x59, 0x00, 0x5e,
|
||||||
0x00, 0x63, 0x00, 0x68, 0x00, 0x6d, 0x00, 0x72,
|
0x00, 0x63, 0x00, 0x68, 0x00, 0x6d, 0x00, 0x72,
|
||||||
0x00, 0x77, 0x00, 0x7c, 0x00, 0x81, 0x00, 0x86,
|
0x00, 0x77, 0x00, 0x7c, 0x00, 0x81, 0x00, 0x86,
|
||||||
0x00, 0x8b, 0x00, 0x90, 0x00, 0x95, 0x00, 0x9a,
|
0x00, 0x8b, 0x00, 0x90, 0x00, 0x95, 0x00, 0x9a,
|
||||||
0x00, 0x9f, 0x00, 0xa4, 0x00, 0xa9, 0x00, 0xae,
|
0x00, 0x9f, 0x00, 0xa4, 0x00, 0xa9, 0x00, 0xae,
|
||||||
0x00, 0xb2, 0x00, 0xb7, 0x00, 0xbc, 0x00, 0xc1,
|
0x00, 0xb2, 0x00, 0xb7, 0x00, 0xbc, 0x00, 0xc1,
|
||||||
0x00, 0xc6, 0x00, 0xcb, 0x00, 0xd0, 0x00, 0xd5,
|
0x00, 0xc6, 0x00, 0xcb, 0x00, 0xd0, 0x00, 0xd5,
|
||||||
0x00, 0xdb, 0x00, 0xe0, 0x00, 0xe5, 0x00, 0xeb,
|
0x00, 0xdb, 0x00, 0xe0, 0x00, 0xe5, 0x00, 0xeb,
|
||||||
0x00, 0xf0, 0x00, 0xf6, 0x00, 0xfb, 0x01, 0x01,
|
0x00, 0xf0, 0x00, 0xf6, 0x00, 0xfb, 0x01, 0x01,
|
||||||
0x01, 0x07, 0x01, 0x0d, 0x01, 0x13, 0x01, 0x19,
|
0x01, 0x07, 0x01, 0x0d, 0x01, 0x13, 0x01, 0x19,
|
||||||
0x01, 0x1f, 0x01, 0x25, 0x01, 0x2b, 0x01, 0x32,
|
0x01, 0x1f, 0x01, 0x25, 0x01, 0x2b, 0x01, 0x32,
|
||||||
0x01, 0x38, 0x01, 0x3e, 0x01, 0x45, 0x01, 0x4c,
|
0x01, 0x38, 0x01, 0x3e, 0x01, 0x45, 0x01, 0x4c,
|
||||||
0x01, 0x52, 0x01, 0x59, 0x01, 0x60, 0x01, 0x67,
|
0x01, 0x52, 0x01, 0x59, 0x01, 0x60, 0x01, 0x67,
|
||||||
0x01, 0x6e, 0x01, 0x75, 0x01, 0x7c, 0x01, 0x83,
|
0x01, 0x6e, 0x01, 0x75, 0x01, 0x7c, 0x01, 0x83,
|
||||||
0x01, 0x8b, 0x01, 0x92, 0x01, 0x9a, 0x01, 0xa1,
|
0x01, 0x8b, 0x01, 0x92, 0x01, 0x9a, 0x01, 0xa1,
|
||||||
0x01, 0xa9, 0x01, 0xb1, 0x01, 0xb9, 0x01, 0xc1,
|
0x01, 0xa9, 0x01, 0xb1, 0x01, 0xb9, 0x01, 0xc1,
|
||||||
0x01, 0xc9, 0x01, 0xd1, 0x01, 0xd9, 0x01, 0xe1,
|
0x01, 0xc9, 0x01, 0xd1, 0x01, 0xd9, 0x01, 0xe1,
|
||||||
0x01, 0xe9, 0x01, 0xf2, 0x01, 0xfa, 0x02, 0x03,
|
0x01, 0xe9, 0x01, 0xf2, 0x01, 0xfa, 0x02, 0x03,
|
||||||
0x02, 0x0c, 0x02, 0x14, 0x02, 0x1d, 0x02, 0x26,
|
0x02, 0x0c, 0x02, 0x14, 0x02, 0x1d, 0x02, 0x26,
|
||||||
0x02, 0x2f, 0x02, 0x38, 0x02, 0x41, 0x02, 0x4b,
|
0x02, 0x2f, 0x02, 0x38, 0x02, 0x41, 0x02, 0x4b,
|
||||||
0x02, 0x54, 0x02, 0x5d, 0x02, 0x67, 0x02, 0x71,
|
0x02, 0x54, 0x02, 0x5d, 0x02, 0x67, 0x02, 0x71,
|
||||||
0x02, 0x7a, 0x02, 0x84, 0x02, 0x8e, 0x02, 0x98,
|
0x02, 0x7a, 0x02, 0x84, 0x02, 0x8e, 0x02, 0x98,
|
||||||
0x02, 0xa2, 0x02, 0xac, 0x02, 0xb6, 0x02, 0xc1,
|
0x02, 0xa2, 0x02, 0xac, 0x02, 0xb6, 0x02, 0xc1,
|
||||||
0x02, 0xcb, 0x02, 0xd5, 0x02, 0xe0, 0x02, 0xeb,
|
0x02, 0xcb, 0x02, 0xd5, 0x02, 0xe0, 0x02, 0xeb,
|
||||||
0x02, 0xf5, 0x03, 0x00, 0x03, 0x0b, 0x03, 0x16,
|
0x02, 0xf5, 0x03, 0x00, 0x03, 0x0b, 0x03, 0x16,
|
||||||
0x03, 0x21, 0x03, 0x2d, 0x03, 0x38, 0x03, 0x43,
|
0x03, 0x21, 0x03, 0x2d, 0x03, 0x38, 0x03, 0x43,
|
||||||
0x03, 0x4f, 0x03, 0x5a, 0x03, 0x66, 0x03, 0x72,
|
0x03, 0x4f, 0x03, 0x5a, 0x03, 0x66, 0x03, 0x72,
|
||||||
0x03, 0x7e, 0x03, 0x8a, 0x03, 0x96, 0x03, 0xa2,
|
0x03, 0x7e, 0x03, 0x8a, 0x03, 0x96, 0x03, 0xa2,
|
||||||
0x03, 0xae, 0x03, 0xba, 0x03, 0xc7, 0x03, 0xd3,
|
0x03, 0xae, 0x03, 0xba, 0x03, 0xc7, 0x03, 0xd3,
|
||||||
0x03, 0xe0, 0x03, 0xec, 0x03, 0xf9, 0x04, 0x06,
|
0x03, 0xe0, 0x03, 0xec, 0x03, 0xf9, 0x04, 0x06,
|
||||||
0x04, 0x13, 0x04, 0x20, 0x04, 0x2d, 0x04, 0x3b,
|
0x04, 0x13, 0x04, 0x20, 0x04, 0x2d, 0x04, 0x3b,
|
||||||
0x04, 0x48, 0x04, 0x55, 0x04, 0x63, 0x04, 0x71,
|
0x04, 0x48, 0x04, 0x55, 0x04, 0x63, 0x04, 0x71,
|
||||||
0x04, 0x7e, 0x04, 0x8c, 0x04, 0x9a, 0x04, 0xa8,
|
0x04, 0x7e, 0x04, 0x8c, 0x04, 0x9a, 0x04, 0xa8,
|
||||||
0x04, 0xb6, 0x04, 0xc4, 0x04, 0xd3, 0x04, 0xe1,
|
0x04, 0xb6, 0x04, 0xc4, 0x04, 0xd3, 0x04, 0xe1,
|
||||||
0x04, 0xf0, 0x04, 0xfe, 0x05, 0x0d, 0x05, 0x1c,
|
0x04, 0xf0, 0x04, 0xfe, 0x05, 0x0d, 0x05, 0x1c,
|
||||||
0x05, 0x2b, 0x05, 0x3a, 0x05, 0x49, 0x05, 0x58,
|
0x05, 0x2b, 0x05, 0x3a, 0x05, 0x49, 0x05, 0x58,
|
||||||
0x05, 0x67, 0x05, 0x77, 0x05, 0x86, 0x05, 0x96,
|
0x05, 0x67, 0x05, 0x77, 0x05, 0x86, 0x05, 0x96,
|
||||||
0x05, 0xa6, 0x05, 0xb5, 0x05, 0xc5, 0x05, 0xd5,
|
0x05, 0xa6, 0x05, 0xb5, 0x05, 0xc5, 0x05, 0xd5,
|
||||||
0x05, 0xe5, 0x05, 0xf6, 0x06, 0x06, 0x06, 0x16,
|
0x05, 0xe5, 0x05, 0xf6, 0x06, 0x06, 0x06, 0x16,
|
||||||
0x06, 0x27, 0x06, 0x37, 0x06, 0x48, 0x06, 0x59,
|
0x06, 0x27, 0x06, 0x37, 0x06, 0x48, 0x06, 0x59,
|
||||||
0x06, 0x6a, 0x06, 0x7b, 0x06, 0x8c, 0x06, 0x9d,
|
0x06, 0x6a, 0x06, 0x7b, 0x06, 0x8c, 0x06, 0x9d,
|
||||||
0x06, 0xaf, 0x06, 0xc0, 0x06, 0xd1, 0x06, 0xe3,
|
0x06, 0xaf, 0x06, 0xc0, 0x06, 0xd1, 0x06, 0xe3,
|
||||||
0x06, 0xf5, 0x07, 0x07, 0x07, 0x19, 0x07, 0x2b,
|
0x06, 0xf5, 0x07, 0x07, 0x07, 0x19, 0x07, 0x2b,
|
||||||
0x07, 0x3d, 0x07, 0x4f, 0x07, 0x61, 0x07, 0x74,
|
0x07, 0x3d, 0x07, 0x4f, 0x07, 0x61, 0x07, 0x74,
|
||||||
0x07, 0x86, 0x07, 0x99, 0x07, 0xac, 0x07, 0xbf,
|
0x07, 0x86, 0x07, 0x99, 0x07, 0xac, 0x07, 0xbf,
|
||||||
0x07, 0xd2, 0x07, 0xe5, 0x07, 0xf8, 0x08, 0x0b,
|
0x07, 0xd2, 0x07, 0xe5, 0x07, 0xf8, 0x08, 0x0b,
|
||||||
0x08, 0x1f, 0x08, 0x32, 0x08, 0x46, 0x08, 0x5a,
|
0x08, 0x1f, 0x08, 0x32, 0x08, 0x46, 0x08, 0x5a,
|
||||||
0x08, 0x6e, 0x08, 0x82, 0x08, 0x96, 0x08, 0xaa,
|
0x08, 0x6e, 0x08, 0x82, 0x08, 0x96, 0x08, 0xaa,
|
||||||
0x08, 0xbe, 0x08, 0xd2, 0x08, 0xe7, 0x08, 0xfb,
|
0x08, 0xbe, 0x08, 0xd2, 0x08, 0xe7, 0x08, 0xfb,
|
||||||
0x09, 0x10, 0x09, 0x25, 0x09, 0x3a, 0x09, 0x4f,
|
0x09, 0x10, 0x09, 0x25, 0x09, 0x3a, 0x09, 0x4f,
|
||||||
0x09, 0x64, 0x09, 0x79, 0x09, 0x8f, 0x09, 0xa4,
|
0x09, 0x64, 0x09, 0x79, 0x09, 0x8f, 0x09, 0xa4,
|
||||||
0x09, 0xba, 0x09, 0xcf, 0x09, 0xe5, 0x09, 0xfb,
|
0x09, 0xba, 0x09, 0xcf, 0x09, 0xe5, 0x09, 0xfb,
|
||||||
0x0a, 0x11, 0x0a, 0x27, 0x0a, 0x3d, 0x0a, 0x54,
|
0x0a, 0x11, 0x0a, 0x27, 0x0a, 0x3d, 0x0a, 0x54,
|
||||||
0x0a, 0x6a, 0x0a, 0x81, 0x0a, 0x98, 0x0a, 0xae,
|
0x0a, 0x6a, 0x0a, 0x81, 0x0a, 0x98, 0x0a, 0xae,
|
||||||
0x0a, 0xc5, 0x0a, 0xdc, 0x0a, 0xf3, 0x0b, 0x0b,
|
0x0a, 0xc5, 0x0a, 0xdc, 0x0a, 0xf3, 0x0b, 0x0b,
|
||||||
0x0b, 0x22, 0x0b, 0x39, 0x0b, 0x51, 0x0b, 0x69,
|
0x0b, 0x22, 0x0b, 0x39, 0x0b, 0x51, 0x0b, 0x69,
|
||||||
0x0b, 0x80, 0x0b, 0x98, 0x0b, 0xb0, 0x0b, 0xc8,
|
0x0b, 0x80, 0x0b, 0x98, 0x0b, 0xb0, 0x0b, 0xc8,
|
||||||
0x0b, 0xe1, 0x0b, 0xf9, 0x0c, 0x12, 0x0c, 0x2a,
|
0x0b, 0xe1, 0x0b, 0xf9, 0x0c, 0x12, 0x0c, 0x2a,
|
||||||
0x0c, 0x43, 0x0c, 0x5c, 0x0c, 0x75, 0x0c, 0x8e,
|
0x0c, 0x43, 0x0c, 0x5c, 0x0c, 0x75, 0x0c, 0x8e,
|
||||||
0x0c, 0xa7, 0x0c, 0xc0, 0x0c, 0xd9, 0x0c, 0xf3,
|
0x0c, 0xa7, 0x0c, 0xc0, 0x0c, 0xd9, 0x0c, 0xf3,
|
||||||
0x0d, 0x0d, 0x0d, 0x26, 0x0d, 0x40, 0x0d, 0x5a,
|
0x0d, 0x0d, 0x0d, 0x26, 0x0d, 0x40, 0x0d, 0x5a,
|
||||||
0x0d, 0x74, 0x0d, 0x8e, 0x0d, 0xa9, 0x0d, 0xc3,
|
0x0d, 0x74, 0x0d, 0x8e, 0x0d, 0xa9, 0x0d, 0xc3,
|
||||||
0x0d, 0xde, 0x0d, 0xf8, 0x0e, 0x13, 0x0e, 0x2e,
|
0x0d, 0xde, 0x0d, 0xf8, 0x0e, 0x13, 0x0e, 0x2e,
|
||||||
0x0e, 0x49, 0x0e, 0x64, 0x0e, 0x7f, 0x0e, 0x9b,
|
0x0e, 0x49, 0x0e, 0x64, 0x0e, 0x7f, 0x0e, 0x9b,
|
||||||
0x0e, 0xb6, 0x0e, 0xd2, 0x0e, 0xee, 0x0f, 0x09,
|
0x0e, 0xb6, 0x0e, 0xd2, 0x0e, 0xee, 0x0f, 0x09,
|
||||||
0x0f, 0x25, 0x0f, 0x41, 0x0f, 0x5e, 0x0f, 0x7a,
|
0x0f, 0x25, 0x0f, 0x41, 0x0f, 0x5e, 0x0f, 0x7a,
|
||||||
0x0f, 0x96, 0x0f, 0xb3, 0x0f, 0xcf, 0x0f, 0xec,
|
0x0f, 0x96, 0x0f, 0xb3, 0x0f, 0xcf, 0x0f, 0xec,
|
||||||
0x10, 0x09, 0x10, 0x26, 0x10, 0x43, 0x10, 0x61,
|
0x10, 0x09, 0x10, 0x26, 0x10, 0x43, 0x10, 0x61,
|
||||||
0x10, 0x7e, 0x10, 0x9b, 0x10, 0xb9, 0x10, 0xd7,
|
0x10, 0x7e, 0x10, 0x9b, 0x10, 0xb9, 0x10, 0xd7,
|
||||||
0x10, 0xf5, 0x11, 0x13, 0x11, 0x31, 0x11, 0x4f,
|
0x10, 0xf5, 0x11, 0x13, 0x11, 0x31, 0x11, 0x4f,
|
||||||
0x11, 0x6d, 0x11, 0x8c, 0x11, 0xaa, 0x11, 0xc9,
|
0x11, 0x6d, 0x11, 0x8c, 0x11, 0xaa, 0x11, 0xc9,
|
||||||
0x11, 0xe8, 0x12, 0x07, 0x12, 0x26, 0x12, 0x45,
|
0x11, 0xe8, 0x12, 0x07, 0x12, 0x26, 0x12, 0x45,
|
||||||
0x12, 0x64, 0x12, 0x84, 0x12, 0xa3, 0x12, 0xc3,
|
0x12, 0x64, 0x12, 0x84, 0x12, 0xa3, 0x12, 0xc3,
|
||||||
0x12, 0xe3, 0x13, 0x03, 0x13, 0x23, 0x13, 0x43,
|
0x12, 0xe3, 0x13, 0x03, 0x13, 0x23, 0x13, 0x43,
|
||||||
0x13, 0x63, 0x13, 0x83, 0x13, 0xa4, 0x13, 0xc5,
|
0x13, 0x63, 0x13, 0x83, 0x13, 0xa4, 0x13, 0xc5,
|
||||||
0x13, 0xe5, 0x14, 0x06, 0x14, 0x27, 0x14, 0x49,
|
0x13, 0xe5, 0x14, 0x06, 0x14, 0x27, 0x14, 0x49,
|
||||||
0x14, 0x6a, 0x14, 0x8b, 0x14, 0xad, 0x14, 0xce,
|
0x14, 0x6a, 0x14, 0x8b, 0x14, 0xad, 0x14, 0xce,
|
||||||
0x14, 0xf0, 0x15, 0x12, 0x15, 0x34, 0x15, 0x56,
|
0x14, 0xf0, 0x15, 0x12, 0x15, 0x34, 0x15, 0x56,
|
||||||
0x15, 0x78, 0x15, 0x9b, 0x15, 0xbd, 0x15, 0xe0,
|
0x15, 0x78, 0x15, 0x9b, 0x15, 0xbd, 0x15, 0xe0,
|
||||||
0x16, 0x03, 0x16, 0x26, 0x16, 0x49, 0x16, 0x6c,
|
0x16, 0x03, 0x16, 0x26, 0x16, 0x49, 0x16, 0x6c,
|
||||||
0x16, 0x8f, 0x16, 0xb2, 0x16, 0xd6, 0x16, 0xfa,
|
0x16, 0x8f, 0x16, 0xb2, 0x16, 0xd6, 0x16, 0xfa,
|
||||||
0x17, 0x1d, 0x17, 0x41, 0x17, 0x65, 0x17, 0x89,
|
0x17, 0x1d, 0x17, 0x41, 0x17, 0x65, 0x17, 0x89,
|
||||||
0x17, 0xae, 0x17, 0xd2, 0x17, 0xf7, 0x18, 0x1b,
|
0x17, 0xae, 0x17, 0xd2, 0x17, 0xf7, 0x18, 0x1b,
|
||||||
0x18, 0x40, 0x18, 0x65, 0x18, 0x8a, 0x18, 0xaf,
|
0x18, 0x40, 0x18, 0x65, 0x18, 0x8a, 0x18, 0xaf,
|
||||||
0x18, 0xd5, 0x18, 0xfa, 0x19, 0x20, 0x19, 0x45,
|
0x18, 0xd5, 0x18, 0xfa, 0x19, 0x20, 0x19, 0x45,
|
||||||
0x19, 0x6b, 0x19, 0x91, 0x19, 0xb7, 0x19, 0xdd,
|
0x19, 0x6b, 0x19, 0x91, 0x19, 0xb7, 0x19, 0xdd,
|
||||||
0x1a, 0x04, 0x1a, 0x2a, 0x1a, 0x51, 0x1a, 0x77,
|
0x1a, 0x04, 0x1a, 0x2a, 0x1a, 0x51, 0x1a, 0x77,
|
||||||
0x1a, 0x9e, 0x1a, 0xc5, 0x1a, 0xec, 0x1b, 0x14,
|
0x1a, 0x9e, 0x1a, 0xc5, 0x1a, 0xec, 0x1b, 0x14,
|
||||||
0x1b, 0x3b, 0x1b, 0x63, 0x1b, 0x8a, 0x1b, 0xb2,
|
0x1b, 0x3b, 0x1b, 0x63, 0x1b, 0x8a, 0x1b, 0xb2,
|
||||||
0x1b, 0xda, 0x1c, 0x02, 0x1c, 0x2a, 0x1c, 0x52,
|
0x1b, 0xda, 0x1c, 0x02, 0x1c, 0x2a, 0x1c, 0x52,
|
||||||
0x1c, 0x7b, 0x1c, 0xa3, 0x1c, 0xcc, 0x1c, 0xf5,
|
0x1c, 0x7b, 0x1c, 0xa3, 0x1c, 0xcc, 0x1c, 0xf5,
|
||||||
0x1d, 0x1e, 0x1d, 0x47, 0x1d, 0x70, 0x1d, 0x99,
|
0x1d, 0x1e, 0x1d, 0x47, 0x1d, 0x70, 0x1d, 0x99,
|
||||||
0x1d, 0xc3, 0x1d, 0xec, 0x1e, 0x16, 0x1e, 0x40,
|
0x1d, 0xc3, 0x1d, 0xec, 0x1e, 0x16, 0x1e, 0x40,
|
||||||
0x1e, 0x6a, 0x1e, 0x94, 0x1e, 0xbe, 0x1e, 0xe9,
|
0x1e, 0x6a, 0x1e, 0x94, 0x1e, 0xbe, 0x1e, 0xe9,
|
||||||
0x1f, 0x13, 0x1f, 0x3e, 0x1f, 0x69, 0x1f, 0x94,
|
0x1f, 0x13, 0x1f, 0x3e, 0x1f, 0x69, 0x1f, 0x94,
|
||||||
0x1f, 0xbf, 0x1f, 0xea, 0x20, 0x15, 0x20, 0x41,
|
0x1f, 0xbf, 0x1f, 0xea, 0x20, 0x15, 0x20, 0x41,
|
||||||
0x20, 0x6c, 0x20, 0x98, 0x20, 0xc4, 0x20, 0xf0,
|
0x20, 0x6c, 0x20, 0x98, 0x20, 0xc4, 0x20, 0xf0,
|
||||||
0x21, 0x1c, 0x21, 0x48, 0x21, 0x75, 0x21, 0xa1,
|
0x21, 0x1c, 0x21, 0x48, 0x21, 0x75, 0x21, 0xa1,
|
||||||
0x21, 0xce, 0x21, 0xfb, 0x22, 0x27, 0x22, 0x55,
|
0x21, 0xce, 0x21, 0xfb, 0x22, 0x27, 0x22, 0x55,
|
||||||
0x22, 0x82, 0x22, 0xaf, 0x22, 0xdd, 0x23, 0x0a,
|
0x22, 0x82, 0x22, 0xaf, 0x22, 0xdd, 0x23, 0x0a,
|
||||||
0x23, 0x38, 0x23, 0x66, 0x23, 0x94, 0x23, 0xc2,
|
0x23, 0x38, 0x23, 0x66, 0x23, 0x94, 0x23, 0xc2,
|
||||||
0x23, 0xf0, 0x24, 0x1f, 0x24, 0x4d, 0x24, 0x7c,
|
0x23, 0xf0, 0x24, 0x1f, 0x24, 0x4d, 0x24, 0x7c,
|
||||||
0x24, 0xab, 0x24, 0xda, 0x25, 0x09, 0x25, 0x38,
|
0x24, 0xab, 0x24, 0xda, 0x25, 0x09, 0x25, 0x38,
|
||||||
0x25, 0x68, 0x25, 0x97, 0x25, 0xc7, 0x25, 0xf7,
|
0x25, 0x68, 0x25, 0x97, 0x25, 0xc7, 0x25, 0xf7,
|
||||||
0x26, 0x27, 0x26, 0x57, 0x26, 0x87, 0x26, 0xb7,
|
0x26, 0x27, 0x26, 0x57, 0x26, 0x87, 0x26, 0xb7,
|
||||||
0x26, 0xe8, 0x27, 0x18, 0x27, 0x49, 0x27, 0x7a,
|
0x26, 0xe8, 0x27, 0x18, 0x27, 0x49, 0x27, 0x7a,
|
||||||
0x27, 0xab, 0x27, 0xdc, 0x28, 0x0d, 0x28, 0x3f,
|
0x27, 0xab, 0x27, 0xdc, 0x28, 0x0d, 0x28, 0x3f,
|
||||||
0x28, 0x71, 0x28, 0xa2, 0x28, 0xd4, 0x29, 0x06,
|
0x28, 0x71, 0x28, 0xa2, 0x28, 0xd4, 0x29, 0x06,
|
||||||
0x29, 0x38, 0x29, 0x6b, 0x29, 0x9d, 0x29, 0xd0,
|
0x29, 0x38, 0x29, 0x6b, 0x29, 0x9d, 0x29, 0xd0,
|
||||||
0x2a, 0x02, 0x2a, 0x35, 0x2a, 0x68, 0x2a, 0x9b,
|
0x2a, 0x02, 0x2a, 0x35, 0x2a, 0x68, 0x2a, 0x9b,
|
||||||
0x2a, 0xcf, 0x2b, 0x02, 0x2b, 0x36, 0x2b, 0x69,
|
0x2a, 0xcf, 0x2b, 0x02, 0x2b, 0x36, 0x2b, 0x69,
|
||||||
0x2b, 0x9d, 0x2b, 0xd1, 0x2c, 0x05, 0x2c, 0x39,
|
0x2b, 0x9d, 0x2b, 0xd1, 0x2c, 0x05, 0x2c, 0x39,
|
||||||
0x2c, 0x6e, 0x2c, 0xa2, 0x2c, 0xd7, 0x2d, 0x0c,
|
0x2c, 0x6e, 0x2c, 0xa2, 0x2c, 0xd7, 0x2d, 0x0c,
|
||||||
0x2d, 0x41, 0x2d, 0x76, 0x2d, 0xab, 0x2d, 0xe1,
|
0x2d, 0x41, 0x2d, 0x76, 0x2d, 0xab, 0x2d, 0xe1,
|
||||||
0x2e, 0x16, 0x2e, 0x4c, 0x2e, 0x82, 0x2e, 0xb7,
|
0x2e, 0x16, 0x2e, 0x4c, 0x2e, 0x82, 0x2e, 0xb7,
|
||||||
0x2e, 0xee, 0x2f, 0x24, 0x2f, 0x5a, 0x2f, 0x91,
|
0x2e, 0xee, 0x2f, 0x24, 0x2f, 0x5a, 0x2f, 0x91,
|
||||||
0x2f, 0xc7, 0x2f, 0xfe, 0x30, 0x35, 0x30, 0x6c,
|
0x2f, 0xc7, 0x2f, 0xfe, 0x30, 0x35, 0x30, 0x6c,
|
||||||
0x30, 0xa4, 0x30, 0xdb, 0x31, 0x12, 0x31, 0x4a,
|
0x30, 0xa4, 0x30, 0xdb, 0x31, 0x12, 0x31, 0x4a,
|
||||||
0x31, 0x82, 0x31, 0xba, 0x31, 0xf2, 0x32, 0x2a,
|
0x31, 0x82, 0x31, 0xba, 0x31, 0xf2, 0x32, 0x2a,
|
||||||
0x32, 0x63, 0x32, 0x9b, 0x32, 0xd4, 0x33, 0x0d,
|
0x32, 0x63, 0x32, 0x9b, 0x32, 0xd4, 0x33, 0x0d,
|
||||||
0x33, 0x46, 0x33, 0x7f, 0x33, 0xb8, 0x33, 0xf1,
|
0x33, 0x46, 0x33, 0x7f, 0x33, 0xb8, 0x33, 0xf1,
|
||||||
0x34, 0x2b, 0x34, 0x65, 0x34, 0x9e, 0x34, 0xd8,
|
0x34, 0x2b, 0x34, 0x65, 0x34, 0x9e, 0x34, 0xd8,
|
||||||
0x35, 0x13, 0x35, 0x4d, 0x35, 0x87, 0x35, 0xc2,
|
0x35, 0x13, 0x35, 0x4d, 0x35, 0x87, 0x35, 0xc2,
|
||||||
0x35, 0xfd, 0x36, 0x37, 0x36, 0x72, 0x36, 0xae,
|
0x35, 0xfd, 0x36, 0x37, 0x36, 0x72, 0x36, 0xae,
|
||||||
0x36, 0xe9, 0x37, 0x24, 0x37, 0x60, 0x37, 0x9c,
|
0x36, 0xe9, 0x37, 0x24, 0x37, 0x60, 0x37, 0x9c,
|
||||||
0x37, 0xd7, 0x38, 0x14, 0x38, 0x50, 0x38, 0x8c,
|
0x37, 0xd7, 0x38, 0x14, 0x38, 0x50, 0x38, 0x8c,
|
||||||
0x38, 0xc8, 0x39, 0x05, 0x39, 0x42, 0x39, 0x7f,
|
0x38, 0xc8, 0x39, 0x05, 0x39, 0x42, 0x39, 0x7f,
|
||||||
0x39, 0xbc, 0x39, 0xf9, 0x3a, 0x36, 0x3a, 0x74,
|
0x39, 0xbc, 0x39, 0xf9, 0x3a, 0x36, 0x3a, 0x74,
|
||||||
0x3a, 0xb2, 0x3a, 0xef, 0x3b, 0x2d, 0x3b, 0x6b,
|
0x3a, 0xb2, 0x3a, 0xef, 0x3b, 0x2d, 0x3b, 0x6b,
|
||||||
0x3b, 0xaa, 0x3b, 0xe8, 0x3c, 0x27, 0x3c, 0x65,
|
0x3b, 0xaa, 0x3b, 0xe8, 0x3c, 0x27, 0x3c, 0x65,
|
||||||
0x3c, 0xa4, 0x3c, 0xe3, 0x3d, 0x22, 0x3d, 0x61,
|
0x3c, 0xa4, 0x3c, 0xe3, 0x3d, 0x22, 0x3d, 0x61,
|
||||||
0x3d, 0xa1, 0x3d, 0xe0, 0x3e, 0x20, 0x3e, 0x60,
|
0x3d, 0xa1, 0x3d, 0xe0, 0x3e, 0x20, 0x3e, 0x60,
|
||||||
0x3e, 0xa0, 0x3e, 0xe0, 0x3f, 0x21, 0x3f, 0x61,
|
0x3e, 0xa0, 0x3e, 0xe0, 0x3f, 0x21, 0x3f, 0x61,
|
||||||
0x3f, 0xa2, 0x3f, 0xe2, 0x40, 0x23, 0x40, 0x64,
|
0x3f, 0xa2, 0x3f, 0xe2, 0x40, 0x23, 0x40, 0x64,
|
||||||
0x40, 0xa6, 0x40, 0xe7, 0x41, 0x29, 0x41, 0x6a,
|
0x40, 0xa6, 0x40, 0xe7, 0x41, 0x29, 0x41, 0x6a,
|
||||||
0x41, 0xac, 0x41, 0xee, 0x42, 0x30, 0x42, 0x72,
|
0x41, 0xac, 0x41, 0xee, 0x42, 0x30, 0x42, 0x72,
|
||||||
0x42, 0xb5, 0x42, 0xf7, 0x43, 0x3a, 0x43, 0x7d,
|
0x42, 0xb5, 0x42, 0xf7, 0x43, 0x3a, 0x43, 0x7d,
|
||||||
0x43, 0xc0, 0x44, 0x03, 0x44, 0x47, 0x44, 0x8a,
|
0x43, 0xc0, 0x44, 0x03, 0x44, 0x47, 0x44, 0x8a,
|
||||||
0x44, 0xce, 0x45, 0x12, 0x45, 0x55, 0x45, 0x9a,
|
0x44, 0xce, 0x45, 0x12, 0x45, 0x55, 0x45, 0x9a,
|
||||||
0x45, 0xde, 0x46, 0x22, 0x46, 0x67, 0x46, 0xab,
|
0x45, 0xde, 0x46, 0x22, 0x46, 0x67, 0x46, 0xab,
|
||||||
0x46, 0xf0, 0x47, 0x35, 0x47, 0x7b, 0x47, 0xc0,
|
0x46, 0xf0, 0x47, 0x35, 0x47, 0x7b, 0x47, 0xc0,
|
||||||
0x48, 0x05, 0x48, 0x4b, 0x48, 0x91, 0x48, 0xd7,
|
0x48, 0x05, 0x48, 0x4b, 0x48, 0x91, 0x48, 0xd7,
|
||||||
0x49, 0x1d, 0x49, 0x63, 0x49, 0xa9, 0x49, 0xf0,
|
0x49, 0x1d, 0x49, 0x63, 0x49, 0xa9, 0x49, 0xf0,
|
||||||
0x4a, 0x37, 0x4a, 0x7d, 0x4a, 0xc4, 0x4b, 0x0c,
|
0x4a, 0x37, 0x4a, 0x7d, 0x4a, 0xc4, 0x4b, 0x0c,
|
||||||
0x4b, 0x53, 0x4b, 0x9a, 0x4b, 0xe2, 0x4c, 0x2a,
|
0x4b, 0x53, 0x4b, 0x9a, 0x4b, 0xe2, 0x4c, 0x2a,
|
||||||
0x4c, 0x72, 0x4c, 0xba, 0x4d, 0x02, 0x4d, 0x4a,
|
0x4c, 0x72, 0x4c, 0xba, 0x4d, 0x02, 0x4d, 0x4a,
|
||||||
0x4d, 0x93, 0x4d, 0xdc, 0x4e, 0x25, 0x4e, 0x6e,
|
0x4d, 0x93, 0x4d, 0xdc, 0x4e, 0x25, 0x4e, 0x6e,
|
||||||
0x4e, 0xb7, 0x4f, 0x00, 0x4f, 0x49, 0x4f, 0x93,
|
0x4e, 0xb7, 0x4f, 0x00, 0x4f, 0x49, 0x4f, 0x93,
|
||||||
0x4f, 0xdd, 0x50, 0x27, 0x50, 0x71, 0x50, 0xbb,
|
0x4f, 0xdd, 0x50, 0x27, 0x50, 0x71, 0x50, 0xbb,
|
||||||
0x51, 0x06, 0x51, 0x50, 0x51, 0x9b, 0x51, 0xe6,
|
0x51, 0x06, 0x51, 0x50, 0x51, 0x9b, 0x51, 0xe6,
|
||||||
0x52, 0x31, 0x52, 0x7c, 0x52, 0xc7, 0x53, 0x13,
|
0x52, 0x31, 0x52, 0x7c, 0x52, 0xc7, 0x53, 0x13,
|
||||||
0x53, 0x5f, 0x53, 0xaa, 0x53, 0xf6, 0x54, 0x42,
|
0x53, 0x5f, 0x53, 0xaa, 0x53, 0xf6, 0x54, 0x42,
|
||||||
0x54, 0x8f, 0x54, 0xdb, 0x55, 0x28, 0x55, 0x75,
|
0x54, 0x8f, 0x54, 0xdb, 0x55, 0x28, 0x55, 0x75,
|
||||||
0x55, 0xc2, 0x56, 0x0f, 0x56, 0x5c, 0x56, 0xa9,
|
0x55, 0xc2, 0x56, 0x0f, 0x56, 0x5c, 0x56, 0xa9,
|
||||||
0x56, 0xf7, 0x57, 0x44, 0x57, 0x92, 0x57, 0xe0,
|
0x56, 0xf7, 0x57, 0x44, 0x57, 0x92, 0x57, 0xe0,
|
||||||
0x58, 0x2f, 0x58, 0x7d, 0x58, 0xcb, 0x59, 0x1a,
|
0x58, 0x2f, 0x58, 0x7d, 0x58, 0xcb, 0x59, 0x1a,
|
||||||
0x59, 0x69, 0x59, 0xb8, 0x5a, 0x07, 0x5a, 0x56,
|
0x59, 0x69, 0x59, 0xb8, 0x5a, 0x07, 0x5a, 0x56,
|
||||||
0x5a, 0xa6, 0x5a, 0xf5, 0x5b, 0x45, 0x5b, 0x95,
|
0x5a, 0xa6, 0x5a, 0xf5, 0x5b, 0x45, 0x5b, 0x95,
|
||||||
0x5b, 0xe5, 0x5c, 0x35, 0x5c, 0x86, 0x5c, 0xd6,
|
0x5b, 0xe5, 0x5c, 0x35, 0x5c, 0x86, 0x5c, 0xd6,
|
||||||
0x5d, 0x27, 0x5d, 0x78, 0x5d, 0xc9, 0x5e, 0x1a,
|
0x5d, 0x27, 0x5d, 0x78, 0x5d, 0xc9, 0x5e, 0x1a,
|
||||||
0x5e, 0x6c, 0x5e, 0xbd, 0x5f, 0x0f, 0x5f, 0x61,
|
0x5e, 0x6c, 0x5e, 0xbd, 0x5f, 0x0f, 0x5f, 0x61,
|
||||||
0x5f, 0xb3, 0x60, 0x05, 0x60, 0x57, 0x60, 0xaa,
|
0x5f, 0xb3, 0x60, 0x05, 0x60, 0x57, 0x60, 0xaa,
|
||||||
0x60, 0xfc, 0x61, 0x4f, 0x61, 0xa2, 0x61, 0xf5,
|
0x60, 0xfc, 0x61, 0x4f, 0x61, 0xa2, 0x61, 0xf5,
|
||||||
0x62, 0x49, 0x62, 0x9c, 0x62, 0xf0, 0x63, 0x43,
|
0x62, 0x49, 0x62, 0x9c, 0x62, 0xf0, 0x63, 0x43,
|
||||||
0x63, 0x97, 0x63, 0xeb, 0x64, 0x40, 0x64, 0x94,
|
0x63, 0x97, 0x63, 0xeb, 0x64, 0x40, 0x64, 0x94,
|
||||||
0x64, 0xe9, 0x65, 0x3d, 0x65, 0x92, 0x65, 0xe7,
|
0x64, 0xe9, 0x65, 0x3d, 0x65, 0x92, 0x65, 0xe7,
|
||||||
0x66, 0x3d, 0x66, 0x92, 0x66, 0xe8, 0x67, 0x3d,
|
0x66, 0x3d, 0x66, 0x92, 0x66, 0xe8, 0x67, 0x3d,
|
||||||
0x67, 0x93, 0x67, 0xe9, 0x68, 0x3f, 0x68, 0x96,
|
0x67, 0x93, 0x67, 0xe9, 0x68, 0x3f, 0x68, 0x96,
|
||||||
0x68, 0xec, 0x69, 0x43, 0x69, 0x9a, 0x69, 0xf1,
|
0x68, 0xec, 0x69, 0x43, 0x69, 0x9a, 0x69, 0xf1,
|
||||||
0x6a, 0x48, 0x6a, 0x9f, 0x6a, 0xf7, 0x6b, 0x4f,
|
0x6a, 0x48, 0x6a, 0x9f, 0x6a, 0xf7, 0x6b, 0x4f,
|
||||||
0x6b, 0xa7, 0x6b, 0xff, 0x6c, 0x57, 0x6c, 0xaf,
|
0x6b, 0xa7, 0x6b, 0xff, 0x6c, 0x57, 0x6c, 0xaf,
|
||||||
0x6d, 0x08, 0x6d, 0x60, 0x6d, 0xb9, 0x6e, 0x12,
|
0x6d, 0x08, 0x6d, 0x60, 0x6d, 0xb9, 0x6e, 0x12,
|
||||||
0x6e, 0x6b, 0x6e, 0xc4, 0x6f, 0x1e, 0x6f, 0x78,
|
0x6e, 0x6b, 0x6e, 0xc4, 0x6f, 0x1e, 0x6f, 0x78,
|
||||||
0x6f, 0xd1, 0x70, 0x2b, 0x70, 0x86, 0x70, 0xe0,
|
0x6f, 0xd1, 0x70, 0x2b, 0x70, 0x86, 0x70, 0xe0,
|
||||||
0x71, 0x3a, 0x71, 0x95, 0x71, 0xf0, 0x72, 0x4b,
|
0x71, 0x3a, 0x71, 0x95, 0x71, 0xf0, 0x72, 0x4b,
|
||||||
0x72, 0xa6, 0x73, 0x01, 0x73, 0x5d, 0x73, 0xb8,
|
0x72, 0xa6, 0x73, 0x01, 0x73, 0x5d, 0x73, 0xb8,
|
||||||
0x74, 0x14, 0x74, 0x70, 0x74, 0xcc, 0x75, 0x28,
|
0x74, 0x14, 0x74, 0x70, 0x74, 0xcc, 0x75, 0x28,
|
||||||
0x75, 0x85, 0x75, 0xe1, 0x76, 0x3e, 0x76, 0x9b,
|
0x75, 0x85, 0x75, 0xe1, 0x76, 0x3e, 0x76, 0x9b,
|
||||||
0x76, 0xf8, 0x77, 0x56, 0x77, 0xb3, 0x78, 0x11,
|
0x76, 0xf8, 0x77, 0x56, 0x77, 0xb3, 0x78, 0x11,
|
||||||
0x78, 0x6e, 0x78, 0xcc, 0x79, 0x2a, 0x79, 0x89,
|
0x78, 0x6e, 0x78, 0xcc, 0x79, 0x2a, 0x79, 0x89,
|
||||||
0x79, 0xe7, 0x7a, 0x46, 0x7a, 0xa5, 0x7b, 0x04,
|
0x79, 0xe7, 0x7a, 0x46, 0x7a, 0xa5, 0x7b, 0x04,
|
||||||
0x7b, 0x63, 0x7b, 0xc2, 0x7c, 0x21, 0x7c, 0x81,
|
0x7b, 0x63, 0x7b, 0xc2, 0x7c, 0x21, 0x7c, 0x81,
|
||||||
0x7c, 0xe1, 0x7d, 0x41, 0x7d, 0xa1, 0x7e, 0x01,
|
0x7c, 0xe1, 0x7d, 0x41, 0x7d, 0xa1, 0x7e, 0x01,
|
||||||
0x7e, 0x62, 0x7e, 0xc2, 0x7f, 0x23, 0x7f, 0x84,
|
0x7e, 0x62, 0x7e, 0xc2, 0x7f, 0x23, 0x7f, 0x84,
|
||||||
0x7f, 0xe5, 0x80, 0x47, 0x80, 0xa8, 0x81, 0x0a,
|
0x7f, 0xe5, 0x80, 0x47, 0x80, 0xa8, 0x81, 0x0a,
|
||||||
0x81, 0x6b, 0x81, 0xcd, 0x82, 0x30, 0x82, 0x92,
|
0x81, 0x6b, 0x81, 0xcd, 0x82, 0x30, 0x82, 0x92,
|
||||||
0x82, 0xf4, 0x83, 0x57, 0x83, 0xba, 0x84, 0x1d,
|
0x82, 0xf4, 0x83, 0x57, 0x83, 0xba, 0x84, 0x1d,
|
||||||
0x84, 0x80, 0x84, 0xe3, 0x85, 0x47, 0x85, 0xab,
|
0x84, 0x80, 0x84, 0xe3, 0x85, 0x47, 0x85, 0xab,
|
||||||
0x86, 0x0e, 0x86, 0x72, 0x86, 0xd7, 0x87, 0x3b,
|
0x86, 0x0e, 0x86, 0x72, 0x86, 0xd7, 0x87, 0x3b,
|
||||||
0x87, 0x9f, 0x88, 0x04, 0x88, 0x69, 0x88, 0xce,
|
0x87, 0x9f, 0x88, 0x04, 0x88, 0x69, 0x88, 0xce,
|
||||||
0x89, 0x33, 0x89, 0x99, 0x89, 0xfe, 0x8a, 0x64,
|
0x89, 0x33, 0x89, 0x99, 0x89, 0xfe, 0x8a, 0x64,
|
||||||
0x8a, 0xca, 0x8b, 0x30, 0x8b, 0x96, 0x8b, 0xfc,
|
0x8a, 0xca, 0x8b, 0x30, 0x8b, 0x96, 0x8b, 0xfc,
|
||||||
0x8c, 0x63, 0x8c, 0xca, 0x8d, 0x31, 0x8d, 0x98,
|
0x8c, 0x63, 0x8c, 0xca, 0x8d, 0x31, 0x8d, 0x98,
|
||||||
0x8d, 0xff, 0x8e, 0x66, 0x8e, 0xce, 0x8f, 0x36,
|
0x8d, 0xff, 0x8e, 0x66, 0x8e, 0xce, 0x8f, 0x36,
|
||||||
0x8f, 0x9e, 0x90, 0x06, 0x90, 0x6e, 0x90, 0xd6,
|
0x8f, 0x9e, 0x90, 0x06, 0x90, 0x6e, 0x90, 0xd6,
|
||||||
0x91, 0x3f, 0x91, 0xa8, 0x92, 0x11, 0x92, 0x7a,
|
0x91, 0x3f, 0x91, 0xa8, 0x92, 0x11, 0x92, 0x7a,
|
||||||
0x92, 0xe3, 0x93, 0x4d, 0x93, 0xb6, 0x94, 0x20,
|
0x92, 0xe3, 0x93, 0x4d, 0x93, 0xb6, 0x94, 0x20,
|
||||||
0x94, 0x8a, 0x94, 0xf4, 0x95, 0x5f, 0x95, 0xc9,
|
0x94, 0x8a, 0x94, 0xf4, 0x95, 0x5f, 0x95, 0xc9,
|
||||||
0x96, 0x34, 0x96, 0x9f, 0x97, 0x0a, 0x97, 0x75,
|
0x96, 0x34, 0x96, 0x9f, 0x97, 0x0a, 0x97, 0x75,
|
||||||
0x97, 0xe0, 0x98, 0x4c, 0x98, 0xb8, 0x99, 0x24,
|
0x97, 0xe0, 0x98, 0x4c, 0x98, 0xb8, 0x99, 0x24,
|
||||||
0x99, 0x90, 0x99, 0xfc, 0x9a, 0x68, 0x9a, 0xd5,
|
0x99, 0x90, 0x99, 0xfc, 0x9a, 0x68, 0x9a, 0xd5,
|
||||||
0x9b, 0x42, 0x9b, 0xaf, 0x9c, 0x1c, 0x9c, 0x89,
|
0x9b, 0x42, 0x9b, 0xaf, 0x9c, 0x1c, 0x9c, 0x89,
|
||||||
0x9c, 0xf7, 0x9d, 0x64, 0x9d, 0xd2, 0x9e, 0x40,
|
0x9c, 0xf7, 0x9d, 0x64, 0x9d, 0xd2, 0x9e, 0x40,
|
||||||
0x9e, 0xae, 0x9f, 0x1d, 0x9f, 0x8b, 0x9f, 0xfa,
|
0x9e, 0xae, 0x9f, 0x1d, 0x9f, 0x8b, 0x9f, 0xfa,
|
||||||
0xa0, 0x69, 0xa0, 0xd8, 0xa1, 0x47, 0xa1, 0xb6,
|
0xa0, 0x69, 0xa0, 0xd8, 0xa1, 0x47, 0xa1, 0xb6,
|
||||||
0xa2, 0x26, 0xa2, 0x96, 0xa3, 0x06, 0xa3, 0x76,
|
0xa2, 0x26, 0xa2, 0x96, 0xa3, 0x06, 0xa3, 0x76,
|
||||||
0xa3, 0xe6, 0xa4, 0x56, 0xa4, 0xc7, 0xa5, 0x38,
|
0xa3, 0xe6, 0xa4, 0x56, 0xa4, 0xc7, 0xa5, 0x38,
|
||||||
0xa5, 0xa9, 0xa6, 0x1a, 0xa6, 0x8b, 0xa6, 0xfd,
|
0xa5, 0xa9, 0xa6, 0x1a, 0xa6, 0x8b, 0xa6, 0xfd,
|
||||||
0xa7, 0x6e, 0xa7, 0xe0, 0xa8, 0x52, 0xa8, 0xc4,
|
0xa7, 0x6e, 0xa7, 0xe0, 0xa8, 0x52, 0xa8, 0xc4,
|
||||||
0xa9, 0x37, 0xa9, 0xa9, 0xaa, 0x1c, 0xaa, 0x8f,
|
0xa9, 0x37, 0xa9, 0xa9, 0xaa, 0x1c, 0xaa, 0x8f,
|
||||||
0xab, 0x02, 0xab, 0x75, 0xab, 0xe9, 0xac, 0x5c,
|
0xab, 0x02, 0xab, 0x75, 0xab, 0xe9, 0xac, 0x5c,
|
||||||
0xac, 0xd0, 0xad, 0x44, 0xad, 0xb8, 0xae, 0x2d,
|
0xac, 0xd0, 0xad, 0x44, 0xad, 0xb8, 0xae, 0x2d,
|
||||||
0xae, 0xa1, 0xaf, 0x16, 0xaf, 0x8b, 0xb0, 0x00,
|
0xae, 0xa1, 0xaf, 0x16, 0xaf, 0x8b, 0xb0, 0x00,
|
||||||
0xb0, 0x75, 0xb0, 0xea, 0xb1, 0x60, 0xb1, 0xd6,
|
0xb0, 0x75, 0xb0, 0xea, 0xb1, 0x60, 0xb1, 0xd6,
|
||||||
0xb2, 0x4b, 0xb2, 0xc2, 0xb3, 0x38, 0xb3, 0xae,
|
0xb2, 0x4b, 0xb2, 0xc2, 0xb3, 0x38, 0xb3, 0xae,
|
||||||
0xb4, 0x25, 0xb4, 0x9c, 0xb5, 0x13, 0xb5, 0x8a,
|
0xb4, 0x25, 0xb4, 0x9c, 0xb5, 0x13, 0xb5, 0x8a,
|
||||||
0xb6, 0x01, 0xb6, 0x79, 0xb6, 0xf0, 0xb7, 0x68,
|
0xb6, 0x01, 0xb6, 0x79, 0xb6, 0xf0, 0xb7, 0x68,
|
||||||
0xb7, 0xe0, 0xb8, 0x59, 0xb8, 0xd1, 0xb9, 0x4a,
|
0xb7, 0xe0, 0xb8, 0x59, 0xb8, 0xd1, 0xb9, 0x4a,
|
||||||
0xb9, 0xc2, 0xba, 0x3b, 0xba, 0xb5, 0xbb, 0x2e,
|
0xb9, 0xc2, 0xba, 0x3b, 0xba, 0xb5, 0xbb, 0x2e,
|
||||||
0xbb, 0xa7, 0xbc, 0x21, 0xbc, 0x9b, 0xbd, 0x15,
|
0xbb, 0xa7, 0xbc, 0x21, 0xbc, 0x9b, 0xbd, 0x15,
|
||||||
0xbd, 0x8f, 0xbe, 0x0a, 0xbe, 0x84, 0xbe, 0xff,
|
0xbd, 0x8f, 0xbe, 0x0a, 0xbe, 0x84, 0xbe, 0xff,
|
||||||
0xbf, 0x7a, 0xbf, 0xf5, 0xc0, 0x70, 0xc0, 0xec,
|
0xbf, 0x7a, 0xbf, 0xf5, 0xc0, 0x70, 0xc0, 0xec,
|
||||||
0xc1, 0x67, 0xc1, 0xe3, 0xc2, 0x5f, 0xc2, 0xdb,
|
0xc1, 0x67, 0xc1, 0xe3, 0xc2, 0x5f, 0xc2, 0xdb,
|
||||||
0xc3, 0x58, 0xc3, 0xd4, 0xc4, 0x51, 0xc4, 0xce,
|
0xc3, 0x58, 0xc3, 0xd4, 0xc4, 0x51, 0xc4, 0xce,
|
||||||
0xc5, 0x4b, 0xc5, 0xc8, 0xc6, 0x46, 0xc6, 0xc3,
|
0xc5, 0x4b, 0xc5, 0xc8, 0xc6, 0x46, 0xc6, 0xc3,
|
||||||
0xc7, 0x41, 0xc7, 0xbf, 0xc8, 0x3d, 0xc8, 0xbc,
|
0xc7, 0x41, 0xc7, 0xbf, 0xc8, 0x3d, 0xc8, 0xbc,
|
||||||
0xc9, 0x3a, 0xc9, 0xb9, 0xca, 0x38, 0xca, 0xb7,
|
0xc9, 0x3a, 0xc9, 0xb9, 0xca, 0x38, 0xca, 0xb7,
|
||||||
0xcb, 0x36, 0xcb, 0xb6, 0xcc, 0x35, 0xcc, 0xb5,
|
0xcb, 0x36, 0xcb, 0xb6, 0xcc, 0x35, 0xcc, 0xb5,
|
||||||
0xcd, 0x35, 0xcd, 0xb5, 0xce, 0x36, 0xce, 0xb6,
|
0xcd, 0x35, 0xcd, 0xb5, 0xce, 0x36, 0xce, 0xb6,
|
||||||
0xcf, 0x37, 0xcf, 0xb8, 0xd0, 0x39, 0xd0, 0xba,
|
0xcf, 0x37, 0xcf, 0xb8, 0xd0, 0x39, 0xd0, 0xba,
|
||||||
0xd1, 0x3c, 0xd1, 0xbe, 0xd2, 0x3f, 0xd2, 0xc1,
|
0xd1, 0x3c, 0xd1, 0xbe, 0xd2, 0x3f, 0xd2, 0xc1,
|
||||||
0xd3, 0x44, 0xd3, 0xc6, 0xd4, 0x49, 0xd4, 0xcb,
|
0xd3, 0x44, 0xd3, 0xc6, 0xd4, 0x49, 0xd4, 0xcb,
|
||||||
0xd5, 0x4e, 0xd5, 0xd1, 0xd6, 0x55, 0xd6, 0xd8,
|
0xd5, 0x4e, 0xd5, 0xd1, 0xd6, 0x55, 0xd6, 0xd8,
|
||||||
0xd7, 0x5c, 0xd7, 0xe0, 0xd8, 0x64, 0xd8, 0xe8,
|
0xd7, 0x5c, 0xd7, 0xe0, 0xd8, 0x64, 0xd8, 0xe8,
|
||||||
0xd9, 0x6c, 0xd9, 0xf1, 0xda, 0x76, 0xda, 0xfb,
|
0xd9, 0x6c, 0xd9, 0xf1, 0xda, 0x76, 0xda, 0xfb,
|
||||||
0xdb, 0x80, 0xdc, 0x05, 0xdc, 0x8a, 0xdd, 0x10,
|
0xdb, 0x80, 0xdc, 0x05, 0xdc, 0x8a, 0xdd, 0x10,
|
||||||
0xdd, 0x96, 0xde, 0x1c, 0xde, 0xa2, 0xdf, 0x29,
|
0xdd, 0x96, 0xde, 0x1c, 0xde, 0xa2, 0xdf, 0x29,
|
||||||
0xdf, 0xaf, 0xe0, 0x36, 0xe0, 0xbd, 0xe1, 0x44,
|
0xdf, 0xaf, 0xe0, 0x36, 0xe0, 0xbd, 0xe1, 0x44,
|
||||||
0xe1, 0xcc, 0xe2, 0x53, 0xe2, 0xdb, 0xe3, 0x63,
|
0xe1, 0xcc, 0xe2, 0x53, 0xe2, 0xdb, 0xe3, 0x63,
|
||||||
0xe3, 0xeb, 0xe4, 0x73, 0xe4, 0xfc, 0xe5, 0x84,
|
0xe3, 0xeb, 0xe4, 0x73, 0xe4, 0xfc, 0xe5, 0x84,
|
||||||
0xe6, 0x0d, 0xe6, 0x96, 0xe7, 0x1f, 0xe7, 0xa9,
|
0xe6, 0x0d, 0xe6, 0x96, 0xe7, 0x1f, 0xe7, 0xa9,
|
||||||
0xe8, 0x32, 0xe8, 0xbc, 0xe9, 0x46, 0xe9, 0xd0,
|
0xe8, 0x32, 0xe8, 0xbc, 0xe9, 0x46, 0xe9, 0xd0,
|
||||||
0xea, 0x5b, 0xea, 0xe5, 0xeb, 0x70, 0xeb, 0xfb,
|
0xea, 0x5b, 0xea, 0xe5, 0xeb, 0x70, 0xeb, 0xfb,
|
||||||
0xec, 0x86, 0xed, 0x11, 0xed, 0x9c, 0xee, 0x28,
|
0xec, 0x86, 0xed, 0x11, 0xed, 0x9c, 0xee, 0x28,
|
||||||
0xee, 0xb4, 0xef, 0x40, 0xef, 0xcc, 0xf0, 0x58,
|
0xee, 0xb4, 0xef, 0x40, 0xef, 0xcc, 0xf0, 0x58,
|
||||||
0xf0, 0xe5, 0xf1, 0x72, 0xf1, 0xff, 0xf2, 0x8c,
|
0xf0, 0xe5, 0xf1, 0x72, 0xf1, 0xff, 0xf2, 0x8c,
|
||||||
0xf3, 0x19, 0xf3, 0xa7, 0xf4, 0x34, 0xf4, 0xc2,
|
0xf3, 0x19, 0xf3, 0xa7, 0xf4, 0x34, 0xf4, 0xc2,
|
||||||
0xf5, 0x50, 0xf5, 0xde, 0xf6, 0x6d, 0xf6, 0xfb,
|
0xf5, 0x50, 0xf5, 0xde, 0xf6, 0x6d, 0xf6, 0xfb,
|
||||||
0xf7, 0x8a, 0xf8, 0x19, 0xf8, 0xa8, 0xf9, 0x38,
|
0xf7, 0x8a, 0xf8, 0x19, 0xf8, 0xa8, 0xf9, 0x38,
|
||||||
0xf9, 0xc7, 0xfa, 0x57, 0xfa, 0xe7, 0xfb, 0x77,
|
0xf9, 0xc7, 0xfa, 0x57, 0xfa, 0xe7, 0xfb, 0x77,
|
||||||
0xfc, 0x07, 0xfc, 0x98, 0xfd, 0x29, 0xfd, 0xba,
|
0xfc, 0x07, 0xfc, 0x98, 0xfd, 0x29, 0xfd, 0xba,
|
||||||
0xfe, 0x4b, 0xfe, 0xdc, 0xff, 0x6d, 0xff, 0xff
|
0xfe, 0x4b, 0xfe, 0xdc, 0xff, 0x6d, 0xff, 0xff
|
||||||
};
|
};
|
||||||
|
|
||||||
int jas_iccprofdata_srgblen = sizeof(jas_iccprofdata_srgb);
|
int jas_iccprofdata_srgblen = sizeof(jas_iccprofdata_srgb);
|
||||||
|
|
||||||
uchar jas_iccprofdata_sgray[] = {
|
uchar jas_iccprofdata_sgray[] = {
|
||||||
0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x02, 0x20, 0x00, 0x00, 0x73, 0x63, 0x6e, 0x72,
|
0x02, 0x20, 0x00, 0x00, 0x73, 0x63, 0x6e, 0x72,
|
||||||
0x47, 0x52, 0x41, 0x59, 0x58, 0x59, 0x5a, 0x20,
|
0x47, 0x52, 0x41, 0x59, 0x58, 0x59, 0x5a, 0x20,
|
||||||
0x07, 0xd3, 0x00, 0x01, 0x00, 0x1f, 0x00, 0x0d,
|
0x07, 0xd3, 0x00, 0x01, 0x00, 0x1f, 0x00, 0x0d,
|
||||||
0x00, 0x35, 0x00, 0x21, 0x61, 0x63, 0x73, 0x70,
|
0x00, 0x35, 0x00, 0x21, 0x61, 0x63, 0x73, 0x70,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||||
0x4b, 0x4f, 0x44, 0x41, 0x73, 0x47, 0x72, 0x79,
|
0x4b, 0x4f, 0x44, 0x41, 0x73, 0x47, 0x72, 0x79,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6,
|
||||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d,
|
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d,
|
||||||
0x4a, 0x50, 0x45, 0x47, 0x00, 0x00, 0x00, 0x00,
|
0x4a, 0x50, 0x45, 0x47, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x04, 0x64, 0x65, 0x73, 0x63,
|
0x00, 0x00, 0x00, 0x04, 0x64, 0x65, 0x73, 0x63,
|
||||||
0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x86,
|
0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x86,
|
||||||
0x63, 0x70, 0x72, 0x74, 0x00, 0x00, 0x01, 0x3c,
|
0x63, 0x70, 0x72, 0x74, 0x00, 0x00, 0x01, 0x3c,
|
||||||
0x00, 0x00, 0x00, 0x2b, 0x77, 0x74, 0x70, 0x74,
|
0x00, 0x00, 0x00, 0x2b, 0x77, 0x74, 0x70, 0x74,
|
||||||
0x00, 0x00, 0x01, 0x68, 0x00, 0x00, 0x00, 0x14,
|
0x00, 0x00, 0x01, 0x68, 0x00, 0x00, 0x00, 0x14,
|
||||||
0x6b, 0x54, 0x52, 0x43, 0x00, 0x00, 0x01, 0x7c,
|
0x6b, 0x54, 0x52, 0x43, 0x00, 0x00, 0x01, 0x7c,
|
||||||
0x00, 0x00, 0x00, 0x0e, 0x64, 0x65, 0x73, 0x63,
|
0x00, 0x00, 0x00, 0x0e, 0x64, 0x65, 0x73, 0x63,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c,
|
||||||
0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74,
|
0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74,
|
||||||
0x65, 0x64, 0x20, 0x49, 0x43, 0x43, 0x20, 0x70,
|
0x65, 0x64, 0x20, 0x49, 0x43, 0x43, 0x20, 0x70,
|
||||||
0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x64,
|
0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x64,
|
||||||
0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x69, 0x6e,
|
0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x69, 0x6e,
|
||||||
0x67, 0x20, 0x73, 0x52, 0x47, 0x42, 0x2d, 0x67,
|
0x67, 0x20, 0x73, 0x52, 0x47, 0x42, 0x2d, 0x67,
|
||||||
0x72, 0x65, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x72, 0x65, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x74,
|
0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x74,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70, 0x79,
|
0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70, 0x79,
|
||||||
0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30,
|
0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30,
|
||||||
0x30, 0x33, 0x20, 0x73, 0x52, 0x47, 0x42, 0x2d,
|
0x30, 0x33, 0x20, 0x73, 0x52, 0x47, 0x42, 0x2d,
|
||||||
0x67, 0x72, 0x65, 0x79, 0x20, 0x52, 0x65, 0x66,
|
0x67, 0x72, 0x65, 0x79, 0x20, 0x52, 0x65, 0x66,
|
||||||
0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x00, 0x00,
|
0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x00, 0x00,
|
||||||
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xf3, 0x54, 0x00, 0x01, 0x00, 0x00,
|
0x00, 0x00, 0xf3, 0x54, 0x00, 0x01, 0x00, 0x00,
|
||||||
0x00, 0x01, 0x16, 0xcf, 0x63, 0x75, 0x72, 0x76,
|
0x00, 0x01, 0x16, 0xcf, 0x63, 0x75, 0x72, 0x76,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||||
0x01, 0xcd
|
0x01, 0xcd
|
||||||
};
|
};
|
||||||
|
|
||||||
int jas_iccprofdata_sgraylen = sizeof(jas_iccprofdata_sgray);
|
int jas_iccprofdata_sgraylen = sizeof(jas_iccprofdata_sgray);
|
||||||
|
1964
3rdparty/libjasper/jas_image.c
vendored
1964
3rdparty/libjasper/jas_image.c
vendored
File diff suppressed because it is too large
Load Diff
114
3rdparty/libjasper/jas_init.c
vendored
114
3rdparty/libjasper/jas_init.c
vendored
@ -74,89 +74,89 @@
|
|||||||
/* Initialize the image format table. */
|
/* Initialize the image format table. */
|
||||||
int jas_init()
|
int jas_init()
|
||||||
{
|
{
|
||||||
jas_image_fmtops_t fmtops;
|
jas_image_fmtops_t fmtops;
|
||||||
int fmtid;
|
int fmtid;
|
||||||
|
|
||||||
fmtid = 0;
|
fmtid = 0;
|
||||||
|
|
||||||
#if !defined(EXCLUDE_MIF_SUPPORT)
|
#if !defined(EXCLUDE_MIF_SUPPORT)
|
||||||
fmtops.decode = mif_decode;
|
fmtops.decode = mif_decode;
|
||||||
fmtops.encode = mif_encode;
|
fmtops.encode = mif_encode;
|
||||||
fmtops.validate = mif_validate;
|
fmtops.validate = mif_validate;
|
||||||
jas_image_addfmt(fmtid, "mif", "mif", "My Image Format (MIF)", &fmtops);
|
jas_image_addfmt(fmtid, "mif", "mif", "My Image Format (MIF)", &fmtops);
|
||||||
++fmtid;
|
++fmtid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(EXCLUDE_PNM_SUPPORT)
|
#if !defined(EXCLUDE_PNM_SUPPORT)
|
||||||
fmtops.decode = pnm_decode;
|
fmtops.decode = pnm_decode;
|
||||||
fmtops.encode = pnm_encode;
|
fmtops.encode = pnm_encode;
|
||||||
fmtops.validate = pnm_validate;
|
fmtops.validate = pnm_validate;
|
||||||
jas_image_addfmt(fmtid, "pnm", "pnm", "Portable Graymap/Pixmap (PNM)",
|
jas_image_addfmt(fmtid, "pnm", "pnm", "Portable Graymap/Pixmap (PNM)",
|
||||||
&fmtops);
|
&fmtops);
|
||||||
jas_image_addfmt(fmtid, "pnm", "pgm", "Portable Graymap/Pixmap (PNM)",
|
jas_image_addfmt(fmtid, "pnm", "pgm", "Portable Graymap/Pixmap (PNM)",
|
||||||
&fmtops);
|
&fmtops);
|
||||||
jas_image_addfmt(fmtid, "pnm", "ppm", "Portable Graymap/Pixmap (PNM)",
|
jas_image_addfmt(fmtid, "pnm", "ppm", "Portable Graymap/Pixmap (PNM)",
|
||||||
&fmtops);
|
&fmtops);
|
||||||
++fmtid;
|
++fmtid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(EXCLUDE_BMP_SUPPORT)
|
#if !defined(EXCLUDE_BMP_SUPPORT)
|
||||||
fmtops.decode = bmp_decode;
|
fmtops.decode = bmp_decode;
|
||||||
fmtops.encode = bmp_encode;
|
fmtops.encode = bmp_encode;
|
||||||
fmtops.validate = bmp_validate;
|
fmtops.validate = bmp_validate;
|
||||||
jas_image_addfmt(fmtid, "bmp", "bmp", "Microsoft Bitmap (BMP)", &fmtops);
|
jas_image_addfmt(fmtid, "bmp", "bmp", "Microsoft Bitmap (BMP)", &fmtops);
|
||||||
++fmtid;
|
++fmtid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(EXCLUDE_RAS_SUPPORT)
|
#if !defined(EXCLUDE_RAS_SUPPORT)
|
||||||
fmtops.decode = ras_decode;
|
fmtops.decode = ras_decode;
|
||||||
fmtops.encode = ras_encode;
|
fmtops.encode = ras_encode;
|
||||||
fmtops.validate = ras_validate;
|
fmtops.validate = ras_validate;
|
||||||
jas_image_addfmt(fmtid, "ras", "ras", "Sun Rasterfile (RAS)", &fmtops);
|
jas_image_addfmt(fmtid, "ras", "ras", "Sun Rasterfile (RAS)", &fmtops);
|
||||||
++fmtid;
|
++fmtid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(EXCLUDE_JP2_SUPPORT)
|
#if !defined(EXCLUDE_JP2_SUPPORT)
|
||||||
fmtops.decode = jp2_decode;
|
fmtops.decode = jp2_decode;
|
||||||
fmtops.encode = jp2_encode;
|
fmtops.encode = jp2_encode;
|
||||||
fmtops.validate = jp2_validate;
|
fmtops.validate = jp2_validate;
|
||||||
jas_image_addfmt(fmtid, "jp2", "jp2",
|
jas_image_addfmt(fmtid, "jp2", "jp2",
|
||||||
"JPEG-2000 JP2 File Format Syntax (ISO/IEC 15444-1)", &fmtops);
|
"JPEG-2000 JP2 File Format Syntax (ISO/IEC 15444-1)", &fmtops);
|
||||||
++fmtid;
|
++fmtid;
|
||||||
fmtops.decode = jpc_decode;
|
fmtops.decode = jpc_decode;
|
||||||
fmtops.encode = jpc_encode;
|
fmtops.encode = jpc_encode;
|
||||||
fmtops.validate = jpc_validate;
|
fmtops.validate = jpc_validate;
|
||||||
jas_image_addfmt(fmtid, "jpc", "jpc",
|
jas_image_addfmt(fmtid, "jpc", "jpc",
|
||||||
"JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1)", &fmtops);
|
"JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1)", &fmtops);
|
||||||
++fmtid;
|
++fmtid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(EXCLUDE_JPG_SUPPORT)
|
#if !defined(EXCLUDE_JPG_SUPPORT)
|
||||||
fmtops.decode = jpg_decode;
|
fmtops.decode = jpg_decode;
|
||||||
fmtops.encode = jpg_encode;
|
fmtops.encode = jpg_encode;
|
||||||
fmtops.validate = jpg_validate;
|
fmtops.validate = jpg_validate;
|
||||||
jas_image_addfmt(fmtid, "jpg", "jpg", "JPEG (ISO/IEC 10918-1)", &fmtops);
|
jas_image_addfmt(fmtid, "jpg", "jpg", "JPEG (ISO/IEC 10918-1)", &fmtops);
|
||||||
++fmtid;
|
++fmtid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(EXCLUDE_PGX_SUPPORT)
|
#if !defined(EXCLUDE_PGX_SUPPORT)
|
||||||
fmtops.decode = pgx_decode;
|
fmtops.decode = pgx_decode;
|
||||||
fmtops.encode = pgx_encode;
|
fmtops.encode = pgx_encode;
|
||||||
fmtops.validate = pgx_validate;
|
fmtops.validate = pgx_validate;
|
||||||
jas_image_addfmt(fmtid, "pgx", "pgx", "JPEG-2000 VM Format (PGX)", &fmtops);
|
jas_image_addfmt(fmtid, "pgx", "pgx", "JPEG-2000 VM Format (PGX)", &fmtops);
|
||||||
++fmtid;
|
++fmtid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We must not register the JasPer library exit handler until after
|
/* We must not register the JasPer library exit handler until after
|
||||||
at least one memory allocation is performed. This is desirable
|
at least one memory allocation is performed. This is desirable
|
||||||
as it ensures that the JasPer exit handler is called before the
|
as it ensures that the JasPer exit handler is called before the
|
||||||
debug memory allocator exit handler. */
|
debug memory allocator exit handler. */
|
||||||
atexit(jas_cleanup);
|
atexit(jas_cleanup);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_cleanup()
|
void jas_cleanup()
|
||||||
{
|
{
|
||||||
jas_image_clearfmts();
|
jas_image_clearfmts();
|
||||||
}
|
}
|
||||||
|
62
3rdparty/libjasper/jas_malloc.c
vendored
62
3rdparty/libjasper/jas_malloc.c
vendored
@ -101,68 +101,68 @@
|
|||||||
void *jas_malloc(size_t size)
|
void *jas_malloc(size_t size)
|
||||||
{
|
{
|
||||||
#if defined(MEMALLOC_ALIGN2)
|
#if defined(MEMALLOC_ALIGN2)
|
||||||
void *ptr;
|
void *ptr;
|
||||||
abort();
|
abort();
|
||||||
if (posix_memalign(&ptr, MEMALLOC_ALIGNMENT, size)) {
|
if (posix_memalign(&ptr, MEMALLOC_ALIGNMENT, size)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return ptr;
|
return ptr;
|
||||||
#endif
|
#endif
|
||||||
return malloc(size);
|
return malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_free(void *ptr)
|
void jas_free(void *ptr)
|
||||||
{
|
{
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *jas_realloc(void *ptr, size_t size)
|
void *jas_realloc(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
return ptr ? realloc(ptr, size) : malloc(size);
|
return ptr ? realloc(ptr, size) : malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *jas_realloc2(void *ptr, size_t nmemb, size_t size)
|
void *jas_realloc2(void *ptr, size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
return jas_alloc2(nmemb, size);
|
return jas_alloc2(nmemb, size);
|
||||||
if (nmemb && SIZE_MAX / nmemb < size) {
|
if (nmemb && SIZE_MAX / nmemb < size) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return jas_realloc(ptr, nmemb * size);
|
return jas_realloc(ptr, nmemb * size);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *jas_alloc2(size_t nmemb, size_t size)
|
void *jas_alloc2(size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
if (nmemb && SIZE_MAX / nmemb < size) {
|
if (nmemb && SIZE_MAX / nmemb < size) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return jas_malloc(nmemb * size);
|
return jas_malloc(nmemb * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *jas_alloc3(size_t a, size_t b, size_t c)
|
void *jas_alloc3(size_t a, size_t b, size_t c)
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
if (a && SIZE_MAX / a < b) {
|
if (a && SIZE_MAX / a < b) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return jas_alloc2(a*b, c);
|
return jas_alloc2(a*b, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *jas_calloc(size_t nmemb, size_t size)
|
void *jas_calloc(size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
ptr = jas_alloc2(nmemb, size);
|
ptr = jas_alloc2(nmemb, size);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
memset(ptr, 0, nmemb*size);
|
memset(ptr, 0, nmemb*size);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
530
3rdparty/libjasper/jas_seq.c
vendored
530
3rdparty/libjasper/jas_seq.c
vendored
@ -85,108 +85,108 @@
|
|||||||
|
|
||||||
jas_matrix_t *jas_seq2d_create(int xstart, int ystart, int xend, int yend)
|
jas_matrix_t *jas_seq2d_create(int xstart, int ystart, int xend, int yend)
|
||||||
{
|
{
|
||||||
jas_matrix_t *matrix;
|
jas_matrix_t *matrix;
|
||||||
assert(xstart <= xend && ystart <= yend);
|
assert(xstart <= xend && ystart <= yend);
|
||||||
if (!(matrix = jas_matrix_create(yend - ystart, xend - xstart))) {
|
if (!(matrix = jas_matrix_create(yend - ystart, xend - xstart))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
matrix->xstart_ = xstart;
|
matrix->xstart_ = xstart;
|
||||||
matrix->ystart_ = ystart;
|
matrix->ystart_ = ystart;
|
||||||
matrix->xend_ = xend;
|
matrix->xend_ = xend;
|
||||||
matrix->yend_ = yend;
|
matrix->yend_ = yend;
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
jas_matrix_t *jas_matrix_create(int numrows, int numcols)
|
jas_matrix_t *jas_matrix_create(int numrows, int numcols)
|
||||||
{
|
{
|
||||||
jas_matrix_t *matrix;
|
jas_matrix_t *matrix;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!(matrix = jas_malloc(sizeof(jas_matrix_t)))) {
|
if (!(matrix = jas_malloc(sizeof(jas_matrix_t)))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
matrix->flags_ = 0;
|
matrix->flags_ = 0;
|
||||||
matrix->numrows_ = numrows;
|
matrix->numrows_ = numrows;
|
||||||
matrix->numcols_ = numcols;
|
matrix->numcols_ = numcols;
|
||||||
matrix->rows_ = 0;
|
matrix->rows_ = 0;
|
||||||
matrix->maxrows_ = numrows;
|
matrix->maxrows_ = numrows;
|
||||||
matrix->data_ = 0;
|
matrix->data_ = 0;
|
||||||
matrix->datasize_ = numrows * numcols;
|
matrix->datasize_ = numrows * numcols;
|
||||||
|
|
||||||
if (matrix->maxrows_ > 0) {
|
if (matrix->maxrows_ > 0) {
|
||||||
if (!(matrix->rows_ = jas_alloc2(matrix->maxrows_,
|
if (!(matrix->rows_ = jas_alloc2(matrix->maxrows_,
|
||||||
sizeof(jas_seqent_t *)))) {
|
sizeof(jas_seqent_t *)))) {
|
||||||
jas_matrix_destroy(matrix);
|
jas_matrix_destroy(matrix);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matrix->datasize_ > 0) {
|
if (matrix->datasize_ > 0) {
|
||||||
if (!(matrix->data_ = jas_alloc2(matrix->datasize_,
|
if (!(matrix->data_ = jas_alloc2(matrix->datasize_,
|
||||||
sizeof(jas_seqent_t)))) {
|
sizeof(jas_seqent_t)))) {
|
||||||
jas_matrix_destroy(matrix);
|
jas_matrix_destroy(matrix);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numrows; ++i) {
|
for (i = 0; i < numrows; ++i) {
|
||||||
matrix->rows_[i] = &matrix->data_[i * matrix->numcols_];
|
matrix->rows_[i] = &matrix->data_[i * matrix->numcols_];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < matrix->datasize_; ++i) {
|
for (i = 0; i < matrix->datasize_; ++i) {
|
||||||
matrix->data_[i] = 0;
|
matrix->data_[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix->xstart_ = 0;
|
matrix->xstart_ = 0;
|
||||||
matrix->ystart_ = 0;
|
matrix->ystart_ = 0;
|
||||||
matrix->xend_ = matrix->numcols_;
|
matrix->xend_ = matrix->numcols_;
|
||||||
matrix->yend_ = matrix->numrows_;
|
matrix->yend_ = matrix->numrows_;
|
||||||
|
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_matrix_destroy(jas_matrix_t *matrix)
|
void jas_matrix_destroy(jas_matrix_t *matrix)
|
||||||
{
|
{
|
||||||
if (matrix->data_) {
|
if (matrix->data_) {
|
||||||
assert(!(matrix->flags_ & JAS_MATRIX_REF));
|
assert(!(matrix->flags_ & JAS_MATRIX_REF));
|
||||||
jas_free(matrix->data_);
|
jas_free(matrix->data_);
|
||||||
matrix->data_ = 0;
|
matrix->data_ = 0;
|
||||||
}
|
}
|
||||||
if (matrix->rows_) {
|
if (matrix->rows_) {
|
||||||
jas_free(matrix->rows_);
|
jas_free(matrix->rows_);
|
||||||
matrix->rows_ = 0;
|
matrix->rows_ = 0;
|
||||||
}
|
}
|
||||||
jas_free(matrix);
|
jas_free(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x)
|
jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x)
|
||||||
{
|
{
|
||||||
jas_matrix_t *y;
|
jas_matrix_t *y;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
y = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x),
|
y = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x),
|
||||||
jas_seq2d_yend(x));
|
jas_seq2d_yend(x));
|
||||||
assert(y);
|
assert(y);
|
||||||
for (i = 0; i < x->numrows_; ++i) {
|
for (i = 0; i < x->numrows_; ++i) {
|
||||||
for (j = 0; j < x->numcols_; ++j) {
|
for (j = 0; j < x->numcols_; ++j) {
|
||||||
*jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
|
*jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
jas_matrix_t *jas_matrix_copy(jas_matrix_t *x)
|
jas_matrix_t *jas_matrix_copy(jas_matrix_t *x)
|
||||||
{
|
{
|
||||||
jas_matrix_t *y;
|
jas_matrix_t *y;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
y = jas_matrix_create(x->numrows_, x->numcols_);
|
y = jas_matrix_create(x->numrows_, x->numcols_);
|
||||||
for (i = 0; i < x->numrows_; ++i) {
|
for (i = 0; i < x->numrows_; ++i) {
|
||||||
for (j = 0; j < x->numcols_; ++j) {
|
for (j = 0; j < x->numcols_; ++j) {
|
||||||
*jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
|
*jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -196,39 +196,39 @@ jas_matrix_t *jas_matrix_copy(jas_matrix_t *x)
|
|||||||
void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart, int ystart,
|
void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart, int ystart,
|
||||||
int xend, int yend)
|
int xend, int yend)
|
||||||
{
|
{
|
||||||
jas_matrix_bindsub(s, s1, ystart - s1->ystart_, xstart - s1->xstart_,
|
jas_matrix_bindsub(s, s1, ystart - s1->ystart_, xstart - s1->xstart_,
|
||||||
yend - s1->ystart_ - 1, xend - s1->xstart_ - 1);
|
yend - s1->ystart_ - 1, xend - s1->xstart_ - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0,
|
void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0,
|
||||||
int r1, int c1)
|
int r1, int c1)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (mat0->data_) {
|
if (mat0->data_) {
|
||||||
if (!(mat0->flags_ & JAS_MATRIX_REF)) {
|
if (!(mat0->flags_ & JAS_MATRIX_REF)) {
|
||||||
jas_free(mat0->data_);
|
jas_free(mat0->data_);
|
||||||
}
|
}
|
||||||
mat0->data_ = 0;
|
mat0->data_ = 0;
|
||||||
mat0->datasize_ = 0;
|
mat0->datasize_ = 0;
|
||||||
}
|
}
|
||||||
if (mat0->rows_) {
|
if (mat0->rows_) {
|
||||||
jas_free(mat0->rows_);
|
jas_free(mat0->rows_);
|
||||||
mat0->rows_ = 0;
|
mat0->rows_ = 0;
|
||||||
}
|
}
|
||||||
mat0->flags_ |= JAS_MATRIX_REF;
|
mat0->flags_ |= JAS_MATRIX_REF;
|
||||||
mat0->numrows_ = r1 - r0 + 1;
|
mat0->numrows_ = r1 - r0 + 1;
|
||||||
mat0->numcols_ = c1 - c0 + 1;
|
mat0->numcols_ = c1 - c0 + 1;
|
||||||
mat0->maxrows_ = mat0->numrows_;
|
mat0->maxrows_ = mat0->numrows_;
|
||||||
mat0->rows_ = jas_alloc2(mat0->maxrows_, sizeof(jas_seqent_t *));
|
mat0->rows_ = jas_alloc2(mat0->maxrows_, sizeof(jas_seqent_t *));
|
||||||
for (i = 0; i < mat0->numrows_; ++i) {
|
for (i = 0; i < mat0->numrows_; ++i) {
|
||||||
mat0->rows_[i] = mat1->rows_[r0 + i] + c0;
|
mat0->rows_[i] = mat1->rows_[r0 + i] + c0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat0->xstart_ = mat1->xstart_ + c0;
|
mat0->xstart_ = mat1->xstart_ + c0;
|
||||||
mat0->ystart_ = mat1->ystart_ + r0;
|
mat0->ystart_ = mat1->ystart_ + r0;
|
||||||
mat0->xend_ = mat0->xstart_ + mat0->numcols_;
|
mat0->xend_ = mat0->xstart_ + mat0->numcols_;
|
||||||
mat0->yend_ = mat0->ystart_ + mat0->numrows_;
|
mat0->yend_ = mat0->ystart_ + mat0->numrows_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -237,102 +237,102 @@ void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0,
|
|||||||
|
|
||||||
int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1)
|
int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if (mat0->numrows_ != mat1->numrows_ || mat0->numcols_ !=
|
if (mat0->numrows_ != mat1->numrows_ || mat0->numcols_ !=
|
||||||
mat1->numcols_) {
|
mat1->numcols_) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (i = 0; i < mat0->numrows_; i++) {
|
for (i = 0; i < mat0->numrows_; i++) {
|
||||||
for (j = 0; j < mat0->numcols_; j++) {
|
for (j = 0; j < mat0->numcols_; j++) {
|
||||||
if (jas_matrix_get(mat0, i, j) != jas_matrix_get(mat1, i, j)) {
|
if (jas_matrix_get(mat0, i, j) != jas_matrix_get(mat1, i, j)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_matrix_divpow2(jas_matrix_t *matrix, int n)
|
void jas_matrix_divpow2(jas_matrix_t *matrix, int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jas_seqent_t *rowstart;
|
jas_seqent_t *rowstart;
|
||||||
int rowstep;
|
int rowstep;
|
||||||
jas_seqent_t *data;
|
jas_seqent_t *data;
|
||||||
|
|
||||||
rowstep = jas_matrix_rowstep(matrix);
|
rowstep = jas_matrix_rowstep(matrix);
|
||||||
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
||||||
rowstart += rowstep) {
|
rowstart += rowstep) {
|
||||||
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
||||||
++data) {
|
++data) {
|
||||||
*data = (*data >= 0) ? ((*data) >> n) :
|
*data = (*data >= 0) ? ((*data) >> n) :
|
||||||
(-((-(*data)) >> n));
|
(-((-(*data)) >> n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval)
|
void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jas_seqent_t v;
|
jas_seqent_t v;
|
||||||
jas_seqent_t *rowstart;
|
jas_seqent_t *rowstart;
|
||||||
jas_seqent_t *data;
|
jas_seqent_t *data;
|
||||||
int rowstep;
|
int rowstep;
|
||||||
|
|
||||||
rowstep = jas_matrix_rowstep(matrix);
|
rowstep = jas_matrix_rowstep(matrix);
|
||||||
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
||||||
rowstart += rowstep) {
|
rowstart += rowstep) {
|
||||||
data = rowstart;
|
data = rowstart;
|
||||||
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
||||||
++data) {
|
++data) {
|
||||||
v = *data;
|
v = *data;
|
||||||
if (v < minval) {
|
if (v < minval) {
|
||||||
*data = minval;
|
*data = minval;
|
||||||
} else if (v > maxval) {
|
} else if (v > maxval) {
|
||||||
*data = maxval;
|
*data = maxval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_matrix_asr(jas_matrix_t *matrix, int n)
|
void jas_matrix_asr(jas_matrix_t *matrix, int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jas_seqent_t *rowstart;
|
jas_seqent_t *rowstart;
|
||||||
int rowstep;
|
int rowstep;
|
||||||
jas_seqent_t *data;
|
jas_seqent_t *data;
|
||||||
|
|
||||||
assert(n >= 0);
|
assert(n >= 0);
|
||||||
rowstep = jas_matrix_rowstep(matrix);
|
rowstep = jas_matrix_rowstep(matrix);
|
||||||
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
||||||
rowstart += rowstep) {
|
rowstart += rowstep) {
|
||||||
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
||||||
++data) {
|
++data) {
|
||||||
*data >>= n;
|
*data >>= n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_matrix_asl(jas_matrix_t *matrix, int n)
|
void jas_matrix_asl(jas_matrix_t *matrix, int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jas_seqent_t *rowstart;
|
jas_seqent_t *rowstart;
|
||||||
int rowstep;
|
int rowstep;
|
||||||
jas_seqent_t *data;
|
jas_seqent_t *data;
|
||||||
|
|
||||||
rowstep = jas_matrix_rowstep(matrix);
|
rowstep = jas_matrix_rowstep(matrix);
|
||||||
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
||||||
rowstart += rowstep) {
|
rowstart += rowstep) {
|
||||||
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
||||||
++data) {
|
++data) {
|
||||||
*data <<= n;
|
*data <<= n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -341,114 +341,114 @@ void jas_matrix_asl(jas_matrix_t *matrix, int n)
|
|||||||
|
|
||||||
int jas_matrix_resize(jas_matrix_t *matrix, int numrows, int numcols)
|
int jas_matrix_resize(jas_matrix_t *matrix, int numrows, int numcols)
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
size = numrows * numcols;
|
size = numrows * numcols;
|
||||||
if (size > matrix->datasize_ || numrows > matrix->maxrows_) {
|
if (size > matrix->datasize_ || numrows > matrix->maxrows_) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix->numrows_ = numrows;
|
matrix->numrows_ = numrows;
|
||||||
matrix->numcols_ = numcols;
|
matrix->numcols_ = numcols;
|
||||||
|
|
||||||
for (i = 0; i < numrows; ++i) {
|
for (i = 0; i < numrows; ++i) {
|
||||||
matrix->rows_[i] = &matrix->data_[numcols * i];
|
matrix->rows_[i] = &matrix->data_[numcols * i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val)
|
void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jas_seqent_t *rowstart;
|
jas_seqent_t *rowstart;
|
||||||
int rowstep;
|
int rowstep;
|
||||||
jas_seqent_t *data;
|
jas_seqent_t *data;
|
||||||
|
|
||||||
rowstep = jas_matrix_rowstep(matrix);
|
rowstep = jas_matrix_rowstep(matrix);
|
||||||
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
|
||||||
rowstart += rowstep) {
|
rowstart += rowstep) {
|
||||||
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
|
||||||
++data) {
|
++data) {
|
||||||
*data = val;
|
*data = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jas_matrix_t *jas_seq2d_input(FILE *in)
|
jas_matrix_t *jas_seq2d_input(FILE *in)
|
||||||
{
|
{
|
||||||
jas_matrix_t *matrix;
|
jas_matrix_t *matrix;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
long x;
|
long x;
|
||||||
int numrows;
|
int numrows;
|
||||||
int numcols;
|
int numcols;
|
||||||
int xoff;
|
int xoff;
|
||||||
int yoff;
|
int yoff;
|
||||||
|
|
||||||
if (fscanf(in, "%d %d", &xoff, &yoff) != 2)
|
if (fscanf(in, "%d %d", &xoff, &yoff) != 2)
|
||||||
return 0;
|
return 0;
|
||||||
if (fscanf(in, "%d %d", &numcols, &numrows) != 2)
|
if (fscanf(in, "%d %d", &numcols, &numrows) != 2)
|
||||||
return 0;
|
return 0;
|
||||||
if (!(matrix = jas_seq2d_create(xoff, yoff, xoff + numcols, yoff + numrows)))
|
if (!(matrix = jas_seq2d_create(xoff, yoff, xoff + numcols, yoff + numrows)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (jas_matrix_numrows(matrix) != numrows || jas_matrix_numcols(matrix) != numcols) {
|
if (jas_matrix_numrows(matrix) != numrows || jas_matrix_numcols(matrix) != numcols) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get matrix data. */
|
/* Get matrix data. */
|
||||||
for (i = 0; i < jas_matrix_numrows(matrix); i++) {
|
for (i = 0; i < jas_matrix_numrows(matrix); i++) {
|
||||||
for (j = 0; j < jas_matrix_numcols(matrix); j++) {
|
for (j = 0; j < jas_matrix_numcols(matrix); j++) {
|
||||||
if (fscanf(in, "%ld", &x) != 1) {
|
if (fscanf(in, "%ld", &x) != 1) {
|
||||||
jas_matrix_destroy(matrix);
|
jas_matrix_destroy(matrix);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
jas_matrix_set(matrix, i, j, JAS_CAST(jas_seqent_t, x));
|
jas_matrix_set(matrix, i, j, JAS_CAST(jas_seqent_t, x));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jas_seq2d_output(jas_matrix_t *matrix, FILE *out)
|
int jas_seq2d_output(jas_matrix_t *matrix, FILE *out)
|
||||||
{
|
{
|
||||||
#define MAXLINELEN 80
|
#define MAXLINELEN 80
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jas_seqent_t x;
|
jas_seqent_t x;
|
||||||
char buf[MAXLINELEN + 1];
|
char buf[MAXLINELEN + 1];
|
||||||
char sbuf[MAXLINELEN + 1];
|
char sbuf[MAXLINELEN + 1];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
fprintf(out, "%d %d\n", (int)jas_seq2d_xstart(matrix),
|
fprintf(out, "%d %d\n", (int)jas_seq2d_xstart(matrix),
|
||||||
(int)jas_seq2d_ystart(matrix));
|
(int)jas_seq2d_ystart(matrix));
|
||||||
fprintf(out, "%d %d\n", (int)jas_matrix_numcols(matrix),
|
fprintf(out, "%d %d\n", (int)jas_matrix_numcols(matrix),
|
||||||
(int)jas_matrix_numrows(matrix));
|
(int)jas_matrix_numrows(matrix));
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
for (i = 0; i < jas_matrix_numrows(matrix); ++i) {
|
for (i = 0; i < jas_matrix_numrows(matrix); ++i) {
|
||||||
for (j = 0; j < jas_matrix_numcols(matrix); ++j) {
|
for (j = 0; j < jas_matrix_numcols(matrix); ++j) {
|
||||||
x = jas_matrix_get(matrix, i, j);
|
x = jas_matrix_get(matrix, i, j);
|
||||||
sprintf(sbuf, "%s%4ld", (strlen(buf) > 0) ? " " : "",
|
sprintf(sbuf, "%s%4ld", (strlen(buf) > 0) ? " " : "",
|
||||||
JAS_CAST(long, x));
|
JAS_CAST(long, x));
|
||||||
n = strlen(buf);
|
n = strlen(buf);
|
||||||
if (n + strlen(sbuf) > MAXLINELEN) {
|
if (n + strlen(sbuf) > MAXLINELEN) {
|
||||||
fputs(buf, out);
|
fputs(buf, out);
|
||||||
fputs("\n", out);
|
fputs("\n", out);
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
strcat(buf, sbuf);
|
strcat(buf, sbuf);
|
||||||
if (j == jas_matrix_numcols(matrix) - 1) {
|
if (j == jas_matrix_numcols(matrix) - 1) {
|
||||||
fputs(buf, out);
|
fputs(buf, out);
|
||||||
fputs("\n", out);
|
fputs("\n", out);
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputs(buf, out);
|
fputs(buf, out);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
1422
3rdparty/libjasper/jas_stream.c
vendored
1422
3rdparty/libjasper/jas_stream.c
vendored
File diff suppressed because it is too large
Load Diff
16
3rdparty/libjasper/jas_string.c
vendored
16
3rdparty/libjasper/jas_string.c
vendored
@ -85,12 +85,12 @@
|
|||||||
|
|
||||||
char *jas_strdup(const char *s)
|
char *jas_strdup(const char *s)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
char *p;
|
char *p;
|
||||||
n = strlen(s) + 1;
|
n = strlen(s) + 1;
|
||||||
if (!(p = jas_malloc(n * sizeof(char)))) {
|
if (!(p = jas_malloc(n * sizeof(char)))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
strcpy(p, s);
|
strcpy(p, s);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
48
3rdparty/libjasper/jas_tmr.c
vendored
48
3rdparty/libjasper/jas_tmr.c
vendored
@ -83,51 +83,51 @@
|
|||||||
|
|
||||||
void jas_tmr_start(jas_tmr_t *tmr)
|
void jas_tmr_start(jas_tmr_t *tmr)
|
||||||
{
|
{
|
||||||
if (gettimeofday(&tmr->start, 0)) {
|
if (gettimeofday(&tmr->start, 0)) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_tmr_stop(jas_tmr_t *tmr)
|
void jas_tmr_stop(jas_tmr_t *tmr)
|
||||||
{
|
{
|
||||||
if (gettimeofday(&tmr->stop, 0)) {
|
if (gettimeofday(&tmr->stop, 0)) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double jas_tmr_get(jas_tmr_t *tmr)
|
double jas_tmr_get(jas_tmr_t *tmr)
|
||||||
{
|
{
|
||||||
double t0;
|
double t0;
|
||||||
double t1;
|
double t1;
|
||||||
t0 = ((double) tmr->start.tv_sec) + ((double) tmr->start.tv_usec) / 1e6;
|
t0 = ((double) tmr->start.tv_sec) + ((double) tmr->start.tv_usec) / 1e6;
|
||||||
t1 = ((double) tmr->stop.tv_sec) + ((double) tmr->stop.tv_usec) / 1e6;
|
t1 = ((double) tmr->stop.tv_sec) + ((double) tmr->stop.tv_usec) / 1e6;
|
||||||
return t1 - t0;
|
return t1 - t0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_GETRUSAGE)
|
#elif defined(HAVE_GETRUSAGE)
|
||||||
|
|
||||||
void jas_tmr_start(jas_tmr_t *tmr)
|
void jas_tmr_start(jas_tmr_t *tmr)
|
||||||
{
|
{
|
||||||
if (getrusage(RUSAGE_SELF, &tmr->start) < 0) {
|
if (getrusage(RUSAGE_SELF, &tmr->start) < 0) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_tmr_stop(jas_tmr_t *tmr)
|
void jas_tmr_stop(jas_tmr_t *tmr)
|
||||||
{
|
{
|
||||||
if (getrusage(RUSAGE_SELF, &tmr->stop) < 0) {
|
if (getrusage(RUSAGE_SELF, &tmr->stop) < 0) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double jas_tmr_get(jas_tmr_t *tmr)
|
double jas_tmr_get(jas_tmr_t *tmr)
|
||||||
{
|
{
|
||||||
double t;
|
double t;
|
||||||
t = ((tmr->stop.ru_utime.tv_sec * 1e6 + tmr->stop.ru_utime.tv_usec) -
|
t = ((tmr->stop.ru_utime.tv_sec * 1e6 + tmr->stop.ru_utime.tv_usec) -
|
||||||
(tmr->start.ru_utime.tv_sec * 1e6 + tmr->start.ru_utime.tv_usec)) / 1e6;
|
(tmr->start.ru_utime.tv_sec * 1e6 + tmr->start.ru_utime.tv_usec)) / 1e6;
|
||||||
t += ((tmr->stop.ru_stime.tv_sec * 1e6 + tmr->stop.ru_stime.tv_usec) -
|
t += ((tmr->stop.ru_stime.tv_sec * 1e6 + tmr->stop.ru_stime.tv_usec) -
|
||||||
(tmr->start.ru_stime.tv_sec * 1e6 + tmr->start.ru_stime.tv_usec)) / 1e6;
|
(tmr->start.ru_stime.tv_sec * 1e6 + tmr->start.ru_stime.tv_usec)) / 1e6;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -142,7 +142,7 @@ void jas_tmr_stop(jas_tmr_t *tmr)
|
|||||||
|
|
||||||
double jas_tmr_get(jas_tmr_t *tmr)
|
double jas_tmr_get(jas_tmr_t *tmr)
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
174
3rdparty/libjasper/jas_tvp.c
vendored
174
3rdparty/libjasper/jas_tvp.c
vendored
@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
/* Is the specified character valid for a tag name? */
|
/* Is the specified character valid for a tag name? */
|
||||||
#define JAS_TVP_ISTAG(x) \
|
#define JAS_TVP_ISTAG(x) \
|
||||||
(isalpha(x) || (x) == '_' || isdigit(x))
|
(isalpha(x) || (x) == '_' || isdigit(x))
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Code for creating and destroying a tag-value parser.
|
* Code for creating and destroying a tag-value parser.
|
||||||
@ -92,26 +92,26 @@
|
|||||||
|
|
||||||
jas_tvparser_t *jas_tvparser_create(const char *s)
|
jas_tvparser_t *jas_tvparser_create(const char *s)
|
||||||
{
|
{
|
||||||
jas_tvparser_t *tvp;
|
jas_tvparser_t *tvp;
|
||||||
if (!(tvp = jas_malloc(sizeof(jas_tvparser_t)))) {
|
if (!(tvp = jas_malloc(sizeof(jas_tvparser_t)))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(tvp->buf = jas_strdup(s))) {
|
if (!(tvp->buf = jas_strdup(s))) {
|
||||||
jas_tvparser_destroy(tvp);
|
jas_tvparser_destroy(tvp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
tvp->pos = tvp->buf;
|
tvp->pos = tvp->buf;
|
||||||
tvp->tag = 0;
|
tvp->tag = 0;
|
||||||
tvp->val = 0;
|
tvp->val = 0;
|
||||||
return tvp;
|
return tvp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jas_tvparser_destroy(jas_tvparser_t *tvp)
|
void jas_tvparser_destroy(jas_tvparser_t *tvp)
|
||||||
{
|
{
|
||||||
if (tvp->buf) {
|
if (tvp->buf) {
|
||||||
jas_free(tvp->buf);
|
jas_free(tvp->buf);
|
||||||
}
|
}
|
||||||
jas_free(tvp);
|
jas_free(tvp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -121,73 +121,73 @@ void jas_tvparser_destroy(jas_tvparser_t *tvp)
|
|||||||
/* Get the next tag-value pair. */
|
/* Get the next tag-value pair. */
|
||||||
int jas_tvparser_next(jas_tvparser_t *tvp)
|
int jas_tvparser_next(jas_tvparser_t *tvp)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char *tag;
|
char *tag;
|
||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
/* Skip any leading whitespace. */
|
/* Skip any leading whitespace. */
|
||||||
p = tvp->pos;
|
p = tvp->pos;
|
||||||
while (*p != '\0' && isspace(*p)) {
|
while (*p != '\0' && isspace(*p)) {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Has the end of the input data been reached? */
|
/* Has the end of the input data been reached? */
|
||||||
if (*p == '\0') {
|
if (*p == '\0') {
|
||||||
/* No more tags are present. */
|
/* No more tags are present. */
|
||||||
tvp->pos = p;
|
tvp->pos = p;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does the tag name begin with a valid character? */
|
/* Does the tag name begin with a valid character? */
|
||||||
if (!JAS_TVP_ISTAG(*p)) {
|
if (!JAS_TVP_ISTAG(*p)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remember where the tag name begins. */
|
/* Remember where the tag name begins. */
|
||||||
tag = p;
|
tag = p;
|
||||||
|
|
||||||
/* Find the end of the tag name. */
|
/* Find the end of the tag name. */
|
||||||
while (*p != '\0' && JAS_TVP_ISTAG(*p)) {
|
while (*p != '\0' && JAS_TVP_ISTAG(*p)) {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Has the end of the input data been reached? */
|
/* Has the end of the input data been reached? */
|
||||||
if (*p == '\0') {
|
if (*p == '\0') {
|
||||||
/* The value field is empty. */
|
/* The value field is empty. */
|
||||||
tvp->tag = tag;
|
tvp->tag = tag;
|
||||||
tvp->val = "";
|
tvp->val = "";
|
||||||
tvp->pos = p;
|
tvp->pos = p;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is a value field not present? */
|
/* Is a value field not present? */
|
||||||
if (*p != '=') {
|
if (*p != '=') {
|
||||||
if (*p != '\0' && !isspace(*p)) {
|
if (*p != '\0' && !isspace(*p)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
tvp->tag = tag;
|
tvp->tag = tag;
|
||||||
tvp->val = "";
|
tvp->val = "";
|
||||||
tvp->pos = p;
|
tvp->pos = p;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
|
|
||||||
val = p;
|
val = p;
|
||||||
while (*p != '\0' && !isspace(*p)) {
|
while (*p != '\0' && !isspace(*p)) {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p != '\0') {
|
if (*p != '\0') {
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
tvp->pos = p;
|
tvp->pos = p;
|
||||||
tvp->tag = tag;
|
tvp->tag = tag;
|
||||||
tvp->val = val;
|
tvp->val = val;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -197,13 +197,13 @@ int jas_tvparser_next(jas_tvparser_t *tvp)
|
|||||||
/* Get the current tag. */
|
/* Get the current tag. */
|
||||||
char *jas_tvparser_gettag(jas_tvparser_t *tvp)
|
char *jas_tvparser_gettag(jas_tvparser_t *tvp)
|
||||||
{
|
{
|
||||||
return tvp->tag;
|
return tvp->tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the current value. */
|
/* Get the current value. */
|
||||||
char *jas_tvparser_getval(jas_tvparser_t *tvp)
|
char *jas_tvparser_getval(jas_tvparser_t *tvp)
|
||||||
{
|
{
|
||||||
return tvp->val;
|
return tvp->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -213,15 +213,15 @@ char *jas_tvparser_getval(jas_tvparser_t *tvp)
|
|||||||
/* Lookup a tag by name. */
|
/* Lookup a tag by name. */
|
||||||
jas_taginfo_t *jas_taginfos_lookup(jas_taginfo_t *taginfos, const char *name)
|
jas_taginfo_t *jas_taginfos_lookup(jas_taginfo_t *taginfos, const char *name)
|
||||||
{
|
{
|
||||||
jas_taginfo_t *taginfo;
|
jas_taginfo_t *taginfo;
|
||||||
taginfo = taginfos;
|
taginfo = taginfos;
|
||||||
while (taginfo->id >= 0) {
|
while (taginfo->id >= 0) {
|
||||||
if (!strcmp(taginfo->name, name)) {
|
if (!strcmp(taginfo->name, name)) {
|
||||||
return taginfo;
|
return taginfo;
|
||||||
}
|
}
|
||||||
++taginfo;
|
++taginfo;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is simply for convenience. */
|
/* This function is simply for convenience. */
|
||||||
@ -229,9 +229,9 @@ jas_taginfo_t *jas_taginfos_lookup(jas_taginfo_t *taginfos, const char *name)
|
|||||||
using this function. This function never returns a null pointer. */
|
using this function. This function never returns a null pointer. */
|
||||||
jas_taginfo_t *jas_taginfo_nonull(jas_taginfo_t *taginfo)
|
jas_taginfo_t *jas_taginfo_nonull(jas_taginfo_t *taginfo)
|
||||||
{
|
{
|
||||||
static jas_taginfo_t invalidtaginfo = {
|
static jas_taginfo_t invalidtaginfo = {
|
||||||
-1, 0
|
-1, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
return taginfo ? taginfo : &invalidtaginfo;
|
return taginfo ? taginfo : &invalidtaginfo;
|
||||||
}
|
}
|
||||||
|
2
3rdparty/libjasper/jas_version.c
vendored
2
3rdparty/libjasper/jas_version.c
vendored
@ -63,5 +63,5 @@
|
|||||||
|
|
||||||
const char *jas_getversion()
|
const char *jas_getversion()
|
||||||
{
|
{
|
||||||
return JAS_VERSION;
|
return JAS_VERSION;
|
||||||
}
|
}
|
||||||
|
86
3rdparty/libjasper/jasper/jas_cm.h
vendored
86
3rdparty/libjasper/jasper/jas_cm.h
vendored
@ -139,72 +139,72 @@ typedef double jas_cmreal_t;
|
|||||||
struct jas_cmpxform_s;
|
struct jas_cmpxform_s;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
long *buf;
|
long *buf;
|
||||||
int prec;
|
int prec;
|
||||||
int sgnd;
|
int sgnd;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
} jas_cmcmptfmt_t;
|
} jas_cmcmptfmt_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int numcmpts;
|
int numcmpts;
|
||||||
jas_cmcmptfmt_t *cmptfmts;
|
jas_cmcmptfmt_t *cmptfmts;
|
||||||
} jas_cmpixmap_t;
|
} jas_cmpixmap_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void (*destroy)(struct jas_cmpxform_s *pxform);
|
void (*destroy)(struct jas_cmpxform_s *pxform);
|
||||||
int (*apply)(struct jas_cmpxform_s *pxform, jas_cmreal_t *in, jas_cmreal_t *out, int cnt);
|
int (*apply)(struct jas_cmpxform_s *pxform, jas_cmreal_t *in, jas_cmreal_t *out, int cnt);
|
||||||
void (*dump)(struct jas_cmpxform_s *pxform);
|
void (*dump)(struct jas_cmpxform_s *pxform);
|
||||||
} jas_cmpxformops_t;
|
} jas_cmpxformops_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_cmreal_t *data;
|
jas_cmreal_t *data;
|
||||||
int size;
|
int size;
|
||||||
} jas_cmshapmatlut_t;
|
} jas_cmshapmatlut_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int mono;
|
int mono;
|
||||||
int order;
|
int order;
|
||||||
int useluts;
|
int useluts;
|
||||||
int usemat;
|
int usemat;
|
||||||
jas_cmshapmatlut_t luts[3];
|
jas_cmshapmatlut_t luts[3];
|
||||||
jas_cmreal_t mat[3][4];
|
jas_cmreal_t mat[3][4];
|
||||||
} jas_cmshapmat_t;
|
} jas_cmshapmat_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int order;
|
int order;
|
||||||
} jas_cmshaplut_t;
|
} jas_cmshaplut_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int inclrspc;
|
int inclrspc;
|
||||||
int outclrspc;
|
int outclrspc;
|
||||||
} jas_cmclrspcconv_t;
|
} jas_cmclrspcconv_t;
|
||||||
|
|
||||||
#define jas_align_t double
|
#define jas_align_t double
|
||||||
|
|
||||||
typedef struct jas_cmpxform_s {
|
typedef struct jas_cmpxform_s {
|
||||||
int refcnt;
|
int refcnt;
|
||||||
jas_cmpxformops_t *ops;
|
jas_cmpxformops_t *ops;
|
||||||
int numinchans;
|
int numinchans;
|
||||||
int numoutchans;
|
int numoutchans;
|
||||||
union {
|
union {
|
||||||
jas_align_t dummy;
|
jas_align_t dummy;
|
||||||
jas_cmshapmat_t shapmat;
|
jas_cmshapmat_t shapmat;
|
||||||
jas_cmshaplut_t shaplut;
|
jas_cmshaplut_t shaplut;
|
||||||
jas_cmclrspcconv_t clrspcconv;
|
jas_cmclrspcconv_t clrspcconv;
|
||||||
} data;
|
} data;
|
||||||
} jas_cmpxform_t;
|
} jas_cmpxform_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int numpxforms;
|
int numpxforms;
|
||||||
int maxpxforms;
|
int maxpxforms;
|
||||||
jas_cmpxform_t **pxforms;
|
jas_cmpxform_t **pxforms;
|
||||||
} jas_cmpxformseq_t;
|
} jas_cmpxformseq_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int numinchans;
|
int numinchans;
|
||||||
int numoutchans;
|
int numoutchans;
|
||||||
jas_cmpxformseq_t *pxformseq;
|
jas_cmpxformseq_t *pxformseq;
|
||||||
} jas_cmxform_t;
|
} jas_cmxform_t;
|
||||||
|
|
||||||
#define JAS_CMPROF_TYPE_DEV 1
|
#define JAS_CMPROF_TYPE_DEV 1
|
||||||
@ -213,12 +213,12 @@ typedef struct {
|
|||||||
#define JAS_CMPROF_NUMPXFORMSEQS 13
|
#define JAS_CMPROF_NUMPXFORMSEQS 13
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int clrspc;
|
int clrspc;
|
||||||
int numchans;
|
int numchans;
|
||||||
int refclrspc;
|
int refclrspc;
|
||||||
int numrefchans;
|
int numrefchans;
|
||||||
jas_iccprof_t *iccprof;
|
jas_iccprof_t *iccprof;
|
||||||
jas_cmpxformseq_t *pxformseqs[JAS_CMPROF_NUMPXFORMSEQS];
|
jas_cmpxformseq_t *pxformseqs[JAS_CMPROF_NUMPXFORMSEQS];
|
||||||
} jas_cmprof_t;
|
} jas_cmprof_t;
|
||||||
|
|
||||||
/* Create a profile. */
|
/* Create a profile. */
|
||||||
|
2
3rdparty/libjasper/jasper/jas_debug.h
vendored
2
3rdparty/libjasper/jasper/jas_debug.h
vendored
@ -90,7 +90,7 @@ extern "C" {
|
|||||||
level is set sufficiently high. */
|
level is set sufficiently high. */
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
#define JAS_DBGLOG(n, x) \
|
#define JAS_DBGLOG(n, x) \
|
||||||
((jas_getdbglevel() >= (n)) ? (jas_eprintf x) : 0)
|
((jas_getdbglevel() >= (n)) ? (jas_eprintf x) : 0)
|
||||||
#else
|
#else
|
||||||
#define JAS_DBGLOG(n, x)
|
#define JAS_DBGLOG(n, x)
|
||||||
#endif
|
#endif
|
||||||
|
100
3rdparty/libjasper/jasper/jas_fix.h
vendored
100
3rdparty/libjasper/jasper/jas_fix.h
vendored
@ -91,15 +91,15 @@ extern "C" {
|
|||||||
|
|
||||||
/* The representation of the value zero. */
|
/* The representation of the value zero. */
|
||||||
#define JAS_FIX_ZERO(fix_t, fracbits) \
|
#define JAS_FIX_ZERO(fix_t, fracbits) \
|
||||||
JAS_CAST(fix_t, 0)
|
JAS_CAST(fix_t, 0)
|
||||||
|
|
||||||
/* The representation of the value one. */
|
/* The representation of the value one. */
|
||||||
#define JAS_FIX_ONE(fix_t, fracbits) \
|
#define JAS_FIX_ONE(fix_t, fracbits) \
|
||||||
(JAS_CAST(fix_t, 1) << (fracbits))
|
(JAS_CAST(fix_t, 1) << (fracbits))
|
||||||
|
|
||||||
/* The representation of the value one half. */
|
/* The representation of the value one half. */
|
||||||
#define JAS_FIX_HALF(fix_t, fracbits) \
|
#define JAS_FIX_HALF(fix_t, fracbits) \
|
||||||
(JAS_CAST(fix_t, 1) << ((fracbits) - 1))
|
(JAS_CAST(fix_t, 1) << ((fracbits) - 1))
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Conversion operations.
|
* Conversion operations.
|
||||||
@ -107,19 +107,19 @@ extern "C" {
|
|||||||
|
|
||||||
/* Convert an int to a fixed-point number. */
|
/* Convert an int to a fixed-point number. */
|
||||||
#define JAS_INTTOFIX(fix_t, fracbits, x) \
|
#define JAS_INTTOFIX(fix_t, fracbits, x) \
|
||||||
JAS_CAST(fix_t, (x) << (fracbits))
|
JAS_CAST(fix_t, (x) << (fracbits))
|
||||||
|
|
||||||
/* Convert a fixed-point number to an int. */
|
/* Convert a fixed-point number to an int. */
|
||||||
#define JAS_FIXTOINT(fix_t, fracbits, x) \
|
#define JAS_FIXTOINT(fix_t, fracbits, x) \
|
||||||
JAS_CAST(int, (x) >> (fracbits))
|
JAS_CAST(int, (x) >> (fracbits))
|
||||||
|
|
||||||
/* Convert a fixed-point number to a double. */
|
/* Convert a fixed-point number to a double. */
|
||||||
#define JAS_FIXTODBL(fix_t, fracbits, x) \
|
#define JAS_FIXTODBL(fix_t, fracbits, x) \
|
||||||
(JAS_CAST(double, x) / (JAS_CAST(fix_t, 1) << (fracbits)))
|
(JAS_CAST(double, x) / (JAS_CAST(fix_t, 1) << (fracbits)))
|
||||||
|
|
||||||
/* Convert a double to a fixed-point number. */
|
/* Convert a double to a fixed-point number. */
|
||||||
#define JAS_DBLTOFIX(fix_t, fracbits, x) \
|
#define JAS_DBLTOFIX(fix_t, fracbits, x) \
|
||||||
JAS_CAST(fix_t, ((x) * JAS_CAST(double, JAS_CAST(fix_t, 1) << (fracbits))))
|
JAS_CAST(fix_t, ((x) * JAS_CAST(double, JAS_CAST(fix_t, 1) << (fracbits))))
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Basic arithmetic operations.
|
* Basic arithmetic operations.
|
||||||
@ -143,11 +143,11 @@ extern "C" {
|
|||||||
|
|
||||||
/* Calculate the sum of two fixed-point numbers with overflow checking. */
|
/* Calculate the sum of two fixed-point numbers with overflow checking. */
|
||||||
#define JAS_FIX_ADD_OFLOW(fix_t, fracbits, x, y) \
|
#define JAS_FIX_ADD_OFLOW(fix_t, fracbits, x, y) \
|
||||||
((x) >= 0) ? \
|
((x) >= 0) ? \
|
||||||
(((y) >= 0) ? ((x) + (y) >= 0 || JAS_FIX_OFLOW(), (x) + (y)) : \
|
(((y) >= 0) ? ((x) + (y) >= 0 || JAS_FIX_OFLOW(), (x) + (y)) : \
|
||||||
((x) + (y))) : \
|
((x) + (y))) : \
|
||||||
(((y) >= 0) ? ((x) + (y)) : ((x) + (y) < 0 || JAS_FIX_OFLOW(), \
|
(((y) >= 0) ? ((x) + (y)) : ((x) + (y) < 0 || JAS_FIX_OFLOW(), \
|
||||||
(x) + (y)))
|
(x) + (y)))
|
||||||
|
|
||||||
/* Calculate the product of two fixed-point numbers. */
|
/* Calculate the product of two fixed-point numbers. */
|
||||||
#if !defined(DEBUG_OVERFLOW)
|
#if !defined(DEBUG_OVERFLOW)
|
||||||
@ -159,17 +159,17 @@ extern "C" {
|
|||||||
/* Calculate the product of two fixed-point numbers without overflow
|
/* Calculate the product of two fixed-point numbers without overflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_MUL_FAST(fix_t, fracbits, bigfix_t, x, y) \
|
#define JAS_FIX_MUL_FAST(fix_t, fracbits, bigfix_t, x, y) \
|
||||||
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y)) >> \
|
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y)) >> \
|
||||||
(fracbits))
|
(fracbits))
|
||||||
|
|
||||||
/* Calculate the product of two fixed-point numbers with overflow
|
/* Calculate the product of two fixed-point numbers with overflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_MUL_OFLOW(fix_t, fracbits, bigfix_t, x, y) \
|
#define JAS_FIX_MUL_OFLOW(fix_t, fracbits, bigfix_t, x, y) \
|
||||||
((JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> (fracbits)) == \
|
((JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> (fracbits)) == \
|
||||||
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> \
|
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> \
|
||||||
(fracbits))) ? \
|
(fracbits))) ? \
|
||||||
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> \
|
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> \
|
||||||
(fracbits))) : JAS_FIX_OFLOW())
|
(fracbits))) : JAS_FIX_OFLOW())
|
||||||
|
|
||||||
/* Calculate the product of a fixed-point number and an int. */
|
/* Calculate the product of a fixed-point number and an int. */
|
||||||
#if !defined(DEBUG_OVERFLOW)
|
#if !defined(DEBUG_OVERFLOW)
|
||||||
@ -181,12 +181,12 @@ extern "C" {
|
|||||||
/* Calculate the product of a fixed-point number and an int without overflow
|
/* Calculate the product of a fixed-point number and an int without overflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) \
|
#define JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) \
|
||||||
JAS_CAST(fix_t, ((x) * (y)))
|
JAS_CAST(fix_t, ((x) * (y)))
|
||||||
|
|
||||||
/* Calculate the product of a fixed-point number and an int with overflow
|
/* Calculate the product of a fixed-point number and an int with overflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_MULBYINT_OFLOW(fix_t, fracbits, x, y) \
|
#define JAS_FIX_MULBYINT_OFLOW(fix_t, fracbits, x, y) \
|
||||||
JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y)
|
JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y)
|
||||||
|
|
||||||
/* Calculate the quotient of two fixed-point numbers. */
|
/* Calculate the quotient of two fixed-point numbers. */
|
||||||
#if !defined(DEBUG_OVERFLOW)
|
#if !defined(DEBUG_OVERFLOW)
|
||||||
@ -198,12 +198,12 @@ extern "C" {
|
|||||||
/* Calculate the quotient of two fixed-point numbers without underflow
|
/* Calculate the quotient of two fixed-point numbers without underflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) \
|
#define JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) \
|
||||||
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) << (fracbits)) / (y))
|
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) << (fracbits)) / (y))
|
||||||
|
|
||||||
/* Calculate the quotient of two fixed-point numbers with underflow
|
/* Calculate the quotient of two fixed-point numbers with underflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_DIV_UFLOW(fix_t, fracbits, bigfix_t, x, y) \
|
#define JAS_FIX_DIV_UFLOW(fix_t, fracbits, bigfix_t, x, y) \
|
||||||
JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y)
|
JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y)
|
||||||
|
|
||||||
/* Negate a fixed-point number. */
|
/* Negate a fixed-point number. */
|
||||||
#if !defined(DEBUG_OVERFLOW)
|
#if !defined(DEBUG_OVERFLOW)
|
||||||
@ -214,13 +214,13 @@ extern "C" {
|
|||||||
|
|
||||||
/* Negate a fixed-point number without overflow checking. */
|
/* Negate a fixed-point number without overflow checking. */
|
||||||
#define JAS_FIX_NEG_FAST(fix_t, fracbits, x) \
|
#define JAS_FIX_NEG_FAST(fix_t, fracbits, x) \
|
||||||
(-(x))
|
(-(x))
|
||||||
|
|
||||||
/* Negate a fixed-point number with overflow checking. */
|
/* Negate a fixed-point number with overflow checking. */
|
||||||
/* Yes, overflow is actually possible for two's complement representations,
|
/* Yes, overflow is actually possible for two's complement representations,
|
||||||
although highly unlikely to occur. */
|
although highly unlikely to occur. */
|
||||||
#define JAS_FIX_NEG_OFLOW(fix_t, fracbits, x) \
|
#define JAS_FIX_NEG_OFLOW(fix_t, fracbits, x) \
|
||||||
(((x) < 0) ? (-(x) > 0 || JAS_FIX_OFLOW(), -(x)) : (-(x)))
|
(((x) < 0) ? (-(x) > 0 || JAS_FIX_OFLOW(), -(x)) : (-(x)))
|
||||||
|
|
||||||
/* Perform an arithmetic shift left of a fixed-point number. */
|
/* Perform an arithmetic shift left of a fixed-point number. */
|
||||||
#if !defined(DEBUG_OVERFLOW)
|
#if !defined(DEBUG_OVERFLOW)
|
||||||
@ -232,12 +232,12 @@ extern "C" {
|
|||||||
/* Perform an arithmetic shift left of a fixed-point number without overflow
|
/* Perform an arithmetic shift left of a fixed-point number without overflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_ASL_FAST(fix_t, fracbits, x, n) \
|
#define JAS_FIX_ASL_FAST(fix_t, fracbits, x, n) \
|
||||||
((x) << (n))
|
((x) << (n))
|
||||||
|
|
||||||
/* Perform an arithmetic shift left of a fixed-point number with overflow
|
/* Perform an arithmetic shift left of a fixed-point number with overflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_ASL_OFLOW(fix_t, fracbits, x, n) \
|
#define JAS_FIX_ASL_OFLOW(fix_t, fracbits, x, n) \
|
||||||
((((x) << (n)) >> (n)) == (x) || JAS_FIX_OFLOW(), (x) << (n))
|
((((x) << (n)) >> (n)) == (x) || JAS_FIX_OFLOW(), (x) << (n))
|
||||||
|
|
||||||
/* Perform an arithmetic shift right of a fixed-point number. */
|
/* Perform an arithmetic shift right of a fixed-point number. */
|
||||||
#if !defined(DEBUG_OVERFLOW)
|
#if !defined(DEBUG_OVERFLOW)
|
||||||
@ -249,12 +249,12 @@ extern "C" {
|
|||||||
/* Perform an arithmetic shift right of a fixed-point number without underflow
|
/* Perform an arithmetic shift right of a fixed-point number without underflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) \
|
#define JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) \
|
||||||
((x) >> (n))
|
((x) >> (n))
|
||||||
|
|
||||||
/* Perform an arithmetic shift right of a fixed-point number with underflow
|
/* Perform an arithmetic shift right of a fixed-point number with underflow
|
||||||
checking. */
|
checking. */
|
||||||
#define JAS_FIX_ASR_UFLOW(fix_t, fracbits, x, n) \
|
#define JAS_FIX_ASR_UFLOW(fix_t, fracbits, x, n) \
|
||||||
JAS_FIX_ASR_FAST(fix_t, fracbits, x, n)
|
JAS_FIX_ASR_FAST(fix_t, fracbits, x, n)
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Other basic arithmetic operations.
|
* Other basic arithmetic operations.
|
||||||
@ -262,19 +262,19 @@ extern "C" {
|
|||||||
|
|
||||||
/* Calculate the difference between two fixed-point numbers. */
|
/* Calculate the difference between two fixed-point numbers. */
|
||||||
#define JAS_FIX_SUB(fix_t, fracbits, x, y) \
|
#define JAS_FIX_SUB(fix_t, fracbits, x, y) \
|
||||||
JAS_FIX_ADD(fix_t, fracbits, x, JAS_FIX_NEG(fix_t, fracbits, y))
|
JAS_FIX_ADD(fix_t, fracbits, x, JAS_FIX_NEG(fix_t, fracbits, y))
|
||||||
|
|
||||||
/* Add one fixed-point number to another. */
|
/* Add one fixed-point number to another. */
|
||||||
#define JAS_FIX_PLUSEQ(fix_t, fracbits, x, y) \
|
#define JAS_FIX_PLUSEQ(fix_t, fracbits, x, y) \
|
||||||
((x) = JAS_FIX_ADD(fix_t, fracbits, x, y))
|
((x) = JAS_FIX_ADD(fix_t, fracbits, x, y))
|
||||||
|
|
||||||
/* Subtract one fixed-point number from another. */
|
/* Subtract one fixed-point number from another. */
|
||||||
#define JAS_FIX_MINUSEQ(fix_t, fracbits, x, y) \
|
#define JAS_FIX_MINUSEQ(fix_t, fracbits, x, y) \
|
||||||
((x) = JAS_FIX_SUB(fix_t, fracbits, x, y))
|
((x) = JAS_FIX_SUB(fix_t, fracbits, x, y))
|
||||||
|
|
||||||
/* Multiply one fixed-point number by another. */
|
/* Multiply one fixed-point number by another. */
|
||||||
#define JAS_FIX_MULEQ(fix_t, fracbits, bigfix_t, x, y) \
|
#define JAS_FIX_MULEQ(fix_t, fracbits, bigfix_t, x, y) \
|
||||||
((x) = JAS_FIX_MUL(fix_t, fracbits, bigfix_t, x, y))
|
((x) = JAS_FIX_MUL(fix_t, fracbits, bigfix_t, x, y))
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Miscellaneous operations.
|
* Miscellaneous operations.
|
||||||
@ -282,15 +282,15 @@ extern "C" {
|
|||||||
|
|
||||||
/* Calculate the absolute value of a fixed-point number. */
|
/* Calculate the absolute value of a fixed-point number. */
|
||||||
#define JAS_FIX_ABS(fix_t, fracbits, x) \
|
#define JAS_FIX_ABS(fix_t, fracbits, x) \
|
||||||
(((x) >= 0) ? (x) : (JAS_FIX_NEG(fix_t, fracbits, x)))
|
(((x) >= 0) ? (x) : (JAS_FIX_NEG(fix_t, fracbits, x)))
|
||||||
|
|
||||||
/* Is a fixed-point number an integer? */
|
/* Is a fixed-point number an integer? */
|
||||||
#define JAS_FIX_ISINT(fix_t, fracbits, x) \
|
#define JAS_FIX_ISINT(fix_t, fracbits, x) \
|
||||||
(JAS_FIX_FLOOR(fix_t, fracbits, x) == (x))
|
(JAS_FIX_FLOOR(fix_t, fracbits, x) == (x))
|
||||||
|
|
||||||
/* Get the sign of a fixed-point number. */
|
/* Get the sign of a fixed-point number. */
|
||||||
#define JAS_FIX_SGN(fix_t, fracbits, x) \
|
#define JAS_FIX_SGN(fix_t, fracbits, x) \
|
||||||
((x) >= 0 ? 1 : (-1))
|
((x) >= 0 ? 1 : (-1))
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Relational operations.
|
* Relational operations.
|
||||||
@ -298,23 +298,23 @@ extern "C" {
|
|||||||
|
|
||||||
/* Compare two fixed-point numbers. */
|
/* Compare two fixed-point numbers. */
|
||||||
#define JAS_FIX_CMP(fix_t, fracbits, x, y) \
|
#define JAS_FIX_CMP(fix_t, fracbits, x, y) \
|
||||||
((x) > (y) ? 1 : (((x) == (y)) ? 0 : (-1)))
|
((x) > (y) ? 1 : (((x) == (y)) ? 0 : (-1)))
|
||||||
|
|
||||||
/* Less than. */
|
/* Less than. */
|
||||||
#define JAS_FIX_LT(fix_t, fracbits, x, y) \
|
#define JAS_FIX_LT(fix_t, fracbits, x, y) \
|
||||||
((x) < (y))
|
((x) < (y))
|
||||||
|
|
||||||
/* Less than or equal. */
|
/* Less than or equal. */
|
||||||
#define JAS_FIX_LTE(fix_t, fracbits, x, y) \
|
#define JAS_FIX_LTE(fix_t, fracbits, x, y) \
|
||||||
((x) <= (y))
|
((x) <= (y))
|
||||||
|
|
||||||
/* Greater than. */
|
/* Greater than. */
|
||||||
#define JAS_FIX_GT(fix_t, fracbits, x, y) \
|
#define JAS_FIX_GT(fix_t, fracbits, x, y) \
|
||||||
((x) > (y))
|
((x) > (y))
|
||||||
|
|
||||||
/* Greater than or equal. */
|
/* Greater than or equal. */
|
||||||
#define JAS_FIX_GTE(fix_t, fracbits, x, y) \
|
#define JAS_FIX_GTE(fix_t, fracbits, x, y) \
|
||||||
((x) >= (y))
|
((x) >= (y))
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Rounding functions.
|
* Rounding functions.
|
||||||
@ -322,21 +322,21 @@ extern "C" {
|
|||||||
|
|
||||||
/* Round a fixed-point number to the nearest integer. */
|
/* Round a fixed-point number to the nearest integer. */
|
||||||
#define JAS_FIX_ROUND(fix_t, fracbits, x) \
|
#define JAS_FIX_ROUND(fix_t, fracbits, x) \
|
||||||
(((x) < 0) ? JAS_FIX_FLOOR(fix_t, fracbits, JAS_FIX_ADD(fix_t, fracbits, \
|
(((x) < 0) ? JAS_FIX_FLOOR(fix_t, fracbits, JAS_FIX_ADD(fix_t, fracbits, \
|
||||||
(x), JAS_FIX_HALF(fix_t, fracbits))) : \
|
(x), JAS_FIX_HALF(fix_t, fracbits))) : \
|
||||||
JAS_FIX_NEG(fix_t, fracbits, JAS_FIX_FLOOR(fix_t, fracbits, \
|
JAS_FIX_NEG(fix_t, fracbits, JAS_FIX_FLOOR(fix_t, fracbits, \
|
||||||
JAS_FIX_ADD(fix_t, fracbits, (-(x)), JAS_FIX_HALF(fix_t, fracbits)))))
|
JAS_FIX_ADD(fix_t, fracbits, (-(x)), JAS_FIX_HALF(fix_t, fracbits)))))
|
||||||
|
|
||||||
/* Round a fixed-point number to the nearest integer in the direction of
|
/* Round a fixed-point number to the nearest integer in the direction of
|
||||||
negative infinity (i.e., the floor function). */
|
negative infinity (i.e., the floor function). */
|
||||||
#define JAS_FIX_FLOOR(fix_t, fracbits, x) \
|
#define JAS_FIX_FLOOR(fix_t, fracbits, x) \
|
||||||
((x) & (~((JAS_CAST(fix_t, 1) << (fracbits)) - 1)))
|
((x) & (~((JAS_CAST(fix_t, 1) << (fracbits)) - 1)))
|
||||||
|
|
||||||
/* Round a fixed-point number to the nearest integer in the direction
|
/* Round a fixed-point number to the nearest integer in the direction
|
||||||
of zero. */
|
of zero. */
|
||||||
#define JAS_FIX_TRUNC(fix_t, fracbits, x) \
|
#define JAS_FIX_TRUNC(fix_t, fracbits, x) \
|
||||||
(((x) >= 0) ? JAS_FIX_FLOOR(fix_t, fracbits, x) : \
|
(((x) >= 0) ? JAS_FIX_FLOOR(fix_t, fracbits, x) : \
|
||||||
JAS_FIX_CEIL(fix_t, fracbits, x))
|
JAS_FIX_CEIL(fix_t, fracbits, x))
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* The below macros are for internal library use only. Do not invoke them
|
* The below macros are for internal library use only. Do not invoke them
|
||||||
@ -345,11 +345,11 @@ extern "C" {
|
|||||||
|
|
||||||
/* Handle overflow. */
|
/* Handle overflow. */
|
||||||
#define JAS_FIX_OFLOW() \
|
#define JAS_FIX_OFLOW() \
|
||||||
jas_eprintf("overflow error: file %s, line %d\n", __FILE__, __LINE__)
|
jas_eprintf("overflow error: file %s, line %d\n", __FILE__, __LINE__)
|
||||||
|
|
||||||
/* Handle underflow. */
|
/* Handle underflow. */
|
||||||
#define JAS_FIX_UFLOW() \
|
#define JAS_FIX_UFLOW() \
|
||||||
jas_eprintf("underflow error: file %s, line %d\n", __FILE__, __LINE__)
|
jas_eprintf("underflow error: file %s, line %d\n", __FILE__, __LINE__)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
12
3rdparty/libjasper/jasper/jas_getopt.h
vendored
12
3rdparty/libjasper/jasper/jas_getopt.h
vendored
@ -93,14 +93,14 @@ extern "C" {
|
|||||||
/* Command line option type. */
|
/* Command line option type. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
/* The unique identifier for this option. */
|
/* The unique identifier for this option. */
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
/* The name of this option. */
|
/* The name of this option. */
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
/* option flags. */
|
/* option flags. */
|
||||||
|
|
||||||
} jas_opt_t;
|
} jas_opt_t;
|
||||||
|
|
||||||
|
184
3rdparty/libjasper/jasper/jas_icc.h
vendored
184
3rdparty/libjasper/jasper/jas_icc.h
vendored
@ -225,152 +225,152 @@ typedef jas_iccsig_t jas_iccattrname_t;
|
|||||||
|
|
||||||
/* Date/time type. */
|
/* Date/time type. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccuint16_t year;
|
jas_iccuint16_t year;
|
||||||
jas_iccuint16_t month;
|
jas_iccuint16_t month;
|
||||||
jas_iccuint16_t day;
|
jas_iccuint16_t day;
|
||||||
jas_iccuint16_t hour;
|
jas_iccuint16_t hour;
|
||||||
jas_iccuint16_t min;
|
jas_iccuint16_t min;
|
||||||
jas_iccuint16_t sec;
|
jas_iccuint16_t sec;
|
||||||
} jas_icctime_t;
|
} jas_icctime_t;
|
||||||
|
|
||||||
/* XYZ type. */
|
/* XYZ type. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccs15fixed16_t x;
|
jas_iccs15fixed16_t x;
|
||||||
jas_iccs15fixed16_t y;
|
jas_iccs15fixed16_t y;
|
||||||
jas_iccs15fixed16_t z;
|
jas_iccs15fixed16_t z;
|
||||||
} jas_iccxyz_t;
|
} jas_iccxyz_t;
|
||||||
|
|
||||||
/* Curve type. */
|
/* Curve type. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccuint32_t numents;
|
jas_iccuint32_t numents;
|
||||||
jas_iccuint16_t *ents;
|
jas_iccuint16_t *ents;
|
||||||
} jas_icccurv_t;
|
} jas_icccurv_t;
|
||||||
|
|
||||||
/* Text description type. */
|
/* Text description type. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccuint32_t asclen;
|
jas_iccuint32_t asclen;
|
||||||
char *ascdata; /* ASCII invariant description */
|
char *ascdata; /* ASCII invariant description */
|
||||||
jas_iccuint32_t uclangcode; /* Unicode language code */
|
jas_iccuint32_t uclangcode; /* Unicode language code */
|
||||||
jas_iccuint32_t uclen; /* Unicode localizable description count */
|
jas_iccuint32_t uclen; /* Unicode localizable description count */
|
||||||
uchar *ucdata; /* Unicode localizable description */
|
uchar *ucdata; /* Unicode localizable description */
|
||||||
jas_iccuint16_t sccode; /* ScriptCode code */
|
jas_iccuint16_t sccode; /* ScriptCode code */
|
||||||
jas_iccuint8_t maclen; /* Localizable Macintosh description count */
|
jas_iccuint8_t maclen; /* Localizable Macintosh description count */
|
||||||
uchar macdata[69]; /* Localizable Macintosh description */
|
uchar macdata[69]; /* Localizable Macintosh description */
|
||||||
} jas_icctxtdesc_t;
|
} jas_icctxtdesc_t;
|
||||||
|
|
||||||
/* Text type. */
|
/* Text type. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *string; /* ASCII character string */
|
char *string; /* ASCII character string */
|
||||||
} jas_icctxt_t;
|
} jas_icctxt_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccuint8_t numinchans;
|
jas_iccuint8_t numinchans;
|
||||||
jas_iccuint8_t numoutchans;
|
jas_iccuint8_t numoutchans;
|
||||||
jas_iccsint32_t e[3][3];
|
jas_iccsint32_t e[3][3];
|
||||||
jas_iccuint8_t clutlen;
|
jas_iccuint8_t clutlen;
|
||||||
jas_iccuint8_t *clut;
|
jas_iccuint8_t *clut;
|
||||||
jas_iccuint16_t numintabents;
|
jas_iccuint16_t numintabents;
|
||||||
jas_iccuint8_t **intabs;
|
jas_iccuint8_t **intabs;
|
||||||
jas_iccuint8_t *intabsbuf;
|
jas_iccuint8_t *intabsbuf;
|
||||||
jas_iccuint16_t numouttabents;
|
jas_iccuint16_t numouttabents;
|
||||||
jas_iccuint8_t **outtabs;
|
jas_iccuint8_t **outtabs;
|
||||||
jas_iccuint8_t *outtabsbuf;
|
jas_iccuint8_t *outtabsbuf;
|
||||||
} jas_icclut8_t;
|
} jas_icclut8_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccuint8_t numinchans;
|
jas_iccuint8_t numinchans;
|
||||||
jas_iccuint8_t numoutchans;
|
jas_iccuint8_t numoutchans;
|
||||||
jas_iccsint32_t e[3][3];
|
jas_iccsint32_t e[3][3];
|
||||||
jas_iccuint8_t clutlen;
|
jas_iccuint8_t clutlen;
|
||||||
jas_iccuint16_t *clut;
|
jas_iccuint16_t *clut;
|
||||||
jas_iccuint16_t numintabents;
|
jas_iccuint16_t numintabents;
|
||||||
jas_iccuint16_t **intabs;
|
jas_iccuint16_t **intabs;
|
||||||
jas_iccuint16_t *intabsbuf;
|
jas_iccuint16_t *intabsbuf;
|
||||||
jas_iccuint16_t numouttabents;
|
jas_iccuint16_t numouttabents;
|
||||||
jas_iccuint16_t **outtabs;
|
jas_iccuint16_t **outtabs;
|
||||||
jas_iccuint16_t *outtabsbuf;
|
jas_iccuint16_t *outtabsbuf;
|
||||||
} jas_icclut16_t;
|
} jas_icclut16_t;
|
||||||
|
|
||||||
struct jas_iccattrval_s;
|
struct jas_iccattrval_s;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void (*destroy)(struct jas_iccattrval_s *);
|
void (*destroy)(struct jas_iccattrval_s *);
|
||||||
int (*copy)(struct jas_iccattrval_s *, struct jas_iccattrval_s *);
|
int (*copy)(struct jas_iccattrval_s *, struct jas_iccattrval_s *);
|
||||||
int (*input)(struct jas_iccattrval_s *, jas_stream_t *, int);
|
int (*input)(struct jas_iccattrval_s *, jas_stream_t *, int);
|
||||||
int (*output)(struct jas_iccattrval_s *, jas_stream_t *);
|
int (*output)(struct jas_iccattrval_s *, jas_stream_t *);
|
||||||
int (*getsize)(struct jas_iccattrval_s *);
|
int (*getsize)(struct jas_iccattrval_s *);
|
||||||
void (*dump)(struct jas_iccattrval_s *, FILE *);
|
void (*dump)(struct jas_iccattrval_s *, FILE *);
|
||||||
} jas_iccattrvalops_t;
|
} jas_iccattrvalops_t;
|
||||||
|
|
||||||
/* Attribute value type (type and value information). */
|
/* Attribute value type (type and value information). */
|
||||||
typedef struct jas_iccattrval_s {
|
typedef struct jas_iccattrval_s {
|
||||||
int refcnt; /* reference count */
|
int refcnt; /* reference count */
|
||||||
jas_iccsig_t type; /* type */
|
jas_iccsig_t type; /* type */
|
||||||
jas_iccattrvalops_t *ops; /* type-dependent operations */
|
jas_iccattrvalops_t *ops; /* type-dependent operations */
|
||||||
union {
|
union {
|
||||||
jas_iccxyz_t xyz;
|
jas_iccxyz_t xyz;
|
||||||
jas_icccurv_t curv;
|
jas_icccurv_t curv;
|
||||||
jas_icctxtdesc_t txtdesc;
|
jas_icctxtdesc_t txtdesc;
|
||||||
jas_icctxt_t txt;
|
jas_icctxt_t txt;
|
||||||
jas_icclut8_t lut8;
|
jas_icclut8_t lut8;
|
||||||
jas_icclut16_t lut16;
|
jas_icclut16_t lut16;
|
||||||
} data; /* value */
|
} data; /* value */
|
||||||
} jas_iccattrval_t;
|
} jas_iccattrval_t;
|
||||||
|
|
||||||
/* Header type. */
|
/* Header type. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccuint32_t size; /* profile size */
|
jas_iccuint32_t size; /* profile size */
|
||||||
jas_iccsig_t cmmtype; /* CMM type signature */
|
jas_iccsig_t cmmtype; /* CMM type signature */
|
||||||
jas_iccuint32_t version; /* profile version */
|
jas_iccuint32_t version; /* profile version */
|
||||||
jas_iccsig_t clas; /* profile/device class signature */
|
jas_iccsig_t clas; /* profile/device class signature */
|
||||||
jas_iccsig_t colorspc; /* color space of data */
|
jas_iccsig_t colorspc; /* color space of data */
|
||||||
jas_iccsig_t refcolorspc; /* profile connection space */
|
jas_iccsig_t refcolorspc; /* profile connection space */
|
||||||
jas_icctime_t ctime; /* creation time */
|
jas_icctime_t ctime; /* creation time */
|
||||||
jas_iccsig_t magic; /* profile file signature */
|
jas_iccsig_t magic; /* profile file signature */
|
||||||
jas_iccsig_t platform; /* primary platform */
|
jas_iccsig_t platform; /* primary platform */
|
||||||
jas_iccuint32_t flags; /* profile flags */
|
jas_iccuint32_t flags; /* profile flags */
|
||||||
jas_iccsig_t maker; /* device manufacturer signature */
|
jas_iccsig_t maker; /* device manufacturer signature */
|
||||||
jas_iccsig_t model; /* device model signature */
|
jas_iccsig_t model; /* device model signature */
|
||||||
jas_iccuint64_t attr; /* device setup attributes */
|
jas_iccuint64_t attr; /* device setup attributes */
|
||||||
jas_iccsig_t intent; /* rendering intent */
|
jas_iccsig_t intent; /* rendering intent */
|
||||||
jas_iccxyz_t illum; /* illuminant */
|
jas_iccxyz_t illum; /* illuminant */
|
||||||
jas_iccsig_t creator; /* profile creator signature */
|
jas_iccsig_t creator; /* profile creator signature */
|
||||||
} jas_icchdr_t;
|
} jas_icchdr_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccsig_t name;
|
jas_iccsig_t name;
|
||||||
jas_iccattrval_t *val;
|
jas_iccattrval_t *val;
|
||||||
} jas_iccattr_t;
|
} jas_iccattr_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int numattrs;
|
int numattrs;
|
||||||
int maxattrs;
|
int maxattrs;
|
||||||
jas_iccattr_t *attrs;
|
jas_iccattr_t *attrs;
|
||||||
} jas_iccattrtab_t;
|
} jas_iccattrtab_t;
|
||||||
|
|
||||||
typedef struct jas_icctagtabent_s {
|
typedef struct jas_icctagtabent_s {
|
||||||
jas_iccuint32_t tag;
|
jas_iccuint32_t tag;
|
||||||
jas_iccuint32_t off;
|
jas_iccuint32_t off;
|
||||||
jas_iccuint32_t len;
|
jas_iccuint32_t len;
|
||||||
void *data;
|
void *data;
|
||||||
struct jas_icctagtabent_s *first;
|
struct jas_icctagtabent_s *first;
|
||||||
} jas_icctagtabent_t;
|
} jas_icctagtabent_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccuint32_t numents;
|
jas_iccuint32_t numents;
|
||||||
jas_icctagtabent_t *ents;
|
jas_icctagtabent_t *ents;
|
||||||
} jas_icctagtab_t;
|
} jas_icctagtab_t;
|
||||||
|
|
||||||
/* ICC profile type. */
|
/* ICC profile type. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_icchdr_t hdr;
|
jas_icchdr_t hdr;
|
||||||
jas_icctagtab_t tagtab;
|
jas_icctagtab_t tagtab;
|
||||||
jas_iccattrtab_t *attrtab;
|
jas_iccattrtab_t *attrtab;
|
||||||
} jas_iccprof_t;
|
} jas_iccprof_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jas_iccuint32_t type;
|
jas_iccuint32_t type;
|
||||||
jas_iccattrvalops_t ops;
|
jas_iccattrvalops_t ops;
|
||||||
} jas_iccattrvalinfo_t;
|
} jas_iccattrvalinfo_t;
|
||||||
|
|
||||||
jas_iccprof_t *jas_iccprof_load(jas_stream_t *in);
|
jas_iccprof_t *jas_iccprof_load(jas_stream_t *in);
|
||||||
|
204
3rdparty/libjasper/jasper/jas_image.h
vendored
204
3rdparty/libjasper/jasper/jas_image.h
vendored
@ -137,44 +137,44 @@ typedef int_fast16_t jas_image_smpltype_t;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
jas_image_coord_t tlx_;
|
jas_image_coord_t tlx_;
|
||||||
/* The x-coordinate of the top-left corner of the component. */
|
/* The x-coordinate of the top-left corner of the component. */
|
||||||
|
|
||||||
jas_image_coord_t tly_;
|
jas_image_coord_t tly_;
|
||||||
/* The y-coordinate of the top-left corner of the component. */
|
/* The y-coordinate of the top-left corner of the component. */
|
||||||
|
|
||||||
jas_image_coord_t hstep_;
|
jas_image_coord_t hstep_;
|
||||||
/* The horizontal sampling period in units of the reference grid. */
|
/* The horizontal sampling period in units of the reference grid. */
|
||||||
|
|
||||||
jas_image_coord_t vstep_;
|
jas_image_coord_t vstep_;
|
||||||
/* The vertical sampling period in units of the reference grid. */
|
/* The vertical sampling period in units of the reference grid. */
|
||||||
|
|
||||||
jas_image_coord_t width_;
|
jas_image_coord_t width_;
|
||||||
/* The component width in samples. */
|
/* The component width in samples. */
|
||||||
|
|
||||||
jas_image_coord_t height_;
|
jas_image_coord_t height_;
|
||||||
/* The component height in samples. */
|
/* The component height in samples. */
|
||||||
|
|
||||||
#ifdef FIX_ME
|
#ifdef FIX_ME
|
||||||
int smpltype_;
|
int smpltype_;
|
||||||
#else
|
#else
|
||||||
int prec_;
|
int prec_;
|
||||||
/* The precision of the sample data (i.e., the number of bits per
|
/* The precision of the sample data (i.e., the number of bits per
|
||||||
sample). If the samples are signed values, this quantity
|
sample). If the samples are signed values, this quantity
|
||||||
includes the sign bit. */
|
includes the sign bit. */
|
||||||
|
|
||||||
int sgnd_;
|
int sgnd_;
|
||||||
/* The signedness of the sample data. */
|
/* The signedness of the sample data. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
jas_stream_t *stream_;
|
jas_stream_t *stream_;
|
||||||
/* The stream containing the component data. */
|
/* The stream containing the component data. */
|
||||||
|
|
||||||
int cps_;
|
int cps_;
|
||||||
/* The number of characters per sample in the stream. */
|
/* The number of characters per sample in the stream. */
|
||||||
|
|
||||||
jas_image_cmpttype_t type_;
|
jas_image_cmpttype_t type_;
|
||||||
/* The type of component (e.g., opacity, red, green, blue, luma). */
|
/* The type of component (e.g., opacity, red, green, blue, luma). */
|
||||||
|
|
||||||
} jas_image_cmpt_t;
|
} jas_image_cmpt_t;
|
||||||
|
|
||||||
@ -182,35 +182,35 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
jas_image_coord_t tlx_;
|
jas_image_coord_t tlx_;
|
||||||
/* The x-coordinate of the top-left corner of the image bounding box. */
|
/* The x-coordinate of the top-left corner of the image bounding box. */
|
||||||
|
|
||||||
jas_image_coord_t tly_;
|
jas_image_coord_t tly_;
|
||||||
/* The y-coordinate of the top-left corner of the image bounding box. */
|
/* The y-coordinate of the top-left corner of the image bounding box. */
|
||||||
|
|
||||||
jas_image_coord_t brx_;
|
jas_image_coord_t brx_;
|
||||||
/* The x-coordinate of the bottom-right corner of the image bounding
|
/* The x-coordinate of the bottom-right corner of the image bounding
|
||||||
box (plus one). */
|
box (plus one). */
|
||||||
|
|
||||||
jas_image_coord_t bry_;
|
jas_image_coord_t bry_;
|
||||||
/* The y-coordinate of the bottom-right corner of the image bounding
|
/* The y-coordinate of the bottom-right corner of the image bounding
|
||||||
box (plus one). */
|
box (plus one). */
|
||||||
|
|
||||||
int numcmpts_;
|
int numcmpts_;
|
||||||
/* The number of components. */
|
/* The number of components. */
|
||||||
|
|
||||||
int maxcmpts_;
|
int maxcmpts_;
|
||||||
/* The maximum number of components that this image can have (i.e., the
|
/* The maximum number of components that this image can have (i.e., the
|
||||||
allocated size of the components array). */
|
allocated size of the components array). */
|
||||||
|
|
||||||
jas_image_cmpt_t **cmpts_;
|
jas_image_cmpt_t **cmpts_;
|
||||||
/* Per-component information. */
|
/* Per-component information. */
|
||||||
|
|
||||||
jas_clrspc_t clrspc_;
|
jas_clrspc_t clrspc_;
|
||||||
|
|
||||||
jas_cmprof_t *cmprof_;
|
jas_cmprof_t *cmprof_;
|
||||||
|
|
||||||
bool inmem_;
|
bool inmem_;
|
||||||
|
|
||||||
} jas_image_t;
|
} jas_image_t;
|
||||||
|
|
||||||
@ -220,32 +220,32 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
jas_image_coord_t tlx;
|
jas_image_coord_t tlx;
|
||||||
/* The x-coordinate of the top-left corner of the component. */
|
/* The x-coordinate of the top-left corner of the component. */
|
||||||
|
|
||||||
jas_image_coord_t tly;
|
jas_image_coord_t tly;
|
||||||
/* The y-coordinate of the top-left corner of the component. */
|
/* The y-coordinate of the top-left corner of the component. */
|
||||||
|
|
||||||
jas_image_coord_t hstep;
|
jas_image_coord_t hstep;
|
||||||
/* The horizontal sampling period in units of the reference grid. */
|
/* The horizontal sampling period in units of the reference grid. */
|
||||||
|
|
||||||
jas_image_coord_t vstep;
|
jas_image_coord_t vstep;
|
||||||
/* The vertical sampling period in units of the reference grid. */
|
/* The vertical sampling period in units of the reference grid. */
|
||||||
|
|
||||||
jas_image_coord_t width;
|
jas_image_coord_t width;
|
||||||
/* The width of the component in samples. */
|
/* The width of the component in samples. */
|
||||||
|
|
||||||
jas_image_coord_t height;
|
jas_image_coord_t height;
|
||||||
/* The height of the component in samples. */
|
/* The height of the component in samples. */
|
||||||
|
|
||||||
#ifdef FIX_ME
|
#ifdef FIX_ME
|
||||||
int smpltype;
|
int smpltype;
|
||||||
#else
|
#else
|
||||||
int prec;
|
int prec;
|
||||||
/* The precision of the component sample data. */
|
/* The precision of the component sample data. */
|
||||||
|
|
||||||
int sgnd;
|
int sgnd;
|
||||||
/* The signedness of the component sample data. */
|
/* The signedness of the component sample data. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} jas_image_cmptparm_t;
|
} jas_image_cmptparm_t;
|
||||||
@ -261,14 +261,14 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
jas_image_t *(*decode)(jas_stream_t *in, char *opts);
|
jas_image_t *(*decode)(jas_stream_t *in, char *opts);
|
||||||
/* Decode image data from a stream. */
|
/* Decode image data from a stream. */
|
||||||
|
|
||||||
int (*encode)(jas_image_t *image, jas_stream_t *out, char *opts);
|
int (*encode)(jas_image_t *image, jas_stream_t *out, char *opts);
|
||||||
/* Encode image data to a stream. */
|
/* Encode image data to a stream. */
|
||||||
|
|
||||||
int (*validate)(jas_stream_t *in);
|
int (*validate)(jas_stream_t *in);
|
||||||
/* Determine if stream data is in a particular format. */
|
/* Determine if stream data is in a particular format. */
|
||||||
|
|
||||||
} jas_image_fmtops_t;
|
} jas_image_fmtops_t;
|
||||||
|
|
||||||
@ -276,20 +276,20 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
/* The ID for this format. */
|
/* The ID for this format. */
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
/* The name by which this format is identified. */
|
/* The name by which this format is identified. */
|
||||||
|
|
||||||
char *ext;
|
char *ext;
|
||||||
/* The file name extension associated with this format. */
|
/* The file name extension associated with this format. */
|
||||||
|
|
||||||
char *desc;
|
char *desc;
|
||||||
/* A brief description of the format. */
|
/* A brief description of the format. */
|
||||||
|
|
||||||
jas_image_fmtops_t ops;
|
jas_image_fmtops_t ops;
|
||||||
/* The operations for this format. */
|
/* The operations for this format. */
|
||||||
|
|
||||||
} jas_image_fmtinfo_t;
|
} jas_image_fmtinfo_t;
|
||||||
|
|
||||||
@ -312,92 +312,92 @@ void jas_image_destroy(jas_image_t *image);
|
|||||||
|
|
||||||
/* Get the width of the image in units of the image reference grid. */
|
/* Get the width of the image in units of the image reference grid. */
|
||||||
#define jas_image_width(image) \
|
#define jas_image_width(image) \
|
||||||
((image)->brx_ - (image)->tlx_)
|
((image)->brx_ - (image)->tlx_)
|
||||||
|
|
||||||
/* Get the height of the image in units of the image reference grid. */
|
/* Get the height of the image in units of the image reference grid. */
|
||||||
#define jas_image_height(image) \
|
#define jas_image_height(image) \
|
||||||
((image)->bry_ - (image)->tly_)
|
((image)->bry_ - (image)->tly_)
|
||||||
|
|
||||||
/* Get the x-coordinate of the top-left corner of the image bounding box
|
/* Get the x-coordinate of the top-left corner of the image bounding box
|
||||||
on the reference grid. */
|
on the reference grid. */
|
||||||
#define jas_image_tlx(image) \
|
#define jas_image_tlx(image) \
|
||||||
((image)->tlx_)
|
((image)->tlx_)
|
||||||
|
|
||||||
/* Get the y-coordinate of the top-left corner of the image bounding box
|
/* Get the y-coordinate of the top-left corner of the image bounding box
|
||||||
on the reference grid. */
|
on the reference grid. */
|
||||||
#define jas_image_tly(image) \
|
#define jas_image_tly(image) \
|
||||||
((image)->tly_)
|
((image)->tly_)
|
||||||
|
|
||||||
/* Get the x-coordinate of the bottom-right corner of the image bounding box
|
/* Get the x-coordinate of the bottom-right corner of the image bounding box
|
||||||
on the reference grid (plus one). */
|
on the reference grid (plus one). */
|
||||||
#define jas_image_brx(image) \
|
#define jas_image_brx(image) \
|
||||||
((image)->brx_)
|
((image)->brx_)
|
||||||
|
|
||||||
/* Get the y-coordinate of the bottom-right corner of the image bounding box
|
/* Get the y-coordinate of the bottom-right corner of the image bounding box
|
||||||
on the reference grid (plus one). */
|
on the reference grid (plus one). */
|
||||||
#define jas_image_bry(image) \
|
#define jas_image_bry(image) \
|
||||||
((image)->bry_)
|
((image)->bry_)
|
||||||
|
|
||||||
/* Get the number of image components. */
|
/* Get the number of image components. */
|
||||||
#define jas_image_numcmpts(image) \
|
#define jas_image_numcmpts(image) \
|
||||||
((image)->numcmpts_)
|
((image)->numcmpts_)
|
||||||
|
|
||||||
/* Get the color model used by the image. */
|
/* Get the color model used by the image. */
|
||||||
#define jas_image_clrspc(image) \
|
#define jas_image_clrspc(image) \
|
||||||
((image)->clrspc_)
|
((image)->clrspc_)
|
||||||
|
|
||||||
/* Set the color model for an image. */
|
/* Set the color model for an image. */
|
||||||
#define jas_image_setclrspc(image, clrspc) \
|
#define jas_image_setclrspc(image, clrspc) \
|
||||||
((image)->clrspc_ = (clrspc))
|
((image)->clrspc_ = (clrspc))
|
||||||
|
|
||||||
#define jas_image_cmpttype(image, cmptno) \
|
#define jas_image_cmpttype(image, cmptno) \
|
||||||
((image)->cmpts_[(cmptno)]->type_)
|
((image)->cmpts_[(cmptno)]->type_)
|
||||||
#define jas_image_setcmpttype(image, cmptno, type) \
|
#define jas_image_setcmpttype(image, cmptno, type) \
|
||||||
((image)->cmpts_[(cmptno)]->type_ = (type))
|
((image)->cmpts_[(cmptno)]->type_ = (type))
|
||||||
|
|
||||||
/* Get the width of a component. */
|
/* Get the width of a component. */
|
||||||
#define jas_image_cmptwidth(image, cmptno) \
|
#define jas_image_cmptwidth(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->width_)
|
((image)->cmpts_[cmptno]->width_)
|
||||||
|
|
||||||
/* Get the height of a component. */
|
/* Get the height of a component. */
|
||||||
#define jas_image_cmptheight(image, cmptno) \
|
#define jas_image_cmptheight(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->height_)
|
((image)->cmpts_[cmptno]->height_)
|
||||||
|
|
||||||
/* Get the signedness of the sample data for a component. */
|
/* Get the signedness of the sample data for a component. */
|
||||||
#define jas_image_cmptsgnd(image, cmptno) \
|
#define jas_image_cmptsgnd(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->sgnd_)
|
((image)->cmpts_[cmptno]->sgnd_)
|
||||||
|
|
||||||
/* Get the precision of the sample data for a component. */
|
/* Get the precision of the sample data for a component. */
|
||||||
#define jas_image_cmptprec(image, cmptno) \
|
#define jas_image_cmptprec(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->prec_)
|
((image)->cmpts_[cmptno]->prec_)
|
||||||
|
|
||||||
/* Get the horizontal subsampling factor for a component. */
|
/* Get the horizontal subsampling factor for a component. */
|
||||||
#define jas_image_cmpthstep(image, cmptno) \
|
#define jas_image_cmpthstep(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->hstep_)
|
((image)->cmpts_[cmptno]->hstep_)
|
||||||
|
|
||||||
/* Get the vertical subsampling factor for a component. */
|
/* Get the vertical subsampling factor for a component. */
|
||||||
#define jas_image_cmptvstep(image, cmptno) \
|
#define jas_image_cmptvstep(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->vstep_)
|
((image)->cmpts_[cmptno]->vstep_)
|
||||||
|
|
||||||
/* Get the x-coordinate of the top-left corner of a component. */
|
/* Get the x-coordinate of the top-left corner of a component. */
|
||||||
#define jas_image_cmpttlx(image, cmptno) \
|
#define jas_image_cmpttlx(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->tlx_)
|
((image)->cmpts_[cmptno]->tlx_)
|
||||||
|
|
||||||
/* Get the y-coordinate of the top-left corner of a component. */
|
/* Get the y-coordinate of the top-left corner of a component. */
|
||||||
#define jas_image_cmpttly(image, cmptno) \
|
#define jas_image_cmpttly(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->tly_)
|
((image)->cmpts_[cmptno]->tly_)
|
||||||
|
|
||||||
/* Get the x-coordinate of the bottom-right corner of a component
|
/* Get the x-coordinate of the bottom-right corner of a component
|
||||||
(plus "one"). */
|
(plus "one"). */
|
||||||
#define jas_image_cmptbrx(image, cmptno) \
|
#define jas_image_cmptbrx(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
|
((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
|
||||||
(image)->cmpts_[cmptno]->hstep_)
|
(image)->cmpts_[cmptno]->hstep_)
|
||||||
|
|
||||||
/* Get the y-coordinate of the bottom-right corner of a component
|
/* Get the y-coordinate of the bottom-right corner of a component
|
||||||
(plus "one"). */
|
(plus "one"). */
|
||||||
#define jas_image_cmptbry(image, cmptno) \
|
#define jas_image_cmptbry(image, cmptno) \
|
||||||
((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
|
((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
|
||||||
(image)->cmpts_[cmptno]->vstep_)
|
(image)->cmpts_[cmptno]->vstep_)
|
||||||
|
|
||||||
/* Get the raw size of an image (i.e., the nominal size of the image without
|
/* Get the raw size of an image (i.e., the nominal size of the image without
|
||||||
any compression. */
|
any compression. */
|
||||||
@ -439,7 +439,7 @@ int jas_image_copycmpt(jas_image_t *dstimage, int dstcmptno,
|
|||||||
#define JAS_IMAGE_CDT_SETPREC(dtype) ((dtype) & 0x7f)
|
#define JAS_IMAGE_CDT_SETPREC(dtype) ((dtype) & 0x7f)
|
||||||
|
|
||||||
#define jas_image_cmptdtype(image, cmptno) \
|
#define jas_image_cmptdtype(image, cmptno) \
|
||||||
(JAS_IMAGE_CDT_SETSGND((image)->cmpts_[cmptno]->sgnd_) | JAS_IMAGE_CDT_SETPREC((image)->cmpts_[cmptno]->prec_))
|
(JAS_IMAGE_CDT_SETSGND((image)->cmpts_[cmptno]->sgnd_) | JAS_IMAGE_CDT_SETPREC((image)->cmpts_[cmptno]->prec_))
|
||||||
|
|
||||||
int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
|
int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
|
||||||
int_fast32_t *lutents, int dtype, int newcmptno);
|
int_fast32_t *lutents, int dtype, int newcmptno);
|
||||||
|
8
3rdparty/libjasper/jasper/jas_math.h
vendored
8
3rdparty/libjasper/jasper/jas_math.h
vendored
@ -90,20 +90,20 @@ extern "C" {
|
|||||||
|
|
||||||
/* Compute the absolute value. */
|
/* Compute the absolute value. */
|
||||||
#define JAS_ABS(x) \
|
#define JAS_ABS(x) \
|
||||||
(((x) >= 0) ? (x) : (-(x)))
|
(((x) >= 0) ? (x) : (-(x)))
|
||||||
|
|
||||||
/* Compute the minimum of two values. */
|
/* Compute the minimum of two values. */
|
||||||
#define JAS_MIN(x, y) \
|
#define JAS_MIN(x, y) \
|
||||||
(((x) < (y)) ? (x) : (y))
|
(((x) < (y)) ? (x) : (y))
|
||||||
|
|
||||||
/* Compute the maximum of two values. */
|
/* Compute the maximum of two values. */
|
||||||
#define JAS_MAX(x, y) \
|
#define JAS_MAX(x, y) \
|
||||||
(((x) > (y)) ? (x) : (y))
|
(((x) > (y)) ? (x) : (y))
|
||||||
|
|
||||||
/* Compute the remainder from division (where division is defined such
|
/* Compute the remainder from division (where division is defined such
|
||||||
that the remainder is always nonnegative). */
|
that the remainder is always nonnegative). */
|
||||||
#define JAS_MOD(x, y) \
|
#define JAS_MOD(x, y) \
|
||||||
(((x) < 0) ? (((-x) % (y)) ? ((y) - ((-(x)) % (y))) : (0)) : ((x) % (y)))
|
(((x) < 0) ? (((-x) % (y)) ? ((y) - ((-(x)) % (y))) : (0)) : ((x) % (y)))
|
||||||
|
|
||||||
/* Compute the integer with the specified number of least significant bits
|
/* Compute the integer with the specified number of least significant bits
|
||||||
set to one. */
|
set to one. */
|
||||||
|
110
3rdparty/libjasper/jasper/jas_seq.h
vendored
110
3rdparty/libjasper/jasper/jas_seq.h
vendored
@ -104,38 +104,38 @@ typedef int_fast32_t jas_matent_t;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* Additional state information. */
|
/* Additional state information. */
|
||||||
int flags_;
|
int flags_;
|
||||||
|
|
||||||
/* The starting horizontal index. */
|
/* The starting horizontal index. */
|
||||||
int_fast32_t xstart_;
|
int_fast32_t xstart_;
|
||||||
|
|
||||||
/* The starting vertical index. */
|
/* The starting vertical index. */
|
||||||
int_fast32_t ystart_;
|
int_fast32_t ystart_;
|
||||||
|
|
||||||
/* The ending horizontal index. */
|
/* The ending horizontal index. */
|
||||||
int_fast32_t xend_;
|
int_fast32_t xend_;
|
||||||
|
|
||||||
/* The ending vertical index. */
|
/* The ending vertical index. */
|
||||||
int_fast32_t yend_;
|
int_fast32_t yend_;
|
||||||
|
|
||||||
/* The number of rows in the matrix. */
|
/* The number of rows in the matrix. */
|
||||||
int_fast32_t numrows_;
|
int_fast32_t numrows_;
|
||||||
|
|
||||||
/* The number of columns in the matrix. */
|
/* The number of columns in the matrix. */
|
||||||
int_fast32_t numcols_;
|
int_fast32_t numcols_;
|
||||||
|
|
||||||
/* Pointers to the start of each row. */
|
/* Pointers to the start of each row. */
|
||||||
jas_seqent_t **rows_;
|
jas_seqent_t **rows_;
|
||||||
|
|
||||||
/* The allocated size of the rows array. */
|
/* The allocated size of the rows array. */
|
||||||
int_fast32_t maxrows_;
|
int_fast32_t maxrows_;
|
||||||
|
|
||||||
/* The matrix data buffer. */
|
/* The matrix data buffer. */
|
||||||
jas_seqent_t *data_;
|
jas_seqent_t *data_;
|
||||||
|
|
||||||
/* The allocated size of the data array. */
|
/* The allocated size of the data array. */
|
||||||
int_fast32_t datasize_;
|
int_fast32_t datasize_;
|
||||||
|
|
||||||
} jas_matrix_t;
|
} jas_matrix_t;
|
||||||
|
|
||||||
@ -148,39 +148,39 @@ typedef jas_matrix_t jas_seq_t;
|
|||||||
|
|
||||||
/* Get the number of rows. */
|
/* Get the number of rows. */
|
||||||
#define jas_matrix_numrows(matrix) \
|
#define jas_matrix_numrows(matrix) \
|
||||||
((matrix)->numrows_)
|
((matrix)->numrows_)
|
||||||
|
|
||||||
/* Get the number of columns. */
|
/* Get the number of columns. */
|
||||||
#define jas_matrix_numcols(matrix) \
|
#define jas_matrix_numcols(matrix) \
|
||||||
((matrix)->numcols_)
|
((matrix)->numcols_)
|
||||||
|
|
||||||
/* Get a matrix element. */
|
/* Get a matrix element. */
|
||||||
#define jas_matrix_get(matrix, i, j) \
|
#define jas_matrix_get(matrix, i, j) \
|
||||||
((matrix)->rows_[i][j])
|
((matrix)->rows_[i][j])
|
||||||
|
|
||||||
/* Set a matrix element. */
|
/* Set a matrix element. */
|
||||||
#define jas_matrix_set(matrix, i, j, v) \
|
#define jas_matrix_set(matrix, i, j, v) \
|
||||||
((matrix)->rows_[i][j] = (v))
|
((matrix)->rows_[i][j] = (v))
|
||||||
|
|
||||||
/* Get an element from a matrix that is known to be a row or column vector. */
|
/* Get an element from a matrix that is known to be a row or column vector. */
|
||||||
#define jas_matrix_getv(matrix, i) \
|
#define jas_matrix_getv(matrix, i) \
|
||||||
(((matrix)->numrows_ == 1) ? ((matrix)->rows_[0][i]) : \
|
(((matrix)->numrows_ == 1) ? ((matrix)->rows_[0][i]) : \
|
||||||
((matrix)->rows_[i][0]))
|
((matrix)->rows_[i][0]))
|
||||||
|
|
||||||
/* Set an element in a matrix that is known to be a row or column vector. */
|
/* Set an element in a matrix that is known to be a row or column vector. */
|
||||||
#define jas_matrix_setv(matrix, i, v) \
|
#define jas_matrix_setv(matrix, i, v) \
|
||||||
(((matrix)->numrows_ == 1) ? ((matrix)->rows_[0][i] = (v)) : \
|
(((matrix)->numrows_ == 1) ? ((matrix)->rows_[0][i] = (v)) : \
|
||||||
((matrix)->rows_[i][0] = (v)))
|
((matrix)->rows_[i][0] = (v)))
|
||||||
|
|
||||||
/* Get the address of an element in a matrix. */
|
/* Get the address of an element in a matrix. */
|
||||||
#define jas_matrix_getref(matrix, i, j) \
|
#define jas_matrix_getref(matrix, i, j) \
|
||||||
(&(matrix)->rows_[i][j])
|
(&(matrix)->rows_[i][j])
|
||||||
|
|
||||||
#define jas_matrix_getvref(matrix, i) \
|
#define jas_matrix_getvref(matrix, i) \
|
||||||
(((matrix)->numrows_ > 1) ? jas_matrix_getref(matrix, i, 0) : jas_matrix_getref(matrix, 0, i))
|
(((matrix)->numrows_ > 1) ? jas_matrix_getref(matrix, i, 0) : jas_matrix_getref(matrix, 0, i))
|
||||||
|
|
||||||
#define jas_matrix_length(matrix) \
|
#define jas_matrix_length(matrix) \
|
||||||
(max((matrix)->numrows_, (matrix)->numcols_))
|
(max((matrix)->numrows_, (matrix)->numcols_))
|
||||||
|
|
||||||
/* Create a matrix with the specified dimensions. */
|
/* Create a matrix with the specified dimensions. */
|
||||||
jas_matrix_t *jas_matrix_create(int numrows, int numcols);
|
jas_matrix_t *jas_matrix_create(int numrows, int numcols);
|
||||||
@ -223,11 +223,11 @@ void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val);
|
|||||||
|
|
||||||
/* The spacing between rows of a matrix. */
|
/* The spacing between rows of a matrix. */
|
||||||
#define jas_matrix_rowstep(matrix) \
|
#define jas_matrix_rowstep(matrix) \
|
||||||
(((matrix)->numrows_ > 1) ? ((matrix)->rows_[1] - (matrix)->rows_[0]) : (0))
|
(((matrix)->numrows_ > 1) ? ((matrix)->rows_[1] - (matrix)->rows_[0]) : (0))
|
||||||
|
|
||||||
/* The spacing between columns of a matrix. */
|
/* The spacing between columns of a matrix. */
|
||||||
#define jas_matrix_step(matrix) \
|
#define jas_matrix_step(matrix) \
|
||||||
(((matrix)->numrows_ > 1) ? (jas_matrix_rowstep(matrix)) : (1))
|
(((matrix)->numrows_ > 1) ? (jas_matrix_rowstep(matrix)) : (1))
|
||||||
|
|
||||||
/* Compare two matrices for equality. */
|
/* Compare two matrices for equality. */
|
||||||
int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1);
|
int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1);
|
||||||
@ -245,30 +245,30 @@ jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x);
|
|||||||
jas_matrix_t *jas_seq2d_create(int xstart, int ystart, int xend, int yend);
|
jas_matrix_t *jas_seq2d_create(int xstart, int ystart, int xend, int yend);
|
||||||
|
|
||||||
#define jas_seq2d_destroy(s) \
|
#define jas_seq2d_destroy(s) \
|
||||||
jas_matrix_destroy(s)
|
jas_matrix_destroy(s)
|
||||||
|
|
||||||
#define jas_seq2d_xstart(s) \
|
#define jas_seq2d_xstart(s) \
|
||||||
((s)->xstart_)
|
((s)->xstart_)
|
||||||
#define jas_seq2d_ystart(s) \
|
#define jas_seq2d_ystart(s) \
|
||||||
((s)->ystart_)
|
((s)->ystart_)
|
||||||
#define jas_seq2d_xend(s) \
|
#define jas_seq2d_xend(s) \
|
||||||
((s)->xend_)
|
((s)->xend_)
|
||||||
#define jas_seq2d_yend(s) \
|
#define jas_seq2d_yend(s) \
|
||||||
((s)->yend_)
|
((s)->yend_)
|
||||||
#define jas_seq2d_getref(s, x, y) \
|
#define jas_seq2d_getref(s, x, y) \
|
||||||
(jas_matrix_getref(s, (y) - (s)->ystart_, (x) - (s)->xstart_))
|
(jas_matrix_getref(s, (y) - (s)->ystart_, (x) - (s)->xstart_))
|
||||||
#define jas_seq2d_get(s, x, y) \
|
#define jas_seq2d_get(s, x, y) \
|
||||||
(jas_matrix_get(s, (y) - (s)->ystart_, (x) - (s)->xstart_))
|
(jas_matrix_get(s, (y) - (s)->ystart_, (x) - (s)->xstart_))
|
||||||
#define jas_seq2d_rowstep(s) \
|
#define jas_seq2d_rowstep(s) \
|
||||||
jas_matrix_rowstep(s)
|
jas_matrix_rowstep(s)
|
||||||
#define jas_seq2d_width(s) \
|
#define jas_seq2d_width(s) \
|
||||||
((s)->xend_ - (s)->xstart_)
|
((s)->xend_ - (s)->xstart_)
|
||||||
#define jas_seq2d_height(s) \
|
#define jas_seq2d_height(s) \
|
||||||
((s)->yend_ - (s)->ystart_)
|
((s)->yend_ - (s)->ystart_)
|
||||||
#define jas_seq2d_setshift(s, x, y) \
|
#define jas_seq2d_setshift(s, x, y) \
|
||||||
((s)->xstart_ = (x), (s)->ystart_ = (y), \
|
((s)->xstart_ = (x), (s)->ystart_ = (y), \
|
||||||
(s)->xend_ = (s)->xstart_ + (s)->numcols_, \
|
(s)->xend_ = (s)->xstart_ + (s)->numcols_, \
|
||||||
(s)->yend_ = (s)->ystart_ + (s)->numrows_)
|
(s)->yend_ = (s)->ystart_ + (s)->numrows_)
|
||||||
|
|
||||||
void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart,
|
void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart,
|
||||||
int ystart, int xend, int yend);
|
int ystart, int xend, int yend);
|
||||||
@ -278,21 +278,21 @@ void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart,
|
|||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
||||||
#define jas_seq_create(start, end) \
|
#define jas_seq_create(start, end) \
|
||||||
(jas_seq2d_create(start, 0, end, 1))
|
(jas_seq2d_create(start, 0, end, 1))
|
||||||
|
|
||||||
#define jas_seq_destroy(seq) \
|
#define jas_seq_destroy(seq) \
|
||||||
(jas_seq2d_destroy(seq))
|
(jas_seq2d_destroy(seq))
|
||||||
|
|
||||||
#define jas_seq_set(seq, i, v) \
|
#define jas_seq_set(seq, i, v) \
|
||||||
((seq)->rows_[0][(i) - (seq)->xstart_] = (v))
|
((seq)->rows_[0][(i) - (seq)->xstart_] = (v))
|
||||||
#define jas_seq_getref(seq, i) \
|
#define jas_seq_getref(seq, i) \
|
||||||
(&(seq)->rows_[0][(i) - (seq)->xstart_])
|
(&(seq)->rows_[0][(i) - (seq)->xstart_])
|
||||||
#define jas_seq_get(seq, i) \
|
#define jas_seq_get(seq, i) \
|
||||||
((seq)->rows_[0][(i) - (seq)->xstart_])
|
((seq)->rows_[0][(i) - (seq)->xstart_])
|
||||||
#define jas_seq_start(seq) \
|
#define jas_seq_start(seq) \
|
||||||
((seq)->xstart_)
|
((seq)->xstart_)
|
||||||
#define jas_seq_end(seq) \
|
#define jas_seq_end(seq) \
|
||||||
((seq)->xend_)
|
((seq)->xend_)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
150
3rdparty/libjasper/jasper/jas_stream.h
vendored
150
3rdparty/libjasper/jasper/jas_stream.h
vendored
@ -149,7 +149,7 @@ extern "C" {
|
|||||||
#define JAS_STREAM_RWLIMIT 0x0004
|
#define JAS_STREAM_RWLIMIT 0x0004
|
||||||
/* The error mask. */
|
/* The error mask. */
|
||||||
#define JAS_STREAM_ERRMASK \
|
#define JAS_STREAM_ERRMASK \
|
||||||
(JAS_STREAM_EOF | JAS_STREAM_ERR | JAS_STREAM_RWLIMIT)
|
(JAS_STREAM_EOF | JAS_STREAM_ERR | JAS_STREAM_RWLIMIT)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Other miscellaneous constants.
|
* Other miscellaneous constants.
|
||||||
@ -179,17 +179,17 @@ typedef void jas_stream_obj_t;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* Read characters from a file object. */
|
/* Read characters from a file object. */
|
||||||
int (*read_)(jas_stream_obj_t *obj, char *buf, int cnt);
|
int (*read_)(jas_stream_obj_t *obj, char *buf, int cnt);
|
||||||
|
|
||||||
/* Write characters to a file object. */
|
/* Write characters to a file object. */
|
||||||
int (*write_)(jas_stream_obj_t *obj, char *buf, int cnt);
|
int (*write_)(jas_stream_obj_t *obj, char *buf, int cnt);
|
||||||
|
|
||||||
/* Set the position for a file object. */
|
/* Set the position for a file object. */
|
||||||
long (*seek_)(jas_stream_obj_t *obj, long offset, int origin);
|
long (*seek_)(jas_stream_obj_t *obj, long offset, int origin);
|
||||||
|
|
||||||
/* Close a file object. */
|
/* Close a file object. */
|
||||||
int (*close_)(jas_stream_obj_t *obj);
|
int (*close_)(jas_stream_obj_t *obj);
|
||||||
|
|
||||||
} jas_stream_ops_t;
|
} jas_stream_ops_t;
|
||||||
|
|
||||||
@ -199,46 +199,46 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The mode in which the stream was opened. */
|
/* The mode in which the stream was opened. */
|
||||||
int openmode_;
|
int openmode_;
|
||||||
|
|
||||||
/* The buffering mode. */
|
/* The buffering mode. */
|
||||||
int bufmode_;
|
int bufmode_;
|
||||||
|
|
||||||
/* The stream status. */
|
/* The stream status. */
|
||||||
int flags_;
|
int flags_;
|
||||||
|
|
||||||
/* The start of the buffer area to use for reading/writing. */
|
/* The start of the buffer area to use for reading/writing. */
|
||||||
uchar *bufbase_;
|
uchar *bufbase_;
|
||||||
|
|
||||||
/* The start of the buffer area excluding the extra initial space for
|
/* The start of the buffer area excluding the extra initial space for
|
||||||
character putback. */
|
character putback. */
|
||||||
uchar *bufstart_;
|
uchar *bufstart_;
|
||||||
|
|
||||||
/* The buffer size. */
|
/* The buffer size. */
|
||||||
int bufsize_;
|
int bufsize_;
|
||||||
|
|
||||||
/* The current position in the buffer. */
|
/* The current position in the buffer. */
|
||||||
uchar *ptr_;
|
uchar *ptr_;
|
||||||
|
|
||||||
/* The number of characters that must be read/written before
|
/* The number of characters that must be read/written before
|
||||||
the buffer needs to be filled/flushed. */
|
the buffer needs to be filled/flushed. */
|
||||||
int cnt_;
|
int cnt_;
|
||||||
|
|
||||||
/* A trivial buffer to be used for unbuffered operation. */
|
/* A trivial buffer to be used for unbuffered operation. */
|
||||||
uchar tinybuf_[JAS_STREAM_MAXPUTBACK + 1];
|
uchar tinybuf_[JAS_STREAM_MAXPUTBACK + 1];
|
||||||
|
|
||||||
/* The operations for the underlying stream file object. */
|
/* The operations for the underlying stream file object. */
|
||||||
jas_stream_ops_t *ops_;
|
jas_stream_ops_t *ops_;
|
||||||
|
|
||||||
/* The underlying stream file object. */
|
/* The underlying stream file object. */
|
||||||
jas_stream_obj_t *obj_;
|
jas_stream_obj_t *obj_;
|
||||||
|
|
||||||
/* The number of characters read/written. */
|
/* The number of characters read/written. */
|
||||||
long rwcnt_;
|
long rwcnt_;
|
||||||
|
|
||||||
/* The maximum number of characters that may be read/written. */
|
/* The maximum number of characters that may be read/written. */
|
||||||
long rwlimit_;
|
long rwlimit_;
|
||||||
|
|
||||||
} jas_stream_t;
|
} jas_stream_t;
|
||||||
|
|
||||||
@ -250,12 +250,12 @@ typedef struct {
|
|||||||
* File descriptor file object.
|
* File descriptor file object.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int fd;
|
int fd;
|
||||||
int flags;
|
int flags;
|
||||||
#if defined _WIN32 && !defined __MINGW__ && !defined __MINGW32__
|
#if defined _WIN32 && !defined __MINGW__ && !defined __MINGW32__
|
||||||
char pathname[MAX_PATH + 1];
|
char pathname[MAX_PATH + 1];
|
||||||
#else
|
#else
|
||||||
char pathname[PATH_MAX + 1];
|
char pathname[PATH_MAX + 1];
|
||||||
#endif
|
#endif
|
||||||
} jas_stream_fileobj_t;
|
} jas_stream_fileobj_t;
|
||||||
|
|
||||||
@ -268,23 +268,23 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The data associated with this file. */
|
/* The data associated with this file. */
|
||||||
uchar *buf_;
|
uchar *buf_;
|
||||||
|
|
||||||
/* The allocated size of the buffer for holding file data. */
|
/* The allocated size of the buffer for holding file data. */
|
||||||
int bufsize_;
|
int bufsize_;
|
||||||
|
|
||||||
/* The length of the file. */
|
/* The length of the file. */
|
||||||
int_fast32_t len_;
|
int_fast32_t len_;
|
||||||
|
|
||||||
/* The seek position. */
|
/* The seek position. */
|
||||||
int_fast32_t pos_;
|
int_fast32_t pos_;
|
||||||
|
|
||||||
/* Is the buffer growable? */
|
/* Is the buffer growable? */
|
||||||
int growable_;
|
int growable_;
|
||||||
|
|
||||||
/* Was the buffer allocated internally? */
|
/* Was the buffer allocated internally? */
|
||||||
int myalloc_;
|
int myalloc_;
|
||||||
|
|
||||||
} jas_stream_memobj_t;
|
} jas_stream_memobj_t;
|
||||||
|
|
||||||
@ -316,26 +316,26 @@ int jas_stream_close(jas_stream_t *stream);
|
|||||||
|
|
||||||
/* Get the EOF indicator for a stream. */
|
/* Get the EOF indicator for a stream. */
|
||||||
#define jas_stream_eof(stream) \
|
#define jas_stream_eof(stream) \
|
||||||
(((stream)->flags_ & JAS_STREAM_EOF) != 0)
|
(((stream)->flags_ & JAS_STREAM_EOF) != 0)
|
||||||
|
|
||||||
/* Get the error indicator for a stream. */
|
/* Get the error indicator for a stream. */
|
||||||
#define jas_stream_error(stream) \
|
#define jas_stream_error(stream) \
|
||||||
(((stream)->flags_ & JAS_STREAM_ERR) != 0)
|
(((stream)->flags_ & JAS_STREAM_ERR) != 0)
|
||||||
|
|
||||||
/* Clear the error indicator for a stream. */
|
/* Clear the error indicator for a stream. */
|
||||||
#define jas_stream_clearerr(stream) \
|
#define jas_stream_clearerr(stream) \
|
||||||
((stream)->flags_ &= ~(JAS_STREAM_ERR | JAS_STREAM_EOF))
|
((stream)->flags_ &= ~(JAS_STREAM_ERR | JAS_STREAM_EOF))
|
||||||
|
|
||||||
/* Get the read/write limit for a stream. */
|
/* Get the read/write limit for a stream. */
|
||||||
#define jas_stream_getrwlimit(stream) \
|
#define jas_stream_getrwlimit(stream) \
|
||||||
(((const jas_stream_t *)(stream))->rwlimit_)
|
(((const jas_stream_t *)(stream))->rwlimit_)
|
||||||
|
|
||||||
/* Set the read/write limit for a stream. */
|
/* Set the read/write limit for a stream. */
|
||||||
int jas_stream_setrwlimit(jas_stream_t *stream, long rwlimit);
|
int jas_stream_setrwlimit(jas_stream_t *stream, long rwlimit);
|
||||||
|
|
||||||
/* Get the read/write count for a stream. */
|
/* Get the read/write count for a stream. */
|
||||||
#define jas_stream_getrwcount(stream) \
|
#define jas_stream_getrwcount(stream) \
|
||||||
(((const jas_stream_t *)(stream))->rwcnt_)
|
(((const jas_stream_t *)(stream))->rwcnt_)
|
||||||
|
|
||||||
/* Set the read/write count for a stream. */
|
/* Set the read/write count for a stream. */
|
||||||
long jas_stream_setrwcount(jas_stream_t *stream, long rwcnt);
|
long jas_stream_setrwcount(jas_stream_t *stream, long rwcnt);
|
||||||
@ -376,8 +376,8 @@ char *jas_stream_gets(jas_stream_t *stream, char *buf, int bufsize);
|
|||||||
/* Look at the next character to be read from a stream without actually
|
/* Look at the next character to be read from a stream without actually
|
||||||
removing it from the stream. */
|
removing it from the stream. */
|
||||||
#define jas_stream_peekc(stream) \
|
#define jas_stream_peekc(stream) \
|
||||||
(((stream)->cnt_ <= 0) ? jas_stream_fillbuf(stream, 0) : \
|
(((stream)->cnt_ <= 0) ? jas_stream_fillbuf(stream, 0) : \
|
||||||
((int)(*(stream)->ptr_)))
|
((int)(*(stream)->ptr_)))
|
||||||
|
|
||||||
/* Put a character back on a stream. */
|
/* Put a character back on a stream. */
|
||||||
int jas_stream_ungetc(jas_stream_t *stream, int c);
|
int jas_stream_ungetc(jas_stream_t *stream, int c);
|
||||||
@ -434,26 +434,26 @@ directly, you will die a horrible, miserable, and painful death! */
|
|||||||
|
|
||||||
/* Read a character from a stream. */
|
/* Read a character from a stream. */
|
||||||
#define jas_stream_getc_macro(stream) \
|
#define jas_stream_getc_macro(stream) \
|
||||||
((!((stream)->flags_ & (JAS_STREAM_ERR | JAS_STREAM_EOF | \
|
((!((stream)->flags_ & (JAS_STREAM_ERR | JAS_STREAM_EOF | \
|
||||||
JAS_STREAM_RWLIMIT))) ? \
|
JAS_STREAM_RWLIMIT))) ? \
|
||||||
(((stream)->rwlimit_ >= 0 && (stream)->rwcnt_ >= (stream)->rwlimit_) ? \
|
(((stream)->rwlimit_ >= 0 && (stream)->rwcnt_ >= (stream)->rwlimit_) ? \
|
||||||
(stream->flags_ |= JAS_STREAM_RWLIMIT, EOF) : \
|
(stream->flags_ |= JAS_STREAM_RWLIMIT, EOF) : \
|
||||||
jas_stream_getc2(stream)) : EOF)
|
jas_stream_getc2(stream)) : EOF)
|
||||||
#define jas_stream_getc2(stream) \
|
#define jas_stream_getc2(stream) \
|
||||||
((--(stream)->cnt_ < 0) ? jas_stream_fillbuf(stream, 1) : \
|
((--(stream)->cnt_ < 0) ? jas_stream_fillbuf(stream, 1) : \
|
||||||
(++(stream)->rwcnt_, (int)(*(stream)->ptr_++)))
|
(++(stream)->rwcnt_, (int)(*(stream)->ptr_++)))
|
||||||
|
|
||||||
/* Write a character to a stream. */
|
/* Write a character to a stream. */
|
||||||
#define jas_stream_putc_macro(stream, c) \
|
#define jas_stream_putc_macro(stream, c) \
|
||||||
((!((stream)->flags_ & (JAS_STREAM_ERR | JAS_STREAM_EOF | \
|
((!((stream)->flags_ & (JAS_STREAM_ERR | JAS_STREAM_EOF | \
|
||||||
JAS_STREAM_RWLIMIT))) ? \
|
JAS_STREAM_RWLIMIT))) ? \
|
||||||
(((stream)->rwlimit_ >= 0 && (stream)->rwcnt_ >= (stream)->rwlimit_) ? \
|
(((stream)->rwlimit_ >= 0 && (stream)->rwcnt_ >= (stream)->rwlimit_) ? \
|
||||||
(stream->flags_ |= JAS_STREAM_RWLIMIT, EOF) : \
|
(stream->flags_ |= JAS_STREAM_RWLIMIT, EOF) : \
|
||||||
jas_stream_putc2(stream, c)) : EOF)
|
jas_stream_putc2(stream, c)) : EOF)
|
||||||
#define jas_stream_putc2(stream, c) \
|
#define jas_stream_putc2(stream, c) \
|
||||||
(((stream)->bufmode_ |= JAS_STREAM_WRBUF, --(stream)->cnt_ < 0) ? \
|
(((stream)->bufmode_ |= JAS_STREAM_WRBUF, --(stream)->cnt_ < 0) ? \
|
||||||
jas_stream_flushbuf((stream), (uchar)(c)) : \
|
jas_stream_flushbuf((stream), (uchar)(c)) : \
|
||||||
(++(stream)->rwcnt_, (int)(*(stream)->ptr_++ = (c))))
|
(++(stream)->rwcnt_, (int)(*(stream)->ptr_++ = (c))))
|
||||||
|
|
||||||
/* These prototypes need to be here for the sake of the stream_getc and
|
/* These prototypes need to be here for the sake of the stream_getc and
|
||||||
stream_putc macros. */
|
stream_putc macros. */
|
||||||
|
8
3rdparty/libjasper/jasper/jas_tmr.h
vendored
8
3rdparty/libjasper/jasper/jas_tmr.h
vendored
@ -75,15 +75,15 @@ extern "C" {
|
|||||||
#if defined(HAVE_GETTIMEOFDAY)
|
#if defined(HAVE_GETTIMEOFDAY)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct timeval start;
|
struct timeval start;
|
||||||
struct timeval stop;
|
struct timeval stop;
|
||||||
} jas_tmr_t;
|
} jas_tmr_t;
|
||||||
|
|
||||||
#elif defined(HAVE_GETRUSAGE)
|
#elif defined(HAVE_GETRUSAGE)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct rusage start;
|
struct rusage start;
|
||||||
struct rusage stop;
|
struct rusage stop;
|
||||||
} jas_tmr_t;
|
} jas_tmr_t;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
24
3rdparty/libjasper/jasper/jas_tvp.h
vendored
24
3rdparty/libjasper/jasper/jas_tvp.h
vendored
@ -86,11 +86,11 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
/* The ID for the tag. */
|
/* The ID for the tag. */
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
/* The name of the tag. */
|
/* The name of the tag. */
|
||||||
|
|
||||||
} jas_taginfo_t;
|
} jas_taginfo_t;
|
||||||
|
|
||||||
@ -98,17 +98,17 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
char *buf;
|
char *buf;
|
||||||
/* The parsing buffer. */
|
/* The parsing buffer. */
|
||||||
|
|
||||||
char *tag;
|
char *tag;
|
||||||
/* The current tag name. */
|
/* The current tag name. */
|
||||||
|
|
||||||
char *val;
|
char *val;
|
||||||
/* The current value. */
|
/* The current value. */
|
||||||
|
|
||||||
char *pos;
|
char *pos;
|
||||||
/* The current position in the parsing buffer. */
|
/* The current position in the parsing buffer. */
|
||||||
|
|
||||||
} jas_tvparser_t;
|
} jas_tvparser_t;
|
||||||
|
|
||||||
|
2
3rdparty/libjasper/jasper/jas_types.h
vendored
2
3rdparty/libjasper/jasper/jas_types.h
vendored
@ -215,7 +215,7 @@ typedef ulonglong uint_fast64_t;
|
|||||||
macro, type casts can be easily located in the source code with
|
macro, type casts can be easily located in the source code with
|
||||||
tools like "grep". */
|
tools like "grep". */
|
||||||
#define JAS_CAST(t, e) \
|
#define JAS_CAST(t, e) \
|
||||||
((t) (e))
|
((t) (e))
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
32
3rdparty/libjasper/jasper/jas_version.h
vendored
32
3rdparty/libjasper/jasper/jas_version.h
vendored
@ -85,24 +85,24 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define JAS_COPYRIGHT \
|
#define JAS_COPYRIGHT \
|
||||||
"Copyright (c) 2001-2006 Michael David Adams.\n" \
|
"Copyright (c) 2001-2006 Michael David Adams.\n" \
|
||||||
"Copyright (c) 1999-2000 Image Power, Inc. and the University of\n" \
|
"Copyright (c) 1999-2000 Image Power, Inc. and the University of\n" \
|
||||||
" British Columbia.\n" \
|
" British Columbia.\n" \
|
||||||
"All rights reserved.\n"
|
"All rights reserved.\n"
|
||||||
|
|
||||||
#define JAS_NOTES \
|
#define JAS_NOTES \
|
||||||
"For more information about this software, please visit the following\n" \
|
"For more information about this software, please visit the following\n" \
|
||||||
"web sites/pages:\n" \
|
"web sites/pages:\n" \
|
||||||
" http://www.ece.uvic.ca/~mdadams/jasper\n" \
|
" http://www.ece.uvic.ca/~mdadams/jasper\n" \
|
||||||
" http://www.jpeg.org/software\n" \
|
" http://www.jpeg.org/software\n" \
|
||||||
"To be added to the (moderated) JasPer software announcements\n" \
|
"To be added to the (moderated) JasPer software announcements\n" \
|
||||||
"mailing list, send an email to:\n" \
|
"mailing list, send an email to:\n" \
|
||||||
" jasper-announce-subscribe@yahoogroups.com\n" \
|
" jasper-announce-subscribe@yahoogroups.com\n" \
|
||||||
"To be added to the (unmoderated) JasPer software discussion\n" \
|
"To be added to the (unmoderated) JasPer software discussion\n" \
|
||||||
"mailing list, send an email to:\n" \
|
"mailing list, send an email to:\n" \
|
||||||
" jasper-discussion-subscribe@yahoogroups.com\n" \
|
" jasper-discussion-subscribe@yahoogroups.com\n" \
|
||||||
"Please send any bug reports to:\n" \
|
"Please send any bug reports to:\n" \
|
||||||
" mdadams@ieee.org\n"
|
" mdadams@ieee.org\n"
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Functions.
|
* Functions.
|
||||||
|
1166
3rdparty/libjasper/jp2_cod.c
vendored
1166
3rdparty/libjasper/jp2_cod.c
vendored
File diff suppressed because it is too large
Load Diff
132
3rdparty/libjasper/jp2_cod.h
vendored
132
3rdparty/libjasper/jp2_cod.h
vendored
@ -86,7 +86,7 @@
|
|||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
||||||
#define JP2_SPTOBPC(s, p) \
|
#define JP2_SPTOBPC(s, p) \
|
||||||
((((p) - 1) & 0x7f) | (((s) & 1) << 7))
|
((((p) - 1) & 0x7f) | (((s) & 1) << 7))
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Box class.
|
* Box class.
|
||||||
@ -124,7 +124,7 @@
|
|||||||
#define JP2_JP_LEN 12
|
#define JP2_JP_LEN 12
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast32_t magic;
|
uint_fast32_t magic;
|
||||||
} jp2_jp_t;
|
} jp2_jp_t;
|
||||||
|
|
||||||
/* FTYP box data. */
|
/* FTYP box data. */
|
||||||
@ -135,10 +135,10 @@ typedef struct {
|
|||||||
#define JP2_FTYP_COMPATCODE JP2_FTYP_MAJVER
|
#define JP2_FTYP_COMPATCODE JP2_FTYP_MAJVER
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast32_t majver;
|
uint_fast32_t majver;
|
||||||
uint_fast32_t minver;
|
uint_fast32_t minver;
|
||||||
uint_fast32_t numcompatcodes;
|
uint_fast32_t numcompatcodes;
|
||||||
uint_fast32_t compatcodes[JP2_FTYP_MAXCOMPATCODES];
|
uint_fast32_t compatcodes[JP2_FTYP_MAXCOMPATCODES];
|
||||||
} jp2_ftyp_t;
|
} jp2_ftyp_t;
|
||||||
|
|
||||||
/* IHDR box data. */
|
/* IHDR box data. */
|
||||||
@ -147,20 +147,20 @@ typedef struct {
|
|||||||
#define JP2_IHDR_BPCNULL 255
|
#define JP2_IHDR_BPCNULL 255
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast32_t width;
|
uint_fast32_t width;
|
||||||
uint_fast32_t height;
|
uint_fast32_t height;
|
||||||
uint_fast16_t numcmpts;
|
uint_fast16_t numcmpts;
|
||||||
uint_fast8_t bpc;
|
uint_fast8_t bpc;
|
||||||
uint_fast8_t comptype;
|
uint_fast8_t comptype;
|
||||||
uint_fast8_t csunk;
|
uint_fast8_t csunk;
|
||||||
uint_fast8_t ipr;
|
uint_fast8_t ipr;
|
||||||
} jp2_ihdr_t;
|
} jp2_ihdr_t;
|
||||||
|
|
||||||
/* BPCC box data. */
|
/* BPCC box data. */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast16_t numcmpts;
|
uint_fast16_t numcmpts;
|
||||||
uint_fast8_t *bpcs;
|
uint_fast8_t *bpcs;
|
||||||
} jp2_bpcc_t;
|
} jp2_bpcc_t;
|
||||||
|
|
||||||
/* COLR box data. */
|
/* COLR box data. */
|
||||||
@ -174,22 +174,22 @@ typedef struct {
|
|||||||
#define JP2_COLR_SYCC 18
|
#define JP2_COLR_SYCC 18
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast8_t method;
|
uint_fast8_t method;
|
||||||
uint_fast8_t pri;
|
uint_fast8_t pri;
|
||||||
uint_fast8_t approx;
|
uint_fast8_t approx;
|
||||||
uint_fast32_t csid;
|
uint_fast32_t csid;
|
||||||
uint_fast8_t *iccp;
|
uint_fast8_t *iccp;
|
||||||
int iccplen;
|
int iccplen;
|
||||||
/* XXX - Someday we ought to add ICC profile data here. */
|
/* XXX - Someday we ought to add ICC profile data here. */
|
||||||
} jp2_colr_t;
|
} jp2_colr_t;
|
||||||
|
|
||||||
/* PCLR box data. */
|
/* PCLR box data. */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast16_t numlutents;
|
uint_fast16_t numlutents;
|
||||||
uint_fast8_t numchans;
|
uint_fast8_t numchans;
|
||||||
int_fast32_t *lutdata;
|
int_fast32_t *lutdata;
|
||||||
uint_fast8_t *bpc;
|
uint_fast8_t *bpc;
|
||||||
} jp2_pclr_t;
|
} jp2_pclr_t;
|
||||||
|
|
||||||
/* CDEF box per-channel data. */
|
/* CDEF box per-channel data. */
|
||||||
@ -211,33 +211,33 @@ typedef struct {
|
|||||||
#define JP2_CDEF_ASOC_NONE 65535
|
#define JP2_CDEF_ASOC_NONE 65535
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast16_t channo;
|
uint_fast16_t channo;
|
||||||
uint_fast16_t type;
|
uint_fast16_t type;
|
||||||
uint_fast16_t assoc;
|
uint_fast16_t assoc;
|
||||||
} jp2_cdefchan_t;
|
} jp2_cdefchan_t;
|
||||||
|
|
||||||
/* CDEF box data. */
|
/* CDEF box data. */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast16_t numchans;
|
uint_fast16_t numchans;
|
||||||
jp2_cdefchan_t *ents;
|
jp2_cdefchan_t *ents;
|
||||||
} jp2_cdef_t;
|
} jp2_cdef_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast16_t cmptno;
|
uint_fast16_t cmptno;
|
||||||
uint_fast8_t map;
|
uint_fast8_t map;
|
||||||
uint_fast8_t pcol;
|
uint_fast8_t pcol;
|
||||||
} jp2_cmapent_t;
|
} jp2_cmapent_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast16_t numchans;
|
uint_fast16_t numchans;
|
||||||
jp2_cmapent_t *ents;
|
jp2_cmapent_t *ents;
|
||||||
} jp2_cmap_t;
|
} jp2_cmap_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_fast32_t datalen;
|
uint_fast32_t datalen;
|
||||||
uint_fast8_t uuid[16];
|
uint_fast8_t uuid[16];
|
||||||
uint_fast8_t *data;
|
uint_fast8_t *data;
|
||||||
} jp2_uuid_t;
|
} jp2_uuid_t;
|
||||||
|
|
||||||
#define JP2_CMAP_DIRECT 0
|
#define JP2_CMAP_DIRECT 0
|
||||||
@ -248,37 +248,37 @@ typedef struct {
|
|||||||
struct jp2_boxops_s;
|
struct jp2_boxops_s;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
struct jp2_boxops_s *ops;
|
struct jp2_boxops_s *ops;
|
||||||
struct jp2_boxinfo_s *info;
|
struct jp2_boxinfo_s *info;
|
||||||
|
|
||||||
uint_fast32_t type;
|
uint_fast32_t type;
|
||||||
|
|
||||||
/* The length of the box including the (variable-length) header. */
|
/* The length of the box including the (variable-length) header. */
|
||||||
uint_fast32_t len;
|
uint_fast32_t len;
|
||||||
|
|
||||||
/* The length of the box data. */
|
/* The length of the box data. */
|
||||||
uint_fast32_t datalen;
|
uint_fast32_t datalen;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
jp2_jp_t jp;
|
jp2_jp_t jp;
|
||||||
jp2_ftyp_t ftyp;
|
jp2_ftyp_t ftyp;
|
||||||
jp2_ihdr_t ihdr;
|
jp2_ihdr_t ihdr;
|
||||||
jp2_bpcc_t bpcc;
|
jp2_bpcc_t bpcc;
|
||||||
jp2_colr_t colr;
|
jp2_colr_t colr;
|
||||||
jp2_pclr_t pclr;
|
jp2_pclr_t pclr;
|
||||||
jp2_cdef_t cdef;
|
jp2_cdef_t cdef;
|
||||||
jp2_cmap_t cmap;
|
jp2_cmap_t cmap;
|
||||||
jp2_uuid_t uuid;
|
jp2_uuid_t uuid;
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
} jp2_box_t;
|
} jp2_box_t;
|
||||||
|
|
||||||
typedef struct jp2_boxops_s {
|
typedef struct jp2_boxops_s {
|
||||||
void (*init)(jp2_box_t *box);
|
void (*init)(jp2_box_t *box);
|
||||||
void (*destroy)(jp2_box_t *box);
|
void (*destroy)(jp2_box_t *box);
|
||||||
int (*getdata)(jp2_box_t *box, jas_stream_t *in);
|
int (*getdata)(jp2_box_t *box, jas_stream_t *in);
|
||||||
int (*putdata)(jp2_box_t *box, jas_stream_t *out);
|
int (*putdata)(jp2_box_t *box, jas_stream_t *out);
|
||||||
void (*dumpdata)(jp2_box_t *box, FILE *out);
|
void (*dumpdata)(jp2_box_t *box, FILE *out);
|
||||||
} jp2_boxops_t;
|
} jp2_boxops_t;
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -286,10 +286,10 @@ typedef struct jp2_boxops_s {
|
|||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
||||||
typedef struct jp2_boxinfo_s {
|
typedef struct jp2_boxinfo_s {
|
||||||
int type;
|
int type;
|
||||||
char *name;
|
char *name;
|
||||||
int flags;
|
int flags;
|
||||||
jp2_boxops_t ops;
|
jp2_boxops_t ops;
|
||||||
} jp2_boxinfo_t;
|
} jp2_boxinfo_t;
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
|
866
3rdparty/libjasper/jp2_dec.c
vendored
866
3rdparty/libjasper/jp2_dec.c
vendored
@ -95,509 +95,509 @@ static int jp2_getct(int colorspace, int type, int assoc);
|
|||||||
|
|
||||||
jas_image_t *jp2_decode(jas_stream_t *in, char *optstr)
|
jas_image_t *jp2_decode(jas_stream_t *in, char *optstr)
|
||||||
{
|
{
|
||||||
jp2_box_t *box;
|
jp2_box_t *box;
|
||||||
int found;
|
int found;
|
||||||
jas_image_t *image;
|
jas_image_t *image;
|
||||||
jp2_dec_t *dec;
|
jp2_dec_t *dec;
|
||||||
bool samedtype;
|
bool samedtype;
|
||||||
int dtype;
|
int dtype;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
jp2_cmap_t *cmapd;
|
jp2_cmap_t *cmapd;
|
||||||
jp2_pclr_t *pclrd;
|
jp2_pclr_t *pclrd;
|
||||||
jp2_cdef_t *cdefd;
|
jp2_cdef_t *cdefd;
|
||||||
unsigned int channo;
|
unsigned int channo;
|
||||||
int newcmptno;
|
int newcmptno;
|
||||||
int_fast32_t *lutents;
|
int_fast32_t *lutents;
|
||||||
#if 0
|
#if 0
|
||||||
jp2_cdefchan_t *cdefent;
|
jp2_cdefchan_t *cdefent;
|
||||||
int cmptno;
|
int cmptno;
|
||||||
#endif
|
#endif
|
||||||
jp2_cmapent_t *cmapent;
|
jp2_cmapent_t *cmapent;
|
||||||
jas_icchdr_t icchdr;
|
jas_icchdr_t icchdr;
|
||||||
jas_iccprof_t *iccprof;
|
jas_iccprof_t *iccprof;
|
||||||
|
|
||||||
dec = 0;
|
dec = 0;
|
||||||
box = 0;
|
box = 0;
|
||||||
image = 0;
|
image = 0;
|
||||||
|
|
||||||
if (!(dec = jp2_dec_create())) {
|
if (!(dec = jp2_dec_create())) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the first box. This should be a JP box. */
|
/* Get the first box. This should be a JP box. */
|
||||||
if (!(box = jp2_box_get(in))) {
|
if (!(box = jp2_box_get(in))) {
|
||||||
jas_eprintf("error: cannot get box\n");
|
jas_eprintf("error: cannot get box\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (box->type != JP2_BOX_JP) {
|
if (box->type != JP2_BOX_JP) {
|
||||||
jas_eprintf("error: expecting signature box\n");
|
jas_eprintf("error: expecting signature box\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (box->data.jp.magic != JP2_JP_MAGIC) {
|
if (box->data.jp.magic != JP2_JP_MAGIC) {
|
||||||
jas_eprintf("incorrect magic number\n");
|
jas_eprintf("incorrect magic number\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
|
|
||||||
/* Get the second box. This should be a FTYP box. */
|
/* Get the second box. This should be a FTYP box. */
|
||||||
if (!(box = jp2_box_get(in))) {
|
if (!(box = jp2_box_get(in))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (box->type != JP2_BOX_FTYP) {
|
if (box->type != JP2_BOX_FTYP) {
|
||||||
jas_eprintf("expecting file type box\n");
|
jas_eprintf("expecting file type box\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
|
|
||||||
/* Get more boxes... */
|
/* Get more boxes... */
|
||||||
found = 0;
|
found = 0;
|
||||||
while ((box = jp2_box_get(in))) {
|
while ((box = jp2_box_get(in))) {
|
||||||
if (jas_getdbglevel() >= 1) {
|
if (jas_getdbglevel() >= 1) {
|
||||||
jas_eprintf("box type %s\n", box->info->name);
|
jas_eprintf("box type %s\n", box->info->name);
|
||||||
}
|
}
|
||||||
switch (box->type) {
|
switch (box->type) {
|
||||||
case JP2_BOX_JP2C:
|
case JP2_BOX_JP2C:
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
case JP2_BOX_IHDR:
|
case JP2_BOX_IHDR:
|
||||||
if (!dec->ihdr) {
|
if (!dec->ihdr) {
|
||||||
dec->ihdr = box;
|
dec->ihdr = box;
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JP2_BOX_BPCC:
|
case JP2_BOX_BPCC:
|
||||||
if (!dec->bpcc) {
|
if (!dec->bpcc) {
|
||||||
dec->bpcc = box;
|
dec->bpcc = box;
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JP2_BOX_CDEF:
|
case JP2_BOX_CDEF:
|
||||||
if (!dec->cdef) {
|
if (!dec->cdef) {
|
||||||
dec->cdef = box;
|
dec->cdef = box;
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JP2_BOX_PCLR:
|
case JP2_BOX_PCLR:
|
||||||
if (!dec->pclr) {
|
if (!dec->pclr) {
|
||||||
dec->pclr = box;
|
dec->pclr = box;
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JP2_BOX_CMAP:
|
case JP2_BOX_CMAP:
|
||||||
if (!dec->cmap) {
|
if (!dec->cmap) {
|
||||||
dec->cmap = box;
|
dec->cmap = box;
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JP2_BOX_COLR:
|
case JP2_BOX_COLR:
|
||||||
if (!dec->colr) {
|
if (!dec->colr) {
|
||||||
dec->colr = box;
|
dec->colr = box;
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (box) {
|
if (box) {
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
jas_eprintf("error: no code stream found\n");
|
jas_eprintf("error: no code stream found\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dec->image = jpc_decode(in, optstr))) {
|
if (!(dec->image = jpc_decode(in, optstr))) {
|
||||||
jas_eprintf("error: cannot decode code stream\n");
|
jas_eprintf("error: cannot decode code stream\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* An IHDR box must be present. */
|
/* An IHDR box must be present. */
|
||||||
if (!dec->ihdr) {
|
if (!dec->ihdr) {
|
||||||
jas_eprintf("error: missing IHDR box\n");
|
jas_eprintf("error: missing IHDR box\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does the number of components indicated in the IHDR box match
|
/* Does the number of components indicated in the IHDR box match
|
||||||
the value specified in the code stream? */
|
the value specified in the code stream? */
|
||||||
if (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(uint, jas_image_numcmpts(dec->image))) {
|
if (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(uint, jas_image_numcmpts(dec->image))) {
|
||||||
jas_eprintf("warning: number of components mismatch\n");
|
jas_eprintf("warning: number of components mismatch\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At least one component must be present. */
|
/* At least one component must be present. */
|
||||||
if (!jas_image_numcmpts(dec->image)) {
|
if (!jas_image_numcmpts(dec->image)) {
|
||||||
jas_eprintf("error: no components\n");
|
jas_eprintf("error: no components\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine if all components have the same data type. */
|
/* Determine if all components have the same data type. */
|
||||||
samedtype = true;
|
samedtype = true;
|
||||||
dtype = jas_image_cmptdtype(dec->image, 0);
|
dtype = jas_image_cmptdtype(dec->image, 0);
|
||||||
for (i = 1; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
|
for (i = 1; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
|
||||||
if (jas_image_cmptdtype(dec->image, i) != dtype) {
|
if (jas_image_cmptdtype(dec->image, i) != dtype) {
|
||||||
samedtype = false;
|
samedtype = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the component data type indicated in the IHDR box consistent
|
/* Is the component data type indicated in the IHDR box consistent
|
||||||
with the data in the code stream? */
|
with the data in the code stream? */
|
||||||
if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||
|
if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||
|
||||||
(!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {
|
(!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {
|
||||||
jas_eprintf("warning: component data type mismatch\n");
|
jas_eprintf("warning: component data type mismatch\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the compression type supported? */
|
/* Is the compression type supported? */
|
||||||
if (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {
|
if (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {
|
||||||
jas_eprintf("error: unsupported compression type\n");
|
jas_eprintf("error: unsupported compression type\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dec->bpcc) {
|
if (dec->bpcc) {
|
||||||
/* Is the number of components indicated in the BPCC box
|
/* Is the number of components indicated in the BPCC box
|
||||||
consistent with the code stream data? */
|
consistent with the code stream data? */
|
||||||
if (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(uint, jas_image_numcmpts(
|
if (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(uint, jas_image_numcmpts(
|
||||||
dec->image))) {
|
dec->image))) {
|
||||||
jas_eprintf("warning: number of components mismatch\n");
|
jas_eprintf("warning: number of components mismatch\n");
|
||||||
}
|
}
|
||||||
/* Is the component data type information indicated in the BPCC
|
/* Is the component data type information indicated in the BPCC
|
||||||
box consistent with the code stream data? */
|
box consistent with the code stream data? */
|
||||||
if (!samedtype) {
|
if (!samedtype) {
|
||||||
for (i = 0; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
|
for (i = 0; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
|
||||||
if (jas_image_cmptdtype(dec->image, i) != JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {
|
if (jas_image_cmptdtype(dec->image, i) != JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {
|
||||||
jas_eprintf("warning: component data type mismatch\n");
|
jas_eprintf("warning: component data type mismatch\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
jas_eprintf("warning: superfluous BPCC box\n");
|
jas_eprintf("warning: superfluous BPCC box\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A COLR box must be present. */
|
/* A COLR box must be present. */
|
||||||
if (!dec->colr) {
|
if (!dec->colr) {
|
||||||
jas_eprintf("error: no COLR box\n");
|
jas_eprintf("error: no COLR box\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dec->colr->data.colr.method) {
|
switch (dec->colr->data.colr.method) {
|
||||||
case JP2_COLR_ENUM:
|
case JP2_COLR_ENUM:
|
||||||
jas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));
|
jas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));
|
||||||
break;
|
break;
|
||||||
case JP2_COLR_ICC:
|
case JP2_COLR_ICC:
|
||||||
iccprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,
|
iccprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,
|
||||||
dec->colr->data.colr.iccplen);
|
dec->colr->data.colr.iccplen);
|
||||||
assert(iccprof);
|
assert(iccprof);
|
||||||
jas_iccprof_gethdr(iccprof, &icchdr);
|
jas_iccprof_gethdr(iccprof, &icchdr);
|
||||||
jas_eprintf("ICC Profile CS %08x\n", icchdr.colorspc);
|
jas_eprintf("ICC Profile CS %08x\n", icchdr.colorspc);
|
||||||
jas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));
|
jas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));
|
||||||
dec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);
|
dec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);
|
||||||
assert(dec->image->cmprof_);
|
assert(dec->image->cmprof_);
|
||||||
jas_iccprof_destroy(iccprof);
|
jas_iccprof_destroy(iccprof);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a CMAP box is present, a PCLR box must also be present. */
|
/* If a CMAP box is present, a PCLR box must also be present. */
|
||||||
if (dec->cmap && !dec->pclr) {
|
if (dec->cmap && !dec->pclr) {
|
||||||
jas_eprintf("warning: missing PCLR box or superfluous CMAP box\n");
|
jas_eprintf("warning: missing PCLR box or superfluous CMAP box\n");
|
||||||
jp2_box_destroy(dec->cmap);
|
jp2_box_destroy(dec->cmap);
|
||||||
dec->cmap = 0;
|
dec->cmap = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a CMAP box is not present, a PCLR box must not be present. */
|
/* If a CMAP box is not present, a PCLR box must not be present. */
|
||||||
if (!dec->cmap && dec->pclr) {
|
if (!dec->cmap && dec->pclr) {
|
||||||
jas_eprintf("warning: missing CMAP box or superfluous PCLR box\n");
|
jas_eprintf("warning: missing CMAP box or superfluous PCLR box\n");
|
||||||
jp2_box_destroy(dec->pclr);
|
jp2_box_destroy(dec->pclr);
|
||||||
dec->pclr = 0;
|
dec->pclr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the number of channels (which is essentially the number
|
/* Determine the number of channels (which is essentially the number
|
||||||
of components after any palette mappings have been applied). */
|
of components after any palette mappings have been applied). */
|
||||||
dec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans : JAS_CAST(uint, jas_image_numcmpts(dec->image));
|
dec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans : JAS_CAST(uint, jas_image_numcmpts(dec->image));
|
||||||
|
|
||||||
/* Perform a basic sanity check on the CMAP box if present. */
|
/* Perform a basic sanity check on the CMAP box if present. */
|
||||||
if (dec->cmap) {
|
if (dec->cmap) {
|
||||||
for (i = 0; i < dec->numchans; ++i) {
|
for (i = 0; i < dec->numchans; ++i) {
|
||||||
/* Is the component number reasonable? */
|
/* Is the component number reasonable? */
|
||||||
if (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(uint, jas_image_numcmpts(dec->image))) {
|
if (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(uint, jas_image_numcmpts(dec->image))) {
|
||||||
jas_eprintf("error: invalid component number in CMAP box\n");
|
jas_eprintf("error: invalid component number in CMAP box\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/* Is the LUT index reasonable? */
|
/* Is the LUT index reasonable? */
|
||||||
if (dec->cmap->data.cmap.ents[i].pcol >= dec->pclr->data.pclr.numchans) {
|
if (dec->cmap->data.cmap.ents[i].pcol >= dec->pclr->data.pclr.numchans) {
|
||||||
jas_eprintf("error: invalid CMAP LUT index\n");
|
jas_eprintf("error: invalid CMAP LUT index\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate space for the channel-number to component-number LUT. */
|
/* Allocate space for the channel-number to component-number LUT. */
|
||||||
if (!(dec->chantocmptlut = jas_alloc2(dec->numchans, sizeof(uint_fast16_t)))) {
|
if (!(dec->chantocmptlut = jas_alloc2(dec->numchans, sizeof(uint_fast16_t)))) {
|
||||||
jas_eprintf("error: no memory\n");
|
jas_eprintf("error: no memory\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dec->cmap) {
|
if (!dec->cmap) {
|
||||||
for (i = 0; i < dec->numchans; ++i) {
|
for (i = 0; i < dec->numchans; ++i) {
|
||||||
dec->chantocmptlut[i] = i;
|
dec->chantocmptlut[i] = i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cmapd = &dec->cmap->data.cmap;
|
cmapd = &dec->cmap->data.cmap;
|
||||||
pclrd = &dec->pclr->data.pclr;
|
pclrd = &dec->pclr->data.pclr;
|
||||||
cdefd = &dec->cdef->data.cdef;
|
cdefd = &dec->cdef->data.cdef;
|
||||||
for (channo = 0; channo < cmapd->numchans; ++channo) {
|
for (channo = 0; channo < cmapd->numchans; ++channo) {
|
||||||
cmapent = &cmapd->ents[channo];
|
cmapent = &cmapd->ents[channo];
|
||||||
if (cmapent->map == JP2_CMAP_DIRECT) {
|
if (cmapent->map == JP2_CMAP_DIRECT) {
|
||||||
dec->chantocmptlut[channo] = channo;
|
dec->chantocmptlut[channo] = channo;
|
||||||
} else if (cmapent->map == JP2_CMAP_PALETTE) {
|
} else if (cmapent->map == JP2_CMAP_PALETTE) {
|
||||||
lutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));
|
lutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));
|
||||||
for (i = 0; i < pclrd->numlutents; ++i) {
|
for (i = 0; i < pclrd->numlutents; ++i) {
|
||||||
lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];
|
lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];
|
||||||
}
|
}
|
||||||
newcmptno = jas_image_numcmpts(dec->image);
|
newcmptno = jas_image_numcmpts(dec->image);
|
||||||
jas_image_depalettize(dec->image, cmapent->cmptno, pclrd->numlutents, lutents, JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);
|
jas_image_depalettize(dec->image, cmapent->cmptno, pclrd->numlutents, lutents, JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);
|
||||||
dec->chantocmptlut[channo] = newcmptno;
|
dec->chantocmptlut[channo] = newcmptno;
|
||||||
jas_free(lutents);
|
jas_free(lutents);
|
||||||
#if 0
|
#if 0
|
||||||
if (dec->cdef) {
|
if (dec->cdef) {
|
||||||
cdefent = jp2_cdef_lookup(cdefd, channo);
|
cdefent = jp2_cdef_lookup(cdefd, channo);
|
||||||
if (!cdefent) {
|
if (!cdefent) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));
|
jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));
|
||||||
} else {
|
} else {
|
||||||
jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));
|
jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark all components as being of unknown type. */
|
/* Mark all components as being of unknown type. */
|
||||||
|
|
||||||
for (i = 0; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
|
for (i = 0; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
|
||||||
jas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);
|
jas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the type of each component. */
|
/* Determine the type of each component. */
|
||||||
if (dec->cdef) {
|
if (dec->cdef) {
|
||||||
for (i = 0; i < dec->numchans; ++i) {
|
for (i = 0; i < dec->numchans; ++i) {
|
||||||
jas_image_setcmpttype(dec->image,
|
jas_image_setcmpttype(dec->image,
|
||||||
dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],
|
dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],
|
||||||
jp2_getct(jas_image_clrspc(dec->image),
|
jp2_getct(jas_image_clrspc(dec->image),
|
||||||
dec->cdef->data.cdef.ents[i].type, dec->cdef->data.cdef.ents[i].assoc));
|
dec->cdef->data.cdef.ents[i].type, dec->cdef->data.cdef.ents[i].assoc));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < dec->numchans; ++i) {
|
for (i = 0; i < dec->numchans; ++i) {
|
||||||
jas_image_setcmpttype(dec->image, dec->chantocmptlut[i],
|
jas_image_setcmpttype(dec->image, dec->chantocmptlut[i],
|
||||||
jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));
|
jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete any components that are not of interest. */
|
/* Delete any components that are not of interest. */
|
||||||
for (i = jas_image_numcmpts(dec->image); i > 0; --i) {
|
for (i = jas_image_numcmpts(dec->image); i > 0; --i) {
|
||||||
if (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {
|
if (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {
|
||||||
jas_image_delcmpt(dec->image, i - 1);
|
jas_image_delcmpt(dec->image, i - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that some components survived. */
|
/* Ensure that some components survived. */
|
||||||
if (!jas_image_numcmpts(dec->image)) {
|
if (!jas_image_numcmpts(dec->image)) {
|
||||||
jas_eprintf("error: no components\n");
|
jas_eprintf("error: no components\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
jas_eprintf("no of components is %d\n", jas_image_numcmpts(dec->image));
|
jas_eprintf("no of components is %d\n", jas_image_numcmpts(dec->image));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Prevent the image from being destroyed later. */
|
/* Prevent the image from being destroyed later. */
|
||||||
image = dec->image;
|
image = dec->image;
|
||||||
dec->image = 0;
|
dec->image = 0;
|
||||||
|
|
||||||
jp2_dec_destroy(dec);
|
jp2_dec_destroy(dec);
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (box) {
|
if (box) {
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
}
|
}
|
||||||
if (dec) {
|
if (dec) {
|
||||||
jp2_dec_destroy(dec);
|
jp2_dec_destroy(dec);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jp2_validate(jas_stream_t *in)
|
int jp2_validate(jas_stream_t *in)
|
||||||
{
|
{
|
||||||
char buf[JP2_VALIDATELEN];
|
char buf[JP2_VALIDATELEN];
|
||||||
int i;
|
int i;
|
||||||
int n;
|
int n;
|
||||||
#if 0
|
#if 0
|
||||||
jas_stream_t *tmpstream;
|
jas_stream_t *tmpstream;
|
||||||
jp2_box_t *box;
|
jp2_box_t *box;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert(JAS_STREAM_MAXPUTBACK >= JP2_VALIDATELEN);
|
assert(JAS_STREAM_MAXPUTBACK >= JP2_VALIDATELEN);
|
||||||
|
|
||||||
/* Read the validation data (i.e., the data used for detecting
|
/* Read the validation data (i.e., the data used for detecting
|
||||||
the format). */
|
the format). */
|
||||||
if ((n = jas_stream_read(in, buf, JP2_VALIDATELEN)) < 0) {
|
if ((n = jas_stream_read(in, buf, JP2_VALIDATELEN)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the validation data back onto the stream, so that the
|
/* Put the validation data back onto the stream, so that the
|
||||||
stream position will not be changed. */
|
stream position will not be changed. */
|
||||||
for (i = n - 1; i >= 0; --i) {
|
for (i = n - 1; i >= 0; --i) {
|
||||||
if (jas_stream_ungetc(in, buf[i]) == EOF) {
|
if (jas_stream_ungetc(in, buf[i]) == EOF) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Did we read enough data? */
|
/* Did we read enough data? */
|
||||||
if (n < JP2_VALIDATELEN) {
|
if (n < JP2_VALIDATELEN) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the box type correct? */
|
/* Is the box type correct? */
|
||||||
if (((buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7]) !=
|
if (((buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7]) !=
|
||||||
JP2_BOX_JP)
|
JP2_BOX_JP)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jp2_dec_t *jp2_dec_create(void)
|
static jp2_dec_t *jp2_dec_create(void)
|
||||||
{
|
{
|
||||||
jp2_dec_t *dec;
|
jp2_dec_t *dec;
|
||||||
|
|
||||||
if (!(dec = jas_malloc(sizeof(jp2_dec_t)))) {
|
if (!(dec = jas_malloc(sizeof(jp2_dec_t)))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
dec->ihdr = 0;
|
dec->ihdr = 0;
|
||||||
dec->bpcc = 0;
|
dec->bpcc = 0;
|
||||||
dec->cdef = 0;
|
dec->cdef = 0;
|
||||||
dec->pclr = 0;
|
dec->pclr = 0;
|
||||||
dec->image = 0;
|
dec->image = 0;
|
||||||
dec->chantocmptlut = 0;
|
dec->chantocmptlut = 0;
|
||||||
dec->cmap = 0;
|
dec->cmap = 0;
|
||||||
dec->colr = 0;
|
dec->colr = 0;
|
||||||
return dec;
|
return dec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jp2_dec_destroy(jp2_dec_t *dec)
|
static void jp2_dec_destroy(jp2_dec_t *dec)
|
||||||
{
|
{
|
||||||
if (dec->ihdr) {
|
if (dec->ihdr) {
|
||||||
jp2_box_destroy(dec->ihdr);
|
jp2_box_destroy(dec->ihdr);
|
||||||
}
|
}
|
||||||
if (dec->bpcc) {
|
if (dec->bpcc) {
|
||||||
jp2_box_destroy(dec->bpcc);
|
jp2_box_destroy(dec->bpcc);
|
||||||
}
|
}
|
||||||
if (dec->cdef) {
|
if (dec->cdef) {
|
||||||
jp2_box_destroy(dec->cdef);
|
jp2_box_destroy(dec->cdef);
|
||||||
}
|
}
|
||||||
if (dec->pclr) {
|
if (dec->pclr) {
|
||||||
jp2_box_destroy(dec->pclr);
|
jp2_box_destroy(dec->pclr);
|
||||||
}
|
}
|
||||||
if (dec->image) {
|
if (dec->image) {
|
||||||
jas_image_destroy(dec->image);
|
jas_image_destroy(dec->image);
|
||||||
}
|
}
|
||||||
if (dec->cmap) {
|
if (dec->cmap) {
|
||||||
jp2_box_destroy(dec->cmap);
|
jp2_box_destroy(dec->cmap);
|
||||||
}
|
}
|
||||||
if (dec->colr) {
|
if (dec->colr) {
|
||||||
jp2_box_destroy(dec->colr);
|
jp2_box_destroy(dec->colr);
|
||||||
}
|
}
|
||||||
if (dec->chantocmptlut) {
|
if (dec->chantocmptlut) {
|
||||||
jas_free(dec->chantocmptlut);
|
jas_free(dec->chantocmptlut);
|
||||||
}
|
}
|
||||||
jas_free(dec);
|
jas_free(dec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jp2_getct(int colorspace, int type, int assoc)
|
static int jp2_getct(int colorspace, int type, int assoc)
|
||||||
{
|
{
|
||||||
if (type == 1 && assoc == 0) {
|
if (type == 1 && assoc == 0) {
|
||||||
return JAS_IMAGE_CT_OPACITY;
|
return JAS_IMAGE_CT_OPACITY;
|
||||||
}
|
}
|
||||||
if (type == 0 && assoc >= 1 && assoc <= 65534) {
|
if (type == 0 && assoc >= 1 && assoc <= 65534) {
|
||||||
switch (colorspace) {
|
switch (colorspace) {
|
||||||
case JAS_CLRSPC_FAM_RGB:
|
case JAS_CLRSPC_FAM_RGB:
|
||||||
switch (assoc) {
|
switch (assoc) {
|
||||||
case JP2_CDEF_RGB_R:
|
case JP2_CDEF_RGB_R:
|
||||||
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R);
|
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R);
|
||||||
break;
|
break;
|
||||||
case JP2_CDEF_RGB_G:
|
case JP2_CDEF_RGB_G:
|
||||||
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G);
|
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G);
|
||||||
break;
|
break;
|
||||||
case JP2_CDEF_RGB_B:
|
case JP2_CDEF_RGB_B:
|
||||||
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B);
|
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JAS_CLRSPC_FAM_YCBCR:
|
case JAS_CLRSPC_FAM_YCBCR:
|
||||||
switch (assoc) {
|
switch (assoc) {
|
||||||
case JP2_CDEF_YCBCR_Y:
|
case JP2_CDEF_YCBCR_Y:
|
||||||
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_Y);
|
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_Y);
|
||||||
break;
|
break;
|
||||||
case JP2_CDEF_YCBCR_CB:
|
case JP2_CDEF_YCBCR_CB:
|
||||||
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CB);
|
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CB);
|
||||||
break;
|
break;
|
||||||
case JP2_CDEF_YCBCR_CR:
|
case JP2_CDEF_YCBCR_CR:
|
||||||
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CR);
|
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JAS_CLRSPC_FAM_GRAY:
|
case JAS_CLRSPC_FAM_GRAY:
|
||||||
switch (assoc) {
|
switch (assoc) {
|
||||||
case JP2_CDEF_GRAY_Y:
|
case JP2_CDEF_GRAY_Y:
|
||||||
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y);
|
return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return JAS_IMAGE_CT_COLOR(assoc - 1);
|
return JAS_IMAGE_CT_COLOR(assoc - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return JAS_IMAGE_CT_UNKNOWN;
|
return JAS_IMAGE_CT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jp2_getcs(jp2_colr_t *colr)
|
static int jp2_getcs(jp2_colr_t *colr)
|
||||||
{
|
{
|
||||||
if (colr->method == JP2_COLR_ENUM) {
|
if (colr->method == JP2_COLR_ENUM) {
|
||||||
switch (colr->csid) {
|
switch (colr->csid) {
|
||||||
case JP2_COLR_SRGB:
|
case JP2_COLR_SRGB:
|
||||||
return JAS_CLRSPC_SRGB;
|
return JAS_CLRSPC_SRGB;
|
||||||
break;
|
break;
|
||||||
case JP2_COLR_SYCC:
|
case JP2_COLR_SYCC:
|
||||||
return JAS_CLRSPC_SYCBCR;
|
return JAS_CLRSPC_SYCBCR;
|
||||||
break;
|
break;
|
||||||
case JP2_COLR_SGRAY:
|
case JP2_COLR_SGRAY:
|
||||||
return JAS_CLRSPC_SGRAY;
|
return JAS_CLRSPC_SGRAY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return JAS_CLRSPC_UNKNOWN;
|
return JAS_CLRSPC_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fromiccpcs(int cs)
|
static int fromiccpcs(int cs)
|
||||||
{
|
{
|
||||||
switch (cs) {
|
switch (cs) {
|
||||||
case ICC_CS_RGB:
|
case ICC_CS_RGB:
|
||||||
return JAS_CLRSPC_GENRGB;
|
return JAS_CLRSPC_GENRGB;
|
||||||
break;
|
break;
|
||||||
case ICC_CS_YCBCR:
|
case ICC_CS_YCBCR:
|
||||||
return JAS_CLRSPC_GENYCBCR;
|
return JAS_CLRSPC_GENYCBCR;
|
||||||
break;
|
break;
|
||||||
case ICC_CS_GRAY:
|
case ICC_CS_GRAY:
|
||||||
return JAS_CLRSPC_GENGRAY;
|
return JAS_CLRSPC_GENGRAY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return JAS_CLRSPC_UNKNOWN;
|
return JAS_CLRSPC_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
18
3rdparty/libjasper/jp2_dec.h
vendored
18
3rdparty/libjasper/jp2_dec.h
vendored
@ -70,15 +70,15 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
jp2_box_t *pclr;
|
jp2_box_t *pclr;
|
||||||
jp2_box_t *cdef;
|
jp2_box_t *cdef;
|
||||||
jp2_box_t *ihdr;
|
jp2_box_t *ihdr;
|
||||||
jp2_box_t *bpcc;
|
jp2_box_t *bpcc;
|
||||||
jp2_box_t *cmap;
|
jp2_box_t *cmap;
|
||||||
jp2_box_t *colr;
|
jp2_box_t *colr;
|
||||||
jas_image_t *image;
|
jas_image_t *image;
|
||||||
uint_fast16_t numchans;
|
uint_fast16_t numchans;
|
||||||
uint_fast16_t *chantocmptlut;
|
uint_fast16_t *chantocmptlut;
|
||||||
|
|
||||||
} jp2_dec_t;
|
} jp2_dec_t;
|
||||||
|
|
||||||
|
636
3rdparty/libjasper/jp2_enc.c
vendored
636
3rdparty/libjasper/jp2_enc.c
vendored
@ -93,19 +93,19 @@ static int clrspctojp2(jas_clrspc_t clrspc);
|
|||||||
|
|
||||||
int jp2_write_header(jas_image_t *image, jas_stream_t *out)
|
int jp2_write_header(jas_image_t *image, jas_stream_t *out)
|
||||||
{
|
{
|
||||||
jp2_box_t *box;
|
jp2_box_t *box;
|
||||||
jp2_ftyp_t *ftyp;
|
jp2_ftyp_t *ftyp;
|
||||||
jp2_ihdr_t *ihdr;
|
jp2_ihdr_t *ihdr;
|
||||||
jas_stream_t *tmpstream;
|
jas_stream_t *tmpstream;
|
||||||
int allcmptssame;
|
int allcmptssame;
|
||||||
jp2_bpcc_t *bpcc;
|
jp2_bpcc_t *bpcc;
|
||||||
long len;
|
long len;
|
||||||
uint_fast16_t cmptno;
|
uint_fast16_t cmptno;
|
||||||
jp2_colr_t *colr;
|
jp2_colr_t *colr;
|
||||||
jp2_cdefchan_t *cdefchanent;
|
jp2_cdefchan_t *cdefchanent;
|
||||||
jp2_cdef_t *cdef;
|
jp2_cdef_t *cdef;
|
||||||
int i;
|
int i;
|
||||||
uint_fast32_t typeasoc;
|
uint_fast32_t typeasoc;
|
||||||
jas_iccprof_t *iccprof;
|
jas_iccprof_t *iccprof;
|
||||||
jas_stream_t *iccstream;
|
jas_stream_t *iccstream;
|
||||||
int pos;
|
int pos;
|
||||||
@ -113,369 +113,369 @@ int needcdef;
|
|||||||
int prec;
|
int prec;
|
||||||
int sgnd;
|
int sgnd;
|
||||||
|
|
||||||
box = 0;
|
box = 0;
|
||||||
tmpstream = 0;
|
tmpstream = 0;
|
||||||
|
|
||||||
allcmptssame = 1;
|
allcmptssame = 1;
|
||||||
sgnd = jas_image_cmptsgnd(image, 0);
|
sgnd = jas_image_cmptsgnd(image, 0);
|
||||||
prec = jas_image_cmptprec(image, 0);
|
prec = jas_image_cmptprec(image, 0);
|
||||||
for (i = 1; i < jas_image_numcmpts(image); ++i) {
|
for (i = 1; i < jas_image_numcmpts(image); ++i) {
|
||||||
if (jas_image_cmptsgnd(image, i) != sgnd ||
|
if (jas_image_cmptsgnd(image, i) != sgnd ||
|
||||||
jas_image_cmptprec(image, i) != prec) {
|
jas_image_cmptprec(image, i) != prec) {
|
||||||
allcmptssame = 0;
|
allcmptssame = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output the signature box. */
|
/* Output the signature box. */
|
||||||
|
|
||||||
if (!(box = jp2_box_create(JP2_BOX_JP))) {
|
if (!(box = jp2_box_create(JP2_BOX_JP))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
box->data.jp.magic = JP2_JP_MAGIC;
|
box->data.jp.magic = JP2_JP_MAGIC;
|
||||||
if (jp2_box_put(box, out)) {
|
if (jp2_box_put(box, out)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
|
|
||||||
/* Output the file type box. */
|
/* Output the file type box. */
|
||||||
|
|
||||||
if (!(box = jp2_box_create(JP2_BOX_FTYP))) {
|
if (!(box = jp2_box_create(JP2_BOX_FTYP))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
ftyp = &box->data.ftyp;
|
ftyp = &box->data.ftyp;
|
||||||
ftyp->majver = JP2_FTYP_MAJVER;
|
ftyp->majver = JP2_FTYP_MAJVER;
|
||||||
ftyp->minver = JP2_FTYP_MINVER;
|
ftyp->minver = JP2_FTYP_MINVER;
|
||||||
ftyp->numcompatcodes = 1;
|
ftyp->numcompatcodes = 1;
|
||||||
ftyp->compatcodes[0] = JP2_FTYP_COMPATCODE;
|
ftyp->compatcodes[0] = JP2_FTYP_COMPATCODE;
|
||||||
if (jp2_box_put(box, out)) {
|
if (jp2_box_put(box, out)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate the data portion of the JP2 header box.
|
* Generate the data portion of the JP2 header box.
|
||||||
* We cannot simply output the header for this box
|
* We cannot simply output the header for this box
|
||||||
* since we do not yet know the correct value for the length
|
* since we do not yet know the correct value for the length
|
||||||
* field.
|
* field.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!(tmpstream = jas_stream_memopen(0, 0))) {
|
if (!(tmpstream = jas_stream_memopen(0, 0))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate image header box. */
|
/* Generate image header box. */
|
||||||
|
|
||||||
if (!(box = jp2_box_create(JP2_BOX_IHDR))) {
|
if (!(box = jp2_box_create(JP2_BOX_IHDR))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
ihdr = &box->data.ihdr;
|
ihdr = &box->data.ihdr;
|
||||||
ihdr->width = jas_image_width(image);
|
ihdr->width = jas_image_width(image);
|
||||||
ihdr->height = jas_image_height(image);
|
ihdr->height = jas_image_height(image);
|
||||||
ihdr->numcmpts = jas_image_numcmpts(image);
|
ihdr->numcmpts = jas_image_numcmpts(image);
|
||||||
ihdr->bpc = allcmptssame ? JP2_SPTOBPC(jas_image_cmptsgnd(image, 0),
|
ihdr->bpc = allcmptssame ? JP2_SPTOBPC(jas_image_cmptsgnd(image, 0),
|
||||||
jas_image_cmptprec(image, 0)) : JP2_IHDR_BPCNULL;
|
jas_image_cmptprec(image, 0)) : JP2_IHDR_BPCNULL;
|
||||||
ihdr->comptype = JP2_IHDR_COMPTYPE;
|
ihdr->comptype = JP2_IHDR_COMPTYPE;
|
||||||
ihdr->csunk = 0;
|
ihdr->csunk = 0;
|
||||||
ihdr->ipr = 0;
|
ihdr->ipr = 0;
|
||||||
if (jp2_box_put(box, tmpstream)) {
|
if (jp2_box_put(box, tmpstream)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
|
|
||||||
/* Generate bits per component box. */
|
/* Generate bits per component box. */
|
||||||
|
|
||||||
if (!allcmptssame) {
|
if (!allcmptssame) {
|
||||||
if (!(box = jp2_box_create(JP2_BOX_BPCC))) {
|
if (!(box = jp2_box_create(JP2_BOX_BPCC))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
bpcc = &box->data.bpcc;
|
bpcc = &box->data.bpcc;
|
||||||
bpcc->numcmpts = jas_image_numcmpts(image);
|
bpcc->numcmpts = jas_image_numcmpts(image);
|
||||||
if (!(bpcc->bpcs = jas_alloc2(bpcc->numcmpts,
|
if (!(bpcc->bpcs = jas_alloc2(bpcc->numcmpts,
|
||||||
sizeof(uint_fast8_t)))) {
|
sizeof(uint_fast8_t)))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
for (cmptno = 0; cmptno < bpcc->numcmpts; ++cmptno) {
|
for (cmptno = 0; cmptno < bpcc->numcmpts; ++cmptno) {
|
||||||
bpcc->bpcs[cmptno] = JP2_SPTOBPC(jas_image_cmptsgnd(image,
|
bpcc->bpcs[cmptno] = JP2_SPTOBPC(jas_image_cmptsgnd(image,
|
||||||
cmptno), jas_image_cmptprec(image, cmptno));
|
cmptno), jas_image_cmptprec(image, cmptno));
|
||||||
}
|
}
|
||||||
if (jp2_box_put(box, tmpstream)) {
|
if (jp2_box_put(box, tmpstream)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate color specification box. */
|
/* Generate color specification box. */
|
||||||
|
|
||||||
if (!(box = jp2_box_create(JP2_BOX_COLR))) {
|
if (!(box = jp2_box_create(JP2_BOX_COLR))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
colr = &box->data.colr;
|
colr = &box->data.colr;
|
||||||
switch (jas_image_clrspc(image)) {
|
switch (jas_image_clrspc(image)) {
|
||||||
case JAS_CLRSPC_SRGB:
|
case JAS_CLRSPC_SRGB:
|
||||||
case JAS_CLRSPC_SYCBCR:
|
case JAS_CLRSPC_SYCBCR:
|
||||||
case JAS_CLRSPC_SGRAY:
|
case JAS_CLRSPC_SGRAY:
|
||||||
colr->method = JP2_COLR_ENUM;
|
colr->method = JP2_COLR_ENUM;
|
||||||
colr->csid = clrspctojp2(jas_image_clrspc(image));
|
colr->csid = clrspctojp2(jas_image_clrspc(image));
|
||||||
colr->pri = JP2_COLR_PRI;
|
colr->pri = JP2_COLR_PRI;
|
||||||
colr->approx = 0;
|
colr->approx = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
colr->method = JP2_COLR_ICC;
|
colr->method = JP2_COLR_ICC;
|
||||||
colr->pri = JP2_COLR_PRI;
|
colr->pri = JP2_COLR_PRI;
|
||||||
colr->approx = 0;
|
colr->approx = 0;
|
||||||
iccprof = jas_iccprof_createfromcmprof(jas_image_cmprof(image));
|
iccprof = jas_iccprof_createfromcmprof(jas_image_cmprof(image));
|
||||||
assert(iccprof);
|
assert(iccprof);
|
||||||
iccstream = jas_stream_memopen(0, 0);
|
iccstream = jas_stream_memopen(0, 0);
|
||||||
assert(iccstream);
|
assert(iccstream);
|
||||||
if (jas_iccprof_save(iccprof, iccstream))
|
if (jas_iccprof_save(iccprof, iccstream))
|
||||||
abort();
|
abort();
|
||||||
if ((pos = jas_stream_tell(iccstream)) < 0)
|
if ((pos = jas_stream_tell(iccstream)) < 0)
|
||||||
abort();
|
abort();
|
||||||
colr->iccplen = pos;
|
colr->iccplen = pos;
|
||||||
colr->iccp = jas_malloc(pos);
|
colr->iccp = jas_malloc(pos);
|
||||||
assert(colr->iccp);
|
assert(colr->iccp);
|
||||||
jas_stream_rewind(iccstream);
|
jas_stream_rewind(iccstream);
|
||||||
if (jas_stream_read(iccstream, colr->iccp, colr->iccplen) != colr->iccplen)
|
if (jas_stream_read(iccstream, colr->iccp, colr->iccplen) != colr->iccplen)
|
||||||
abort();
|
abort();
|
||||||
jas_stream_close(iccstream);
|
jas_stream_close(iccstream);
|
||||||
jas_iccprof_destroy(iccprof);
|
jas_iccprof_destroy(iccprof);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (jp2_box_put(box, tmpstream)) {
|
if (jp2_box_put(box, tmpstream)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
|
|
||||||
needcdef = 1;
|
needcdef = 1;
|
||||||
switch (jas_clrspc_fam(jas_image_clrspc(image))) {
|
switch (jas_clrspc_fam(jas_image_clrspc(image))) {
|
||||||
case JAS_CLRSPC_FAM_RGB:
|
case JAS_CLRSPC_FAM_RGB:
|
||||||
if (jas_image_cmpttype(image, 0) ==
|
if (jas_image_cmpttype(image, 0) ==
|
||||||
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R) &&
|
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R) &&
|
||||||
jas_image_cmpttype(image, 1) ==
|
jas_image_cmpttype(image, 1) ==
|
||||||
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G) &&
|
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G) &&
|
||||||
jas_image_cmpttype(image, 2) ==
|
jas_image_cmpttype(image, 2) ==
|
||||||
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B))
|
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B))
|
||||||
needcdef = 0;
|
needcdef = 0;
|
||||||
break;
|
break;
|
||||||
case JAS_CLRSPC_FAM_YCBCR:
|
case JAS_CLRSPC_FAM_YCBCR:
|
||||||
if (jas_image_cmpttype(image, 0) ==
|
if (jas_image_cmpttype(image, 0) ==
|
||||||
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_Y) &&
|
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_Y) &&
|
||||||
jas_image_cmpttype(image, 1) ==
|
jas_image_cmpttype(image, 1) ==
|
||||||
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CB) &&
|
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CB) &&
|
||||||
jas_image_cmpttype(image, 2) ==
|
jas_image_cmpttype(image, 2) ==
|
||||||
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CR))
|
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CR))
|
||||||
needcdef = 0;
|
needcdef = 0;
|
||||||
break;
|
break;
|
||||||
case JAS_CLRSPC_FAM_GRAY:
|
case JAS_CLRSPC_FAM_GRAY:
|
||||||
if (jas_image_cmpttype(image, 0) ==
|
if (jas_image_cmpttype(image, 0) ==
|
||||||
JAS_IMAGE_CT_COLOR(JAS_IMAGE_CT_GRAY_Y))
|
JAS_IMAGE_CT_COLOR(JAS_IMAGE_CT_GRAY_Y))
|
||||||
needcdef = 0;
|
needcdef = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needcdef) {
|
if (needcdef) {
|
||||||
if (!(box = jp2_box_create(JP2_BOX_CDEF))) {
|
if (!(box = jp2_box_create(JP2_BOX_CDEF))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
cdef = &box->data.cdef;
|
cdef = &box->data.cdef;
|
||||||
cdef->numchans = jas_image_numcmpts(image);
|
cdef->numchans = jas_image_numcmpts(image);
|
||||||
cdef->ents = jas_alloc2(cdef->numchans, sizeof(jp2_cdefchan_t));
|
cdef->ents = jas_alloc2(cdef->numchans, sizeof(jp2_cdefchan_t));
|
||||||
for (i = 0; i < jas_image_numcmpts(image); ++i) {
|
for (i = 0; i < jas_image_numcmpts(image); ++i) {
|
||||||
cdefchanent = &cdef->ents[i];
|
cdefchanent = &cdef->ents[i];
|
||||||
cdefchanent->channo = i;
|
cdefchanent->channo = i;
|
||||||
typeasoc = jp2_gettypeasoc(jas_image_clrspc(image), jas_image_cmpttype(image, i));
|
typeasoc = jp2_gettypeasoc(jas_image_clrspc(image), jas_image_cmpttype(image, i));
|
||||||
cdefchanent->type = typeasoc >> 16;
|
cdefchanent->type = typeasoc >> 16;
|
||||||
cdefchanent->assoc = typeasoc & 0x7fff;
|
cdefchanent->assoc = typeasoc & 0x7fff;
|
||||||
}
|
}
|
||||||
if (jp2_box_put(box, tmpstream)) {
|
if (jp2_box_put(box, tmpstream)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the total length of the JP2 header box. */
|
/* Determine the total length of the JP2 header box. */
|
||||||
|
|
||||||
len = jas_stream_tell(tmpstream);
|
len = jas_stream_tell(tmpstream);
|
||||||
jas_stream_rewind(tmpstream);
|
jas_stream_rewind(tmpstream);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output the JP2 header box and all of the boxes which it contains.
|
* Output the JP2 header box and all of the boxes which it contains.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!(box = jp2_box_create(JP2_BOX_JP2H))) {
|
if (!(box = jp2_box_create(JP2_BOX_JP2H))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
box->len = len + JP2_BOX_HDRLEN(false);
|
box->len = len + JP2_BOX_HDRLEN(false);
|
||||||
if (jp2_box_put(box, out)) {
|
if (jp2_box_put(box, out)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
|
|
||||||
if (jas_stream_copy(out, tmpstream, len)) {
|
if (jas_stream_copy(out, tmpstream, len)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
jas_stream_close(tmpstream);
|
jas_stream_close(tmpstream);
|
||||||
tmpstream = 0;
|
tmpstream = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if (box) {
|
if (box) {
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
}
|
}
|
||||||
if (tmpstream) {
|
if (tmpstream) {
|
||||||
jas_stream_close(tmpstream);
|
jas_stream_close(tmpstream);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jp2_write_codestream(jas_image_t *image, jas_stream_t *out, char *optstr)
|
int jp2_write_codestream(jas_image_t *image, jas_stream_t *out, char *optstr)
|
||||||
{
|
{
|
||||||
jp2_box_t *box;
|
jp2_box_t *box;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
uint_fast32_t overhead;
|
uint_fast32_t overhead;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output the contiguous code stream box.
|
* Output the contiguous code stream box.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!(box = jp2_box_create(JP2_BOX_JP2C))) {
|
if (!(box = jp2_box_create(JP2_BOX_JP2C))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
box->len = 0;
|
box->len = 0;
|
||||||
if (jp2_box_put(box, out)) {
|
if (jp2_box_put(box, out)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
box = 0;
|
box = 0;
|
||||||
|
|
||||||
/* Output the JPEG-2000 code stream. */
|
/* Output the JPEG-2000 code stream. */
|
||||||
|
|
||||||
overhead = jas_stream_getrwcount(out);
|
overhead = jas_stream_getrwcount(out);
|
||||||
sprintf(buf, "%s\n_jp2overhead=%lu\n", (optstr ? optstr : ""),
|
sprintf(buf, "%s\n_jp2overhead=%lu\n", (optstr ? optstr : ""),
|
||||||
(unsigned long) overhead);
|
(unsigned long) overhead);
|
||||||
|
|
||||||
if (jpc_encode(image, out, buf)) {
|
if (jpc_encode(image, out, buf)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if (box) {
|
if (box) {
|
||||||
jp2_box_destroy(box);
|
jp2_box_destroy(box);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr)
|
int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr)
|
||||||
{
|
{
|
||||||
if (jp2_write_header(image, out) < 0)
|
if (jp2_write_header(image, out) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (jp2_write_codestream(image, out, optstr) < 0)
|
if (jp2_write_codestream(image, out, optstr) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jp2_encode_uuid(jas_image_t *image, jas_stream_t *out,
|
int jp2_encode_uuid(jas_image_t *image, jas_stream_t *out,
|
||||||
char *optstr, jp2_box_t *uuid)
|
char *optstr, jp2_box_t *uuid)
|
||||||
{
|
{
|
||||||
if (jp2_write_header(image, out) < 0)
|
if (jp2_write_header(image, out) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (uuid) {
|
if (uuid) {
|
||||||
if (jp2_box_put(uuid, out))
|
if (jp2_box_put(uuid, out))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (jp2_write_codestream(image, out, optstr) < 0)
|
if (jp2_write_codestream(image, out, optstr) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint_fast32_t jp2_gettypeasoc(int colorspace, int ctype)
|
static uint_fast32_t jp2_gettypeasoc(int colorspace, int ctype)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
int asoc;
|
int asoc;
|
||||||
|
|
||||||
if (ctype & JAS_IMAGE_CT_OPACITY) {
|
if (ctype & JAS_IMAGE_CT_OPACITY) {
|
||||||
type = JP2_CDEF_TYPE_OPACITY;
|
type = JP2_CDEF_TYPE_OPACITY;
|
||||||
asoc = JP2_CDEF_ASOC_ALL;
|
asoc = JP2_CDEF_ASOC_ALL;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = JP2_CDEF_TYPE_UNSPEC;
|
type = JP2_CDEF_TYPE_UNSPEC;
|
||||||
asoc = JP2_CDEF_ASOC_NONE;
|
asoc = JP2_CDEF_ASOC_NONE;
|
||||||
switch (jas_clrspc_fam(colorspace)) {
|
switch (jas_clrspc_fam(colorspace)) {
|
||||||
case JAS_CLRSPC_FAM_RGB:
|
case JAS_CLRSPC_FAM_RGB:
|
||||||
switch (JAS_IMAGE_CT_COLOR(ctype)) {
|
switch (JAS_IMAGE_CT_COLOR(ctype)) {
|
||||||
case JAS_IMAGE_CT_RGB_R:
|
case JAS_IMAGE_CT_RGB_R:
|
||||||
type = JP2_CDEF_TYPE_COLOR;
|
type = JP2_CDEF_TYPE_COLOR;
|
||||||
asoc = JP2_CDEF_RGB_R;
|
asoc = JP2_CDEF_RGB_R;
|
||||||
break;
|
break;
|
||||||
case JAS_IMAGE_CT_RGB_G:
|
case JAS_IMAGE_CT_RGB_G:
|
||||||
type = JP2_CDEF_TYPE_COLOR;
|
type = JP2_CDEF_TYPE_COLOR;
|
||||||
asoc = JP2_CDEF_RGB_G;
|
asoc = JP2_CDEF_RGB_G;
|
||||||
break;
|
break;
|
||||||
case JAS_IMAGE_CT_RGB_B:
|
case JAS_IMAGE_CT_RGB_B:
|
||||||
type = JP2_CDEF_TYPE_COLOR;
|
type = JP2_CDEF_TYPE_COLOR;
|
||||||
asoc = JP2_CDEF_RGB_B;
|
asoc = JP2_CDEF_RGB_B;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JAS_CLRSPC_FAM_YCBCR:
|
case JAS_CLRSPC_FAM_YCBCR:
|
||||||
switch (JAS_IMAGE_CT_COLOR(ctype)) {
|
switch (JAS_IMAGE_CT_COLOR(ctype)) {
|
||||||
case JAS_IMAGE_CT_YCBCR_Y:
|
case JAS_IMAGE_CT_YCBCR_Y:
|
||||||
type = JP2_CDEF_TYPE_COLOR;
|
type = JP2_CDEF_TYPE_COLOR;
|
||||||
asoc = JP2_CDEF_YCBCR_Y;
|
asoc = JP2_CDEF_YCBCR_Y;
|
||||||
break;
|
break;
|
||||||
case JAS_IMAGE_CT_YCBCR_CB:
|
case JAS_IMAGE_CT_YCBCR_CB:
|
||||||
type = JP2_CDEF_TYPE_COLOR;
|
type = JP2_CDEF_TYPE_COLOR;
|
||||||
asoc = JP2_CDEF_YCBCR_CB;
|
asoc = JP2_CDEF_YCBCR_CB;
|
||||||
break;
|
break;
|
||||||
case JAS_IMAGE_CT_YCBCR_CR:
|
case JAS_IMAGE_CT_YCBCR_CR:
|
||||||
type = JP2_CDEF_TYPE_COLOR;
|
type = JP2_CDEF_TYPE_COLOR;
|
||||||
asoc = JP2_CDEF_YCBCR_CR;
|
asoc = JP2_CDEF_YCBCR_CR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JAS_CLRSPC_FAM_GRAY:
|
case JAS_CLRSPC_FAM_GRAY:
|
||||||
type = JP2_CDEF_TYPE_COLOR;
|
type = JP2_CDEF_TYPE_COLOR;
|
||||||
asoc = JP2_CDEF_GRAY_Y;
|
asoc = JP2_CDEF_GRAY_Y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return (type << 16) | asoc;
|
return (type << 16) | asoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clrspctojp2(jas_clrspc_t clrspc)
|
static int clrspctojp2(jas_clrspc_t clrspc)
|
||||||
{
|
{
|
||||||
switch (clrspc) {
|
switch (clrspc) {
|
||||||
case JAS_CLRSPC_SRGB:
|
case JAS_CLRSPC_SRGB:
|
||||||
return JP2_COLR_SRGB;
|
return JP2_COLR_SRGB;
|
||||||
case JAS_CLRSPC_SYCBCR:
|
case JAS_CLRSPC_SYCBCR:
|
||||||
return JP2_COLR_SYCC;
|
return JP2_COLR_SYCC;
|
||||||
case JAS_CLRSPC_SGRAY:
|
case JAS_CLRSPC_SGRAY:
|
||||||
return JP2_COLR_SGRAY;
|
return JP2_COLR_SGRAY;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
474
3rdparty/libjasper/jpc_bs.c
vendored
474
3rdparty/libjasper/jpc_bs.c
vendored
@ -94,73 +94,73 @@ static jpc_bitstream_t *jpc_bitstream_alloc(void);
|
|||||||
/* Open a bit stream from a stream. */
|
/* Open a bit stream from a stream. */
|
||||||
jpc_bitstream_t *jpc_bitstream_sopen(jas_stream_t *stream, char *mode)
|
jpc_bitstream_t *jpc_bitstream_sopen(jas_stream_t *stream, char *mode)
|
||||||
{
|
{
|
||||||
jpc_bitstream_t *bitstream;
|
jpc_bitstream_t *bitstream;
|
||||||
|
|
||||||
/* Ensure that the open mode is valid. */
|
/* Ensure that the open mode is valid. */
|
||||||
#if 1
|
#if 1
|
||||||
/* This causes a string literal too long error (with c99 pedantic mode). */
|
/* This causes a string literal too long error (with c99 pedantic mode). */
|
||||||
assert(!strcmp(mode, "r") || !strcmp(mode, "w") || !strcmp(mode, "r+")
|
assert(!strcmp(mode, "r") || !strcmp(mode, "w") || !strcmp(mode, "r+")
|
||||||
|| !strcmp(mode, "w+"));
|
|| !strcmp(mode, "w+"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(bitstream = jpc_bitstream_alloc())) {
|
if (!(bitstream = jpc_bitstream_alloc())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* By default, do not close the underlying (character) stream, upon
|
/* By default, do not close the underlying (character) stream, upon
|
||||||
the close of the bit stream. */
|
the close of the bit stream. */
|
||||||
bitstream->flags_ = JPC_BITSTREAM_NOCLOSE;
|
bitstream->flags_ = JPC_BITSTREAM_NOCLOSE;
|
||||||
|
|
||||||
bitstream->stream_ = stream;
|
bitstream->stream_ = stream;
|
||||||
bitstream->openmode_ = (mode[0] == 'w') ? JPC_BITSTREAM_WRITE :
|
bitstream->openmode_ = (mode[0] == 'w') ? JPC_BITSTREAM_WRITE :
|
||||||
JPC_BITSTREAM_READ;
|
JPC_BITSTREAM_READ;
|
||||||
|
|
||||||
/* Mark the data buffer as empty. */
|
/* Mark the data buffer as empty. */
|
||||||
bitstream->cnt_ = (bitstream->openmode_ == JPC_BITSTREAM_READ) ? 0 : 8;
|
bitstream->cnt_ = (bitstream->openmode_ == JPC_BITSTREAM_READ) ? 0 : 8;
|
||||||
bitstream->buf_ = 0;
|
bitstream->buf_ = 0;
|
||||||
|
|
||||||
return bitstream;
|
return bitstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close a bit stream. */
|
/* Close a bit stream. */
|
||||||
int jpc_bitstream_close(jpc_bitstream_t *bitstream)
|
int jpc_bitstream_close(jpc_bitstream_t *bitstream)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Align to the next byte boundary while considering the effects of
|
/* Align to the next byte boundary while considering the effects of
|
||||||
bit stuffing. */
|
bit stuffing. */
|
||||||
if (jpc_bitstream_align(bitstream)) {
|
if (jpc_bitstream_align(bitstream)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If necessary, close the underlying (character) stream. */
|
/* If necessary, close the underlying (character) stream. */
|
||||||
if (!(bitstream->flags_ & JPC_BITSTREAM_NOCLOSE) && bitstream->stream_) {
|
if (!(bitstream->flags_ & JPC_BITSTREAM_NOCLOSE) && bitstream->stream_) {
|
||||||
if (jas_stream_close(bitstream->stream_)) {
|
if (jas_stream_close(bitstream->stream_)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
bitstream->stream_ = 0;
|
bitstream->stream_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
jas_free(bitstream);
|
jas_free(bitstream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a new bit stream. */
|
/* Allocate a new bit stream. */
|
||||||
static jpc_bitstream_t *jpc_bitstream_alloc()
|
static jpc_bitstream_t *jpc_bitstream_alloc()
|
||||||
{
|
{
|
||||||
jpc_bitstream_t *bitstream;
|
jpc_bitstream_t *bitstream;
|
||||||
|
|
||||||
/* Allocate memory for the new bit stream object. */
|
/* Allocate memory for the new bit stream object. */
|
||||||
if (!(bitstream = jas_malloc(sizeof(jpc_bitstream_t)))) {
|
if (!(bitstream = jas_malloc(sizeof(jpc_bitstream_t)))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Initialize all of the data members. */
|
/* Initialize all of the data members. */
|
||||||
bitstream->stream_ = 0;
|
bitstream->stream_ = 0;
|
||||||
bitstream->cnt_ = 0;
|
bitstream->cnt_ = 0;
|
||||||
bitstream->flags_ = 0;
|
bitstream->flags_ = 0;
|
||||||
bitstream->openmode_ = 0;
|
bitstream->openmode_ = 0;
|
||||||
|
|
||||||
return bitstream;
|
return bitstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -170,64 +170,64 @@ static jpc_bitstream_t *jpc_bitstream_alloc()
|
|||||||
/* Get a bit from a bit stream. */
|
/* Get a bit from a bit stream. */
|
||||||
int jpc_bitstream_getbit_func(jpc_bitstream_t *bitstream)
|
int jpc_bitstream_getbit_func(jpc_bitstream_t *bitstream)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
JAS_DBGLOG(1000, ("jpc_bitstream_getbit_func(%p)\n", bitstream));
|
JAS_DBGLOG(1000, ("jpc_bitstream_getbit_func(%p)\n", bitstream));
|
||||||
ret = jpc_bitstream_getbit_macro(bitstream);
|
ret = jpc_bitstream_getbit_macro(bitstream);
|
||||||
JAS_DBGLOG(1000, ("jpc_bitstream_getbit_func -> %d\n", ret));
|
JAS_DBGLOG(1000, ("jpc_bitstream_getbit_func -> %d\n", ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put a bit to a bit stream. */
|
/* Put a bit to a bit stream. */
|
||||||
int jpc_bitstream_putbit_func(jpc_bitstream_t *bitstream, int b)
|
int jpc_bitstream_putbit_func(jpc_bitstream_t *bitstream, int b)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
JAS_DBGLOG(1000, ("jpc_bitstream_putbit_func(%p, %d)\n", bitstream, b));
|
JAS_DBGLOG(1000, ("jpc_bitstream_putbit_func(%p, %d)\n", bitstream, b));
|
||||||
ret = jpc_bitstream_putbit_macro(bitstream, b);
|
ret = jpc_bitstream_putbit_macro(bitstream, b);
|
||||||
JAS_DBGLOG(1000, ("jpc_bitstream_putbit_func() -> %d\n", ret));
|
JAS_DBGLOG(1000, ("jpc_bitstream_putbit_func() -> %d\n", ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get one or more bits from a bit stream. */
|
/* Get one or more bits from a bit stream. */
|
||||||
long jpc_bitstream_getbits(jpc_bitstream_t *bitstream, int n)
|
long jpc_bitstream_getbits(jpc_bitstream_t *bitstream, int n)
|
||||||
{
|
{
|
||||||
long v;
|
long v;
|
||||||
int u;
|
int u;
|
||||||
|
|
||||||
/* We can reliably get at most 31 bits since ISO/IEC 9899 only
|
/* We can reliably get at most 31 bits since ISO/IEC 9899 only
|
||||||
guarantees that a long can represent values up to 2^31-1. */
|
guarantees that a long can represent values up to 2^31-1. */
|
||||||
assert(n >= 0 && n < 32);
|
assert(n >= 0 && n < 32);
|
||||||
|
|
||||||
/* Get the number of bits requested from the specified bit stream. */
|
/* Get the number of bits requested from the specified bit stream. */
|
||||||
v = 0;
|
v = 0;
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
if ((u = jpc_bitstream_getbit(bitstream)) < 0) {
|
if ((u = jpc_bitstream_getbit(bitstream)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
v = (v << 1) | u;
|
v = (v << 1) | u;
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put one or more bits to a bit stream. */
|
/* Put one or more bits to a bit stream. */
|
||||||
int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v)
|
int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
/* We can reliably put at most 31 bits since ISO/IEC 9899 only
|
/* We can reliably put at most 31 bits since ISO/IEC 9899 only
|
||||||
guarantees that a long can represent values up to 2^31-1. */
|
guarantees that a long can represent values up to 2^31-1. */
|
||||||
assert(n >= 0 && n < 32);
|
assert(n >= 0 && n < 32);
|
||||||
/* Ensure that only the bits to be output are nonzero. */
|
/* Ensure that only the bits to be output are nonzero. */
|
||||||
assert(!(v & (~JAS_ONES(n))));
|
assert(!(v & (~JAS_ONES(n))));
|
||||||
|
|
||||||
/* Put the desired number of bits to the specified bit stream. */
|
/* Put the desired number of bits to the specified bit stream. */
|
||||||
m = n - 1;
|
m = n - 1;
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
if (jpc_bitstream_putbit(bitstream, (v >> m) & 1) == EOF) {
|
if (jpc_bitstream_putbit(bitstream, (v >> m) & 1) == EOF) {
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
v <<= 1;
|
v <<= 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -237,30 +237,30 @@ int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v)
|
|||||||
/* Fill the buffer for a bit stream. */
|
/* Fill the buffer for a bit stream. */
|
||||||
int jpc_bitstream_fillbuf(jpc_bitstream_t *bitstream)
|
int jpc_bitstream_fillbuf(jpc_bitstream_t *bitstream)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
/* Note: The count has already been decremented by the caller. */
|
/* Note: The count has already been decremented by the caller. */
|
||||||
assert(bitstream->openmode_ & JPC_BITSTREAM_READ);
|
assert(bitstream->openmode_ & JPC_BITSTREAM_READ);
|
||||||
assert(bitstream->cnt_ <= 0);
|
assert(bitstream->cnt_ <= 0);
|
||||||
|
|
||||||
if (bitstream->flags_ & JPC_BITSTREAM_ERR) {
|
if (bitstream->flags_ & JPC_BITSTREAM_ERR) {
|
||||||
bitstream->cnt_ = 0;
|
bitstream->cnt_ = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitstream->flags_ & JPC_BITSTREAM_EOF) {
|
if (bitstream->flags_ & JPC_BITSTREAM_EOF) {
|
||||||
bitstream->buf_ = 0x7f;
|
bitstream->buf_ = 0x7f;
|
||||||
bitstream->cnt_ = 7;
|
bitstream->cnt_ = 7;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitstream->buf_ = (bitstream->buf_ << 8) & 0xffff;
|
bitstream->buf_ = (bitstream->buf_ << 8) & 0xffff;
|
||||||
if ((c = jas_stream_getc((bitstream)->stream_)) == EOF) {
|
if ((c = jas_stream_getc((bitstream)->stream_)) == EOF) {
|
||||||
bitstream->flags_ |= JPC_BITSTREAM_EOF;
|
bitstream->flags_ |= JPC_BITSTREAM_EOF;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
bitstream->cnt_ = (bitstream->buf_ == 0xff00) ? 6 : 7;
|
bitstream->cnt_ = (bitstream->buf_ == 0xff00) ? 6 : 7;
|
||||||
bitstream->buf_ |= c & ((1 << (bitstream->cnt_ + 1)) - 1);
|
bitstream->buf_ |= c & ((1 << (bitstream->cnt_ + 1)) - 1);
|
||||||
return (bitstream->buf_ >> bitstream->cnt_) & 1;
|
return (bitstream->buf_ >> bitstream->cnt_) & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -272,169 +272,169 @@ int jpc_bitstream_fillbuf(jpc_bitstream_t *bitstream)
|
|||||||
the effects of bit stuffing)? */
|
the effects of bit stuffing)? */
|
||||||
int jpc_bitstream_needalign(jpc_bitstream_t *bitstream)
|
int jpc_bitstream_needalign(jpc_bitstream_t *bitstream)
|
||||||
{
|
{
|
||||||
if (bitstream->openmode_ & JPC_BITSTREAM_READ) {
|
if (bitstream->openmode_ & JPC_BITSTREAM_READ) {
|
||||||
/* The bit stream is open for reading. */
|
/* The bit stream is open for reading. */
|
||||||
/* If there are any bits buffered for reading, or the
|
/* If there are any bits buffered for reading, or the
|
||||||
previous byte forced a stuffed bit, alignment is
|
previous byte forced a stuffed bit, alignment is
|
||||||
required. */
|
required. */
|
||||||
if ((bitstream->cnt_ < 8 && bitstream->cnt_ > 0) ||
|
if ((bitstream->cnt_ < 8 && bitstream->cnt_ > 0) ||
|
||||||
((bitstream->buf_ >> 8) & 0xff) == 0xff) {
|
((bitstream->buf_ >> 8) & 0xff) == 0xff) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
|
} else if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
|
||||||
/* The bit stream is open for writing. */
|
/* The bit stream is open for writing. */
|
||||||
/* If there are any bits buffered for writing, or the
|
/* If there are any bits buffered for writing, or the
|
||||||
previous byte forced a stuffed bit, alignment is
|
previous byte forced a stuffed bit, alignment is
|
||||||
required. */
|
required. */
|
||||||
if ((bitstream->cnt_ < 8 && bitstream->cnt_ >= 0) ||
|
if ((bitstream->cnt_ < 8 && bitstream->cnt_ >= 0) ||
|
||||||
((bitstream->buf_ >> 8) & 0xff) == 0xff) {
|
((bitstream->buf_ >> 8) & 0xff) == 0xff) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* This should not happen. Famous last words, eh? :-) */
|
/* This should not happen. Famous last words, eh? :-) */
|
||||||
assert(0);
|
assert(0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* How many additional bytes would be output if we align the bit stream? */
|
/* How many additional bytes would be output if we align the bit stream? */
|
||||||
int jpc_bitstream_pending(jpc_bitstream_t *bitstream)
|
int jpc_bitstream_pending(jpc_bitstream_t *bitstream)
|
||||||
{
|
{
|
||||||
if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
|
if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
|
||||||
/* The bit stream is being used for writing. */
|
/* The bit stream is being used for writing. */
|
||||||
#if 1
|
#if 1
|
||||||
/* XXX - Is this really correct? Check someday... */
|
/* XXX - Is this really correct? Check someday... */
|
||||||
if (bitstream->cnt_ < 8) {
|
if (bitstream->cnt_ < 8) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (bitstream->cnt_ < 8) {
|
if (bitstream->cnt_ < 8) {
|
||||||
if (((bitstream->buf_ >> 8) & 0xff) == 0xff) {
|
if (((bitstream->buf_ >> 8) & 0xff) == 0xff) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* This operation should not be invoked on a bit stream that
|
/* This operation should not be invoked on a bit stream that
|
||||||
is being used for reading. */
|
is being used for reading. */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Align the bit stream to a byte boundary. */
|
/* Align the bit stream to a byte boundary. */
|
||||||
int jpc_bitstream_align(jpc_bitstream_t *bitstream)
|
int jpc_bitstream_align(jpc_bitstream_t *bitstream)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (bitstream->openmode_ & JPC_BITSTREAM_READ) {
|
if (bitstream->openmode_ & JPC_BITSTREAM_READ) {
|
||||||
ret = jpc_bitstream_inalign(bitstream, 0, 0);
|
ret = jpc_bitstream_inalign(bitstream, 0, 0);
|
||||||
} else if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
|
} else if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
|
||||||
ret = jpc_bitstream_outalign(bitstream, 0);
|
ret = jpc_bitstream_outalign(bitstream, 0);
|
||||||
} else {
|
} else {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Align a bit stream in the input case. */
|
/* Align a bit stream in the input case. */
|
||||||
int jpc_bitstream_inalign(jpc_bitstream_t *bitstream, int fillmask,
|
int jpc_bitstream_inalign(jpc_bitstream_t *bitstream, int fillmask,
|
||||||
int filldata)
|
int filldata)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
int v;
|
int v;
|
||||||
int u;
|
int u;
|
||||||
int numfill;
|
int numfill;
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
numfill = 7;
|
numfill = 7;
|
||||||
m = 0;
|
m = 0;
|
||||||
v = 0;
|
v = 0;
|
||||||
if (bitstream->cnt_ > 0) {
|
if (bitstream->cnt_ > 0) {
|
||||||
n = bitstream->cnt_;
|
n = bitstream->cnt_;
|
||||||
} else if (!bitstream->cnt_) {
|
} else if (!bitstream->cnt_) {
|
||||||
n = ((bitstream->buf_ & 0xff) == 0xff) ? 7 : 0;
|
n = ((bitstream->buf_ & 0xff) == 0xff) ? 7 : 0;
|
||||||
} else {
|
} else {
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
if ((u = jpc_bitstream_getbits(bitstream, n)) < 0) {
|
if ((u = jpc_bitstream_getbits(bitstream, n)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
m += n;
|
m += n;
|
||||||
v = (v << n) | u;
|
v = (v << n) | u;
|
||||||
}
|
}
|
||||||
if ((bitstream->buf_ & 0xff) == 0xff) {
|
if ((bitstream->buf_ & 0xff) == 0xff) {
|
||||||
if ((u = jpc_bitstream_getbits(bitstream, 7)) < 0) {
|
if ((u = jpc_bitstream_getbits(bitstream, 7)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
v = (v << 7) | u;
|
v = (v << 7) | u;
|
||||||
m += 7;
|
m += 7;
|
||||||
}
|
}
|
||||||
if (m > numfill) {
|
if (m > numfill) {
|
||||||
v >>= m - numfill;
|
v >>= m - numfill;
|
||||||
} else {
|
} else {
|
||||||
filldata >>= numfill - m;
|
filldata >>= numfill - m;
|
||||||
fillmask >>= numfill - m;
|
fillmask >>= numfill - m;
|
||||||
}
|
}
|
||||||
if (((~(v ^ filldata)) & fillmask) != fillmask) {
|
if (((~(v ^ filldata)) & fillmask) != fillmask) {
|
||||||
/* The actual fill pattern does not match the expected one. */
|
/* The actual fill pattern does not match the expected one. */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Align a bit stream in the output case. */
|
/* Align a bit stream in the output case. */
|
||||||
int jpc_bitstream_outalign(jpc_bitstream_t *bitstream, int filldata)
|
int jpc_bitstream_outalign(jpc_bitstream_t *bitstream, int filldata)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
/* Ensure that this bit stream is open for writing. */
|
/* Ensure that this bit stream is open for writing. */
|
||||||
assert(bitstream->openmode_ & JPC_BITSTREAM_WRITE);
|
assert(bitstream->openmode_ & JPC_BITSTREAM_WRITE);
|
||||||
|
|
||||||
/* Ensure that the first bit of fill data is zero. */
|
/* Ensure that the first bit of fill data is zero. */
|
||||||
/* Note: The first bit of fill data must be zero. If this were not
|
/* Note: The first bit of fill data must be zero. If this were not
|
||||||
the case, the fill data itself could cause further bit stuffing to
|
the case, the fill data itself could cause further bit stuffing to
|
||||||
be required (which would cause numerous complications). */
|
be required (which would cause numerous complications). */
|
||||||
assert(!(filldata & (~0x3f)));
|
assert(!(filldata & (~0x3f)));
|
||||||
|
|
||||||
if (!bitstream->cnt_) {
|
if (!bitstream->cnt_) {
|
||||||
if ((bitstream->buf_ & 0xff) == 0xff) {
|
if ((bitstream->buf_ & 0xff) == 0xff) {
|
||||||
n = 7;
|
n = 7;
|
||||||
v = filldata;
|
v = filldata;
|
||||||
} else {
|
} else {
|
||||||
n = 0;
|
n = 0;
|
||||||
v = 0;
|
v = 0;
|
||||||
}
|
}
|
||||||
} else if (bitstream->cnt_ > 0 && bitstream->cnt_ < 8) {
|
} else if (bitstream->cnt_ > 0 && bitstream->cnt_ < 8) {
|
||||||
n = bitstream->cnt_;
|
n = bitstream->cnt_;
|
||||||
v = filldata >> (7 - n);
|
v = filldata >> (7 - n);
|
||||||
} else {
|
} else {
|
||||||
n = 0;
|
n = 0;
|
||||||
v = 0;
|
v = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the appropriate fill data to the bit stream. */
|
/* Write the appropriate fill data to the bit stream. */
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
if (jpc_bitstream_putbits(bitstream, n, v)) {
|
if (jpc_bitstream_putbits(bitstream, n, v)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bitstream->cnt_ < 8) {
|
if (bitstream->cnt_ < 8) {
|
||||||
assert(bitstream->cnt_ >= 0 && bitstream->cnt_ < 8);
|
assert(bitstream->cnt_ >= 0 && bitstream->cnt_ < 8);
|
||||||
assert((bitstream->buf_ & 0xff) != 0xff);
|
assert((bitstream->buf_ & 0xff) != 0xff);
|
||||||
/* Force the pending byte of output to be written to the
|
/* Force the pending byte of output to be written to the
|
||||||
underlying (character) stream. */
|
underlying (character) stream. */
|
||||||
if (jas_stream_putc(bitstream->stream_, bitstream->buf_ & 0xff) == EOF) {
|
if (jas_stream_putc(bitstream->stream_, bitstream->buf_ & 0xff) == EOF) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
bitstream->cnt_ = 8;
|
bitstream->cnt_ = 8;
|
||||||
bitstream->buf_ = (bitstream->buf_ << 8) & 0xffff;
|
bitstream->buf_ = (bitstream->buf_ << 8) & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
56
3rdparty/libjasper/jpc_bs.h
vendored
56
3rdparty/libjasper/jpc_bs.h
vendored
@ -111,20 +111,20 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* Some miscellaneous flags. */
|
/* Some miscellaneous flags. */
|
||||||
int flags_;
|
int flags_;
|
||||||
|
|
||||||
/* The input/output buffer. */
|
/* The input/output buffer. */
|
||||||
uint_fast16_t buf_;
|
uint_fast16_t buf_;
|
||||||
|
|
||||||
/* The number of bits remaining in the byte being read/written. */
|
/* The number of bits remaining in the byte being read/written. */
|
||||||
int cnt_;
|
int cnt_;
|
||||||
|
|
||||||
/* The underlying stream associated with this bit stream. */
|
/* The underlying stream associated with this bit stream. */
|
||||||
jas_stream_t *stream_;
|
jas_stream_t *stream_;
|
||||||
|
|
||||||
/* The mode in which this bit stream was opened. */
|
/* The mode in which this bit stream was opened. */
|
||||||
int openmode_;
|
int openmode_;
|
||||||
|
|
||||||
} jpc_bitstream_t;
|
} jpc_bitstream_t;
|
||||||
|
|
||||||
@ -145,19 +145,19 @@ int jpc_bitstream_close(jpc_bitstream_t *bitstream);
|
|||||||
/* Read a bit from a bit stream. */
|
/* Read a bit from a bit stream. */
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
#define jpc_bitstream_getbit(bitstream) \
|
#define jpc_bitstream_getbit(bitstream) \
|
||||||
jpc_bitstream_getbit_func(bitstream)
|
jpc_bitstream_getbit_func(bitstream)
|
||||||
#else
|
#else
|
||||||
#define jpc_bitstream_getbit(bitstream) \
|
#define jpc_bitstream_getbit(bitstream) \
|
||||||
jpc_bitstream_getbit_macro(bitstream)
|
jpc_bitstream_getbit_macro(bitstream)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Write a bit to a bit stream. */
|
/* Write a bit to a bit stream. */
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
#define jpc_bitstream_putbit(bitstream, v) \
|
#define jpc_bitstream_putbit(bitstream, v) \
|
||||||
jpc_bitstream_putbit_func(bitstream, v)
|
jpc_bitstream_putbit_func(bitstream, v)
|
||||||
#else
|
#else
|
||||||
#define jpc_bitstream_putbit(bitstream, v) \
|
#define jpc_bitstream_putbit(bitstream, v) \
|
||||||
jpc_bitstream_putbit_macro(bitstream, v)
|
jpc_bitstream_putbit_macro(bitstream, v)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Read one or more bits from a bit stream. */
|
/* Read one or more bits from a bit stream. */
|
||||||
@ -196,7 +196,7 @@ int jpc_bitstream_pending(jpc_bitstream_t *bitstream);
|
|||||||
|
|
||||||
/* Has EOF been encountered on a bit stream? */
|
/* Has EOF been encountered on a bit stream? */
|
||||||
#define jpc_bitstream_eof(bitstream) \
|
#define jpc_bitstream_eof(bitstream) \
|
||||||
((bitstream)->flags_ & JPC_BITSTREAM_EOF)
|
((bitstream)->flags_ & JPC_BITSTREAM_EOF)
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Internals.
|
* Internals.
|
||||||
@ -212,20 +212,20 @@ int jpc_bitstream_putbit_func(jpc_bitstream_t *bitstream, int v);
|
|||||||
int jpc_bitstream_fillbuf(jpc_bitstream_t *bitstream);
|
int jpc_bitstream_fillbuf(jpc_bitstream_t *bitstream);
|
||||||
|
|
||||||
#define jpc_bitstream_getbit_macro(bitstream) \
|
#define jpc_bitstream_getbit_macro(bitstream) \
|
||||||
(assert((bitstream)->openmode_ & JPC_BITSTREAM_READ), \
|
(assert((bitstream)->openmode_ & JPC_BITSTREAM_READ), \
|
||||||
(--(bitstream)->cnt_ >= 0) ? \
|
(--(bitstream)->cnt_ >= 0) ? \
|
||||||
((int)(((bitstream)->buf_ >> (bitstream)->cnt_) & 1)) : \
|
((int)(((bitstream)->buf_ >> (bitstream)->cnt_) & 1)) : \
|
||||||
jpc_bitstream_fillbuf(bitstream))
|
jpc_bitstream_fillbuf(bitstream))
|
||||||
|
|
||||||
#define jpc_bitstream_putbit_macro(bitstream, bit) \
|
#define jpc_bitstream_putbit_macro(bitstream, bit) \
|
||||||
(assert((bitstream)->openmode_ & JPC_BITSTREAM_WRITE), \
|
(assert((bitstream)->openmode_ & JPC_BITSTREAM_WRITE), \
|
||||||
(--(bitstream)->cnt_ < 0) ? \
|
(--(bitstream)->cnt_ < 0) ? \
|
||||||
((bitstream)->buf_ = ((bitstream)->buf_ << 8) & 0xffff, \
|
((bitstream)->buf_ = ((bitstream)->buf_ << 8) & 0xffff, \
|
||||||
(bitstream)->cnt_ = ((bitstream)->buf_ == 0xff00) ? 6 : 7, \
|
(bitstream)->cnt_ = ((bitstream)->buf_ == 0xff00) ? 6 : 7, \
|
||||||
(bitstream)->buf_ |= ((bit) & 1) << (bitstream)->cnt_, \
|
(bitstream)->buf_ |= ((bit) & 1) << (bitstream)->cnt_, \
|
||||||
(jas_stream_putc((bitstream)->stream_, (bitstream)->buf_ >> 8) == EOF) \
|
(jas_stream_putc((bitstream)->stream_, (bitstream)->buf_ >> 8) == EOF) \
|
||||||
? (EOF) : ((bit) & 1)) : \
|
? (EOF) : ((bit) & 1)) : \
|
||||||
((bitstream)->buf_ |= ((bit) & 1) << (bitstream)->cnt_, \
|
((bitstream)->buf_ |= ((bit) & 1) << (bitstream)->cnt_, \
|
||||||
(bit) & 1))
|
(bit) & 1))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
2030
3rdparty/libjasper/jpc_cs.c
vendored
2030
3rdparty/libjasper/jpc_cs.c
vendored
File diff suppressed because it is too large
Load Diff
390
3rdparty/libjasper/jpc_cs.h
vendored
390
3rdparty/libjasper/jpc_cs.h
vendored
@ -125,8 +125,8 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of components. */
|
/* The number of components. */
|
||||||
uint_fast16_t numcomps;
|
uint_fast16_t numcomps;
|
||||||
|
|
||||||
} jpc_cstate_t;
|
} jpc_cstate_t;
|
||||||
|
|
||||||
@ -136,18 +136,18 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The tile number. */
|
/* The tile number. */
|
||||||
uint_fast16_t tileno;
|
uint_fast16_t tileno;
|
||||||
|
|
||||||
/* The combined length of the marker segment and its auxilary data
|
/* The combined length of the marker segment and its auxilary data
|
||||||
(i.e., packet data). */
|
(i.e., packet data). */
|
||||||
uint_fast32_t len;
|
uint_fast32_t len;
|
||||||
|
|
||||||
/* The tile-part instance. */
|
/* The tile-part instance. */
|
||||||
uint_fast8_t partno;
|
uint_fast8_t partno;
|
||||||
|
|
||||||
/* The number of tile-parts. */
|
/* The number of tile-parts. */
|
||||||
uint_fast8_t numparts;
|
uint_fast8_t numparts;
|
||||||
|
|
||||||
} jpc_sot_t;
|
} jpc_sot_t;
|
||||||
|
|
||||||
@ -159,19 +159,19 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The precision of the samples. */
|
/* The precision of the samples. */
|
||||||
uint_fast8_t prec;
|
uint_fast8_t prec;
|
||||||
|
|
||||||
/* The signedness of the samples. */
|
/* The signedness of the samples. */
|
||||||
uint_fast8_t sgnd;
|
uint_fast8_t sgnd;
|
||||||
|
|
||||||
/* The horizontal separation of samples with respect to the reference
|
/* The horizontal separation of samples with respect to the reference
|
||||||
grid. */
|
grid. */
|
||||||
uint_fast8_t hsamp;
|
uint_fast8_t hsamp;
|
||||||
|
|
||||||
/* The vertical separation of samples with respect to the reference
|
/* The vertical separation of samples with respect to the reference
|
||||||
grid. */
|
grid. */
|
||||||
uint_fast8_t vsamp;
|
uint_fast8_t vsamp;
|
||||||
|
|
||||||
} jpc_sizcomp_t;
|
} jpc_sizcomp_t;
|
||||||
|
|
||||||
@ -179,42 +179,42 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The code stream capabilities. */
|
/* The code stream capabilities. */
|
||||||
uint_fast16_t caps;
|
uint_fast16_t caps;
|
||||||
|
|
||||||
/* The width of the image in units of the reference grid. */
|
/* The width of the image in units of the reference grid. */
|
||||||
uint_fast32_t width;
|
uint_fast32_t width;
|
||||||
|
|
||||||
/* The height of the image in units of the reference grid. */
|
/* The height of the image in units of the reference grid. */
|
||||||
uint_fast32_t height;
|
uint_fast32_t height;
|
||||||
|
|
||||||
/* The horizontal offset from the origin of the reference grid to the
|
/* The horizontal offset from the origin of the reference grid to the
|
||||||
left side of the image area. */
|
left side of the image area. */
|
||||||
uint_fast32_t xoff;
|
uint_fast32_t xoff;
|
||||||
|
|
||||||
/* The vertical offset from the origin of the reference grid to the
|
/* The vertical offset from the origin of the reference grid to the
|
||||||
top side of the image area. */
|
top side of the image area. */
|
||||||
uint_fast32_t yoff;
|
uint_fast32_t yoff;
|
||||||
|
|
||||||
/* The nominal width of a tile in units of the reference grid. */
|
/* The nominal width of a tile in units of the reference grid. */
|
||||||
uint_fast32_t tilewidth;
|
uint_fast32_t tilewidth;
|
||||||
|
|
||||||
/* The nominal height of a tile in units of the reference grid. */
|
/* The nominal height of a tile in units of the reference grid. */
|
||||||
uint_fast32_t tileheight;
|
uint_fast32_t tileheight;
|
||||||
|
|
||||||
/* The horizontal offset from the origin of the reference grid to the
|
/* The horizontal offset from the origin of the reference grid to the
|
||||||
left side of the first tile. */
|
left side of the first tile. */
|
||||||
uint_fast32_t tilexoff;
|
uint_fast32_t tilexoff;
|
||||||
|
|
||||||
/* The vertical offset from the origin of the reference grid to the
|
/* The vertical offset from the origin of the reference grid to the
|
||||||
top side of the first tile. */
|
top side of the first tile. */
|
||||||
uint_fast32_t tileyoff;
|
uint_fast32_t tileyoff;
|
||||||
|
|
||||||
/* The number of components. */
|
/* The number of components. */
|
||||||
uint_fast16_t numcomps;
|
uint_fast16_t numcomps;
|
||||||
|
|
||||||
/* The per-component information. */
|
/* The per-component information. */
|
||||||
jpc_sizcomp_t *comps;
|
jpc_sizcomp_t *comps;
|
||||||
|
|
||||||
} jpc_siz_t;
|
} jpc_siz_t;
|
||||||
|
|
||||||
@ -278,11 +278,11 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The packet partition width. */
|
/* The packet partition width. */
|
||||||
uint_fast8_t parwidthval;
|
uint_fast8_t parwidthval;
|
||||||
|
|
||||||
/* The packet partition height. */
|
/* The packet partition height. */
|
||||||
uint_fast8_t parheightval;
|
uint_fast8_t parheightval;
|
||||||
|
|
||||||
} jpc_coxrlvl_t;
|
} jpc_coxrlvl_t;
|
||||||
|
|
||||||
@ -290,29 +290,29 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The coding style. */
|
/* The coding style. */
|
||||||
uint_fast8_t csty;
|
uint_fast8_t csty;
|
||||||
|
|
||||||
/* The number of decomposition levels. */
|
/* The number of decomposition levels. */
|
||||||
uint_fast8_t numdlvls;
|
uint_fast8_t numdlvls;
|
||||||
|
|
||||||
/* The nominal code block width specifier. */
|
/* The nominal code block width specifier. */
|
||||||
uint_fast8_t cblkwidthval;
|
uint_fast8_t cblkwidthval;
|
||||||
|
|
||||||
/* The nominal code block height specifier. */
|
/* The nominal code block height specifier. */
|
||||||
uint_fast8_t cblkheightval;
|
uint_fast8_t cblkheightval;
|
||||||
|
|
||||||
/* The style of coding passes. */
|
/* The style of coding passes. */
|
||||||
uint_fast8_t cblksty;
|
uint_fast8_t cblksty;
|
||||||
|
|
||||||
/* The QMFB employed. */
|
/* The QMFB employed. */
|
||||||
uint_fast8_t qmfbid;
|
uint_fast8_t qmfbid;
|
||||||
|
|
||||||
/* The number of resolution levels. */
|
/* The number of resolution levels. */
|
||||||
int numrlvls;
|
int numrlvls;
|
||||||
|
|
||||||
/* The per-resolution-level information. */
|
/* The per-resolution-level information. */
|
||||||
jpc_coxrlvl_t rlvls[JPC_MAXRLVLS];
|
jpc_coxrlvl_t rlvls[JPC_MAXRLVLS];
|
||||||
|
|
||||||
} jpc_coxcp_t;
|
} jpc_coxcp_t;
|
||||||
|
|
||||||
@ -320,20 +320,20 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The general coding style. */
|
/* The general coding style. */
|
||||||
uint_fast8_t csty;
|
uint_fast8_t csty;
|
||||||
|
|
||||||
/* The progression order. */
|
/* The progression order. */
|
||||||
uint_fast8_t prg;
|
uint_fast8_t prg;
|
||||||
|
|
||||||
/* The number of layers. */
|
/* The number of layers. */
|
||||||
uint_fast16_t numlyrs;
|
uint_fast16_t numlyrs;
|
||||||
|
|
||||||
/* The multicomponent transform. */
|
/* The multicomponent transform. */
|
||||||
uint_fast8_t mctrans;
|
uint_fast8_t mctrans;
|
||||||
|
|
||||||
/* Component-related parameters. */
|
/* Component-related parameters. */
|
||||||
jpc_coxcp_t compparms;
|
jpc_coxcp_t compparms;
|
||||||
|
|
||||||
} jpc_cod_t;
|
} jpc_cod_t;
|
||||||
|
|
||||||
@ -341,11 +341,11 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The component number. */
|
/* The component number. */
|
||||||
uint_fast16_t compno;
|
uint_fast16_t compno;
|
||||||
|
|
||||||
/* Component-related parameters. */
|
/* Component-related parameters. */
|
||||||
jpc_coxcp_t compparms;
|
jpc_coxcp_t compparms;
|
||||||
|
|
||||||
} jpc_coc_t;
|
} jpc_coc_t;
|
||||||
|
|
||||||
@ -358,14 +358,14 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The component to which the marker applies. */
|
/* The component to which the marker applies. */
|
||||||
uint_fast16_t compno;
|
uint_fast16_t compno;
|
||||||
|
|
||||||
/* The ROI style. */
|
/* The ROI style. */
|
||||||
uint_fast8_t roisty;
|
uint_fast8_t roisty;
|
||||||
|
|
||||||
/* The ROI shift value. */
|
/* The ROI shift value. */
|
||||||
uint_fast8_t roishift;
|
uint_fast8_t roishift;
|
||||||
|
|
||||||
} jpc_rgn_t;
|
} jpc_rgn_t;
|
||||||
|
|
||||||
@ -394,17 +394,17 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The quantization style. */
|
/* The quantization style. */
|
||||||
uint_fast8_t qntsty;
|
uint_fast8_t qntsty;
|
||||||
|
|
||||||
/* The number of step sizes. */
|
/* The number of step sizes. */
|
||||||
int numstepsizes;
|
int numstepsizes;
|
||||||
|
|
||||||
/* The step sizes. */
|
/* The step sizes. */
|
||||||
uint_fast16_t *stepsizes;
|
uint_fast16_t *stepsizes;
|
||||||
|
|
||||||
/* The number of guard bits. */
|
/* The number of guard bits. */
|
||||||
uint_fast8_t numguard;
|
uint_fast8_t numguard;
|
||||||
|
|
||||||
} jpc_qcxcp_t;
|
} jpc_qcxcp_t;
|
||||||
|
|
||||||
@ -412,11 +412,11 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The component associated with this marker segment. */
|
/* The component associated with this marker segment. */
|
||||||
uint_fast16_t compno;
|
uint_fast16_t compno;
|
||||||
|
|
||||||
/* The parameters. */
|
/* The parameters. */
|
||||||
jpc_qcxcp_t compparms;
|
jpc_qcxcp_t compparms;
|
||||||
|
|
||||||
} jpc_qcc_t;
|
} jpc_qcc_t;
|
||||||
|
|
||||||
@ -424,8 +424,8 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The parameters. */
|
/* The parameters. */
|
||||||
jpc_qcxcp_t compparms;
|
jpc_qcxcp_t compparms;
|
||||||
|
|
||||||
} jpc_qcd_t;
|
} jpc_qcd_t;
|
||||||
|
|
||||||
@ -435,28 +435,28 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The progression order. */
|
/* The progression order. */
|
||||||
uint_fast8_t prgord;
|
uint_fast8_t prgord;
|
||||||
|
|
||||||
/* The lower bound (inclusive) on the resolution level for the
|
/* The lower bound (inclusive) on the resolution level for the
|
||||||
progression order volume. */
|
progression order volume. */
|
||||||
uint_fast8_t rlvlnostart;
|
uint_fast8_t rlvlnostart;
|
||||||
|
|
||||||
/* The upper bound (exclusive) on the resolution level for the
|
/* The upper bound (exclusive) on the resolution level for the
|
||||||
progression order volume. */
|
progression order volume. */
|
||||||
uint_fast8_t rlvlnoend;
|
uint_fast8_t rlvlnoend;
|
||||||
|
|
||||||
/* The lower bound (inclusive) on the component for the progression
|
/* The lower bound (inclusive) on the component for the progression
|
||||||
order volume. */
|
order volume. */
|
||||||
uint_fast16_t compnostart;
|
uint_fast16_t compnostart;
|
||||||
|
|
||||||
/* The upper bound (exclusive) on the component for the progression
|
/* The upper bound (exclusive) on the component for the progression
|
||||||
order volume. */
|
order volume. */
|
||||||
uint_fast16_t compnoend;
|
uint_fast16_t compnoend;
|
||||||
|
|
||||||
/* The upper bound (exclusive) on the layer for the progression
|
/* The upper bound (exclusive) on the layer for the progression
|
||||||
order volume. */
|
order volume. */
|
||||||
uint_fast16_t lyrnoend;
|
uint_fast16_t lyrnoend;
|
||||||
|
|
||||||
} jpc_pocpchg_t;
|
} jpc_pocpchg_t;
|
||||||
|
|
||||||
@ -467,11 +467,11 @@ typedef jpc_pocpchg_t jpc_pchg_t;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of progression order changes. */
|
/* The number of progression order changes. */
|
||||||
int numpchgs;
|
int numpchgs;
|
||||||
|
|
||||||
/* The per-progression-order-change information. */
|
/* The per-progression-order-change information. */
|
||||||
jpc_pocpchg_t *pchgs;
|
jpc_pocpchg_t *pchgs;
|
||||||
|
|
||||||
} jpc_poc_t;
|
} jpc_poc_t;
|
||||||
|
|
||||||
@ -483,14 +483,14 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The index. */
|
/* The index. */
|
||||||
uint_fast8_t ind;
|
uint_fast8_t ind;
|
||||||
|
|
||||||
/* The length. */
|
/* The length. */
|
||||||
uint_fast16_t len;
|
uint_fast16_t len;
|
||||||
|
|
||||||
/* The data. */
|
/* The data. */
|
||||||
uchar *data;
|
uchar *data;
|
||||||
|
|
||||||
} jpc_ppm_t;
|
} jpc_ppm_t;
|
||||||
|
|
||||||
@ -498,14 +498,14 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The index. */
|
/* The index. */
|
||||||
uint_fast8_t ind;
|
uint_fast8_t ind;
|
||||||
|
|
||||||
/* The length. */
|
/* The length. */
|
||||||
uint_fast32_t len;
|
uint_fast32_t len;
|
||||||
|
|
||||||
/* The data. */
|
/* The data. */
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
} jpc_ppt_t;
|
} jpc_ppt_t;
|
||||||
|
|
||||||
@ -522,14 +522,14 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The registration ID. */
|
/* The registration ID. */
|
||||||
uint_fast16_t regid;
|
uint_fast16_t regid;
|
||||||
|
|
||||||
/* The length of the data in bytes. */
|
/* The length of the data in bytes. */
|
||||||
uint_fast16_t len;
|
uint_fast16_t len;
|
||||||
|
|
||||||
/* The data. */
|
/* The data. */
|
||||||
uchar *data;
|
uchar *data;
|
||||||
|
|
||||||
} jpc_com_t;
|
} jpc_com_t;
|
||||||
|
|
||||||
@ -539,8 +539,8 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The sequence number. */
|
/* The sequence number. */
|
||||||
uint_fast16_t seqno;
|
uint_fast16_t seqno;
|
||||||
|
|
||||||
} jpc_sop_t;
|
} jpc_sop_t;
|
||||||
|
|
||||||
@ -552,21 +552,21 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The horizontal offset. */
|
/* The horizontal offset. */
|
||||||
uint_fast16_t hoff;
|
uint_fast16_t hoff;
|
||||||
|
|
||||||
/* The vertical offset. */
|
/* The vertical offset. */
|
||||||
uint_fast16_t voff;
|
uint_fast16_t voff;
|
||||||
|
|
||||||
} jpc_crgcomp_t;
|
} jpc_crgcomp_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of components. */
|
/* The number of components. */
|
||||||
int numcomps;
|
int numcomps;
|
||||||
|
|
||||||
/* Per component information. */
|
/* Per component information. */
|
||||||
jpc_crgcomp_t *comps;
|
jpc_crgcomp_t *comps;
|
||||||
|
|
||||||
} jpc_crg_t;
|
} jpc_crg_t;
|
||||||
|
|
||||||
@ -576,11 +576,11 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The data. */
|
/* The data. */
|
||||||
uchar *data;
|
uchar *data;
|
||||||
|
|
||||||
/* The length. */
|
/* The length. */
|
||||||
uint_fast16_t len;
|
uint_fast16_t len;
|
||||||
|
|
||||||
} jpc_unk_t;
|
} jpc_unk_t;
|
||||||
|
|
||||||
@ -589,26 +589,26 @@ typedef struct {
|
|||||||
\**************************************/
|
\**************************************/
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
int soc; /* unused */
|
int soc; /* unused */
|
||||||
jpc_sot_t sot;
|
jpc_sot_t sot;
|
||||||
int sod; /* unused */
|
int sod; /* unused */
|
||||||
int eoc; /* unused */
|
int eoc; /* unused */
|
||||||
jpc_siz_t siz;
|
jpc_siz_t siz;
|
||||||
jpc_cod_t cod;
|
jpc_cod_t cod;
|
||||||
jpc_coc_t coc;
|
jpc_coc_t coc;
|
||||||
jpc_rgn_t rgn;
|
jpc_rgn_t rgn;
|
||||||
jpc_qcd_t qcd;
|
jpc_qcd_t qcd;
|
||||||
jpc_qcc_t qcc;
|
jpc_qcc_t qcc;
|
||||||
jpc_poc_t poc;
|
jpc_poc_t poc;
|
||||||
/* jpc_plm_t plm; */
|
/* jpc_plm_t plm; */
|
||||||
/* jpc_plt_t plt; */
|
/* jpc_plt_t plt; */
|
||||||
jpc_ppm_t ppm;
|
jpc_ppm_t ppm;
|
||||||
jpc_ppt_t ppt;
|
jpc_ppt_t ppt;
|
||||||
jpc_sop_t sop;
|
jpc_sop_t sop;
|
||||||
int eph; /* unused */
|
int eph; /* unused */
|
||||||
jpc_com_t com;
|
jpc_com_t com;
|
||||||
jpc_crg_t crg;
|
jpc_crg_t crg;
|
||||||
jpc_unk_t unk;
|
jpc_unk_t unk;
|
||||||
} jpc_msparms_t;
|
} jpc_msparms_t;
|
||||||
|
|
||||||
/**************************************\
|
/**************************************\
|
||||||
@ -667,20 +667,20 @@ struct jpc_msops_s;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The type of marker segment. */
|
/* The type of marker segment. */
|
||||||
uint_fast16_t id;
|
uint_fast16_t id;
|
||||||
|
|
||||||
/* The length of the marker segment. */
|
/* The length of the marker segment. */
|
||||||
uint_fast16_t len;
|
uint_fast16_t len;
|
||||||
|
|
||||||
/* The starting offset within the stream. */
|
/* The starting offset within the stream. */
|
||||||
uint_fast32_t off;
|
uint_fast32_t off;
|
||||||
|
|
||||||
/* The parameters of the marker segment. */
|
/* The parameters of the marker segment. */
|
||||||
jpc_msparms_t parms;
|
jpc_msparms_t parms;
|
||||||
|
|
||||||
/* The marker segment operations. */
|
/* The marker segment operations. */
|
||||||
struct jpc_msops_s *ops;
|
struct jpc_msops_s *ops;
|
||||||
|
|
||||||
} jpc_ms_t;
|
} jpc_ms_t;
|
||||||
|
|
||||||
@ -688,17 +688,17 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct jpc_msops_s {
|
typedef struct jpc_msops_s {
|
||||||
|
|
||||||
/* Destroy the marker segment parameters. */
|
/* Destroy the marker segment parameters. */
|
||||||
void (*destroyparms)(jpc_ms_t *ms);
|
void (*destroyparms)(jpc_ms_t *ms);
|
||||||
|
|
||||||
/* Get the marker segment parameters from a stream. */
|
/* Get the marker segment parameters from a stream. */
|
||||||
int (*getparms)(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
|
int (*getparms)(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
|
||||||
|
|
||||||
/* Put the marker segment parameters to a stream. */
|
/* Put the marker segment parameters to a stream. */
|
||||||
int (*putparms)(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
|
int (*putparms)(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
|
||||||
|
|
||||||
/* Dump the marker segment parameters (for debugging). */
|
/* Dump the marker segment parameters (for debugging). */
|
||||||
int (*dumpparms)(jpc_ms_t *ms, FILE *out);
|
int (*dumpparms)(jpc_ms_t *ms, FILE *out);
|
||||||
|
|
||||||
} jpc_msops_t;
|
} jpc_msops_t;
|
||||||
|
|
||||||
@ -720,12 +720,12 @@ void jpc_ms_destroy(jpc_ms_t *ms);
|
|||||||
|
|
||||||
/* Does a marker segment have parameters? */
|
/* Does a marker segment have parameters? */
|
||||||
#define JPC_MS_HASPARMS(x) \
|
#define JPC_MS_HASPARMS(x) \
|
||||||
(!((x) == JPC_MS_SOC || (x) == JPC_MS_SOD || (x) == JPC_MS_EOC || \
|
(!((x) == JPC_MS_SOC || (x) == JPC_MS_SOD || (x) == JPC_MS_EOC || \
|
||||||
(x) == JPC_MS_EPH || ((x) >= 0xff30 && (x) <= 0xff3f)))
|
(x) == JPC_MS_EPH || ((x) >= 0xff30 && (x) <= 0xff3f)))
|
||||||
|
|
||||||
/* Get the marker segment type. */
|
/* Get the marker segment type. */
|
||||||
#define jpc_ms_gettype(ms) \
|
#define jpc_ms_gettype(ms) \
|
||||||
((ms)->id)
|
((ms)->id)
|
||||||
|
|
||||||
/* Read a marker segment from a stream. */
|
/* Read a marker segment from a stream. */
|
||||||
jpc_ms_t *jpc_getms(jas_stream_t *in, jpc_cstate_t *cstate);
|
jpc_ms_t *jpc_getms(jas_stream_t *in, jpc_cstate_t *cstate);
|
||||||
|
3274
3rdparty/libjasper/jpc_dec.c
vendored
3274
3rdparty/libjasper/jpc_dec.c
vendored
File diff suppressed because it is too large
Load Diff
658
3rdparty/libjasper/jpc_dec.h
vendored
658
3rdparty/libjasper/jpc_dec.h
vendored
@ -92,14 +92,14 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The index for this entry. */
|
/* The index for this entry. */
|
||||||
uint_fast16_t ind;
|
uint_fast16_t ind;
|
||||||
|
|
||||||
/* The data length. */
|
/* The data length. */
|
||||||
uint_fast32_t len;
|
uint_fast32_t len;
|
||||||
|
|
||||||
/* The data. */
|
/* The data. */
|
||||||
uchar *data;
|
uchar *data;
|
||||||
|
|
||||||
} jpc_ppxstabent_t;
|
} jpc_ppxstabent_t;
|
||||||
|
|
||||||
@ -107,15 +107,15 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of entries. */
|
/* The number of entries. */
|
||||||
int numents;
|
int numents;
|
||||||
|
|
||||||
/* The maximum number of entries (i.e., the allocated size of the array
|
/* The maximum number of entries (i.e., the allocated size of the array
|
||||||
below). */
|
below). */
|
||||||
int maxents;
|
int maxents;
|
||||||
|
|
||||||
/* The table entries. */
|
/* The table entries. */
|
||||||
jpc_ppxstabent_t **ents;
|
jpc_ppxstabent_t **ents;
|
||||||
|
|
||||||
} jpc_ppxstab_t;
|
} jpc_ppxstab_t;
|
||||||
|
|
||||||
@ -123,15 +123,15 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of streams in this list. */
|
/* The number of streams in this list. */
|
||||||
int numstreams;
|
int numstreams;
|
||||||
|
|
||||||
/* The maximum number of streams that can be accomodated without
|
/* The maximum number of streams that can be accomodated without
|
||||||
growing the streams array. */
|
growing the streams array. */
|
||||||
int maxstreams;
|
int maxstreams;
|
||||||
|
|
||||||
/* The streams. */
|
/* The streams. */
|
||||||
jas_stream_t **streams;
|
jas_stream_t **streams;
|
||||||
|
|
||||||
} jpc_streamlist_t;
|
} jpc_streamlist_t;
|
||||||
|
|
||||||
@ -143,47 +143,47 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* How were various coding parameters set? */
|
/* How were various coding parameters set? */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
/* Per-component coding style parameters (e.g., explicit precinct sizes) */
|
/* Per-component coding style parameters (e.g., explicit precinct sizes) */
|
||||||
uint_fast8_t csty;
|
uint_fast8_t csty;
|
||||||
|
|
||||||
/* The number of resolution levels. */
|
/* The number of resolution levels. */
|
||||||
uint_fast8_t numrlvls;
|
uint_fast8_t numrlvls;
|
||||||
|
|
||||||
/* The code block width exponent. */
|
/* The code block width exponent. */
|
||||||
uint_fast8_t cblkwidthexpn;
|
uint_fast8_t cblkwidthexpn;
|
||||||
|
|
||||||
/* The code block height exponent. */
|
/* The code block height exponent. */
|
||||||
uint_fast8_t cblkheightexpn;
|
uint_fast8_t cblkheightexpn;
|
||||||
|
|
||||||
/* The QMFB ID. */
|
/* The QMFB ID. */
|
||||||
uint_fast8_t qmfbid;
|
uint_fast8_t qmfbid;
|
||||||
|
|
||||||
/* The quantization style. */
|
/* The quantization style. */
|
||||||
uint_fast8_t qsty;
|
uint_fast8_t qsty;
|
||||||
|
|
||||||
/* The number of quantizer step sizes. */
|
/* The number of quantizer step sizes. */
|
||||||
uint_fast16_t numstepsizes;
|
uint_fast16_t numstepsizes;
|
||||||
|
|
||||||
/* The step sizes. */
|
/* The step sizes. */
|
||||||
uint_fast16_t stepsizes[3 * JPC_MAXRLVLS + 1];
|
uint_fast16_t stepsizes[3 * JPC_MAXRLVLS + 1];
|
||||||
|
|
||||||
/* The number of guard bits. */
|
/* The number of guard bits. */
|
||||||
uint_fast8_t numguardbits;
|
uint_fast8_t numguardbits;
|
||||||
|
|
||||||
/* The ROI shift value. */
|
/* The ROI shift value. */
|
||||||
uint_fast8_t roishift;
|
uint_fast8_t roishift;
|
||||||
|
|
||||||
/* The code block parameters. */
|
/* The code block parameters. */
|
||||||
uint_fast8_t cblkctx;
|
uint_fast8_t cblkctx;
|
||||||
|
|
||||||
/* The precinct width exponents. */
|
/* The precinct width exponents. */
|
||||||
uint_fast8_t prcwidthexpns[JPC_MAXRLVLS];
|
uint_fast8_t prcwidthexpns[JPC_MAXRLVLS];
|
||||||
|
|
||||||
/* The precinct height exponents. */
|
/* The precinct height exponents. */
|
||||||
uint_fast8_t prcheightexpns[JPC_MAXRLVLS];
|
uint_fast8_t prcheightexpns[JPC_MAXRLVLS];
|
||||||
|
|
||||||
} jpc_dec_ccp_t;
|
} jpc_dec_ccp_t;
|
||||||
|
|
||||||
@ -191,29 +191,29 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* How were these coding parameters set? */
|
/* How were these coding parameters set? */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
/* Progression change list. */
|
/* Progression change list. */
|
||||||
jpc_pchglist_t *pchglist;
|
jpc_pchglist_t *pchglist;
|
||||||
|
|
||||||
/* Progression order. */
|
/* Progression order. */
|
||||||
uint_fast8_t prgord;
|
uint_fast8_t prgord;
|
||||||
|
|
||||||
/* The number of layers. */
|
/* The number of layers. */
|
||||||
uint_fast16_t numlyrs;
|
uint_fast16_t numlyrs;
|
||||||
|
|
||||||
/* The MCT ID. */
|
/* The MCT ID. */
|
||||||
uint_fast8_t mctid;
|
uint_fast8_t mctid;
|
||||||
|
|
||||||
/* The coding style parameters (e.g., SOP, EPH). */
|
/* The coding style parameters (e.g., SOP, EPH). */
|
||||||
uint_fast8_t csty;
|
uint_fast8_t csty;
|
||||||
|
|
||||||
/* The number of components. */
|
/* The number of components. */
|
||||||
int numcomps;
|
int numcomps;
|
||||||
|
|
||||||
/* The per-component coding parameters. */
|
/* The per-component coding parameters. */
|
||||||
jpc_dec_ccp_t *ccps;
|
jpc_dec_ccp_t *ccps;
|
||||||
|
|
||||||
} jpc_dec_cp_t;
|
} jpc_dec_cp_t;
|
||||||
|
|
||||||
@ -225,38 +225,38 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct jpc_dec_seg_s {
|
typedef struct jpc_dec_seg_s {
|
||||||
|
|
||||||
/* The next segment in the list. */
|
/* The next segment in the list. */
|
||||||
struct jpc_dec_seg_s *next;
|
struct jpc_dec_seg_s *next;
|
||||||
|
|
||||||
/* The previous segment in the list. */
|
/* The previous segment in the list. */
|
||||||
struct jpc_dec_seg_s *prev;
|
struct jpc_dec_seg_s *prev;
|
||||||
|
|
||||||
/* The starting pass number for this segment. */
|
/* The starting pass number for this segment. */
|
||||||
int passno;
|
int passno;
|
||||||
|
|
||||||
/* The number of passes in this segment. */
|
/* The number of passes in this segment. */
|
||||||
int numpasses;
|
int numpasses;
|
||||||
|
|
||||||
/* The maximum number of passes in this segment. */
|
/* The maximum number of passes in this segment. */
|
||||||
int maxpasses;
|
int maxpasses;
|
||||||
|
|
||||||
/* The type of data in this segment (i.e., MQ or raw). */
|
/* The type of data in this segment (i.e., MQ or raw). */
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
/* A stream containing the data for this segment. */
|
/* A stream containing the data for this segment. */
|
||||||
jas_stream_t *stream;
|
jas_stream_t *stream;
|
||||||
|
|
||||||
/* The number of bytes destined for this segment from the packet
|
/* The number of bytes destined for this segment from the packet
|
||||||
currently being decoded. */
|
currently being decoded. */
|
||||||
int cnt;
|
int cnt;
|
||||||
|
|
||||||
/* A flag indicating if this segment has been terminated. */
|
/* A flag indicating if this segment has been terminated. */
|
||||||
int complete;
|
int complete;
|
||||||
|
|
||||||
/* The layer number to which this segment belongs. */
|
/* The layer number to which this segment belongs. */
|
||||||
/* If the segment spans multiple layers, then the largest layer number
|
/* If the segment spans multiple layers, then the largest layer number
|
||||||
spanned by the segment is used. */
|
spanned by the segment is used. */
|
||||||
int lyrno;
|
int lyrno;
|
||||||
|
|
||||||
} jpc_dec_seg_t;
|
} jpc_dec_seg_t;
|
||||||
|
|
||||||
@ -264,11 +264,11 @@ typedef struct jpc_dec_seg_s {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The first entry in the list. */
|
/* The first entry in the list. */
|
||||||
jpc_dec_seg_t *head;
|
jpc_dec_seg_t *head;
|
||||||
|
|
||||||
/* The last entry in the list. */
|
/* The last entry in the list. */
|
||||||
jpc_dec_seg_t *tail;
|
jpc_dec_seg_t *tail;
|
||||||
|
|
||||||
} jpc_dec_seglist_t;
|
} jpc_dec_seglist_t;
|
||||||
|
|
||||||
@ -276,35 +276,35 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of passes. */
|
/* The number of passes. */
|
||||||
int numpasses;
|
int numpasses;
|
||||||
|
|
||||||
/* A list of segments that still need to be decoded. */
|
/* A list of segments that still need to be decoded. */
|
||||||
jpc_dec_seglist_t segs;
|
jpc_dec_seglist_t segs;
|
||||||
|
|
||||||
/* The first incomplete/partial segment. */
|
/* The first incomplete/partial segment. */
|
||||||
jpc_dec_seg_t *curseg;
|
jpc_dec_seg_t *curseg;
|
||||||
|
|
||||||
/* The number of leading insignificant bit planes for this code block. */
|
/* The number of leading insignificant bit planes for this code block. */
|
||||||
int numimsbs;
|
int numimsbs;
|
||||||
|
|
||||||
/* The number of bits used to encode pass data lengths. */
|
/* The number of bits used to encode pass data lengths. */
|
||||||
int numlenbits;
|
int numlenbits;
|
||||||
|
|
||||||
/* The first pass number containing data for this code block. */
|
/* The first pass number containing data for this code block. */
|
||||||
int firstpassno;
|
int firstpassno;
|
||||||
|
|
||||||
/* The MQ decoder. */
|
/* The MQ decoder. */
|
||||||
jpc_mqdec_t *mqdec;
|
jpc_mqdec_t *mqdec;
|
||||||
|
|
||||||
/* The raw bit stream decoder. */
|
/* The raw bit stream decoder. */
|
||||||
jpc_bitstream_t *nulldec;
|
jpc_bitstream_t *nulldec;
|
||||||
|
|
||||||
/* The per-sample state information for this code block. */
|
/* The per-sample state information for this code block. */
|
||||||
jas_matrix_t *flags;
|
jas_matrix_t *flags;
|
||||||
|
|
||||||
/* The sample data associated with this code block. */
|
/* The sample data associated with this code block. */
|
||||||
jas_matrix_t *data;
|
jas_matrix_t *data;
|
||||||
|
|
||||||
} jpc_dec_cblk_t;
|
} jpc_dec_cblk_t;
|
||||||
|
|
||||||
@ -312,39 +312,39 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the precinct. */
|
/* The x-coordinate of the top-left corner of the precinct. */
|
||||||
uint_fast32_t xstart;
|
uint_fast32_t xstart;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the precinct. */
|
/* The y-coordinate of the top-left corner of the precinct. */
|
||||||
uint_fast32_t ystart;
|
uint_fast32_t ystart;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the precinct
|
/* The x-coordinate of the bottom-right corner of the precinct
|
||||||
(plus one). */
|
(plus one). */
|
||||||
uint_fast32_t xend;
|
uint_fast32_t xend;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the precinct
|
/* The y-coordinate of the bottom-right corner of the precinct
|
||||||
(plus one). */
|
(plus one). */
|
||||||
uint_fast32_t yend;
|
uint_fast32_t yend;
|
||||||
|
|
||||||
/* The number of code blocks spanning this precinct in the horizontal
|
/* The number of code blocks spanning this precinct in the horizontal
|
||||||
direction. */
|
direction. */
|
||||||
int numhcblks;
|
int numhcblks;
|
||||||
|
|
||||||
/* The number of code blocks spanning this precinct in the vertical
|
/* The number of code blocks spanning this precinct in the vertical
|
||||||
direction. */
|
direction. */
|
||||||
int numvcblks;
|
int numvcblks;
|
||||||
|
|
||||||
/* The total number of code blocks in this precinct. */
|
/* The total number of code blocks in this precinct. */
|
||||||
int numcblks;
|
int numcblks;
|
||||||
|
|
||||||
/* The per code block information. */
|
/* The per code block information. */
|
||||||
jpc_dec_cblk_t *cblks;
|
jpc_dec_cblk_t *cblks;
|
||||||
|
|
||||||
/* The inclusion tag tree. */
|
/* The inclusion tag tree. */
|
||||||
jpc_tagtree_t *incltagtree;
|
jpc_tagtree_t *incltagtree;
|
||||||
|
|
||||||
/* The insignificant MSBs tag tree. */
|
/* The insignificant MSBs tag tree. */
|
||||||
jpc_tagtree_t *numimsbstagtree;
|
jpc_tagtree_t *numimsbstagtree;
|
||||||
|
|
||||||
} jpc_dec_prc_t;
|
} jpc_dec_prc_t;
|
||||||
|
|
||||||
@ -352,29 +352,29 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The per-code-block-group state information. */
|
/* The per-code-block-group state information. */
|
||||||
jpc_dec_prc_t *prcs;
|
jpc_dec_prc_t *prcs;
|
||||||
|
|
||||||
/* The sample data associated with this band. */
|
/* The sample data associated with this band. */
|
||||||
jas_matrix_t *data;
|
jas_matrix_t *data;
|
||||||
|
|
||||||
/* The orientation of this band (i.e., LL, LH, HL, or HH). */
|
/* The orientation of this band (i.e., LL, LH, HL, or HH). */
|
||||||
int orient;
|
int orient;
|
||||||
|
|
||||||
/* The encoded quantizer step size. */
|
/* The encoded quantizer step size. */
|
||||||
int stepsize;
|
int stepsize;
|
||||||
|
|
||||||
/* The absolute quantizer step size. */
|
/* The absolute quantizer step size. */
|
||||||
jpc_fix_t absstepsize;
|
jpc_fix_t absstepsize;
|
||||||
|
|
||||||
/* The number of bit planes for this band. */
|
/* The number of bit planes for this band. */
|
||||||
int numbps;
|
int numbps;
|
||||||
|
|
||||||
/* The analysis gain associated with this band. */
|
/* The analysis gain associated with this band. */
|
||||||
int analgain;
|
int analgain;
|
||||||
|
|
||||||
/* The ROI shift value for this band. */
|
/* The ROI shift value for this band. */
|
||||||
int roishift;
|
int roishift;
|
||||||
|
|
||||||
} jpc_dec_band_t;
|
} jpc_dec_band_t;
|
||||||
|
|
||||||
@ -382,60 +382,60 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of bands associated with this resolution level. */
|
/* The number of bands associated with this resolution level. */
|
||||||
int numbands;
|
int numbands;
|
||||||
|
|
||||||
/* The per-band information. */
|
/* The per-band information. */
|
||||||
jpc_dec_band_t *bands;
|
jpc_dec_band_t *bands;
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the tile-component
|
/* The x-coordinate of the top-left corner of the tile-component
|
||||||
at this resolution. */
|
at this resolution. */
|
||||||
uint_fast32_t xstart;
|
uint_fast32_t xstart;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the tile-component
|
/* The y-coordinate of the top-left corner of the tile-component
|
||||||
at this resolution. */
|
at this resolution. */
|
||||||
uint_fast32_t ystart;
|
uint_fast32_t ystart;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the tile-component
|
/* The x-coordinate of the bottom-right corner of the tile-component
|
||||||
at this resolution (plus one). */
|
at this resolution (plus one). */
|
||||||
uint_fast32_t xend;
|
uint_fast32_t xend;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the tile-component
|
/* The y-coordinate of the bottom-right corner of the tile-component
|
||||||
at this resolution (plus one). */
|
at this resolution (plus one). */
|
||||||
uint_fast32_t yend;
|
uint_fast32_t yend;
|
||||||
|
|
||||||
/* The exponent value for the nominal precinct width measured
|
/* The exponent value for the nominal precinct width measured
|
||||||
relative to the associated LL band. */
|
relative to the associated LL band. */
|
||||||
int prcwidthexpn;
|
int prcwidthexpn;
|
||||||
|
|
||||||
/* The exponent value for the nominal precinct height measured
|
/* The exponent value for the nominal precinct height measured
|
||||||
relative to the associated LL band. */
|
relative to the associated LL band. */
|
||||||
int prcheightexpn;
|
int prcheightexpn;
|
||||||
|
|
||||||
/* The number of precincts in the horizontal direction. */
|
/* The number of precincts in the horizontal direction. */
|
||||||
int numhprcs;
|
int numhprcs;
|
||||||
|
|
||||||
/* The number of precincts in the vertical direction. */
|
/* The number of precincts in the vertical direction. */
|
||||||
int numvprcs;
|
int numvprcs;
|
||||||
|
|
||||||
/* The total number of precincts. */
|
/* The total number of precincts. */
|
||||||
int numprcs;
|
int numprcs;
|
||||||
|
|
||||||
/* The exponent value for the nominal code block group width.
|
/* The exponent value for the nominal code block group width.
|
||||||
This quantity is associated with the next lower resolution level
|
This quantity is associated with the next lower resolution level
|
||||||
(assuming that there is one). */
|
(assuming that there is one). */
|
||||||
int cbgwidthexpn;
|
int cbgwidthexpn;
|
||||||
|
|
||||||
/* The exponent value for the nominal code block group height
|
/* The exponent value for the nominal code block group height
|
||||||
This quantity is associated with the next lower resolution level
|
This quantity is associated with the next lower resolution level
|
||||||
(assuming that there is one). */
|
(assuming that there is one). */
|
||||||
int cbgheightexpn;
|
int cbgheightexpn;
|
||||||
|
|
||||||
/* The exponent value for the code block width. */
|
/* The exponent value for the code block width. */
|
||||||
uint_fast16_t cblkwidthexpn;
|
uint_fast16_t cblkwidthexpn;
|
||||||
|
|
||||||
/* The exponent value for the code block height. */
|
/* The exponent value for the code block height. */
|
||||||
uint_fast16_t cblkheightexpn;
|
uint_fast16_t cblkheightexpn;
|
||||||
|
|
||||||
} jpc_dec_rlvl_t;
|
} jpc_dec_rlvl_t;
|
||||||
|
|
||||||
@ -443,33 +443,33 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the tile-component
|
/* The x-coordinate of the top-left corner of the tile-component
|
||||||
in the coordinate system of the tile-component. */
|
in the coordinate system of the tile-component. */
|
||||||
uint_fast32_t xstart;
|
uint_fast32_t xstart;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the tile-component
|
/* The y-coordinate of the top-left corner of the tile-component
|
||||||
in the coordinate system of the tile-component. */
|
in the coordinate system of the tile-component. */
|
||||||
uint_fast32_t ystart;
|
uint_fast32_t ystart;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the tile-component
|
/* The x-coordinate of the bottom-right corner of the tile-component
|
||||||
in the coordinate system of the tile-component (plus one). */
|
in the coordinate system of the tile-component (plus one). */
|
||||||
uint_fast32_t xend;
|
uint_fast32_t xend;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the tile-component
|
/* The y-coordinate of the bottom-right corner of the tile-component
|
||||||
in the coordinate system of the tile-component (plus one). */
|
in the coordinate system of the tile-component (plus one). */
|
||||||
uint_fast32_t yend;
|
uint_fast32_t yend;
|
||||||
|
|
||||||
/* The component data for the current tile. */
|
/* The component data for the current tile. */
|
||||||
jas_matrix_t *data;
|
jas_matrix_t *data;
|
||||||
|
|
||||||
/* The number of resolution levels. */
|
/* The number of resolution levels. */
|
||||||
int numrlvls;
|
int numrlvls;
|
||||||
|
|
||||||
/* The per resolution level information. */
|
/* The per resolution level information. */
|
||||||
jpc_dec_rlvl_t *rlvls;
|
jpc_dec_rlvl_t *rlvls;
|
||||||
|
|
||||||
/* The TSFB. */
|
/* The TSFB. */
|
||||||
jpc_tsfb_t *tsfb;
|
jpc_tsfb_t *tsfb;
|
||||||
|
|
||||||
} jpc_dec_tcomp_t;
|
} jpc_dec_tcomp_t;
|
||||||
|
|
||||||
@ -486,51 +486,51 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The processing state for this tile. */
|
/* The processing state for this tile. */
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the tile on the reference
|
/* The x-coordinate of the top-left corner of the tile on the reference
|
||||||
grid. */
|
grid. */
|
||||||
uint_fast32_t xstart;
|
uint_fast32_t xstart;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the tile on the reference
|
/* The y-coordinate of the top-left corner of the tile on the reference
|
||||||
grid. */
|
grid. */
|
||||||
uint_fast32_t ystart;
|
uint_fast32_t ystart;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the tile on the
|
/* The x-coordinate of the bottom-right corner of the tile on the
|
||||||
reference grid (plus one). */
|
reference grid (plus one). */
|
||||||
uint_fast32_t xend;
|
uint_fast32_t xend;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the tile on the
|
/* The y-coordinate of the bottom-right corner of the tile on the
|
||||||
reference grid (plus one). */
|
reference grid (plus one). */
|
||||||
uint_fast32_t yend;
|
uint_fast32_t yend;
|
||||||
|
|
||||||
/* The packed packet header data for this tile. */
|
/* The packed packet header data for this tile. */
|
||||||
jpc_ppxstab_t *pptstab;
|
jpc_ppxstab_t *pptstab;
|
||||||
|
|
||||||
/* A stream containing the packed packet header data for this tile. */
|
/* A stream containing the packed packet header data for this tile. */
|
||||||
jas_stream_t *pkthdrstream;
|
jas_stream_t *pkthdrstream;
|
||||||
|
|
||||||
/* The current position within the packed packet header stream. */
|
/* The current position within the packed packet header stream. */
|
||||||
long pkthdrstreampos;
|
long pkthdrstreampos;
|
||||||
|
|
||||||
/* The coding parameters for this tile. */
|
/* The coding parameters for this tile. */
|
||||||
jpc_dec_cp_t *cp;
|
jpc_dec_cp_t *cp;
|
||||||
|
|
||||||
/* The per tile-component information. */
|
/* The per tile-component information. */
|
||||||
jpc_dec_tcomp_t *tcomps;
|
jpc_dec_tcomp_t *tcomps;
|
||||||
|
|
||||||
/* The next expected tile-part number. */
|
/* The next expected tile-part number. */
|
||||||
int partno;
|
int partno;
|
||||||
|
|
||||||
/* The number of tile-parts. */
|
/* The number of tile-parts. */
|
||||||
int numparts;
|
int numparts;
|
||||||
|
|
||||||
/* The coding mode. */
|
/* The coding mode. */
|
||||||
int realmode;
|
int realmode;
|
||||||
|
|
||||||
/* The packet iterator for this tile. */
|
/* The packet iterator for this tile. */
|
||||||
jpc_pi_t *pi;
|
jpc_pi_t *pi;
|
||||||
|
|
||||||
} jpc_dec_tile_t;
|
} jpc_dec_tile_t;
|
||||||
|
|
||||||
@ -538,29 +538,29 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The horizontal sampling period. */
|
/* The horizontal sampling period. */
|
||||||
uint_fast32_t hstep;
|
uint_fast32_t hstep;
|
||||||
|
|
||||||
/* The vertical sampling period. */
|
/* The vertical sampling period. */
|
||||||
uint_fast32_t vstep;
|
uint_fast32_t vstep;
|
||||||
|
|
||||||
/* The number of samples in the horizontal direction. */
|
/* The number of samples in the horizontal direction. */
|
||||||
uint_fast32_t width;
|
uint_fast32_t width;
|
||||||
|
|
||||||
/* The number of samples in the vertical direction. */
|
/* The number of samples in the vertical direction. */
|
||||||
uint_fast32_t height;
|
uint_fast32_t height;
|
||||||
|
|
||||||
/* The precision of the sample data. */
|
/* The precision of the sample data. */
|
||||||
uint_fast16_t prec;
|
uint_fast16_t prec;
|
||||||
|
|
||||||
/* The signedness of the sample data. */
|
/* The signedness of the sample data. */
|
||||||
bool sgnd;
|
bool sgnd;
|
||||||
|
|
||||||
/* The sample alignment horizontal offset. */
|
/* The sample alignment horizontal offset. */
|
||||||
uint_fast32_t hsubstep;
|
uint_fast32_t hsubstep;
|
||||||
|
|
||||||
/* The sample alignment vertical offset. */
|
/* The sample alignment vertical offset. */
|
||||||
uint_fast32_t vsubstep;
|
uint_fast32_t vsubstep;
|
||||||
|
|
||||||
} jpc_dec_cmpt_t;
|
} jpc_dec_cmpt_t;
|
||||||
|
|
||||||
@ -568,96 +568,96 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The decoded image. */
|
/* The decoded image. */
|
||||||
jas_image_t *image;
|
jas_image_t *image;
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the image area on
|
/* The x-coordinate of the top-left corner of the image area on
|
||||||
the reference grid. */
|
the reference grid. */
|
||||||
uint_fast32_t xstart;
|
uint_fast32_t xstart;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the image area on
|
/* The y-coordinate of the top-left corner of the image area on
|
||||||
the reference grid. */
|
the reference grid. */
|
||||||
uint_fast32_t ystart;
|
uint_fast32_t ystart;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the image area on
|
/* The x-coordinate of the bottom-right corner of the image area on
|
||||||
the reference grid (plus one). */
|
the reference grid (plus one). */
|
||||||
uint_fast32_t xend;
|
uint_fast32_t xend;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the image area on
|
/* The y-coordinate of the bottom-right corner of the image area on
|
||||||
the reference grid (plus one). */
|
the reference grid (plus one). */
|
||||||
uint_fast32_t yend;
|
uint_fast32_t yend;
|
||||||
|
|
||||||
/* The nominal tile width in units of the image reference grid. */
|
/* The nominal tile width in units of the image reference grid. */
|
||||||
uint_fast32_t tilewidth;
|
uint_fast32_t tilewidth;
|
||||||
|
|
||||||
/* The nominal tile height in units of the image reference grid. */
|
/* The nominal tile height in units of the image reference grid. */
|
||||||
uint_fast32_t tileheight;
|
uint_fast32_t tileheight;
|
||||||
|
|
||||||
/* The horizontal offset from the origin of the reference grid to the
|
/* The horizontal offset from the origin of the reference grid to the
|
||||||
left side of the first tile. */
|
left side of the first tile. */
|
||||||
uint_fast32_t tilexoff;
|
uint_fast32_t tilexoff;
|
||||||
|
|
||||||
/* The vertical offset from the origin of the reference grid to the
|
/* The vertical offset from the origin of the reference grid to the
|
||||||
top side of the first tile. */
|
top side of the first tile. */
|
||||||
uint_fast32_t tileyoff;
|
uint_fast32_t tileyoff;
|
||||||
|
|
||||||
/* The number of tiles spanning the image area in the vertical
|
/* The number of tiles spanning the image area in the vertical
|
||||||
direction. */
|
direction. */
|
||||||
int numhtiles;
|
int numhtiles;
|
||||||
|
|
||||||
/* The number of tiles spanning the image area in the horizontal
|
/* The number of tiles spanning the image area in the horizontal
|
||||||
direction. */
|
direction. */
|
||||||
int numvtiles;
|
int numvtiles;
|
||||||
|
|
||||||
/* The total number of tiles. */
|
/* The total number of tiles. */
|
||||||
int numtiles;
|
int numtiles;
|
||||||
|
|
||||||
/* The per-tile information. */
|
/* The per-tile information. */
|
||||||
jpc_dec_tile_t *tiles;
|
jpc_dec_tile_t *tiles;
|
||||||
|
|
||||||
/* The tile currently being processed. */
|
/* The tile currently being processed. */
|
||||||
jpc_dec_tile_t *curtile;
|
jpc_dec_tile_t *curtile;
|
||||||
|
|
||||||
/* The number of components. */
|
/* The number of components. */
|
||||||
int numcomps;
|
int numcomps;
|
||||||
|
|
||||||
/* The stream containing the input JPEG-2000 code stream data. */
|
/* The stream containing the input JPEG-2000 code stream data. */
|
||||||
jas_stream_t *in;
|
jas_stream_t *in;
|
||||||
|
|
||||||
/* The default coding parameters for all tiles. */
|
/* The default coding parameters for all tiles. */
|
||||||
jpc_dec_cp_t *cp;
|
jpc_dec_cp_t *cp;
|
||||||
|
|
||||||
/* The maximum number of layers that may be decoded. */
|
/* The maximum number of layers that may be decoded. */
|
||||||
int maxlyrs;
|
int maxlyrs;
|
||||||
|
|
||||||
/* The maximum number of packets that may be decoded. */
|
/* The maximum number of packets that may be decoded. */
|
||||||
int maxpkts;
|
int maxpkts;
|
||||||
|
|
||||||
/* The number of packets decoded so far in the processing of the entire
|
/* The number of packets decoded so far in the processing of the entire
|
||||||
code stream. */
|
code stream. */
|
||||||
int numpkts;
|
int numpkts;
|
||||||
|
|
||||||
/* The next expected PPM marker segment sequence number. */
|
/* The next expected PPM marker segment sequence number. */
|
||||||
int ppmseqno;
|
int ppmseqno;
|
||||||
|
|
||||||
/* The current state for code stream processing. */
|
/* The current state for code stream processing. */
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
/* The per-component information. */
|
/* The per-component information. */
|
||||||
jpc_dec_cmpt_t *cmpts;
|
jpc_dec_cmpt_t *cmpts;
|
||||||
|
|
||||||
/* The information from PPM marker segments. */
|
/* The information from PPM marker segments. */
|
||||||
jpc_ppxstab_t *ppmstab;
|
jpc_ppxstab_t *ppmstab;
|
||||||
|
|
||||||
/* A list of streams containing packet header data from PPM marker
|
/* A list of streams containing packet header data from PPM marker
|
||||||
segments. */
|
segments. */
|
||||||
jpc_streamlist_t *pkthdrstreams;
|
jpc_streamlist_t *pkthdrstreams;
|
||||||
|
|
||||||
/* The expected ending offset for a tile-part. */
|
/* The expected ending offset for a tile-part. */
|
||||||
long curtileendoff;
|
long curtileendoff;
|
||||||
|
|
||||||
/* This is required by the tier-2 decoder. */
|
/* This is required by the tier-2 decoder. */
|
||||||
jpc_cstate_t *cstate;
|
jpc_cstate_t *cstate;
|
||||||
|
|
||||||
} jpc_dec_t;
|
} jpc_dec_t;
|
||||||
|
|
||||||
@ -665,14 +665,14 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The debug level for the decoder. */
|
/* The debug level for the decoder. */
|
||||||
int debug;
|
int debug;
|
||||||
|
|
||||||
/* The maximum number of layers to decode. */
|
/* The maximum number of layers to decode. */
|
||||||
int maxlyrs;
|
int maxlyrs;
|
||||||
|
|
||||||
/* The maximum number of packets to decode. */
|
/* The maximum number of packets to decode. */
|
||||||
int maxpkts;
|
int maxpkts;
|
||||||
|
|
||||||
} jpc_dec_importopts_t;
|
} jpc_dec_importopts_t;
|
||||||
|
|
||||||
|
3978
3rdparty/libjasper/jpc_enc.c
vendored
3978
3rdparty/libjasper/jpc_enc.c
vendored
File diff suppressed because it is too large
Load Diff
654
3rdparty/libjasper/jpc_enc.h
vendored
654
3rdparty/libjasper/jpc_enc.h
vendored
@ -100,29 +100,29 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The horizontal sampling period. */
|
/* The horizontal sampling period. */
|
||||||
uint_fast8_t sampgrdstepx;
|
uint_fast8_t sampgrdstepx;
|
||||||
|
|
||||||
/* The vertical sampling period. */
|
/* The vertical sampling period. */
|
||||||
uint_fast8_t sampgrdstepy;
|
uint_fast8_t sampgrdstepy;
|
||||||
|
|
||||||
/* The sample alignment horizontal offset. */
|
/* The sample alignment horizontal offset. */
|
||||||
uint_fast8_t sampgrdsubstepx;
|
uint_fast8_t sampgrdsubstepx;
|
||||||
|
|
||||||
/* The sample alignment vertical offset. */
|
/* The sample alignment vertical offset. */
|
||||||
uint_fast8_t sampgrdsubstepy;
|
uint_fast8_t sampgrdsubstepy;
|
||||||
|
|
||||||
/* The precision of the samples. */
|
/* The precision of the samples. */
|
||||||
uint_fast8_t prec;
|
uint_fast8_t prec;
|
||||||
|
|
||||||
/* The signedness of the samples. */
|
/* The signedness of the samples. */
|
||||||
bool sgnd;
|
bool sgnd;
|
||||||
|
|
||||||
/* The number of step sizes. */
|
/* The number of step sizes. */
|
||||||
uint_fast16_t numstepsizes;
|
uint_fast16_t numstepsizes;
|
||||||
|
|
||||||
/* The quantizer step sizes. */
|
/* The quantizer step sizes. */
|
||||||
uint_fast16_t stepsizes[JPC_MAXBANDS];
|
uint_fast16_t stepsizes[JPC_MAXBANDS];
|
||||||
|
|
||||||
} jpc_enc_ccp_t;
|
} jpc_enc_ccp_t;
|
||||||
|
|
||||||
@ -130,24 +130,24 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The coding mode. */
|
/* The coding mode. */
|
||||||
bool intmode;
|
bool intmode;
|
||||||
|
|
||||||
/* The coding style (i.e., SOP, EPH). */
|
/* The coding style (i.e., SOP, EPH). */
|
||||||
uint_fast8_t csty;
|
uint_fast8_t csty;
|
||||||
|
|
||||||
/* The progression order. */
|
/* The progression order. */
|
||||||
uint_fast8_t prg;
|
uint_fast8_t prg;
|
||||||
|
|
||||||
/* The multicomponent transform. */
|
/* The multicomponent transform. */
|
||||||
uint_fast8_t mctid;
|
uint_fast8_t mctid;
|
||||||
|
|
||||||
/* The number of layers. */
|
/* The number of layers. */
|
||||||
uint_fast16_t numlyrs;
|
uint_fast16_t numlyrs;
|
||||||
|
|
||||||
/* The normalized bit rates associated with the various
|
/* The normalized bit rates associated with the various
|
||||||
intermediate layers. */
|
intermediate layers. */
|
||||||
jpc_fix_t *ilyrrates;
|
jpc_fix_t *ilyrrates;
|
||||||
|
|
||||||
} jpc_enc_tcp_t;
|
} jpc_enc_tcp_t;
|
||||||
|
|
||||||
@ -155,33 +155,33 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The coding style (i.e., explicit precinct sizes). */
|
/* The coding style (i.e., explicit precinct sizes). */
|
||||||
uint_fast8_t csty;
|
uint_fast8_t csty;
|
||||||
|
|
||||||
/* The maximum number of resolution levels allowed. */
|
/* The maximum number of resolution levels allowed. */
|
||||||
uint_fast8_t maxrlvls;
|
uint_fast8_t maxrlvls;
|
||||||
|
|
||||||
/* The exponent for the nominal code block width. */
|
/* The exponent for the nominal code block width. */
|
||||||
uint_fast16_t cblkwidthexpn;
|
uint_fast16_t cblkwidthexpn;
|
||||||
|
|
||||||
/* The exponent for the nominal code block height. */
|
/* The exponent for the nominal code block height. */
|
||||||
uint_fast16_t cblkheightexpn;
|
uint_fast16_t cblkheightexpn;
|
||||||
|
|
||||||
/* The code block style parameters (e.g., lazy, terminate all,
|
/* The code block style parameters (e.g., lazy, terminate all,
|
||||||
segmentation symbols, causal, reset probability models). */
|
segmentation symbols, causal, reset probability models). */
|
||||||
uint_fast8_t cblksty;
|
uint_fast8_t cblksty;
|
||||||
|
|
||||||
/* The QMFB. */
|
/* The QMFB. */
|
||||||
uint_fast8_t qmfbid;
|
uint_fast8_t qmfbid;
|
||||||
|
|
||||||
/* The precinct width values. */
|
/* The precinct width values. */
|
||||||
uint_fast16_t prcwidthexpns[JPC_MAXRLVLS];
|
uint_fast16_t prcwidthexpns[JPC_MAXRLVLS];
|
||||||
|
|
||||||
/* The precinct height values. */
|
/* The precinct height values. */
|
||||||
uint_fast16_t prcheightexpns[JPC_MAXRLVLS];
|
uint_fast16_t prcheightexpns[JPC_MAXRLVLS];
|
||||||
|
|
||||||
/* The number of guard bits. */
|
/* The number of guard bits. */
|
||||||
uint_fast8_t numgbits;
|
uint_fast8_t numgbits;
|
||||||
|
|
||||||
} jpc_enc_tccp_t;
|
} jpc_enc_tccp_t;
|
||||||
|
|
||||||
@ -189,67 +189,67 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The debug level. */
|
/* The debug level. */
|
||||||
int debug;
|
int debug;
|
||||||
|
|
||||||
/* The horizontal offset from the origin of the reference grid to the
|
/* The horizontal offset from the origin of the reference grid to the
|
||||||
left edge of the image area. */
|
left edge of the image area. */
|
||||||
uint_fast32_t imgareatlx;
|
uint_fast32_t imgareatlx;
|
||||||
|
|
||||||
/* The vertical offset from the origin of the reference grid to the
|
/* The vertical offset from the origin of the reference grid to the
|
||||||
top edge of the image area. */
|
top edge of the image area. */
|
||||||
uint_fast32_t imgareatly;
|
uint_fast32_t imgareatly;
|
||||||
|
|
||||||
/* The horizontal offset from the origin of the reference grid to the
|
/* The horizontal offset from the origin of the reference grid to the
|
||||||
right edge of the image area (plus one). */
|
right edge of the image area (plus one). */
|
||||||
uint_fast32_t refgrdwidth;
|
uint_fast32_t refgrdwidth;
|
||||||
|
|
||||||
/* The vertical offset from the origin of the reference grid to the
|
/* The vertical offset from the origin of the reference grid to the
|
||||||
bottom edge of the image area (plus one). */
|
bottom edge of the image area (plus one). */
|
||||||
uint_fast32_t refgrdheight;
|
uint_fast32_t refgrdheight;
|
||||||
|
|
||||||
/* The horizontal offset from the origin of the tile grid to the
|
/* The horizontal offset from the origin of the tile grid to the
|
||||||
origin of the reference grid. */
|
origin of the reference grid. */
|
||||||
uint_fast32_t tilegrdoffx;
|
uint_fast32_t tilegrdoffx;
|
||||||
|
|
||||||
/* The vertical offset from the origin of the tile grid to the
|
/* The vertical offset from the origin of the tile grid to the
|
||||||
origin of the reference grid. */
|
origin of the reference grid. */
|
||||||
uint_fast32_t tilegrdoffy;
|
uint_fast32_t tilegrdoffy;
|
||||||
|
|
||||||
/* The nominal tile width in units of the image reference grid. */
|
/* The nominal tile width in units of the image reference grid. */
|
||||||
uint_fast32_t tilewidth;
|
uint_fast32_t tilewidth;
|
||||||
|
|
||||||
/* The nominal tile height in units of the image reference grid. */
|
/* The nominal tile height in units of the image reference grid. */
|
||||||
uint_fast32_t tileheight;
|
uint_fast32_t tileheight;
|
||||||
|
|
||||||
/* The number of tiles spanning the image area in the horizontal
|
/* The number of tiles spanning the image area in the horizontal
|
||||||
direction. */
|
direction. */
|
||||||
uint_fast32_t numhtiles;
|
uint_fast32_t numhtiles;
|
||||||
|
|
||||||
/* The number of tiles spanning the image area in the vertical
|
/* The number of tiles spanning the image area in the vertical
|
||||||
direction. */
|
direction. */
|
||||||
uint_fast32_t numvtiles;
|
uint_fast32_t numvtiles;
|
||||||
|
|
||||||
/* The number of tiles. */
|
/* The number of tiles. */
|
||||||
uint_fast32_t numtiles;
|
uint_fast32_t numtiles;
|
||||||
|
|
||||||
/* The number of components. */
|
/* The number of components. */
|
||||||
uint_fast16_t numcmpts;
|
uint_fast16_t numcmpts;
|
||||||
|
|
||||||
/* The per-component coding parameters. */
|
/* The per-component coding parameters. */
|
||||||
jpc_enc_ccp_t *ccps;
|
jpc_enc_ccp_t *ccps;
|
||||||
|
|
||||||
/* The per-tile coding parameters. */
|
/* The per-tile coding parameters. */
|
||||||
jpc_enc_tcp_t tcp;
|
jpc_enc_tcp_t tcp;
|
||||||
|
|
||||||
/* The per-tile-component coding parameters. */
|
/* The per-tile-component coding parameters. */
|
||||||
jpc_enc_tccp_t tccp;
|
jpc_enc_tccp_t tccp;
|
||||||
|
|
||||||
/* The target code stream length in bytes. */
|
/* The target code stream length in bytes. */
|
||||||
uint_fast32_t totalsize;
|
uint_fast32_t totalsize;
|
||||||
|
|
||||||
/* The raw (i.e., uncompressed) size of the image in bytes. */
|
/* The raw (i.e., uncompressed) size of the image in bytes. */
|
||||||
uint_fast32_t rawsize;
|
uint_fast32_t rawsize;
|
||||||
|
|
||||||
} jpc_enc_cp_t;
|
} jpc_enc_cp_t;
|
||||||
|
|
||||||
@ -261,35 +261,35 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The starting offset for this pass. */
|
/* The starting offset for this pass. */
|
||||||
int start;
|
int start;
|
||||||
|
|
||||||
/* The ending offset for this pass. */
|
/* The ending offset for this pass. */
|
||||||
int end;
|
int end;
|
||||||
|
|
||||||
/* The type of data in this pass (i.e., MQ or raw). */
|
/* The type of data in this pass (i.e., MQ or raw). */
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
/* Flag indicating that this pass is terminated. */
|
/* Flag indicating that this pass is terminated. */
|
||||||
int term;
|
int term;
|
||||||
|
|
||||||
/* The entropy coder state after coding this pass. */
|
/* The entropy coder state after coding this pass. */
|
||||||
jpc_mqencstate_t mqencstate;
|
jpc_mqencstate_t mqencstate;
|
||||||
|
|
||||||
/* The layer to which this pass has been assigned. */
|
/* The layer to which this pass has been assigned. */
|
||||||
int lyrno;
|
int lyrno;
|
||||||
|
|
||||||
/* The R-D slope for this pass. */
|
/* The R-D slope for this pass. */
|
||||||
jpc_flt_t rdslope;
|
jpc_flt_t rdslope;
|
||||||
|
|
||||||
/* The weighted MSE reduction associated with this pass. */
|
/* The weighted MSE reduction associated with this pass. */
|
||||||
jpc_flt_t wmsedec;
|
jpc_flt_t wmsedec;
|
||||||
|
|
||||||
/* The cumulative weighted MSE reduction. */
|
/* The cumulative weighted MSE reduction. */
|
||||||
jpc_flt_t cumwmsedec;
|
jpc_flt_t cumwmsedec;
|
||||||
|
|
||||||
/* The normalized MSE reduction. */
|
/* The normalized MSE reduction. */
|
||||||
long nmsedec;
|
long nmsedec;
|
||||||
|
|
||||||
} jpc_enc_pass_t;
|
} jpc_enc_pass_t;
|
||||||
|
|
||||||
@ -297,53 +297,53 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of passes. */
|
/* The number of passes. */
|
||||||
int numpasses;
|
int numpasses;
|
||||||
|
|
||||||
/* The per-pass information. */
|
/* The per-pass information. */
|
||||||
jpc_enc_pass_t *passes;
|
jpc_enc_pass_t *passes;
|
||||||
|
|
||||||
/* The number of passes encoded so far. */
|
/* The number of passes encoded so far. */
|
||||||
int numencpasses;
|
int numencpasses;
|
||||||
|
|
||||||
/* The number of insignificant MSBs. */
|
/* The number of insignificant MSBs. */
|
||||||
int numimsbs;
|
int numimsbs;
|
||||||
|
|
||||||
/* The number of bits used to encode pass data lengths. */
|
/* The number of bits used to encode pass data lengths. */
|
||||||
int numlenbits;
|
int numlenbits;
|
||||||
|
|
||||||
/* The byte stream for this code block. */
|
/* The byte stream for this code block. */
|
||||||
jas_stream_t *stream;
|
jas_stream_t *stream;
|
||||||
|
|
||||||
/* The entropy encoder. */
|
/* The entropy encoder. */
|
||||||
jpc_mqenc_t *mqenc;
|
jpc_mqenc_t *mqenc;
|
||||||
|
|
||||||
/* The data for this code block. */
|
/* The data for this code block. */
|
||||||
jas_matrix_t *data;
|
jas_matrix_t *data;
|
||||||
|
|
||||||
/* The state for this code block. */
|
/* The state for this code block. */
|
||||||
jas_matrix_t *flags;
|
jas_matrix_t *flags;
|
||||||
|
|
||||||
/* The number of bit planes required for this code block. */
|
/* The number of bit planes required for this code block. */
|
||||||
int numbps;
|
int numbps;
|
||||||
|
|
||||||
/* The next pass to be encoded. */
|
/* The next pass to be encoded. */
|
||||||
jpc_enc_pass_t *curpass;
|
jpc_enc_pass_t *curpass;
|
||||||
|
|
||||||
/* The per-code-block-group state information. */
|
/* The per-code-block-group state information. */
|
||||||
struct jpc_enc_prc_s *prc;
|
struct jpc_enc_prc_s *prc;
|
||||||
|
|
||||||
/* The saved current pass. */
|
/* The saved current pass. */
|
||||||
/* This is used by the rate control code. */
|
/* This is used by the rate control code. */
|
||||||
jpc_enc_pass_t *savedcurpass;
|
jpc_enc_pass_t *savedcurpass;
|
||||||
|
|
||||||
/* The saved length indicator size. */
|
/* The saved length indicator size. */
|
||||||
/* This is used by the rate control code. */
|
/* This is used by the rate control code. */
|
||||||
int savednumlenbits;
|
int savednumlenbits;
|
||||||
|
|
||||||
/* The saved number of encoded passes. */
|
/* The saved number of encoded passes. */
|
||||||
/* This is used by the rate control code. */
|
/* This is used by the rate control code. */
|
||||||
int savednumencpasses;
|
int savednumencpasses;
|
||||||
|
|
||||||
} jpc_enc_cblk_t;
|
} jpc_enc_cblk_t;
|
||||||
|
|
||||||
@ -351,50 +351,50 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct jpc_enc_prc_s {
|
typedef struct jpc_enc_prc_s {
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the precinct. */
|
/* The x-coordinate of the top-left corner of the precinct. */
|
||||||
uint_fast32_t tlx;
|
uint_fast32_t tlx;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the precinct. */
|
/* The y-coordinate of the top-left corner of the precinct. */
|
||||||
uint_fast32_t tly;
|
uint_fast32_t tly;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the precinct
|
/* The x-coordinate of the bottom-right corner of the precinct
|
||||||
(plus one). */
|
(plus one). */
|
||||||
uint_fast32_t brx;
|
uint_fast32_t brx;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the precinct
|
/* The y-coordinate of the bottom-right corner of the precinct
|
||||||
(plus one). */
|
(plus one). */
|
||||||
uint_fast32_t bry;
|
uint_fast32_t bry;
|
||||||
|
|
||||||
/* The number of code blocks spanning the precinct in the horizontal
|
/* The number of code blocks spanning the precinct in the horizontal
|
||||||
direction. */
|
direction. */
|
||||||
int numhcblks;
|
int numhcblks;
|
||||||
|
|
||||||
/* The number of code blocks spanning the precinct in the vertical
|
/* The number of code blocks spanning the precinct in the vertical
|
||||||
direction. */
|
direction. */
|
||||||
int numvcblks;
|
int numvcblks;
|
||||||
|
|
||||||
/* The total number of code blocks. */
|
/* The total number of code blocks. */
|
||||||
int numcblks;
|
int numcblks;
|
||||||
|
|
||||||
/* The per-code-block information. */
|
/* The per-code-block information. */
|
||||||
jpc_enc_cblk_t *cblks;
|
jpc_enc_cblk_t *cblks;
|
||||||
|
|
||||||
/* The inclusion tag tree. */
|
/* The inclusion tag tree. */
|
||||||
jpc_tagtree_t *incltree;
|
jpc_tagtree_t *incltree;
|
||||||
|
|
||||||
/* The insignifcant MSBs tag tree. */
|
/* The insignifcant MSBs tag tree. */
|
||||||
jpc_tagtree_t *nlibtree;
|
jpc_tagtree_t *nlibtree;
|
||||||
|
|
||||||
/* The per-band information. */
|
/* The per-band information. */
|
||||||
struct jpc_enc_band_s *band;
|
struct jpc_enc_band_s *band;
|
||||||
|
|
||||||
/* The saved inclusion tag tree. */
|
/* The saved inclusion tag tree. */
|
||||||
/* This is used by rate control. */
|
/* This is used by rate control. */
|
||||||
jpc_tagtree_t *savincltree;
|
jpc_tagtree_t *savincltree;
|
||||||
|
|
||||||
/* The saved leading-insignificant-bit-planes tag tree. */
|
/* The saved leading-insignificant-bit-planes tag tree. */
|
||||||
/* This is used by rate control. */
|
/* This is used by rate control. */
|
||||||
jpc_tagtree_t *savnlibtree;
|
jpc_tagtree_t *savnlibtree;
|
||||||
|
|
||||||
} jpc_enc_prc_t;
|
} jpc_enc_prc_t;
|
||||||
|
|
||||||
@ -402,33 +402,33 @@ typedef struct jpc_enc_prc_s {
|
|||||||
|
|
||||||
typedef struct jpc_enc_band_s {
|
typedef struct jpc_enc_band_s {
|
||||||
|
|
||||||
/* The per precinct information. */
|
/* The per precinct information. */
|
||||||
jpc_enc_prc_t *prcs;
|
jpc_enc_prc_t *prcs;
|
||||||
|
|
||||||
/* The coefficient data for this band. */
|
/* The coefficient data for this band. */
|
||||||
jas_matrix_t *data;
|
jas_matrix_t *data;
|
||||||
|
|
||||||
/* The orientation of this band (i.e., LL, LH, HL, or HH). */
|
/* The orientation of this band (i.e., LL, LH, HL, or HH). */
|
||||||
int orient;
|
int orient;
|
||||||
|
|
||||||
/* The number of bit planes associated with this band. */
|
/* The number of bit planes associated with this band. */
|
||||||
int numbps;
|
int numbps;
|
||||||
|
|
||||||
/* The quantizer step size. */
|
/* The quantizer step size. */
|
||||||
jpc_fix_t absstepsize;
|
jpc_fix_t absstepsize;
|
||||||
|
|
||||||
/* The encoded quantizer step size. */
|
/* The encoded quantizer step size. */
|
||||||
int stepsize;
|
int stepsize;
|
||||||
|
|
||||||
/* The L2 norm of the synthesis basis functions associated with
|
/* The L2 norm of the synthesis basis functions associated with
|
||||||
this band. (The MCT is not considered in this value.) */
|
this band. (The MCT is not considered in this value.) */
|
||||||
jpc_fix_t synweight;
|
jpc_fix_t synweight;
|
||||||
|
|
||||||
/* The analysis gain for this band. */
|
/* The analysis gain for this band. */
|
||||||
int analgain;
|
int analgain;
|
||||||
|
|
||||||
/* The per-resolution-level information. */
|
/* The per-resolution-level information. */
|
||||||
struct jpc_enc_rlvl_s *rlvl;
|
struct jpc_enc_rlvl_s *rlvl;
|
||||||
|
|
||||||
} jpc_enc_band_t;
|
} jpc_enc_band_t;
|
||||||
|
|
||||||
@ -436,65 +436,65 @@ typedef struct jpc_enc_band_s {
|
|||||||
|
|
||||||
typedef struct jpc_enc_rlvl_s {
|
typedef struct jpc_enc_rlvl_s {
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the tile-component
|
/* The x-coordinate of the top-left corner of the tile-component
|
||||||
at this resolution. */
|
at this resolution. */
|
||||||
uint_fast32_t tlx;
|
uint_fast32_t tlx;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the tile-component
|
/* The y-coordinate of the top-left corner of the tile-component
|
||||||
at this resolution. */
|
at this resolution. */
|
||||||
uint_fast32_t tly;
|
uint_fast32_t tly;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the tile-component
|
/* The x-coordinate of the bottom-right corner of the tile-component
|
||||||
at this resolution (plus one). */
|
at this resolution (plus one). */
|
||||||
uint_fast32_t brx;
|
uint_fast32_t brx;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the tile-component
|
/* The y-coordinate of the bottom-right corner of the tile-component
|
||||||
at this resolution (plus one). */
|
at this resolution (plus one). */
|
||||||
uint_fast32_t bry;
|
uint_fast32_t bry;
|
||||||
|
|
||||||
/* The exponent value for the nominal precinct width measured
|
/* The exponent value for the nominal precinct width measured
|
||||||
relative to the associated LL band. */
|
relative to the associated LL band. */
|
||||||
int prcwidthexpn;
|
int prcwidthexpn;
|
||||||
|
|
||||||
/* The exponent value for the nominal precinct height measured
|
/* The exponent value for the nominal precinct height measured
|
||||||
relative to the associated LL band. */
|
relative to the associated LL band. */
|
||||||
int prcheightexpn;
|
int prcheightexpn;
|
||||||
|
|
||||||
/* The number of precincts spanning the resolution level in the
|
/* The number of precincts spanning the resolution level in the
|
||||||
horizontal direction. */
|
horizontal direction. */
|
||||||
int numhprcs;
|
int numhprcs;
|
||||||
|
|
||||||
/* The number of precincts spanning the resolution level in the
|
/* The number of precincts spanning the resolution level in the
|
||||||
vertical direction. */
|
vertical direction. */
|
||||||
int numvprcs;
|
int numvprcs;
|
||||||
|
|
||||||
/* The total number of precincts. */
|
/* The total number of precincts. */
|
||||||
int numprcs;
|
int numprcs;
|
||||||
|
|
||||||
/* The exponent value for the nominal code block group width.
|
/* The exponent value for the nominal code block group width.
|
||||||
This quantity is associated with the next lower resolution level
|
This quantity is associated with the next lower resolution level
|
||||||
(assuming that there is one). */
|
(assuming that there is one). */
|
||||||
int cbgwidthexpn;
|
int cbgwidthexpn;
|
||||||
|
|
||||||
/* The exponent value for the nominal code block group height.
|
/* The exponent value for the nominal code block group height.
|
||||||
This quantity is associated with the next lower resolution level
|
This quantity is associated with the next lower resolution level
|
||||||
(assuming that there is one). */
|
(assuming that there is one). */
|
||||||
int cbgheightexpn;
|
int cbgheightexpn;
|
||||||
|
|
||||||
/* The exponent value for the code block width. */
|
/* The exponent value for the code block width. */
|
||||||
uint_fast16_t cblkwidthexpn;
|
uint_fast16_t cblkwidthexpn;
|
||||||
|
|
||||||
/* The exponent value for the code block height. */
|
/* The exponent value for the code block height. */
|
||||||
uint_fast16_t cblkheightexpn;
|
uint_fast16_t cblkheightexpn;
|
||||||
|
|
||||||
/* The number of bands associated with this resolution level. */
|
/* The number of bands associated with this resolution level. */
|
||||||
int numbands;
|
int numbands;
|
||||||
|
|
||||||
/* The per-band information. */
|
/* The per-band information. */
|
||||||
jpc_enc_band_t *bands;
|
jpc_enc_band_t *bands;
|
||||||
|
|
||||||
/* The parent tile-component. */
|
/* The parent tile-component. */
|
||||||
struct jpc_enc_tcmpt_s *tcmpt;
|
struct jpc_enc_tcmpt_s *tcmpt;
|
||||||
|
|
||||||
} jpc_enc_rlvl_t;
|
} jpc_enc_rlvl_t;
|
||||||
|
|
||||||
@ -502,53 +502,53 @@ typedef struct jpc_enc_rlvl_s {
|
|||||||
|
|
||||||
typedef struct jpc_enc_tcmpt_s {
|
typedef struct jpc_enc_tcmpt_s {
|
||||||
|
|
||||||
/* The number of resolution levels. */
|
/* The number of resolution levels. */
|
||||||
int numrlvls;
|
int numrlvls;
|
||||||
|
|
||||||
/* The per-resolution-level information. */
|
/* The per-resolution-level information. */
|
||||||
jpc_enc_rlvl_t *rlvls;
|
jpc_enc_rlvl_t *rlvls;
|
||||||
|
|
||||||
/* The tile-component data. */
|
/* The tile-component data. */
|
||||||
jas_matrix_t *data;
|
jas_matrix_t *data;
|
||||||
|
|
||||||
/* The QMFB. */
|
/* The QMFB. */
|
||||||
int qmfbid;
|
int qmfbid;
|
||||||
|
|
||||||
/* The number of bands. */
|
/* The number of bands. */
|
||||||
int numbands;
|
int numbands;
|
||||||
|
|
||||||
/* The TSFB. */
|
/* The TSFB. */
|
||||||
jpc_tsfb_t *tsfb;
|
jpc_tsfb_t *tsfb;
|
||||||
|
|
||||||
/* The synthesis energy weight (for the MCT). */
|
/* The synthesis energy weight (for the MCT). */
|
||||||
jpc_fix_t synweight;
|
jpc_fix_t synweight;
|
||||||
|
|
||||||
/* The precinct width exponents. */
|
/* The precinct width exponents. */
|
||||||
int prcwidthexpns[JPC_MAXRLVLS];
|
int prcwidthexpns[JPC_MAXRLVLS];
|
||||||
|
|
||||||
/* The precinct height exponents. */
|
/* The precinct height exponents. */
|
||||||
int prcheightexpns[JPC_MAXRLVLS];
|
int prcheightexpns[JPC_MAXRLVLS];
|
||||||
|
|
||||||
/* The code block width exponent. */
|
/* The code block width exponent. */
|
||||||
int cblkwidthexpn;
|
int cblkwidthexpn;
|
||||||
|
|
||||||
/* The code block height exponent. */
|
/* The code block height exponent. */
|
||||||
int cblkheightexpn;
|
int cblkheightexpn;
|
||||||
|
|
||||||
/* Coding style (i.e., explicit precinct sizes). */
|
/* Coding style (i.e., explicit precinct sizes). */
|
||||||
int csty;
|
int csty;
|
||||||
|
|
||||||
/* Code block style. */
|
/* Code block style. */
|
||||||
int cblksty;
|
int cblksty;
|
||||||
|
|
||||||
/* The number of quantizer step sizes. */
|
/* The number of quantizer step sizes. */
|
||||||
int numstepsizes;
|
int numstepsizes;
|
||||||
|
|
||||||
/* The encoded quantizer step sizes. */
|
/* The encoded quantizer step sizes. */
|
||||||
uint_fast16_t stepsizes[JPC_MAXBANDS];
|
uint_fast16_t stepsizes[JPC_MAXBANDS];
|
||||||
|
|
||||||
/* The parent tile. */
|
/* The parent tile. */
|
||||||
struct jpc_enc_tile_s *tile;
|
struct jpc_enc_tile_s *tile;
|
||||||
|
|
||||||
} jpc_enc_tcmpt_t;
|
} jpc_enc_tcmpt_t;
|
||||||
|
|
||||||
@ -556,55 +556,55 @@ typedef struct jpc_enc_tcmpt_s {
|
|||||||
|
|
||||||
typedef struct jpc_enc_tile_s {
|
typedef struct jpc_enc_tile_s {
|
||||||
|
|
||||||
/* The tile number. */
|
/* The tile number. */
|
||||||
uint_fast32_t tileno;
|
uint_fast32_t tileno;
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the tile measured with
|
/* The x-coordinate of the top-left corner of the tile measured with
|
||||||
respect to the reference grid. */
|
respect to the reference grid. */
|
||||||
uint_fast32_t tlx;
|
uint_fast32_t tlx;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the tile measured with
|
/* The y-coordinate of the top-left corner of the tile measured with
|
||||||
respect to the reference grid. */
|
respect to the reference grid. */
|
||||||
uint_fast32_t tly;
|
uint_fast32_t tly;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the tile measured
|
/* The x-coordinate of the bottom-right corner of the tile measured
|
||||||
with respect to the reference grid (plus one). */
|
with respect to the reference grid (plus one). */
|
||||||
uint_fast32_t brx;
|
uint_fast32_t brx;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the tile measured
|
/* The y-coordinate of the bottom-right corner of the tile measured
|
||||||
with respect to the reference grid (plus one). */
|
with respect to the reference grid (plus one). */
|
||||||
uint_fast32_t bry;
|
uint_fast32_t bry;
|
||||||
|
|
||||||
/* The coding style. */
|
/* The coding style. */
|
||||||
uint_fast8_t csty;
|
uint_fast8_t csty;
|
||||||
|
|
||||||
/* The progression order. */
|
/* The progression order. */
|
||||||
uint_fast8_t prg;
|
uint_fast8_t prg;
|
||||||
|
|
||||||
/* The number of layers. */
|
/* The number of layers. */
|
||||||
int numlyrs;
|
int numlyrs;
|
||||||
|
|
||||||
/* The MCT to employ (if any). */
|
/* The MCT to employ (if any). */
|
||||||
uint_fast8_t mctid;
|
uint_fast8_t mctid;
|
||||||
|
|
||||||
/* The packet iterator (used to determine the order of packet
|
/* The packet iterator (used to determine the order of packet
|
||||||
generation). */
|
generation). */
|
||||||
jpc_pi_t *pi;
|
jpc_pi_t *pi;
|
||||||
|
|
||||||
/* The coding mode (i.e., integer or real). */
|
/* The coding mode (i.e., integer or real). */
|
||||||
bool intmode;
|
bool intmode;
|
||||||
|
|
||||||
/* The number of bytes to allocate to the various layers. */
|
/* The number of bytes to allocate to the various layers. */
|
||||||
uint_fast32_t *lyrsizes;
|
uint_fast32_t *lyrsizes;
|
||||||
|
|
||||||
/* The number of tile-components. */
|
/* The number of tile-components. */
|
||||||
int numtcmpts;
|
int numtcmpts;
|
||||||
|
|
||||||
/* The per tile-component information. */
|
/* The per tile-component information. */
|
||||||
jpc_enc_tcmpt_t *tcmpts;
|
jpc_enc_tcmpt_t *tcmpts;
|
||||||
|
|
||||||
/* The raw (i.e., uncompressed) size of this tile. */
|
/* The raw (i.e., uncompressed) size of this tile. */
|
||||||
uint_fast32_t rawsize;
|
uint_fast32_t rawsize;
|
||||||
|
|
||||||
} jpc_enc_tile_t;
|
} jpc_enc_tile_t;
|
||||||
|
|
||||||
@ -612,34 +612,34 @@ typedef struct jpc_enc_tile_s {
|
|||||||
|
|
||||||
typedef struct jpc_enc_s {
|
typedef struct jpc_enc_s {
|
||||||
|
|
||||||
/* The image being encoded. */
|
/* The image being encoded. */
|
||||||
jas_image_t *image;
|
jas_image_t *image;
|
||||||
|
|
||||||
/* The output stream. */
|
/* The output stream. */
|
||||||
jas_stream_t *out;
|
jas_stream_t *out;
|
||||||
|
|
||||||
/* The coding parameters. */
|
/* The coding parameters. */
|
||||||
jpc_enc_cp_t *cp;
|
jpc_enc_cp_t *cp;
|
||||||
|
|
||||||
/* The tile currently being processed. */
|
/* The tile currently being processed. */
|
||||||
jpc_enc_tile_t *curtile;
|
jpc_enc_tile_t *curtile;
|
||||||
|
|
||||||
/* The code stream state. */
|
/* The code stream state. */
|
||||||
jpc_cstate_t *cstate;
|
jpc_cstate_t *cstate;
|
||||||
|
|
||||||
/* The number of bytes output so far. */
|
/* The number of bytes output so far. */
|
||||||
uint_fast32_t len;
|
uint_fast32_t len;
|
||||||
|
|
||||||
/* The number of bytes available for the main body of the code stream. */
|
/* The number of bytes available for the main body of the code stream. */
|
||||||
/* This is used for rate allocation purposes. */
|
/* This is used for rate allocation purposes. */
|
||||||
uint_fast32_t mainbodysize;
|
uint_fast32_t mainbodysize;
|
||||||
|
|
||||||
/* The marker segment currently being processed. */
|
/* The marker segment currently being processed. */
|
||||||
/* This member is a convenience for making cleanup easier. */
|
/* This member is a convenience for making cleanup easier. */
|
||||||
jpc_ms_t *mrk;
|
jpc_ms_t *mrk;
|
||||||
|
|
||||||
/* The stream used to temporarily hold tile-part data. */
|
/* The stream used to temporarily hold tile-part data. */
|
||||||
jas_stream_t *tmpstream;
|
jas_stream_t *tmpstream;
|
||||||
|
|
||||||
} jpc_enc_t;
|
} jpc_enc_t;
|
||||||
|
|
||||||
|
8
3rdparty/libjasper/jpc_fix.h
vendored
8
3rdparty/libjasper/jpc_fix.h
vendored
@ -113,11 +113,11 @@ typedef int_fast64_t jpc_fix_big_t;
|
|||||||
#define jpc_fix_add(x, y) JAS_FIX_ADD(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
#define jpc_fix_add(x, y) JAS_FIX_ADD(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
||||||
#define jpc_fix_sub(x, y) JAS_FIX_SUB(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
#define jpc_fix_sub(x, y) JAS_FIX_SUB(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
||||||
#define jpc_fix_mul(x, y) \
|
#define jpc_fix_mul(x, y) \
|
||||||
JAS_FIX_MUL(jpc_fix_t, JPC_FIX_FRACBITS, jpc_fix_big_t, x, y)
|
JAS_FIX_MUL(jpc_fix_t, JPC_FIX_FRACBITS, jpc_fix_big_t, x, y)
|
||||||
#define jpc_fix_mulbyint(x, y) \
|
#define jpc_fix_mulbyint(x, y) \
|
||||||
JAS_FIX_MULBYINT(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
JAS_FIX_MULBYINT(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
||||||
#define jpc_fix_div(x, y) \
|
#define jpc_fix_div(x, y) \
|
||||||
JAS_FIX_DIV(jpc_fix_t, JPC_FIX_FRACBITS, jpc_fix_big_t, x, y)
|
JAS_FIX_DIV(jpc_fix_t, JPC_FIX_FRACBITS, jpc_fix_big_t, x, y)
|
||||||
#define jpc_fix_neg(x) JAS_FIX_NEG(jpc_fix_t, JPC_FIX_FRACBITS, x)
|
#define jpc_fix_neg(x) JAS_FIX_NEG(jpc_fix_t, JPC_FIX_FRACBITS, x)
|
||||||
#define jpc_fix_asl(x, n) JAS_FIX_ASL(jpc_fix_t, JPC_FIX_FRACBITS, x, n)
|
#define jpc_fix_asl(x, n) JAS_FIX_ASL(jpc_fix_t, JPC_FIX_FRACBITS, x, n)
|
||||||
#define jpc_fix_asr(x, n) JAS_FIX_ASR(jpc_fix_t, JPC_FIX_FRACBITS, x, n)
|
#define jpc_fix_asr(x, n) JAS_FIX_ASR(jpc_fix_t, JPC_FIX_FRACBITS, x, n)
|
||||||
@ -125,7 +125,7 @@ typedef int_fast64_t jpc_fix_big_t;
|
|||||||
#define jpc_fix_pluseq(x, y) JAS_FIX_PLUSEQ(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
#define jpc_fix_pluseq(x, y) JAS_FIX_PLUSEQ(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
||||||
#define jpc_fix_minuseq(x, y) JAS_FIX_MINUSEQ(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
#define jpc_fix_minuseq(x, y) JAS_FIX_MINUSEQ(jpc_fix_t, JPC_FIX_FRACBITS, x, y)
|
||||||
#define jpc_fix_muleq(x, y) \
|
#define jpc_fix_muleq(x, y) \
|
||||||
JAS_FIX_MULEQ(jpc_fix_t, JPC_FIX_FRACBITS, jpc_fix_big_t, x, y)
|
JAS_FIX_MULEQ(jpc_fix_t, JPC_FIX_FRACBITS, jpc_fix_big_t, x, y)
|
||||||
|
|
||||||
#define jpc_fix_abs(x) JAS_FIX_ABS(jpc_fix_t, JPC_FIX_FRACBITS, x)
|
#define jpc_fix_abs(x) JAS_FIX_ABS(jpc_fix_t, JPC_FIX_FRACBITS, x)
|
||||||
#define jpc_fix_isint(x) JAS_FIX_ISINT(jpc_fix_t, JPC_FIX_FRACBITS, x)
|
#define jpc_fix_isint(x) JAS_FIX_ISINT(jpc_fix_t, JPC_FIX_FRACBITS, x)
|
||||||
|
36
3rdparty/libjasper/jpc_math.c
vendored
36
3rdparty/libjasper/jpc_math.c
vendored
@ -88,17 +88,17 @@
|
|||||||
integer. */
|
integer. */
|
||||||
int jpc_floorlog2(int x)
|
int jpc_floorlog2(int x)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
/* The argument must be positive. */
|
/* The argument must be positive. */
|
||||||
assert(x > 0);
|
assert(x > 0);
|
||||||
|
|
||||||
y = 0;
|
y = 0;
|
||||||
while (x > 1) {
|
while (x > 1) {
|
||||||
x >>= 1;
|
x >>= 1;
|
||||||
++y;
|
++y;
|
||||||
}
|
}
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the bit position of the first leading one in a nonnegative
|
/* Calculate the bit position of the first leading one in a nonnegative
|
||||||
@ -107,15 +107,15 @@ int jpc_floorlog2(int x)
|
|||||||
allowable range for x is slightly different. */
|
allowable range for x is slightly different. */
|
||||||
int jpc_firstone(int x)
|
int jpc_firstone(int x)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* The argument must be nonnegative. */
|
/* The argument must be nonnegative. */
|
||||||
assert(x >= 0);
|
assert(x >= 0);
|
||||||
|
|
||||||
n = -1;
|
n = -1;
|
||||||
while (x > 0) {
|
while (x > 0) {
|
||||||
x >>= 1;
|
x >>= 1;
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
344
3rdparty/libjasper/jpc_mct.c
vendored
344
3rdparty/libjasper/jpc_mct.c
vendored
@ -86,206 +86,206 @@
|
|||||||
|
|
||||||
void jpc_rct(jas_matrix_t *c0, jas_matrix_t *c1, jas_matrix_t *c2)
|
void jpc_rct(jas_matrix_t *c0, jas_matrix_t *c1, jas_matrix_t *c2)
|
||||||
{
|
{
|
||||||
int numrows;
|
int numrows;
|
||||||
int numcols;
|
int numcols;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jpc_fix_t *c0p;
|
jpc_fix_t *c0p;
|
||||||
jpc_fix_t *c1p;
|
jpc_fix_t *c1p;
|
||||||
jpc_fix_t *c2p;
|
jpc_fix_t *c2p;
|
||||||
|
|
||||||
numrows = jas_matrix_numrows(c0);
|
numrows = jas_matrix_numrows(c0);
|
||||||
numcols = jas_matrix_numcols(c0);
|
numcols = jas_matrix_numcols(c0);
|
||||||
|
|
||||||
/* All three matrices must have the same dimensions. */
|
/* All three matrices must have the same dimensions. */
|
||||||
assert(jas_matrix_numrows(c1) == numrows && jas_matrix_numcols(c1) == numcols
|
assert(jas_matrix_numrows(c1) == numrows && jas_matrix_numcols(c1) == numcols
|
||||||
&& jas_matrix_numrows(c2) == numrows && jas_matrix_numcols(c2) == numcols);
|
&& jas_matrix_numrows(c2) == numrows && jas_matrix_numcols(c2) == numcols);
|
||||||
|
|
||||||
for (i = 0; i < numrows; i++) {
|
for (i = 0; i < numrows; i++) {
|
||||||
c0p = jas_matrix_getref(c0, i, 0);
|
c0p = jas_matrix_getref(c0, i, 0);
|
||||||
c1p = jas_matrix_getref(c1, i, 0);
|
c1p = jas_matrix_getref(c1, i, 0);
|
||||||
c2p = jas_matrix_getref(c2, i, 0);
|
c2p = jas_matrix_getref(c2, i, 0);
|
||||||
for (j = numcols; j > 0; --j) {
|
for (j = numcols; j > 0; --j) {
|
||||||
int r;
|
int r;
|
||||||
int g;
|
int g;
|
||||||
int b;
|
int b;
|
||||||
int y;
|
int y;
|
||||||
int u;
|
int u;
|
||||||
int v;
|
int v;
|
||||||
r = *c0p;
|
r = *c0p;
|
||||||
g = *c1p;
|
g = *c1p;
|
||||||
b = *c2p;
|
b = *c2p;
|
||||||
y = (r + (g << 1) + b) >> 2;
|
y = (r + (g << 1) + b) >> 2;
|
||||||
u = b - g;
|
u = b - g;
|
||||||
v = r - g;
|
v = r - g;
|
||||||
*c0p++ = y;
|
*c0p++ = y;
|
||||||
*c1p++ = u;
|
*c1p++ = u;
|
||||||
*c2p++ = v;
|
*c2p++ = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the inverse RCT. */
|
/* Compute the inverse RCT. */
|
||||||
|
|
||||||
void jpc_irct(jas_matrix_t *c0, jas_matrix_t *c1, jas_matrix_t *c2)
|
void jpc_irct(jas_matrix_t *c0, jas_matrix_t *c1, jas_matrix_t *c2)
|
||||||
{
|
{
|
||||||
int numrows;
|
int numrows;
|
||||||
int numcols;
|
int numcols;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jpc_fix_t *c0p;
|
jpc_fix_t *c0p;
|
||||||
jpc_fix_t *c1p;
|
jpc_fix_t *c1p;
|
||||||
jpc_fix_t *c2p;
|
jpc_fix_t *c2p;
|
||||||
|
|
||||||
numrows = jas_matrix_numrows(c0);
|
numrows = jas_matrix_numrows(c0);
|
||||||
numcols = jas_matrix_numcols(c0);
|
numcols = jas_matrix_numcols(c0);
|
||||||
|
|
||||||
/* All three matrices must have the same dimensions. */
|
/* All three matrices must have the same dimensions. */
|
||||||
assert(jas_matrix_numrows(c1) == numrows && jas_matrix_numcols(c1) == numcols
|
assert(jas_matrix_numrows(c1) == numrows && jas_matrix_numcols(c1) == numcols
|
||||||
&& jas_matrix_numrows(c2) == numrows && jas_matrix_numcols(c2) == numcols);
|
&& jas_matrix_numrows(c2) == numrows && jas_matrix_numcols(c2) == numcols);
|
||||||
|
|
||||||
for (i = 0; i < numrows; i++) {
|
for (i = 0; i < numrows; i++) {
|
||||||
c0p = jas_matrix_getref(c0, i, 0);
|
c0p = jas_matrix_getref(c0, i, 0);
|
||||||
c1p = jas_matrix_getref(c1, i, 0);
|
c1p = jas_matrix_getref(c1, i, 0);
|
||||||
c2p = jas_matrix_getref(c2, i, 0);
|
c2p = jas_matrix_getref(c2, i, 0);
|
||||||
for (j = numcols; j > 0; --j) {
|
for (j = numcols; j > 0; --j) {
|
||||||
int r;
|
int r;
|
||||||
int g;
|
int g;
|
||||||
int b;
|
int b;
|
||||||
int y;
|
int y;
|
||||||
int u;
|
int u;
|
||||||
int v;
|
int v;
|
||||||
y = *c0p;
|
y = *c0p;
|
||||||
u = *c1p;
|
u = *c1p;
|
||||||
v = *c2p;
|
v = *c2p;
|
||||||
g = y - ((u + v) >> 2);
|
g = y - ((u + v) >> 2);
|
||||||
r = v + g;
|
r = v + g;
|
||||||
b = u + g;
|
b = u + g;
|
||||||
*c0p++ = r;
|
*c0p++ = r;
|
||||||
*c1p++ = g;
|
*c1p++ = g;
|
||||||
*c2p++ = b;
|
*c2p++ = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void jpc_ict(jas_matrix_t *c0, jas_matrix_t *c1, jas_matrix_t *c2)
|
void jpc_ict(jas_matrix_t *c0, jas_matrix_t *c1, jas_matrix_t *c2)
|
||||||
{
|
{
|
||||||
int numrows;
|
int numrows;
|
||||||
int numcols;
|
int numcols;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jpc_fix_t r;
|
jpc_fix_t r;
|
||||||
jpc_fix_t g;
|
jpc_fix_t g;
|
||||||
jpc_fix_t b;
|
jpc_fix_t b;
|
||||||
jpc_fix_t y;
|
jpc_fix_t y;
|
||||||
jpc_fix_t u;
|
jpc_fix_t u;
|
||||||
jpc_fix_t v;
|
jpc_fix_t v;
|
||||||
jpc_fix_t *c0p;
|
jpc_fix_t *c0p;
|
||||||
jpc_fix_t *c1p;
|
jpc_fix_t *c1p;
|
||||||
jpc_fix_t *c2p;
|
jpc_fix_t *c2p;
|
||||||
|
|
||||||
numrows = jas_matrix_numrows(c0);
|
numrows = jas_matrix_numrows(c0);
|
||||||
assert(jas_matrix_numrows(c1) == numrows && jas_matrix_numrows(c2) == numrows);
|
assert(jas_matrix_numrows(c1) == numrows && jas_matrix_numrows(c2) == numrows);
|
||||||
numcols = jas_matrix_numcols(c0);
|
numcols = jas_matrix_numcols(c0);
|
||||||
assert(jas_matrix_numcols(c1) == numcols && jas_matrix_numcols(c2) == numcols);
|
assert(jas_matrix_numcols(c1) == numcols && jas_matrix_numcols(c2) == numcols);
|
||||||
for (i = 0; i < numrows; ++i) {
|
for (i = 0; i < numrows; ++i) {
|
||||||
c0p = jas_matrix_getref(c0, i, 0);
|
c0p = jas_matrix_getref(c0, i, 0);
|
||||||
c1p = jas_matrix_getref(c1, i, 0);
|
c1p = jas_matrix_getref(c1, i, 0);
|
||||||
c2p = jas_matrix_getref(c2, i, 0);
|
c2p = jas_matrix_getref(c2, i, 0);
|
||||||
for (j = numcols; j > 0; --j) {
|
for (j = numcols; j > 0; --j) {
|
||||||
r = *c0p;
|
r = *c0p;
|
||||||
g = *c1p;
|
g = *c1p;
|
||||||
b = *c2p;
|
b = *c2p;
|
||||||
y = jpc_fix_add3(jpc_fix_mul(jpc_dbltofix(0.299), r), jpc_fix_mul(jpc_dbltofix(0.587), g),
|
y = jpc_fix_add3(jpc_fix_mul(jpc_dbltofix(0.299), r), jpc_fix_mul(jpc_dbltofix(0.587), g),
|
||||||
jpc_fix_mul(jpc_dbltofix(0.114), b));
|
jpc_fix_mul(jpc_dbltofix(0.114), b));
|
||||||
u = jpc_fix_add3(jpc_fix_mul(jpc_dbltofix(-0.16875), r), jpc_fix_mul(jpc_dbltofix(-0.33126), g),
|
u = jpc_fix_add3(jpc_fix_mul(jpc_dbltofix(-0.16875), r), jpc_fix_mul(jpc_dbltofix(-0.33126), g),
|
||||||
jpc_fix_mul(jpc_dbltofix(0.5), b));
|
jpc_fix_mul(jpc_dbltofix(0.5), b));
|
||||||
v = jpc_fix_add3(jpc_fix_mul(jpc_dbltofix(0.5), r), jpc_fix_mul(jpc_dbltofix(-0.41869), g),
|
v = jpc_fix_add3(jpc_fix_mul(jpc_dbltofix(0.5), r), jpc_fix_mul(jpc_dbltofix(-0.41869), g),
|
||||||
jpc_fix_mul(jpc_dbltofix(-0.08131), b));
|
jpc_fix_mul(jpc_dbltofix(-0.08131), b));
|
||||||
*c0p++ = y;
|
*c0p++ = y;
|
||||||
*c1p++ = u;
|
*c1p++ = u;
|
||||||
*c2p++ = v;
|
*c2p++ = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void jpc_iict(jas_matrix_t *c0, jas_matrix_t *c1, jas_matrix_t *c2)
|
void jpc_iict(jas_matrix_t *c0, jas_matrix_t *c1, jas_matrix_t *c2)
|
||||||
{
|
{
|
||||||
int numrows;
|
int numrows;
|
||||||
int numcols;
|
int numcols;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
jpc_fix_t r;
|
jpc_fix_t r;
|
||||||
jpc_fix_t g;
|
jpc_fix_t g;
|
||||||
jpc_fix_t b;
|
jpc_fix_t b;
|
||||||
jpc_fix_t y;
|
jpc_fix_t y;
|
||||||
jpc_fix_t u;
|
jpc_fix_t u;
|
||||||
jpc_fix_t v;
|
jpc_fix_t v;
|
||||||
jpc_fix_t *c0p;
|
jpc_fix_t *c0p;
|
||||||
jpc_fix_t *c1p;
|
jpc_fix_t *c1p;
|
||||||
jpc_fix_t *c2p;
|
jpc_fix_t *c2p;
|
||||||
|
|
||||||
numrows = jas_matrix_numrows(c0);
|
numrows = jas_matrix_numrows(c0);
|
||||||
assert(jas_matrix_numrows(c1) == numrows && jas_matrix_numrows(c2) == numrows);
|
assert(jas_matrix_numrows(c1) == numrows && jas_matrix_numrows(c2) == numrows);
|
||||||
numcols = jas_matrix_numcols(c0);
|
numcols = jas_matrix_numcols(c0);
|
||||||
assert(jas_matrix_numcols(c1) == numcols && jas_matrix_numcols(c2) == numcols);
|
assert(jas_matrix_numcols(c1) == numcols && jas_matrix_numcols(c2) == numcols);
|
||||||
for (i = 0; i < numrows; ++i) {
|
for (i = 0; i < numrows; ++i) {
|
||||||
c0p = jas_matrix_getref(c0, i, 0);
|
c0p = jas_matrix_getref(c0, i, 0);
|
||||||
c1p = jas_matrix_getref(c1, i, 0);
|
c1p = jas_matrix_getref(c1, i, 0);
|
||||||
c2p = jas_matrix_getref(c2, i, 0);
|
c2p = jas_matrix_getref(c2, i, 0);
|
||||||
for (j = numcols; j > 0; --j) {
|
for (j = numcols; j > 0; --j) {
|
||||||
y = *c0p;
|
y = *c0p;
|
||||||
u = *c1p;
|
u = *c1p;
|
||||||
v = *c2p;
|
v = *c2p;
|
||||||
r = jpc_fix_add(y, jpc_fix_mul(jpc_dbltofix(1.402), v));
|
r = jpc_fix_add(y, jpc_fix_mul(jpc_dbltofix(1.402), v));
|
||||||
g = jpc_fix_add3(y, jpc_fix_mul(jpc_dbltofix(-0.34413), u),
|
g = jpc_fix_add3(y, jpc_fix_mul(jpc_dbltofix(-0.34413), u),
|
||||||
jpc_fix_mul(jpc_dbltofix(-0.71414), v));
|
jpc_fix_mul(jpc_dbltofix(-0.71414), v));
|
||||||
b = jpc_fix_add(y, jpc_fix_mul(jpc_dbltofix(1.772), u));
|
b = jpc_fix_add(y, jpc_fix_mul(jpc_dbltofix(1.772), u));
|
||||||
*c0p++ = r;
|
*c0p++ = r;
|
||||||
*c1p++ = g;
|
*c1p++ = g;
|
||||||
*c2p++ = b;
|
*c2p++ = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jpc_fix_t jpc_mct_getsynweight(int mctid, int cmptno)
|
jpc_fix_t jpc_mct_getsynweight(int mctid, int cmptno)
|
||||||
{
|
{
|
||||||
jpc_fix_t synweight;
|
jpc_fix_t synweight;
|
||||||
|
|
||||||
synweight = JPC_FIX_ONE;
|
synweight = JPC_FIX_ONE;
|
||||||
switch (mctid) {
|
switch (mctid) {
|
||||||
case JPC_MCT_RCT:
|
case JPC_MCT_RCT:
|
||||||
switch (cmptno) {
|
switch (cmptno) {
|
||||||
case 0:
|
case 0:
|
||||||
synweight = jpc_dbltofix(sqrt(3.0));
|
synweight = jpc_dbltofix(sqrt(3.0));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
synweight = jpc_dbltofix(sqrt(0.6875));
|
synweight = jpc_dbltofix(sqrt(0.6875));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
synweight = jpc_dbltofix(sqrt(0.6875));
|
synweight = jpc_dbltofix(sqrt(0.6875));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JPC_MCT_ICT:
|
case JPC_MCT_ICT:
|
||||||
switch (cmptno) {
|
switch (cmptno) {
|
||||||
case 0:
|
case 0:
|
||||||
synweight = jpc_dbltofix(sqrt(3.0000));
|
synweight = jpc_dbltofix(sqrt(3.0000));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
synweight = jpc_dbltofix(sqrt(3.2584));
|
synweight = jpc_dbltofix(sqrt(3.2584));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
synweight = jpc_dbltofix(sqrt(2.4755));
|
synweight = jpc_dbltofix(sqrt(2.4755));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
default:
|
default:
|
||||||
synweight = JPC_FIX_ONE;
|
synweight = JPC_FIX_ONE;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return synweight;
|
return synweight;
|
||||||
}
|
}
|
||||||
|
188
3rdparty/libjasper/jpc_mqcod.c
vendored
188
3rdparty/libjasper/jpc_mqcod.c
vendored
@ -82,98 +82,98 @@
|
|||||||
/* MQ coder per-state information. */
|
/* MQ coder per-state information. */
|
||||||
|
|
||||||
jpc_mqstate_t jpc_mqstates[47 * 2] = {
|
jpc_mqstate_t jpc_mqstates[47 * 2] = {
|
||||||
{0x5601, 0, &jpc_mqstates[ 2], &jpc_mqstates[ 3]},
|
{0x5601, 0, &jpc_mqstates[ 2], &jpc_mqstates[ 3]},
|
||||||
{0x5601, 1, &jpc_mqstates[ 3], &jpc_mqstates[ 2]},
|
{0x5601, 1, &jpc_mqstates[ 3], &jpc_mqstates[ 2]},
|
||||||
{0x3401, 0, &jpc_mqstates[ 4], &jpc_mqstates[12]},
|
{0x3401, 0, &jpc_mqstates[ 4], &jpc_mqstates[12]},
|
||||||
{0x3401, 1, &jpc_mqstates[ 5], &jpc_mqstates[13]},
|
{0x3401, 1, &jpc_mqstates[ 5], &jpc_mqstates[13]},
|
||||||
{0x1801, 0, &jpc_mqstates[ 6], &jpc_mqstates[18]},
|
{0x1801, 0, &jpc_mqstates[ 6], &jpc_mqstates[18]},
|
||||||
{0x1801, 1, &jpc_mqstates[ 7], &jpc_mqstates[19]},
|
{0x1801, 1, &jpc_mqstates[ 7], &jpc_mqstates[19]},
|
||||||
{0x0ac1, 0, &jpc_mqstates[ 8], &jpc_mqstates[24]},
|
{0x0ac1, 0, &jpc_mqstates[ 8], &jpc_mqstates[24]},
|
||||||
{0x0ac1, 1, &jpc_mqstates[ 9], &jpc_mqstates[25]},
|
{0x0ac1, 1, &jpc_mqstates[ 9], &jpc_mqstates[25]},
|
||||||
{0x0521, 0, &jpc_mqstates[10], &jpc_mqstates[58]},
|
{0x0521, 0, &jpc_mqstates[10], &jpc_mqstates[58]},
|
||||||
{0x0521, 1, &jpc_mqstates[11], &jpc_mqstates[59]},
|
{0x0521, 1, &jpc_mqstates[11], &jpc_mqstates[59]},
|
||||||
{0x0221, 0, &jpc_mqstates[76], &jpc_mqstates[66]},
|
{0x0221, 0, &jpc_mqstates[76], &jpc_mqstates[66]},
|
||||||
{0x0221, 1, &jpc_mqstates[77], &jpc_mqstates[67]},
|
{0x0221, 1, &jpc_mqstates[77], &jpc_mqstates[67]},
|
||||||
{0x5601, 0, &jpc_mqstates[14], &jpc_mqstates[13]},
|
{0x5601, 0, &jpc_mqstates[14], &jpc_mqstates[13]},
|
||||||
{0x5601, 1, &jpc_mqstates[15], &jpc_mqstates[12]},
|
{0x5601, 1, &jpc_mqstates[15], &jpc_mqstates[12]},
|
||||||
{0x5401, 0, &jpc_mqstates[16], &jpc_mqstates[28]},
|
{0x5401, 0, &jpc_mqstates[16], &jpc_mqstates[28]},
|
||||||
{0x5401, 1, &jpc_mqstates[17], &jpc_mqstates[29]},
|
{0x5401, 1, &jpc_mqstates[17], &jpc_mqstates[29]},
|
||||||
{0x4801, 0, &jpc_mqstates[18], &jpc_mqstates[28]},
|
{0x4801, 0, &jpc_mqstates[18], &jpc_mqstates[28]},
|
||||||
{0x4801, 1, &jpc_mqstates[19], &jpc_mqstates[29]},
|
{0x4801, 1, &jpc_mqstates[19], &jpc_mqstates[29]},
|
||||||
{0x3801, 0, &jpc_mqstates[20], &jpc_mqstates[28]},
|
{0x3801, 0, &jpc_mqstates[20], &jpc_mqstates[28]},
|
||||||
{0x3801, 1, &jpc_mqstates[21], &jpc_mqstates[29]},
|
{0x3801, 1, &jpc_mqstates[21], &jpc_mqstates[29]},
|
||||||
{0x3001, 0, &jpc_mqstates[22], &jpc_mqstates[34]},
|
{0x3001, 0, &jpc_mqstates[22], &jpc_mqstates[34]},
|
||||||
{0x3001, 1, &jpc_mqstates[23], &jpc_mqstates[35]},
|
{0x3001, 1, &jpc_mqstates[23], &jpc_mqstates[35]},
|
||||||
{0x2401, 0, &jpc_mqstates[24], &jpc_mqstates[36]},
|
{0x2401, 0, &jpc_mqstates[24], &jpc_mqstates[36]},
|
||||||
{0x2401, 1, &jpc_mqstates[25], &jpc_mqstates[37]},
|
{0x2401, 1, &jpc_mqstates[25], &jpc_mqstates[37]},
|
||||||
{0x1c01, 0, &jpc_mqstates[26], &jpc_mqstates[40]},
|
{0x1c01, 0, &jpc_mqstates[26], &jpc_mqstates[40]},
|
||||||
{0x1c01, 1, &jpc_mqstates[27], &jpc_mqstates[41]},
|
{0x1c01, 1, &jpc_mqstates[27], &jpc_mqstates[41]},
|
||||||
{0x1601, 0, &jpc_mqstates[58], &jpc_mqstates[42]},
|
{0x1601, 0, &jpc_mqstates[58], &jpc_mqstates[42]},
|
||||||
{0x1601, 1, &jpc_mqstates[59], &jpc_mqstates[43]},
|
{0x1601, 1, &jpc_mqstates[59], &jpc_mqstates[43]},
|
||||||
{0x5601, 0, &jpc_mqstates[30], &jpc_mqstates[29]},
|
{0x5601, 0, &jpc_mqstates[30], &jpc_mqstates[29]},
|
||||||
{0x5601, 1, &jpc_mqstates[31], &jpc_mqstates[28]},
|
{0x5601, 1, &jpc_mqstates[31], &jpc_mqstates[28]},
|
||||||
{0x5401, 0, &jpc_mqstates[32], &jpc_mqstates[28]},
|
{0x5401, 0, &jpc_mqstates[32], &jpc_mqstates[28]},
|
||||||
{0x5401, 1, &jpc_mqstates[33], &jpc_mqstates[29]},
|
{0x5401, 1, &jpc_mqstates[33], &jpc_mqstates[29]},
|
||||||
{0x5101, 0, &jpc_mqstates[34], &jpc_mqstates[30]},
|
{0x5101, 0, &jpc_mqstates[34], &jpc_mqstates[30]},
|
||||||
{0x5101, 1, &jpc_mqstates[35], &jpc_mqstates[31]},
|
{0x5101, 1, &jpc_mqstates[35], &jpc_mqstates[31]},
|
||||||
{0x4801, 0, &jpc_mqstates[36], &jpc_mqstates[32]},
|
{0x4801, 0, &jpc_mqstates[36], &jpc_mqstates[32]},
|
||||||
{0x4801, 1, &jpc_mqstates[37], &jpc_mqstates[33]},
|
{0x4801, 1, &jpc_mqstates[37], &jpc_mqstates[33]},
|
||||||
{0x3801, 0, &jpc_mqstates[38], &jpc_mqstates[34]},
|
{0x3801, 0, &jpc_mqstates[38], &jpc_mqstates[34]},
|
||||||
{0x3801, 1, &jpc_mqstates[39], &jpc_mqstates[35]},
|
{0x3801, 1, &jpc_mqstates[39], &jpc_mqstates[35]},
|
||||||
{0x3401, 0, &jpc_mqstates[40], &jpc_mqstates[36]},
|
{0x3401, 0, &jpc_mqstates[40], &jpc_mqstates[36]},
|
||||||
{0x3401, 1, &jpc_mqstates[41], &jpc_mqstates[37]},
|
{0x3401, 1, &jpc_mqstates[41], &jpc_mqstates[37]},
|
||||||
{0x3001, 0, &jpc_mqstates[42], &jpc_mqstates[38]},
|
{0x3001, 0, &jpc_mqstates[42], &jpc_mqstates[38]},
|
||||||
{0x3001, 1, &jpc_mqstates[43], &jpc_mqstates[39]},
|
{0x3001, 1, &jpc_mqstates[43], &jpc_mqstates[39]},
|
||||||
{0x2801, 0, &jpc_mqstates[44], &jpc_mqstates[38]},
|
{0x2801, 0, &jpc_mqstates[44], &jpc_mqstates[38]},
|
||||||
{0x2801, 1, &jpc_mqstates[45], &jpc_mqstates[39]},
|
{0x2801, 1, &jpc_mqstates[45], &jpc_mqstates[39]},
|
||||||
{0x2401, 0, &jpc_mqstates[46], &jpc_mqstates[40]},
|
{0x2401, 0, &jpc_mqstates[46], &jpc_mqstates[40]},
|
||||||
{0x2401, 1, &jpc_mqstates[47], &jpc_mqstates[41]},
|
{0x2401, 1, &jpc_mqstates[47], &jpc_mqstates[41]},
|
||||||
{0x2201, 0, &jpc_mqstates[48], &jpc_mqstates[42]},
|
{0x2201, 0, &jpc_mqstates[48], &jpc_mqstates[42]},
|
||||||
{0x2201, 1, &jpc_mqstates[49], &jpc_mqstates[43]},
|
{0x2201, 1, &jpc_mqstates[49], &jpc_mqstates[43]},
|
||||||
{0x1c01, 0, &jpc_mqstates[50], &jpc_mqstates[44]},
|
{0x1c01, 0, &jpc_mqstates[50], &jpc_mqstates[44]},
|
||||||
{0x1c01, 1, &jpc_mqstates[51], &jpc_mqstates[45]},
|
{0x1c01, 1, &jpc_mqstates[51], &jpc_mqstates[45]},
|
||||||
{0x1801, 0, &jpc_mqstates[52], &jpc_mqstates[46]},
|
{0x1801, 0, &jpc_mqstates[52], &jpc_mqstates[46]},
|
||||||
{0x1801, 1, &jpc_mqstates[53], &jpc_mqstates[47]},
|
{0x1801, 1, &jpc_mqstates[53], &jpc_mqstates[47]},
|
||||||
{0x1601, 0, &jpc_mqstates[54], &jpc_mqstates[48]},
|
{0x1601, 0, &jpc_mqstates[54], &jpc_mqstates[48]},
|
||||||
{0x1601, 1, &jpc_mqstates[55], &jpc_mqstates[49]},
|
{0x1601, 1, &jpc_mqstates[55], &jpc_mqstates[49]},
|
||||||
{0x1401, 0, &jpc_mqstates[56], &jpc_mqstates[50]},
|
{0x1401, 0, &jpc_mqstates[56], &jpc_mqstates[50]},
|
||||||
{0x1401, 1, &jpc_mqstates[57], &jpc_mqstates[51]},
|
{0x1401, 1, &jpc_mqstates[57], &jpc_mqstates[51]},
|
||||||
{0x1201, 0, &jpc_mqstates[58], &jpc_mqstates[52]},
|
{0x1201, 0, &jpc_mqstates[58], &jpc_mqstates[52]},
|
||||||
{0x1201, 1, &jpc_mqstates[59], &jpc_mqstates[53]},
|
{0x1201, 1, &jpc_mqstates[59], &jpc_mqstates[53]},
|
||||||
{0x1101, 0, &jpc_mqstates[60], &jpc_mqstates[54]},
|
{0x1101, 0, &jpc_mqstates[60], &jpc_mqstates[54]},
|
||||||
{0x1101, 1, &jpc_mqstates[61], &jpc_mqstates[55]},
|
{0x1101, 1, &jpc_mqstates[61], &jpc_mqstates[55]},
|
||||||
{0x0ac1, 0, &jpc_mqstates[62], &jpc_mqstates[56]},
|
{0x0ac1, 0, &jpc_mqstates[62], &jpc_mqstates[56]},
|
||||||
{0x0ac1, 1, &jpc_mqstates[63], &jpc_mqstates[57]},
|
{0x0ac1, 1, &jpc_mqstates[63], &jpc_mqstates[57]},
|
||||||
{0x09c1, 0, &jpc_mqstates[64], &jpc_mqstates[58]},
|
{0x09c1, 0, &jpc_mqstates[64], &jpc_mqstates[58]},
|
||||||
{0x09c1, 1, &jpc_mqstates[65], &jpc_mqstates[59]},
|
{0x09c1, 1, &jpc_mqstates[65], &jpc_mqstates[59]},
|
||||||
{0x08a1, 0, &jpc_mqstates[66], &jpc_mqstates[60]},
|
{0x08a1, 0, &jpc_mqstates[66], &jpc_mqstates[60]},
|
||||||
{0x08a1, 1, &jpc_mqstates[67], &jpc_mqstates[61]},
|
{0x08a1, 1, &jpc_mqstates[67], &jpc_mqstates[61]},
|
||||||
{0x0521, 0, &jpc_mqstates[68], &jpc_mqstates[62]},
|
{0x0521, 0, &jpc_mqstates[68], &jpc_mqstates[62]},
|
||||||
{0x0521, 1, &jpc_mqstates[69], &jpc_mqstates[63]},
|
{0x0521, 1, &jpc_mqstates[69], &jpc_mqstates[63]},
|
||||||
{0x0441, 0, &jpc_mqstates[70], &jpc_mqstates[64]},
|
{0x0441, 0, &jpc_mqstates[70], &jpc_mqstates[64]},
|
||||||
{0x0441, 1, &jpc_mqstates[71], &jpc_mqstates[65]},
|
{0x0441, 1, &jpc_mqstates[71], &jpc_mqstates[65]},
|
||||||
{0x02a1, 0, &jpc_mqstates[72], &jpc_mqstates[66]},
|
{0x02a1, 0, &jpc_mqstates[72], &jpc_mqstates[66]},
|
||||||
{0x02a1, 1, &jpc_mqstates[73], &jpc_mqstates[67]},
|
{0x02a1, 1, &jpc_mqstates[73], &jpc_mqstates[67]},
|
||||||
{0x0221, 0, &jpc_mqstates[74], &jpc_mqstates[68]},
|
{0x0221, 0, &jpc_mqstates[74], &jpc_mqstates[68]},
|
||||||
{0x0221, 1, &jpc_mqstates[75], &jpc_mqstates[69]},
|
{0x0221, 1, &jpc_mqstates[75], &jpc_mqstates[69]},
|
||||||
{0x0141, 0, &jpc_mqstates[76], &jpc_mqstates[70]},
|
{0x0141, 0, &jpc_mqstates[76], &jpc_mqstates[70]},
|
||||||
{0x0141, 1, &jpc_mqstates[77], &jpc_mqstates[71]},
|
{0x0141, 1, &jpc_mqstates[77], &jpc_mqstates[71]},
|
||||||
{0x0111, 0, &jpc_mqstates[78], &jpc_mqstates[72]},
|
{0x0111, 0, &jpc_mqstates[78], &jpc_mqstates[72]},
|
||||||
{0x0111, 1, &jpc_mqstates[79], &jpc_mqstates[73]},
|
{0x0111, 1, &jpc_mqstates[79], &jpc_mqstates[73]},
|
||||||
{0x0085, 0, &jpc_mqstates[80], &jpc_mqstates[74]},
|
{0x0085, 0, &jpc_mqstates[80], &jpc_mqstates[74]},
|
||||||
{0x0085, 1, &jpc_mqstates[81], &jpc_mqstates[75]},
|
{0x0085, 1, &jpc_mqstates[81], &jpc_mqstates[75]},
|
||||||
{0x0049, 0, &jpc_mqstates[82], &jpc_mqstates[76]},
|
{0x0049, 0, &jpc_mqstates[82], &jpc_mqstates[76]},
|
||||||
{0x0049, 1, &jpc_mqstates[83], &jpc_mqstates[77]},
|
{0x0049, 1, &jpc_mqstates[83], &jpc_mqstates[77]},
|
||||||
{0x0025, 0, &jpc_mqstates[84], &jpc_mqstates[78]},
|
{0x0025, 0, &jpc_mqstates[84], &jpc_mqstates[78]},
|
||||||
{0x0025, 1, &jpc_mqstates[85], &jpc_mqstates[79]},
|
{0x0025, 1, &jpc_mqstates[85], &jpc_mqstates[79]},
|
||||||
{0x0015, 0, &jpc_mqstates[86], &jpc_mqstates[80]},
|
{0x0015, 0, &jpc_mqstates[86], &jpc_mqstates[80]},
|
||||||
{0x0015, 1, &jpc_mqstates[87], &jpc_mqstates[81]},
|
{0x0015, 1, &jpc_mqstates[87], &jpc_mqstates[81]},
|
||||||
{0x0009, 0, &jpc_mqstates[88], &jpc_mqstates[82]},
|
{0x0009, 0, &jpc_mqstates[88], &jpc_mqstates[82]},
|
||||||
{0x0009, 1, &jpc_mqstates[89], &jpc_mqstates[83]},
|
{0x0009, 1, &jpc_mqstates[89], &jpc_mqstates[83]},
|
||||||
{0x0005, 0, &jpc_mqstates[90], &jpc_mqstates[84]},
|
{0x0005, 0, &jpc_mqstates[90], &jpc_mqstates[84]},
|
||||||
{0x0005, 1, &jpc_mqstates[91], &jpc_mqstates[85]},
|
{0x0005, 1, &jpc_mqstates[91], &jpc_mqstates[85]},
|
||||||
{0x0001, 0, &jpc_mqstates[90], &jpc_mqstates[86]},
|
{0x0001, 0, &jpc_mqstates[90], &jpc_mqstates[86]},
|
||||||
{0x0001, 1, &jpc_mqstates[91], &jpc_mqstates[87]},
|
{0x0001, 1, &jpc_mqstates[91], &jpc_mqstates[87]},
|
||||||
{0x5601, 0, &jpc_mqstates[92], &jpc_mqstates[92]},
|
{0x5601, 0, &jpc_mqstates[92], &jpc_mqstates[92]},
|
||||||
{0x5601, 1, &jpc_mqstates[93], &jpc_mqstates[93]},
|
{0x5601, 1, &jpc_mqstates[93], &jpc_mqstates[93]},
|
||||||
};
|
};
|
||||||
|
24
3rdparty/libjasper/jpc_mqcod.h
vendored
24
3rdparty/libjasper/jpc_mqcod.h
vendored
@ -86,11 +86,11 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The most probable symbol (MPS). */
|
/* The most probable symbol (MPS). */
|
||||||
int mps;
|
int mps;
|
||||||
|
|
||||||
/* The state index. */
|
/* The state index. */
|
||||||
int_fast16_t ind;
|
int_fast16_t ind;
|
||||||
|
|
||||||
} jpc_mqctx_t;
|
} jpc_mqctx_t;
|
||||||
|
|
||||||
@ -100,17 +100,17 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct jpc_mqstate_s {
|
typedef struct jpc_mqstate_s {
|
||||||
|
|
||||||
/* The Qe value. */
|
/* The Qe value. */
|
||||||
uint_fast16_t qeval;
|
uint_fast16_t qeval;
|
||||||
|
|
||||||
/* The MPS. */
|
/* The MPS. */
|
||||||
int mps;
|
int mps;
|
||||||
|
|
||||||
/* The NMPS state. */
|
/* The NMPS state. */
|
||||||
struct jpc_mqstate_s *nmps;
|
struct jpc_mqstate_s *nmps;
|
||||||
|
|
||||||
/* The NLPS state. */
|
/* The NLPS state. */
|
||||||
struct jpc_mqstate_s *nlps;
|
struct jpc_mqstate_s *nlps;
|
||||||
|
|
||||||
} jpc_mqstate_t;
|
} jpc_mqstate_t;
|
||||||
|
|
||||||
|
234
3rdparty/libjasper/jpc_mqdec.c
vendored
234
3rdparty/libjasper/jpc_mqdec.c
vendored
@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
#define MQDEC_CALL(n, x) \
|
#define MQDEC_CALL(n, x) \
|
||||||
((jas_getdbglevel() >= (n)) ? ((void)(x)) : ((void)0))
|
((jas_getdbglevel() >= (n)) ? ((void)(x)) : ((void)0))
|
||||||
#else
|
#else
|
||||||
#define MQDEC_CALL(n, x)
|
#define MQDEC_CALL(n, x)
|
||||||
#endif
|
#endif
|
||||||
@ -106,49 +106,49 @@ static void jpc_mqdec_bytein(jpc_mqdec_t *mqdec);
|
|||||||
/* Create a MQ decoder. */
|
/* Create a MQ decoder. */
|
||||||
jpc_mqdec_t *jpc_mqdec_create(int maxctxs, jas_stream_t *in)
|
jpc_mqdec_t *jpc_mqdec_create(int maxctxs, jas_stream_t *in)
|
||||||
{
|
{
|
||||||
jpc_mqdec_t *mqdec;
|
jpc_mqdec_t *mqdec;
|
||||||
|
|
||||||
/* There must be at least one context. */
|
/* There must be at least one context. */
|
||||||
assert(maxctxs > 0);
|
assert(maxctxs > 0);
|
||||||
|
|
||||||
/* Allocate memory for the MQ decoder. */
|
/* Allocate memory for the MQ decoder. */
|
||||||
if (!(mqdec = jas_malloc(sizeof(jpc_mqdec_t)))) {
|
if (!(mqdec = jas_malloc(sizeof(jpc_mqdec_t)))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
mqdec->in = in;
|
mqdec->in = in;
|
||||||
mqdec->maxctxs = maxctxs;
|
mqdec->maxctxs = maxctxs;
|
||||||
/* Allocate memory for the per-context state information. */
|
/* Allocate memory for the per-context state information. */
|
||||||
if (!(mqdec->ctxs = jas_alloc2(mqdec->maxctxs, sizeof(jpc_mqstate_t *)))) {
|
if (!(mqdec->ctxs = jas_alloc2(mqdec->maxctxs, sizeof(jpc_mqstate_t *)))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/* Set the current context to the first context. */
|
/* Set the current context to the first context. */
|
||||||
mqdec->curctx = mqdec->ctxs;
|
mqdec->curctx = mqdec->ctxs;
|
||||||
|
|
||||||
/* If an input stream has been associated with the MQ decoder,
|
/* If an input stream has been associated with the MQ decoder,
|
||||||
initialize the decoder state from the stream. */
|
initialize the decoder state from the stream. */
|
||||||
if (mqdec->in) {
|
if (mqdec->in) {
|
||||||
jpc_mqdec_init(mqdec);
|
jpc_mqdec_init(mqdec);
|
||||||
}
|
}
|
||||||
/* Initialize the per-context state information. */
|
/* Initialize the per-context state information. */
|
||||||
jpc_mqdec_setctxs(mqdec, 0, 0);
|
jpc_mqdec_setctxs(mqdec, 0, 0);
|
||||||
|
|
||||||
return mqdec;
|
return mqdec;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
/* Oops... Something has gone wrong. */
|
/* Oops... Something has gone wrong. */
|
||||||
if (mqdec) {
|
if (mqdec) {
|
||||||
jpc_mqdec_destroy(mqdec);
|
jpc_mqdec_destroy(mqdec);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy a MQ decoder. */
|
/* Destroy a MQ decoder. */
|
||||||
void jpc_mqdec_destroy(jpc_mqdec_t *mqdec)
|
void jpc_mqdec_destroy(jpc_mqdec_t *mqdec)
|
||||||
{
|
{
|
||||||
if (mqdec->ctxs) {
|
if (mqdec->ctxs) {
|
||||||
jas_free(mqdec->ctxs);
|
jas_free(mqdec->ctxs);
|
||||||
}
|
}
|
||||||
jas_free(mqdec);
|
jas_free(mqdec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -159,59 +159,59 @@ void jpc_mqdec_destroy(jpc_mqdec_t *mqdec)
|
|||||||
|
|
||||||
void jpc_mqdec_init(jpc_mqdec_t *mqdec)
|
void jpc_mqdec_init(jpc_mqdec_t *mqdec)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
mqdec->eof = 0;
|
mqdec->eof = 0;
|
||||||
mqdec->creg = 0;
|
mqdec->creg = 0;
|
||||||
/* Get the next byte from the input stream. */
|
/* Get the next byte from the input stream. */
|
||||||
if ((c = jas_stream_getc(mqdec->in)) == EOF) {
|
if ((c = jas_stream_getc(mqdec->in)) == EOF) {
|
||||||
/* We have encountered an I/O error or EOF. */
|
/* We have encountered an I/O error or EOF. */
|
||||||
c = 0xff;
|
c = 0xff;
|
||||||
mqdec->eof = 1;
|
mqdec->eof = 1;
|
||||||
}
|
}
|
||||||
mqdec->inbuffer = c;
|
mqdec->inbuffer = c;
|
||||||
mqdec->creg += mqdec->inbuffer << 16;
|
mqdec->creg += mqdec->inbuffer << 16;
|
||||||
jpc_mqdec_bytein(mqdec);
|
jpc_mqdec_bytein(mqdec);
|
||||||
mqdec->creg <<= 7;
|
mqdec->creg <<= 7;
|
||||||
mqdec->ctreg -= 7;
|
mqdec->ctreg -= 7;
|
||||||
mqdec->areg = 0x8000;
|
mqdec->areg = 0x8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the input stream for a MQ decoder. */
|
/* Set the input stream for a MQ decoder. */
|
||||||
|
|
||||||
void jpc_mqdec_setinput(jpc_mqdec_t *mqdec, jas_stream_t *in)
|
void jpc_mqdec_setinput(jpc_mqdec_t *mqdec, jas_stream_t *in)
|
||||||
{
|
{
|
||||||
mqdec->in = in;
|
mqdec->in = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize one or more contexts. */
|
/* Initialize one or more contexts. */
|
||||||
|
|
||||||
void jpc_mqdec_setctxs(jpc_mqdec_t *mqdec, int numctxs, jpc_mqctx_t *ctxs)
|
void jpc_mqdec_setctxs(jpc_mqdec_t *mqdec, int numctxs, jpc_mqctx_t *ctxs)
|
||||||
{
|
{
|
||||||
jpc_mqstate_t **ctx;
|
jpc_mqstate_t **ctx;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
ctx = mqdec->ctxs;
|
ctx = mqdec->ctxs;
|
||||||
n = JAS_MIN(mqdec->maxctxs, numctxs);
|
n = JAS_MIN(mqdec->maxctxs, numctxs);
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
*ctx = &jpc_mqstates[2 * ctxs->ind + ctxs->mps];
|
*ctx = &jpc_mqstates[2 * ctxs->ind + ctxs->mps];
|
||||||
++ctx;
|
++ctx;
|
||||||
++ctxs;
|
++ctxs;
|
||||||
}
|
}
|
||||||
n = mqdec->maxctxs - numctxs;
|
n = mqdec->maxctxs - numctxs;
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
*ctx = &jpc_mqstates[0];
|
*ctx = &jpc_mqstates[0];
|
||||||
++ctx;
|
++ctx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize a context. */
|
/* Initialize a context. */
|
||||||
|
|
||||||
void jpc_mqdec_setctx(jpc_mqdec_t *mqdec, int ctxno, jpc_mqctx_t *ctx)
|
void jpc_mqdec_setctx(jpc_mqdec_t *mqdec, int ctxno, jpc_mqctx_t *ctx)
|
||||||
{
|
{
|
||||||
jpc_mqstate_t **ctxi;
|
jpc_mqstate_t **ctxi;
|
||||||
ctxi = &mqdec->ctxs[ctxno];
|
ctxi = &mqdec->ctxs[ctxno];
|
||||||
*ctxi = &jpc_mqstates[2 * ctx->ind + ctx->mps];
|
*ctxi = &jpc_mqstates[2 * ctx->ind + ctx->mps];
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -222,36 +222,36 @@ void jpc_mqdec_setctx(jpc_mqdec_t *mqdec, int ctxno, jpc_mqctx_t *ctx)
|
|||||||
|
|
||||||
int jpc_mqdec_getbit_func(register jpc_mqdec_t *mqdec)
|
int jpc_mqdec_getbit_func(register jpc_mqdec_t *mqdec)
|
||||||
{
|
{
|
||||||
int bit;
|
int bit;
|
||||||
JAS_DBGLOG(100, ("jpc_mqdec_getbit_func(%p)\n", mqdec));
|
JAS_DBGLOG(100, ("jpc_mqdec_getbit_func(%p)\n", mqdec));
|
||||||
MQDEC_CALL(100, jpc_mqdec_dump(mqdec, stderr));
|
MQDEC_CALL(100, jpc_mqdec_dump(mqdec, stderr));
|
||||||
bit = jpc_mqdec_getbit_macro(mqdec);
|
bit = jpc_mqdec_getbit_macro(mqdec);
|
||||||
MQDEC_CALL(100, jpc_mqdec_dump(mqdec, stderr));
|
MQDEC_CALL(100, jpc_mqdec_dump(mqdec, stderr));
|
||||||
JAS_DBGLOG(100, ("ctx = %d, decoded %d\n", mqdec->curctx -
|
JAS_DBGLOG(100, ("ctx = %d, decoded %d\n", mqdec->curctx -
|
||||||
mqdec->ctxs, bit));
|
mqdec->ctxs, bit));
|
||||||
return bit;
|
return bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply MPS_EXCHANGE algorithm (with RENORMD). */
|
/* Apply MPS_EXCHANGE algorithm (with RENORMD). */
|
||||||
int jpc_mqdec_mpsexchrenormd(register jpc_mqdec_t *mqdec)
|
int jpc_mqdec_mpsexchrenormd(register jpc_mqdec_t *mqdec)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
register jpc_mqstate_t *state = *mqdec->curctx;
|
register jpc_mqstate_t *state = *mqdec->curctx;
|
||||||
jpc_mqdec_mpsexchange(mqdec->areg, state->qeval, mqdec->curctx, ret);
|
jpc_mqdec_mpsexchange(mqdec->areg, state->qeval, mqdec->curctx, ret);
|
||||||
jpc_mqdec_renormd(mqdec->areg, mqdec->creg, mqdec->ctreg, mqdec->in,
|
jpc_mqdec_renormd(mqdec->areg, mqdec->creg, mqdec->ctreg, mqdec->in,
|
||||||
mqdec->eof, mqdec->inbuffer);
|
mqdec->eof, mqdec->inbuffer);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply LPS_EXCHANGE algorithm (with RENORMD). */
|
/* Apply LPS_EXCHANGE algorithm (with RENORMD). */
|
||||||
int jpc_mqdec_lpsexchrenormd(register jpc_mqdec_t *mqdec)
|
int jpc_mqdec_lpsexchrenormd(register jpc_mqdec_t *mqdec)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
register jpc_mqstate_t *state = *mqdec->curctx;
|
register jpc_mqstate_t *state = *mqdec->curctx;
|
||||||
jpc_mqdec_lpsexchange(mqdec->areg, state->qeval, mqdec->curctx, ret);
|
jpc_mqdec_lpsexchange(mqdec->areg, state->qeval, mqdec->curctx, ret);
|
||||||
jpc_mqdec_renormd(mqdec->areg, mqdec->creg, mqdec->ctreg, mqdec->in,
|
jpc_mqdec_renormd(mqdec->areg, mqdec->creg, mqdec->ctreg, mqdec->in,
|
||||||
mqdec->eof, mqdec->inbuffer);
|
mqdec->eof, mqdec->inbuffer);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -261,32 +261,32 @@ int jpc_mqdec_lpsexchrenormd(register jpc_mqdec_t *mqdec)
|
|||||||
/* Apply the BYTEIN algorithm. */
|
/* Apply the BYTEIN algorithm. */
|
||||||
static void jpc_mqdec_bytein(jpc_mqdec_t *mqdec)
|
static void jpc_mqdec_bytein(jpc_mqdec_t *mqdec)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
unsigned char prevbuf;
|
unsigned char prevbuf;
|
||||||
|
|
||||||
if (!mqdec->eof) {
|
if (!mqdec->eof) {
|
||||||
if ((c = jas_stream_getc(mqdec->in)) == EOF) {
|
if ((c = jas_stream_getc(mqdec->in)) == EOF) {
|
||||||
mqdec->eof = 1;
|
mqdec->eof = 1;
|
||||||
c = 0xff;
|
c = 0xff;
|
||||||
}
|
}
|
||||||
prevbuf = mqdec->inbuffer;
|
prevbuf = mqdec->inbuffer;
|
||||||
mqdec->inbuffer = c;
|
mqdec->inbuffer = c;
|
||||||
if (prevbuf == 0xff) {
|
if (prevbuf == 0xff) {
|
||||||
if (c > 0x8f) {
|
if (c > 0x8f) {
|
||||||
mqdec->creg += 0xff00;
|
mqdec->creg += 0xff00;
|
||||||
mqdec->ctreg = 8;
|
mqdec->ctreg = 8;
|
||||||
} else {
|
} else {
|
||||||
mqdec->creg += c << 9;
|
mqdec->creg += c << 9;
|
||||||
mqdec->ctreg = 7;
|
mqdec->ctreg = 7;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mqdec->creg += c << 8;
|
mqdec->creg += c << 8;
|
||||||
mqdec->ctreg = 8;
|
mqdec->ctreg = 8;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mqdec->creg += 0xff00;
|
mqdec->creg += 0xff00;
|
||||||
mqdec->ctreg = 8;
|
mqdec->ctreg = 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -297,10 +297,10 @@ static void jpc_mqdec_bytein(jpc_mqdec_t *mqdec)
|
|||||||
|
|
||||||
void jpc_mqdec_dump(jpc_mqdec_t *mqdec, FILE *out)
|
void jpc_mqdec_dump(jpc_mqdec_t *mqdec, FILE *out)
|
||||||
{
|
{
|
||||||
fprintf(out, "MQDEC A = %08lx, C = %08lx, CT=%08lx, ",
|
fprintf(out, "MQDEC A = %08lx, C = %08lx, CT=%08lx, ",
|
||||||
(unsigned long) mqdec->areg, (unsigned long) mqdec->creg,
|
(unsigned long) mqdec->areg, (unsigned long) mqdec->creg,
|
||||||
(unsigned long) mqdec->ctreg);
|
(unsigned long) mqdec->ctreg);
|
||||||
fprintf(out, "CTX = %d, ", (int)(mqdec->curctx - mqdec->ctxs));
|
fprintf(out, "CTX = %d, ", (int)(mqdec->curctx - mqdec->ctxs));
|
||||||
fprintf(out, "IND %d, MPS %d, QEVAL %x\n", (int)(*mqdec->curctx -
|
fprintf(out, "IND %d, MPS %d, QEVAL %x\n", (int)(*mqdec->curctx -
|
||||||
jpc_mqstates), (int)(*mqdec->curctx)->mps, (int)(*mqdec->curctx)->qeval);
|
jpc_mqstates), (int)(*mqdec->curctx)->mps, (int)(*mqdec->curctx)->qeval);
|
||||||
}
|
}
|
||||||
|
168
3rdparty/libjasper/jpc_mqdec.h
vendored
168
3rdparty/libjasper/jpc_mqdec.h
vendored
@ -87,32 +87,32 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The C register. */
|
/* The C register. */
|
||||||
uint_fast32_t creg;
|
uint_fast32_t creg;
|
||||||
|
|
||||||
/* The A register. */
|
/* The A register. */
|
||||||
uint_fast32_t areg;
|
uint_fast32_t areg;
|
||||||
|
|
||||||
/* The CT register. */
|
/* The CT register. */
|
||||||
uint_fast32_t ctreg;
|
uint_fast32_t ctreg;
|
||||||
|
|
||||||
/* The current context. */
|
/* The current context. */
|
||||||
jpc_mqstate_t **curctx;
|
jpc_mqstate_t **curctx;
|
||||||
|
|
||||||
/* The per-context information. */
|
/* The per-context information. */
|
||||||
jpc_mqstate_t **ctxs;
|
jpc_mqstate_t **ctxs;
|
||||||
|
|
||||||
/* The maximum number of contexts. */
|
/* The maximum number of contexts. */
|
||||||
int maxctxs;
|
int maxctxs;
|
||||||
|
|
||||||
/* The stream from which to read data. */
|
/* The stream from which to read data. */
|
||||||
jas_stream_t *in;
|
jas_stream_t *in;
|
||||||
|
|
||||||
/* The last character read. */
|
/* The last character read. */
|
||||||
uchar inbuffer;
|
uchar inbuffer;
|
||||||
|
|
||||||
/* The EOF indicator. */
|
/* The EOF indicator. */
|
||||||
int eof;
|
int eof;
|
||||||
|
|
||||||
} jpc_mqdec_t;
|
} jpc_mqdec_t;
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ void jpc_mqdec_init(jpc_mqdec_t *dec);
|
|||||||
|
|
||||||
/* Set the current context for a MQ decoder. */
|
/* Set the current context for a MQ decoder. */
|
||||||
#define jpc_mqdec_setcurctx(dec, ctxno) \
|
#define jpc_mqdec_setcurctx(dec, ctxno) \
|
||||||
((mqdec)->curctx = &(mqdec)->ctxs[ctxno]);
|
((mqdec)->curctx = &(mqdec)->ctxs[ctxno]);
|
||||||
|
|
||||||
/* Set the state information for a particular context of a MQ decoder. */
|
/* Set the state information for a particular context of a MQ decoder. */
|
||||||
void jpc_mqdec_setctx(jpc_mqdec_t *dec, int ctxno, jpc_mqctx_t *ctx);
|
void jpc_mqdec_setctx(jpc_mqdec_t *dec, int ctxno, jpc_mqctx_t *ctx);
|
||||||
@ -157,19 +157,19 @@ void jpc_mqdec_setctxs(jpc_mqdec_t *dec, int numctxs, jpc_mqctx_t *ctxs);
|
|||||||
/* Decode a symbol. */
|
/* Decode a symbol. */
|
||||||
#if !defined(DEBUG)
|
#if !defined(DEBUG)
|
||||||
#define jpc_mqdec_getbit(dec) \
|
#define jpc_mqdec_getbit(dec) \
|
||||||
jpc_mqdec_getbit_macro(dec)
|
jpc_mqdec_getbit_macro(dec)
|
||||||
#else
|
#else
|
||||||
#define jpc_mqdec_getbit(dec) \
|
#define jpc_mqdec_getbit(dec) \
|
||||||
jpc_mqdec_getbit_func(dec)
|
jpc_mqdec_getbit_func(dec)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Decode a symbol (assuming an unskewed probability distribution). */
|
/* Decode a symbol (assuming an unskewed probability distribution). */
|
||||||
#if !defined(DEBUG)
|
#if !defined(DEBUG)
|
||||||
#define jpc_mqdec_getbitnoskew(dec) \
|
#define jpc_mqdec_getbitnoskew(dec) \
|
||||||
jpc_mqdec_getbit_macro(dec)
|
jpc_mqdec_getbit_macro(dec)
|
||||||
#else
|
#else
|
||||||
#define jpc_mqdec_getbitnoskew(dec) \
|
#define jpc_mqdec_getbitnoskew(dec) \
|
||||||
jpc_mqdec_getbit_func(dec)
|
jpc_mqdec_getbit_func(dec)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -186,82 +186,82 @@ void jpc_mqdec_dump(jpc_mqdec_t *dec, FILE *out);
|
|||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
||||||
#define jpc_mqdec_getbit_macro(dec) \
|
#define jpc_mqdec_getbit_macro(dec) \
|
||||||
((((dec)->areg -= (*(dec)->curctx)->qeval), \
|
((((dec)->areg -= (*(dec)->curctx)->qeval), \
|
||||||
(dec)->creg >> 16 >= (*(dec)->curctx)->qeval) ? \
|
(dec)->creg >> 16 >= (*(dec)->curctx)->qeval) ? \
|
||||||
((((dec)->creg -= (*(dec)->curctx)->qeval << 16), \
|
((((dec)->creg -= (*(dec)->curctx)->qeval << 16), \
|
||||||
(dec)->areg & 0x8000) ? (*(dec)->curctx)->mps : \
|
(dec)->areg & 0x8000) ? (*(dec)->curctx)->mps : \
|
||||||
jpc_mqdec_mpsexchrenormd(dec)) : \
|
jpc_mqdec_mpsexchrenormd(dec)) : \
|
||||||
jpc_mqdec_lpsexchrenormd(dec))
|
jpc_mqdec_lpsexchrenormd(dec))
|
||||||
|
|
||||||
#define jpc_mqdec_mpsexchange(areg, delta, curctx, bit) \
|
#define jpc_mqdec_mpsexchange(areg, delta, curctx, bit) \
|
||||||
{ \
|
{ \
|
||||||
if ((areg) < (delta)) { \
|
if ((areg) < (delta)) { \
|
||||||
register jpc_mqstate_t *state = *(curctx); \
|
register jpc_mqstate_t *state = *(curctx); \
|
||||||
/* LPS decoded. */ \
|
/* LPS decoded. */ \
|
||||||
(bit) = state->mps ^ 1; \
|
(bit) = state->mps ^ 1; \
|
||||||
*(curctx) = state->nlps; \
|
*(curctx) = state->nlps; \
|
||||||
} else { \
|
} else { \
|
||||||
register jpc_mqstate_t *state = *(curctx); \
|
register jpc_mqstate_t *state = *(curctx); \
|
||||||
/* MPS decoded. */ \
|
/* MPS decoded. */ \
|
||||||
(bit) = state->mps; \
|
(bit) = state->mps; \
|
||||||
*(curctx) = state->nmps; \
|
*(curctx) = state->nmps; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define jpc_mqdec_lpsexchange(areg, delta, curctx, bit) \
|
#define jpc_mqdec_lpsexchange(areg, delta, curctx, bit) \
|
||||||
{ \
|
{ \
|
||||||
if ((areg) >= (delta)) { \
|
if ((areg) >= (delta)) { \
|
||||||
register jpc_mqstate_t *state = *(curctx); \
|
register jpc_mqstate_t *state = *(curctx); \
|
||||||
(areg) = (delta); \
|
(areg) = (delta); \
|
||||||
(bit) = state->mps ^ 1; \
|
(bit) = state->mps ^ 1; \
|
||||||
*(curctx) = state->nlps; \
|
*(curctx) = state->nlps; \
|
||||||
} else { \
|
} else { \
|
||||||
register jpc_mqstate_t *state = *(curctx); \
|
register jpc_mqstate_t *state = *(curctx); \
|
||||||
(areg) = (delta); \
|
(areg) = (delta); \
|
||||||
(bit) = state->mps; \
|
(bit) = state->mps; \
|
||||||
*(curctx) = state->nmps; \
|
*(curctx) = state->nmps; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define jpc_mqdec_renormd(areg, creg, ctreg, in, eof, inbuf) \
|
#define jpc_mqdec_renormd(areg, creg, ctreg, in, eof, inbuf) \
|
||||||
{ \
|
{ \
|
||||||
do { \
|
do { \
|
||||||
if (!(ctreg)) { \
|
if (!(ctreg)) { \
|
||||||
jpc_mqdec_bytein2(creg, ctreg, in, eof, inbuf); \
|
jpc_mqdec_bytein2(creg, ctreg, in, eof, inbuf); \
|
||||||
} \
|
} \
|
||||||
(areg) <<= 1; \
|
(areg) <<= 1; \
|
||||||
(creg) <<= 1; \
|
(creg) <<= 1; \
|
||||||
--(ctreg); \
|
--(ctreg); \
|
||||||
} while (!((areg) & 0x8000)); \
|
} while (!((areg) & 0x8000)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define jpc_mqdec_bytein2(creg, ctreg, in, eof, inbuf) \
|
#define jpc_mqdec_bytein2(creg, ctreg, in, eof, inbuf) \
|
||||||
{ \
|
{ \
|
||||||
int c; \
|
int c; \
|
||||||
unsigned char prevbuf; \
|
unsigned char prevbuf; \
|
||||||
if (!(eof)) { \
|
if (!(eof)) { \
|
||||||
if ((c = jas_stream_getc(in)) == EOF) { \
|
if ((c = jas_stream_getc(in)) == EOF) { \
|
||||||
(eof) = 1; \
|
(eof) = 1; \
|
||||||
c = 0xff; \
|
c = 0xff; \
|
||||||
} \
|
} \
|
||||||
prevbuf = (inbuf); \
|
prevbuf = (inbuf); \
|
||||||
(inbuf) = c; \
|
(inbuf) = c; \
|
||||||
if (prevbuf == 0xff) { \
|
if (prevbuf == 0xff) { \
|
||||||
if (c > 0x8f) { \
|
if (c > 0x8f) { \
|
||||||
(creg) += 0xff00; \
|
(creg) += 0xff00; \
|
||||||
(ctreg) = 8; \
|
(ctreg) = 8; \
|
||||||
} else { \
|
} else { \
|
||||||
(creg) += c << 9; \
|
(creg) += c << 9; \
|
||||||
(ctreg) = 7; \
|
(ctreg) = 7; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
(creg) += c << 8; \
|
(creg) += c << 8; \
|
||||||
(ctreg) = 8; \
|
(ctreg) = 8; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
(creg) += 0xff00; \
|
(creg) += 0xff00; \
|
||||||
(ctreg) = 8; \
|
(ctreg) = 8; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_mqdec_getbit_func(jpc_mqdec_t *dec);
|
int jpc_mqdec_getbit_func(jpc_mqdec_t *dec);
|
||||||
|
366
3rdparty/libjasper/jpc_mqenc.c
vendored
366
3rdparty/libjasper/jpc_mqenc.c
vendored
@ -87,90 +87,90 @@
|
|||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
#define JPC_MQENC_CALL(n, x) \
|
#define JPC_MQENC_CALL(n, x) \
|
||||||
((jas_getdbglevel() >= (n)) ? ((void)(x)) : ((void)0))
|
((jas_getdbglevel() >= (n)) ? ((void)(x)) : ((void)0))
|
||||||
#else
|
#else
|
||||||
#define JPC_MQENC_CALL(n, x)
|
#define JPC_MQENC_CALL(n, x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define jpc_mqenc_codemps9(areg, creg, ctreg, curctx, enc) \
|
#define jpc_mqenc_codemps9(areg, creg, ctreg, curctx, enc) \
|
||||||
{ \
|
{ \
|
||||||
jpc_mqstate_t *state = *(curctx); \
|
jpc_mqstate_t *state = *(curctx); \
|
||||||
(areg) -= state->qeval; \
|
(areg) -= state->qeval; \
|
||||||
if (!((areg) & 0x8000)) { \
|
if (!((areg) & 0x8000)) { \
|
||||||
if ((areg) < state->qeval) { \
|
if ((areg) < state->qeval) { \
|
||||||
(areg) = state->qeval; \
|
(areg) = state->qeval; \
|
||||||
} else { \
|
} else { \
|
||||||
(creg) += state->qeval; \
|
(creg) += state->qeval; \
|
||||||
} \
|
} \
|
||||||
*(curctx) = state->nmps; \
|
*(curctx) = state->nmps; \
|
||||||
jpc_mqenc_renorme((areg), (creg), (ctreg), (enc)); \
|
jpc_mqenc_renorme((areg), (creg), (ctreg), (enc)); \
|
||||||
} else { \
|
} else { \
|
||||||
(creg) += state->qeval; \
|
(creg) += state->qeval; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define jpc_mqenc_codelps2(areg, creg, ctreg, curctx, enc) \
|
#define jpc_mqenc_codelps2(areg, creg, ctreg, curctx, enc) \
|
||||||
{ \
|
{ \
|
||||||
jpc_mqstate_t *state = *(curctx); \
|
jpc_mqstate_t *state = *(curctx); \
|
||||||
(areg) -= state->qeval; \
|
(areg) -= state->qeval; \
|
||||||
if ((areg) < state->qeval) { \
|
if ((areg) < state->qeval) { \
|
||||||
(creg) += state->qeval; \
|
(creg) += state->qeval; \
|
||||||
} else { \
|
} else { \
|
||||||
(areg) = state->qeval; \
|
(areg) = state->qeval; \
|
||||||
} \
|
} \
|
||||||
*(curctx) = state->nlps; \
|
*(curctx) = state->nlps; \
|
||||||
jpc_mqenc_renorme((areg), (creg), (ctreg), (enc)); \
|
jpc_mqenc_renorme((areg), (creg), (ctreg), (enc)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define jpc_mqenc_renorme(areg, creg, ctreg, enc) \
|
#define jpc_mqenc_renorme(areg, creg, ctreg, enc) \
|
||||||
{ \
|
{ \
|
||||||
do { \
|
do { \
|
||||||
(areg) <<= 1; \
|
(areg) <<= 1; \
|
||||||
(creg) <<= 1; \
|
(creg) <<= 1; \
|
||||||
if (!--(ctreg)) { \
|
if (!--(ctreg)) { \
|
||||||
jpc_mqenc_byteout((areg), (creg), (ctreg), (enc)); \
|
jpc_mqenc_byteout((areg), (creg), (ctreg), (enc)); \
|
||||||
} \
|
} \
|
||||||
} while (!((areg) & 0x8000)); \
|
} while (!((areg) & 0x8000)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define jpc_mqenc_byteout(areg, creg, ctreg, enc) \
|
#define jpc_mqenc_byteout(areg, creg, ctreg, enc) \
|
||||||
{ \
|
{ \
|
||||||
if ((enc)->outbuf != 0xff) { \
|
if ((enc)->outbuf != 0xff) { \
|
||||||
if ((creg) & 0x8000000) { \
|
if ((creg) & 0x8000000) { \
|
||||||
if (++((enc)->outbuf) == 0xff) { \
|
if (++((enc)->outbuf) == 0xff) { \
|
||||||
(creg) &= 0x7ffffff; \
|
(creg) &= 0x7ffffff; \
|
||||||
jpc_mqenc_byteout2(enc); \
|
jpc_mqenc_byteout2(enc); \
|
||||||
enc->outbuf = ((creg) >> 20) & 0xff; \
|
enc->outbuf = ((creg) >> 20) & 0xff; \
|
||||||
(creg) &= 0xfffff; \
|
(creg) &= 0xfffff; \
|
||||||
(ctreg) = 7; \
|
(ctreg) = 7; \
|
||||||
} else { \
|
} else { \
|
||||||
jpc_mqenc_byteout2(enc); \
|
jpc_mqenc_byteout2(enc); \
|
||||||
enc->outbuf = ((creg) >> 19) & 0xff; \
|
enc->outbuf = ((creg) >> 19) & 0xff; \
|
||||||
(creg) &= 0x7ffff; \
|
(creg) &= 0x7ffff; \
|
||||||
(ctreg) = 8; \
|
(ctreg) = 8; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
jpc_mqenc_byteout2(enc); \
|
jpc_mqenc_byteout2(enc); \
|
||||||
(enc)->outbuf = ((creg) >> 19) & 0xff; \
|
(enc)->outbuf = ((creg) >> 19) & 0xff; \
|
||||||
(creg) &= 0x7ffff; \
|
(creg) &= 0x7ffff; \
|
||||||
(ctreg) = 8; \
|
(ctreg) = 8; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
jpc_mqenc_byteout2(enc); \
|
jpc_mqenc_byteout2(enc); \
|
||||||
(enc)->outbuf = ((creg) >> 20) & 0xff; \
|
(enc)->outbuf = ((creg) >> 20) & 0xff; \
|
||||||
(creg) &= 0xfffff; \
|
(creg) &= 0xfffff; \
|
||||||
(ctreg) = 7; \
|
(ctreg) = 7; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define jpc_mqenc_byteout2(enc) \
|
#define jpc_mqenc_byteout2(enc) \
|
||||||
{ \
|
{ \
|
||||||
if (enc->outbuf >= 0) { \
|
if (enc->outbuf >= 0) { \
|
||||||
if (jas_stream_putc(enc->out, (unsigned char)enc->outbuf) == EOF) { \
|
if (jas_stream_putc(enc->out, (unsigned char)enc->outbuf) == EOF) { \
|
||||||
enc->err |= 1; \
|
enc->err |= 1; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
enc->lastbyte = enc->outbuf; \
|
enc->lastbyte = enc->outbuf; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -187,45 +187,45 @@ static void jpc_mqenc_setbits(jpc_mqenc_t *mqenc);
|
|||||||
|
|
||||||
jpc_mqenc_t *jpc_mqenc_create(int maxctxs, jas_stream_t *out)
|
jpc_mqenc_t *jpc_mqenc_create(int maxctxs, jas_stream_t *out)
|
||||||
{
|
{
|
||||||
jpc_mqenc_t *mqenc;
|
jpc_mqenc_t *mqenc;
|
||||||
|
|
||||||
/* Allocate memory for the MQ encoder. */
|
/* Allocate memory for the MQ encoder. */
|
||||||
if (!(mqenc = jas_malloc(sizeof(jpc_mqenc_t)))) {
|
if (!(mqenc = jas_malloc(sizeof(jpc_mqenc_t)))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
mqenc->out = out;
|
mqenc->out = out;
|
||||||
mqenc->maxctxs = maxctxs;
|
mqenc->maxctxs = maxctxs;
|
||||||
|
|
||||||
/* Allocate memory for the per-context state information. */
|
/* Allocate memory for the per-context state information. */
|
||||||
if (!(mqenc->ctxs = jas_alloc2(mqenc->maxctxs, sizeof(jpc_mqstate_t *)))) {
|
if (!(mqenc->ctxs = jas_alloc2(mqenc->maxctxs, sizeof(jpc_mqstate_t *)))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the current context to the first one. */
|
/* Set the current context to the first one. */
|
||||||
mqenc->curctx = mqenc->ctxs;
|
mqenc->curctx = mqenc->ctxs;
|
||||||
|
|
||||||
jpc_mqenc_init(mqenc);
|
jpc_mqenc_init(mqenc);
|
||||||
|
|
||||||
/* Initialize the per-context state information to something sane. */
|
/* Initialize the per-context state information to something sane. */
|
||||||
jpc_mqenc_setctxs(mqenc, 0, 0);
|
jpc_mqenc_setctxs(mqenc, 0, 0);
|
||||||
|
|
||||||
return mqenc;
|
return mqenc;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (mqenc) {
|
if (mqenc) {
|
||||||
jpc_mqenc_destroy(mqenc);
|
jpc_mqenc_destroy(mqenc);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy a MQ encoder. */
|
/* Destroy a MQ encoder. */
|
||||||
|
|
||||||
void jpc_mqenc_destroy(jpc_mqenc_t *mqenc)
|
void jpc_mqenc_destroy(jpc_mqenc_t *mqenc)
|
||||||
{
|
{
|
||||||
if (mqenc->ctxs) {
|
if (mqenc->ctxs) {
|
||||||
jas_free(mqenc->ctxs);
|
jas_free(mqenc->ctxs);
|
||||||
}
|
}
|
||||||
jas_free(mqenc);
|
jas_free(mqenc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -236,33 +236,33 @@ void jpc_mqenc_destroy(jpc_mqenc_t *mqenc)
|
|||||||
|
|
||||||
void jpc_mqenc_init(jpc_mqenc_t *mqenc)
|
void jpc_mqenc_init(jpc_mqenc_t *mqenc)
|
||||||
{
|
{
|
||||||
mqenc->areg = 0x8000;
|
mqenc->areg = 0x8000;
|
||||||
mqenc->outbuf = -1;
|
mqenc->outbuf = -1;
|
||||||
mqenc->creg = 0;
|
mqenc->creg = 0;
|
||||||
mqenc->ctreg = 12;
|
mqenc->ctreg = 12;
|
||||||
mqenc->lastbyte = -1;
|
mqenc->lastbyte = -1;
|
||||||
mqenc->err = 0;
|
mqenc->err = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize one or more contexts. */
|
/* Initialize one or more contexts. */
|
||||||
|
|
||||||
void jpc_mqenc_setctxs(jpc_mqenc_t *mqenc, int numctxs, jpc_mqctx_t *ctxs)
|
void jpc_mqenc_setctxs(jpc_mqenc_t *mqenc, int numctxs, jpc_mqctx_t *ctxs)
|
||||||
{
|
{
|
||||||
jpc_mqstate_t **ctx;
|
jpc_mqstate_t **ctx;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
ctx = mqenc->ctxs;
|
ctx = mqenc->ctxs;
|
||||||
n = JAS_MIN(mqenc->maxctxs, numctxs);
|
n = JAS_MIN(mqenc->maxctxs, numctxs);
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
*ctx = &jpc_mqstates[2 * ctxs->ind + ctxs->mps];
|
*ctx = &jpc_mqstates[2 * ctxs->ind + ctxs->mps];
|
||||||
++ctx;
|
++ctx;
|
||||||
++ctxs;
|
++ctxs;
|
||||||
}
|
}
|
||||||
n = mqenc->maxctxs - numctxs;
|
n = mqenc->maxctxs - numctxs;
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
*ctx = &jpc_mqstates[0];
|
*ctx = &jpc_mqstates[0];
|
||||||
++ctx;
|
++ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,10 +270,10 @@ void jpc_mqenc_setctxs(jpc_mqenc_t *mqenc, int numctxs, jpc_mqctx_t *ctxs)
|
|||||||
|
|
||||||
void jpc_mqenc_getstate(jpc_mqenc_t *mqenc, jpc_mqencstate_t *state)
|
void jpc_mqenc_getstate(jpc_mqenc_t *mqenc, jpc_mqencstate_t *state)
|
||||||
{
|
{
|
||||||
state->areg = mqenc->areg;
|
state->areg = mqenc->areg;
|
||||||
state->creg = mqenc->creg;
|
state->creg = mqenc->creg;
|
||||||
state->ctreg = mqenc->ctreg;
|
state->ctreg = mqenc->ctreg;
|
||||||
state->lastbyte = mqenc->lastbyte;
|
state->lastbyte = mqenc->lastbyte;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -284,49 +284,49 @@ void jpc_mqenc_getstate(jpc_mqenc_t *mqenc, jpc_mqencstate_t *state)
|
|||||||
|
|
||||||
int jpc_mqenc_putbit_func(jpc_mqenc_t *mqenc, int bit)
|
int jpc_mqenc_putbit_func(jpc_mqenc_t *mqenc, int bit)
|
||||||
{
|
{
|
||||||
const jpc_mqstate_t *state;
|
const jpc_mqstate_t *state;
|
||||||
JAS_DBGLOG(100, ("jpc_mqenc_putbit(%p, %d)\n", mqenc, bit));
|
JAS_DBGLOG(100, ("jpc_mqenc_putbit(%p, %d)\n", mqenc, bit));
|
||||||
JPC_MQENC_CALL(100, jpc_mqenc_dump(mqenc, stderr));
|
JPC_MQENC_CALL(100, jpc_mqenc_dump(mqenc, stderr));
|
||||||
|
|
||||||
state = *(mqenc->curctx);
|
state = *(mqenc->curctx);
|
||||||
|
|
||||||
if (state->mps == bit) {
|
if (state->mps == bit) {
|
||||||
/* Apply the CODEMPS algorithm as defined in the standard. */
|
/* Apply the CODEMPS algorithm as defined in the standard. */
|
||||||
mqenc->areg -= state->qeval;
|
mqenc->areg -= state->qeval;
|
||||||
if (!(mqenc->areg & 0x8000)) {
|
if (!(mqenc->areg & 0x8000)) {
|
||||||
jpc_mqenc_codemps2(mqenc);
|
jpc_mqenc_codemps2(mqenc);
|
||||||
} else {
|
} else {
|
||||||
mqenc->creg += state->qeval;
|
mqenc->creg += state->qeval;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Apply the CODELPS algorithm as defined in the standard. */
|
/* Apply the CODELPS algorithm as defined in the standard. */
|
||||||
jpc_mqenc_codelps2(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc->curctx, mqenc);
|
jpc_mqenc_codelps2(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc->curctx, mqenc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return jpc_mqenc_error(mqenc) ? (-1) : 0;
|
return jpc_mqenc_error(mqenc) ? (-1) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_mqenc_codemps2(jpc_mqenc_t *mqenc)
|
int jpc_mqenc_codemps2(jpc_mqenc_t *mqenc)
|
||||||
{
|
{
|
||||||
/* Note: This function only performs part of the work associated with
|
/* Note: This function only performs part of the work associated with
|
||||||
the CODEMPS algorithm from the standard. Some of the work is also
|
the CODEMPS algorithm from the standard. Some of the work is also
|
||||||
performed by the caller. */
|
performed by the caller. */
|
||||||
|
|
||||||
jpc_mqstate_t *state = *(mqenc->curctx);
|
jpc_mqstate_t *state = *(mqenc->curctx);
|
||||||
if (mqenc->areg < state->qeval) {
|
if (mqenc->areg < state->qeval) {
|
||||||
mqenc->areg = state->qeval;
|
mqenc->areg = state->qeval;
|
||||||
} else {
|
} else {
|
||||||
mqenc->creg += state->qeval;
|
mqenc->creg += state->qeval;
|
||||||
}
|
}
|
||||||
*mqenc->curctx = state->nmps;
|
*mqenc->curctx = state->nmps;
|
||||||
jpc_mqenc_renorme(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
jpc_mqenc_renorme(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
||||||
return jpc_mqenc_error(mqenc) ? (-1) : 0;
|
return jpc_mqenc_error(mqenc) ? (-1) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_mqenc_codelps(jpc_mqenc_t *mqenc)
|
int jpc_mqenc_codelps(jpc_mqenc_t *mqenc)
|
||||||
{
|
{
|
||||||
jpc_mqenc_codelps2(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc->curctx, mqenc);
|
jpc_mqenc_codelps2(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc->curctx, mqenc);
|
||||||
return jpc_mqenc_error(mqenc) ? (-1) : 0;
|
return jpc_mqenc_error(mqenc) ? (-1) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -337,56 +337,56 @@ int jpc_mqenc_codelps(jpc_mqenc_t *mqenc)
|
|||||||
|
|
||||||
int jpc_mqenc_flush(jpc_mqenc_t *mqenc, int termmode)
|
int jpc_mqenc_flush(jpc_mqenc_t *mqenc, int termmode)
|
||||||
{
|
{
|
||||||
int_fast16_t k;
|
int_fast16_t k;
|
||||||
|
|
||||||
switch (termmode) {
|
switch (termmode) {
|
||||||
case JPC_MQENC_PTERM:
|
case JPC_MQENC_PTERM:
|
||||||
k = 11 - mqenc->ctreg + 1;
|
k = 11 - mqenc->ctreg + 1;
|
||||||
while (k > 0) {
|
while (k > 0) {
|
||||||
mqenc->creg <<= mqenc->ctreg;
|
mqenc->creg <<= mqenc->ctreg;
|
||||||
mqenc->ctreg = 0;
|
mqenc->ctreg = 0;
|
||||||
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg,
|
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg,
|
||||||
mqenc);
|
mqenc);
|
||||||
k -= mqenc->ctreg;
|
k -= mqenc->ctreg;
|
||||||
}
|
}
|
||||||
if (mqenc->outbuf != 0xff) {
|
if (mqenc->outbuf != 0xff) {
|
||||||
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JPC_MQENC_DEFTERM:
|
case JPC_MQENC_DEFTERM:
|
||||||
jpc_mqenc_setbits(mqenc);
|
jpc_mqenc_setbits(mqenc);
|
||||||
mqenc->creg <<= mqenc->ctreg;
|
mqenc->creg <<= mqenc->ctreg;
|
||||||
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
||||||
mqenc->creg <<= mqenc->ctreg;
|
mqenc->creg <<= mqenc->ctreg;
|
||||||
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
||||||
if (mqenc->outbuf != 0xff) {
|
if (mqenc->outbuf != 0xff) {
|
||||||
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
jpc_mqenc_byteout(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jpc_mqenc_setbits(jpc_mqenc_t *mqenc)
|
static void jpc_mqenc_setbits(jpc_mqenc_t *mqenc)
|
||||||
{
|
{
|
||||||
uint_fast32_t tmp = mqenc->creg + mqenc->areg;
|
uint_fast32_t tmp = mqenc->creg + mqenc->areg;
|
||||||
mqenc->creg |= 0xffff;
|
mqenc->creg |= 0xffff;
|
||||||
if (mqenc->creg >= tmp) {
|
if (mqenc->creg >= tmp) {
|
||||||
mqenc->creg -= 0x8000;
|
mqenc->creg -= 0x8000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump a MQ encoder to a stream for debugging. */
|
/* Dump a MQ encoder to a stream for debugging. */
|
||||||
|
|
||||||
int jpc_mqenc_dump(jpc_mqenc_t *mqenc, FILE *out)
|
int jpc_mqenc_dump(jpc_mqenc_t *mqenc, FILE *out)
|
||||||
{
|
{
|
||||||
fprintf(out, "AREG = %08x, CREG = %08x, CTREG = %d\n",
|
fprintf(out, "AREG = %08x, CREG = %08x, CTREG = %d\n",
|
||||||
(unsigned)mqenc->areg, (unsigned)mqenc->creg, (int)mqenc->ctreg);
|
(unsigned)mqenc->areg, (unsigned)mqenc->creg, (int)mqenc->ctreg);
|
||||||
fprintf(out, "IND = %02d, MPS = %d, QEVAL = %04x\n",
|
fprintf(out, "IND = %02d, MPS = %d, QEVAL = %04x\n",
|
||||||
(int)(*mqenc->curctx - jpc_mqstates), (int)(*mqenc->curctx)->mps,
|
(int)(*mqenc->curctx - jpc_mqstates), (int)(*mqenc->curctx)->mps,
|
||||||
(int)(*mqenc->curctx)->qeval);
|
(int)(*mqenc->curctx)->qeval);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
68
3rdparty/libjasper/jpc_mqenc.h
vendored
68
3rdparty/libjasper/jpc_mqenc.h
vendored
@ -98,35 +98,35 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The C register. */
|
/* The C register. */
|
||||||
uint_fast32_t creg;
|
uint_fast32_t creg;
|
||||||
|
|
||||||
/* The A register. */
|
/* The A register. */
|
||||||
uint_fast32_t areg;
|
uint_fast32_t areg;
|
||||||
|
|
||||||
/* The CT register. */
|
/* The CT register. */
|
||||||
uint_fast32_t ctreg;
|
uint_fast32_t ctreg;
|
||||||
|
|
||||||
/* The maximum number of contexts. */
|
/* The maximum number of contexts. */
|
||||||
int maxctxs;
|
int maxctxs;
|
||||||
|
|
||||||
/* The per-context information. */
|
/* The per-context information. */
|
||||||
jpc_mqstate_t **ctxs;
|
jpc_mqstate_t **ctxs;
|
||||||
|
|
||||||
/* The current context. */
|
/* The current context. */
|
||||||
jpc_mqstate_t **curctx;
|
jpc_mqstate_t **curctx;
|
||||||
|
|
||||||
/* The stream for encoder output. */
|
/* The stream for encoder output. */
|
||||||
jas_stream_t *out;
|
jas_stream_t *out;
|
||||||
|
|
||||||
/* The byte buffer (i.e., the B variable in the standard). */
|
/* The byte buffer (i.e., the B variable in the standard). */
|
||||||
int_fast16_t outbuf;
|
int_fast16_t outbuf;
|
||||||
|
|
||||||
/* The last byte output. */
|
/* The last byte output. */
|
||||||
int_fast16_t lastbyte;
|
int_fast16_t lastbyte;
|
||||||
|
|
||||||
/* The error indicator. */
|
/* The error indicator. */
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
} jpc_mqenc_t;
|
} jpc_mqenc_t;
|
||||||
|
|
||||||
@ -134,17 +134,17 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The A register. */
|
/* The A register. */
|
||||||
unsigned areg;
|
unsigned areg;
|
||||||
|
|
||||||
/* The C register. */
|
/* The C register. */
|
||||||
unsigned creg;
|
unsigned creg;
|
||||||
|
|
||||||
/* The CT register. */
|
/* The CT register. */
|
||||||
unsigned ctreg;
|
unsigned ctreg;
|
||||||
|
|
||||||
/* The last byte output by the encoder. */
|
/* The last byte output by the encoder. */
|
||||||
int lastbyte;
|
int lastbyte;
|
||||||
|
|
||||||
} jpc_mqencstate_t;
|
} jpc_mqencstate_t;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ void jpc_mqenc_setctxs(jpc_mqenc_t *enc, int numctxs, jpc_mqctx_t *ctxs);
|
|||||||
|
|
||||||
/* Get the error state of a MQ encoder. */
|
/* Get the error state of a MQ encoder. */
|
||||||
#define jpc_mqenc_error(enc) \
|
#define jpc_mqenc_error(enc) \
|
||||||
((enc)->err)
|
((enc)->err)
|
||||||
|
|
||||||
/* Get the current encoder state. */
|
/* Get the current encoder state. */
|
||||||
void jpc_mqenc_getstate(jpc_mqenc_t *enc, jpc_mqencstate_t *state);
|
void jpc_mqenc_getstate(jpc_mqenc_t *enc, jpc_mqencstate_t *state);
|
||||||
@ -217,11 +217,11 @@ int jpc_mqenc_dump(jpc_mqenc_t *mqenc, FILE *out);
|
|||||||
/* Note: This macro is included only to satisfy the needs of
|
/* Note: This macro is included only to satisfy the needs of
|
||||||
the mqenc_putbit macro. */
|
the mqenc_putbit macro. */
|
||||||
#define jpc_mqenc_putbit_macro(enc, bit) \
|
#define jpc_mqenc_putbit_macro(enc, bit) \
|
||||||
(((*((enc)->curctx))->mps == (bit)) ? \
|
(((*((enc)->curctx))->mps == (bit)) ? \
|
||||||
(((enc)->areg -= (*(enc)->curctx)->qeval), \
|
(((enc)->areg -= (*(enc)->curctx)->qeval), \
|
||||||
((!((enc)->areg & 0x8000)) ? (jpc_mqenc_codemps2(enc)) : \
|
((!((enc)->areg & 0x8000)) ? (jpc_mqenc_codemps2(enc)) : \
|
||||||
((enc)->creg += (*(enc)->curctx)->qeval))) : \
|
((enc)->creg += (*(enc)->curctx)->qeval))) : \
|
||||||
jpc_mqenc_codelps(enc))
|
jpc_mqenc_codelps(enc))
|
||||||
|
|
||||||
/* Note: These function prototypes are included only to satisfy the
|
/* Note: These function prototypes are included only to satisfy the
|
||||||
needs of the mqenc_putbit_macro macro. Do not call any of these
|
needs of the mqenc_putbit_macro macro. Do not call any of these
|
||||||
|
5022
3rdparty/libjasper/jpc_qmfb.c
vendored
5022
3rdparty/libjasper/jpc_qmfb.c
vendored
File diff suppressed because it is too large
Load Diff
8
3rdparty/libjasper/jpc_qmfb.h
vendored
8
3rdparty/libjasper/jpc_qmfb.h
vendored
@ -101,10 +101,10 @@ any particular platform. Hopefully, it is not too unreasonable, however. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int (*analyze)(int *, int, int, int, int, int);
|
int (*analyze)(int *, int, int, int, int, int);
|
||||||
int (*synthesize)(int *, int, int, int, int, int);
|
int (*synthesize)(int *, int, int, int, int, int);
|
||||||
double *lpenergywts;
|
double *lpenergywts;
|
||||||
double *hpenergywts;
|
double *hpenergywts;
|
||||||
} jpc_qmfb2d_t;
|
} jpc_qmfb2d_t;
|
||||||
|
|
||||||
extern jpc_qmfb2d_t jpc_ft_qmfb2d;
|
extern jpc_qmfb2d_t jpc_ft_qmfb2d;
|
||||||
|
588
3rdparty/libjasper/jpc_t1cod.c
vendored
588
3rdparty/libjasper/jpc_t1cod.c
vendored
@ -114,49 +114,49 @@ void jpc_initmqctxs(void);
|
|||||||
|
|
||||||
int JPC_PASSTYPE(int passno)
|
int JPC_PASSTYPE(int passno)
|
||||||
{
|
{
|
||||||
int passtype;
|
int passtype;
|
||||||
switch (passno % 3) {
|
switch (passno % 3) {
|
||||||
case 0:
|
case 0:
|
||||||
passtype = JPC_CLNPASS;
|
passtype = JPC_CLNPASS;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
passtype = JPC_SIGPASS;
|
passtype = JPC_SIGPASS;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
passtype = JPC_REFPASS;
|
passtype = JPC_REFPASS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
passtype = -1;
|
passtype = -1;
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return passtype;
|
return passtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
int JPC_NOMINALGAIN(int qmfbid, int numlvls, int lvlno, int orient)
|
int JPC_NOMINALGAIN(int qmfbid, int numlvls, int lvlno, int orient)
|
||||||
{
|
{
|
||||||
/* Avoid compiler warnings about unused parameters. */
|
/* Avoid compiler warnings about unused parameters. */
|
||||||
numlvls = 0;
|
numlvls = 0;
|
||||||
|
|
||||||
if (qmfbid == JPC_COX_INS) {
|
if (qmfbid == JPC_COX_INS) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
assert(qmfbid == JPC_COX_RFT);
|
assert(qmfbid == JPC_COX_RFT);
|
||||||
if (lvlno == 0) {
|
if (lvlno == 0) {
|
||||||
assert(orient == JPC_TSFB_LL);
|
assert(orient == JPC_TSFB_LL);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
switch (orient) {
|
switch (orient) {
|
||||||
case JPC_TSFB_LH:
|
case JPC_TSFB_LH:
|
||||||
case JPC_TSFB_HL:
|
case JPC_TSFB_HL:
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
case JPC_TSFB_HH:
|
case JPC_TSFB_HH:
|
||||||
return 2;
|
return 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -165,66 +165,66 @@ if (qmfbid == JPC_COX_INS) {
|
|||||||
|
|
||||||
int JPC_SEGTYPE(int passno, int firstpassno, int bypass)
|
int JPC_SEGTYPE(int passno, int firstpassno, int bypass)
|
||||||
{
|
{
|
||||||
int passtype;
|
int passtype;
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
passtype = JPC_PASSTYPE(passno);
|
passtype = JPC_PASSTYPE(passno);
|
||||||
if (passtype == JPC_CLNPASS) {
|
if (passtype == JPC_CLNPASS) {
|
||||||
return JPC_SEG_MQ;
|
return JPC_SEG_MQ;
|
||||||
}
|
}
|
||||||
return ((passno < firstpassno + 10) ? JPC_SEG_MQ : JPC_SEG_RAW);
|
return ((passno < firstpassno + 10) ? JPC_SEG_MQ : JPC_SEG_RAW);
|
||||||
} else {
|
} else {
|
||||||
return JPC_SEG_MQ;
|
return JPC_SEG_MQ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int JPC_SEGPASSCNT(int passno, int firstpassno, int numpasses, int bypass, int termall)
|
int JPC_SEGPASSCNT(int passno, int firstpassno, int numpasses, int bypass, int termall)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int passtype;
|
int passtype;
|
||||||
|
|
||||||
if (termall) {
|
if (termall) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else if (bypass) {
|
} else if (bypass) {
|
||||||
if (passno < firstpassno + 10) {
|
if (passno < firstpassno + 10) {
|
||||||
ret = 10 - (passno - firstpassno);
|
ret = 10 - (passno - firstpassno);
|
||||||
} else {
|
} else {
|
||||||
passtype = JPC_PASSTYPE(passno);
|
passtype = JPC_PASSTYPE(passno);
|
||||||
switch (passtype) {
|
switch (passtype) {
|
||||||
case JPC_SIGPASS:
|
case JPC_SIGPASS:
|
||||||
ret = 2;
|
ret = 2;
|
||||||
break;
|
break;
|
||||||
case JPC_REFPASS:
|
case JPC_REFPASS:
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
case JPC_CLNPASS:
|
case JPC_CLNPASS:
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -1;
|
ret = -1;
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = JPC_PREC * 3 - 2;
|
ret = JPC_PREC * 3 - 2;
|
||||||
}
|
}
|
||||||
ret = JAS_MIN(ret, numpasses - passno);
|
ret = JAS_MIN(ret, numpasses - passno);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int JPC_ISTERMINATED(int passno, int firstpassno, int numpasses, int termall,
|
int JPC_ISTERMINATED(int passno, int firstpassno, int numpasses, int termall,
|
||||||
int lazy)
|
int lazy)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int n;
|
int n;
|
||||||
if (passno - firstpassno == numpasses - 1) {
|
if (passno - firstpassno == numpasses - 1) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
n = JPC_SEGPASSCNT(passno, firstpassno, numpasses, lazy, termall);
|
n = JPC_SEGPASSCNT(passno, firstpassno, numpasses, lazy, termall);
|
||||||
ret = (n <= 1) ? 1 : 0;
|
ret = (n <= 1) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -233,265 +233,265 @@ int JPC_ISTERMINATED(int passno, int firstpassno, int numpasses, int termall,
|
|||||||
|
|
||||||
void jpc_initluts()
|
void jpc_initluts()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int orient;
|
int orient;
|
||||||
int refine;
|
int refine;
|
||||||
float u;
|
float u;
|
||||||
float v;
|
float v;
|
||||||
float t;
|
float t;
|
||||||
|
|
||||||
/* XXX - hack */
|
/* XXX - hack */
|
||||||
jpc_initmqctxs();
|
jpc_initmqctxs();
|
||||||
|
|
||||||
for (orient = 0; orient < 4; ++orient) {
|
for (orient = 0; orient < 4; ++orient) {
|
||||||
for (i = 0; i < 256; ++i) {
|
for (i = 0; i < 256; ++i) {
|
||||||
jpc_zcctxnolut[(orient << 8) | i] = jpc_getzcctxno(i, orient);
|
jpc_zcctxnolut[(orient << 8) | i] = jpc_getzcctxno(i, orient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 256; ++i) {
|
for (i = 0; i < 256; ++i) {
|
||||||
jpc_spblut[i] = jpc_getspb(i << 4);
|
jpc_spblut[i] = jpc_getspb(i << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 256; ++i) {
|
for (i = 0; i < 256; ++i) {
|
||||||
jpc_scctxnolut[i] = jpc_getscctxno(i << 4);
|
jpc_scctxnolut[i] = jpc_getscctxno(i << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (refine = 0; refine < 2; ++refine) {
|
for (refine = 0; refine < 2; ++refine) {
|
||||||
for (i = 0; i < 2048; ++i) {
|
for (i = 0; i < 2048; ++i) {
|
||||||
jpc_magctxnolut[(refine << 11) + i] = jpc_getmagctxno((refine ? JPC_REFINE : 0) | i);
|
jpc_magctxnolut[(refine << 11) + i] = jpc_getmagctxno((refine ? JPC_REFINE : 0) | i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < (1 << JPC_NMSEDEC_BITS); ++i) {
|
for (i = 0; i < (1 << JPC_NMSEDEC_BITS); ++i) {
|
||||||
t = i * jpc_pow2i(-JPC_NMSEDEC_FRACBITS);
|
t = i * jpc_pow2i(-JPC_NMSEDEC_FRACBITS);
|
||||||
u = t;
|
u = t;
|
||||||
v = t - 1.5;
|
v = t - 1.5;
|
||||||
jpc_signmsedec[i] = jpc_dbltofix(floor((u * u - v * v) * jpc_pow2i(JPC_NMSEDEC_FRACBITS) + 0.5) / jpc_pow2i(JPC_NMSEDEC_FRACBITS));
|
jpc_signmsedec[i] = jpc_dbltofix(floor((u * u - v * v) * jpc_pow2i(JPC_NMSEDEC_FRACBITS) + 0.5) / jpc_pow2i(JPC_NMSEDEC_FRACBITS));
|
||||||
/* XXX - this calc is not correct */
|
/* XXX - this calc is not correct */
|
||||||
jpc_signmsedec0[i] = jpc_dbltofix(floor((u * u) * jpc_pow2i(JPC_NMSEDEC_FRACBITS) + 0.5) / jpc_pow2i(JPC_NMSEDEC_FRACBITS));
|
jpc_signmsedec0[i] = jpc_dbltofix(floor((u * u) * jpc_pow2i(JPC_NMSEDEC_FRACBITS) + 0.5) / jpc_pow2i(JPC_NMSEDEC_FRACBITS));
|
||||||
u = t - 1.0;
|
u = t - 1.0;
|
||||||
if (i & (1 << (JPC_NMSEDEC_BITS - 1))) {
|
if (i & (1 << (JPC_NMSEDEC_BITS - 1))) {
|
||||||
v = t - 1.5;
|
v = t - 1.5;
|
||||||
} else {
|
} else {
|
||||||
v = t - 0.5;
|
v = t - 0.5;
|
||||||
}
|
}
|
||||||
jpc_refnmsedec[i] = jpc_dbltofix(floor((u * u - v * v) * jpc_pow2i(JPC_NMSEDEC_FRACBITS) + 0.5) / jpc_pow2i(JPC_NMSEDEC_FRACBITS));
|
jpc_refnmsedec[i] = jpc_dbltofix(floor((u * u - v * v) * jpc_pow2i(JPC_NMSEDEC_FRACBITS) + 0.5) / jpc_pow2i(JPC_NMSEDEC_FRACBITS));
|
||||||
/* XXX - this calc is not correct */
|
/* XXX - this calc is not correct */
|
||||||
jpc_refnmsedec0[i] = jpc_dbltofix(floor((u * u) * jpc_pow2i(JPC_NMSEDEC_FRACBITS) + 0.5) / jpc_pow2i(JPC_NMSEDEC_FRACBITS));
|
jpc_refnmsedec0[i] = jpc_dbltofix(floor((u * u) * jpc_pow2i(JPC_NMSEDEC_FRACBITS) + 0.5) / jpc_pow2i(JPC_NMSEDEC_FRACBITS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jpc_fix_t jpc_getsignmsedec_func(jpc_fix_t x, int bitpos)
|
jpc_fix_t jpc_getsignmsedec_func(jpc_fix_t x, int bitpos)
|
||||||
{
|
{
|
||||||
jpc_fix_t y;
|
jpc_fix_t y;
|
||||||
assert(!(x & (~JAS_ONES(bitpos + 1))));
|
assert(!(x & (~JAS_ONES(bitpos + 1))));
|
||||||
y = jpc_getsignmsedec_macro(x, bitpos);
|
y = jpc_getsignmsedec_macro(x, bitpos);
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_getzcctxno(int f, int orient)
|
int jpc_getzcctxno(int f, int orient)
|
||||||
{
|
{
|
||||||
int h;
|
int h;
|
||||||
int v;
|
int v;
|
||||||
int d;
|
int d;
|
||||||
int n;
|
int n;
|
||||||
int t;
|
int t;
|
||||||
int hv;
|
int hv;
|
||||||
|
|
||||||
/* Avoid compiler warning. */
|
/* Avoid compiler warning. */
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
h = ((f & JPC_WSIG) != 0) + ((f & JPC_ESIG) != 0);
|
h = ((f & JPC_WSIG) != 0) + ((f & JPC_ESIG) != 0);
|
||||||
v = ((f & JPC_NSIG) != 0) + ((f & JPC_SSIG) != 0);
|
v = ((f & JPC_NSIG) != 0) + ((f & JPC_SSIG) != 0);
|
||||||
d = ((f & JPC_NWSIG) != 0) + ((f & JPC_NESIG) != 0) + ((f & JPC_SESIG) != 0) + ((f & JPC_SWSIG) != 0);
|
d = ((f & JPC_NWSIG) != 0) + ((f & JPC_NESIG) != 0) + ((f & JPC_SESIG) != 0) + ((f & JPC_SWSIG) != 0);
|
||||||
switch (orient) {
|
switch (orient) {
|
||||||
case JPC_TSFB_HL:
|
case JPC_TSFB_HL:
|
||||||
t = h;
|
t = h;
|
||||||
h = v;
|
h = v;
|
||||||
v = t;
|
v = t;
|
||||||
case JPC_TSFB_LL:
|
case JPC_TSFB_LL:
|
||||||
case JPC_TSFB_LH:
|
case JPC_TSFB_LH:
|
||||||
if (!h) {
|
if (!h) {
|
||||||
if (!v) {
|
if (!v) {
|
||||||
if (!d) {
|
if (!d) {
|
||||||
n = 0;
|
n = 0;
|
||||||
} else if (d == 1) {
|
} else if (d == 1) {
|
||||||
n = 1;
|
n = 1;
|
||||||
} else {
|
} else {
|
||||||
n = 2;
|
n = 2;
|
||||||
}
|
}
|
||||||
} else if (v == 1) {
|
} else if (v == 1) {
|
||||||
n = 3;
|
n = 3;
|
||||||
} else {
|
} else {
|
||||||
n = 4;
|
n = 4;
|
||||||
}
|
}
|
||||||
} else if (h == 1) {
|
} else if (h == 1) {
|
||||||
if (!v) {
|
if (!v) {
|
||||||
if (!d) {
|
if (!d) {
|
||||||
n = 5;
|
n = 5;
|
||||||
} else {
|
} else {
|
||||||
n = 6;
|
n = 6;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
n = 7;
|
n = 7;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
n = 8;
|
n = 8;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JPC_TSFB_HH:
|
case JPC_TSFB_HH:
|
||||||
hv = h + v;
|
hv = h + v;
|
||||||
if (!d) {
|
if (!d) {
|
||||||
if (!hv) {
|
if (!hv) {
|
||||||
n = 0;
|
n = 0;
|
||||||
} else if (hv == 1) {
|
} else if (hv == 1) {
|
||||||
n = 1;
|
n = 1;
|
||||||
} else {
|
} else {
|
||||||
n = 2;
|
n = 2;
|
||||||
}
|
}
|
||||||
} else if (d == 1) {
|
} else if (d == 1) {
|
||||||
if (!hv) {
|
if (!hv) {
|
||||||
n = 3;
|
n = 3;
|
||||||
} else if (hv == 1) {
|
} else if (hv == 1) {
|
||||||
n = 4;
|
n = 4;
|
||||||
} else {
|
} else {
|
||||||
n = 5;
|
n = 5;
|
||||||
}
|
}
|
||||||
} else if (d == 2) {
|
} else if (d == 2) {
|
||||||
if (!hv) {
|
if (!hv) {
|
||||||
n = 6;
|
n = 6;
|
||||||
} else {
|
} else {
|
||||||
n = 7;
|
n = 7;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
n = 8;
|
n = 8;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
assert(n < JPC_NUMZCCTXS);
|
assert(n < JPC_NUMZCCTXS);
|
||||||
return JPC_ZCCTXNO + n;
|
return JPC_ZCCTXNO + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_getspb(int f)
|
int jpc_getspb(int f)
|
||||||
{
|
{
|
||||||
int hc;
|
int hc;
|
||||||
int vc;
|
int vc;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
hc = JAS_MIN(((f & (JPC_ESIG | JPC_ESGN)) == JPC_ESIG) + ((f & (JPC_WSIG | JPC_WSGN)) == JPC_WSIG), 1) -
|
hc = JAS_MIN(((f & (JPC_ESIG | JPC_ESGN)) == JPC_ESIG) + ((f & (JPC_WSIG | JPC_WSGN)) == JPC_WSIG), 1) -
|
||||||
JAS_MIN(((f & (JPC_ESIG | JPC_ESGN)) == (JPC_ESIG | JPC_ESGN)) + ((f & (JPC_WSIG | JPC_WSGN)) == (JPC_WSIG | JPC_WSGN)), 1);
|
JAS_MIN(((f & (JPC_ESIG | JPC_ESGN)) == (JPC_ESIG | JPC_ESGN)) + ((f & (JPC_WSIG | JPC_WSGN)) == (JPC_WSIG | JPC_WSGN)), 1);
|
||||||
vc = JAS_MIN(((f & (JPC_NSIG | JPC_NSGN)) == JPC_NSIG) + ((f & (JPC_SSIG | JPC_SSGN)) == JPC_SSIG), 1) -
|
vc = JAS_MIN(((f & (JPC_NSIG | JPC_NSGN)) == JPC_NSIG) + ((f & (JPC_SSIG | JPC_SSGN)) == JPC_SSIG), 1) -
|
||||||
JAS_MIN(((f & (JPC_NSIG | JPC_NSGN)) == (JPC_NSIG | JPC_NSGN)) + ((f & (JPC_SSIG | JPC_SSGN)) == (JPC_SSIG | JPC_SSGN)), 1);
|
JAS_MIN(((f & (JPC_NSIG | JPC_NSGN)) == (JPC_NSIG | JPC_NSGN)) + ((f & (JPC_SSIG | JPC_SSGN)) == (JPC_SSIG | JPC_SSGN)), 1);
|
||||||
if (!hc && !vc) {
|
if (!hc && !vc) {
|
||||||
n = 0;
|
n = 0;
|
||||||
} else {
|
} else {
|
||||||
n = (!(hc > 0 || (!hc && vc > 0)));
|
n = (!(hc > 0 || (!hc && vc > 0)));
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_getscctxno(int f)
|
int jpc_getscctxno(int f)
|
||||||
{
|
{
|
||||||
int hc;
|
int hc;
|
||||||
int vc;
|
int vc;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* Avoid compiler warning. */
|
/* Avoid compiler warning. */
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
hc = JAS_MIN(((f & (JPC_ESIG | JPC_ESGN)) == JPC_ESIG) + ((f & (JPC_WSIG | JPC_WSGN)) == JPC_WSIG),
|
hc = JAS_MIN(((f & (JPC_ESIG | JPC_ESGN)) == JPC_ESIG) + ((f & (JPC_WSIG | JPC_WSGN)) == JPC_WSIG),
|
||||||
1) - JAS_MIN(((f & (JPC_ESIG | JPC_ESGN)) == (JPC_ESIG | JPC_ESGN)) +
|
1) - JAS_MIN(((f & (JPC_ESIG | JPC_ESGN)) == (JPC_ESIG | JPC_ESGN)) +
|
||||||
((f & (JPC_WSIG | JPC_WSGN)) == (JPC_WSIG | JPC_WSGN)), 1);
|
((f & (JPC_WSIG | JPC_WSGN)) == (JPC_WSIG | JPC_WSGN)), 1);
|
||||||
vc = JAS_MIN(((f & (JPC_NSIG | JPC_NSGN)) == JPC_NSIG) + ((f & (JPC_SSIG | JPC_SSGN)) == JPC_SSIG),
|
vc = JAS_MIN(((f & (JPC_NSIG | JPC_NSGN)) == JPC_NSIG) + ((f & (JPC_SSIG | JPC_SSGN)) == JPC_SSIG),
|
||||||
1) - JAS_MIN(((f & (JPC_NSIG | JPC_NSGN)) == (JPC_NSIG | JPC_NSGN)) +
|
1) - JAS_MIN(((f & (JPC_NSIG | JPC_NSGN)) == (JPC_NSIG | JPC_NSGN)) +
|
||||||
((f & (JPC_SSIG | JPC_SSGN)) == (JPC_SSIG | JPC_SSGN)), 1);
|
((f & (JPC_SSIG | JPC_SSGN)) == (JPC_SSIG | JPC_SSGN)), 1);
|
||||||
assert(hc >= -1 && hc <= 1 && vc >= -1 && vc <= 1);
|
assert(hc >= -1 && hc <= 1 && vc >= -1 && vc <= 1);
|
||||||
if (hc < 0) {
|
if (hc < 0) {
|
||||||
hc = -hc;
|
hc = -hc;
|
||||||
vc = -vc;
|
vc = -vc;
|
||||||
}
|
}
|
||||||
if (!hc) {
|
if (!hc) {
|
||||||
if (vc == -1) {
|
if (vc == -1) {
|
||||||
n = 1;
|
n = 1;
|
||||||
} else if (!vc) {
|
} else if (!vc) {
|
||||||
n = 0;
|
n = 0;
|
||||||
} else {
|
} else {
|
||||||
n = 1;
|
n = 1;
|
||||||
}
|
}
|
||||||
} else if (hc == 1) {
|
} else if (hc == 1) {
|
||||||
if (vc == -1) {
|
if (vc == -1) {
|
||||||
n = 2;
|
n = 2;
|
||||||
} else if (!vc) {
|
} else if (!vc) {
|
||||||
n = 3;
|
n = 3;
|
||||||
} else {
|
} else {
|
||||||
n = 4;
|
n = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(n < JPC_NUMSCCTXS);
|
assert(n < JPC_NUMSCCTXS);
|
||||||
return JPC_SCCTXNO + n;
|
return JPC_SCCTXNO + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_getmagctxno(int f)
|
int jpc_getmagctxno(int f)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (!(f & JPC_REFINE)) {
|
if (!(f & JPC_REFINE)) {
|
||||||
n = (f & (JPC_OTHSIGMSK)) ? 1 : 0;
|
n = (f & (JPC_OTHSIGMSK)) ? 1 : 0;
|
||||||
} else {
|
} else {
|
||||||
n = 2;
|
n = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(n < JPC_NUMMAGCTXS);
|
assert(n < JPC_NUMMAGCTXS);
|
||||||
return JPC_MAGCTXNO + n;
|
return JPC_MAGCTXNO + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jpc_initctxs(jpc_mqctx_t *ctxs)
|
void jpc_initctxs(jpc_mqctx_t *ctxs)
|
||||||
{
|
{
|
||||||
jpc_mqctx_t *ctx;
|
jpc_mqctx_t *ctx;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ctx = ctxs;
|
ctx = ctxs;
|
||||||
for (i = 0; i < JPC_NUMCTXS; ++i) {
|
for (i = 0; i < JPC_NUMCTXS; ++i) {
|
||||||
ctx->mps = 0;
|
ctx->mps = 0;
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case JPC_UCTXNO:
|
case JPC_UCTXNO:
|
||||||
ctx->ind = 46;
|
ctx->ind = 46;
|
||||||
break;
|
break;
|
||||||
case JPC_ZCCTXNO:
|
case JPC_ZCCTXNO:
|
||||||
ctx->ind = 4;
|
ctx->ind = 4;
|
||||||
break;
|
break;
|
||||||
case JPC_AGGCTXNO:
|
case JPC_AGGCTXNO:
|
||||||
ctx->ind = 3;
|
ctx->ind = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ctx->ind = 0;
|
ctx->ind = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++ctx;
|
++ctx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void jpc_initmqctxs()
|
void jpc_initmqctxs()
|
||||||
{
|
{
|
||||||
jpc_initctxs(jpc_mqctxs);
|
jpc_initctxs(jpc_mqctxs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the real quantity exp2(n), where x is an integer. */
|
/* Calculate the real quantity exp2(n), where x is an integer. */
|
||||||
double jpc_pow2i(int n)
|
double jpc_pow2i(int n)
|
||||||
{
|
{
|
||||||
double x;
|
double x;
|
||||||
double a;
|
double a;
|
||||||
|
|
||||||
x = 1.0;
|
x = 1.0;
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
a = 0.5;
|
a = 0.5;
|
||||||
n = -n;
|
n = -n;
|
||||||
} else {
|
} else {
|
||||||
a = 2.0;
|
a = 2.0;
|
||||||
}
|
}
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
x *= a;
|
x *= a;
|
||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
82
3rdparty/libjasper/jpc_t1cod.h
vendored
82
3rdparty/libjasper/jpc_t1cod.h
vendored
@ -127,7 +127,7 @@
|
|||||||
#define JPC_WSIG 0x0080
|
#define JPC_WSIG 0x0080
|
||||||
/* The significance mask for 8-connected neighbours. */
|
/* The significance mask for 8-connected neighbours. */
|
||||||
#define JPC_OTHSIGMSK \
|
#define JPC_OTHSIGMSK \
|
||||||
(JPC_NSIG | JPC_NESIG | JPC_ESIG | JPC_SESIG | JPC_SSIG | JPC_SWSIG | JPC_WSIG | JPC_NWSIG)
|
(JPC_NSIG | JPC_NESIG | JPC_ESIG | JPC_SESIG | JPC_SSIG | JPC_SWSIG | JPC_WSIG | JPC_NWSIG)
|
||||||
/* The significance mask for 4-connected neighbours. */
|
/* The significance mask for 4-connected neighbours. */
|
||||||
#define JPC_PRIMSIGMSK (JPC_NSIG | JPC_ESIG | JPC_SSIG | JPC_WSIG)
|
#define JPC_PRIMSIGMSK (JPC_NSIG | JPC_ESIG | JPC_SSIG | JPC_WSIG)
|
||||||
|
|
||||||
@ -201,75 +201,75 @@ void jpc_initctxs(jpc_mqctx_t *ctxs);
|
|||||||
/* Get the zero coding context. */
|
/* Get the zero coding context. */
|
||||||
int jpc_getzcctxno(int f, int orient);
|
int jpc_getzcctxno(int f, int orient);
|
||||||
#define JPC_GETZCCTXNO(f, orient) \
|
#define JPC_GETZCCTXNO(f, orient) \
|
||||||
(jpc_zcctxnolut[((orient) << 8) | ((f) & JPC_OTHSIGMSK)])
|
(jpc_zcctxnolut[((orient) << 8) | ((f) & JPC_OTHSIGMSK)])
|
||||||
|
|
||||||
/* Get the sign prediction bit. */
|
/* Get the sign prediction bit. */
|
||||||
int jpc_getspb(int f);
|
int jpc_getspb(int f);
|
||||||
#define JPC_GETSPB(f) \
|
#define JPC_GETSPB(f) \
|
||||||
(jpc_spblut[((f) & (JPC_PRIMSIGMSK | JPC_SGNMSK)) >> 4])
|
(jpc_spblut[((f) & (JPC_PRIMSIGMSK | JPC_SGNMSK)) >> 4])
|
||||||
|
|
||||||
/* Get the sign coding context. */
|
/* Get the sign coding context. */
|
||||||
int jpc_getscctxno(int f);
|
int jpc_getscctxno(int f);
|
||||||
#define JPC_GETSCCTXNO(f) \
|
#define JPC_GETSCCTXNO(f) \
|
||||||
(jpc_scctxnolut[((f) & (JPC_PRIMSIGMSK | JPC_SGNMSK)) >> 4])
|
(jpc_scctxnolut[((f) & (JPC_PRIMSIGMSK | JPC_SGNMSK)) >> 4])
|
||||||
|
|
||||||
/* Get the magnitude context. */
|
/* Get the magnitude context. */
|
||||||
int jpc_getmagctxno(int f);
|
int jpc_getmagctxno(int f);
|
||||||
#define JPC_GETMAGCTXNO(f) \
|
#define JPC_GETMAGCTXNO(f) \
|
||||||
(jpc_magctxnolut[((f) & JPC_OTHSIGMSK) | ((((f) & JPC_REFINE) != 0) << 11)])
|
(jpc_magctxnolut[((f) & JPC_OTHSIGMSK) | ((((f) & JPC_REFINE) != 0) << 11)])
|
||||||
|
|
||||||
/* Get the normalized MSE reduction for significance passes. */
|
/* Get the normalized MSE reduction for significance passes. */
|
||||||
#define JPC_GETSIGNMSEDEC(x, bitpos) jpc_getsignmsedec_macro(x, bitpos)
|
#define JPC_GETSIGNMSEDEC(x, bitpos) jpc_getsignmsedec_macro(x, bitpos)
|
||||||
jpc_fix_t jpc_getsignmsedec_func(jpc_fix_t x, int bitpos);
|
jpc_fix_t jpc_getsignmsedec_func(jpc_fix_t x, int bitpos);
|
||||||
#define jpc_getsignmsedec_macro(x, bitpos) \
|
#define jpc_getsignmsedec_macro(x, bitpos) \
|
||||||
((bitpos > JPC_NMSEDEC_FRACBITS) ? jpc_signmsedec[JPC_ASR(x, bitpos - JPC_NMSEDEC_FRACBITS) & JAS_ONES(JPC_NMSEDEC_BITS)] : \
|
((bitpos > JPC_NMSEDEC_FRACBITS) ? jpc_signmsedec[JPC_ASR(x, bitpos - JPC_NMSEDEC_FRACBITS) & JAS_ONES(JPC_NMSEDEC_BITS)] : \
|
||||||
(jpc_signmsedec0[JPC_ASR(x, bitpos - JPC_NMSEDEC_FRACBITS) & JAS_ONES(JPC_NMSEDEC_BITS)]))
|
(jpc_signmsedec0[JPC_ASR(x, bitpos - JPC_NMSEDEC_FRACBITS) & JAS_ONES(JPC_NMSEDEC_BITS)]))
|
||||||
|
|
||||||
/* Get the normalized MSE reduction for refinement passes. */
|
/* Get the normalized MSE reduction for refinement passes. */
|
||||||
#define JPC_GETREFNMSEDEC(x, bitpos) jpc_getrefnmsedec_macro(x, bitpos)
|
#define JPC_GETREFNMSEDEC(x, bitpos) jpc_getrefnmsedec_macro(x, bitpos)
|
||||||
jpc_fix_t jpc_refsignmsedec_func(jpc_fix_t x, int bitpos);
|
jpc_fix_t jpc_refsignmsedec_func(jpc_fix_t x, int bitpos);
|
||||||
#define jpc_getrefnmsedec_macro(x, bitpos) \
|
#define jpc_getrefnmsedec_macro(x, bitpos) \
|
||||||
((bitpos > JPC_NMSEDEC_FRACBITS) ? jpc_refnmsedec[JPC_ASR(x, bitpos - JPC_NMSEDEC_FRACBITS) & JAS_ONES(JPC_NMSEDEC_BITS)] : \
|
((bitpos > JPC_NMSEDEC_FRACBITS) ? jpc_refnmsedec[JPC_ASR(x, bitpos - JPC_NMSEDEC_FRACBITS) & JAS_ONES(JPC_NMSEDEC_BITS)] : \
|
||||||
(jpc_refnmsedec0[JPC_ASR(x, bitpos - JPC_NMSEDEC_FRACBITS) & JAS_ONES(JPC_NMSEDEC_BITS)]))
|
(jpc_refnmsedec0[JPC_ASR(x, bitpos - JPC_NMSEDEC_FRACBITS) & JAS_ONES(JPC_NMSEDEC_BITS)]))
|
||||||
|
|
||||||
/* Arithmetic shift right (with ability to shift left also). */
|
/* Arithmetic shift right (with ability to shift left also). */
|
||||||
#define JPC_ASR(x, n) \
|
#define JPC_ASR(x, n) \
|
||||||
(((n) >= 0) ? ((x) >> (n)) : ((x) << (-(n))))
|
(((n) >= 0) ? ((x) >> (n)) : ((x) << (-(n))))
|
||||||
|
|
||||||
/* Update the per-sample state information. */
|
/* Update the per-sample state information. */
|
||||||
#define JPC_UPDATEFLAGS4(fp, rowstep, s, vcausalflag) \
|
#define JPC_UPDATEFLAGS4(fp, rowstep, s, vcausalflag) \
|
||||||
{ \
|
{ \
|
||||||
register jpc_fix_t *np = (fp) - (rowstep); \
|
register jpc_fix_t *np = (fp) - (rowstep); \
|
||||||
register jpc_fix_t *sp = (fp) + (rowstep); \
|
register jpc_fix_t *sp = (fp) + (rowstep); \
|
||||||
if ((vcausalflag)) { \
|
if ((vcausalflag)) { \
|
||||||
sp[-1] |= JPC_NESIG; \
|
sp[-1] |= JPC_NESIG; \
|
||||||
sp[1] |= JPC_NWSIG; \
|
sp[1] |= JPC_NWSIG; \
|
||||||
if (s) { \
|
if (s) { \
|
||||||
*sp |= JPC_NSIG | JPC_NSGN; \
|
*sp |= JPC_NSIG | JPC_NSGN; \
|
||||||
(fp)[-1] |= JPC_ESIG | JPC_ESGN; \
|
(fp)[-1] |= JPC_ESIG | JPC_ESGN; \
|
||||||
(fp)[1] |= JPC_WSIG | JPC_WSGN; \
|
(fp)[1] |= JPC_WSIG | JPC_WSGN; \
|
||||||
} else { \
|
} else { \
|
||||||
*sp |= JPC_NSIG; \
|
*sp |= JPC_NSIG; \
|
||||||
(fp)[-1] |= JPC_ESIG; \
|
(fp)[-1] |= JPC_ESIG; \
|
||||||
(fp)[1] |= JPC_WSIG; \
|
(fp)[1] |= JPC_WSIG; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
np[-1] |= JPC_SESIG; \
|
np[-1] |= JPC_SESIG; \
|
||||||
np[1] |= JPC_SWSIG; \
|
np[1] |= JPC_SWSIG; \
|
||||||
sp[-1] |= JPC_NESIG; \
|
sp[-1] |= JPC_NESIG; \
|
||||||
sp[1] |= JPC_NWSIG; \
|
sp[1] |= JPC_NWSIG; \
|
||||||
if (s) { \
|
if (s) { \
|
||||||
*np |= JPC_SSIG | JPC_SSGN; \
|
*np |= JPC_SSIG | JPC_SSGN; \
|
||||||
*sp |= JPC_NSIG | JPC_NSGN; \
|
*sp |= JPC_NSIG | JPC_NSGN; \
|
||||||
(fp)[-1] |= JPC_ESIG | JPC_ESGN; \
|
(fp)[-1] |= JPC_ESIG | JPC_ESGN; \
|
||||||
(fp)[1] |= JPC_WSIG | JPC_WSGN; \
|
(fp)[1] |= JPC_WSIG | JPC_WSGN; \
|
||||||
} else { \
|
} else { \
|
||||||
*np |= JPC_SSIG; \
|
*np |= JPC_SSIG; \
|
||||||
*sp |= JPC_NSIG; \
|
*sp |= JPC_NSIG; \
|
||||||
(fp)[-1] |= JPC_ESIG; \
|
(fp)[-1] |= JPC_ESIG; \
|
||||||
(fp)[1] |= JPC_WSIG; \
|
(fp)[1] |= JPC_WSIG; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the lookup tables used by the codec. */
|
/* Initialize the lookup tables used by the codec. */
|
||||||
|
1314
3rdparty/libjasper/jpc_t1dec.c
vendored
1314
3rdparty/libjasper/jpc_t1dec.c
vendored
File diff suppressed because it is too large
Load Diff
1404
3rdparty/libjasper/jpc_t1enc.c
vendored
1404
3rdparty/libjasper/jpc_t1enc.c
vendored
File diff suppressed because it is too large
Load Diff
990
3rdparty/libjasper/jpc_t2cod.c
vendored
990
3rdparty/libjasper/jpc_t2cod.c
vendored
File diff suppressed because it is too large
Load Diff
160
3rdparty/libjasper/jpc_t2cod.h
vendored
160
3rdparty/libjasper/jpc_t2cod.h
vendored
@ -84,15 +84,15 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of progression changes. */
|
/* The number of progression changes. */
|
||||||
int numpchgs;
|
int numpchgs;
|
||||||
|
|
||||||
/* The maximum number of progression changes that can be accomodated
|
/* The maximum number of progression changes that can be accomodated
|
||||||
without growing the progression change array. */
|
without growing the progression change array. */
|
||||||
int maxpchgs;
|
int maxpchgs;
|
||||||
|
|
||||||
/* The progression changes. */
|
/* The progression changes. */
|
||||||
jpc_pchg_t **pchgs;
|
jpc_pchg_t **pchgs;
|
||||||
|
|
||||||
} jpc_pchglist_t;
|
} jpc_pchglist_t;
|
||||||
|
|
||||||
@ -100,21 +100,21 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of precincts. */
|
/* The number of precincts. */
|
||||||
int numprcs;
|
int numprcs;
|
||||||
|
|
||||||
/* The last layer processed for each precinct. */
|
/* The last layer processed for each precinct. */
|
||||||
int *prclyrnos;
|
int *prclyrnos;
|
||||||
|
|
||||||
/* The precinct width exponent. */
|
/* The precinct width exponent. */
|
||||||
int prcwidthexpn;
|
int prcwidthexpn;
|
||||||
|
|
||||||
/* The precinct height exponent. */
|
/* The precinct height exponent. */
|
||||||
int prcheightexpn;
|
int prcheightexpn;
|
||||||
|
|
||||||
/* The number of precincts spanning the resolution level in the horizontal
|
/* The number of precincts spanning the resolution level in the horizontal
|
||||||
direction. */
|
direction. */
|
||||||
int numhprcs;
|
int numhprcs;
|
||||||
|
|
||||||
} jpc_pirlvl_t;
|
} jpc_pirlvl_t;
|
||||||
|
|
||||||
@ -122,17 +122,17 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of resolution levels. */
|
/* The number of resolution levels. */
|
||||||
int numrlvls;
|
int numrlvls;
|
||||||
|
|
||||||
/* The per-resolution-level information. */
|
/* The per-resolution-level information. */
|
||||||
jpc_pirlvl_t *pirlvls;
|
jpc_pirlvl_t *pirlvls;
|
||||||
|
|
||||||
/* The horizontal sampling period. */
|
/* The horizontal sampling period. */
|
||||||
int hsamp;
|
int hsamp;
|
||||||
|
|
||||||
/* The vertical sampling period. */
|
/* The vertical sampling period. */
|
||||||
int vsamp;
|
int vsamp;
|
||||||
|
|
||||||
} jpc_picomp_t;
|
} jpc_picomp_t;
|
||||||
|
|
||||||
@ -140,84 +140,84 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of layers. */
|
/* The number of layers. */
|
||||||
int numlyrs;
|
int numlyrs;
|
||||||
|
|
||||||
/* The number of resolution levels. */
|
/* The number of resolution levels. */
|
||||||
int maxrlvls;
|
int maxrlvls;
|
||||||
|
|
||||||
/* The number of components. */
|
/* The number of components. */
|
||||||
int numcomps;
|
int numcomps;
|
||||||
|
|
||||||
/* The per-component information. */
|
/* The per-component information. */
|
||||||
jpc_picomp_t *picomps;
|
jpc_picomp_t *picomps;
|
||||||
|
|
||||||
/* The current component. */
|
/* The current component. */
|
||||||
jpc_picomp_t *picomp;
|
jpc_picomp_t *picomp;
|
||||||
|
|
||||||
/* The current resolution level. */
|
/* The current resolution level. */
|
||||||
jpc_pirlvl_t *pirlvl;
|
jpc_pirlvl_t *pirlvl;
|
||||||
|
|
||||||
/* The number of the current component. */
|
/* The number of the current component. */
|
||||||
int compno;
|
int compno;
|
||||||
|
|
||||||
/* The number of the current resolution level. */
|
/* The number of the current resolution level. */
|
||||||
int rlvlno;
|
int rlvlno;
|
||||||
|
|
||||||
/* The number of the current precinct. */
|
/* The number of the current precinct. */
|
||||||
int prcno;
|
int prcno;
|
||||||
|
|
||||||
/* The number of the current layer. */
|
/* The number of the current layer. */
|
||||||
int lyrno;
|
int lyrno;
|
||||||
|
|
||||||
/* The x-coordinate of the current position. */
|
/* The x-coordinate of the current position. */
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
/* The y-coordinate of the current position. */
|
/* The y-coordinate of the current position. */
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
/* The horizontal step size. */
|
/* The horizontal step size. */
|
||||||
int xstep;
|
int xstep;
|
||||||
|
|
||||||
/* The vertical step size. */
|
/* The vertical step size. */
|
||||||
int ystep;
|
int ystep;
|
||||||
|
|
||||||
/* The x-coordinate of the top-left corner of the tile on the reference
|
/* The x-coordinate of the top-left corner of the tile on the reference
|
||||||
grid. */
|
grid. */
|
||||||
int xstart;
|
int xstart;
|
||||||
|
|
||||||
/* The y-coordinate of the top-left corner of the tile on the reference
|
/* The y-coordinate of the top-left corner of the tile on the reference
|
||||||
grid. */
|
grid. */
|
||||||
int ystart;
|
int ystart;
|
||||||
|
|
||||||
/* The x-coordinate of the bottom-right corner of the tile on the
|
/* The x-coordinate of the bottom-right corner of the tile on the
|
||||||
reference grid (plus one). */
|
reference grid (plus one). */
|
||||||
int xend;
|
int xend;
|
||||||
|
|
||||||
/* The y-coordinate of the bottom-right corner of the tile on the
|
/* The y-coordinate of the bottom-right corner of the tile on the
|
||||||
reference grid (plus one). */
|
reference grid (plus one). */
|
||||||
int yend;
|
int yend;
|
||||||
|
|
||||||
/* The current progression change. */
|
/* The current progression change. */
|
||||||
jpc_pchg_t *pchg;
|
jpc_pchg_t *pchg;
|
||||||
|
|
||||||
/* The progression change list. */
|
/* The progression change list. */
|
||||||
jpc_pchglist_t *pchglist;
|
jpc_pchglist_t *pchglist;
|
||||||
|
|
||||||
/* The progression to use in the absense of explicit specification. */
|
/* The progression to use in the absense of explicit specification. */
|
||||||
jpc_pchg_t defaultpchg;
|
jpc_pchg_t defaultpchg;
|
||||||
|
|
||||||
/* The current progression change number. */
|
/* The current progression change number. */
|
||||||
int pchgno;
|
int pchgno;
|
||||||
|
|
||||||
/* Is this the first time in the current progression volume? */
|
/* Is this the first time in the current progression volume? */
|
||||||
bool prgvolfirst;
|
bool prgvolfirst;
|
||||||
|
|
||||||
/* Is the current iterator value valid? */
|
/* Is the current iterator value valid? */
|
||||||
bool valid;
|
bool valid;
|
||||||
|
|
||||||
/* The current packet number. */
|
/* The current packet number. */
|
||||||
int pktno;
|
int pktno;
|
||||||
|
|
||||||
} jpc_pi_t;
|
} jpc_pi_t;
|
||||||
|
|
||||||
|
814
3rdparty/libjasper/jpc_t2dec.c
vendored
814
3rdparty/libjasper/jpc_t2dec.c
vendored
@ -106,309 +106,309 @@ static int jpc_dec_decodepkt(jpc_dec_t *dec, jas_stream_t *pkthdrstream, jas_str
|
|||||||
|
|
||||||
static int jpc_getcommacode(jpc_bitstream_t *in)
|
static int jpc_getcommacode(jpc_bitstream_t *in)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ((v = jpc_bitstream_getbit(in)) < 0) {
|
if ((v = jpc_bitstream_getbit(in)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (jpc_bitstream_eof(in)) {
|
if (jpc_bitstream_eof(in)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!v) {
|
if (!v) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jpc_getnumnewpasses(jpc_bitstream_t *in)
|
static int jpc_getnumnewpasses(jpc_bitstream_t *in)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if ((n = jpc_bitstream_getbit(in)) > 0) {
|
if ((n = jpc_bitstream_getbit(in)) > 0) {
|
||||||
if ((n = jpc_bitstream_getbit(in)) > 0) {
|
if ((n = jpc_bitstream_getbit(in)) > 0) {
|
||||||
if ((n = jpc_bitstream_getbits(in, 2)) == 3) {
|
if ((n = jpc_bitstream_getbits(in, 2)) == 3) {
|
||||||
if ((n = jpc_bitstream_getbits(in, 5)) == 31) {
|
if ((n = jpc_bitstream_getbits(in, 5)) == 31) {
|
||||||
if ((n = jpc_bitstream_getbits(in, 7)) >= 0) {
|
if ((n = jpc_bitstream_getbits(in, 7)) >= 0) {
|
||||||
n += 36 + 1;
|
n += 36 + 1;
|
||||||
}
|
}
|
||||||
} else if (n >= 0) {
|
} else if (n >= 0) {
|
||||||
n += 5 + 1;
|
n += 5 + 1;
|
||||||
}
|
}
|
||||||
} else if (n >= 0) {
|
} else if (n >= 0) {
|
||||||
n += 2 + 1;
|
n += 2 + 1;
|
||||||
}
|
}
|
||||||
} else if (!n) {
|
} else if (!n) {
|
||||||
n += 2;
|
n += 2;
|
||||||
}
|
}
|
||||||
} else if (!n) {
|
} else if (!n) {
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jpc_dec_decodepkt(jpc_dec_t *dec, jas_stream_t *pkthdrstream, jas_stream_t *in, int compno, int rlvlno,
|
static int jpc_dec_decodepkt(jpc_dec_t *dec, jas_stream_t *pkthdrstream, jas_stream_t *in, int compno, int rlvlno,
|
||||||
int prcno, int lyrno)
|
int prcno, int lyrno)
|
||||||
{
|
{
|
||||||
jpc_bitstream_t *inb;
|
jpc_bitstream_t *inb;
|
||||||
jpc_dec_tcomp_t *tcomp;
|
jpc_dec_tcomp_t *tcomp;
|
||||||
jpc_dec_rlvl_t *rlvl;
|
jpc_dec_rlvl_t *rlvl;
|
||||||
jpc_dec_band_t *band;
|
jpc_dec_band_t *band;
|
||||||
jpc_dec_cblk_t *cblk;
|
jpc_dec_cblk_t *cblk;
|
||||||
int n;
|
int n;
|
||||||
int m;
|
int m;
|
||||||
int i;
|
int i;
|
||||||
jpc_tagtreenode_t *leaf;
|
jpc_tagtreenode_t *leaf;
|
||||||
int included;
|
int included;
|
||||||
int ret;
|
int ret;
|
||||||
int numnewpasses;
|
int numnewpasses;
|
||||||
jpc_dec_seg_t *seg;
|
jpc_dec_seg_t *seg;
|
||||||
int len;
|
int len;
|
||||||
int present;
|
int present;
|
||||||
int savenumnewpasses;
|
int savenumnewpasses;
|
||||||
int mycounter;
|
int mycounter;
|
||||||
jpc_ms_t *ms;
|
jpc_ms_t *ms;
|
||||||
jpc_dec_tile_t *tile;
|
jpc_dec_tile_t *tile;
|
||||||
jpc_dec_ccp_t *ccp;
|
jpc_dec_ccp_t *ccp;
|
||||||
jpc_dec_cp_t *cp;
|
jpc_dec_cp_t *cp;
|
||||||
int bandno;
|
int bandno;
|
||||||
jpc_dec_prc_t *prc;
|
jpc_dec_prc_t *prc;
|
||||||
int usedcblkcnt;
|
int usedcblkcnt;
|
||||||
int cblkno;
|
int cblkno;
|
||||||
uint_fast32_t bodylen;
|
uint_fast32_t bodylen;
|
||||||
bool discard;
|
bool discard;
|
||||||
int passno;
|
int passno;
|
||||||
int maxpasses;
|
int maxpasses;
|
||||||
int hdrlen;
|
int hdrlen;
|
||||||
int hdroffstart;
|
int hdroffstart;
|
||||||
int hdroffend;
|
int hdroffend;
|
||||||
|
|
||||||
/* Avoid compiler warning about possible use of uninitialized
|
/* Avoid compiler warning about possible use of uninitialized
|
||||||
variable. */
|
variable. */
|
||||||
bodylen = 0;
|
bodylen = 0;
|
||||||
|
|
||||||
discard = (lyrno >= dec->maxlyrs);
|
discard = (lyrno >= dec->maxlyrs);
|
||||||
|
|
||||||
tile = dec->curtile;
|
tile = dec->curtile;
|
||||||
cp = tile->cp;
|
cp = tile->cp;
|
||||||
ccp = &cp->ccps[compno];
|
ccp = &cp->ccps[compno];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decode the packet header.
|
* Decode the packet header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Decode the SOP marker segment if present. */
|
/* Decode the SOP marker segment if present. */
|
||||||
if (cp->csty & JPC_COD_SOP) {
|
if (cp->csty & JPC_COD_SOP) {
|
||||||
if (jpc_dec_lookahead(in) == JPC_MS_SOP) {
|
if (jpc_dec_lookahead(in) == JPC_MS_SOP) {
|
||||||
if (!(ms = jpc_getms(in, dec->cstate))) {
|
if (!(ms = jpc_getms(in, dec->cstate))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (jpc_ms_gettype(ms) != JPC_MS_SOP) {
|
if (jpc_ms_gettype(ms) != JPC_MS_SOP) {
|
||||||
jpc_ms_destroy(ms);
|
jpc_ms_destroy(ms);
|
||||||
jas_eprintf("missing SOP marker segment\n");
|
jas_eprintf("missing SOP marker segment\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
jpc_ms_destroy(ms);
|
jpc_ms_destroy(ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hdroffstart = jas_stream_getrwcount(pkthdrstream);
|
hdroffstart = jas_stream_getrwcount(pkthdrstream);
|
||||||
|
|
||||||
if (!(inb = jpc_bitstream_sopen(pkthdrstream, "r"))) {
|
if (!(inb = jpc_bitstream_sopen(pkthdrstream, "r"))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((present = jpc_bitstream_getbit(inb)) < 0) {
|
if ((present = jpc_bitstream_getbit(inb)) < 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
JAS_DBGLOG(10, ("\n", present));
|
JAS_DBGLOG(10, ("\n", present));
|
||||||
JAS_DBGLOG(10, ("present=%d ", present));
|
JAS_DBGLOG(10, ("present=%d ", present));
|
||||||
|
|
||||||
/* Is the packet non-empty? */
|
/* Is the packet non-empty? */
|
||||||
if (present) {
|
if (present) {
|
||||||
/* The packet is non-empty. */
|
/* The packet is non-empty. */
|
||||||
tcomp = &tile->tcomps[compno];
|
tcomp = &tile->tcomps[compno];
|
||||||
rlvl = &tcomp->rlvls[rlvlno];
|
rlvl = &tcomp->rlvls[rlvlno];
|
||||||
bodylen = 0;
|
bodylen = 0;
|
||||||
for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands;
|
for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands;
|
||||||
++bandno, ++band) {
|
++bandno, ++band) {
|
||||||
if (!band->data) {
|
if (!band->data) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
prc = &band->prcs[prcno];
|
prc = &band->prcs[prcno];
|
||||||
if (!prc->cblks) {
|
if (!prc->cblks) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
usedcblkcnt = 0;
|
usedcblkcnt = 0;
|
||||||
for (cblkno = 0, cblk = prc->cblks; cblkno < prc->numcblks;
|
for (cblkno = 0, cblk = prc->cblks; cblkno < prc->numcblks;
|
||||||
++cblkno, ++cblk) {
|
++cblkno, ++cblk) {
|
||||||
++usedcblkcnt;
|
++usedcblkcnt;
|
||||||
if (!cblk->numpasses) {
|
if (!cblk->numpasses) {
|
||||||
leaf = jpc_tagtree_getleaf(prc->incltagtree, usedcblkcnt - 1);
|
leaf = jpc_tagtree_getleaf(prc->incltagtree, usedcblkcnt - 1);
|
||||||
if ((included = jpc_tagtree_decode(prc->incltagtree, leaf, lyrno + 1, inb)) < 0) {
|
if ((included = jpc_tagtree_decode(prc->incltagtree, leaf, lyrno + 1, inb)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((included = jpc_bitstream_getbit(inb)) < 0) {
|
if ((included = jpc_bitstream_getbit(inb)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JAS_DBGLOG(10, ("\n"));
|
JAS_DBGLOG(10, ("\n"));
|
||||||
JAS_DBGLOG(10, ("included=%d ", included));
|
JAS_DBGLOG(10, ("included=%d ", included));
|
||||||
if (!included) {
|
if (!included) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!cblk->numpasses) {
|
if (!cblk->numpasses) {
|
||||||
i = 1;
|
i = 1;
|
||||||
leaf = jpc_tagtree_getleaf(prc->numimsbstagtree, usedcblkcnt - 1);
|
leaf = jpc_tagtree_getleaf(prc->numimsbstagtree, usedcblkcnt - 1);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ((ret = jpc_tagtree_decode(prc->numimsbstagtree, leaf, i, inb)) < 0) {
|
if ((ret = jpc_tagtree_decode(prc->numimsbstagtree, leaf, i, inb)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
cblk->numimsbs = i - 1;
|
cblk->numimsbs = i - 1;
|
||||||
cblk->firstpassno = cblk->numimsbs * 3;
|
cblk->firstpassno = cblk->numimsbs * 3;
|
||||||
}
|
}
|
||||||
if ((numnewpasses = jpc_getnumnewpasses(inb)) < 0) {
|
if ((numnewpasses = jpc_getnumnewpasses(inb)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
JAS_DBGLOG(10, ("numnewpasses=%d ", numnewpasses));
|
JAS_DBGLOG(10, ("numnewpasses=%d ", numnewpasses));
|
||||||
seg = cblk->curseg;
|
seg = cblk->curseg;
|
||||||
savenumnewpasses = numnewpasses;
|
savenumnewpasses = numnewpasses;
|
||||||
mycounter = 0;
|
mycounter = 0;
|
||||||
if (numnewpasses > 0) {
|
if (numnewpasses > 0) {
|
||||||
if ((m = jpc_getcommacode(inb)) < 0) {
|
if ((m = jpc_getcommacode(inb)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
cblk->numlenbits += m;
|
cblk->numlenbits += m;
|
||||||
JAS_DBGLOG(10, ("increment=%d ", m));
|
JAS_DBGLOG(10, ("increment=%d ", m));
|
||||||
while (numnewpasses > 0) {
|
while (numnewpasses > 0) {
|
||||||
passno = cblk->firstpassno + cblk->numpasses + mycounter;
|
passno = cblk->firstpassno + cblk->numpasses + mycounter;
|
||||||
/* XXX - the maxpasses is not set precisely but this doesn't matter... */
|
/* XXX - the maxpasses is not set precisely but this doesn't matter... */
|
||||||
maxpasses = JPC_SEGPASSCNT(passno, cblk->firstpassno, 10000, (ccp->cblkctx & JPC_COX_LAZY) != 0, (ccp->cblkctx & JPC_COX_TERMALL) != 0);
|
maxpasses = JPC_SEGPASSCNT(passno, cblk->firstpassno, 10000, (ccp->cblkctx & JPC_COX_LAZY) != 0, (ccp->cblkctx & JPC_COX_TERMALL) != 0);
|
||||||
if (!discard && !seg) {
|
if (!discard && !seg) {
|
||||||
if (!(seg = jpc_seg_alloc())) {
|
if (!(seg = jpc_seg_alloc())) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
jpc_seglist_insert(&cblk->segs, cblk->segs.tail, seg);
|
jpc_seglist_insert(&cblk->segs, cblk->segs.tail, seg);
|
||||||
if (!cblk->curseg) {
|
if (!cblk->curseg) {
|
||||||
cblk->curseg = seg;
|
cblk->curseg = seg;
|
||||||
}
|
}
|
||||||
seg->passno = passno;
|
seg->passno = passno;
|
||||||
seg->type = JPC_SEGTYPE(seg->passno, cblk->firstpassno, (ccp->cblkctx & JPC_COX_LAZY) != 0);
|
seg->type = JPC_SEGTYPE(seg->passno, cblk->firstpassno, (ccp->cblkctx & JPC_COX_LAZY) != 0);
|
||||||
seg->maxpasses = maxpasses;
|
seg->maxpasses = maxpasses;
|
||||||
}
|
}
|
||||||
n = JAS_MIN(numnewpasses, maxpasses);
|
n = JAS_MIN(numnewpasses, maxpasses);
|
||||||
mycounter += n;
|
mycounter += n;
|
||||||
numnewpasses -= n;
|
numnewpasses -= n;
|
||||||
if ((len = jpc_bitstream_getbits(inb, cblk->numlenbits + jpc_floorlog2(n))) < 0) {
|
if ((len = jpc_bitstream_getbits(inb, cblk->numlenbits + jpc_floorlog2(n))) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
JAS_DBGLOG(10, ("len=%d ", len));
|
JAS_DBGLOG(10, ("len=%d ", len));
|
||||||
if (!discard) {
|
if (!discard) {
|
||||||
seg->lyrno = lyrno;
|
seg->lyrno = lyrno;
|
||||||
seg->numpasses += n;
|
seg->numpasses += n;
|
||||||
seg->cnt = len;
|
seg->cnt = len;
|
||||||
seg = seg->next;
|
seg = seg->next;
|
||||||
}
|
}
|
||||||
bodylen += len;
|
bodylen += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cblk->numpasses += savenumnewpasses;
|
cblk->numpasses += savenumnewpasses;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jpc_bitstream_inalign(inb, 0, 0);
|
jpc_bitstream_inalign(inb, 0, 0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (jpc_bitstream_inalign(inb, 0x7f, 0)) {
|
if (jpc_bitstream_inalign(inb, 0x7f, 0)) {
|
||||||
jas_eprintf("alignment failed\n");
|
jas_eprintf("alignment failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jpc_bitstream_close(inb);
|
jpc_bitstream_close(inb);
|
||||||
|
|
||||||
hdroffend = jas_stream_getrwcount(pkthdrstream);
|
hdroffend = jas_stream_getrwcount(pkthdrstream);
|
||||||
hdrlen = hdroffend - hdroffstart;
|
hdrlen = hdroffend - hdroffstart;
|
||||||
if (jas_getdbglevel() >= 5) {
|
if (jas_getdbglevel() >= 5) {
|
||||||
jas_eprintf("hdrlen=%lu bodylen=%lu \n", (unsigned long) hdrlen,
|
jas_eprintf("hdrlen=%lu bodylen=%lu \n", (unsigned long) hdrlen,
|
||||||
(unsigned long) bodylen);
|
(unsigned long) bodylen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cp->csty & JPC_COD_EPH) {
|
if (cp->csty & JPC_COD_EPH) {
|
||||||
if (jpc_dec_lookahead(pkthdrstream) == JPC_MS_EPH) {
|
if (jpc_dec_lookahead(pkthdrstream) == JPC_MS_EPH) {
|
||||||
if (!(ms = jpc_getms(pkthdrstream, dec->cstate))) {
|
if (!(ms = jpc_getms(pkthdrstream, dec->cstate))) {
|
||||||
jas_eprintf("cannot get (EPH) marker segment\n");
|
jas_eprintf("cannot get (EPH) marker segment\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (jpc_ms_gettype(ms) != JPC_MS_EPH) {
|
if (jpc_ms_gettype(ms) != JPC_MS_EPH) {
|
||||||
jpc_ms_destroy(ms);
|
jpc_ms_destroy(ms);
|
||||||
jas_eprintf("missing EPH marker segment\n");
|
jas_eprintf("missing EPH marker segment\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
jpc_ms_destroy(ms);
|
jpc_ms_destroy(ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decode the packet body. */
|
/* decode the packet body. */
|
||||||
|
|
||||||
if (jas_getdbglevel() >= 1) {
|
if (jas_getdbglevel() >= 1) {
|
||||||
jas_eprintf("packet body offset=%06ld\n", (long) jas_stream_getrwcount(in));
|
jas_eprintf("packet body offset=%06ld\n", (long) jas_stream_getrwcount(in));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!discard) {
|
if (!discard) {
|
||||||
tcomp = &tile->tcomps[compno];
|
tcomp = &tile->tcomps[compno];
|
||||||
rlvl = &tcomp->rlvls[rlvlno];
|
rlvl = &tcomp->rlvls[rlvlno];
|
||||||
for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands;
|
for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands;
|
||||||
++bandno, ++band) {
|
++bandno, ++band) {
|
||||||
if (!band->data) {
|
if (!band->data) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
prc = &band->prcs[prcno];
|
prc = &band->prcs[prcno];
|
||||||
if (!prc->cblks) {
|
if (!prc->cblks) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (cblkno = 0, cblk = prc->cblks; cblkno < prc->numcblks;
|
for (cblkno = 0, cblk = prc->cblks; cblkno < prc->numcblks;
|
||||||
++cblkno, ++cblk) {
|
++cblkno, ++cblk) {
|
||||||
seg = cblk->curseg;
|
seg = cblk->curseg;
|
||||||
while (seg) {
|
while (seg) {
|
||||||
if (!seg->stream) {
|
if (!seg->stream) {
|
||||||
if (!(seg->stream = jas_stream_memopen(0, 0))) {
|
if (!(seg->stream = jas_stream_memopen(0, 0))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
jas_eprintf("lyrno=%02d, compno=%02d, lvlno=%02d, prcno=%02d, bandno=%02d, cblkno=%02d, passno=%02d numpasses=%02d cnt=%d numbps=%d, numimsbs=%d\n", lyrno, compno, rlvlno, prcno, band - rlvl->bands, cblk - prc->cblks, seg->passno, seg->numpasses, seg->cnt, band->numbps, cblk->numimsbs);
|
jas_eprintf("lyrno=%02d, compno=%02d, lvlno=%02d, prcno=%02d, bandno=%02d, cblkno=%02d, passno=%02d numpasses=%02d cnt=%d numbps=%d, numimsbs=%d\n", lyrno, compno, rlvlno, prcno, band - rlvl->bands, cblk - prc->cblks, seg->passno, seg->numpasses, seg->cnt, band->numbps, cblk->numimsbs);
|
||||||
#endif
|
#endif
|
||||||
if (seg->cnt > 0) {
|
if (seg->cnt > 0) {
|
||||||
if (jpc_getdata(in, seg->stream, seg->cnt) < 0) {
|
if (jpc_getdata(in, seg->stream, seg->cnt) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
seg->cnt = 0;
|
seg->cnt = 0;
|
||||||
}
|
}
|
||||||
if (seg->numpasses >= seg->maxpasses) {
|
if (seg->numpasses >= seg->maxpasses) {
|
||||||
cblk->curseg = seg->next;
|
cblk->curseg = seg->next;
|
||||||
}
|
}
|
||||||
seg = seg->next;
|
seg = seg->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (jas_stream_gobble(in, bodylen) != JAS_CAST(int, bodylen)) {
|
if (jas_stream_gobble(in, bodylen) != JAS_CAST(int, bodylen)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
@ -416,166 +416,166 @@ jas_eprintf("lyrno=%02d, compno=%02d, lvlno=%02d, prcno=%02d, bandno=%02d, cblkn
|
|||||||
|
|
||||||
int jpc_dec_decodepkts(jpc_dec_t *dec, jas_stream_t *pkthdrstream, jas_stream_t *in)
|
int jpc_dec_decodepkts(jpc_dec_t *dec, jas_stream_t *pkthdrstream, jas_stream_t *in)
|
||||||
{
|
{
|
||||||
jpc_dec_tile_t *tile;
|
jpc_dec_tile_t *tile;
|
||||||
jpc_pi_t *pi;
|
jpc_pi_t *pi;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
tile = dec->curtile;
|
tile = dec->curtile;
|
||||||
pi = tile->pi;
|
pi = tile->pi;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!tile->pkthdrstream || jas_stream_peekc(tile->pkthdrstream) == EOF) {
|
if (!tile->pkthdrstream || jas_stream_peekc(tile->pkthdrstream) == EOF) {
|
||||||
switch (jpc_dec_lookahead(in)) {
|
switch (jpc_dec_lookahead(in)) {
|
||||||
case JPC_MS_EOC:
|
case JPC_MS_EOC:
|
||||||
case JPC_MS_SOT:
|
case JPC_MS_SOT:
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case JPC_MS_SOP:
|
case JPC_MS_SOP:
|
||||||
case JPC_MS_EPH:
|
case JPC_MS_EPH:
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((ret = jpc_pi_next(pi))) {
|
if ((ret = jpc_pi_next(pi))) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (dec->maxpkts >= 0 && dec->numpkts >= dec->maxpkts) {
|
if (dec->maxpkts >= 0 && dec->numpkts >= dec->maxpkts) {
|
||||||
jas_eprintf("warning: stopping decode prematurely as requested\n");
|
jas_eprintf("warning: stopping decode prematurely as requested\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (jas_getdbglevel() >= 1) {
|
if (jas_getdbglevel() >= 1) {
|
||||||
jas_eprintf("packet offset=%08ld prg=%d cmptno=%02d "
|
jas_eprintf("packet offset=%08ld prg=%d cmptno=%02d "
|
||||||
"rlvlno=%02d prcno=%03d lyrno=%02d\n", (long)
|
"rlvlno=%02d prcno=%03d lyrno=%02d\n", (long)
|
||||||
jas_stream_getrwcount(in), jpc_pi_prg(pi), jpc_pi_cmptno(pi),
|
jas_stream_getrwcount(in), jpc_pi_prg(pi), jpc_pi_cmptno(pi),
|
||||||
jpc_pi_rlvlno(pi), jpc_pi_prcno(pi), jpc_pi_lyrno(pi));
|
jpc_pi_rlvlno(pi), jpc_pi_prcno(pi), jpc_pi_lyrno(pi));
|
||||||
}
|
}
|
||||||
if (jpc_dec_decodepkt(dec, pkthdrstream, in, jpc_pi_cmptno(pi), jpc_pi_rlvlno(pi),
|
if (jpc_dec_decodepkt(dec, pkthdrstream, in, jpc_pi_cmptno(pi), jpc_pi_rlvlno(pi),
|
||||||
jpc_pi_prcno(pi), jpc_pi_lyrno(pi))) {
|
jpc_pi_prcno(pi), jpc_pi_lyrno(pi))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
++dec->numpkts;
|
++dec->numpkts;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
jpc_pi_t *jpc_dec_pi_create(jpc_dec_t *dec, jpc_dec_tile_t *tile)
|
jpc_pi_t *jpc_dec_pi_create(jpc_dec_t *dec, jpc_dec_tile_t *tile)
|
||||||
{
|
{
|
||||||
jpc_pi_t *pi;
|
jpc_pi_t *pi;
|
||||||
int compno;
|
int compno;
|
||||||
jpc_picomp_t *picomp;
|
jpc_picomp_t *picomp;
|
||||||
jpc_pirlvl_t *pirlvl;
|
jpc_pirlvl_t *pirlvl;
|
||||||
jpc_dec_tcomp_t *tcomp;
|
jpc_dec_tcomp_t *tcomp;
|
||||||
int rlvlno;
|
int rlvlno;
|
||||||
jpc_dec_rlvl_t *rlvl;
|
jpc_dec_rlvl_t *rlvl;
|
||||||
int prcno;
|
int prcno;
|
||||||
int *prclyrno;
|
int *prclyrno;
|
||||||
jpc_dec_cmpt_t *cmpt;
|
jpc_dec_cmpt_t *cmpt;
|
||||||
|
|
||||||
if (!(pi = jpc_pi_create0())) {
|
if (!(pi = jpc_pi_create0())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pi->numcomps = dec->numcomps;
|
pi->numcomps = dec->numcomps;
|
||||||
if (!(pi->picomps = jas_alloc2(pi->numcomps, sizeof(jpc_picomp_t)))) {
|
if (!(pi->picomps = jas_alloc2(pi->numcomps, sizeof(jpc_picomp_t)))) {
|
||||||
jpc_pi_destroy(pi);
|
jpc_pi_destroy(pi);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (compno = 0, picomp = pi->picomps; compno < pi->numcomps; ++compno,
|
for (compno = 0, picomp = pi->picomps; compno < pi->numcomps; ++compno,
|
||||||
++picomp) {
|
++picomp) {
|
||||||
picomp->pirlvls = 0;
|
picomp->pirlvls = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (compno = 0, tcomp = tile->tcomps, picomp = pi->picomps;
|
for (compno = 0, tcomp = tile->tcomps, picomp = pi->picomps;
|
||||||
compno < pi->numcomps; ++compno, ++tcomp, ++picomp) {
|
compno < pi->numcomps; ++compno, ++tcomp, ++picomp) {
|
||||||
picomp->numrlvls = tcomp->numrlvls;
|
picomp->numrlvls = tcomp->numrlvls;
|
||||||
if (!(picomp->pirlvls = jas_alloc2(picomp->numrlvls,
|
if (!(picomp->pirlvls = jas_alloc2(picomp->numrlvls,
|
||||||
sizeof(jpc_pirlvl_t)))) {
|
sizeof(jpc_pirlvl_t)))) {
|
||||||
jpc_pi_destroy(pi);
|
jpc_pi_destroy(pi);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno <
|
for (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno <
|
||||||
picomp->numrlvls; ++rlvlno, ++pirlvl) {
|
picomp->numrlvls; ++rlvlno, ++pirlvl) {
|
||||||
pirlvl->prclyrnos = 0;
|
pirlvl->prclyrnos = 0;
|
||||||
}
|
}
|
||||||
for (rlvlno = 0, pirlvl = picomp->pirlvls, rlvl = tcomp->rlvls;
|
for (rlvlno = 0, pirlvl = picomp->pirlvls, rlvl = tcomp->rlvls;
|
||||||
rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl, ++rlvl) {
|
rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl, ++rlvl) {
|
||||||
/* XXX sizeof(long) should be sizeof different type */
|
/* XXX sizeof(long) should be sizeof different type */
|
||||||
pirlvl->numprcs = rlvl->numprcs;
|
pirlvl->numprcs = rlvl->numprcs;
|
||||||
if (!(pirlvl->prclyrnos = jas_alloc2(pirlvl->numprcs,
|
if (!(pirlvl->prclyrnos = jas_alloc2(pirlvl->numprcs,
|
||||||
sizeof(long)))) {
|
sizeof(long)))) {
|
||||||
jpc_pi_destroy(pi);
|
jpc_pi_destroy(pi);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pi->maxrlvls = 0;
|
pi->maxrlvls = 0;
|
||||||
for (compno = 0, tcomp = tile->tcomps, picomp = pi->picomps, cmpt =
|
for (compno = 0, tcomp = tile->tcomps, picomp = pi->picomps, cmpt =
|
||||||
dec->cmpts; compno < pi->numcomps; ++compno, ++tcomp, ++picomp,
|
dec->cmpts; compno < pi->numcomps; ++compno, ++tcomp, ++picomp,
|
||||||
++cmpt) {
|
++cmpt) {
|
||||||
picomp->hsamp = cmpt->hstep;
|
picomp->hsamp = cmpt->hstep;
|
||||||
picomp->vsamp = cmpt->vstep;
|
picomp->vsamp = cmpt->vstep;
|
||||||
for (rlvlno = 0, pirlvl = picomp->pirlvls, rlvl = tcomp->rlvls;
|
for (rlvlno = 0, pirlvl = picomp->pirlvls, rlvl = tcomp->rlvls;
|
||||||
rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl, ++rlvl) {
|
rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl, ++rlvl) {
|
||||||
pirlvl->prcwidthexpn = rlvl->prcwidthexpn;
|
pirlvl->prcwidthexpn = rlvl->prcwidthexpn;
|
||||||
pirlvl->prcheightexpn = rlvl->prcheightexpn;
|
pirlvl->prcheightexpn = rlvl->prcheightexpn;
|
||||||
for (prcno = 0, prclyrno = pirlvl->prclyrnos;
|
for (prcno = 0, prclyrno = pirlvl->prclyrnos;
|
||||||
prcno < pirlvl->numprcs; ++prcno, ++prclyrno) {
|
prcno < pirlvl->numprcs; ++prcno, ++prclyrno) {
|
||||||
*prclyrno = 0;
|
*prclyrno = 0;
|
||||||
}
|
}
|
||||||
pirlvl->numhprcs = rlvl->numhprcs;
|
pirlvl->numhprcs = rlvl->numhprcs;
|
||||||
}
|
}
|
||||||
if (pi->maxrlvls < tcomp->numrlvls) {
|
if (pi->maxrlvls < tcomp->numrlvls) {
|
||||||
pi->maxrlvls = tcomp->numrlvls;
|
pi->maxrlvls = tcomp->numrlvls;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pi->numlyrs = tile->cp->numlyrs;
|
pi->numlyrs = tile->cp->numlyrs;
|
||||||
pi->xstart = tile->xstart;
|
pi->xstart = tile->xstart;
|
||||||
pi->ystart = tile->ystart;
|
pi->ystart = tile->ystart;
|
||||||
pi->xend = tile->xend;
|
pi->xend = tile->xend;
|
||||||
pi->yend = tile->yend;
|
pi->yend = tile->yend;
|
||||||
|
|
||||||
pi->picomp = 0;
|
pi->picomp = 0;
|
||||||
pi->pirlvl = 0;
|
pi->pirlvl = 0;
|
||||||
pi->x = 0;
|
pi->x = 0;
|
||||||
pi->y = 0;
|
pi->y = 0;
|
||||||
pi->compno = 0;
|
pi->compno = 0;
|
||||||
pi->rlvlno = 0;
|
pi->rlvlno = 0;
|
||||||
pi->prcno = 0;
|
pi->prcno = 0;
|
||||||
pi->lyrno = 0;
|
pi->lyrno = 0;
|
||||||
pi->xstep = 0;
|
pi->xstep = 0;
|
||||||
pi->ystep = 0;
|
pi->ystep = 0;
|
||||||
|
|
||||||
pi->pchgno = -1;
|
pi->pchgno = -1;
|
||||||
|
|
||||||
pi->defaultpchg.prgord = tile->cp->prgord;
|
pi->defaultpchg.prgord = tile->cp->prgord;
|
||||||
pi->defaultpchg.compnostart = 0;
|
pi->defaultpchg.compnostart = 0;
|
||||||
pi->defaultpchg.compnoend = pi->numcomps;
|
pi->defaultpchg.compnoend = pi->numcomps;
|
||||||
pi->defaultpchg.rlvlnostart = 0;
|
pi->defaultpchg.rlvlnostart = 0;
|
||||||
pi->defaultpchg.rlvlnoend = pi->maxrlvls;
|
pi->defaultpchg.rlvlnoend = pi->maxrlvls;
|
||||||
pi->defaultpchg.lyrnoend = pi->numlyrs;
|
pi->defaultpchg.lyrnoend = pi->numlyrs;
|
||||||
pi->pchg = 0;
|
pi->pchg = 0;
|
||||||
|
|
||||||
pi->valid = 0;
|
pi->valid = 0;
|
||||||
|
|
||||||
return pi;
|
return pi;
|
||||||
}
|
}
|
||||||
|
|
||||||
long jpc_dec_lookahead(jas_stream_t *in)
|
long jpc_dec_lookahead(jas_stream_t *in)
|
||||||
{
|
{
|
||||||
uint_fast16_t x;
|
uint_fast16_t x;
|
||||||
if (jpc_getuint16(in, &x)) {
|
if (jpc_getuint16(in, &x)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (jas_stream_ungetc(in, x & 0xff) == EOF ||
|
if (jas_stream_ungetc(in, x & 0xff) == EOF ||
|
||||||
jas_stream_ungetc(in, x >> 8) == EOF) {
|
jas_stream_ungetc(in, x >> 8) == EOF) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (x >= JPC_MS_INMIN /*&& x <= JPC_MS_INMAX*/) {
|
if (x >= JPC_MS_INMIN /*&& x <= JPC_MS_INMAX*/) {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
962
3rdparty/libjasper/jpc_t2enc.c
vendored
962
3rdparty/libjasper/jpc_t2enc.c
vendored
File diff suppressed because it is too large
Load Diff
404
3rdparty/libjasper/jpc_tagtree.c
vendored
404
3rdparty/libjasper/jpc_tagtree.c
vendored
@ -94,99 +94,99 @@ static jpc_tagtree_t *jpc_tagtree_alloc(void);
|
|||||||
|
|
||||||
jpc_tagtree_t *jpc_tagtree_create(int numleafsh, int numleafsv)
|
jpc_tagtree_t *jpc_tagtree_create(int numleafsh, int numleafsv)
|
||||||
{
|
{
|
||||||
int nplh[JPC_TAGTREE_MAXDEPTH];
|
int nplh[JPC_TAGTREE_MAXDEPTH];
|
||||||
int nplv[JPC_TAGTREE_MAXDEPTH];
|
int nplv[JPC_TAGTREE_MAXDEPTH];
|
||||||
jpc_tagtreenode_t *node;
|
jpc_tagtreenode_t *node;
|
||||||
jpc_tagtreenode_t *parentnode;
|
jpc_tagtreenode_t *parentnode;
|
||||||
jpc_tagtreenode_t *parentnode0;
|
jpc_tagtreenode_t *parentnode0;
|
||||||
jpc_tagtree_t *tree;
|
jpc_tagtree_t *tree;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int k;
|
int k;
|
||||||
int numlvls;
|
int numlvls;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
assert(numleafsh > 0 && numleafsv > 0);
|
assert(numleafsh > 0 && numleafsv > 0);
|
||||||
|
|
||||||
if (!(tree = jpc_tagtree_alloc())) {
|
if (!(tree = jpc_tagtree_alloc())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
tree->numleafsh_ = numleafsh;
|
tree->numleafsh_ = numleafsh;
|
||||||
tree->numleafsv_ = numleafsv;
|
tree->numleafsv_ = numleafsv;
|
||||||
|
|
||||||
numlvls = 0;
|
numlvls = 0;
|
||||||
nplh[0] = numleafsh;
|
nplh[0] = numleafsh;
|
||||||
nplv[0] = numleafsv;
|
nplv[0] = numleafsv;
|
||||||
do {
|
do {
|
||||||
n = nplh[numlvls] * nplv[numlvls];
|
n = nplh[numlvls] * nplv[numlvls];
|
||||||
nplh[numlvls + 1] = (nplh[numlvls] + 1) / 2;
|
nplh[numlvls + 1] = (nplh[numlvls] + 1) / 2;
|
||||||
nplv[numlvls + 1] = (nplv[numlvls] + 1) / 2;
|
nplv[numlvls + 1] = (nplv[numlvls] + 1) / 2;
|
||||||
tree->numnodes_ += n;
|
tree->numnodes_ += n;
|
||||||
++numlvls;
|
++numlvls;
|
||||||
} while (n > 1);
|
} while (n > 1);
|
||||||
|
|
||||||
if (!(tree->nodes_ = jas_alloc2(tree->numnodes_, sizeof(jpc_tagtreenode_t)))) {
|
if (!(tree->nodes_ = jas_alloc2(tree->numnodes_, sizeof(jpc_tagtreenode_t)))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the parent links for all nodes in the tree. */
|
/* Initialize the parent links for all nodes in the tree. */
|
||||||
|
|
||||||
node = tree->nodes_;
|
node = tree->nodes_;
|
||||||
parentnode = &tree->nodes_[tree->numleafsh_ * tree->numleafsv_];
|
parentnode = &tree->nodes_[tree->numleafsh_ * tree->numleafsv_];
|
||||||
parentnode0 = parentnode;
|
parentnode0 = parentnode;
|
||||||
|
|
||||||
for (i = 0; i < numlvls - 1; ++i) {
|
for (i = 0; i < numlvls - 1; ++i) {
|
||||||
for (j = 0; j < nplv[i]; ++j) {
|
for (j = 0; j < nplv[i]; ++j) {
|
||||||
k = nplh[i];
|
k = nplh[i];
|
||||||
while (--k >= 0) {
|
while (--k >= 0) {
|
||||||
node->parent_ = parentnode;
|
node->parent_ = parentnode;
|
||||||
++node;
|
++node;
|
||||||
if (--k >= 0) {
|
if (--k >= 0) {
|
||||||
node->parent_ = parentnode;
|
node->parent_ = parentnode;
|
||||||
++node;
|
++node;
|
||||||
}
|
}
|
||||||
++parentnode;
|
++parentnode;
|
||||||
}
|
}
|
||||||
if ((j & 1) || j == nplv[i] - 1) {
|
if ((j & 1) || j == nplv[i] - 1) {
|
||||||
parentnode0 = parentnode;
|
parentnode0 = parentnode;
|
||||||
} else {
|
} else {
|
||||||
parentnode = parentnode0;
|
parentnode = parentnode0;
|
||||||
parentnode0 += nplh[i];
|
parentnode0 += nplh[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node->parent_ = 0;
|
node->parent_ = 0;
|
||||||
|
|
||||||
/* Initialize the data values to something sane. */
|
/* Initialize the data values to something sane. */
|
||||||
|
|
||||||
jpc_tagtree_reset(tree);
|
jpc_tagtree_reset(tree);
|
||||||
|
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy a tag tree. */
|
/* Destroy a tag tree. */
|
||||||
|
|
||||||
void jpc_tagtree_destroy(jpc_tagtree_t *tree)
|
void jpc_tagtree_destroy(jpc_tagtree_t *tree)
|
||||||
{
|
{
|
||||||
if (tree->nodes_) {
|
if (tree->nodes_) {
|
||||||
jas_free(tree->nodes_);
|
jas_free(tree->nodes_);
|
||||||
}
|
}
|
||||||
jas_free(tree);
|
jas_free(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jpc_tagtree_t *jpc_tagtree_alloc()
|
static jpc_tagtree_t *jpc_tagtree_alloc()
|
||||||
{
|
{
|
||||||
jpc_tagtree_t *tree;
|
jpc_tagtree_t *tree;
|
||||||
|
|
||||||
if (!(tree = jas_malloc(sizeof(jpc_tagtree_t)))) {
|
if (!(tree = jas_malloc(sizeof(jpc_tagtree_t)))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
tree->numleafsh_ = 0;
|
tree->numleafsh_ = 0;
|
||||||
tree->numleafsv_ = 0;
|
tree->numleafsv_ = 0;
|
||||||
tree->numnodes_ = 0;
|
tree->numnodes_ = 0;
|
||||||
tree->nodes_ = 0;
|
tree->nodes_ = 0;
|
||||||
|
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -197,42 +197,42 @@ static jpc_tagtree_t *jpc_tagtree_alloc()
|
|||||||
|
|
||||||
void jpc_tagtree_copy(jpc_tagtree_t *dsttree, jpc_tagtree_t *srctree)
|
void jpc_tagtree_copy(jpc_tagtree_t *dsttree, jpc_tagtree_t *srctree)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
jpc_tagtreenode_t *srcnode;
|
jpc_tagtreenode_t *srcnode;
|
||||||
jpc_tagtreenode_t *dstnode;
|
jpc_tagtreenode_t *dstnode;
|
||||||
|
|
||||||
/* The two tag trees must have similar sizes. */
|
/* The two tag trees must have similar sizes. */
|
||||||
assert(srctree->numleafsh_ == dsttree->numleafsh_ &&
|
assert(srctree->numleafsh_ == dsttree->numleafsh_ &&
|
||||||
srctree->numleafsv_ == dsttree->numleafsv_);
|
srctree->numleafsv_ == dsttree->numleafsv_);
|
||||||
|
|
||||||
n = srctree->numnodes_;
|
n = srctree->numnodes_;
|
||||||
srcnode = srctree->nodes_;
|
srcnode = srctree->nodes_;
|
||||||
dstnode = dsttree->nodes_;
|
dstnode = dsttree->nodes_;
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
dstnode->value_ = srcnode->value_;
|
dstnode->value_ = srcnode->value_;
|
||||||
dstnode->low_ = srcnode->low_;
|
dstnode->low_ = srcnode->low_;
|
||||||
dstnode->known_ = srcnode->known_;
|
dstnode->known_ = srcnode->known_;
|
||||||
++dstnode;
|
++dstnode;
|
||||||
++srcnode;
|
++srcnode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset all of the state information associated with a tag tree. */
|
/* Reset all of the state information associated with a tag tree. */
|
||||||
|
|
||||||
void jpc_tagtree_reset(jpc_tagtree_t *tree)
|
void jpc_tagtree_reset(jpc_tagtree_t *tree)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
jpc_tagtreenode_t *node;
|
jpc_tagtreenode_t *node;
|
||||||
|
|
||||||
n = tree->numnodes_;
|
n = tree->numnodes_;
|
||||||
node = tree->nodes_;
|
node = tree->nodes_;
|
||||||
|
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
node->value_ = INT_MAX;
|
node->value_ = INT_MAX;
|
||||||
node->low_ = 0;
|
node->low_ = 0;
|
||||||
node->known_ = 0;
|
node->known_ = 0;
|
||||||
++node;
|
++node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the value associated with the specified leaf node, updating
|
/* Set the value associated with the specified leaf node, updating
|
||||||
@ -241,25 +241,25 @@ the other nodes as necessary. */
|
|||||||
void jpc_tagtree_setvalue(jpc_tagtree_t *tree, jpc_tagtreenode_t *leaf,
|
void jpc_tagtree_setvalue(jpc_tagtree_t *tree, jpc_tagtreenode_t *leaf,
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
jpc_tagtreenode_t *node;
|
jpc_tagtreenode_t *node;
|
||||||
|
|
||||||
/* Avoid compiler warnings about unused parameters. */
|
/* Avoid compiler warnings about unused parameters. */
|
||||||
tree = 0;
|
tree = 0;
|
||||||
|
|
||||||
assert(value >= 0);
|
assert(value >= 0);
|
||||||
|
|
||||||
node = leaf;
|
node = leaf;
|
||||||
while (node && node->value_ > value) {
|
while (node && node->value_ > value) {
|
||||||
node->value_ = value;
|
node->value_ = value;
|
||||||
node = node->parent_;
|
node = node->parent_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a particular leaf node. */
|
/* Get a particular leaf node. */
|
||||||
|
|
||||||
jpc_tagtreenode_t *jpc_tagtree_getleaf(jpc_tagtree_t *tree, int n)
|
jpc_tagtreenode_t *jpc_tagtree_getleaf(jpc_tagtree_t *tree, int n)
|
||||||
{
|
{
|
||||||
return &tree->nodes_[n];
|
return &tree->nodes_[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke the tag tree encoding procedure. */
|
/* Invoke the tag tree encoding procedure. */
|
||||||
@ -267,58 +267,58 @@ jpc_tagtreenode_t *jpc_tagtree_getleaf(jpc_tagtree_t *tree, int n)
|
|||||||
int jpc_tagtree_encode(jpc_tagtree_t *tree, jpc_tagtreenode_t *leaf,
|
int jpc_tagtree_encode(jpc_tagtree_t *tree, jpc_tagtreenode_t *leaf,
|
||||||
int threshold, jpc_bitstream_t *out)
|
int threshold, jpc_bitstream_t *out)
|
||||||
{
|
{
|
||||||
jpc_tagtreenode_t *stk[JPC_TAGTREE_MAXDEPTH - 1];
|
jpc_tagtreenode_t *stk[JPC_TAGTREE_MAXDEPTH - 1];
|
||||||
jpc_tagtreenode_t **stkptr;
|
jpc_tagtreenode_t **stkptr;
|
||||||
jpc_tagtreenode_t *node;
|
jpc_tagtreenode_t *node;
|
||||||
int low;
|
int low;
|
||||||
|
|
||||||
/* Avoid compiler warnings about unused parameters. */
|
/* Avoid compiler warnings about unused parameters. */
|
||||||
tree = 0;
|
tree = 0;
|
||||||
|
|
||||||
assert(leaf);
|
assert(leaf);
|
||||||
assert(threshold >= 0);
|
assert(threshold >= 0);
|
||||||
|
|
||||||
/* Traverse to the root of the tree, recording the path taken. */
|
/* Traverse to the root of the tree, recording the path taken. */
|
||||||
stkptr = stk;
|
stkptr = stk;
|
||||||
node = leaf;
|
node = leaf;
|
||||||
while (node->parent_) {
|
while (node->parent_) {
|
||||||
*stkptr++ = node;
|
*stkptr++ = node;
|
||||||
node = node->parent_;
|
node = node->parent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
low = 0;
|
low = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (low > node->low_) {
|
if (low > node->low_) {
|
||||||
/* Deferred propagation of the lower bound downward in
|
/* Deferred propagation of the lower bound downward in
|
||||||
the tree. */
|
the tree. */
|
||||||
node->low_ = low;
|
node->low_ = low;
|
||||||
} else {
|
} else {
|
||||||
low = node->low_;
|
low = node->low_;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (low < threshold) {
|
while (low < threshold) {
|
||||||
if (low >= node->value_) {
|
if (low >= node->value_) {
|
||||||
if (!node->known_) {
|
if (!node->known_) {
|
||||||
if (jpc_bitstream_putbit(out, 1) == EOF) {
|
if (jpc_bitstream_putbit(out, 1) == EOF) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
node->known_ = 1;
|
node->known_ = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (jpc_bitstream_putbit(out, 0) == EOF) {
|
if (jpc_bitstream_putbit(out, 0) == EOF) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
++low;
|
++low;
|
||||||
}
|
}
|
||||||
node->low_ = low;
|
node->low_ = low;
|
||||||
if (stkptr == stk) {
|
if (stkptr == stk) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node = *--stkptr;
|
node = *--stkptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
return (leaf->low_ < threshold) ? 1 : 0;
|
return (leaf->low_ < threshold) ? 1 : 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,50 +327,50 @@ int jpc_tagtree_encode(jpc_tagtree_t *tree, jpc_tagtreenode_t *leaf,
|
|||||||
int jpc_tagtree_decode(jpc_tagtree_t *tree, jpc_tagtreenode_t *leaf,
|
int jpc_tagtree_decode(jpc_tagtree_t *tree, jpc_tagtreenode_t *leaf,
|
||||||
int threshold, jpc_bitstream_t *in)
|
int threshold, jpc_bitstream_t *in)
|
||||||
{
|
{
|
||||||
jpc_tagtreenode_t *stk[JPC_TAGTREE_MAXDEPTH - 1];
|
jpc_tagtreenode_t *stk[JPC_TAGTREE_MAXDEPTH - 1];
|
||||||
jpc_tagtreenode_t **stkptr;
|
jpc_tagtreenode_t **stkptr;
|
||||||
jpc_tagtreenode_t *node;
|
jpc_tagtreenode_t *node;
|
||||||
int low;
|
int low;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Avoid compiler warnings about unused parameters. */
|
/* Avoid compiler warnings about unused parameters. */
|
||||||
tree = 0;
|
tree = 0;
|
||||||
|
|
||||||
assert(threshold >= 0);
|
assert(threshold >= 0);
|
||||||
|
|
||||||
/* Traverse to the root of the tree, recording the path taken. */
|
/* Traverse to the root of the tree, recording the path taken. */
|
||||||
stkptr = stk;
|
stkptr = stk;
|
||||||
node = leaf;
|
node = leaf;
|
||||||
while (node->parent_) {
|
while (node->parent_) {
|
||||||
*stkptr++ = node;
|
*stkptr++ = node;
|
||||||
node = node->parent_;
|
node = node->parent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
low = 0;
|
low = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (low > node->low_) {
|
if (low > node->low_) {
|
||||||
node->low_ = low;
|
node->low_ = low;
|
||||||
} else {
|
} else {
|
||||||
low = node->low_;
|
low = node->low_;
|
||||||
}
|
}
|
||||||
while (low < threshold && low < node->value_) {
|
while (low < threshold && low < node->value_) {
|
||||||
if ((ret = jpc_bitstream_getbit(in)) < 0) {
|
if ((ret = jpc_bitstream_getbit(in)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
node->value_ = low;
|
node->value_ = low;
|
||||||
} else {
|
} else {
|
||||||
++low;
|
++low;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node->low_ = low;
|
node->low_ = low;
|
||||||
if (stkptr == stk) {
|
if (stkptr == stk) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node = *--stkptr;
|
node = *--stkptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (node->value_ < threshold) ? 1 : 0;
|
return (node->value_ < threshold) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
@ -379,15 +379,15 @@ int jpc_tagtree_decode(jpc_tagtree_t *tree, jpc_tagtreenode_t *leaf,
|
|||||||
|
|
||||||
void jpc_tagtree_dump(jpc_tagtree_t *tree, FILE *out)
|
void jpc_tagtree_dump(jpc_tagtree_t *tree, FILE *out)
|
||||||
{
|
{
|
||||||
jpc_tagtreenode_t *node;
|
jpc_tagtreenode_t *node;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
node = tree->nodes_;
|
node = tree->nodes_;
|
||||||
n = tree->numnodes_;
|
n = tree->numnodes_;
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
fprintf(out, "node %p, parent %p, value %d, lower %d, known %d\n",
|
fprintf(out, "node %p, parent %p, value %d, lower %d, known %d\n",
|
||||||
(void *) node, (void *) node->parent_, node->value_, node->low_,
|
(void *) node, (void *) node->parent_, node->value_, node->low_,
|
||||||
node->known_);
|
node->known_);
|
||||||
++node;
|
++node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
3rdparty/libjasper/jpc_tagtree.h
vendored
32
3rdparty/libjasper/jpc_tagtree.h
vendored
@ -96,17 +96,17 @@
|
|||||||
|
|
||||||
typedef struct jpc_tagtreenode_ {
|
typedef struct jpc_tagtreenode_ {
|
||||||
|
|
||||||
/* The parent of this node. */
|
/* The parent of this node. */
|
||||||
struct jpc_tagtreenode_ *parent_;
|
struct jpc_tagtreenode_ *parent_;
|
||||||
|
|
||||||
/* The value associated with this node. */
|
/* The value associated with this node. */
|
||||||
int value_;
|
int value_;
|
||||||
|
|
||||||
/* The lower bound on the value associated with this node. */
|
/* The lower bound on the value associated with this node. */
|
||||||
int low_;
|
int low_;
|
||||||
|
|
||||||
/* A flag indicating if the value is known exactly. */
|
/* A flag indicating if the value is known exactly. */
|
||||||
int known_;
|
int known_;
|
||||||
|
|
||||||
} jpc_tagtreenode_t;
|
} jpc_tagtreenode_t;
|
||||||
|
|
||||||
@ -116,17 +116,17 @@ typedef struct jpc_tagtreenode_ {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The number of leaves in the horizontal direction. */
|
/* The number of leaves in the horizontal direction. */
|
||||||
int numleafsh_;
|
int numleafsh_;
|
||||||
|
|
||||||
/* The number of leaves in the vertical direction. */
|
/* The number of leaves in the vertical direction. */
|
||||||
int numleafsv_;
|
int numleafsv_;
|
||||||
|
|
||||||
/* The total number of nodes in the tree. */
|
/* The total number of nodes in the tree. */
|
||||||
int numnodes_;
|
int numnodes_;
|
||||||
|
|
||||||
/* The nodes. */
|
/* The nodes. */
|
||||||
jpc_tagtreenode_t *nodes_;
|
jpc_tagtreenode_t *nodes_;
|
||||||
|
|
||||||
} jpc_tagtree_t;
|
} jpc_tagtree_t;
|
||||||
|
|
||||||
|
290
3rdparty/libjasper/jpc_tsfb.c
vendored
290
3rdparty/libjasper/jpc_tsfb.c
vendored
@ -92,197 +92,197 @@ void jpc_tsfb_getbands2(jpc_tsfb_t *tsfb, int locxstart, int locystart,
|
|||||||
|
|
||||||
jpc_tsfb_t *jpc_cod_gettsfb(int qmfbid, int numlvls)
|
jpc_tsfb_t *jpc_cod_gettsfb(int qmfbid, int numlvls)
|
||||||
{
|
{
|
||||||
jpc_tsfb_t *tsfb;
|
jpc_tsfb_t *tsfb;
|
||||||
|
|
||||||
if (!(tsfb = malloc(sizeof(jpc_tsfb_t))))
|
if (!(tsfb = malloc(sizeof(jpc_tsfb_t))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (numlvls > 0) {
|
if (numlvls > 0) {
|
||||||
switch (qmfbid) {
|
switch (qmfbid) {
|
||||||
case JPC_COX_INS:
|
case JPC_COX_INS:
|
||||||
tsfb->qmfb = &jpc_ns_qmfb2d;
|
tsfb->qmfb = &jpc_ns_qmfb2d;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case JPC_COX_RFT:
|
case JPC_COX_RFT:
|
||||||
tsfb->qmfb = &jpc_ft_qmfb2d;
|
tsfb->qmfb = &jpc_ft_qmfb2d;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tsfb->qmfb = 0;
|
tsfb->qmfb = 0;
|
||||||
}
|
}
|
||||||
tsfb->numlvls = numlvls;
|
tsfb->numlvls = numlvls;
|
||||||
return tsfb;
|
return tsfb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jpc_tsfb_destroy(jpc_tsfb_t *tsfb)
|
void jpc_tsfb_destroy(jpc_tsfb_t *tsfb)
|
||||||
{
|
{
|
||||||
free(tsfb);
|
free(tsfb);
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_tsfb_analyze(jpc_tsfb_t *tsfb, jas_seq2d_t *a)
|
int jpc_tsfb_analyze(jpc_tsfb_t *tsfb, jas_seq2d_t *a)
|
||||||
{
|
{
|
||||||
return (tsfb->numlvls > 0) ? jpc_tsfb_analyze2(tsfb, jas_seq2d_getref(a,
|
return (tsfb->numlvls > 0) ? jpc_tsfb_analyze2(tsfb, jas_seq2d_getref(a,
|
||||||
jas_seq2d_xstart(a), jas_seq2d_ystart(a)), jas_seq2d_xstart(a),
|
jas_seq2d_xstart(a), jas_seq2d_ystart(a)), jas_seq2d_xstart(a),
|
||||||
jas_seq2d_ystart(a), jas_seq2d_width(a),
|
jas_seq2d_ystart(a), jas_seq2d_width(a),
|
||||||
jas_seq2d_height(a), jas_seq2d_rowstep(a), tsfb->numlvls - 1) : 0;
|
jas_seq2d_height(a), jas_seq2d_rowstep(a), tsfb->numlvls - 1) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_tsfb_analyze2(jpc_tsfb_t *tsfb, int *a, int xstart, int ystart,
|
int jpc_tsfb_analyze2(jpc_tsfb_t *tsfb, int *a, int xstart, int ystart,
|
||||||
int width, int height, int stride, int numlvls)
|
int width, int height, int stride, int numlvls)
|
||||||
{
|
{
|
||||||
if (width > 0 && height > 0) {
|
if (width > 0 && height > 0) {
|
||||||
if ((*tsfb->qmfb->analyze)(a, xstart, ystart, width, height, stride))
|
if ((*tsfb->qmfb->analyze)(a, xstart, ystart, width, height, stride))
|
||||||
return -1;
|
return -1;
|
||||||
if (numlvls > 0) {
|
if (numlvls > 0) {
|
||||||
if (jpc_tsfb_analyze2(tsfb, a, JPC_CEILDIVPOW2(xstart,
|
if (jpc_tsfb_analyze2(tsfb, a, JPC_CEILDIVPOW2(xstart,
|
||||||
1), JPC_CEILDIVPOW2(ystart, 1), JPC_CEILDIVPOW2(
|
1), JPC_CEILDIVPOW2(ystart, 1), JPC_CEILDIVPOW2(
|
||||||
xstart + width, 1) - JPC_CEILDIVPOW2(xstart, 1),
|
xstart + width, 1) - JPC_CEILDIVPOW2(xstart, 1),
|
||||||
JPC_CEILDIVPOW2(ystart + height, 1) -
|
JPC_CEILDIVPOW2(ystart + height, 1) -
|
||||||
JPC_CEILDIVPOW2(ystart, 1), stride, numlvls - 1)) {
|
JPC_CEILDIVPOW2(ystart, 1), stride, numlvls - 1)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_tsfb_synthesize(jpc_tsfb_t *tsfb, jas_seq2d_t *a)
|
int jpc_tsfb_synthesize(jpc_tsfb_t *tsfb, jas_seq2d_t *a)
|
||||||
{
|
{
|
||||||
return (tsfb->numlvls > 0) ? jpc_tsfb_synthesize2(tsfb,
|
return (tsfb->numlvls > 0) ? jpc_tsfb_synthesize2(tsfb,
|
||||||
jas_seq2d_getref(a, jas_seq2d_xstart(a), jas_seq2d_ystart(a)),
|
jas_seq2d_getref(a, jas_seq2d_xstart(a), jas_seq2d_ystart(a)),
|
||||||
jas_seq2d_xstart(a), jas_seq2d_ystart(a), jas_seq2d_width(a),
|
jas_seq2d_xstart(a), jas_seq2d_ystart(a), jas_seq2d_width(a),
|
||||||
jas_seq2d_height(a), jas_seq2d_rowstep(a), tsfb->numlvls - 1) : 0;
|
jas_seq2d_height(a), jas_seq2d_rowstep(a), tsfb->numlvls - 1) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_tsfb_synthesize2(jpc_tsfb_t *tsfb, int *a, int xstart, int ystart,
|
int jpc_tsfb_synthesize2(jpc_tsfb_t *tsfb, int *a, int xstart, int ystart,
|
||||||
int width, int height, int stride, int numlvls)
|
int width, int height, int stride, int numlvls)
|
||||||
{
|
{
|
||||||
if (numlvls > 0) {
|
if (numlvls > 0) {
|
||||||
if (jpc_tsfb_synthesize2(tsfb, a, JPC_CEILDIVPOW2(xstart, 1),
|
if (jpc_tsfb_synthesize2(tsfb, a, JPC_CEILDIVPOW2(xstart, 1),
|
||||||
JPC_CEILDIVPOW2(ystart, 1), JPC_CEILDIVPOW2(xstart + width,
|
JPC_CEILDIVPOW2(ystart, 1), JPC_CEILDIVPOW2(xstart + width,
|
||||||
1) - JPC_CEILDIVPOW2(xstart, 1), JPC_CEILDIVPOW2(ystart +
|
1) - JPC_CEILDIVPOW2(xstart, 1), JPC_CEILDIVPOW2(ystart +
|
||||||
height, 1) - JPC_CEILDIVPOW2(ystart, 1), stride, numlvls -
|
height, 1) - JPC_CEILDIVPOW2(ystart, 1), stride, numlvls -
|
||||||
1)) {
|
1)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (width > 0 && height > 0) {
|
if (width > 0 && height > 0) {
|
||||||
if ((*tsfb->qmfb->synthesize)(a, xstart, ystart, width, height, stride)) {
|
if ((*tsfb->qmfb->synthesize)(a, xstart, ystart, width, height, stride)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jpc_tsfb_getbands(jpc_tsfb_t *tsfb, uint_fast32_t xstart,
|
int jpc_tsfb_getbands(jpc_tsfb_t *tsfb, uint_fast32_t xstart,
|
||||||
uint_fast32_t ystart, uint_fast32_t xend, uint_fast32_t yend,
|
uint_fast32_t ystart, uint_fast32_t xend, uint_fast32_t yend,
|
||||||
jpc_tsfb_band_t *bands)
|
jpc_tsfb_band_t *bands)
|
||||||
{
|
{
|
||||||
jpc_tsfb_band_t *band;
|
jpc_tsfb_band_t *band;
|
||||||
|
|
||||||
band = bands;
|
band = bands;
|
||||||
if (tsfb->numlvls > 0) {
|
if (tsfb->numlvls > 0) {
|
||||||
jpc_tsfb_getbands2(tsfb, xstart, ystart, xstart, ystart, xend, yend,
|
jpc_tsfb_getbands2(tsfb, xstart, ystart, xstart, ystart, xend, yend,
|
||||||
&band, tsfb->numlvls);
|
&band, tsfb->numlvls);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
band->xstart = xstart;
|
band->xstart = xstart;
|
||||||
band->ystart = ystart;
|
band->ystart = ystart;
|
||||||
band->xend = xend;
|
band->xend = xend;
|
||||||
band->yend = yend;
|
band->yend = yend;
|
||||||
band->locxstart = xstart;
|
band->locxstart = xstart;
|
||||||
band->locystart = ystart;
|
band->locystart = ystart;
|
||||||
band->locxend = band->locxstart + band->xend - band->xstart;
|
band->locxend = band->locxstart + band->xend - band->xstart;
|
||||||
band->locyend = band->locystart + band->yend - band->ystart;
|
band->locyend = band->locystart + band->yend - band->ystart;
|
||||||
band->orient = JPC_TSFB_LL;
|
band->orient = JPC_TSFB_LL;
|
||||||
band->synenergywt = JPC_FIX_ONE;
|
band->synenergywt = JPC_FIX_ONE;
|
||||||
++band;
|
++band;
|
||||||
}
|
}
|
||||||
return band - bands;
|
return band - bands;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jpc_tsfb_getbands2(jpc_tsfb_t *tsfb, int locxstart, int locystart,
|
void jpc_tsfb_getbands2(jpc_tsfb_t *tsfb, int locxstart, int locystart,
|
||||||
int xstart, int ystart, int xend, int yend, jpc_tsfb_band_t **bands,
|
int xstart, int ystart, int xend, int yend, jpc_tsfb_band_t **bands,
|
||||||
int numlvls)
|
int numlvls)
|
||||||
{
|
{
|
||||||
int newxstart;
|
int newxstart;
|
||||||
int newystart;
|
int newystart;
|
||||||
int newxend;
|
int newxend;
|
||||||
int newyend;
|
int newyend;
|
||||||
jpc_tsfb_band_t *band;
|
jpc_tsfb_band_t *band;
|
||||||
|
|
||||||
newxstart = JPC_CEILDIVPOW2(xstart, 1);
|
newxstart = JPC_CEILDIVPOW2(xstart, 1);
|
||||||
newystart = JPC_CEILDIVPOW2(ystart, 1);
|
newystart = JPC_CEILDIVPOW2(ystart, 1);
|
||||||
newxend = JPC_CEILDIVPOW2(xend, 1);
|
newxend = JPC_CEILDIVPOW2(xend, 1);
|
||||||
newyend = JPC_CEILDIVPOW2(yend, 1);
|
newyend = JPC_CEILDIVPOW2(yend, 1);
|
||||||
|
|
||||||
if (numlvls > 0) {
|
if (numlvls > 0) {
|
||||||
|
|
||||||
jpc_tsfb_getbands2(tsfb, locxstart, locystart, newxstart, newystart,
|
jpc_tsfb_getbands2(tsfb, locxstart, locystart, newxstart, newystart,
|
||||||
newxend, newyend, bands, numlvls - 1);
|
newxend, newyend, bands, numlvls - 1);
|
||||||
|
|
||||||
band = *bands;
|
band = *bands;
|
||||||
band->xstart = JPC_FLOORDIVPOW2(xstart, 1);
|
band->xstart = JPC_FLOORDIVPOW2(xstart, 1);
|
||||||
band->ystart = newystart;
|
band->ystart = newystart;
|
||||||
band->xend = JPC_FLOORDIVPOW2(xend, 1);
|
band->xend = JPC_FLOORDIVPOW2(xend, 1);
|
||||||
band->yend = newyend;
|
band->yend = newyend;
|
||||||
band->locxstart = locxstart + newxend - newxstart;
|
band->locxstart = locxstart + newxend - newxstart;
|
||||||
band->locystart = locystart;
|
band->locystart = locystart;
|
||||||
band->locxend = band->locxstart + band->xend - band->xstart;
|
band->locxend = band->locxstart + band->xend - band->xstart;
|
||||||
band->locyend = band->locystart + band->yend - band->ystart;
|
band->locyend = band->locystart + band->yend - band->ystart;
|
||||||
band->orient = JPC_TSFB_HL;
|
band->orient = JPC_TSFB_HL;
|
||||||
band->synenergywt = jpc_dbltofix(tsfb->qmfb->hpenergywts[
|
band->synenergywt = jpc_dbltofix(tsfb->qmfb->hpenergywts[
|
||||||
tsfb->numlvls - numlvls] * tsfb->qmfb->lpenergywts[
|
tsfb->numlvls - numlvls] * tsfb->qmfb->lpenergywts[
|
||||||
tsfb->numlvls - numlvls]);
|
tsfb->numlvls - numlvls]);
|
||||||
++(*bands);
|
++(*bands);
|
||||||
|
|
||||||
band = *bands;
|
band = *bands;
|
||||||
band->xstart = newxstart;
|
band->xstart = newxstart;
|
||||||
band->ystart = JPC_FLOORDIVPOW2(ystart, 1);
|
band->ystart = JPC_FLOORDIVPOW2(ystart, 1);
|
||||||
band->xend = newxend;
|
band->xend = newxend;
|
||||||
band->yend = JPC_FLOORDIVPOW2(yend, 1);
|
band->yend = JPC_FLOORDIVPOW2(yend, 1);
|
||||||
band->locxstart = locxstart;
|
band->locxstart = locxstart;
|
||||||
band->locystart = locystart + newyend - newystart;
|
band->locystart = locystart + newyend - newystart;
|
||||||
band->locxend = band->locxstart + band->xend - band->xstart;
|
band->locxend = band->locxstart + band->xend - band->xstart;
|
||||||
band->locyend = band->locystart + band->yend - band->ystart;
|
band->locyend = band->locystart + band->yend - band->ystart;
|
||||||
band->orient = JPC_TSFB_LH;
|
band->orient = JPC_TSFB_LH;
|
||||||
band->synenergywt = jpc_dbltofix(tsfb->qmfb->lpenergywts[
|
band->synenergywt = jpc_dbltofix(tsfb->qmfb->lpenergywts[
|
||||||
tsfb->numlvls - numlvls] * tsfb->qmfb->hpenergywts[
|
tsfb->numlvls - numlvls] * tsfb->qmfb->hpenergywts[
|
||||||
tsfb->numlvls - numlvls]);
|
tsfb->numlvls - numlvls]);
|
||||||
++(*bands);
|
++(*bands);
|
||||||
|
|
||||||
band = *bands;
|
band = *bands;
|
||||||
band->xstart = JPC_FLOORDIVPOW2(xstart, 1);
|
band->xstart = JPC_FLOORDIVPOW2(xstart, 1);
|
||||||
band->ystart = JPC_FLOORDIVPOW2(ystart, 1);
|
band->ystart = JPC_FLOORDIVPOW2(ystart, 1);
|
||||||
band->xend = JPC_FLOORDIVPOW2(xend, 1);
|
band->xend = JPC_FLOORDIVPOW2(xend, 1);
|
||||||
band->yend = JPC_FLOORDIVPOW2(yend, 1);
|
band->yend = JPC_FLOORDIVPOW2(yend, 1);
|
||||||
band->locxstart = locxstart + newxend - newxstart;
|
band->locxstart = locxstart + newxend - newxstart;
|
||||||
band->locystart = locystart + newyend - newystart;
|
band->locystart = locystart + newyend - newystart;
|
||||||
band->locxend = band->locxstart + band->xend - band->xstart;
|
band->locxend = band->locxstart + band->xend - band->xstart;
|
||||||
band->locyend = band->locystart + band->yend - band->ystart;
|
band->locyend = band->locystart + band->yend - band->ystart;
|
||||||
band->orient = JPC_TSFB_HH;
|
band->orient = JPC_TSFB_HH;
|
||||||
band->synenergywt = jpc_dbltofix(tsfb->qmfb->hpenergywts[
|
band->synenergywt = jpc_dbltofix(tsfb->qmfb->hpenergywts[
|
||||||
tsfb->numlvls - numlvls] * tsfb->qmfb->hpenergywts[
|
tsfb->numlvls - numlvls] * tsfb->qmfb->hpenergywts[
|
||||||
tsfb->numlvls - numlvls]);
|
tsfb->numlvls - numlvls]);
|
||||||
++(*bands);
|
++(*bands);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
band = *bands;
|
band = *bands;
|
||||||
band->xstart = xstart;
|
band->xstart = xstart;
|
||||||
band->ystart = ystart;
|
band->ystart = ystart;
|
||||||
band->xend = xend;
|
band->xend = xend;
|
||||||
band->yend = yend;
|
band->yend = yend;
|
||||||
band->locxstart = locxstart;
|
band->locxstart = locxstart;
|
||||||
band->locystart = locystart;
|
band->locystart = locystart;
|
||||||
band->locxend = band->locxstart + band->xend - band->xstart;
|
band->locxend = band->locxstart + band->xend - band->xstart;
|
||||||
band->locyend = band->locystart + band->yend - band->ystart;
|
band->locyend = band->locystart + band->yend - band->ystart;
|
||||||
band->orient = JPC_TSFB_LL;
|
band->orient = JPC_TSFB_LL;
|
||||||
band->synenergywt = jpc_dbltofix(tsfb->qmfb->lpenergywts[
|
band->synenergywt = jpc_dbltofix(tsfb->qmfb->lpenergywts[
|
||||||
tsfb->numlvls - numlvls - 1] * tsfb->qmfb->lpenergywts[
|
tsfb->numlvls - numlvls - 1] * tsfb->qmfb->lpenergywts[
|
||||||
tsfb->numlvls - numlvls - 1]);
|
tsfb->numlvls - numlvls - 1]);
|
||||||
++(*bands);
|
++(*bands);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
24
3rdparty/libjasper/jpc_tsfb.h
vendored
24
3rdparty/libjasper/jpc_tsfb.h
vendored
@ -97,21 +97,21 @@
|
|||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int xstart;
|
int xstart;
|
||||||
int ystart;
|
int ystart;
|
||||||
int xend;
|
int xend;
|
||||||
int yend;
|
int yend;
|
||||||
int orient;
|
int orient;
|
||||||
int locxstart;
|
int locxstart;
|
||||||
int locystart;
|
int locystart;
|
||||||
int locxend;
|
int locxend;
|
||||||
int locyend;
|
int locyend;
|
||||||
jpc_fix_t synenergywt;
|
jpc_fix_t synenergywt;
|
||||||
} jpc_tsfb_band_t;
|
} jpc_tsfb_band_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int numlvls;
|
int numlvls;
|
||||||
jpc_qmfb2d_t *qmfb;
|
jpc_qmfb2d_t *qmfb;
|
||||||
} jpc_tsfb_t;
|
} jpc_tsfb_t;
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
|
156
3rdparty/libjasper/jpc_util.c
vendored
156
3rdparty/libjasper/jpc_util.c
vendored
@ -90,105 +90,105 @@
|
|||||||
|
|
||||||
int jpc_atoaf(char *s, int *numvalues, double **values)
|
int jpc_atoaf(char *s, int *numvalues, double **values)
|
||||||
{
|
{
|
||||||
static char delim[] = ", \t\n";
|
static char delim[] = ", \t\n";
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
int n;
|
int n;
|
||||||
double *vs;
|
double *vs;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
strncpy(buf, s, sizeof(buf));
|
strncpy(buf, s, sizeof(buf));
|
||||||
buf[sizeof(buf) - 1] = '\0';
|
buf[sizeof(buf) - 1] = '\0';
|
||||||
n = 0;
|
n = 0;
|
||||||
if ((cp = strtok(buf, delim))) {
|
if ((cp = strtok(buf, delim))) {
|
||||||
++n;
|
++n;
|
||||||
while ((cp = strtok(0, delim))) {
|
while ((cp = strtok(0, delim))) {
|
||||||
if (cp != '\0') {
|
if (cp != '\0') {
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
if (!(vs = jas_alloc2(n, sizeof(double)))) {
|
if (!(vs = jas_alloc2(n, sizeof(double)))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(buf, s, sizeof(buf));
|
strncpy(buf, s, sizeof(buf));
|
||||||
buf[sizeof(buf) - 1] = '\0';
|
buf[sizeof(buf) - 1] = '\0';
|
||||||
n = 0;
|
n = 0;
|
||||||
if ((cp = strtok(buf, delim))) {
|
if ((cp = strtok(buf, delim))) {
|
||||||
vs[n] = atof(cp);
|
vs[n] = atof(cp);
|
||||||
++n;
|
++n;
|
||||||
while ((cp = strtok(0, delim))) {
|
while ((cp = strtok(0, delim))) {
|
||||||
if (cp != '\0') {
|
if (cp != '\0') {
|
||||||
vs[n] = atof(cp);
|
vs[n] = atof(cp);
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vs = 0;
|
vs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*numvalues = n;
|
*numvalues = n;
|
||||||
*values = vs;
|
*values = vs;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
jas_seq_t *jpc_seq_upsample(jas_seq_t *x, int m)
|
jas_seq_t *jpc_seq_upsample(jas_seq_t *x, int m)
|
||||||
{
|
{
|
||||||
jas_seq_t *z;
|
jas_seq_t *z;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!(z = jas_seq_create(jas_seq_start(x) * m, (jas_seq_end(x) - 1) * m + 1)))
|
if (!(z = jas_seq_create(jas_seq_start(x) * m, (jas_seq_end(x) - 1) * m + 1)))
|
||||||
return 0;
|
return 0;
|
||||||
for (i = jas_seq_start(z); i < jas_seq_end(z); i++) {
|
for (i = jas_seq_start(z); i < jas_seq_end(z); i++) {
|
||||||
*jas_seq_getref(z, i) = (!JAS_MOD(i, m)) ? jas_seq_get(x, i / m) :
|
*jas_seq_getref(z, i) = (!JAS_MOD(i, m)) ? jas_seq_get(x, i / m) :
|
||||||
jpc_inttofix(0);
|
jpc_inttofix(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
jpc_fix_t jpc_seq_norm(jas_seq_t *x)
|
jpc_fix_t jpc_seq_norm(jas_seq_t *x)
|
||||||
{
|
{
|
||||||
jpc_fix_t s;
|
jpc_fix_t s;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
s = jpc_inttofix(0);
|
s = jpc_inttofix(0);
|
||||||
for (i = jas_seq_start(x); i < jas_seq_end(x); i++) {
|
for (i = jas_seq_start(x); i < jas_seq_end(x); i++) {
|
||||||
s = jpc_fix_add(s, jpc_fix_mul(jas_seq_get(x, i), jas_seq_get(x, i)));
|
s = jpc_fix_add(s, jpc_fix_mul(jas_seq_get(x, i), jas_seq_get(x, i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return jpc_dbltofix(sqrt(jpc_fixtodbl(s)));
|
return jpc_dbltofix(sqrt(jpc_fixtodbl(s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
jas_seq_t *jpc_seq_conv(jas_seq_t *x, jas_seq_t *y)
|
jas_seq_t *jpc_seq_conv(jas_seq_t *x, jas_seq_t *y)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int k;
|
int k;
|
||||||
jas_seq_t *z;
|
jas_seq_t *z;
|
||||||
jpc_fix_t s;
|
jpc_fix_t s;
|
||||||
jpc_fix_t v;
|
jpc_fix_t v;
|
||||||
|
|
||||||
z = jas_seq_create(jas_seq_start(x) + jas_seq_start(y),
|
z = jas_seq_create(jas_seq_start(x) + jas_seq_start(y),
|
||||||
jas_seq_end(x) + jas_seq_end(y) - 1);
|
jas_seq_end(x) + jas_seq_end(y) - 1);
|
||||||
assert(z);
|
assert(z);
|
||||||
for (i = jas_seq_start(z); i < jas_seq_end(z); i++) {
|
for (i = jas_seq_start(z); i < jas_seq_end(z); i++) {
|
||||||
s = jpc_inttofix(0);
|
s = jpc_inttofix(0);
|
||||||
for (j = jas_seq_start(y); j < jas_seq_end(y); j++) {
|
for (j = jas_seq_start(y); j < jas_seq_end(y); j++) {
|
||||||
k = i - j;
|
k = i - j;
|
||||||
if (k < jas_seq_start(x) || k >= jas_seq_end(x)) {
|
if (k < jas_seq_start(x) || k >= jas_seq_end(x)) {
|
||||||
v = JPC_FIX_ZERO;
|
v = JPC_FIX_ZERO;
|
||||||
} else {
|
} else {
|
||||||
v = jas_seq_get(x, k);
|
v = jas_seq_get(x, k);
|
||||||
}
|
}
|
||||||
s = jpc_fix_add(s, jpc_fix_mul(jas_seq_get(y, j), v));
|
s = jpc_fix_add(s, jpc_fix_mul(jas_seq_get(y, j), v));
|
||||||
}
|
}
|
||||||
*jas_seq_getref(z, i) = s;
|
*jas_seq_getref(z, i) = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
12
3rdparty/libjpeg/jcapimin.c
vendored
12
3rdparty/libjpeg/jcapimin.c
vendored
@ -37,7 +37,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
|
|||||||
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
|
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
|
||||||
if (structsize != SIZEOF(struct jpeg_compress_struct))
|
if (structsize != SIZEOF(struct jpeg_compress_struct))
|
||||||
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
|
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
|
||||||
(int) SIZEOF(struct jpeg_compress_struct), (int) structsize);
|
(int) SIZEOF(struct jpeg_compress_struct), (int) structsize);
|
||||||
|
|
||||||
/* For debugging purposes, we zero the whole master structure.
|
/* For debugging purposes, we zero the whole master structure.
|
||||||
* But the application has already set the err pointer, and may have set
|
* But the application has already set the err pointer, and may have set
|
||||||
@ -161,15 +161,15 @@ jpeg_finish_compress (j_compress_ptr cinfo)
|
|||||||
(*cinfo->master->prepare_for_pass) (cinfo);
|
(*cinfo->master->prepare_for_pass) (cinfo);
|
||||||
for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
|
for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
|
||||||
if (cinfo->progress != NULL) {
|
if (cinfo->progress != NULL) {
|
||||||
cinfo->progress->pass_counter = (long) iMCU_row;
|
cinfo->progress->pass_counter = (long) iMCU_row;
|
||||||
cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
|
cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
|
||||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
||||||
}
|
}
|
||||||
/* We bypass the main controller and invoke coef controller directly;
|
/* We bypass the main controller and invoke coef controller directly;
|
||||||
* all work is being done from the coefficient buffer.
|
* all work is being done from the coefficient buffer.
|
||||||
*/
|
*/
|
||||||
if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
|
if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
|
||||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||||
}
|
}
|
||||||
(*cinfo->master->finish_pass) (cinfo);
|
(*cinfo->master->finish_pass) (cinfo);
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ jpeg_finish_compress (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_write_marker (j_compress_ptr cinfo, int marker,
|
jpeg_write_marker (j_compress_ptr cinfo, int marker,
|
||||||
const JOCTET *dataptr, unsigned int datalen)
|
const JOCTET *dataptr, unsigned int datalen)
|
||||||
{
|
{
|
||||||
JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val));
|
JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val));
|
||||||
|
|
||||||
|
4
3rdparty/libjpeg/jcapistd.c
vendored
4
3rdparty/libjpeg/jcapistd.c
vendored
@ -75,7 +75,7 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
|
|||||||
|
|
||||||
GLOBAL(JDIMENSION)
|
GLOBAL(JDIMENSION)
|
||||||
jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
|
jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
|
||||||
JDIMENSION num_lines)
|
JDIMENSION num_lines)
|
||||||
{
|
{
|
||||||
JDIMENSION row_ctr, rows_left;
|
JDIMENSION row_ctr, rows_left;
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
|
|||||||
|
|
||||||
GLOBAL(JDIMENSION)
|
GLOBAL(JDIMENSION)
|
||||||
jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
|
jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
|
||||||
JDIMENSION num_lines)
|
JDIMENSION num_lines)
|
||||||
{
|
{
|
||||||
JDIMENSION lines_per_iMCU_row;
|
JDIMENSION lines_per_iMCU_row;
|
||||||
|
|
||||||
|
162
3rdparty/libjpeg/jccoefct.c
vendored
162
3rdparty/libjpeg/jccoefct.c
vendored
@ -154,7 +154,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
||||||
yoffset++) {
|
yoffset++) {
|
||||||
for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
|
for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
|
||||||
MCU_col_num++) {
|
MCU_col_num++) {
|
||||||
/* Determine where data comes from in input_buf and do the DCT thing.
|
/* Determine where data comes from in input_buf and do the DCT thing.
|
||||||
* Each call on forward_DCT processes a horizontal row of DCT blocks
|
* Each call on forward_DCT processes a horizontal row of DCT blocks
|
||||||
* as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks
|
* as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks
|
||||||
@ -166,46 +166,46 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
*/
|
*/
|
||||||
blkn = 0;
|
blkn = 0;
|
||||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
|
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
|
||||||
: compptr->last_col_width;
|
: compptr->last_col_width;
|
||||||
xpos = MCU_col_num * compptr->MCU_sample_width;
|
xpos = MCU_col_num * compptr->MCU_sample_width;
|
||||||
ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
|
ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
|
||||||
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
||||||
if (coef->iMCU_row_num < last_iMCU_row ||
|
if (coef->iMCU_row_num < last_iMCU_row ||
|
||||||
yoffset+yindex < compptr->last_row_height) {
|
yoffset+yindex < compptr->last_row_height) {
|
||||||
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
|
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
|
||||||
input_buf[compptr->component_index],
|
input_buf[compptr->component_index],
|
||||||
coef->MCU_buffer[blkn],
|
coef->MCU_buffer[blkn],
|
||||||
ypos, xpos, (JDIMENSION) blockcnt);
|
ypos, xpos, (JDIMENSION) blockcnt);
|
||||||
if (blockcnt < compptr->MCU_width) {
|
if (blockcnt < compptr->MCU_width) {
|
||||||
/* Create some dummy blocks at the right edge of the image. */
|
/* Create some dummy blocks at the right edge of the image. */
|
||||||
jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt],
|
jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt],
|
||||||
(compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
|
(compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
|
||||||
for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
|
for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
|
||||||
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
|
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Create a row of dummy blocks at the bottom of the image. */
|
/* Create a row of dummy blocks at the bottom of the image. */
|
||||||
jzero_far((void FAR *) coef->MCU_buffer[blkn],
|
jzero_far((void FAR *) coef->MCU_buffer[blkn],
|
||||||
compptr->MCU_width * SIZEOF(JBLOCK));
|
compptr->MCU_width * SIZEOF(JBLOCK));
|
||||||
for (bi = 0; bi < compptr->MCU_width; bi++) {
|
for (bi = 0; bi < compptr->MCU_width; bi++) {
|
||||||
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
|
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blkn += compptr->MCU_width;
|
blkn += compptr->MCU_width;
|
||||||
ypos += DCTSIZE;
|
ypos += DCTSIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Try to write the MCU. In event of a suspension failure, we will
|
/* Try to write the MCU. In event of a suspension failure, we will
|
||||||
* re-DCT the MCU on restart (a bit inefficient, could be fixed...)
|
* re-DCT the MCU on restart (a bit inefficient, could be fixed...)
|
||||||
*/
|
*/
|
||||||
if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
||||||
/* Suspension forced; update state counters and exit */
|
/* Suspension forced; update state counters and exit */
|
||||||
coef->MCU_vert_offset = yoffset;
|
coef->MCU_vert_offset = yoffset;
|
||||||
coef->mcu_ctr = MCU_col_num;
|
coef->mcu_ctr = MCU_col_num;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Completed an MCU row, but perhaps not an iMCU row */
|
/* Completed an MCU row, but perhaps not an iMCU row */
|
||||||
@ -280,17 +280,17 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
for (block_row = 0; block_row < block_rows; block_row++) {
|
for (block_row = 0; block_row < block_rows; block_row++) {
|
||||||
thisblockrow = buffer[block_row];
|
thisblockrow = buffer[block_row];
|
||||||
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
|
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
|
||||||
input_buf[ci], thisblockrow,
|
input_buf[ci], thisblockrow,
|
||||||
(JDIMENSION) (block_row * DCTSIZE),
|
(JDIMENSION) (block_row * DCTSIZE),
|
||||||
(JDIMENSION) 0, blocks_across);
|
(JDIMENSION) 0, blocks_across);
|
||||||
if (ndummy > 0) {
|
if (ndummy > 0) {
|
||||||
/* Create dummy blocks at the right edge of the image. */
|
/* Create dummy blocks at the right edge of the image. */
|
||||||
thisblockrow += blocks_across; /* => first dummy block */
|
thisblockrow += blocks_across; /* => first dummy block */
|
||||||
jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
|
jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
|
||||||
lastDC = thisblockrow[-1][0];
|
lastDC = thisblockrow[-1][0];
|
||||||
for (bi = 0; bi < ndummy; bi++) {
|
for (bi = 0; bi < ndummy; bi++) {
|
||||||
thisblockrow[bi][0] = lastDC;
|
thisblockrow[bi][0] = lastDC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If at end of image, create dummy block rows as needed.
|
/* If at end of image, create dummy block rows as needed.
|
||||||
@ -302,19 +302,19 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
blocks_across += ndummy; /* include lower right corner */
|
blocks_across += ndummy; /* include lower right corner */
|
||||||
MCUs_across = blocks_across / h_samp_factor;
|
MCUs_across = blocks_across / h_samp_factor;
|
||||||
for (block_row = block_rows; block_row < compptr->v_samp_factor;
|
for (block_row = block_rows; block_row < compptr->v_samp_factor;
|
||||||
block_row++) {
|
block_row++) {
|
||||||
thisblockrow = buffer[block_row];
|
thisblockrow = buffer[block_row];
|
||||||
lastblockrow = buffer[block_row-1];
|
lastblockrow = buffer[block_row-1];
|
||||||
jzero_far((void FAR *) thisblockrow,
|
jzero_far((void FAR *) thisblockrow,
|
||||||
(size_t) (blocks_across * SIZEOF(JBLOCK)));
|
(size_t) (blocks_across * SIZEOF(JBLOCK)));
|
||||||
for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
|
for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
|
||||||
lastDC = lastblockrow[h_samp_factor-1][0];
|
lastDC = lastblockrow[h_samp_factor-1][0];
|
||||||
for (bi = 0; bi < h_samp_factor; bi++) {
|
for (bi = 0; bi < h_samp_factor; bi++) {
|
||||||
thisblockrow[bi][0] = lastDC;
|
thisblockrow[bi][0] = lastDC;
|
||||||
}
|
}
|
||||||
thisblockrow += h_samp_factor; /* advance to next MCU in row */
|
thisblockrow += h_samp_factor; /* advance to next MCU in row */
|
||||||
lastblockrow += h_samp_factor;
|
lastblockrow += h_samp_factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -364,25 +364,25 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
||||||
yoffset++) {
|
yoffset++) {
|
||||||
for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
|
for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
|
||||||
MCU_col_num++) {
|
MCU_col_num++) {
|
||||||
/* Construct list of pointers to DCT blocks belonging to this MCU */
|
/* Construct list of pointers to DCT blocks belonging to this MCU */
|
||||||
blkn = 0; /* index of current DCT block within MCU */
|
blkn = 0; /* index of current DCT block within MCU */
|
||||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
start_col = MCU_col_num * compptr->MCU_width;
|
start_col = MCU_col_num * compptr->MCU_width;
|
||||||
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
||||||
buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
|
buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
|
||||||
for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
|
for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
|
||||||
coef->MCU_buffer[blkn++] = buffer_ptr++;
|
coef->MCU_buffer[blkn++] = buffer_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Try to write the MCU. */
|
/* Try to write the MCU. */
|
||||||
if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
|
||||||
/* Suspension forced; update state counters and exit */
|
/* Suspension forced; update state counters and exit */
|
||||||
coef->MCU_vert_offset = yoffset;
|
coef->MCU_vert_offset = yoffset;
|
||||||
coef->mcu_ctr = MCU_col_num;
|
coef->mcu_ctr = MCU_col_num;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Completed an MCU row, but perhaps not an iMCU row */
|
/* Completed an MCU row, but perhaps not an iMCU row */
|
||||||
@ -408,7 +408,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
|
|
||||||
coef = (my_coef_ptr)
|
coef = (my_coef_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_coef_controller));
|
SIZEOF(my_coef_controller));
|
||||||
cinfo->coef = (struct jpeg_c_coef_controller *) coef;
|
cinfo->coef = (struct jpeg_c_coef_controller *) coef;
|
||||||
coef->pub.start_pass = start_pass_coef;
|
coef->pub.start_pass = start_pass_coef;
|
||||||
|
|
||||||
@ -421,14 +421,14 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
|
coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
||||||
(JDIMENSION) jround_up((long) compptr->width_in_blocks,
|
(JDIMENSION) jround_up((long) compptr->width_in_blocks,
|
||||||
(long) compptr->h_samp_factor),
|
(long) compptr->h_samp_factor),
|
||||||
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
||||||
(long) compptr->v_samp_factor),
|
(long) compptr->v_samp_factor),
|
||||||
(JDIMENSION) compptr->v_samp_factor);
|
(JDIMENSION) compptr->v_samp_factor);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
@ -440,7 +440,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
|
|
||||||
buffer = (JBLOCKROW)
|
buffer = (JBLOCKROW)
|
||||||
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
||||||
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
|
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
|
||||||
coef->MCU_buffer[i] = buffer + i;
|
coef->MCU_buffer[i] = buffer + i;
|
||||||
}
|
}
|
||||||
|
58
3rdparty/libjpeg/jccolor.c
vendored
58
3rdparty/libjpeg/jccolor.c
vendored
@ -92,7 +92,7 @@ rgb_ycc_start (j_compress_ptr cinfo)
|
|||||||
/* Allocate and fill in the conversion tables. */
|
/* Allocate and fill in the conversion tables. */
|
||||||
cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *)
|
cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
(TABLE_SIZE * SIZEOF(INT32)));
|
(TABLE_SIZE * SIZEOF(INT32)));
|
||||||
|
|
||||||
for (i = 0; i <= MAXJSAMPLE; i++) {
|
for (i = 0; i <= MAXJSAMPLE; i++) {
|
||||||
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
|
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
|
||||||
@ -128,8 +128,8 @@ rgb_ycc_start (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
rgb_ycc_convert (j_compress_ptr cinfo,
|
rgb_ycc_convert (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||||
JDIMENSION output_row, int num_rows)
|
JDIMENSION output_row, int num_rows)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||||
register int r, g, b;
|
register int r, g, b;
|
||||||
@ -157,16 +157,16 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
/* Y */
|
/* Y */
|
||||||
outptr0[col] = (JSAMPLE)
|
outptr0[col] = (JSAMPLE)
|
||||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
||||||
>> SCALEBITS);
|
>> SCALEBITS);
|
||||||
/* Cb */
|
/* Cb */
|
||||||
outptr1[col] = (JSAMPLE)
|
outptr1[col] = (JSAMPLE)
|
||||||
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
|
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
|
||||||
>> SCALEBITS);
|
>> SCALEBITS);
|
||||||
/* Cr */
|
/* Cr */
|
||||||
outptr2[col] = (JSAMPLE)
|
outptr2[col] = (JSAMPLE)
|
||||||
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
||||||
>> SCALEBITS);
|
>> SCALEBITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,8 +184,8 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
rgb_gray_convert (j_compress_ptr cinfo,
|
rgb_gray_convert (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||||
JDIMENSION output_row, int num_rows)
|
JDIMENSION output_row, int num_rows)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||||
register int r, g, b;
|
register int r, g, b;
|
||||||
@ -206,8 +206,8 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
|||||||
inptr += RGB_PIXELSIZE;
|
inptr += RGB_PIXELSIZE;
|
||||||
/* Y */
|
/* Y */
|
||||||
outptr[col] = (JSAMPLE)
|
outptr[col] = (JSAMPLE)
|
||||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
||||||
>> SCALEBITS);
|
>> SCALEBITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,8 +223,8 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
cmyk_ycck_convert (j_compress_ptr cinfo,
|
cmyk_ycck_convert (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||||
JDIMENSION output_row, int num_rows)
|
JDIMENSION output_row, int num_rows)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||||
register int r, g, b;
|
register int r, g, b;
|
||||||
@ -255,16 +255,16 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
/* Y */
|
/* Y */
|
||||||
outptr0[col] = (JSAMPLE)
|
outptr0[col] = (JSAMPLE)
|
||||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
||||||
>> SCALEBITS);
|
>> SCALEBITS);
|
||||||
/* Cb */
|
/* Cb */
|
||||||
outptr1[col] = (JSAMPLE)
|
outptr1[col] = (JSAMPLE)
|
||||||
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
|
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
|
||||||
>> SCALEBITS);
|
>> SCALEBITS);
|
||||||
/* Cr */
|
/* Cr */
|
||||||
outptr2[col] = (JSAMPLE)
|
outptr2[col] = (JSAMPLE)
|
||||||
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
||||||
>> SCALEBITS);
|
>> SCALEBITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,8 +278,8 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
grayscale_convert (j_compress_ptr cinfo,
|
grayscale_convert (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||||
JDIMENSION output_row, int num_rows)
|
JDIMENSION output_row, int num_rows)
|
||||||
{
|
{
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
register JSAMPROW outptr;
|
register JSAMPROW outptr;
|
||||||
@ -307,8 +307,8 @@ grayscale_convert (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
null_convert (j_compress_ptr cinfo,
|
null_convert (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||||
JDIMENSION output_row, int num_rows)
|
JDIMENSION output_row, int num_rows)
|
||||||
{
|
{
|
||||||
register JSAMPROW inptr;
|
register JSAMPROW inptr;
|
||||||
register JSAMPROW outptr;
|
register JSAMPROW outptr;
|
||||||
@ -323,8 +323,8 @@ null_convert (j_compress_ptr cinfo,
|
|||||||
inptr = *input_buf;
|
inptr = *input_buf;
|
||||||
outptr = output_buf[ci][output_row];
|
outptr = output_buf[ci][output_row];
|
||||||
for (col = 0; col < num_cols; col++) {
|
for (col = 0; col < num_cols; col++) {
|
||||||
outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
|
outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
|
||||||
inptr += nc;
|
inptr += nc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input_buf++;
|
input_buf++;
|
||||||
@ -355,7 +355,7 @@ jinit_color_converter (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
cconvert = (my_cconvert_ptr)
|
cconvert = (my_cconvert_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_color_converter));
|
SIZEOF(my_color_converter));
|
||||||
cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
|
cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
|
||||||
/* set start_pass to null method until we find out differently */
|
/* set start_pass to null method until we find out differently */
|
||||||
cconvert->pub.start_pass = null_method;
|
cconvert->pub.start_pass = null_method;
|
||||||
@ -451,7 +451,7 @@ jinit_color_converter (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
default: /* allow null conversion of JCS_UNKNOWN */
|
default: /* allow null conversion of JCS_UNKNOWN */
|
||||||
if (cinfo->jpeg_color_space != cinfo->in_color_space ||
|
if (cinfo->jpeg_color_space != cinfo->in_color_space ||
|
||||||
cinfo->num_components != cinfo->input_components)
|
cinfo->num_components != cinfo->input_components)
|
||||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||||
cconvert->pub.color_convert = null_convert;
|
cconvert->pub.color_convert = null_convert;
|
||||||
break;
|
break;
|
||||||
|
266
3rdparty/libjpeg/jcdctmgr.c
vendored
266
3rdparty/libjpeg/jcdctmgr.c
vendored
@ -64,7 +64,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
|
|||||||
qtblno = compptr->quant_tbl_no;
|
qtblno = compptr->quant_tbl_no;
|
||||||
/* Make sure specified quantization table is present */
|
/* Make sure specified quantization table is present */
|
||||||
if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
|
if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
|
||||||
cinfo->quant_tbl_ptrs[qtblno] == NULL)
|
cinfo->quant_tbl_ptrs[qtblno] == NULL)
|
||||||
ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
|
ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
|
||||||
qtbl = cinfo->quant_tbl_ptrs[qtblno];
|
qtbl = cinfo->quant_tbl_ptrs[qtblno];
|
||||||
/* Compute divisors for this quant table */
|
/* Compute divisors for this quant table */
|
||||||
@ -76,87 +76,87 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
|
|||||||
* coefficients multiplied by 8 (to counteract scaling).
|
* coefficients multiplied by 8 (to counteract scaling).
|
||||||
*/
|
*/
|
||||||
if (fdct->divisors[qtblno] == NULL) {
|
if (fdct->divisors[qtblno] == NULL) {
|
||||||
fdct->divisors[qtblno] = (DCTELEM *)
|
fdct->divisors[qtblno] = (DCTELEM *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
DCTSIZE2 * SIZEOF(DCTELEM));
|
DCTSIZE2 * SIZEOF(DCTELEM));
|
||||||
}
|
}
|
||||||
dtbl = fdct->divisors[qtblno];
|
dtbl = fdct->divisors[qtblno];
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3;
|
dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DCT_IFAST_SUPPORTED
|
#ifdef DCT_IFAST_SUPPORTED
|
||||||
case JDCT_IFAST:
|
case JDCT_IFAST:
|
||||||
{
|
{
|
||||||
/* For AA&N IDCT method, divisors are equal to quantization
|
/* For AA&N IDCT method, divisors are equal to quantization
|
||||||
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
||||||
* scalefactor[0] = 1
|
* scalefactor[0] = 1
|
||||||
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
||||||
* We apply a further scale factor of 8.
|
* We apply a further scale factor of 8.
|
||||||
*/
|
*/
|
||||||
#define CONST_BITS 14
|
#define CONST_BITS 14
|
||||||
static const INT16 aanscales[DCTSIZE2] = {
|
static const INT16 aanscales[DCTSIZE2] = {
|
||||||
/* precomputed values scaled up by 14 bits */
|
/* precomputed values scaled up by 14 bits */
|
||||||
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
||||||
22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
|
22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
|
||||||
21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
|
21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
|
||||||
19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
|
19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
|
||||||
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
||||||
12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
|
12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
|
||||||
8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
|
8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
|
||||||
4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
|
4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
|
||||||
};
|
};
|
||||||
SHIFT_TEMPS
|
SHIFT_TEMPS
|
||||||
|
|
||||||
if (fdct->divisors[qtblno] == NULL) {
|
if (fdct->divisors[qtblno] == NULL) {
|
||||||
fdct->divisors[qtblno] = (DCTELEM *)
|
fdct->divisors[qtblno] = (DCTELEM *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
DCTSIZE2 * SIZEOF(DCTELEM));
|
DCTSIZE2 * SIZEOF(DCTELEM));
|
||||||
}
|
}
|
||||||
dtbl = fdct->divisors[qtblno];
|
dtbl = fdct->divisors[qtblno];
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
dtbl[i] = (DCTELEM)
|
dtbl[i] = (DCTELEM)
|
||||||
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
|
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
|
||||||
(INT32) aanscales[i]),
|
(INT32) aanscales[i]),
|
||||||
CONST_BITS-3);
|
CONST_BITS-3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DCT_FLOAT_SUPPORTED
|
#ifdef DCT_FLOAT_SUPPORTED
|
||||||
case JDCT_FLOAT:
|
case JDCT_FLOAT:
|
||||||
{
|
{
|
||||||
/* For float AA&N IDCT method, divisors are equal to quantization
|
/* For float AA&N IDCT method, divisors are equal to quantization
|
||||||
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
||||||
* scalefactor[0] = 1
|
* scalefactor[0] = 1
|
||||||
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
||||||
* We apply a further scale factor of 8.
|
* We apply a further scale factor of 8.
|
||||||
* What's actually stored is 1/divisor so that the inner loop can
|
* What's actually stored is 1/divisor so that the inner loop can
|
||||||
* use a multiplication rather than a division.
|
* use a multiplication rather than a division.
|
||||||
*/
|
*/
|
||||||
FAST_FLOAT * fdtbl;
|
FAST_FLOAT * fdtbl;
|
||||||
int row, col;
|
int row, col;
|
||||||
static const double aanscalefactor[DCTSIZE] = {
|
static const double aanscalefactor[DCTSIZE] = {
|
||||||
1.0, 1.387039845, 1.306562965, 1.175875602,
|
1.0, 1.387039845, 1.306562965, 1.175875602,
|
||||||
1.0, 0.785694958, 0.541196100, 0.275899379
|
1.0, 0.785694958, 0.541196100, 0.275899379
|
||||||
};
|
};
|
||||||
|
|
||||||
if (fdct->float_divisors[qtblno] == NULL) {
|
if (fdct->float_divisors[qtblno] == NULL) {
|
||||||
fdct->float_divisors[qtblno] = (FAST_FLOAT *)
|
fdct->float_divisors[qtblno] = (FAST_FLOAT *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
DCTSIZE2 * SIZEOF(FAST_FLOAT));
|
DCTSIZE2 * SIZEOF(FAST_FLOAT));
|
||||||
}
|
}
|
||||||
fdtbl = fdct->float_divisors[qtblno];
|
fdtbl = fdct->float_divisors[qtblno];
|
||||||
i = 0;
|
i = 0;
|
||||||
for (row = 0; row < DCTSIZE; row++) {
|
for (row = 0; row < DCTSIZE; row++) {
|
||||||
for (col = 0; col < DCTSIZE; col++) {
|
for (col = 0; col < DCTSIZE; col++) {
|
||||||
fdtbl[i] = (FAST_FLOAT)
|
fdtbl[i] = (FAST_FLOAT)
|
||||||
(1.0 / (((double) qtbl->quantval[i] *
|
(1.0 / (((double) qtbl->quantval[i] *
|
||||||
aanscalefactor[row] * aanscalefactor[col] * 8.0)));
|
aanscalefactor[row] * aanscalefactor[col] * 8.0)));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -178,9 +178,9 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
|
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
|
||||||
JDIMENSION start_row, JDIMENSION start_col,
|
JDIMENSION start_row, JDIMENSION start_col,
|
||||||
JDIMENSION num_blocks)
|
JDIMENSION num_blocks)
|
||||||
/* This version is used for integer DCT implementations. */
|
/* This version is used for integer DCT implementations. */
|
||||||
{
|
{
|
||||||
/* This routine is heavily used, so it's worth coding it tightly. */
|
/* This routine is heavily used, so it's worth coding it tightly. */
|
||||||
@ -200,22 +200,22 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
workspaceptr = workspace;
|
workspaceptr = workspace;
|
||||||
for (elemr = 0; elemr < DCTSIZE; elemr++) {
|
for (elemr = 0; elemr < DCTSIZE; elemr++) {
|
||||||
elemptr = sample_data[elemr] + start_col;
|
elemptr = sample_data[elemr] + start_col;
|
||||||
#if DCTSIZE == 8 /* unroll the inner loop */
|
#if DCTSIZE == 8 /* unroll the inner loop */
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
#else
|
#else
|
||||||
{ register int elemc;
|
{ register int elemc;
|
||||||
for (elemc = DCTSIZE; elemc > 0; elemc--) {
|
for (elemc = DCTSIZE; elemc > 0; elemc--) {
|
||||||
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,35 +229,35 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
register JCOEFPTR output_ptr = coef_blocks[bi];
|
register JCOEFPTR output_ptr = coef_blocks[bi];
|
||||||
|
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
qval = divisors[i];
|
qval = divisors[i];
|
||||||
temp = workspace[i];
|
temp = workspace[i];
|
||||||
/* Divide the coefficient value by qval, ensuring proper rounding.
|
/* Divide the coefficient value by qval, ensuring proper rounding.
|
||||||
* Since C does not specify the direction of rounding for negative
|
* Since C does not specify the direction of rounding for negative
|
||||||
* quotients, we have to force the dividend positive for portability.
|
* quotients, we have to force the dividend positive for portability.
|
||||||
*
|
*
|
||||||
* In most files, at least half of the output values will be zero
|
* In most files, at least half of the output values will be zero
|
||||||
* (at default quantization settings, more like three-quarters...)
|
* (at default quantization settings, more like three-quarters...)
|
||||||
* so we should ensure that this case is fast. On many machines,
|
* so we should ensure that this case is fast. On many machines,
|
||||||
* a comparison is enough cheaper than a divide to make a special test
|
* a comparison is enough cheaper than a divide to make a special test
|
||||||
* a win. Since both inputs will be nonnegative, we need only test
|
* a win. Since both inputs will be nonnegative, we need only test
|
||||||
* for a < b to discover whether a/b is 0.
|
* for a < b to discover whether a/b is 0.
|
||||||
* If your machine's division is fast enough, define FAST_DIVIDE.
|
* If your machine's division is fast enough, define FAST_DIVIDE.
|
||||||
*/
|
*/
|
||||||
#ifdef FAST_DIVIDE
|
#ifdef FAST_DIVIDE
|
||||||
#define DIVIDE_BY(a,b) a /= b
|
#define DIVIDE_BY(a,b) a /= b
|
||||||
#else
|
#else
|
||||||
#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0
|
#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0
|
||||||
#endif
|
#endif
|
||||||
if (temp < 0) {
|
if (temp < 0) {
|
||||||
temp = -temp;
|
temp = -temp;
|
||||||
temp += qval>>1; /* for rounding */
|
temp += qval>>1; /* for rounding */
|
||||||
DIVIDE_BY(temp, qval);
|
DIVIDE_BY(temp, qval);
|
||||||
temp = -temp;
|
temp = -temp;
|
||||||
} else {
|
} else {
|
||||||
temp += qval>>1; /* for rounding */
|
temp += qval>>1; /* for rounding */
|
||||||
DIVIDE_BY(temp, qval);
|
DIVIDE_BY(temp, qval);
|
||||||
}
|
}
|
||||||
output_ptr[i] = (JCOEF) temp;
|
output_ptr[i] = (JCOEF) temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,9 +268,9 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
|
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
|
||||||
JDIMENSION start_row, JDIMENSION start_col,
|
JDIMENSION start_row, JDIMENSION start_col,
|
||||||
JDIMENSION num_blocks)
|
JDIMENSION num_blocks)
|
||||||
/* This version is used for floating-point DCT implementations. */
|
/* This version is used for floating-point DCT implementations. */
|
||||||
{
|
{
|
||||||
/* This routine is heavily used, so it's worth coding it tightly. */
|
/* This routine is heavily used, so it's worth coding it tightly. */
|
||||||
@ -290,23 +290,23 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
workspaceptr = workspace;
|
workspaceptr = workspace;
|
||||||
for (elemr = 0; elemr < DCTSIZE; elemr++) {
|
for (elemr = 0; elemr < DCTSIZE; elemr++) {
|
||||||
elemptr = sample_data[elemr] + start_col;
|
elemptr = sample_data[elemr] + start_col;
|
||||||
#if DCTSIZE == 8 /* unroll the inner loop */
|
#if DCTSIZE == 8 /* unroll the inner loop */
|
||||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
#else
|
#else
|
||||||
{ register int elemc;
|
{ register int elemc;
|
||||||
for (elemc = DCTSIZE; elemc > 0; elemc--) {
|
for (elemc = DCTSIZE; elemc > 0; elemc--) {
|
||||||
*workspaceptr++ = (FAST_FLOAT)
|
*workspaceptr++ = (FAST_FLOAT)
|
||||||
(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,15 +320,15 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
register JCOEFPTR output_ptr = coef_blocks[bi];
|
register JCOEFPTR output_ptr = coef_blocks[bi];
|
||||||
|
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
/* Apply the quantization and scaling factor */
|
/* Apply the quantization and scaling factor */
|
||||||
temp = workspace[i] * divisors[i];
|
temp = workspace[i] * divisors[i];
|
||||||
/* Round to nearest integer.
|
/* Round to nearest integer.
|
||||||
* Since C does not specify the direction of rounding for negative
|
* Since C does not specify the direction of rounding for negative
|
||||||
* quotients, we have to force the dividend positive for portability.
|
* quotients, we have to force the dividend positive for portability.
|
||||||
* The maximum coefficient size is +-16K (for 12-bit data), so this
|
* The maximum coefficient size is +-16K (for 12-bit data), so this
|
||||||
* code should work for either 16-bit or 32-bit ints.
|
* code should work for either 16-bit or 32-bit ints.
|
||||||
*/
|
*/
|
||||||
output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384);
|
output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ jinit_forward_dct (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
fdct = (my_fdct_ptr)
|
fdct = (my_fdct_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_fdct_controller));
|
SIZEOF(my_fdct_controller));
|
||||||
cinfo->fdct = (struct jpeg_forward_dct *) fdct;
|
cinfo->fdct = (struct jpeg_forward_dct *) fdct;
|
||||||
fdct->pub.start_pass = start_pass_fdctmgr;
|
fdct->pub.start_pass = start_pass_fdctmgr;
|
||||||
|
|
||||||
|
118
3rdparty/libjpeg/jchuff.c
vendored
118
3rdparty/libjpeg/jchuff.c
vendored
@ -42,12 +42,12 @@ typedef struct {
|
|||||||
#else
|
#else
|
||||||
#if MAX_COMPS_IN_SCAN == 4
|
#if MAX_COMPS_IN_SCAN == 4
|
||||||
#define ASSIGN_STATE(dest,src) \
|
#define ASSIGN_STATE(dest,src) \
|
||||||
((dest).put_buffer = (src).put_buffer, \
|
((dest).put_buffer = (src).put_buffer, \
|
||||||
(dest).put_bits = (src).put_bits, \
|
(dest).put_bits = (src).put_bits, \
|
||||||
(dest).last_dc_val[0] = (src).last_dc_val[0], \
|
(dest).last_dc_val[0] = (src).last_dc_val[0], \
|
||||||
(dest).last_dc_val[1] = (src).last_dc_val[1], \
|
(dest).last_dc_val[1] = (src).last_dc_val[1], \
|
||||||
(dest).last_dc_val[2] = (src).last_dc_val[2], \
|
(dest).last_dc_val[2] = (src).last_dc_val[2], \
|
||||||
(dest).last_dc_val[3] = (src).last_dc_val[3])
|
(dest).last_dc_val[3] = (src).last_dc_val[3])
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -87,11 +87,11 @@ typedef struct {
|
|||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data));
|
JBLOCKROW *MCU_data));
|
||||||
METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo));
|
METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo));
|
||||||
#ifdef ENTROPY_OPT_SUPPORTED
|
#ifdef ENTROPY_OPT_SUPPORTED
|
||||||
METHODDEF(boolean) encode_mcu_gather JPP((j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_gather JPP((j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data));
|
JBLOCKROW *MCU_data));
|
||||||
METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo));
|
METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -130,29 +130,29 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
/* Check for invalid table indexes */
|
/* Check for invalid table indexes */
|
||||||
/* (make_c_derived_tbl does this in the other path) */
|
/* (make_c_derived_tbl does this in the other path) */
|
||||||
if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)
|
if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)
|
||||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
|
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
|
||||||
if (actbl < 0 || actbl >= NUM_HUFF_TBLS)
|
if (actbl < 0 || actbl >= NUM_HUFF_TBLS)
|
||||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
|
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
|
||||||
/* Allocate and zero the statistics tables */
|
/* Allocate and zero the statistics tables */
|
||||||
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
||||||
if (entropy->dc_count_ptrs[dctbl] == NULL)
|
if (entropy->dc_count_ptrs[dctbl] == NULL)
|
||||||
entropy->dc_count_ptrs[dctbl] = (long *)
|
entropy->dc_count_ptrs[dctbl] = (long *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
257 * SIZEOF(long));
|
257 * SIZEOF(long));
|
||||||
MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long));
|
MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long));
|
||||||
if (entropy->ac_count_ptrs[actbl] == NULL)
|
if (entropy->ac_count_ptrs[actbl] == NULL)
|
||||||
entropy->ac_count_ptrs[actbl] = (long *)
|
entropy->ac_count_ptrs[actbl] = (long *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
257 * SIZEOF(long));
|
257 * SIZEOF(long));
|
||||||
MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long));
|
MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* Compute derived values for Huffman tables */
|
/* Compute derived values for Huffman tables */
|
||||||
/* We may do this more than once for a table, but it's not expensive */
|
/* We may do this more than once for a table, but it's not expensive */
|
||||||
jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
|
jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
|
||||||
& entropy->dc_derived_tbls[dctbl]);
|
& entropy->dc_derived_tbls[dctbl]);
|
||||||
jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
|
jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
|
||||||
& entropy->ac_derived_tbls[actbl]);
|
& entropy->ac_derived_tbls[actbl]);
|
||||||
}
|
}
|
||||||
/* Initialize DC predictions to 0 */
|
/* Initialize DC predictions to 0 */
|
||||||
entropy->saved.last_dc_val[ci] = 0;
|
entropy->saved.last_dc_val[ci] = 0;
|
||||||
@ -177,7 +177,7 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
||||||
c_derived_tbl ** pdtbl)
|
c_derived_tbl ** pdtbl)
|
||||||
{
|
{
|
||||||
JHUFF_TBL *htbl;
|
JHUFF_TBL *htbl;
|
||||||
c_derived_tbl *dtbl;
|
c_derived_tbl *dtbl;
|
||||||
@ -202,7 +202,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
if (*pdtbl == NULL)
|
if (*pdtbl == NULL)
|
||||||
*pdtbl = (c_derived_tbl *)
|
*pdtbl = (c_derived_tbl *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(c_derived_tbl));
|
SIZEOF(c_derived_tbl));
|
||||||
dtbl = *pdtbl;
|
dtbl = *pdtbl;
|
||||||
|
|
||||||
/* Figure C.1: make table of Huffman code length for each symbol */
|
/* Figure C.1: make table of Huffman code length for each symbol */
|
||||||
@ -268,10 +268,10 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
|
|
||||||
/* Emit a byte, taking 'action' if must suspend. */
|
/* Emit a byte, taking 'action' if must suspend. */
|
||||||
#define emit_byte(state,val,action) \
|
#define emit_byte(state,val,action) \
|
||||||
{ *(state)->next_output_byte++ = (JOCTET) (val); \
|
{ *(state)->next_output_byte++ = (JOCTET) (val); \
|
||||||
if (--(state)->free_in_buffer == 0) \
|
if (--(state)->free_in_buffer == 0) \
|
||||||
if (! dump_buffer(state)) \
|
if (! dump_buffer(state)) \
|
||||||
{ action; } }
|
{ action; } }
|
||||||
|
|
||||||
|
|
||||||
LOCAL(boolean)
|
LOCAL(boolean)
|
||||||
@ -351,7 +351,7 @@ flush_bits (working_state * state)
|
|||||||
|
|
||||||
LOCAL(boolean)
|
LOCAL(boolean)
|
||||||
encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
|
encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
|
||||||
c_derived_tbl *dctbl, c_derived_tbl *actbl)
|
c_derived_tbl *dctbl, c_derived_tbl *actbl)
|
||||||
{
|
{
|
||||||
register int temp, temp2;
|
register int temp, temp2;
|
||||||
register int nbits;
|
register int nbits;
|
||||||
@ -400,35 +400,35 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
|
|||||||
} else {
|
} else {
|
||||||
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
|
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
|
||||||
while (r > 15) {
|
while (r > 15) {
|
||||||
if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0]))
|
if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0]))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
r -= 16;
|
r -= 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp2 = temp;
|
temp2 = temp;
|
||||||
if (temp < 0) {
|
if (temp < 0) {
|
||||||
temp = -temp; /* temp is abs value of input */
|
temp = -temp; /* temp is abs value of input */
|
||||||
/* This code assumes we are on a two's complement machine */
|
/* This code assumes we are on a two's complement machine */
|
||||||
temp2--;
|
temp2--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the number of bits needed for the magnitude of the coefficient */
|
/* Find the number of bits needed for the magnitude of the coefficient */
|
||||||
nbits = 1; /* there must be at least one 1 bit */
|
nbits = 1; /* there must be at least one 1 bit */
|
||||||
while ((temp >>= 1))
|
while ((temp >>= 1))
|
||||||
nbits++;
|
nbits++;
|
||||||
/* Check for out-of-range coefficient values */
|
/* Check for out-of-range coefficient values */
|
||||||
if (nbits > MAX_COEF_BITS)
|
if (nbits > MAX_COEF_BITS)
|
||||||
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
|
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
|
||||||
|
|
||||||
/* Emit Huffman symbol for run length / number of bits */
|
/* Emit Huffman symbol for run length / number of bits */
|
||||||
i = (r << 4) + nbits;
|
i = (r << 4) + nbits;
|
||||||
if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i]))
|
if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i]))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Emit that number of bits of the value, if positive, */
|
/* Emit that number of bits of the value, if positive, */
|
||||||
/* or the complement of its magnitude, if negative. */
|
/* or the complement of its magnitude, if negative. */
|
||||||
if (! emit_bits(state, (unsigned int) temp2, nbits))
|
if (! emit_bits(state, (unsigned int) temp2, nbits))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
}
|
}
|
||||||
@ -490,7 +490,7 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
if (cinfo->restart_interval) {
|
if (cinfo->restart_interval) {
|
||||||
if (entropy->restarts_to_go == 0)
|
if (entropy->restarts_to_go == 0)
|
||||||
if (! emit_restart(&state, entropy->next_restart_num))
|
if (! emit_restart(&state, entropy->next_restart_num))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Encode the MCU data blocks */
|
/* Encode the MCU data blocks */
|
||||||
@ -498,9 +498,9 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
ci = cinfo->MCU_membership[blkn];
|
ci = cinfo->MCU_membership[blkn];
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
if (! encode_one_block(&state,
|
if (! encode_one_block(&state,
|
||||||
MCU_data[blkn][0], state.cur.last_dc_val[ci],
|
MCU_data[blkn][0], state.cur.last_dc_val[ci],
|
||||||
entropy->dc_derived_tbls[compptr->dc_tbl_no],
|
entropy->dc_derived_tbls[compptr->dc_tbl_no],
|
||||||
entropy->ac_derived_tbls[compptr->ac_tbl_no]))
|
entropy->ac_derived_tbls[compptr->ac_tbl_no]))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* Update last_dc_val */
|
/* Update last_dc_val */
|
||||||
state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
|
state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
|
||||||
@ -570,7 +570,7 @@ finish_pass_huff (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
||||||
long dc_counts[], long ac_counts[])
|
long dc_counts[], long ac_counts[])
|
||||||
{
|
{
|
||||||
register int temp;
|
register int temp;
|
||||||
register int nbits;
|
register int nbits;
|
||||||
@ -607,21 +607,21 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
|||||||
} else {
|
} else {
|
||||||
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
|
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
|
||||||
while (r > 15) {
|
while (r > 15) {
|
||||||
ac_counts[0xF0]++;
|
ac_counts[0xF0]++;
|
||||||
r -= 16;
|
r -= 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the number of bits needed for the magnitude of the coefficient */
|
/* Find the number of bits needed for the magnitude of the coefficient */
|
||||||
if (temp < 0)
|
if (temp < 0)
|
||||||
temp = -temp;
|
temp = -temp;
|
||||||
|
|
||||||
/* Find the number of bits needed for the magnitude of the coefficient */
|
/* Find the number of bits needed for the magnitude of the coefficient */
|
||||||
nbits = 1; /* there must be at least one 1 bit */
|
nbits = 1; /* there must be at least one 1 bit */
|
||||||
while ((temp >>= 1))
|
while ((temp >>= 1))
|
||||||
nbits++;
|
nbits++;
|
||||||
/* Check for out-of-range coefficient values */
|
/* Check for out-of-range coefficient values */
|
||||||
if (nbits > MAX_COEF_BITS)
|
if (nbits > MAX_COEF_BITS)
|
||||||
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
|
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
|
||||||
|
|
||||||
/* Count Huffman symbol for run length / number of bits */
|
/* Count Huffman symbol for run length / number of bits */
|
||||||
ac_counts[(r << 4) + nbits]++;
|
ac_counts[(r << 4) + nbits]++;
|
||||||
@ -653,7 +653,7 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
if (entropy->restarts_to_go == 0) {
|
if (entropy->restarts_to_go == 0) {
|
||||||
/* Re-initialize DC predictions to 0 */
|
/* Re-initialize DC predictions to 0 */
|
||||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++)
|
for (ci = 0; ci < cinfo->comps_in_scan; ci++)
|
||||||
entropy->saved.last_dc_val[ci] = 0;
|
entropy->saved.last_dc_val[ci] = 0;
|
||||||
/* Update restart state */
|
/* Update restart state */
|
||||||
entropy->restarts_to_go = cinfo->restart_interval;
|
entropy->restarts_to_go = cinfo->restart_interval;
|
||||||
}
|
}
|
||||||
@ -664,8 +664,8 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
ci = cinfo->MCU_membership[blkn];
|
ci = cinfo->MCU_membership[blkn];
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci],
|
htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci],
|
||||||
entropy->dc_count_ptrs[compptr->dc_tbl_no],
|
entropy->dc_count_ptrs[compptr->dc_tbl_no],
|
||||||
entropy->ac_count_ptrs[compptr->ac_tbl_no]);
|
entropy->ac_count_ptrs[compptr->ac_tbl_no]);
|
||||||
entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0];
|
entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,8 +734,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
|||||||
v = 1000000000L;
|
v = 1000000000L;
|
||||||
for (i = 0; i <= 256; i++) {
|
for (i = 0; i <= 256; i++) {
|
||||||
if (freq[i] && freq[i] <= v) {
|
if (freq[i] && freq[i] <= v) {
|
||||||
v = freq[i];
|
v = freq[i];
|
||||||
c1 = i;
|
c1 = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,8 +745,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
|||||||
v = 1000000000L;
|
v = 1000000000L;
|
||||||
for (i = 0; i <= 256; i++) {
|
for (i = 0; i <= 256; i++) {
|
||||||
if (freq[i] && freq[i] <= v && i != c1) {
|
if (freq[i] && freq[i] <= v && i != c1) {
|
||||||
v = freq[i];
|
v = freq[i];
|
||||||
c2 = i;
|
c2 = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
|||||||
/* The JPEG standard seems to think that this can't happen, */
|
/* The JPEG standard seems to think that this can't happen, */
|
||||||
/* but I'm paranoid... */
|
/* but I'm paranoid... */
|
||||||
if (codesize[i] > MAX_CLEN)
|
if (codesize[i] > MAX_CLEN)
|
||||||
ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
|
ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
|
||||||
|
|
||||||
bits[codesize[i]]++;
|
bits[codesize[i]]++;
|
||||||
}
|
}
|
||||||
@ -802,7 +802,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
|||||||
while (bits[i] > 0) {
|
while (bits[i] > 0) {
|
||||||
j = i - 2; /* find length of new prefix to be used */
|
j = i - 2; /* find length of new prefix to be used */
|
||||||
while (bits[j] == 0)
|
while (bits[j] == 0)
|
||||||
j--;
|
j--;
|
||||||
|
|
||||||
bits[i] -= 2; /* remove two symbols */
|
bits[i] -= 2; /* remove two symbols */
|
||||||
bits[i-1]++; /* one goes in this length */
|
bits[i-1]++; /* one goes in this length */
|
||||||
@ -827,8 +827,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
|||||||
for (i = 1; i <= MAX_CLEN; i++) {
|
for (i = 1; i <= MAX_CLEN; i++) {
|
||||||
for (j = 0; j <= 255; j++) {
|
for (j = 0; j <= 255; j++) {
|
||||||
if (codesize[j] == i) {
|
if (codesize[j] == i) {
|
||||||
htbl->huffval[p] = (UINT8) j;
|
htbl->huffval[p] = (UINT8) j;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -865,14 +865,14 @@ finish_pass_gather (j_compress_ptr cinfo)
|
|||||||
if (! did_dc[dctbl]) {
|
if (! did_dc[dctbl]) {
|
||||||
htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl];
|
htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl];
|
||||||
if (*htblptr == NULL)
|
if (*htblptr == NULL)
|
||||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
||||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
|
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
|
||||||
did_dc[dctbl] = TRUE;
|
did_dc[dctbl] = TRUE;
|
||||||
}
|
}
|
||||||
if (! did_ac[actbl]) {
|
if (! did_ac[actbl]) {
|
||||||
htblptr = & cinfo->ac_huff_tbl_ptrs[actbl];
|
htblptr = & cinfo->ac_huff_tbl_ptrs[actbl];
|
||||||
if (*htblptr == NULL)
|
if (*htblptr == NULL)
|
||||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
||||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
|
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
|
||||||
did_ac[actbl] = TRUE;
|
did_ac[actbl] = TRUE;
|
||||||
}
|
}
|
||||||
@ -895,7 +895,7 @@ jinit_huff_encoder (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
entropy = (huff_entropy_ptr)
|
entropy = (huff_entropy_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(huff_entropy_encoder));
|
SIZEOF(huff_entropy_encoder));
|
||||||
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
|
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
|
||||||
entropy->pub.start_pass = start_pass_huff;
|
entropy->pub.start_pass = start_pass_huff;
|
||||||
|
|
||||||
|
6
3rdparty/libjpeg/jchuff.h
vendored
6
3rdparty/libjpeg/jchuff.h
vendored
@ -39,9 +39,9 @@ typedef struct {
|
|||||||
|
|
||||||
/* Expand a Huffman table definition into the derived format */
|
/* Expand a Huffman table definition into the derived format */
|
||||||
EXTERN(void) jpeg_make_c_derived_tbl
|
EXTERN(void) jpeg_make_c_derived_tbl
|
||||||
JPP((j_compress_ptr cinfo, boolean isDC, int tblno,
|
JPP((j_compress_ptr cinfo, boolean isDC, int tblno,
|
||||||
c_derived_tbl ** pdtbl));
|
c_derived_tbl ** pdtbl));
|
||||||
|
|
||||||
/* Generate an optimal table definition given the specified counts */
|
/* Generate an optimal table definition given the specified counts */
|
||||||
EXTERN(void) jpeg_gen_optimal_table
|
EXTERN(void) jpeg_gen_optimal_table
|
||||||
JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]));
|
JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]));
|
||||||
|
2
3rdparty/libjpeg/jcinit.c
vendored
2
3rdparty/libjpeg/jcinit.c
vendored
@ -56,7 +56,7 @@ jinit_compress_master (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
/* Need a full-image coefficient buffer in any multi-pass mode. */
|
/* Need a full-image coefficient buffer in any multi-pass mode. */
|
||||||
jinit_c_coef_controller(cinfo,
|
jinit_c_coef_controller(cinfo,
|
||||||
(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
|
(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
|
||||||
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
|
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
|
||||||
|
|
||||||
jinit_marker_writer(cinfo);
|
jinit_marker_writer(cinfo);
|
||||||
|
96
3rdparty/libjpeg/jcmainct.c
vendored
96
3rdparty/libjpeg/jcmainct.c
vendored
@ -52,12 +52,12 @@ typedef my_main_controller * my_main_ptr;
|
|||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
METHODDEF(void) process_data_simple_main
|
METHODDEF(void) process_data_simple_main
|
||||||
JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
|
JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
|
||||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||||
METHODDEF(void) process_data_buffer_main
|
METHODDEF(void) process_data_buffer_main
|
||||||
JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
||||||
JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
|
JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
process_data_simple_main (j_compress_ptr cinfo,
|
process_data_simple_main (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||||
JDIMENSION in_rows_avail)
|
JDIMENSION in_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
@ -120,9 +120,9 @@ process_data_simple_main (j_compress_ptr cinfo,
|
|||||||
/* Read input data if we haven't filled the main_ptr buffer yet */
|
/* Read input data if we haven't filled the main_ptr buffer yet */
|
||||||
if (main_ptr->rowgroup_ctr < DCTSIZE)
|
if (main_ptr->rowgroup_ctr < DCTSIZE)
|
||||||
(*cinfo->prep->pre_process_data) (cinfo,
|
(*cinfo->prep->pre_process_data) (cinfo,
|
||||||
input_buf, in_row_ctr, in_rows_avail,
|
input_buf, in_row_ctr, in_rows_avail,
|
||||||
main_ptr->buffer, &main_ptr->rowgroup_ctr,
|
main_ptr->buffer, &main_ptr->rowgroup_ctr,
|
||||||
(JDIMENSION) DCTSIZE);
|
(JDIMENSION) DCTSIZE);
|
||||||
|
|
||||||
/* If we don't have a full iMCU row buffered, return to application for
|
/* If we don't have a full iMCU row buffered, return to application for
|
||||||
* more data. Note that preprocessor will always pad to fill the iMCU row
|
* more data. Note that preprocessor will always pad to fill the iMCU row
|
||||||
@ -140,8 +140,8 @@ process_data_simple_main (j_compress_ptr cinfo,
|
|||||||
* think we were done.
|
* think we were done.
|
||||||
*/
|
*/
|
||||||
if (! main_ptr->suspended) {
|
if (! main_ptr->suspended) {
|
||||||
(*in_row_ctr)--;
|
(*in_row_ctr)--;
|
||||||
main_ptr->suspended = TRUE;
|
main_ptr->suspended = TRUE;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -167,8 +167,8 @@ process_data_simple_main (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
process_data_buffer_main (j_compress_ptr cinfo,
|
process_data_buffer_main (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||||
JDIMENSION in_rows_avail)
|
JDIMENSION in_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
|
||||||
int ci;
|
int ci;
|
||||||
@ -179,16 +179,16 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
|||||||
/* Realign the virtual buffers if at the start of an iMCU row. */
|
/* Realign the virtual buffers if at the start of an iMCU row. */
|
||||||
if (main_ptr->rowgroup_ctr == 0) {
|
if (main_ptr->rowgroup_ctr == 0) {
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main_ptr->buffer[ci] = (*cinfo->mem->access_virt_sarray)
|
main_ptr->buffer[ci] = (*cinfo->mem->access_virt_sarray)
|
||||||
((j_common_ptr) cinfo, main_ptr->whole_image[ci],
|
((j_common_ptr) cinfo, main_ptr->whole_image[ci],
|
||||||
main_ptr->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
|
main_ptr->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
|
||||||
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
|
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
|
||||||
}
|
}
|
||||||
/* In a read pass, pretend we just read some source data. */
|
/* In a read pass, pretend we just read some source data. */
|
||||||
if (! writing) {
|
if (! writing) {
|
||||||
*in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
|
*in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
|
||||||
main_ptr->rowgroup_ctr = DCTSIZE;
|
main_ptr->rowgroup_ctr = DCTSIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,35 +196,35 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
|||||||
/* Note: preprocessor will pad if necessary to fill the last iMCU row. */
|
/* Note: preprocessor will pad if necessary to fill the last iMCU row. */
|
||||||
if (writing) {
|
if (writing) {
|
||||||
(*cinfo->prep->pre_process_data) (cinfo,
|
(*cinfo->prep->pre_process_data) (cinfo,
|
||||||
input_buf, in_row_ctr, in_rows_avail,
|
input_buf, in_row_ctr, in_rows_avail,
|
||||||
main_ptr->buffer, &main_ptr->rowgroup_ctr,
|
main_ptr->buffer, &main_ptr->rowgroup_ctr,
|
||||||
(JDIMENSION) DCTSIZE);
|
(JDIMENSION) DCTSIZE);
|
||||||
/* Return to application if we need more data to fill the iMCU row. */
|
/* Return to application if we need more data to fill the iMCU row. */
|
||||||
if (main_ptr->rowgroup_ctr < DCTSIZE)
|
if (main_ptr->rowgroup_ctr < DCTSIZE)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Emit data, unless this is a sink-only pass. */
|
/* Emit data, unless this is a sink-only pass. */
|
||||||
if (main_ptr->pass_mode != JBUF_SAVE_SOURCE) {
|
if (main_ptr->pass_mode != JBUF_SAVE_SOURCE) {
|
||||||
if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) {
|
if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) {
|
||||||
/* If compressor did not consume the whole row, then we must need to
|
/* If compressor did not consume the whole row, then we must need to
|
||||||
* suspend processing and return to the application. In this situation
|
* suspend processing and return to the application. In this situation
|
||||||
* we pretend we didn't yet consume the last input row; otherwise, if
|
* we pretend we didn't yet consume the last input row; otherwise, if
|
||||||
* it happened to be the last row of the image, the application would
|
* it happened to be the last row of the image, the application would
|
||||||
* think we were done.
|
* think we were done.
|
||||||
*/
|
*/
|
||||||
if (! main_ptr->suspended) {
|
if (! main_ptr->suspended) {
|
||||||
(*in_row_ctr)--;
|
(*in_row_ctr)--;
|
||||||
main_ptr->suspended = TRUE;
|
main_ptr->suspended = TRUE;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* We did finish the row. Undo our little suspension hack if a previous
|
/* We did finish the row. Undo our little suspension hack if a previous
|
||||||
* call suspended; then mark the main_ptr buffer empty.
|
* call suspended; then mark the main_ptr buffer empty.
|
||||||
*/
|
*/
|
||||||
if (main_ptr->suspended) {
|
if (main_ptr->suspended) {
|
||||||
(*in_row_ctr)++;
|
(*in_row_ctr)++;
|
||||||
main_ptr->suspended = FALSE;
|
main_ptr->suspended = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
|
|
||||||
main_ptr = (my_main_ptr)
|
main_ptr = (my_main_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_main_controller));
|
SIZEOF(my_main_controller));
|
||||||
cinfo->main = (struct jpeg_c_main_controller *) main_ptr;
|
cinfo->main = (struct jpeg_c_main_controller *) main_ptr;
|
||||||
main_ptr->pub.start_pass = start_pass_main;
|
main_ptr->pub.start_pass = start_pass_main;
|
||||||
|
|
||||||
@ -266,13 +266,13 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
/* Allocate a full-image virtual array for each component */
|
/* Allocate a full-image virtual array for each component */
|
||||||
/* Note we pad the bottom to a multiple of the iMCU height */
|
/* Note we pad the bottom to a multiple of the iMCU height */
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main_ptr->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
|
main_ptr->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
||||||
compptr->width_in_blocks * DCTSIZE,
|
compptr->width_in_blocks * DCTSIZE,
|
||||||
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
||||||
(long) compptr->v_samp_factor) * DCTSIZE,
|
(long) compptr->v_samp_factor) * DCTSIZE,
|
||||||
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
|
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
@ -283,11 +283,11 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
#endif
|
#endif
|
||||||
/* Allocate a strip buffer for each component */
|
/* Allocate a strip buffer for each component */
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
compptr->width_in_blocks * DCTSIZE,
|
compptr->width_in_blocks * DCTSIZE,
|
||||||
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
|
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
40
3rdparty/libjpeg/jcmarker.c
vendored
40
3rdparty/libjpeg/jcmarker.c
vendored
@ -169,7 +169,7 @@ emit_dqt (j_compress_ptr cinfo, int index)
|
|||||||
/* The table entries must be emitted in zigzag order. */
|
/* The table entries must be emitted in zigzag order. */
|
||||||
unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
|
unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
|
||||||
if (prec)
|
if (prec)
|
||||||
emit_byte(cinfo, (int) (qval >> 8));
|
emit_byte(cinfo, (int) (qval >> 8));
|
||||||
emit_byte(cinfo, (int) (qval & 0xFF));
|
emit_byte(cinfo, (int) (qval & 0xFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,11 +329,11 @@ emit_sos (j_compress_ptr cinfo)
|
|||||||
* but does not seem to be specified in the standard.
|
* but does not seem to be specified in the standard.
|
||||||
*/
|
*/
|
||||||
if (cinfo->Ss == 0) {
|
if (cinfo->Ss == 0) {
|
||||||
ta = 0; /* DC scan */
|
ta = 0; /* DC scan */
|
||||||
if (cinfo->Ah != 0 && !cinfo->arith_code)
|
if (cinfo->Ah != 0 && !cinfo->arith_code)
|
||||||
td = 0; /* no DC table either */
|
td = 0; /* no DC table either */
|
||||||
} else {
|
} else {
|
||||||
td = 0; /* AC scan */
|
td = 0; /* AC scan */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit_byte(cinfo, (td << 4) + ta);
|
emit_byte(cinfo, (td << 4) + ta);
|
||||||
@ -516,9 +516,9 @@ write_frame_header (j_compress_ptr cinfo)
|
|||||||
} else {
|
} else {
|
||||||
is_baseline = TRUE;
|
is_baseline = TRUE;
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
|
if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
|
||||||
is_baseline = FALSE;
|
is_baseline = FALSE;
|
||||||
}
|
}
|
||||||
if (prec && is_baseline) {
|
if (prec && is_baseline) {
|
||||||
is_baseline = FALSE;
|
is_baseline = FALSE;
|
||||||
@ -567,17 +567,17 @@ write_scan_header (j_compress_ptr cinfo)
|
|||||||
for (i = 0; i < cinfo->comps_in_scan; i++) {
|
for (i = 0; i < cinfo->comps_in_scan; i++) {
|
||||||
compptr = cinfo->cur_comp_info[i];
|
compptr = cinfo->cur_comp_info[i];
|
||||||
if (cinfo->progressive_mode) {
|
if (cinfo->progressive_mode) {
|
||||||
/* Progressive mode: only DC or only AC tables are used in one scan */
|
/* Progressive mode: only DC or only AC tables are used in one scan */
|
||||||
if (cinfo->Ss == 0) {
|
if (cinfo->Ss == 0) {
|
||||||
if (cinfo->Ah == 0) /* DC needs no table for refinement scan */
|
if (cinfo->Ah == 0) /* DC needs no table for refinement scan */
|
||||||
emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
|
emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
|
||||||
} else {
|
} else {
|
||||||
emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
|
emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Sequential mode: need both DC and AC tables */
|
/* Sequential mode: need both DC and AC tables */
|
||||||
emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
|
emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
|
||||||
emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
|
emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -627,9 +627,9 @@ write_tables_only (j_compress_ptr cinfo)
|
|||||||
if (! cinfo->arith_code) {
|
if (! cinfo->arith_code) {
|
||||||
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
||||||
if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
|
if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
|
||||||
emit_dht(cinfo, i, FALSE);
|
emit_dht(cinfo, i, FALSE);
|
||||||
if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
|
if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
|
||||||
emit_dht(cinfo, i, TRUE);
|
emit_dht(cinfo, i, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,7 +649,7 @@ jinit_marker_writer (j_compress_ptr cinfo)
|
|||||||
/* Create the subobject */
|
/* Create the subobject */
|
||||||
marker = (my_marker_ptr)
|
marker = (my_marker_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_marker_writer));
|
SIZEOF(my_marker_writer));
|
||||||
cinfo->marker = (struct jpeg_marker_writer *) marker;
|
cinfo->marker = (struct jpeg_marker_writer *) marker;
|
||||||
/* Initialize method pointers */
|
/* Initialize method pointers */
|
||||||
marker->pub.write_file_header = write_file_header;
|
marker->pub.write_file_header = write_file_header;
|
||||||
|
106
3rdparty/libjpeg/jcmaster.c
vendored
106
3rdparty/libjpeg/jcmaster.c
vendored
@ -19,9 +19,9 @@
|
|||||||
/* Private state */
|
/* Private state */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
main_pass, /* input data, also do first output step */
|
main_pass, /* input data, also do first output step */
|
||||||
huff_opt_pass, /* Huffman code optimization pass */
|
huff_opt_pass, /* Huffman code optimization pass */
|
||||||
output_pass /* data output pass */
|
output_pass /* data output pass */
|
||||||
} c_pass_type;
|
} c_pass_type;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -74,7 +74,7 @@ initial_setup (j_compress_ptr cinfo)
|
|||||||
/* Check that number of components won't exceed internal array sizes */
|
/* Check that number of components won't exceed internal array sizes */
|
||||||
if (cinfo->num_components > MAX_COMPONENTS)
|
if (cinfo->num_components > MAX_COMPONENTS)
|
||||||
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
|
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
|
||||||
MAX_COMPONENTS);
|
MAX_COMPONENTS);
|
||||||
|
|
||||||
/* Compute maximum sampling factors; check factor validity */
|
/* Compute maximum sampling factors; check factor validity */
|
||||||
cinfo->max_h_samp_factor = 1;
|
cinfo->max_h_samp_factor = 1;
|
||||||
@ -82,12 +82,12 @@ initial_setup (j_compress_ptr cinfo)
|
|||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
|
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
|
||||||
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
|
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
|
||||||
ERREXIT(cinfo, JERR_BAD_SAMPLING);
|
ERREXIT(cinfo, JERR_BAD_SAMPLING);
|
||||||
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
|
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
|
||||||
compptr->h_samp_factor);
|
compptr->h_samp_factor);
|
||||||
cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
|
cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
|
||||||
compptr->v_samp_factor);
|
compptr->v_samp_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute dimensions of components */
|
/* Compute dimensions of components */
|
||||||
@ -100,17 +100,17 @@ initial_setup (j_compress_ptr cinfo)
|
|||||||
/* Size in DCT blocks */
|
/* Size in DCT blocks */
|
||||||
compptr->width_in_blocks = (JDIMENSION)
|
compptr->width_in_blocks = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
||||||
(long) (cinfo->max_h_samp_factor * DCTSIZE));
|
(long) (cinfo->max_h_samp_factor * DCTSIZE));
|
||||||
compptr->height_in_blocks = (JDIMENSION)
|
compptr->height_in_blocks = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
||||||
(long) (cinfo->max_v_samp_factor * DCTSIZE));
|
(long) (cinfo->max_v_samp_factor * DCTSIZE));
|
||||||
/* Size in samples */
|
/* Size in samples */
|
||||||
compptr->downsampled_width = (JDIMENSION)
|
compptr->downsampled_width = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
||||||
(long) cinfo->max_h_samp_factor);
|
(long) cinfo->max_h_samp_factor);
|
||||||
compptr->downsampled_height = (JDIMENSION)
|
compptr->downsampled_height = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
||||||
(long) cinfo->max_v_samp_factor);
|
(long) cinfo->max_v_samp_factor);
|
||||||
/* Mark component needed (this flag isn't actually used for compression) */
|
/* Mark component needed (this flag isn't actually used for compression) */
|
||||||
compptr->component_needed = TRUE;
|
compptr->component_needed = TRUE;
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ initial_setup (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
cinfo->total_iMCU_rows = (JDIMENSION)
|
cinfo->total_iMCU_rows = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_height,
|
jdiv_round_up((long) cinfo->image_height,
|
||||||
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ validate_script (j_compress_ptr cinfo)
|
|||||||
last_bitpos_ptr = & last_bitpos[0][0];
|
last_bitpos_ptr = & last_bitpos[0][0];
|
||||||
for (ci = 0; ci < cinfo->num_components; ci++)
|
for (ci = 0; ci < cinfo->num_components; ci++)
|
||||||
for (coefi = 0; coefi < DCTSIZE2; coefi++)
|
for (coefi = 0; coefi < DCTSIZE2; coefi++)
|
||||||
*last_bitpos_ptr++ = -1;
|
*last_bitpos_ptr++ = -1;
|
||||||
#else
|
#else
|
||||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||||
#endif
|
#endif
|
||||||
@ -173,10 +173,10 @@ validate_script (j_compress_ptr cinfo)
|
|||||||
for (ci = 0; ci < ncomps; ci++) {
|
for (ci = 0; ci < ncomps; ci++) {
|
||||||
thisi = scanptr->component_index[ci];
|
thisi = scanptr->component_index[ci];
|
||||||
if (thisi < 0 || thisi >= cinfo->num_components)
|
if (thisi < 0 || thisi >= cinfo->num_components)
|
||||||
ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
|
||||||
/* Components must appear in SOF order within each scan */
|
/* Components must appear in SOF order within each scan */
|
||||||
if (ci > 0 && thisi <= scanptr->component_index[ci-1])
|
if (ci > 0 && thisi <= scanptr->component_index[ci-1])
|
||||||
ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
|
||||||
}
|
}
|
||||||
/* Validate progression parameters */
|
/* Validate progression parameters */
|
||||||
Ss = scanptr->Ss;
|
Ss = scanptr->Ss;
|
||||||
@ -198,43 +198,43 @@ validate_script (j_compress_ptr cinfo)
|
|||||||
#define MAX_AH_AL 13
|
#define MAX_AH_AL 13
|
||||||
#endif
|
#endif
|
||||||
if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
|
if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
|
||||||
Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)
|
Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
if (Ss == 0) {
|
if (Ss == 0) {
|
||||||
if (Se != 0) /* DC and AC together not OK */
|
if (Se != 0) /* DC and AC together not OK */
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
} else {
|
} else {
|
||||||
if (ncomps != 1) /* AC scans must be for only one component */
|
if (ncomps != 1) /* AC scans must be for only one component */
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
}
|
}
|
||||||
for (ci = 0; ci < ncomps; ci++) {
|
for (ci = 0; ci < ncomps; ci++) {
|
||||||
last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0];
|
last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0];
|
||||||
if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
|
if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
for (coefi = Ss; coefi <= Se; coefi++) {
|
for (coefi = Ss; coefi <= Se; coefi++) {
|
||||||
if (last_bitpos_ptr[coefi] < 0) {
|
if (last_bitpos_ptr[coefi] < 0) {
|
||||||
/* first scan of this coefficient */
|
/* first scan of this coefficient */
|
||||||
if (Ah != 0)
|
if (Ah != 0)
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
} else {
|
} else {
|
||||||
/* not first scan */
|
/* not first scan */
|
||||||
if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)
|
if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
}
|
}
|
||||||
last_bitpos_ptr[coefi] = Al;
|
last_bitpos_ptr[coefi] = Al;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* For sequential JPEG, all progression parameters must be these: */
|
/* For sequential JPEG, all progression parameters must be these: */
|
||||||
if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
|
if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
/* Make sure components are not sent twice */
|
/* Make sure components are not sent twice */
|
||||||
for (ci = 0; ci < ncomps; ci++) {
|
for (ci = 0; ci < ncomps; ci++) {
|
||||||
thisi = scanptr->component_index[ci];
|
thisi = scanptr->component_index[ci];
|
||||||
if (component_sent[thisi])
|
if (component_sent[thisi])
|
||||||
ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
|
||||||
component_sent[thisi] = TRUE;
|
component_sent[thisi] = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,13 +249,13 @@ validate_script (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||||
if (last_bitpos[ci][0] < 0)
|
if (last_bitpos[ci][0] < 0)
|
||||||
ERREXIT(cinfo, JERR_MISSING_DATA);
|
ERREXIT(cinfo, JERR_MISSING_DATA);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||||
if (! component_sent[ci])
|
if (! component_sent[ci])
|
||||||
ERREXIT(cinfo, JERR_MISSING_DATA);
|
ERREXIT(cinfo, JERR_MISSING_DATA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ select_scan_parameters (j_compress_ptr cinfo)
|
|||||||
cinfo->comps_in_scan = scanptr->comps_in_scan;
|
cinfo->comps_in_scan = scanptr->comps_in_scan;
|
||||||
for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
|
for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
|
||||||
cinfo->cur_comp_info[ci] =
|
cinfo->cur_comp_info[ci] =
|
||||||
&cinfo->comp_info[scanptr->component_index[ci]];
|
&cinfo->comp_info[scanptr->component_index[ci]];
|
||||||
}
|
}
|
||||||
cinfo->Ss = scanptr->Ss;
|
cinfo->Ss = scanptr->Ss;
|
||||||
cinfo->Se = scanptr->Se;
|
cinfo->Se = scanptr->Se;
|
||||||
@ -291,7 +291,7 @@ select_scan_parameters (j_compress_ptr cinfo)
|
|||||||
/* Prepare for single sequential-JPEG scan containing all components */
|
/* Prepare for single sequential-JPEG scan containing all components */
|
||||||
if (cinfo->num_components > MAX_COMPS_IN_SCAN)
|
if (cinfo->num_components > MAX_COMPS_IN_SCAN)
|
||||||
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
|
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
|
||||||
MAX_COMPS_IN_SCAN);
|
MAX_COMPS_IN_SCAN);
|
||||||
cinfo->comps_in_scan = cinfo->num_components;
|
cinfo->comps_in_scan = cinfo->num_components;
|
||||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||||
cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
|
cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
|
||||||
@ -343,15 +343,15 @@ per_scan_setup (j_compress_ptr cinfo)
|
|||||||
/* Interleaved (multi-component) scan */
|
/* Interleaved (multi-component) scan */
|
||||||
if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
|
if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
|
||||||
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
|
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
|
||||||
MAX_COMPS_IN_SCAN);
|
MAX_COMPS_IN_SCAN);
|
||||||
|
|
||||||
/* Overall image size in MCUs */
|
/* Overall image size in MCUs */
|
||||||
cinfo->MCUs_per_row = (JDIMENSION)
|
cinfo->MCUs_per_row = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_width,
|
jdiv_round_up((long) cinfo->image_width,
|
||||||
(long) (cinfo->max_h_samp_factor*DCTSIZE));
|
(long) (cinfo->max_h_samp_factor*DCTSIZE));
|
||||||
cinfo->MCU_rows_in_scan = (JDIMENSION)
|
cinfo->MCU_rows_in_scan = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_height,
|
jdiv_round_up((long) cinfo->image_height,
|
||||||
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
||||||
|
|
||||||
cinfo->blocks_in_MCU = 0;
|
cinfo->blocks_in_MCU = 0;
|
||||||
|
|
||||||
@ -372,9 +372,9 @@ per_scan_setup (j_compress_ptr cinfo)
|
|||||||
/* Prepare array describing MCU composition */
|
/* Prepare array describing MCU composition */
|
||||||
mcublks = compptr->MCU_blocks;
|
mcublks = compptr->MCU_blocks;
|
||||||
if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)
|
if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)
|
||||||
ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
|
ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
|
||||||
while (mcublks-- > 0) {
|
while (mcublks-- > 0) {
|
||||||
cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
|
cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,8 +417,8 @@ prepare_for_pass (j_compress_ptr cinfo)
|
|||||||
(*cinfo->fdct->start_pass) (cinfo);
|
(*cinfo->fdct->start_pass) (cinfo);
|
||||||
(*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
|
(*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
|
||||||
(*cinfo->coef->start_pass) (cinfo,
|
(*cinfo->coef->start_pass) (cinfo,
|
||||||
(master->total_passes > 1 ?
|
(master->total_passes > 1 ?
|
||||||
JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
|
JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
|
||||||
(*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
|
(*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
|
||||||
if (cinfo->optimize_coding) {
|
if (cinfo->optimize_coding) {
|
||||||
/* No immediate data output; postpone writing frame/scan headers */
|
/* No immediate data output; postpone writing frame/scan headers */
|
||||||
@ -546,7 +546,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
|
|||||||
|
|
||||||
master = (my_master_ptr)
|
master = (my_master_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_comp_master));
|
SIZEOF(my_comp_master));
|
||||||
cinfo->master = (struct jpeg_comp_master *) master;
|
cinfo->master = (struct jpeg_comp_master *) master;
|
||||||
master->pub.prepare_for_pass = prepare_for_pass;
|
master->pub.prepare_for_pass = prepare_for_pass;
|
||||||
master->pub.pass_startup = pass_startup;
|
master->pub.pass_startup = pass_startup;
|
||||||
|
30
3rdparty/libjpeg/jcparam.c
vendored
30
3rdparty/libjpeg/jcparam.c
vendored
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
|
jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
|
||||||
const unsigned int *basic_table,
|
const unsigned int *basic_table,
|
||||||
int scale_factor, boolean force_baseline)
|
int scale_factor, boolean force_baseline)
|
||||||
/* Define a quantization table equal to the basic_table times
|
/* Define a quantization table equal to the basic_table times
|
||||||
* a scale factor (given as a percentage).
|
* a scale factor (given as a percentage).
|
||||||
* If force_baseline is TRUE, the computed quantization table entries
|
* If force_baseline is TRUE, the computed quantization table entries
|
||||||
@ -62,7 +62,7 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
|
|||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
|
jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
|
||||||
boolean force_baseline)
|
boolean force_baseline)
|
||||||
/* Set or change the 'quality' (quantization) setting, using default tables
|
/* Set or change the 'quality' (quantization) setting, using default tables
|
||||||
* and a straight percentage-scaling quality scale. In most cases it's better
|
* and a straight percentage-scaling quality scale. In most cases it's better
|
||||||
* to use jpeg_set_quality (below); this entry point is provided for
|
* to use jpeg_set_quality (below); this entry point is provided for
|
||||||
@ -96,9 +96,9 @@ jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
|
|||||||
|
|
||||||
/* Set up two quantization tables using the specified scaling */
|
/* Set up two quantization tables using the specified scaling */
|
||||||
jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
|
jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
|
||||||
scale_factor, force_baseline);
|
scale_factor, force_baseline);
|
||||||
jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
|
jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
|
||||||
scale_factor, force_baseline);
|
scale_factor, force_baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
|
|||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
add_huff_table (j_compress_ptr cinfo,
|
add_huff_table (j_compress_ptr cinfo,
|
||||||
JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
|
JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
|
||||||
/* Define a Huffman table */
|
/* Define a Huffman table */
|
||||||
{
|
{
|
||||||
int nsymbols, len;
|
int nsymbols, len;
|
||||||
@ -244,13 +244,13 @@ std_huff_tables (j_compress_ptr cinfo)
|
|||||||
0xf9, 0xfa };
|
0xf9, 0xfa };
|
||||||
|
|
||||||
add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
|
add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
|
||||||
bits_dc_luminance, val_dc_luminance);
|
bits_dc_luminance, val_dc_luminance);
|
||||||
add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],
|
add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],
|
||||||
bits_ac_luminance, val_ac_luminance);
|
bits_ac_luminance, val_ac_luminance);
|
||||||
add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1],
|
add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1],
|
||||||
bits_dc_chrominance, val_dc_chrominance);
|
bits_dc_chrominance, val_dc_chrominance);
|
||||||
add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
|
add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
|
||||||
bits_ac_chrominance, val_ac_chrominance);
|
bits_ac_chrominance, val_ac_chrominance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ jpeg_set_defaults (j_compress_ptr cinfo)
|
|||||||
if (cinfo->comp_info == NULL)
|
if (cinfo->comp_info == NULL)
|
||||||
cinfo->comp_info = (jpeg_component_info *)
|
cinfo->comp_info = (jpeg_component_info *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||||
MAX_COMPONENTS * SIZEOF(jpeg_component_info));
|
MAX_COMPONENTS * SIZEOF(jpeg_component_info));
|
||||||
|
|
||||||
/* Initialize everything not dependent on the color space */
|
/* Initialize everything not dependent on the color space */
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
|
|||||||
cinfo->num_components = cinfo->input_components;
|
cinfo->num_components = cinfo->input_components;
|
||||||
if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
|
if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
|
||||||
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
|
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
|
||||||
MAX_COMPONENTS);
|
MAX_COMPONENTS);
|
||||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||||
SET_COMP(ci, ci, 1,1, 0, 0,0);
|
SET_COMP(ci, ci, 1,1, 0, 0,0);
|
||||||
}
|
}
|
||||||
@ -473,7 +473,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
|
|||||||
|
|
||||||
LOCAL(jpeg_scan_info *)
|
LOCAL(jpeg_scan_info *)
|
||||||
fill_a_scan (jpeg_scan_info * scanptr, int ci,
|
fill_a_scan (jpeg_scan_info * scanptr, int ci,
|
||||||
int Ss, int Se, int Ah, int Al)
|
int Ss, int Se, int Ah, int Al)
|
||||||
/* Support routine: generate one scan for specified component */
|
/* Support routine: generate one scan for specified component */
|
||||||
{
|
{
|
||||||
scanptr->comps_in_scan = 1;
|
scanptr->comps_in_scan = 1;
|
||||||
@ -488,7 +488,7 @@ fill_a_scan (jpeg_scan_info * scanptr, int ci,
|
|||||||
|
|
||||||
LOCAL(jpeg_scan_info *)
|
LOCAL(jpeg_scan_info *)
|
||||||
fill_scans (jpeg_scan_info * scanptr, int ncomps,
|
fill_scans (jpeg_scan_info * scanptr, int ncomps,
|
||||||
int Ss, int Se, int Ah, int Al)
|
int Ss, int Se, int Ah, int Al)
|
||||||
/* Support routine: generate one scan for each component */
|
/* Support routine: generate one scan for each component */
|
||||||
{
|
{
|
||||||
int ci;
|
int ci;
|
||||||
@ -567,7 +567,7 @@ jpeg_simple_progression (j_compress_ptr cinfo)
|
|||||||
cinfo->script_space_size = MAX(nscans, 10);
|
cinfo->script_space_size = MAX(nscans, 10);
|
||||||
cinfo->script_space = (jpeg_scan_info *)
|
cinfo->script_space = (jpeg_scan_info *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||||
cinfo->script_space_size * SIZEOF(jpeg_scan_info));
|
cinfo->script_space_size * SIZEOF(jpeg_scan_info));
|
||||||
}
|
}
|
||||||
scanptr = cinfo->script_space;
|
scanptr = cinfo->script_space;
|
||||||
cinfo->scan_info = scanptr;
|
cinfo->scan_info = scanptr;
|
||||||
|
42
3rdparty/libjpeg/jcphuff.c
vendored
42
3rdparty/libjpeg/jcphuff.c
vendored
@ -77,9 +77,9 @@ typedef phuff_entropy_encoder * phuff_entropy_ptr;
|
|||||||
#ifdef RIGHT_SHIFT_IS_UNSIGNED
|
#ifdef RIGHT_SHIFT_IS_UNSIGNED
|
||||||
#define ISHIFT_TEMPS int ishift_temp;
|
#define ISHIFT_TEMPS int ishift_temp;
|
||||||
#define IRIGHT_SHIFT(x,shft) \
|
#define IRIGHT_SHIFT(x,shft) \
|
||||||
((ishift_temp = (x)) < 0 ? \
|
((ishift_temp = (x)) < 0 ? \
|
||||||
(ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
|
(ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
|
||||||
(ishift_temp >> (shft)))
|
(ishift_temp >> (shft)))
|
||||||
#else
|
#else
|
||||||
#define ISHIFT_TEMPS
|
#define ISHIFT_TEMPS
|
||||||
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
|
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
|
||||||
@ -87,13 +87,13 @@ typedef phuff_entropy_encoder * phuff_entropy_ptr;
|
|||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
METHODDEF(boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data));
|
JBLOCKROW *MCU_data));
|
||||||
METHODDEF(boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data));
|
JBLOCKROW *MCU_data));
|
||||||
METHODDEF(boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data));
|
JBLOCKROW *MCU_data));
|
||||||
METHODDEF(boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo,
|
METHODDEF(boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo,
|
||||||
JBLOCKROW *MCU_data));
|
JBLOCKROW *MCU_data));
|
||||||
METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo));
|
METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo));
|
||||||
METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo));
|
METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo));
|
||||||
|
|
||||||
@ -130,9 +130,9 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
entropy->pub.encode_mcu = encode_mcu_AC_refine;
|
entropy->pub.encode_mcu = encode_mcu_AC_refine;
|
||||||
/* AC refinement needs a correction bit buffer */
|
/* AC refinement needs a correction bit buffer */
|
||||||
if (entropy->bit_buffer == NULL)
|
if (entropy->bit_buffer == NULL)
|
||||||
entropy->bit_buffer = (char *)
|
entropy->bit_buffer = (char *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
MAX_CORR_BITS * SIZEOF(char));
|
MAX_CORR_BITS * SIZEOF(char));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gather_statistics)
|
if (gather_statistics)
|
||||||
@ -150,7 +150,7 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
/* Get table index */
|
/* Get table index */
|
||||||
if (is_DC_band) {
|
if (is_DC_band) {
|
||||||
if (cinfo->Ah != 0) /* DC refinement needs no table */
|
if (cinfo->Ah != 0) /* DC refinement needs no table */
|
||||||
continue;
|
continue;
|
||||||
tbl = compptr->dc_tbl_no;
|
tbl = compptr->dc_tbl_no;
|
||||||
} else {
|
} else {
|
||||||
entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
|
entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
|
||||||
@ -163,15 +163,15 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
/* Allocate and zero the statistics tables */
|
/* Allocate and zero the statistics tables */
|
||||||
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
||||||
if (entropy->count_ptrs[tbl] == NULL)
|
if (entropy->count_ptrs[tbl] == NULL)
|
||||||
entropy->count_ptrs[tbl] = (long *)
|
entropy->count_ptrs[tbl] = (long *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
257 * SIZEOF(long));
|
257 * SIZEOF(long));
|
||||||
MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long));
|
MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long));
|
||||||
} else {
|
} else {
|
||||||
/* Compute derived values for Huffman table */
|
/* Compute derived values for Huffman table */
|
||||||
/* We may do this more than once for a table, but it's not expensive */
|
/* We may do this more than once for a table, but it's not expensive */
|
||||||
jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl,
|
jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl,
|
||||||
& entropy->derived_tbls[tbl]);
|
& entropy->derived_tbls[tbl]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,9 +196,9 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
|
|||||||
|
|
||||||
/* Emit a byte */
|
/* Emit a byte */
|
||||||
#define emit_byte(entropy,val) \
|
#define emit_byte(entropy,val) \
|
||||||
{ *(entropy)->next_output_byte++ = (JOCTET) (val); \
|
{ *(entropy)->next_output_byte++ = (JOCTET) (val); \
|
||||||
if (--(entropy)->free_in_buffer == 0) \
|
if (--(entropy)->free_in_buffer == 0) \
|
||||||
dump_buffer(entropy); }
|
dump_buffer(entropy); }
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
@ -295,7 +295,7 @@ emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
|
|||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart,
|
emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart,
|
||||||
unsigned int nbits)
|
unsigned int nbits)
|
||||||
{
|
{
|
||||||
if (entropy->gather_statistics)
|
if (entropy->gather_statistics)
|
||||||
return; /* no real work */
|
return; /* no real work */
|
||||||
@ -787,7 +787,7 @@ finish_pass_gather_phuff (j_compress_ptr cinfo)
|
|||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
if (is_DC_band) {
|
if (is_DC_band) {
|
||||||
if (cinfo->Ah != 0) /* DC refinement needs no table */
|
if (cinfo->Ah != 0) /* DC refinement needs no table */
|
||||||
continue;
|
continue;
|
||||||
tbl = compptr->dc_tbl_no;
|
tbl = compptr->dc_tbl_no;
|
||||||
} else {
|
} else {
|
||||||
tbl = compptr->ac_tbl_no;
|
tbl = compptr->ac_tbl_no;
|
||||||
@ -818,7 +818,7 @@ jinit_phuff_encoder (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
entropy = (phuff_entropy_ptr)
|
entropy = (phuff_entropy_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(phuff_entropy_encoder));
|
SIZEOF(phuff_entropy_encoder));
|
||||||
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
|
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
|
||||||
entropy->pub.start_pass = start_pass_phuff;
|
entropy->pub.start_pass = start_pass_phuff;
|
||||||
|
|
||||||
|
114
3rdparty/libjpeg/jcprepct.c
vendored
114
3rdparty/libjpeg/jcprepct.c
vendored
@ -104,13 +104,13 @@ start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
|||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
|
expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
|
||||||
int input_rows, int output_rows)
|
int input_rows, int output_rows)
|
||||||
{
|
{
|
||||||
register int row;
|
register int row;
|
||||||
|
|
||||||
for (row = input_rows; row < output_rows; row++) {
|
for (row = input_rows; row < output_rows; row++) {
|
||||||
jcopy_sample_rows(image_data, input_rows-1, image_data, row,
|
jcopy_sample_rows(image_data, input_rows-1, image_data, row,
|
||||||
1, num_cols);
|
1, num_cols);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,10 +126,10 @@ expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
pre_process_data (j_compress_ptr cinfo,
|
pre_process_data (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||||
JDIMENSION in_rows_avail,
|
JDIMENSION in_rows_avail,
|
||||||
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
|
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
|
||||||
JDIMENSION out_row_groups_avail)
|
JDIMENSION out_row_groups_avail)
|
||||||
{
|
{
|
||||||
my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
|
my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
|
||||||
int numrows, ci;
|
int numrows, ci;
|
||||||
@ -137,32 +137,32 @@ pre_process_data (j_compress_ptr cinfo,
|
|||||||
jpeg_component_info * compptr;
|
jpeg_component_info * compptr;
|
||||||
|
|
||||||
while (*in_row_ctr < in_rows_avail &&
|
while (*in_row_ctr < in_rows_avail &&
|
||||||
*out_row_group_ctr < out_row_groups_avail) {
|
*out_row_group_ctr < out_row_groups_avail) {
|
||||||
/* Do color conversion to fill the conversion buffer. */
|
/* Do color conversion to fill the conversion buffer. */
|
||||||
inrows = in_rows_avail - *in_row_ctr;
|
inrows = in_rows_avail - *in_row_ctr;
|
||||||
numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
|
numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
|
||||||
numrows = (int) MIN((JDIMENSION) numrows, inrows);
|
numrows = (int) MIN((JDIMENSION) numrows, inrows);
|
||||||
(*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
|
(*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
|
||||||
prep->color_buf,
|
prep->color_buf,
|
||||||
(JDIMENSION) prep->next_buf_row,
|
(JDIMENSION) prep->next_buf_row,
|
||||||
numrows);
|
numrows);
|
||||||
*in_row_ctr += numrows;
|
*in_row_ctr += numrows;
|
||||||
prep->next_buf_row += numrows;
|
prep->next_buf_row += numrows;
|
||||||
prep->rows_to_go -= numrows;
|
prep->rows_to_go -= numrows;
|
||||||
/* If at bottom of image, pad to fill the conversion buffer. */
|
/* If at bottom of image, pad to fill the conversion buffer. */
|
||||||
if (prep->rows_to_go == 0 &&
|
if (prep->rows_to_go == 0 &&
|
||||||
prep->next_buf_row < cinfo->max_v_samp_factor) {
|
prep->next_buf_row < cinfo->max_v_samp_factor) {
|
||||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||||
expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
|
expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
|
||||||
prep->next_buf_row, cinfo->max_v_samp_factor);
|
prep->next_buf_row, cinfo->max_v_samp_factor);
|
||||||
}
|
}
|
||||||
prep->next_buf_row = cinfo->max_v_samp_factor;
|
prep->next_buf_row = cinfo->max_v_samp_factor;
|
||||||
}
|
}
|
||||||
/* If we've filled the conversion buffer, empty it. */
|
/* If we've filled the conversion buffer, empty it. */
|
||||||
if (prep->next_buf_row == cinfo->max_v_samp_factor) {
|
if (prep->next_buf_row == cinfo->max_v_samp_factor) {
|
||||||
(*cinfo->downsample->downsample) (cinfo,
|
(*cinfo->downsample->downsample) (cinfo,
|
||||||
prep->color_buf, (JDIMENSION) 0,
|
prep->color_buf, (JDIMENSION) 0,
|
||||||
output_buf, *out_row_group_ctr);
|
output_buf, *out_row_group_ctr);
|
||||||
prep->next_buf_row = 0;
|
prep->next_buf_row = 0;
|
||||||
(*out_row_group_ctr)++;
|
(*out_row_group_ctr)++;
|
||||||
}
|
}
|
||||||
@ -170,13 +170,13 @@ pre_process_data (j_compress_ptr cinfo,
|
|||||||
* Note we assume the caller is providing a one-iMCU-height output buffer!
|
* Note we assume the caller is providing a one-iMCU-height output buffer!
|
||||||
*/
|
*/
|
||||||
if (prep->rows_to_go == 0 &&
|
if (prep->rows_to_go == 0 &&
|
||||||
*out_row_group_ctr < out_row_groups_avail) {
|
*out_row_group_ctr < out_row_groups_avail) {
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
expand_bottom_edge(output_buf[ci],
|
expand_bottom_edge(output_buf[ci],
|
||||||
compptr->width_in_blocks * DCTSIZE,
|
compptr->width_in_blocks * DCTSIZE,
|
||||||
(int) (*out_row_group_ctr * compptr->v_samp_factor),
|
(int) (*out_row_group_ctr * compptr->v_samp_factor),
|
||||||
(int) (out_row_groups_avail * compptr->v_samp_factor));
|
(int) (out_row_groups_avail * compptr->v_samp_factor));
|
||||||
}
|
}
|
||||||
*out_row_group_ctr = out_row_groups_avail;
|
*out_row_group_ctr = out_row_groups_avail;
|
||||||
break; /* can exit outer loop without test */
|
break; /* can exit outer loop without test */
|
||||||
@ -193,10 +193,10 @@ pre_process_data (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
pre_process_context (j_compress_ptr cinfo,
|
pre_process_context (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||||
JDIMENSION in_rows_avail,
|
JDIMENSION in_rows_avail,
|
||||||
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
|
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
|
||||||
JDIMENSION out_row_groups_avail)
|
JDIMENSION out_row_groups_avail)
|
||||||
{
|
{
|
||||||
my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
|
my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
|
||||||
int numrows, ci;
|
int numrows, ci;
|
||||||
@ -210,19 +210,19 @@ pre_process_context (j_compress_ptr cinfo,
|
|||||||
numrows = prep->next_buf_stop - prep->next_buf_row;
|
numrows = prep->next_buf_stop - prep->next_buf_row;
|
||||||
numrows = (int) MIN((JDIMENSION) numrows, inrows);
|
numrows = (int) MIN((JDIMENSION) numrows, inrows);
|
||||||
(*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
|
(*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
|
||||||
prep->color_buf,
|
prep->color_buf,
|
||||||
(JDIMENSION) prep->next_buf_row,
|
(JDIMENSION) prep->next_buf_row,
|
||||||
numrows);
|
numrows);
|
||||||
/* Pad at top of image, if first time through */
|
/* Pad at top of image, if first time through */
|
||||||
if (prep->rows_to_go == cinfo->image_height) {
|
if (prep->rows_to_go == cinfo->image_height) {
|
||||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||||
int row;
|
int row;
|
||||||
for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
|
for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
|
||||||
jcopy_sample_rows(prep->color_buf[ci], 0,
|
jcopy_sample_rows(prep->color_buf[ci], 0,
|
||||||
prep->color_buf[ci], -row,
|
prep->color_buf[ci], -row,
|
||||||
1, cinfo->image_width);
|
1, cinfo->image_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*in_row_ctr += numrows;
|
*in_row_ctr += numrows;
|
||||||
prep->next_buf_row += numrows;
|
prep->next_buf_row += numrows;
|
||||||
@ -230,29 +230,29 @@ pre_process_context (j_compress_ptr cinfo,
|
|||||||
} else {
|
} else {
|
||||||
/* Return for more data, unless we are at the bottom of the image. */
|
/* Return for more data, unless we are at the bottom of the image. */
|
||||||
if (prep->rows_to_go != 0)
|
if (prep->rows_to_go != 0)
|
||||||
break;
|
break;
|
||||||
/* When at bottom of image, pad to fill the conversion buffer. */
|
/* When at bottom of image, pad to fill the conversion buffer. */
|
||||||
if (prep->next_buf_row < prep->next_buf_stop) {
|
if (prep->next_buf_row < prep->next_buf_stop) {
|
||||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||||
expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
|
expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
|
||||||
prep->next_buf_row, prep->next_buf_stop);
|
prep->next_buf_row, prep->next_buf_stop);
|
||||||
}
|
}
|
||||||
prep->next_buf_row = prep->next_buf_stop;
|
prep->next_buf_row = prep->next_buf_stop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If we've gotten enough data, downsample a row group. */
|
/* If we've gotten enough data, downsample a row group. */
|
||||||
if (prep->next_buf_row == prep->next_buf_stop) {
|
if (prep->next_buf_row == prep->next_buf_stop) {
|
||||||
(*cinfo->downsample->downsample) (cinfo,
|
(*cinfo->downsample->downsample) (cinfo,
|
||||||
prep->color_buf,
|
prep->color_buf,
|
||||||
(JDIMENSION) prep->this_row_group,
|
(JDIMENSION) prep->this_row_group,
|
||||||
output_buf, *out_row_group_ctr);
|
output_buf, *out_row_group_ctr);
|
||||||
(*out_row_group_ctr)++;
|
(*out_row_group_ctr)++;
|
||||||
/* Advance pointers with wraparound as necessary. */
|
/* Advance pointers with wraparound as necessary. */
|
||||||
prep->this_row_group += cinfo->max_v_samp_factor;
|
prep->this_row_group += cinfo->max_v_samp_factor;
|
||||||
if (prep->this_row_group >= buf_height)
|
if (prep->this_row_group >= buf_height)
|
||||||
prep->this_row_group = 0;
|
prep->this_row_group = 0;
|
||||||
if (prep->next_buf_row >= buf_height)
|
if (prep->next_buf_row >= buf_height)
|
||||||
prep->next_buf_row = 0;
|
prep->next_buf_row = 0;
|
||||||
prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor;
|
prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,8 +277,8 @@ create_context_buffer (j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
fake_buffer = (JSAMPARRAY)
|
fake_buffer = (JSAMPARRAY)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
(cinfo->num_components * 5 * rgroup_height) *
|
(cinfo->num_components * 5 * rgroup_height) *
|
||||||
SIZEOF(JSAMPROW));
|
SIZEOF(JSAMPROW));
|
||||||
|
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
@ -289,11 +289,11 @@ create_context_buffer (j_compress_ptr cinfo)
|
|||||||
true_buffer = (*cinfo->mem->alloc_sarray)
|
true_buffer = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
(JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
|
(JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
|
||||||
cinfo->max_h_samp_factor) / compptr->h_samp_factor),
|
cinfo->max_h_samp_factor) / compptr->h_samp_factor),
|
||||||
(JDIMENSION) (3 * rgroup_height));
|
(JDIMENSION) (3 * rgroup_height));
|
||||||
/* Copy true buffer row pointers into the middle of the fake row array */
|
/* Copy true buffer row pointers into the middle of the fake row array */
|
||||||
MEMCOPY(fake_buffer + rgroup_height, true_buffer,
|
MEMCOPY(fake_buffer + rgroup_height, true_buffer,
|
||||||
3 * rgroup_height * SIZEOF(JSAMPROW));
|
3 * rgroup_height * SIZEOF(JSAMPROW));
|
||||||
/* Fill in the above and below wraparound pointers */
|
/* Fill in the above and below wraparound pointers */
|
||||||
for (i = 0; i < rgroup_height; i++) {
|
for (i = 0; i < rgroup_height; i++) {
|
||||||
fake_buffer[i] = true_buffer[2 * rgroup_height + i];
|
fake_buffer[i] = true_buffer[2 * rgroup_height + i];
|
||||||
@ -323,7 +323,7 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
|
|
||||||
prep = (my_prep_ptr)
|
prep = (my_prep_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_prep_controller));
|
SIZEOF(my_prep_controller));
|
||||||
cinfo->prep = (struct jpeg_c_prep_controller *) prep;
|
cinfo->prep = (struct jpeg_c_prep_controller *) prep;
|
||||||
prep->pub.start_pass = start_pass_prep;
|
prep->pub.start_pass = start_pass_prep;
|
||||||
|
|
||||||
@ -343,12 +343,12 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
/* No context, just make it tall enough for one row group */
|
/* No context, just make it tall enough for one row group */
|
||||||
prep->pub.pre_process_data = pre_process_data;
|
prep->pub.pre_process_data = pre_process_data;
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
|
prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
(JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
|
(JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
|
||||||
cinfo->max_h_samp_factor) / compptr->h_samp_factor),
|
cinfo->max_h_samp_factor) / compptr->h_samp_factor),
|
||||||
(JDIMENSION) cinfo->max_v_samp_factor);
|
(JDIMENSION) cinfo->max_v_samp_factor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
112
3rdparty/libjpeg/jcsample.c
vendored
112
3rdparty/libjpeg/jcsample.c
vendored
@ -52,8 +52,8 @@
|
|||||||
|
|
||||||
/* Pointer to routine to downsample a single component */
|
/* Pointer to routine to downsample a single component */
|
||||||
typedef JMETHOD(void, downsample1_ptr,
|
typedef JMETHOD(void, downsample1_ptr,
|
||||||
(j_compress_ptr cinfo, jpeg_component_info * compptr,
|
(j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JSAMPARRAY input_data, JSAMPARRAY output_data));
|
JSAMPARRAY input_data, JSAMPARRAY output_data));
|
||||||
|
|
||||||
/* Private subobject */
|
/* Private subobject */
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ start_pass_downsample (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
expand_right_edge (JSAMPARRAY image_data, int num_rows,
|
expand_right_edge (JSAMPARRAY image_data, int num_rows,
|
||||||
JDIMENSION input_cols, JDIMENSION output_cols)
|
JDIMENSION input_cols, JDIMENSION output_cols)
|
||||||
{
|
{
|
||||||
register JSAMPROW ptr;
|
register JSAMPROW ptr;
|
||||||
register JSAMPLE pixval;
|
register JSAMPLE pixval;
|
||||||
@ -98,7 +98,7 @@ expand_right_edge (JSAMPARRAY image_data, int num_rows,
|
|||||||
ptr = image_data[row] + input_cols;
|
ptr = image_data[row] + input_cols;
|
||||||
pixval = ptr[-1]; /* don't need GETJSAMPLE() here */
|
pixval = ptr[-1]; /* don't need GETJSAMPLE() here */
|
||||||
for (count = numcols; count > 0; count--)
|
for (count = numcols; count > 0; count--)
|
||||||
*ptr++ = pixval;
|
*ptr++ = pixval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,8 +112,8 @@ expand_right_edge (JSAMPARRAY image_data, int num_rows,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
sep_downsample (j_compress_ptr cinfo,
|
sep_downsample (j_compress_ptr cinfo,
|
||||||
JSAMPIMAGE input_buf, JDIMENSION in_row_index,
|
JSAMPIMAGE input_buf, JDIMENSION in_row_index,
|
||||||
JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
|
JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
|
||||||
{
|
{
|
||||||
my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
|
my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
|
||||||
int ci;
|
int ci;
|
||||||
@ -138,7 +138,7 @@ sep_downsample (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
||||||
{
|
{
|
||||||
int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
|
int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
|
||||||
JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
|
JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
|
||||||
@ -156,19 +156,19 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
* efficient.
|
* efficient.
|
||||||
*/
|
*/
|
||||||
expand_right_edge(input_data, cinfo->max_v_samp_factor,
|
expand_right_edge(input_data, cinfo->max_v_samp_factor,
|
||||||
cinfo->image_width, output_cols * h_expand);
|
cinfo->image_width, output_cols * h_expand);
|
||||||
|
|
||||||
inrow = 0;
|
inrow = 0;
|
||||||
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
|
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
|
||||||
outptr = output_data[outrow];
|
outptr = output_data[outrow];
|
||||||
for (outcol = 0, outcol_h = 0; outcol < output_cols;
|
for (outcol = 0, outcol_h = 0; outcol < output_cols;
|
||||||
outcol++, outcol_h += h_expand) {
|
outcol++, outcol_h += h_expand) {
|
||||||
outvalue = 0;
|
outvalue = 0;
|
||||||
for (v = 0; v < v_expand; v++) {
|
for (v = 0; v < v_expand; v++) {
|
||||||
inptr = input_data[inrow+v] + outcol_h;
|
inptr = input_data[inrow+v] + outcol_h;
|
||||||
for (h = 0; h < h_expand; h++) {
|
for (h = 0; h < h_expand; h++) {
|
||||||
outvalue += (INT32) GETJSAMPLE(*inptr++);
|
outvalue += (INT32) GETJSAMPLE(*inptr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
|
*outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
|
||||||
}
|
}
|
||||||
@ -185,14 +185,14 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
||||||
{
|
{
|
||||||
/* Copy the data */
|
/* Copy the data */
|
||||||
jcopy_sample_rows(input_data, 0, output_data, 0,
|
jcopy_sample_rows(input_data, 0, output_data, 0,
|
||||||
cinfo->max_v_samp_factor, cinfo->image_width);
|
cinfo->max_v_samp_factor, cinfo->image_width);
|
||||||
/* Edge-expand */
|
/* Edge-expand */
|
||||||
expand_right_edge(output_data, cinfo->max_v_samp_factor,
|
expand_right_edge(output_data, cinfo->max_v_samp_factor,
|
||||||
cinfo->image_width, compptr->width_in_blocks * DCTSIZE);
|
cinfo->image_width, compptr->width_in_blocks * DCTSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
||||||
{
|
{
|
||||||
int outrow;
|
int outrow;
|
||||||
JDIMENSION outcol;
|
JDIMENSION outcol;
|
||||||
@ -223,7 +223,7 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
* efficient.
|
* efficient.
|
||||||
*/
|
*/
|
||||||
expand_right_edge(input_data, cinfo->max_v_samp_factor,
|
expand_right_edge(input_data, cinfo->max_v_samp_factor,
|
||||||
cinfo->image_width, output_cols * 2);
|
cinfo->image_width, output_cols * 2);
|
||||||
|
|
||||||
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
|
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
|
||||||
outptr = output_data[outrow];
|
outptr = output_data[outrow];
|
||||||
@ -231,7 +231,7 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
bias = 0; /* bias = 0,1,0,1,... for successive samples */
|
bias = 0; /* bias = 0,1,0,1,... for successive samples */
|
||||||
for (outcol = 0; outcol < output_cols; outcol++) {
|
for (outcol = 0; outcol < output_cols; outcol++) {
|
||||||
*outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
|
*outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
|
||||||
+ bias) >> 1);
|
+ bias) >> 1);
|
||||||
bias ^= 1; /* 0=>1, 1=>0 */
|
bias ^= 1; /* 0=>1, 1=>0 */
|
||||||
inptr += 2;
|
inptr += 2;
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
||||||
{
|
{
|
||||||
int inrow, outrow;
|
int inrow, outrow;
|
||||||
JDIMENSION outcol;
|
JDIMENSION outcol;
|
||||||
@ -260,7 +260,7 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
* efficient.
|
* efficient.
|
||||||
*/
|
*/
|
||||||
expand_right_edge(input_data, cinfo->max_v_samp_factor,
|
expand_right_edge(input_data, cinfo->max_v_samp_factor,
|
||||||
cinfo->image_width, output_cols * 2);
|
cinfo->image_width, output_cols * 2);
|
||||||
|
|
||||||
inrow = 0;
|
inrow = 0;
|
||||||
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
|
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
|
||||||
@ -270,8 +270,8 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
bias = 1; /* bias = 1,2,1,2,... for successive samples */
|
bias = 1; /* bias = 1,2,1,2,... for successive samples */
|
||||||
for (outcol = 0; outcol < output_cols; outcol++) {
|
for (outcol = 0; outcol < output_cols; outcol++) {
|
||||||
*outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
*outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
||||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
|
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
|
||||||
+ bias) >> 2);
|
+ bias) >> 2);
|
||||||
bias ^= 3; /* 1=>2, 2=>1 */
|
bias ^= 3; /* 1=>2, 2=>1 */
|
||||||
inptr0 += 2; inptr1 += 2;
|
inptr0 += 2; inptr1 += 2;
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
||||||
{
|
{
|
||||||
int inrow, outrow;
|
int inrow, outrow;
|
||||||
JDIMENSION colctr;
|
JDIMENSION colctr;
|
||||||
@ -303,7 +303,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
* efficient.
|
* efficient.
|
||||||
*/
|
*/
|
||||||
expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
|
expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
|
||||||
cinfo->image_width, output_cols * 2);
|
cinfo->image_width, output_cols * 2);
|
||||||
|
|
||||||
/* We don't bother to form the individual "smoothed" input pixel values;
|
/* We don't bother to form the individual "smoothed" input pixel values;
|
||||||
* we can directly compute the output which is the average of the four
|
* we can directly compute the output which is the average of the four
|
||||||
@ -331,14 +331,14 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
/* Special case for first column: pretend column -1 is same as column 0 */
|
/* Special case for first column: pretend column -1 is same as column 0 */
|
||||||
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
||||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
||||||
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
||||||
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
||||||
GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
|
GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
|
||||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
|
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
|
||||||
neighsum += neighsum;
|
neighsum += neighsum;
|
||||||
neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
|
neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
|
||||||
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
|
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
|
||||||
membersum = membersum * memberscale + neighsum * neighscale;
|
membersum = membersum * memberscale + neighsum * neighscale;
|
||||||
*outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
|
*outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
|
||||||
inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
|
inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
|
||||||
@ -346,17 +346,17 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
for (colctr = output_cols - 2; colctr > 0; colctr--) {
|
for (colctr = output_cols - 2; colctr > 0; colctr--) {
|
||||||
/* sum of pixels directly mapped to this output element */
|
/* sum of pixels directly mapped to this output element */
|
||||||
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
||||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
||||||
/* sum of edge-neighbor pixels */
|
/* sum of edge-neighbor pixels */
|
||||||
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
||||||
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
||||||
GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
|
GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
|
||||||
GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
|
GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
|
||||||
/* The edge-neighbors count twice as much as corner-neighbors */
|
/* The edge-neighbors count twice as much as corner-neighbors */
|
||||||
neighsum += neighsum;
|
neighsum += neighsum;
|
||||||
/* Add in the corner-neighbors */
|
/* Add in the corner-neighbors */
|
||||||
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
|
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
|
||||||
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
|
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
|
||||||
/* form final output scaled up by 2^16 */
|
/* form final output scaled up by 2^16 */
|
||||||
membersum = membersum * memberscale + neighsum * neighscale;
|
membersum = membersum * memberscale + neighsum * neighscale;
|
||||||
/* round, descale and output it */
|
/* round, descale and output it */
|
||||||
@ -366,14 +366,14 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
/* Special case for last column */
|
/* Special case for last column */
|
||||||
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
|
||||||
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
|
||||||
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
|
||||||
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
|
||||||
GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
|
GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
|
||||||
GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
|
GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
|
||||||
neighsum += neighsum;
|
neighsum += neighsum;
|
||||||
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
|
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
|
||||||
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
|
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
|
||||||
membersum = membersum * memberscale + neighsum * neighscale;
|
membersum = membersum * memberscale + neighsum * neighscale;
|
||||||
*outptr = (JSAMPLE) ((membersum + 32768) >> 16);
|
*outptr = (JSAMPLE) ((membersum + 32768) >> 16);
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
|
fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||||
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
||||||
{
|
{
|
||||||
int outrow;
|
int outrow;
|
||||||
JDIMENSION colctr;
|
JDIMENSION colctr;
|
||||||
@ -404,7 +404,7 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
|
|||||||
* efficient.
|
* efficient.
|
||||||
*/
|
*/
|
||||||
expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
|
expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
|
||||||
cinfo->image_width, output_cols);
|
cinfo->image_width, output_cols);
|
||||||
|
|
||||||
/* Each of the eight neighbor pixels contributes a fraction SF to the
|
/* Each of the eight neighbor pixels contributes a fraction SF to the
|
||||||
* smoothed pixel, while the main pixel contributes (1-8*SF). In order
|
* smoothed pixel, while the main pixel contributes (1-8*SF). In order
|
||||||
@ -423,10 +423,10 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
|
|||||||
|
|
||||||
/* Special case for first column */
|
/* Special case for first column */
|
||||||
colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
|
colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
|
||||||
GETJSAMPLE(*inptr);
|
GETJSAMPLE(*inptr);
|
||||||
membersum = GETJSAMPLE(*inptr++);
|
membersum = GETJSAMPLE(*inptr++);
|
||||||
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
|
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
|
||||||
GETJSAMPLE(*inptr);
|
GETJSAMPLE(*inptr);
|
||||||
neighsum = colsum + (colsum - membersum) + nextcolsum;
|
neighsum = colsum + (colsum - membersum) + nextcolsum;
|
||||||
membersum = membersum * memberscale + neighsum * neighscale;
|
membersum = membersum * memberscale + neighsum * neighscale;
|
||||||
*outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
|
*outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
|
||||||
@ -436,7 +436,7 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
|
|||||||
membersum = GETJSAMPLE(*inptr++);
|
membersum = GETJSAMPLE(*inptr++);
|
||||||
above_ptr++; below_ptr++;
|
above_ptr++; below_ptr++;
|
||||||
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
|
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
|
||||||
GETJSAMPLE(*inptr);
|
GETJSAMPLE(*inptr);
|
||||||
neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
|
neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
|
||||||
membersum = membersum * memberscale + neighsum * neighscale;
|
membersum = membersum * memberscale + neighsum * neighscale;
|
||||||
*outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
|
*outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
|
||||||
@ -470,7 +470,7 @@ jinit_downsampler (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
downsample = (my_downsample_ptr)
|
downsample = (my_downsample_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_downsampler));
|
SIZEOF(my_downsampler));
|
||||||
cinfo->downsample = (struct jpeg_downsampler *) downsample;
|
cinfo->downsample = (struct jpeg_downsampler *) downsample;
|
||||||
downsample->pub.start_pass = start_pass_downsample;
|
downsample->pub.start_pass = start_pass_downsample;
|
||||||
downsample->pub.downsample = sep_downsample;
|
downsample->pub.downsample = sep_downsample;
|
||||||
@ -483,29 +483,29 @@ jinit_downsampler (j_compress_ptr cinfo)
|
|||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
|
if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
|
||||||
compptr->v_samp_factor == cinfo->max_v_samp_factor) {
|
compptr->v_samp_factor == cinfo->max_v_samp_factor) {
|
||||||
#ifdef INPUT_SMOOTHING_SUPPORTED
|
#ifdef INPUT_SMOOTHING_SUPPORTED
|
||||||
if (cinfo->smoothing_factor) {
|
if (cinfo->smoothing_factor) {
|
||||||
downsample->methods[ci] = fullsize_smooth_downsample;
|
downsample->methods[ci] = fullsize_smooth_downsample;
|
||||||
downsample->pub.need_context_rows = TRUE;
|
downsample->pub.need_context_rows = TRUE;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
downsample->methods[ci] = fullsize_downsample;
|
downsample->methods[ci] = fullsize_downsample;
|
||||||
} else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
|
} else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
|
||||||
compptr->v_samp_factor == cinfo->max_v_samp_factor) {
|
compptr->v_samp_factor == cinfo->max_v_samp_factor) {
|
||||||
smoothok = FALSE;
|
smoothok = FALSE;
|
||||||
downsample->methods[ci] = h2v1_downsample;
|
downsample->methods[ci] = h2v1_downsample;
|
||||||
} else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
|
} else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
|
||||||
compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
|
compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
|
||||||
#ifdef INPUT_SMOOTHING_SUPPORTED
|
#ifdef INPUT_SMOOTHING_SUPPORTED
|
||||||
if (cinfo->smoothing_factor) {
|
if (cinfo->smoothing_factor) {
|
||||||
downsample->methods[ci] = h2v2_smooth_downsample;
|
downsample->methods[ci] = h2v2_smooth_downsample;
|
||||||
downsample->pub.need_context_rows = TRUE;
|
downsample->pub.need_context_rows = TRUE;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
downsample->methods[ci] = h2v2_downsample;
|
downsample->methods[ci] = h2v2_downsample;
|
||||||
} else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
|
} else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
|
||||||
(cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
|
(cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
|
||||||
smoothok = FALSE;
|
smoothok = FALSE;
|
||||||
downsample->methods[ci] = int_downsample;
|
downsample->methods[ci] = int_downsample;
|
||||||
} else
|
} else
|
||||||
|
92
3rdparty/libjpeg/jctrans.c
vendored
92
3rdparty/libjpeg/jctrans.c
vendored
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
LOCAL(void) transencode_master_selection
|
LOCAL(void) transencode_master_selection
|
||||||
JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
|
JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
|
||||||
LOCAL(void) transencode_coef_controller
|
LOCAL(void) transencode_coef_controller
|
||||||
JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
|
JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -61,7 +61,7 @@ jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)
|
|||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
||||||
j_compress_ptr dstinfo)
|
j_compress_ptr dstinfo)
|
||||||
{
|
{
|
||||||
JQUANT_TBL ** qtblptr;
|
JQUANT_TBL ** qtblptr;
|
||||||
jpeg_component_info *incomp, *outcomp;
|
jpeg_component_info *incomp, *outcomp;
|
||||||
@ -89,10 +89,10 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
|||||||
if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
|
if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
|
||||||
qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
|
qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
|
||||||
if (*qtblptr == NULL)
|
if (*qtblptr == NULL)
|
||||||
*qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
|
*qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
|
||||||
MEMCOPY((*qtblptr)->quantval,
|
MEMCOPY((*qtblptr)->quantval,
|
||||||
srcinfo->quant_tbl_ptrs[tblno]->quantval,
|
srcinfo->quant_tbl_ptrs[tblno]->quantval,
|
||||||
SIZEOF((*qtblptr)->quantval));
|
SIZEOF((*qtblptr)->quantval));
|
||||||
(*qtblptr)->sent_table = FALSE;
|
(*qtblptr)->sent_table = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
|||||||
dstinfo->num_components = srcinfo->num_components;
|
dstinfo->num_components = srcinfo->num_components;
|
||||||
if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
|
if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
|
||||||
ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
|
ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
|
||||||
MAX_COMPONENTS);
|
MAX_COMPONENTS);
|
||||||
for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
|
for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
|
||||||
ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
|
ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
|
||||||
outcomp->component_id = incomp->component_id;
|
outcomp->component_id = incomp->component_id;
|
||||||
@ -115,14 +115,14 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
|||||||
*/
|
*/
|
||||||
tblno = outcomp->quant_tbl_no;
|
tblno = outcomp->quant_tbl_no;
|
||||||
if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
|
if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
|
||||||
srcinfo->quant_tbl_ptrs[tblno] == NULL)
|
srcinfo->quant_tbl_ptrs[tblno] == NULL)
|
||||||
ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
|
ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
|
||||||
slot_quant = srcinfo->quant_tbl_ptrs[tblno];
|
slot_quant = srcinfo->quant_tbl_ptrs[tblno];
|
||||||
c_quant = incomp->quant_table;
|
c_quant = incomp->quant_table;
|
||||||
if (c_quant != NULL) {
|
if (c_quant != NULL) {
|
||||||
for (coefi = 0; coefi < DCTSIZE2; coefi++) {
|
for (coefi = 0; coefi < DCTSIZE2; coefi++) {
|
||||||
if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
|
if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
|
||||||
ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
|
ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Note: we do not copy the source's Huffman table assignments;
|
/* Note: we do not copy the source's Huffman table assignments;
|
||||||
@ -156,7 +156,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
|||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
transencode_master_selection (j_compress_ptr cinfo,
|
transencode_master_selection (j_compress_ptr cinfo,
|
||||||
jvirt_barray_ptr * coef_arrays)
|
jvirt_barray_ptr * coef_arrays)
|
||||||
{
|
{
|
||||||
/* Although we don't actually use input_components for transcoding,
|
/* Although we don't actually use input_components for transcoding,
|
||||||
* jcmaster.c's initial_setup will complain if input_components is 0.
|
* jcmaster.c's initial_setup will complain if input_components is 0.
|
||||||
@ -301,44 +301,44 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
||||||
yoffset++) {
|
yoffset++) {
|
||||||
for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
|
for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
|
||||||
MCU_col_num++) {
|
MCU_col_num++) {
|
||||||
/* Construct list of pointers to DCT blocks belonging to this MCU */
|
/* Construct list of pointers to DCT blocks belonging to this MCU */
|
||||||
blkn = 0; /* index of current DCT block within MCU */
|
blkn = 0; /* index of current DCT block within MCU */
|
||||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
start_col = MCU_col_num * compptr->MCU_width;
|
start_col = MCU_col_num * compptr->MCU_width;
|
||||||
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
|
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
|
||||||
: compptr->last_col_width;
|
: compptr->last_col_width;
|
||||||
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
||||||
if (coef->iMCU_row_num < last_iMCU_row ||
|
if (coef->iMCU_row_num < last_iMCU_row ||
|
||||||
yindex+yoffset < compptr->last_row_height) {
|
yindex+yoffset < compptr->last_row_height) {
|
||||||
/* Fill in pointers to real blocks in this row */
|
/* Fill in pointers to real blocks in this row */
|
||||||
buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
|
buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
|
||||||
for (xindex = 0; xindex < blockcnt; xindex++)
|
for (xindex = 0; xindex < blockcnt; xindex++)
|
||||||
MCU_buffer[blkn++] = buffer_ptr++;
|
MCU_buffer[blkn++] = buffer_ptr++;
|
||||||
} else {
|
} else {
|
||||||
/* At bottom of image, need a whole row of dummy blocks */
|
/* At bottom of image, need a whole row of dummy blocks */
|
||||||
xindex = 0;
|
xindex = 0;
|
||||||
}
|
}
|
||||||
/* Fill in any dummy blocks needed in this row.
|
/* Fill in any dummy blocks needed in this row.
|
||||||
* Dummy blocks are filled in the same way as in jccoefct.c:
|
* Dummy blocks are filled in the same way as in jccoefct.c:
|
||||||
* all zeroes in the AC entries, DC entries equal to previous
|
* all zeroes in the AC entries, DC entries equal to previous
|
||||||
* block's DC value. The init routine has already zeroed the
|
* block's DC value. The init routine has already zeroed the
|
||||||
* AC entries, so we need only set the DC entries correctly.
|
* AC entries, so we need only set the DC entries correctly.
|
||||||
*/
|
*/
|
||||||
for (; xindex < compptr->MCU_width; xindex++) {
|
for (; xindex < compptr->MCU_width; xindex++) {
|
||||||
MCU_buffer[blkn] = coef->dummy_buffer[blkn];
|
MCU_buffer[blkn] = coef->dummy_buffer[blkn];
|
||||||
MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0];
|
MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0];
|
||||||
blkn++;
|
blkn++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Try to write the MCU. */
|
/* Try to write the MCU. */
|
||||||
if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
|
if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
|
||||||
/* Suspension forced; update state counters and exit */
|
/* Suspension forced; update state counters and exit */
|
||||||
coef->MCU_vert_offset = yoffset;
|
coef->MCU_vert_offset = yoffset;
|
||||||
coef->mcu_ctr = MCU_col_num;
|
coef->mcu_ctr = MCU_col_num;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Completed an MCU row, but perhaps not an iMCU row */
|
/* Completed an MCU row, but perhaps not an iMCU row */
|
||||||
@ -361,7 +361,7 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
|||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
transencode_coef_controller (j_compress_ptr cinfo,
|
transencode_coef_controller (j_compress_ptr cinfo,
|
||||||
jvirt_barray_ptr * coef_arrays)
|
jvirt_barray_ptr * coef_arrays)
|
||||||
{
|
{
|
||||||
my_coef_ptr coef;
|
my_coef_ptr coef;
|
||||||
JBLOCKROW buffer;
|
JBLOCKROW buffer;
|
||||||
@ -369,7 +369,7 @@ transencode_coef_controller (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
coef = (my_coef_ptr)
|
coef = (my_coef_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_coef_controller));
|
SIZEOF(my_coef_controller));
|
||||||
cinfo->coef = (struct jpeg_c_coef_controller *) coef;
|
cinfo->coef = (struct jpeg_c_coef_controller *) coef;
|
||||||
coef->pub.start_pass = start_pass_coef;
|
coef->pub.start_pass = start_pass_coef;
|
||||||
coef->pub.compress_data = compress_output;
|
coef->pub.compress_data = compress_output;
|
||||||
@ -380,7 +380,7 @@ transencode_coef_controller (j_compress_ptr cinfo,
|
|||||||
/* Allocate and pre-zero space for dummy DCT blocks. */
|
/* Allocate and pre-zero space for dummy DCT blocks. */
|
||||||
buffer = (JBLOCKROW)
|
buffer = (JBLOCKROW)
|
||||||
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
||||||
jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
||||||
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
|
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
|
||||||
coef->dummy_buffer[i] = buffer + i;
|
coef->dummy_buffer[i] = buffer + i;
|
||||||
|
38
3rdparty/libjpeg/jdapimin.c
vendored
38
3rdparty/libjpeg/jdapimin.c
vendored
@ -37,7 +37,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
|
|||||||
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
|
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
|
||||||
if (structsize != SIZEOF(struct jpeg_decompress_struct))
|
if (structsize != SIZEOF(struct jpeg_decompress_struct))
|
||||||
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
|
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
|
||||||
(int) SIZEOF(struct jpeg_decompress_struct), (int) structsize);
|
(int) SIZEOF(struct jpeg_decompress_struct), (int) structsize);
|
||||||
|
|
||||||
/* For debugging purposes, we zero the whole master structure.
|
/* For debugging purposes, we zero the whole master structure.
|
||||||
* But the application has already set the err pointer, and may have set
|
* But the application has already set the err pointer, and may have set
|
||||||
@ -128,15 +128,15 @@ default_decompress_parms (j_decompress_ptr cinfo)
|
|||||||
} else if (cinfo->saw_Adobe_marker) {
|
} else if (cinfo->saw_Adobe_marker) {
|
||||||
switch (cinfo->Adobe_transform) {
|
switch (cinfo->Adobe_transform) {
|
||||||
case 0:
|
case 0:
|
||||||
cinfo->jpeg_color_space = JCS_RGB;
|
cinfo->jpeg_color_space = JCS_RGB;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
cinfo->jpeg_color_space = JCS_YCbCr;
|
cinfo->jpeg_color_space = JCS_YCbCr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
|
WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
|
||||||
cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
|
cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Saw no special markers, try to guess from the component IDs */
|
/* Saw no special markers, try to guess from the component IDs */
|
||||||
@ -145,12 +145,12 @@ default_decompress_parms (j_decompress_ptr cinfo)
|
|||||||
int cid2 = cinfo->comp_info[2].component_id;
|
int cid2 = cinfo->comp_info[2].component_id;
|
||||||
|
|
||||||
if (cid0 == 1 && cid1 == 2 && cid2 == 3)
|
if (cid0 == 1 && cid1 == 2 && cid2 == 3)
|
||||||
cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
|
cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
|
||||||
else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
|
else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
|
||||||
cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
|
cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
|
||||||
else {
|
else {
|
||||||
TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
|
TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
|
||||||
cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
|
cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Always guess RGB is proper output colorspace. */
|
/* Always guess RGB is proper output colorspace. */
|
||||||
@ -161,15 +161,15 @@ default_decompress_parms (j_decompress_ptr cinfo)
|
|||||||
if (cinfo->saw_Adobe_marker) {
|
if (cinfo->saw_Adobe_marker) {
|
||||||
switch (cinfo->Adobe_transform) {
|
switch (cinfo->Adobe_transform) {
|
||||||
case 0:
|
case 0:
|
||||||
cinfo->jpeg_color_space = JCS_CMYK;
|
cinfo->jpeg_color_space = JCS_CMYK;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
cinfo->jpeg_color_space = JCS_YCCK;
|
cinfo->jpeg_color_space = JCS_YCCK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
|
WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
|
||||||
cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
|
cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No special markers, assume straight CMYK. */
|
/* No special markers, assume straight CMYK. */
|
||||||
|
52
3rdparty/libjpeg/jdapistd.c
vendored
52
3rdparty/libjpeg/jdapistd.c
vendored
@ -52,24 +52,24 @@ jpeg_start_decompress (j_decompress_ptr cinfo)
|
|||||||
if (cinfo->inputctl->has_multiple_scans) {
|
if (cinfo->inputctl->has_multiple_scans) {
|
||||||
#ifdef D_MULTISCAN_FILES_SUPPORTED
|
#ifdef D_MULTISCAN_FILES_SUPPORTED
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int retcode;
|
int retcode;
|
||||||
/* Call progress monitor hook if present */
|
/* Call progress monitor hook if present */
|
||||||
if (cinfo->progress != NULL)
|
if (cinfo->progress != NULL)
|
||||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
||||||
/* Absorb some more input */
|
/* Absorb some more input */
|
||||||
retcode = (*cinfo->inputctl->consume_input) (cinfo);
|
retcode = (*cinfo->inputctl->consume_input) (cinfo);
|
||||||
if (retcode == JPEG_SUSPENDED)
|
if (retcode == JPEG_SUSPENDED)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (retcode == JPEG_REACHED_EOI)
|
if (retcode == JPEG_REACHED_EOI)
|
||||||
break;
|
break;
|
||||||
/* Advance progress counter if appropriate */
|
/* Advance progress counter if appropriate */
|
||||||
if (cinfo->progress != NULL &&
|
if (cinfo->progress != NULL &&
|
||||||
(retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
|
(retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
|
||||||
if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
|
if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
|
||||||
/* jdmaster underestimated number of scans; ratchet up one scan */
|
/* jdmaster underestimated number of scans; ratchet up one scan */
|
||||||
cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
|
cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||||
@ -108,16 +108,16 @@ output_pass_setup (j_decompress_ptr cinfo)
|
|||||||
JDIMENSION last_scanline;
|
JDIMENSION last_scanline;
|
||||||
/* Call progress monitor hook if present */
|
/* Call progress monitor hook if present */
|
||||||
if (cinfo->progress != NULL) {
|
if (cinfo->progress != NULL) {
|
||||||
cinfo->progress->pass_counter = (long) cinfo->output_scanline;
|
cinfo->progress->pass_counter = (long) cinfo->output_scanline;
|
||||||
cinfo->progress->pass_limit = (long) cinfo->output_height;
|
cinfo->progress->pass_limit = (long) cinfo->output_height;
|
||||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
||||||
}
|
}
|
||||||
/* Process some data */
|
/* Process some data */
|
||||||
last_scanline = cinfo->output_scanline;
|
last_scanline = cinfo->output_scanline;
|
||||||
(*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL,
|
(*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL,
|
||||||
&cinfo->output_scanline, (JDIMENSION) 0);
|
&cinfo->output_scanline, (JDIMENSION) 0);
|
||||||
if (cinfo->output_scanline == last_scanline)
|
if (cinfo->output_scanline == last_scanline)
|
||||||
return FALSE; /* No progress made, must suspend */
|
return FALSE; /* No progress made, must suspend */
|
||||||
}
|
}
|
||||||
/* Finish up dummy pass, and set up for another one */
|
/* Finish up dummy pass, and set up for another one */
|
||||||
(*cinfo->master->finish_output_pass) (cinfo);
|
(*cinfo->master->finish_output_pass) (cinfo);
|
||||||
@ -150,7 +150,7 @@ output_pass_setup (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
GLOBAL(JDIMENSION)
|
GLOBAL(JDIMENSION)
|
||||||
jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
|
jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
|
||||||
JDIMENSION max_lines)
|
JDIMENSION max_lines)
|
||||||
{
|
{
|
||||||
JDIMENSION row_ctr;
|
JDIMENSION row_ctr;
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
|
|||||||
|
|
||||||
GLOBAL(JDIMENSION)
|
GLOBAL(JDIMENSION)
|
||||||
jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
|
jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
|
||||||
JDIMENSION max_lines)
|
JDIMENSION max_lines)
|
||||||
{
|
{
|
||||||
JDIMENSION lines_per_iMCU_row;
|
JDIMENSION lines_per_iMCU_row;
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ jpeg_finish_output (j_decompress_ptr cinfo)
|
|||||||
}
|
}
|
||||||
/* Read markers looking for SOS or EOI */
|
/* Read markers looking for SOS or EOI */
|
||||||
while (cinfo->input_scan_number <= cinfo->output_scan_number &&
|
while (cinfo->input_scan_number <= cinfo->output_scan_number &&
|
||||||
! cinfo->inputctl->eoi_reached) {
|
! cinfo->inputctl->eoi_reached) {
|
||||||
if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
|
if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
|
||||||
return FALSE; /* Suspend, come back later */
|
return FALSE; /* Suspend, come back later */
|
||||||
}
|
}
|
||||||
|
4
3rdparty/libjpeg/jdatadst.c
vendored
4
3rdparty/libjpeg/jdatadst.c
vendored
@ -47,7 +47,7 @@ init_destination (j_compress_ptr cinfo)
|
|||||||
/* Allocate the output buffer --- it will be released when done with image */
|
/* Allocate the output buffer --- it will be released when done with image */
|
||||||
dest->buffer = (JOCTET *)
|
dest->buffer = (JOCTET *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
|
OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
|
||||||
|
|
||||||
dest->pub.next_output_byte = dest->buffer;
|
dest->pub.next_output_byte = dest->buffer;
|
||||||
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
|
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
|
||||||
@ -140,7 +140,7 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile)
|
|||||||
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
|
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
|
||||||
cinfo->dest = (struct jpeg_destination_mgr *)
|
cinfo->dest = (struct jpeg_destination_mgr *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||||
SIZEOF(my_destination_mgr));
|
SIZEOF(my_destination_mgr));
|
||||||
}
|
}
|
||||||
|
|
||||||
dest = (my_dest_ptr) cinfo->dest;
|
dest = (my_dest_ptr) cinfo->dest;
|
||||||
|
4
3rdparty/libjpeg/jdatasrc.c
vendored
4
3rdparty/libjpeg/jdatasrc.c
vendored
@ -193,11 +193,11 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
|
|||||||
if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
||||||
cinfo->src = (struct jpeg_source_mgr *)
|
cinfo->src = (struct jpeg_source_mgr *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||||
SIZEOF(my_source_mgr));
|
SIZEOF(my_source_mgr));
|
||||||
src = (my_src_ptr) cinfo->src;
|
src = (my_src_ptr) cinfo->src;
|
||||||
src->buffer = (JOCTET *)
|
src->buffer = (JOCTET *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||||
INPUT_BUF_SIZE * SIZEOF(JOCTET));
|
INPUT_BUF_SIZE * SIZEOF(JOCTET));
|
||||||
}
|
}
|
||||||
|
|
||||||
src = (my_src_ptr) cinfo->src;
|
src = (my_src_ptr) cinfo->src;
|
||||||
|
358
3rdparty/libjpeg/jdcoefct.c
vendored
358
3rdparty/libjpeg/jdcoefct.c
vendored
@ -63,15 +63,15 @@ typedef my_coef_controller * my_coef_ptr;
|
|||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
METHODDEF(int) decompress_onepass
|
METHODDEF(int) decompress_onepass
|
||||||
JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
|
JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
|
||||||
#ifdef D_MULTISCAN_FILES_SUPPORTED
|
#ifdef D_MULTISCAN_FILES_SUPPORTED
|
||||||
METHODDEF(int) decompress_data
|
METHODDEF(int) decompress_data
|
||||||
JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
|
JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
|
||||||
#endif
|
#endif
|
||||||
#ifdef BLOCK_SMOOTHING_SUPPORTED
|
#ifdef BLOCK_SMOOTHING_SUPPORTED
|
||||||
LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo));
|
LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo));
|
||||||
METHODDEF(int) decompress_smooth_data
|
METHODDEF(int) decompress_smooth_data
|
||||||
JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
|
JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -160,15 +160,15 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
||||||
yoffset++) {
|
yoffset++) {
|
||||||
for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
|
for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
|
||||||
MCU_col_num++) {
|
MCU_col_num++) {
|
||||||
/* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
|
/* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
|
||||||
jzero_far((void FAR *) coef->MCU_buffer[0],
|
jzero_far((void FAR *) coef->MCU_buffer[0],
|
||||||
(size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
|
(size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
|
||||||
if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
|
if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
|
||||||
/* Suspension forced; update state counters and exit */
|
/* Suspension forced; update state counters and exit */
|
||||||
coef->MCU_vert_offset = yoffset;
|
coef->MCU_vert_offset = yoffset;
|
||||||
coef->MCU_ctr = MCU_col_num;
|
coef->MCU_ctr = MCU_col_num;
|
||||||
return JPEG_SUSPENDED;
|
return JPEG_SUSPENDED;
|
||||||
}
|
}
|
||||||
/* Determine where data should go in output_buf and do the IDCT thing.
|
/* Determine where data should go in output_buf and do the IDCT thing.
|
||||||
* We skip dummy blocks at the right and bottom edges (but blkn gets
|
* We skip dummy blocks at the right and bottom edges (but blkn gets
|
||||||
@ -177,32 +177,32 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
*/
|
*/
|
||||||
blkn = 0; /* index of current DCT block within MCU */
|
blkn = 0; /* index of current DCT block within MCU */
|
||||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
/* Don't bother to IDCT an uninteresting component. */
|
/* Don't bother to IDCT an uninteresting component. */
|
||||||
if (! compptr->component_needed) {
|
if (! compptr->component_needed) {
|
||||||
blkn += compptr->MCU_blocks;
|
blkn += compptr->MCU_blocks;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
|
inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
|
||||||
useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
|
useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
|
||||||
: compptr->last_col_width;
|
: compptr->last_col_width;
|
||||||
output_ptr = output_buf[compptr->component_index] +
|
output_ptr = output_buf[compptr->component_index] +
|
||||||
yoffset * compptr->DCT_scaled_size;
|
yoffset * compptr->DCT_scaled_size;
|
||||||
start_col = MCU_col_num * compptr->MCU_sample_width;
|
start_col = MCU_col_num * compptr->MCU_sample_width;
|
||||||
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
||||||
if (cinfo->input_iMCU_row < last_iMCU_row ||
|
if (cinfo->input_iMCU_row < last_iMCU_row ||
|
||||||
yoffset+yindex < compptr->last_row_height) {
|
yoffset+yindex < compptr->last_row_height) {
|
||||||
output_col = start_col;
|
output_col = start_col;
|
||||||
for (xindex = 0; xindex < useful_width; xindex++) {
|
for (xindex = 0; xindex < useful_width; xindex++) {
|
||||||
(*inverse_DCT) (cinfo, compptr,
|
(*inverse_DCT) (cinfo, compptr,
|
||||||
(JCOEFPTR) coef->MCU_buffer[blkn+xindex],
|
(JCOEFPTR) coef->MCU_buffer[blkn+xindex],
|
||||||
output_ptr, output_col);
|
output_ptr, output_col);
|
||||||
output_col += compptr->DCT_scaled_size;
|
output_col += compptr->DCT_scaled_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blkn += compptr->MCU_width;
|
blkn += compptr->MCU_width;
|
||||||
output_ptr += compptr->DCT_scaled_size;
|
output_ptr += compptr->DCT_scaled_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Completed an MCU row, but perhaps not an iMCU row */
|
/* Completed an MCU row, but perhaps not an iMCU row */
|
||||||
@ -268,25 +268,25 @@ consume_data (j_decompress_ptr cinfo)
|
|||||||
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
|
||||||
yoffset++) {
|
yoffset++) {
|
||||||
for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
|
for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
|
||||||
MCU_col_num++) {
|
MCU_col_num++) {
|
||||||
/* Construct list of pointers to DCT blocks belonging to this MCU */
|
/* Construct list of pointers to DCT blocks belonging to this MCU */
|
||||||
blkn = 0; /* index of current DCT block within MCU */
|
blkn = 0; /* index of current DCT block within MCU */
|
||||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||||
compptr = cinfo->cur_comp_info[ci];
|
compptr = cinfo->cur_comp_info[ci];
|
||||||
start_col = MCU_col_num * compptr->MCU_width;
|
start_col = MCU_col_num * compptr->MCU_width;
|
||||||
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
|
||||||
buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
|
buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
|
||||||
for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
|
for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
|
||||||
coef->MCU_buffer[blkn++] = buffer_ptr++;
|
coef->MCU_buffer[blkn++] = buffer_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Try to fetch the MCU. */
|
/* Try to fetch the MCU. */
|
||||||
if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
|
if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
|
||||||
/* Suspension forced; update state counters and exit */
|
/* Suspension forced; update state counters and exit */
|
||||||
coef->MCU_vert_offset = yoffset;
|
coef->MCU_vert_offset = yoffset;
|
||||||
coef->MCU_ctr = MCU_col_num;
|
coef->MCU_ctr = MCU_col_num;
|
||||||
return JPEG_SUSPENDED;
|
return JPEG_SUSPENDED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Completed an MCU row, but perhaps not an iMCU row */
|
/* Completed an MCU row, but perhaps not an iMCU row */
|
||||||
@ -327,8 +327,8 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
|
|
||||||
/* Force some input to be done if we are getting ahead of the input. */
|
/* Force some input to be done if we are getting ahead of the input. */
|
||||||
while (cinfo->input_scan_number < cinfo->output_scan_number ||
|
while (cinfo->input_scan_number < cinfo->output_scan_number ||
|
||||||
(cinfo->input_scan_number == cinfo->output_scan_number &&
|
(cinfo->input_scan_number == cinfo->output_scan_number &&
|
||||||
cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
|
cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
|
||||||
if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
|
if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
|
||||||
return JPEG_SUSPENDED;
|
return JPEG_SUSPENDED;
|
||||||
}
|
}
|
||||||
@ -359,10 +359,10 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
buffer_ptr = buffer[block_row];
|
buffer_ptr = buffer[block_row];
|
||||||
output_col = 0;
|
output_col = 0;
|
||||||
for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) {
|
for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) {
|
||||||
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,
|
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,
|
||||||
output_ptr, output_col);
|
output_ptr, output_col);
|
||||||
buffer_ptr++;
|
buffer_ptr++;
|
||||||
output_col += compptr->DCT_scaled_size;
|
output_col += compptr->DCT_scaled_size;
|
||||||
}
|
}
|
||||||
output_ptr += compptr->DCT_scaled_size;
|
output_ptr += compptr->DCT_scaled_size;
|
||||||
}
|
}
|
||||||
@ -419,8 +419,8 @@ smoothing_ok (j_decompress_ptr cinfo)
|
|||||||
if (coef->coef_bits_latch == NULL)
|
if (coef->coef_bits_latch == NULL)
|
||||||
coef->coef_bits_latch = (int *)
|
coef->coef_bits_latch = (int *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
cinfo->num_components *
|
cinfo->num_components *
|
||||||
(SAVED_COEFS * SIZEOF(int)));
|
(SAVED_COEFS * SIZEOF(int)));
|
||||||
coef_bits_latch = coef->coef_bits_latch;
|
coef_bits_latch = coef->coef_bits_latch;
|
||||||
|
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
@ -430,11 +430,11 @@ smoothing_ok (j_decompress_ptr cinfo)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
/* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */
|
/* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */
|
||||||
if (qtable->quantval[0] == 0 ||
|
if (qtable->quantval[0] == 0 ||
|
||||||
qtable->quantval[Q01_POS] == 0 ||
|
qtable->quantval[Q01_POS] == 0 ||
|
||||||
qtable->quantval[Q10_POS] == 0 ||
|
qtable->quantval[Q10_POS] == 0 ||
|
||||||
qtable->quantval[Q20_POS] == 0 ||
|
qtable->quantval[Q20_POS] == 0 ||
|
||||||
qtable->quantval[Q11_POS] == 0 ||
|
qtable->quantval[Q11_POS] == 0 ||
|
||||||
qtable->quantval[Q02_POS] == 0)
|
qtable->quantval[Q02_POS] == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* DC values must be at least partly known for all components. */
|
/* DC values must be at least partly known for all components. */
|
||||||
coef_bits = cinfo->coef_bits[ci];
|
coef_bits = cinfo->coef_bits[ci];
|
||||||
@ -444,7 +444,7 @@ smoothing_ok (j_decompress_ptr cinfo)
|
|||||||
for (coefi = 1; coefi <= 5; coefi++) {
|
for (coefi = 1; coefi <= 5; coefi++) {
|
||||||
coef_bits_latch[coefi] = coef_bits[coefi];
|
coef_bits_latch[coefi] = coef_bits[coefi];
|
||||||
if (coef_bits[coefi] != 0)
|
if (coef_bits[coefi] != 0)
|
||||||
smoothing_useful = TRUE;
|
smoothing_useful = TRUE;
|
||||||
}
|
}
|
||||||
coef_bits_latch += SAVED_COEFS;
|
coef_bits_latch += SAVED_COEFS;
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
|
|
||||||
/* Force some input to be done if we are getting ahead of the input. */
|
/* Force some input to be done if we are getting ahead of the input. */
|
||||||
while (cinfo->input_scan_number <= cinfo->output_scan_number &&
|
while (cinfo->input_scan_number <= cinfo->output_scan_number &&
|
||||||
! cinfo->inputctl->eoi_reached) {
|
! cinfo->inputctl->eoi_reached) {
|
||||||
if (cinfo->input_scan_number == cinfo->output_scan_number) {
|
if (cinfo->input_scan_number == cinfo->output_scan_number) {
|
||||||
/* If input is working on current scan, we ordinarily want it to
|
/* If input is working on current scan, we ordinarily want it to
|
||||||
* have completed the current row. But if input scan is DC,
|
* have completed the current row. But if input scan is DC,
|
||||||
@ -489,7 +489,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
*/
|
*/
|
||||||
JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;
|
JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;
|
||||||
if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)
|
if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
|
if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
|
||||||
return JPEG_SUSPENDED;
|
return JPEG_SUSPENDED;
|
||||||
@ -517,15 +517,15 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
if (cinfo->output_iMCU_row > 0) {
|
if (cinfo->output_iMCU_row > 0) {
|
||||||
access_rows += compptr->v_samp_factor; /* prior iMCU row too */
|
access_rows += compptr->v_samp_factor; /* prior iMCU row too */
|
||||||
buffer = (*cinfo->mem->access_virt_barray)
|
buffer = (*cinfo->mem->access_virt_barray)
|
||||||
((j_common_ptr) cinfo, coef->whole_image[ci],
|
((j_common_ptr) cinfo, coef->whole_image[ci],
|
||||||
(cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
|
(cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
|
||||||
(JDIMENSION) access_rows, FALSE);
|
(JDIMENSION) access_rows, FALSE);
|
||||||
buffer += compptr->v_samp_factor; /* point to current iMCU row */
|
buffer += compptr->v_samp_factor; /* point to current iMCU row */
|
||||||
first_row = FALSE;
|
first_row = FALSE;
|
||||||
} else {
|
} else {
|
||||||
buffer = (*cinfo->mem->access_virt_barray)
|
buffer = (*cinfo->mem->access_virt_barray)
|
||||||
((j_common_ptr) cinfo, coef->whole_image[ci],
|
((j_common_ptr) cinfo, coef->whole_image[ci],
|
||||||
(JDIMENSION) 0, (JDIMENSION) access_rows, FALSE);
|
(JDIMENSION) 0, (JDIMENSION) access_rows, FALSE);
|
||||||
first_row = TRUE;
|
first_row = TRUE;
|
||||||
}
|
}
|
||||||
/* Fetch component-dependent info */
|
/* Fetch component-dependent info */
|
||||||
@ -543,13 +543,13 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
for (block_row = 0; block_row < block_rows; block_row++) {
|
for (block_row = 0; block_row < block_rows; block_row++) {
|
||||||
buffer_ptr = buffer[block_row];
|
buffer_ptr = buffer[block_row];
|
||||||
if (first_row && block_row == 0)
|
if (first_row && block_row == 0)
|
||||||
prev_block_row = buffer_ptr;
|
prev_block_row = buffer_ptr;
|
||||||
else
|
else
|
||||||
prev_block_row = buffer[block_row-1];
|
prev_block_row = buffer[block_row-1];
|
||||||
if (last_row && block_row == block_rows-1)
|
if (last_row && block_row == block_rows-1)
|
||||||
next_block_row = buffer_ptr;
|
next_block_row = buffer_ptr;
|
||||||
else
|
else
|
||||||
next_block_row = buffer[block_row+1];
|
next_block_row = buffer[block_row+1];
|
||||||
/* We fetch the surrounding DC values using a sliding-register approach.
|
/* We fetch the surrounding DC values using a sliding-register approach.
|
||||||
* Initialize all nine here so as to do the right thing on narrow pics.
|
* Initialize all nine here so as to do the right thing on narrow pics.
|
||||||
*/
|
*/
|
||||||
@ -559,102 +559,102 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||||||
output_col = 0;
|
output_col = 0;
|
||||||
last_block_column = compptr->width_in_blocks - 1;
|
last_block_column = compptr->width_in_blocks - 1;
|
||||||
for (block_num = 0; block_num <= last_block_column; block_num++) {
|
for (block_num = 0; block_num <= last_block_column; block_num++) {
|
||||||
/* Fetch current DCT block into workspace so we can modify it. */
|
/* Fetch current DCT block into workspace so we can modify it. */
|
||||||
jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1);
|
jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1);
|
||||||
/* Update DC values */
|
/* Update DC values */
|
||||||
if (block_num < last_block_column) {
|
if (block_num < last_block_column) {
|
||||||
DC3 = (int) prev_block_row[1][0];
|
DC3 = (int) prev_block_row[1][0];
|
||||||
DC6 = (int) buffer_ptr[1][0];
|
DC6 = (int) buffer_ptr[1][0];
|
||||||
DC9 = (int) next_block_row[1][0];
|
DC9 = (int) next_block_row[1][0];
|
||||||
}
|
}
|
||||||
/* Compute coefficient estimates per K.8.
|
/* Compute coefficient estimates per K.8.
|
||||||
* An estimate is applied only if coefficient is still zero,
|
* An estimate is applied only if coefficient is still zero,
|
||||||
* and is not known to be fully accurate.
|
* and is not known to be fully accurate.
|
||||||
*/
|
*/
|
||||||
/* AC01 */
|
/* AC01 */
|
||||||
if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {
|
if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {
|
||||||
num = 36 * Q00 * (DC4 - DC6);
|
num = 36 * Q00 * (DC4 - DC6);
|
||||||
if (num >= 0) {
|
if (num >= 0) {
|
||||||
pred = (int) (((Q01<<7) + num) / (Q01<<8));
|
pred = (int) (((Q01<<7) + num) / (Q01<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
} else {
|
} else {
|
||||||
pred = (int) (((Q01<<7) - num) / (Q01<<8));
|
pred = (int) (((Q01<<7) - num) / (Q01<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
pred = -pred;
|
pred = -pred;
|
||||||
}
|
}
|
||||||
workspace[1] = (JCOEF) pred;
|
workspace[1] = (JCOEF) pred;
|
||||||
}
|
}
|
||||||
/* AC10 */
|
/* AC10 */
|
||||||
if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) {
|
if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) {
|
||||||
num = 36 * Q00 * (DC2 - DC8);
|
num = 36 * Q00 * (DC2 - DC8);
|
||||||
if (num >= 0) {
|
if (num >= 0) {
|
||||||
pred = (int) (((Q10<<7) + num) / (Q10<<8));
|
pred = (int) (((Q10<<7) + num) / (Q10<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
} else {
|
} else {
|
||||||
pred = (int) (((Q10<<7) - num) / (Q10<<8));
|
pred = (int) (((Q10<<7) - num) / (Q10<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
pred = -pred;
|
pred = -pred;
|
||||||
}
|
}
|
||||||
workspace[8] = (JCOEF) pred;
|
workspace[8] = (JCOEF) pred;
|
||||||
}
|
}
|
||||||
/* AC20 */
|
/* AC20 */
|
||||||
if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) {
|
if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) {
|
||||||
num = 9 * Q00 * (DC2 + DC8 - 2*DC5);
|
num = 9 * Q00 * (DC2 + DC8 - 2*DC5);
|
||||||
if (num >= 0) {
|
if (num >= 0) {
|
||||||
pred = (int) (((Q20<<7) + num) / (Q20<<8));
|
pred = (int) (((Q20<<7) + num) / (Q20<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
} else {
|
} else {
|
||||||
pred = (int) (((Q20<<7) - num) / (Q20<<8));
|
pred = (int) (((Q20<<7) - num) / (Q20<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
pred = -pred;
|
pred = -pred;
|
||||||
}
|
}
|
||||||
workspace[16] = (JCOEF) pred;
|
workspace[16] = (JCOEF) pred;
|
||||||
}
|
}
|
||||||
/* AC11 */
|
/* AC11 */
|
||||||
if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) {
|
if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) {
|
||||||
num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9);
|
num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9);
|
||||||
if (num >= 0) {
|
if (num >= 0) {
|
||||||
pred = (int) (((Q11<<7) + num) / (Q11<<8));
|
pred = (int) (((Q11<<7) + num) / (Q11<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
} else {
|
} else {
|
||||||
pred = (int) (((Q11<<7) - num) / (Q11<<8));
|
pred = (int) (((Q11<<7) - num) / (Q11<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
pred = -pred;
|
pred = -pred;
|
||||||
}
|
}
|
||||||
workspace[9] = (JCOEF) pred;
|
workspace[9] = (JCOEF) pred;
|
||||||
}
|
}
|
||||||
/* AC02 */
|
/* AC02 */
|
||||||
if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) {
|
if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) {
|
||||||
num = 9 * Q00 * (DC4 + DC6 - 2*DC5);
|
num = 9 * Q00 * (DC4 + DC6 - 2*DC5);
|
||||||
if (num >= 0) {
|
if (num >= 0) {
|
||||||
pred = (int) (((Q02<<7) + num) / (Q02<<8));
|
pred = (int) (((Q02<<7) + num) / (Q02<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
} else {
|
} else {
|
||||||
pred = (int) (((Q02<<7) - num) / (Q02<<8));
|
pred = (int) (((Q02<<7) - num) / (Q02<<8));
|
||||||
if (Al > 0 && pred >= (1<<Al))
|
if (Al > 0 && pred >= (1<<Al))
|
||||||
pred = (1<<Al)-1;
|
pred = (1<<Al)-1;
|
||||||
pred = -pred;
|
pred = -pred;
|
||||||
}
|
}
|
||||||
workspace[2] = (JCOEF) pred;
|
workspace[2] = (JCOEF) pred;
|
||||||
}
|
}
|
||||||
/* OK, do the IDCT */
|
/* OK, do the IDCT */
|
||||||
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace,
|
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace,
|
||||||
output_ptr, output_col);
|
output_ptr, output_col);
|
||||||
/* Advance for next column */
|
/* Advance for next column */
|
||||||
DC1 = DC2; DC2 = DC3;
|
DC1 = DC2; DC2 = DC3;
|
||||||
DC4 = DC5; DC5 = DC6;
|
DC4 = DC5; DC5 = DC6;
|
||||||
DC7 = DC8; DC8 = DC9;
|
DC7 = DC8; DC8 = DC9;
|
||||||
buffer_ptr++, prev_block_row++, next_block_row++;
|
buffer_ptr++, prev_block_row++, next_block_row++;
|
||||||
output_col += compptr->DCT_scaled_size;
|
output_col += compptr->DCT_scaled_size;
|
||||||
}
|
}
|
||||||
output_ptr += compptr->DCT_scaled_size;
|
output_ptr += compptr->DCT_scaled_size;
|
||||||
}
|
}
|
||||||
@ -679,7 +679,7 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
|||||||
|
|
||||||
coef = (my_coef_ptr)
|
coef = (my_coef_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_coef_controller));
|
SIZEOF(my_coef_controller));
|
||||||
cinfo->coef = (struct jpeg_d_coef_controller *) coef;
|
cinfo->coef = (struct jpeg_d_coef_controller *) coef;
|
||||||
coef->pub.start_input_pass = start_input_pass;
|
coef->pub.start_input_pass = start_input_pass;
|
||||||
coef->pub.start_output_pass = start_output_pass;
|
coef->pub.start_output_pass = start_output_pass;
|
||||||
@ -697,20 +697,20 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
|||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
access_rows = compptr->v_samp_factor;
|
access_rows = compptr->v_samp_factor;
|
||||||
#ifdef BLOCK_SMOOTHING_SUPPORTED
|
#ifdef BLOCK_SMOOTHING_SUPPORTED
|
||||||
/* If block smoothing could be used, need a bigger window */
|
/* If block smoothing could be used, need a bigger window */
|
||||||
if (cinfo->progressive_mode)
|
if (cinfo->progressive_mode)
|
||||||
access_rows *= 3;
|
access_rows *= 3;
|
||||||
#endif
|
#endif
|
||||||
coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
|
coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
|
||||||
(JDIMENSION) jround_up((long) compptr->width_in_blocks,
|
(JDIMENSION) jround_up((long) compptr->width_in_blocks,
|
||||||
(long) compptr->h_samp_factor),
|
(long) compptr->h_samp_factor),
|
||||||
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
||||||
(long) compptr->v_samp_factor),
|
(long) compptr->v_samp_factor),
|
||||||
(JDIMENSION) access_rows);
|
(JDIMENSION) access_rows);
|
||||||
}
|
}
|
||||||
coef->pub.consume_data = consume_data;
|
coef->pub.consume_data = consume_data;
|
||||||
coef->pub.decompress_data = decompress_data;
|
coef->pub.decompress_data = decompress_data;
|
||||||
@ -725,7 +725,7 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
|||||||
|
|
||||||
buffer = (JBLOCKROW)
|
buffer = (JBLOCKROW)
|
||||||
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
||||||
for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
|
for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
|
||||||
coef->MCU_buffer[i] = buffer + i;
|
coef->MCU_buffer[i] = buffer + i;
|
||||||
}
|
}
|
||||||
|
52
3rdparty/libjpeg/jdcolor.c
vendored
52
3rdparty/libjpeg/jdcolor.c
vendored
@ -76,26 +76,26 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
cconvert->Cr_r_tab = (int *)
|
cconvert->Cr_r_tab = (int *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||||
cconvert->Cb_b_tab = (int *)
|
cconvert->Cb_b_tab = (int *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||||
cconvert->Cr_g_tab = (INT32 *)
|
cconvert->Cr_g_tab = (INT32 *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||||
cconvert->Cb_g_tab = (INT32 *)
|
cconvert->Cb_g_tab = (INT32 *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||||
|
|
||||||
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
|
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
|
||||||
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
|
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
|
||||||
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
|
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
|
||||||
/* Cr=>R value is nearest int to 1.40200 * x */
|
/* Cr=>R value is nearest int to 1.40200 * x */
|
||||||
cconvert->Cr_r_tab[i] = (int)
|
cconvert->Cr_r_tab[i] = (int)
|
||||||
RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
|
RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
|
||||||
/* Cb=>B value is nearest int to 1.77200 * x */
|
/* Cb=>B value is nearest int to 1.77200 * x */
|
||||||
cconvert->Cb_b_tab[i] = (int)
|
cconvert->Cb_b_tab[i] = (int)
|
||||||
RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
|
RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
|
||||||
/* Cr=>G value is scaled-up -0.71414 * x */
|
/* Cr=>G value is scaled-up -0.71414 * x */
|
||||||
cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;
|
cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;
|
||||||
/* Cb=>G value is scaled-up -0.34414 * x */
|
/* Cb=>G value is scaled-up -0.34414 * x */
|
||||||
@ -118,8 +118,8 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
ycc_rgb_convert (j_decompress_ptr cinfo,
|
ycc_rgb_convert (j_decompress_ptr cinfo,
|
||||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||||
JSAMPARRAY output_buf, int num_rows)
|
JSAMPARRAY output_buf, int num_rows)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||||
register int y, cb, cr;
|
register int y, cb, cr;
|
||||||
@ -148,8 +148,8 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
|
|||||||
/* Range-limiting is essential due to noise introduced by DCT losses. */
|
/* Range-limiting is essential due to noise introduced by DCT losses. */
|
||||||
outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
|
outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
|
||||||
outptr[RGB_GREEN] = range_limit[y +
|
outptr[RGB_GREEN] = range_limit[y +
|
||||||
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
||||||
SCALEBITS))];
|
SCALEBITS))];
|
||||||
outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
|
outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
|
||||||
outptr += RGB_PIXELSIZE;
|
outptr += RGB_PIXELSIZE;
|
||||||
}
|
}
|
||||||
@ -167,8 +167,8 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
null_convert (j_decompress_ptr cinfo,
|
null_convert (j_decompress_ptr cinfo,
|
||||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||||
JSAMPARRAY output_buf, int num_rows)
|
JSAMPARRAY output_buf, int num_rows)
|
||||||
{
|
{
|
||||||
register JSAMPROW inptr, outptr;
|
register JSAMPROW inptr, outptr;
|
||||||
register JDIMENSION count;
|
register JDIMENSION count;
|
||||||
@ -181,8 +181,8 @@ null_convert (j_decompress_ptr cinfo,
|
|||||||
inptr = input_buf[ci][input_row];
|
inptr = input_buf[ci][input_row];
|
||||||
outptr = output_buf[0] + ci;
|
outptr = output_buf[0] + ci;
|
||||||
for (count = num_cols; count > 0; count--) {
|
for (count = num_cols; count > 0; count--) {
|
||||||
*outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */
|
*outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */
|
||||||
outptr += num_components;
|
outptr += num_components;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input_row++;
|
input_row++;
|
||||||
@ -199,11 +199,11 @@ null_convert (j_decompress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
grayscale_convert (j_decompress_ptr cinfo,
|
grayscale_convert (j_decompress_ptr cinfo,
|
||||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||||
JSAMPARRAY output_buf, int num_rows)
|
JSAMPARRAY output_buf, int num_rows)
|
||||||
{
|
{
|
||||||
jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0,
|
jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0,
|
||||||
num_rows, cinfo->output_width);
|
num_rows, cinfo->output_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -215,8 +215,8 @@ grayscale_convert (j_decompress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
gray_rgb_convert (j_decompress_ptr cinfo,
|
gray_rgb_convert (j_decompress_ptr cinfo,
|
||||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||||
JSAMPARRAY output_buf, int num_rows)
|
JSAMPARRAY output_buf, int num_rows)
|
||||||
{
|
{
|
||||||
register JSAMPROW inptr, outptr;
|
register JSAMPROW inptr, outptr;
|
||||||
register JDIMENSION col;
|
register JDIMENSION col;
|
||||||
@ -243,8 +243,8 @@ gray_rgb_convert (j_decompress_ptr cinfo,
|
|||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
ycck_cmyk_convert (j_decompress_ptr cinfo,
|
ycck_cmyk_convert (j_decompress_ptr cinfo,
|
||||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||||
JSAMPARRAY output_buf, int num_rows)
|
JSAMPARRAY output_buf, int num_rows)
|
||||||
{
|
{
|
||||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||||
register int y, cb, cr;
|
register int y, cb, cr;
|
||||||
@ -274,8 +274,8 @@ ycck_cmyk_convert (j_decompress_ptr cinfo,
|
|||||||
/* Range-limiting is essential due to noise introduced by DCT losses. */
|
/* Range-limiting is essential due to noise introduced by DCT losses. */
|
||||||
outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
|
outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
|
||||||
outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
|
outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
|
||||||
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
||||||
SCALEBITS)))];
|
SCALEBITS)))];
|
||||||
outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */
|
outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */
|
||||||
/* K passes through unchanged */
|
/* K passes through unchanged */
|
||||||
outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */
|
outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */
|
||||||
@ -308,7 +308,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
cconvert = (my_cconvert_ptr)
|
cconvert = (my_cconvert_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_color_deconverter));
|
SIZEOF(my_color_deconverter));
|
||||||
cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert;
|
cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert;
|
||||||
cconvert->pub.start_pass = start_pass_dcolor;
|
cconvert->pub.start_pass = start_pass_dcolor;
|
||||||
|
|
||||||
@ -346,11 +346,11 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
|||||||
case JCS_GRAYSCALE:
|
case JCS_GRAYSCALE:
|
||||||
cinfo->out_color_components = 1;
|
cinfo->out_color_components = 1;
|
||||||
if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
|
if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
|
||||||
cinfo->jpeg_color_space == JCS_YCbCr) {
|
cinfo->jpeg_color_space == JCS_YCbCr) {
|
||||||
cconvert->pub.color_convert = grayscale_convert;
|
cconvert->pub.color_convert = grayscale_convert;
|
||||||
/* For color->grayscale conversion, only the Y (0) component is needed */
|
/* For color->grayscale conversion, only the Y (0) component is needed */
|
||||||
for (ci = 1; ci < cinfo->num_components; ci++)
|
for (ci = 1; ci < cinfo->num_components; ci++)
|
||||||
cinfo->comp_info[ci].component_needed = FALSE;
|
cinfo->comp_info[ci].component_needed = FALSE;
|
||||||
} else
|
} else
|
||||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||||
break;
|
break;
|
||||||
|
12
3rdparty/libjpeg/jdct.h
vendored
12
3rdparty/libjpeg/jdct.h
vendored
@ -100,22 +100,22 @@ EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data));
|
|||||||
|
|
||||||
EXTERN(void) jpeg_idct_islow
|
EXTERN(void) jpeg_idct_islow
|
||||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
EXTERN(void) jpeg_idct_ifast
|
EXTERN(void) jpeg_idct_ifast
|
||||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
EXTERN(void) jpeg_idct_float
|
EXTERN(void) jpeg_idct_float
|
||||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
EXTERN(void) jpeg_idct_4x4
|
EXTERN(void) jpeg_idct_4x4
|
||||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
EXTERN(void) jpeg_idct_2x2
|
EXTERN(void) jpeg_idct_2x2
|
||||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
EXTERN(void) jpeg_idct_1x1
|
EXTERN(void) jpeg_idct_1x1
|
||||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
132
3rdparty/libjpeg/jddctmgr.c
vendored
132
3rdparty/libjpeg/jddctmgr.c
vendored
@ -117,25 +117,25 @@ start_pass (j_decompress_ptr cinfo)
|
|||||||
switch (cinfo->dct_method) {
|
switch (cinfo->dct_method) {
|
||||||
#ifdef DCT_ISLOW_SUPPORTED
|
#ifdef DCT_ISLOW_SUPPORTED
|
||||||
case JDCT_ISLOW:
|
case JDCT_ISLOW:
|
||||||
method_ptr = jpeg_idct_islow;
|
method_ptr = jpeg_idct_islow;
|
||||||
method = JDCT_ISLOW;
|
method = JDCT_ISLOW;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DCT_IFAST_SUPPORTED
|
#ifdef DCT_IFAST_SUPPORTED
|
||||||
case JDCT_IFAST:
|
case JDCT_IFAST:
|
||||||
method_ptr = jpeg_idct_ifast;
|
method_ptr = jpeg_idct_ifast;
|
||||||
method = JDCT_IFAST;
|
method = JDCT_IFAST;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DCT_FLOAT_SUPPORTED
|
#ifdef DCT_FLOAT_SUPPORTED
|
||||||
case JDCT_FLOAT:
|
case JDCT_FLOAT:
|
||||||
method_ptr = jpeg_idct_float;
|
method_ptr = jpeg_idct_float;
|
||||||
method = JDCT_FLOAT;
|
method = JDCT_FLOAT;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -160,74 +160,74 @@ start_pass (j_decompress_ptr cinfo)
|
|||||||
#ifdef PROVIDE_ISLOW_TABLES
|
#ifdef PROVIDE_ISLOW_TABLES
|
||||||
case JDCT_ISLOW:
|
case JDCT_ISLOW:
|
||||||
{
|
{
|
||||||
/* For LL&M IDCT method, multipliers are equal to raw quantization
|
/* For LL&M IDCT method, multipliers are equal to raw quantization
|
||||||
* coefficients, but are stored as ints to ensure access efficiency.
|
* coefficients, but are stored as ints to ensure access efficiency.
|
||||||
*/
|
*/
|
||||||
ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table;
|
ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table;
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i];
|
ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DCT_IFAST_SUPPORTED
|
#ifdef DCT_IFAST_SUPPORTED
|
||||||
case JDCT_IFAST:
|
case JDCT_IFAST:
|
||||||
{
|
{
|
||||||
/* For AA&N IDCT method, multipliers are equal to quantization
|
/* For AA&N IDCT method, multipliers are equal to quantization
|
||||||
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
||||||
* scalefactor[0] = 1
|
* scalefactor[0] = 1
|
||||||
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
||||||
* For integer operation, the multiplier table is to be scaled by
|
* For integer operation, the multiplier table is to be scaled by
|
||||||
* IFAST_SCALE_BITS.
|
* IFAST_SCALE_BITS.
|
||||||
*/
|
*/
|
||||||
IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table;
|
IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table;
|
||||||
#define CONST_BITS 14
|
#define CONST_BITS 14
|
||||||
static const INT16 aanscales[DCTSIZE2] = {
|
static const INT16 aanscales[DCTSIZE2] = {
|
||||||
/* precomputed values scaled up by 14 bits */
|
/* precomputed values scaled up by 14 bits */
|
||||||
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
||||||
22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
|
22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
|
||||||
21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
|
21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
|
||||||
19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
|
19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
|
||||||
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
||||||
12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
|
12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
|
||||||
8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
|
8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
|
||||||
4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
|
4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
|
||||||
};
|
};
|
||||||
SHIFT_TEMPS
|
SHIFT_TEMPS
|
||||||
|
|
||||||
for (i = 0; i < DCTSIZE2; i++) {
|
for (i = 0; i < DCTSIZE2; i++) {
|
||||||
ifmtbl[i] = (IFAST_MULT_TYPE)
|
ifmtbl[i] = (IFAST_MULT_TYPE)
|
||||||
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
|
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
|
||||||
(INT32) aanscales[i]),
|
(INT32) aanscales[i]),
|
||||||
CONST_BITS-IFAST_SCALE_BITS);
|
CONST_BITS-IFAST_SCALE_BITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DCT_FLOAT_SUPPORTED
|
#ifdef DCT_FLOAT_SUPPORTED
|
||||||
case JDCT_FLOAT:
|
case JDCT_FLOAT:
|
||||||
{
|
{
|
||||||
/* For float AA&N IDCT method, multipliers are equal to quantization
|
/* For float AA&N IDCT method, multipliers are equal to quantization
|
||||||
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
||||||
* scalefactor[0] = 1
|
* scalefactor[0] = 1
|
||||||
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
||||||
*/
|
*/
|
||||||
FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table;
|
FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table;
|
||||||
int row, col;
|
int row, col;
|
||||||
static const double aanscalefactor[DCTSIZE] = {
|
static const double aanscalefactor[DCTSIZE] = {
|
||||||
1.0, 1.387039845, 1.306562965, 1.175875602,
|
1.0, 1.387039845, 1.306562965, 1.175875602,
|
||||||
1.0, 0.785694958, 0.541196100, 0.275899379
|
1.0, 0.785694958, 0.541196100, 0.275899379
|
||||||
};
|
};
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (row = 0; row < DCTSIZE; row++) {
|
for (row = 0; row < DCTSIZE; row++) {
|
||||||
for (col = 0; col < DCTSIZE; col++) {
|
for (col = 0; col < DCTSIZE; col++) {
|
||||||
fmtbl[i] = (FLOAT_MULT_TYPE)
|
fmtbl[i] = (FLOAT_MULT_TYPE)
|
||||||
((double) qtbl->quantval[i] *
|
((double) qtbl->quantval[i] *
|
||||||
aanscalefactor[row] * aanscalefactor[col]);
|
aanscalefactor[row] * aanscalefactor[col]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -252,7 +252,7 @@ jinit_inverse_dct (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
idct = (my_idct_ptr)
|
idct = (my_idct_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_idct_controller));
|
SIZEOF(my_idct_controller));
|
||||||
cinfo->idct = (struct jpeg_inverse_dct *) idct;
|
cinfo->idct = (struct jpeg_inverse_dct *) idct;
|
||||||
idct->pub.start_pass = start_pass;
|
idct->pub.start_pass = start_pass;
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ jinit_inverse_dct (j_decompress_ptr cinfo)
|
|||||||
/* Allocate and pre-zero a multiplier table for each component */
|
/* Allocate and pre-zero a multiplier table for each component */
|
||||||
compptr->dct_table =
|
compptr->dct_table =
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(multiplier_table));
|
SIZEOF(multiplier_table));
|
||||||
MEMZERO(compptr->dct_table, SIZEOF(multiplier_table));
|
MEMZERO(compptr->dct_table, SIZEOF(multiplier_table));
|
||||||
/* Mark multiplier table not yet set up for any method */
|
/* Mark multiplier table not yet set up for any method */
|
||||||
idct->cur_method[ci] = -1;
|
idct->cur_method[ci] = -1;
|
||||||
|
204
3rdparty/libjpeg/jdhuff.c
vendored
204
3rdparty/libjpeg/jdhuff.c
vendored
@ -41,10 +41,10 @@ typedef struct {
|
|||||||
#else
|
#else
|
||||||
#if MAX_COMPS_IN_SCAN == 4
|
#if MAX_COMPS_IN_SCAN == 4
|
||||||
#define ASSIGN_STATE(dest,src) \
|
#define ASSIGN_STATE(dest,src) \
|
||||||
((dest).last_dc_val[0] = (src).last_dc_val[0], \
|
((dest).last_dc_val[0] = (src).last_dc_val[0], \
|
||||||
(dest).last_dc_val[1] = (src).last_dc_val[1], \
|
(dest).last_dc_val[1] = (src).last_dc_val[1], \
|
||||||
(dest).last_dc_val[2] = (src).last_dc_val[2], \
|
(dest).last_dc_val[2] = (src).last_dc_val[2], \
|
||||||
(dest).last_dc_val[3] = (src).last_dc_val[3])
|
(dest).last_dc_val[3] = (src).last_dc_val[3])
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -104,9 +104,9 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
|||||||
/* Compute derived values for Huffman tables */
|
/* Compute derived values for Huffman tables */
|
||||||
/* We may do this more than once for a table, but it's not expensive */
|
/* We may do this more than once for a table, but it's not expensive */
|
||||||
jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
|
jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
|
||||||
& entropy->dc_derived_tbls[dctbl]);
|
& entropy->dc_derived_tbls[dctbl]);
|
||||||
jpeg_make_d_derived_tbl(cinfo, FALSE, actbl,
|
jpeg_make_d_derived_tbl(cinfo, FALSE, actbl,
|
||||||
& entropy->ac_derived_tbls[actbl]);
|
& entropy->ac_derived_tbls[actbl]);
|
||||||
/* Initialize DC predictions to 0 */
|
/* Initialize DC predictions to 0 */
|
||||||
entropy->saved.last_dc_val[ci] = 0;
|
entropy->saved.last_dc_val[ci] = 0;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
|
jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
|
||||||
d_derived_tbl ** pdtbl)
|
d_derived_tbl ** pdtbl)
|
||||||
{
|
{
|
||||||
JHUFF_TBL *htbl;
|
JHUFF_TBL *htbl;
|
||||||
d_derived_tbl *dtbl;
|
d_derived_tbl *dtbl;
|
||||||
@ -173,7 +173,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
if (*pdtbl == NULL)
|
if (*pdtbl == NULL)
|
||||||
*pdtbl = (d_derived_tbl *)
|
*pdtbl = (d_derived_tbl *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(d_derived_tbl));
|
SIZEOF(d_derived_tbl));
|
||||||
dtbl = *pdtbl;
|
dtbl = *pdtbl;
|
||||||
dtbl->pub = htbl; /* fill in back link */
|
dtbl->pub = htbl; /* fill in back link */
|
||||||
|
|
||||||
@ -243,9 +243,9 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
/* Generate left-justified code followed by all possible bit sequences */
|
/* Generate left-justified code followed by all possible bit sequences */
|
||||||
lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l);
|
lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l);
|
||||||
for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) {
|
for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) {
|
||||||
dtbl->look_nbits[lookbits] = l;
|
dtbl->look_nbits[lookbits] = l;
|
||||||
dtbl->look_sym[lookbits] = htbl->huffval[p];
|
dtbl->look_sym[lookbits] = htbl->huffval[p];
|
||||||
lookbits++;
|
lookbits++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
for (i = 0; i < numsymbols; i++) {
|
for (i = 0; i < numsymbols; i++) {
|
||||||
int sym = htbl->huffval[i];
|
int sym = htbl->huffval[i];
|
||||||
if (sym < 0 || sym > 15)
|
if (sym < 0 || sym > 15)
|
||||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,8 +290,8 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
|
|||||||
|
|
||||||
GLOBAL(boolean)
|
GLOBAL(boolean)
|
||||||
jpeg_fill_bit_buffer (bitread_working_state * state,
|
jpeg_fill_bit_buffer (bitread_working_state * state,
|
||||||
register bit_buf_type get_buffer, register int bits_left,
|
register bit_buf_type get_buffer, register int bits_left,
|
||||||
int nbits)
|
int nbits)
|
||||||
/* Load up the bit buffer to a depth of at least nbits */
|
/* Load up the bit buffer to a depth of at least nbits */
|
||||||
{
|
{
|
||||||
/* Copy heavily used state fields into locals (hopefully registers) */
|
/* Copy heavily used state fields into locals (hopefully registers) */
|
||||||
@ -309,48 +309,48 @@ jpeg_fill_bit_buffer (bitread_working_state * state,
|
|||||||
|
|
||||||
/* Attempt to read a byte */
|
/* Attempt to read a byte */
|
||||||
if (bytes_in_buffer == 0) {
|
if (bytes_in_buffer == 0) {
|
||||||
if (! (*cinfo->src->fill_input_buffer) (cinfo))
|
if (! (*cinfo->src->fill_input_buffer) (cinfo))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
next_input_byte = cinfo->src->next_input_byte;
|
next_input_byte = cinfo->src->next_input_byte;
|
||||||
bytes_in_buffer = cinfo->src->bytes_in_buffer;
|
bytes_in_buffer = cinfo->src->bytes_in_buffer;
|
||||||
}
|
}
|
||||||
bytes_in_buffer--;
|
bytes_in_buffer--;
|
||||||
c = GETJOCTET(*next_input_byte++);
|
c = GETJOCTET(*next_input_byte++);
|
||||||
|
|
||||||
/* If it's 0xFF, check and discard stuffed zero byte */
|
/* If it's 0xFF, check and discard stuffed zero byte */
|
||||||
if (c == 0xFF) {
|
if (c == 0xFF) {
|
||||||
/* Loop here to discard any padding FF's on terminating marker,
|
/* Loop here to discard any padding FF's on terminating marker,
|
||||||
* so that we can save a valid unread_marker value. NOTE: we will
|
* so that we can save a valid unread_marker value. NOTE: we will
|
||||||
* accept multiple FF's followed by a 0 as meaning a single FF data
|
* accept multiple FF's followed by a 0 as meaning a single FF data
|
||||||
* byte. This data pattern is not valid according to the standard.
|
* byte. This data pattern is not valid according to the standard.
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
if (bytes_in_buffer == 0) {
|
if (bytes_in_buffer == 0) {
|
||||||
if (! (*cinfo->src->fill_input_buffer) (cinfo))
|
if (! (*cinfo->src->fill_input_buffer) (cinfo))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
next_input_byte = cinfo->src->next_input_byte;
|
next_input_byte = cinfo->src->next_input_byte;
|
||||||
bytes_in_buffer = cinfo->src->bytes_in_buffer;
|
bytes_in_buffer = cinfo->src->bytes_in_buffer;
|
||||||
}
|
}
|
||||||
bytes_in_buffer--;
|
bytes_in_buffer--;
|
||||||
c = GETJOCTET(*next_input_byte++);
|
c = GETJOCTET(*next_input_byte++);
|
||||||
} while (c == 0xFF);
|
} while (c == 0xFF);
|
||||||
|
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
/* Found FF/00, which represents an FF data byte */
|
/* Found FF/00, which represents an FF data byte */
|
||||||
c = 0xFF;
|
c = 0xFF;
|
||||||
} else {
|
} else {
|
||||||
/* Oops, it's actually a marker indicating end of compressed data.
|
/* Oops, it's actually a marker indicating end of compressed data.
|
||||||
* Save the marker code for later use.
|
* Save the marker code for later use.
|
||||||
* Fine point: it might appear that we should save the marker into
|
* Fine point: it might appear that we should save the marker into
|
||||||
* bitread working state, not straight into permanent state. But
|
* bitread working state, not straight into permanent state. But
|
||||||
* once we have hit a marker, we cannot need to suspend within the
|
* once we have hit a marker, we cannot need to suspend within the
|
||||||
* current MCU, because we will read no more bytes from the data
|
* current MCU, because we will read no more bytes from the data
|
||||||
* source. So it is OK to update permanent state right away.
|
* source. So it is OK to update permanent state right away.
|
||||||
*/
|
*/
|
||||||
cinfo->unread_marker = c;
|
cinfo->unread_marker = c;
|
||||||
/* See if we need to insert some fake zero bits. */
|
/* See if we need to insert some fake zero bits. */
|
||||||
goto no_more_bytes;
|
goto no_more_bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OK, load c into get_buffer */
|
/* OK, load c into get_buffer */
|
||||||
@ -370,8 +370,8 @@ jpeg_fill_bit_buffer (bitread_working_state * state,
|
|||||||
* appears per data segment.
|
* appears per data segment.
|
||||||
*/
|
*/
|
||||||
if (! cinfo->entropy->insufficient_data) {
|
if (! cinfo->entropy->insufficient_data) {
|
||||||
WARNMS(cinfo, JWRN_HIT_MARKER);
|
WARNMS(cinfo, JWRN_HIT_MARKER);
|
||||||
cinfo->entropy->insufficient_data = TRUE;
|
cinfo->entropy->insufficient_data = TRUE;
|
||||||
}
|
}
|
||||||
/* Fill the buffer with zero bits */
|
/* Fill the buffer with zero bits */
|
||||||
get_buffer <<= MIN_GET_BITS - bits_left;
|
get_buffer <<= MIN_GET_BITS - bits_left;
|
||||||
@ -396,8 +396,8 @@ jpeg_fill_bit_buffer (bitread_working_state * state,
|
|||||||
|
|
||||||
GLOBAL(int)
|
GLOBAL(int)
|
||||||
jpeg_huff_decode (bitread_working_state * state,
|
jpeg_huff_decode (bitread_working_state * state,
|
||||||
register bit_buf_type get_buffer, register int bits_left,
|
register bit_buf_type get_buffer, register int bits_left,
|
||||||
d_derived_tbl * htbl, int min_bits)
|
d_derived_tbl * htbl, int min_bits)
|
||||||
{
|
{
|
||||||
register int l = min_bits;
|
register int l = min_bits;
|
||||||
register INT32 code;
|
register INT32 code;
|
||||||
@ -525,7 +525,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
if (cinfo->restart_interval) {
|
if (cinfo->restart_interval) {
|
||||||
if (entropy->restarts_to_go == 0)
|
if (entropy->restarts_to_go == 0)
|
||||||
if (! process_restart(cinfo))
|
if (! process_restart(cinfo))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we've run out of data, just leave the MCU set to zeroes.
|
/* If we've run out of data, just leave the MCU set to zeroes.
|
||||||
@ -550,67 +550,67 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
/* Section F.2.2.1: decode the DC coefficient difference */
|
/* Section F.2.2.1: decode the DC coefficient difference */
|
||||||
HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
|
HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
|
||||||
if (s) {
|
if (s) {
|
||||||
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
||||||
r = GET_BITS(s);
|
r = GET_BITS(s);
|
||||||
s = HUFF_EXTEND(r, s);
|
s = HUFF_EXTEND(r, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entropy->dc_needed[blkn]) {
|
if (entropy->dc_needed[blkn]) {
|
||||||
/* Convert DC difference to actual value, update last_dc_val */
|
/* Convert DC difference to actual value, update last_dc_val */
|
||||||
int ci = cinfo->MCU_membership[blkn];
|
int ci = cinfo->MCU_membership[blkn];
|
||||||
s += state.last_dc_val[ci];
|
s += state.last_dc_val[ci];
|
||||||
state.last_dc_val[ci] = s;
|
state.last_dc_val[ci] = s;
|
||||||
/* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
|
/* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
|
||||||
(*block)[0] = (JCOEF) s;
|
(*block)[0] = (JCOEF) s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entropy->ac_needed[blkn]) {
|
if (entropy->ac_needed[blkn]) {
|
||||||
|
|
||||||
/* Section F.2.2.2: decode the AC coefficients */
|
/* Section F.2.2.2: decode the AC coefficients */
|
||||||
/* Since zeroes are skipped, output area must be cleared beforehand */
|
/* Since zeroes are skipped, output area must be cleared beforehand */
|
||||||
for (k = 1; k < DCTSIZE2; k++) {
|
for (k = 1; k < DCTSIZE2; k++) {
|
||||||
HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
|
HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
|
||||||
|
|
||||||
r = s >> 4;
|
r = s >> 4;
|
||||||
s &= 15;
|
s &= 15;
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
k += r;
|
k += r;
|
||||||
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
||||||
r = GET_BITS(s);
|
r = GET_BITS(s);
|
||||||
s = HUFF_EXTEND(r, s);
|
s = HUFF_EXTEND(r, s);
|
||||||
/* Output coefficient in natural (dezigzagged) order.
|
/* Output coefficient in natural (dezigzagged) order.
|
||||||
* Note: the extra entries in jpeg_natural_order[] will save us
|
* Note: the extra entries in jpeg_natural_order[] will save us
|
||||||
* if k >= DCTSIZE2, which could happen if the data is corrupted.
|
* if k >= DCTSIZE2, which could happen if the data is corrupted.
|
||||||
*/
|
*/
|
||||||
(*block)[jpeg_natural_order[k]] = (JCOEF) s;
|
(*block)[jpeg_natural_order[k]] = (JCOEF) s;
|
||||||
} else {
|
} else {
|
||||||
if (r != 15)
|
if (r != 15)
|
||||||
break;
|
break;
|
||||||
k += 15;
|
k += 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Section F.2.2.2: decode the AC coefficients */
|
/* Section F.2.2.2: decode the AC coefficients */
|
||||||
/* In this path we just discard the values */
|
/* In this path we just discard the values */
|
||||||
for (k = 1; k < DCTSIZE2; k++) {
|
for (k = 1; k < DCTSIZE2; k++) {
|
||||||
HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
|
HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
|
||||||
|
|
||||||
r = s >> 4;
|
r = s >> 4;
|
||||||
s &= 15;
|
s &= 15;
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
k += r;
|
k += r;
|
||||||
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
||||||
DROP_BITS(s);
|
DROP_BITS(s);
|
||||||
} else {
|
} else {
|
||||||
if (r != 15)
|
if (r != 15)
|
||||||
break;
|
break;
|
||||||
k += 15;
|
k += 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -639,7 +639,7 @@ jinit_huff_decoder (j_decompress_ptr cinfo)
|
|||||||
|
|
||||||
entropy = (huff_entropy_ptr)
|
entropy = (huff_entropy_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(huff_entropy_decoder));
|
SIZEOF(huff_entropy_decoder));
|
||||||
cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
|
cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
|
||||||
entropy->pub.start_pass = start_pass_huff_decoder;
|
entropy->pub.start_pass = start_pass_huff_decoder;
|
||||||
entropy->pub.decode_mcu = decode_mcu;
|
entropy->pub.decode_mcu = decode_mcu;
|
||||||
|
52
3rdparty/libjpeg/jdhuff.h
vendored
52
3rdparty/libjpeg/jdhuff.h
vendored
@ -47,8 +47,8 @@ typedef struct {
|
|||||||
|
|
||||||
/* Expand a Huffman table definition into the derived format */
|
/* Expand a Huffman table definition into the derived format */
|
||||||
EXTERN(void) jpeg_make_d_derived_tbl
|
EXTERN(void) jpeg_make_d_derived_tbl
|
||||||
JPP((j_decompress_ptr cinfo, boolean isDC, int tblno,
|
JPP((j_decompress_ptr cinfo, boolean isDC, int tblno,
|
||||||
d_derived_tbl ** pdtbl));
|
d_derived_tbl ** pdtbl));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -100,22 +100,22 @@ typedef struct { /* Bitreading working state within an MCU */
|
|||||||
|
|
||||||
/* Macros to declare and load/save bitread local variables. */
|
/* Macros to declare and load/save bitread local variables. */
|
||||||
#define BITREAD_STATE_VARS \
|
#define BITREAD_STATE_VARS \
|
||||||
register bit_buf_type get_buffer; \
|
register bit_buf_type get_buffer; \
|
||||||
register int bits_left; \
|
register int bits_left; \
|
||||||
bitread_working_state br_state
|
bitread_working_state br_state
|
||||||
|
|
||||||
#define BITREAD_LOAD_STATE(cinfop,permstate) \
|
#define BITREAD_LOAD_STATE(cinfop,permstate) \
|
||||||
br_state.cinfo = cinfop; \
|
br_state.cinfo = cinfop; \
|
||||||
br_state.next_input_byte = cinfop->src->next_input_byte; \
|
br_state.next_input_byte = cinfop->src->next_input_byte; \
|
||||||
br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
|
br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
|
||||||
get_buffer = permstate.get_buffer; \
|
get_buffer = permstate.get_buffer; \
|
||||||
bits_left = permstate.bits_left;
|
bits_left = permstate.bits_left;
|
||||||
|
|
||||||
#define BITREAD_SAVE_STATE(cinfop,permstate) \
|
#define BITREAD_SAVE_STATE(cinfop,permstate) \
|
||||||
cinfop->src->next_input_byte = br_state.next_input_byte; \
|
cinfop->src->next_input_byte = br_state.next_input_byte; \
|
||||||
cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
|
cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
|
||||||
permstate.get_buffer = get_buffer; \
|
permstate.get_buffer = get_buffer; \
|
||||||
permstate.bits_left = bits_left
|
permstate.bits_left = bits_left
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These macros provide the in-line portion of bit fetching.
|
* These macros provide the in-line portion of bit fetching.
|
||||||
@ -136,24 +136,24 @@ typedef struct { /* Bitreading working state within an MCU */
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define CHECK_BIT_BUFFER(state,nbits,action) \
|
#define CHECK_BIT_BUFFER(state,nbits,action) \
|
||||||
{ if (bits_left < (nbits)) { \
|
{ if (bits_left < (nbits)) { \
|
||||||
if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \
|
if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \
|
||||||
{ action; } \
|
{ action; } \
|
||||||
get_buffer = (state).get_buffer; bits_left = (state).bits_left; } }
|
get_buffer = (state).get_buffer; bits_left = (state).bits_left; } }
|
||||||
|
|
||||||
#define GET_BITS(nbits) \
|
#define GET_BITS(nbits) \
|
||||||
(((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1))
|
(((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1))
|
||||||
|
|
||||||
#define PEEK_BITS(nbits) \
|
#define PEEK_BITS(nbits) \
|
||||||
(((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1))
|
(((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1))
|
||||||
|
|
||||||
#define DROP_BITS(nbits) \
|
#define DROP_BITS(nbits) \
|
||||||
(bits_left -= (nbits))
|
(bits_left -= (nbits))
|
||||||
|
|
||||||
/* Load up the bit buffer to a depth of at least nbits */
|
/* Load up the bit buffer to a depth of at least nbits */
|
||||||
EXTERN(boolean) jpeg_fill_bit_buffer
|
EXTERN(boolean) jpeg_fill_bit_buffer
|
||||||
JPP((bitread_working_state * state, register bit_buf_type get_buffer,
|
JPP((bitread_working_state * state, register bit_buf_type get_buffer,
|
||||||
register int bits_left, int nbits));
|
register int bits_left, int nbits));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -190,12 +190,12 @@ EXTERN(boolean) jpeg_fill_bit_buffer
|
|||||||
nb = HUFF_LOOKAHEAD+1; \
|
nb = HUFF_LOOKAHEAD+1; \
|
||||||
slowlabel: \
|
slowlabel: \
|
||||||
if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \
|
if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \
|
||||||
{ failaction; } \
|
{ failaction; } \
|
||||||
get_buffer = state.get_buffer; bits_left = state.bits_left; \
|
get_buffer = state.get_buffer; bits_left = state.bits_left; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Out-of-line case for Huffman code fetching */
|
/* Out-of-line case for Huffman code fetching */
|
||||||
EXTERN(int) jpeg_huff_decode
|
EXTERN(int) jpeg_huff_decode
|
||||||
JPP((bitread_working_state * state, register bit_buf_type get_buffer,
|
JPP((bitread_working_state * state, register bit_buf_type get_buffer,
|
||||||
register int bits_left, d_derived_tbl * htbl, int min_bits));
|
register int bits_left, d_derived_tbl * htbl, int min_bits));
|
||||||
|
40
3rdparty/libjpeg/jdinput.c
vendored
40
3rdparty/libjpeg/jdinput.c
vendored
@ -54,7 +54,7 @@ initial_setup (j_decompress_ptr cinfo)
|
|||||||
/* Check that number of components won't exceed internal array sizes */
|
/* Check that number of components won't exceed internal array sizes */
|
||||||
if (cinfo->num_components > MAX_COMPONENTS)
|
if (cinfo->num_components > MAX_COMPONENTS)
|
||||||
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
|
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
|
||||||
MAX_COMPONENTS);
|
MAX_COMPONENTS);
|
||||||
|
|
||||||
/* Compute maximum sampling factors; check factor validity */
|
/* Compute maximum sampling factors; check factor validity */
|
||||||
cinfo->max_h_samp_factor = 1;
|
cinfo->max_h_samp_factor = 1;
|
||||||
@ -62,12 +62,12 @@ initial_setup (j_decompress_ptr cinfo)
|
|||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
|
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
|
||||||
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
|
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
|
||||||
ERREXIT(cinfo, JERR_BAD_SAMPLING);
|
ERREXIT(cinfo, JERR_BAD_SAMPLING);
|
||||||
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
|
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
|
||||||
compptr->h_samp_factor);
|
compptr->h_samp_factor);
|
||||||
cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
|
cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
|
||||||
compptr->v_samp_factor);
|
compptr->v_samp_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
|
/* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
|
||||||
@ -83,10 +83,10 @@ initial_setup (j_decompress_ptr cinfo)
|
|||||||
/* Size in DCT blocks */
|
/* Size in DCT blocks */
|
||||||
compptr->width_in_blocks = (JDIMENSION)
|
compptr->width_in_blocks = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
||||||
(long) (cinfo->max_h_samp_factor * DCTSIZE));
|
(long) (cinfo->max_h_samp_factor * DCTSIZE));
|
||||||
compptr->height_in_blocks = (JDIMENSION)
|
compptr->height_in_blocks = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
||||||
(long) (cinfo->max_v_samp_factor * DCTSIZE));
|
(long) (cinfo->max_v_samp_factor * DCTSIZE));
|
||||||
/* downsampled_width and downsampled_height will also be overridden by
|
/* downsampled_width and downsampled_height will also be overridden by
|
||||||
* jdmaster.c if we are doing full decompression. The transcoder library
|
* jdmaster.c if we are doing full decompression. The transcoder library
|
||||||
* doesn't use these values, but the calling application might.
|
* doesn't use these values, but the calling application might.
|
||||||
@ -94,10 +94,10 @@ initial_setup (j_decompress_ptr cinfo)
|
|||||||
/* Size in samples */
|
/* Size in samples */
|
||||||
compptr->downsampled_width = (JDIMENSION)
|
compptr->downsampled_width = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
||||||
(long) cinfo->max_h_samp_factor);
|
(long) cinfo->max_h_samp_factor);
|
||||||
compptr->downsampled_height = (JDIMENSION)
|
compptr->downsampled_height = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
||||||
(long) cinfo->max_v_samp_factor);
|
(long) cinfo->max_v_samp_factor);
|
||||||
/* Mark component needed, until color conversion says otherwise */
|
/* Mark component needed, until color conversion says otherwise */
|
||||||
compptr->component_needed = TRUE;
|
compptr->component_needed = TRUE;
|
||||||
/* Mark no quantization table yet saved for component */
|
/* Mark no quantization table yet saved for component */
|
||||||
@ -107,7 +107,7 @@ initial_setup (j_decompress_ptr cinfo)
|
|||||||
/* Compute number of fully interleaved MCU rows. */
|
/* Compute number of fully interleaved MCU rows. */
|
||||||
cinfo->total_iMCU_rows = (JDIMENSION)
|
cinfo->total_iMCU_rows = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_height,
|
jdiv_round_up((long) cinfo->image_height,
|
||||||
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
||||||
|
|
||||||
/* Decide whether file contains multiple scans */
|
/* Decide whether file contains multiple scans */
|
||||||
if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
|
if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
|
||||||
@ -156,15 +156,15 @@ per_scan_setup (j_decompress_ptr cinfo)
|
|||||||
/* Interleaved (multi-component) scan */
|
/* Interleaved (multi-component) scan */
|
||||||
if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
|
if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
|
||||||
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
|
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
|
||||||
MAX_COMPS_IN_SCAN);
|
MAX_COMPS_IN_SCAN);
|
||||||
|
|
||||||
/* Overall image size in MCUs */
|
/* Overall image size in MCUs */
|
||||||
cinfo->MCUs_per_row = (JDIMENSION)
|
cinfo->MCUs_per_row = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_width,
|
jdiv_round_up((long) cinfo->image_width,
|
||||||
(long) (cinfo->max_h_samp_factor*DCTSIZE));
|
(long) (cinfo->max_h_samp_factor*DCTSIZE));
|
||||||
cinfo->MCU_rows_in_scan = (JDIMENSION)
|
cinfo->MCU_rows_in_scan = (JDIMENSION)
|
||||||
jdiv_round_up((long) cinfo->image_height,
|
jdiv_round_up((long) cinfo->image_height,
|
||||||
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
||||||
|
|
||||||
cinfo->blocks_in_MCU = 0;
|
cinfo->blocks_in_MCU = 0;
|
||||||
|
|
||||||
@ -185,9 +185,9 @@ per_scan_setup (j_decompress_ptr cinfo)
|
|||||||
/* Prepare array describing MCU composition */
|
/* Prepare array describing MCU composition */
|
||||||
mcublks = compptr->MCU_blocks;
|
mcublks = compptr->MCU_blocks;
|
||||||
if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
|
if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
|
||||||
ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
|
ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
|
||||||
while (mcublks-- > 0) {
|
while (mcublks-- > 0) {
|
||||||
cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
|
cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,12 +231,12 @@ latch_quant_tables (j_decompress_ptr cinfo)
|
|||||||
/* Make sure specified quantization table is present */
|
/* Make sure specified quantization table is present */
|
||||||
qtblno = compptr->quant_tbl_no;
|
qtblno = compptr->quant_tbl_no;
|
||||||
if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
|
if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
|
||||||
cinfo->quant_tbl_ptrs[qtblno] == NULL)
|
cinfo->quant_tbl_ptrs[qtblno] == NULL)
|
||||||
ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
|
ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
|
||||||
/* OK, save away the quantization table */
|
/* OK, save away the quantization table */
|
||||||
qtbl = (JQUANT_TBL *)
|
qtbl = (JQUANT_TBL *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(JQUANT_TBL));
|
SIZEOF(JQUANT_TBL));
|
||||||
MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL));
|
MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL));
|
||||||
compptr->quant_table = qtbl;
|
compptr->quant_table = qtbl;
|
||||||
}
|
}
|
||||||
@ -306,7 +306,7 @@ consume_markers (j_decompress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
} else { /* 2nd or later SOS marker */
|
} else { /* 2nd or later SOS marker */
|
||||||
if (! inputctl->pub.has_multiple_scans)
|
if (! inputctl->pub.has_multiple_scans)
|
||||||
ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
|
ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
|
||||||
start_input_pass(cinfo);
|
start_input_pass(cinfo);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -314,13 +314,13 @@ consume_markers (j_decompress_ptr cinfo)
|
|||||||
inputctl->pub.eoi_reached = TRUE;
|
inputctl->pub.eoi_reached = TRUE;
|
||||||
if (inputctl->inheaders) { /* Tables-only datastream, apparently */
|
if (inputctl->inheaders) { /* Tables-only datastream, apparently */
|
||||||
if (cinfo->marker->saw_SOF)
|
if (cinfo->marker->saw_SOF)
|
||||||
ERREXIT(cinfo, JERR_SOF_NO_SOS);
|
ERREXIT(cinfo, JERR_SOF_NO_SOS);
|
||||||
} else {
|
} else {
|
||||||
/* Prevent infinite loop in coef ctlr's decompress_data routine
|
/* Prevent infinite loop in coef ctlr's decompress_data routine
|
||||||
* if user set output_scan_number larger than number of scans.
|
* if user set output_scan_number larger than number of scans.
|
||||||
*/
|
*/
|
||||||
if (cinfo->output_scan_number > cinfo->input_scan_number)
|
if (cinfo->output_scan_number > cinfo->input_scan_number)
|
||||||
cinfo->output_scan_number = cinfo->input_scan_number;
|
cinfo->output_scan_number = cinfo->input_scan_number;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JPEG_SUSPENDED:
|
case JPEG_SUSPENDED:
|
||||||
@ -365,7 +365,7 @@ jinit_input_controller (j_decompress_ptr cinfo)
|
|||||||
/* Create subobject in permanent pool */
|
/* Create subobject in permanent pool */
|
||||||
inputctl = (my_inputctl_ptr)
|
inputctl = (my_inputctl_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||||
SIZEOF(my_input_controller));
|
SIZEOF(my_input_controller));
|
||||||
cinfo->inputctl = (struct jpeg_input_controller *) inputctl;
|
cinfo->inputctl = (struct jpeg_input_controller *) inputctl;
|
||||||
/* Initialize method pointers */
|
/* Initialize method pointers */
|
||||||
inputctl->pub.consume_input = consume_markers;
|
inputctl->pub.consume_input = consume_markers;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user