summaryrefslogtreecommitdiff
path: root/src/include/codec
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/codec')
-rwxr-xr-xsrc/include/codec/AGifFrameInfo.h64
-rwxr-xr-xsrc/include/codec/IfegDecodeAGIF.h57
-rw-r--r--src/include/codec/img-codec-agif.h28
-rwxr-xr-xsrc/include/codec/img-codec-common.h276
-rwxr-xr-xsrc/include/codec/img-codec-config.h26
-rwxr-xr-xsrc/include/codec/img-codec-osal.h127
-rwxr-xr-xsrc/include/codec/img-codec-parser.h26
-rwxr-xr-xsrc/include/codec/img-codec.h48
8 files changed, 21 insertions, 631 deletions
diff --git a/src/include/codec/AGifFrameInfo.h b/src/include/codec/AGifFrameInfo.h
deleted file mode 100755
index e5ab7b1..0000000
--- a/src/include/codec/AGifFrameInfo.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * libmedia-thumbnail
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _AGIFFRAMEINFO_H_
-#define _AGIFFRAMEINFO_H_
-
-typedef struct tagFrameInfo {
- int height;
- int width;
- unsigned int backcolor;
- unsigned int ui_backcolor;
- int imgCount;
- int inputSize;
-
- unsigned char *pEncodedData;
- void *pOutBits;
-
- unsigned char *pPrevImg;
- unsigned int *pGlobal_table;
- unsigned short *pPrefix;
- unsigned char *pDstack;
- unsigned char *pSuffix;
-
- int flag;
- int size;
- int useBuffer;
- int bLoop;
- int global_numcol;
- int resizedwidth;
- int resizedheight;
- int logi_wdt;
- int logi_hgt;
- int offset;
- int firstpos;
-
- unsigned short delay;
-
-#ifdef INTERNAL_IMGCODEC
- int nRepeatCount;
- int nLoopCount;
-
- unsigned char bOneFrame;
-#endif
-} AGifFrameInfo;
-
-#endif // _AGIFFRAMEINFO_H_
diff --git a/src/include/codec/IfegDecodeAGIF.h b/src/include/codec/IfegDecodeAGIF.h
deleted file mode 100755
index 3504ff6..0000000
--- a/src/include/codec/IfegDecodeAGIF.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * libmedia-thumbnail
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _IFEG_DECODE_GIF_H_
-#define _IFEG_DECODE_GIF_H_
-
-
-
-#include "AGifFrameInfo.h"
-#include "img-codec-common.h"
-
-
-
-#define MODE 0
-
-#define MAX_GIF_HEADER_SIZE 4096
-
-#if MODE == 2
-#define MAXBUFFMEMORY 330000
-#endif
-
-#define MAXWIDTH 4096
-#define MAXHEIGHT 4096
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-int FastImgGetNextFrameAGIF(AGifFrameInfo* pFrameData, BOOL bCenterAlign);
-AGifFrameInfo* FastImgCreateAGIFFrameData(unsigned int width, unsigned int height, unsigned char *pEncodedData, unsigned int file_size, unsigned int ui_backcolor, BOOL bLoop);
-void FastImgDestroyAGIFFrameData(AGifFrameInfo* pFrameData);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /*_IFEG_DECODER_H_*/
diff --git a/src/include/codec/img-codec-agif.h b/src/include/codec/img-codec-agif.h
deleted file mode 100644
index 4480bd8..0000000
--- a/src/include/codec/img-codec-agif.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * libmedia-thumbnail
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _IMGCODEC_AGIF_H_
-#define _IMGCODEC_AGIF_H_
-
-#include "IfegDecodeAGIF.h"
-
-#endif /*_IMGCODEC_AGIF_H_*/
-
diff --git a/src/include/codec/img-codec-common.h b/src/include/codec/img-codec-common.h
deleted file mode 100755
index 91c01b4..0000000
--- a/src/include/codec/img-codec-common.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * libmedia-thumbnail
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _IMGCODEC_COMMON_H_
-#define _IMGCODEC_COMMON_H_
-
-#include "img-codec-config.h"
-#include "img-codec-osal.h"
-#include <stdio.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-//////////////////////////////////////////////////////////////
-
-/* Maximum Image File Size Supported */
-#define IMG_MAX_IMAGE_FILE_SIZE (10 * 1024 * 1024)
-
-//////////////////////////////////////////////////////////////
-#if 0
-#define ImgDebug(type, fmt, arg...) \
- do { \
- fprintf(stderr, "[Media-SVC]"fmt, ##arg); \
- } while (0)
-
-
-#define SysRequireEx(expr, retValue) \
- if (!(expr)) { \
- fprintf(stderr, "[Media-SVC][%s] INVALID_PARAM (%d lines in %s)\n", __FUNCTION__, __LINE__, __FILE__); \
- return (retValue); \
- }
-#define SysDebug(X) ImgDebug X
-
-#define SysAssert(expr)
-#else
-#define SysRequireEx(expr, retValue)
-#define SysDebug(expr, retValue)
-#define SysAssert(expr)
-#endif
-
-//////////////////////////////////////////////////////////////
-
-
-typedef enum {
- IMG_INFO_DECODING_FAIL = 0,
- IMG_INFO_DECODING_SUCCESS = 1,
- IMG_INFO_AGIF_LAST_FRAME = 2,
- IMG_INFO_TOO_BIG_FILE_SIZE = -1,
- IMG_INFO_TOO_LARGE_SCALE = -2,
- IMG_INFO_TOO_BIG_PROGRESSIVE = -3,
- IMG_INFO_UNKNOWN_FORMAT = -4,
- IMG_INFO_FILE_ERR = -5,
- IMG_INFO_MEM_ALLOC_FAIL = -6
-} ImgFastCodecInfo;
-
-typedef enum inputFlag {
- IMG_RGB_888_OUTPUT = 0x0001,
- IMG_RGB_OUTPUT = 0x0002,
- IMG_YUV_OUTPUT = 0x0005
-} ImgInputFlag;
-
-typedef enum resize {
- /* During resizing aspect ratio will be maintained */
- IMG_RESIZE_MAINTAIN_ASPECT_RATIO = 0x0001,
- IMG_RESIZE = 0x0002
-} ImgResizeInput;
-
-
-typedef struct tagImgImageInfo {
- unsigned int width;
- unsigned int height;
- unsigned int numberOfFrame;
- unsigned int delay; //deprecated.
- unsigned int bOrientation; //deprecated.
-} ImgImageInfo;
-
-typedef struct tagImgBitmap {
- int width;
- int height;
- UCHAR bitsPerPixel; /* For TIF it should be 8 or 4 or 1 always
- * If coming directly from camera and
- * bitsperpixel is 16 then its assumed as 8
- * & color type as RGBC and compression
- * type as NO_COMP and encode it.
- */
-
- void *pBits;
- BOOL bChromaKeyFlag; /* Flag to indicate chroma key
- * Default: FALSE
- */
- ULONG chromaKey; /* This is the colour which needs to be (or is) transparent.
- * This colour will be in 5, 5, 5 RGB format as below.
- * First 16 MS Bits 0, R (5), G (5), 0 (1), B (5)
- */
- UCHAR disposal; /* Disposal action to take during
- * display of current flag
- * Default: 0
- */
- USHORT delay; /* Delay before display of
- * next frame. Default: 0
- */
- BOOL inputFlag; /* User input required befflag used
- * Default: FALSE
- */
-
- BOOL interlace; /* Interlace indicator flag
- * Default: FALSE
- */
- BYTE *pLocalColorMap; /* Local color palette pointer
- * Default: NULL
- */
- /* For TIF :Should be given if PALETTE color type.
- */
- USHORT localColorMapSize; /* Local color palette size */
- /* In TIF: Should be given if PALETTE color type.
- */
- void *pAlphaChannel; /* An alpha channel, representing transparency
- * information on a per-pixel basis
- */
- BYTE colorType ; /* Indicates the color type of image. It can be
- * GRAY, COLOR, PALETTED, GRAY_WITH_ALPHA_CHANNEL or
- * COLOR_WITH_ALPHA_CHANNEL
- */
- /* For TIF: IT could be TIF_COLORTYPE_BILEVEL,
- * TIF_COLORTYPE_GRAY ,TIF_COLORTYPE_RGB,
- * TIF_COLORTYPE_PALETTE or
- * TIF_COLORTYPE_RGBPALETTE.
- */
- BYTE filter ; /* Type of filter to apply. Could be one of NONE,
- * SUB, UP, AVERAGE or PAETH
- */
- BYTE compressionMethod; /* Type of compression in zLib to apply. Could be
- * one of NONE, FIXED or DYANMIC
- */
- /* For TIF : IT could be TIF_COMP_NOCOMP ,
- * TIF_COMP_PACKBIT or TIF_COMP_HUFFMAN (only for bilevel)
- */
-
- UCHAR colorConversion; /* Indicates whether color conversion has to
- * be done or not
- */
- /* For TIF :This represents white is zero or
- * black is zero in case of bilevel & gray.
- */
- UCHAR downSampling; /* Indicates whether down sampling needs to
- * be done or not
- */
-
- UCHAR downSamplingMethod[3];
- /* Down sampling offsets for every component. Possible
- * combinations are
- * 1, 1, 1
- * 1, 2, 1
- * 1, 2, 2
- */
-} ImgBitmap;
-
-typedef struct tagImgCodecColor {
- UINT16 red;
- UINT16 green;
- UINT16 blue;
-} ImgCodecColor;
-
-typedef struct {
- int width, height, bpp;
-
- BOOL tRNSFlag;
- ImgCodecColor tRNSColor;
-
- BOOL bKGDFlag;
- ImgCodecColor bKGDColor;
-
- BOOL AlphaChannelFlag;
- unsigned short *pAlphaChannel;
-} ImgTrnsInfo;
-
-typedef struct tagImgBitmapElem ImgBitmapElem;
-
-struct tagImgBitmapElem {
- int x;
- int y;
- ImgBitmap *pbmBitmap;
- ImgBitmapElem *pNext;
-};
-
-typedef struct gifDecode ImgGIFFrame;
-
-typedef struct tagImgImage {
- int dataSize; /* Holds the total number of bytes required
- * to hold the image
- */
- int width;
- int height;
-
- USHORT flag; /* This contains flags as defined
- * in ImgCodecFlagType
- */
- ULONG backGroundColor; /* The backgroundColor specifies a default background
- * color to present the image against.
- * Note that viewers are not bound to honor this color.
- * A viewer can choose to use a different background.
- */
- BYTE *pGlobalColorMap; /* Global color palette pointer
- * Default: NULL
- */
- USHORT globalColorMapSize; /* Local color palette size */
- ULONG gamma; /* The value is encoded as a 4-byte unsigned integer,
- * representing gamma times 100000. For example, a
- * gamma of 0.45 would be stored as the integer 45000.
- */
- int bitmapCount; /* This will hold the number of bitmaps in the
- * ImgImage structure
- */
- BYTE function ; /* This will be set as TRUE if this structure is
- * used for encoder
- */
-
- ImgBitmapElem *pHead;
- ImgBitmapElem *pTail;
-
-
- ULONG decodedSize ; /* 1 => Same as in the encoded stream
- * 0 => Resize to QQVGA if size is more
- * than 176 x 144
- */
-
- BOOL memAllocEx ; /* TRUE => MemAllocEx is used,
- * FALSE => MemAlloc is used
- */
-
- USHORT loopCount ; /* This will contain the number of times to repeat
- * the animation
- */
- BOOL bLoopCount ; /* If GIF LoopCount is present then this will be
- * TRUE, otherwise it will be false
- */
-
- ImgGIFFrame *pGifFrame ; /* Stores the intermediate GIF Frame */
-
- ImgInputFlag inputFlag;
- ImgResizeInput resizeMethod ;
-
- /* Flag to identify whether image is AGIF or not */
- BOOL bAGIFImage ;
- unsigned char *pEncodedData ;
- INT32 cFileSize ;
- BOOL bFirstFrame ;
- BOOL bReservedMemoryFlag;
- unsigned int offset ;
-} ImgImage;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif // _IMGCODEC_COMMON_H_
diff --git a/src/include/codec/img-codec-config.h b/src/include/codec/img-codec-config.h
deleted file mode 100755
index 7b49c56..0000000
--- a/src/include/codec/img-codec-config.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * libmedia-thumbnail
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _IMGCODEC_CONFIG_H_
-#define _IMGCODEC_CONFIG_H_
-#define INTERNAL_IMGCODEC
-
-#endif // _IMGCODEC_CONFIG_H_
diff --git a/src/include/codec/img-codec-osal.h b/src/include/codec/img-codec-osal.h
deleted file mode 100755
index 68bcc5d..0000000
--- a/src/include/codec/img-codec-osal.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * libmedia-thumbnail
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _IMGCODEC_OSAL_H_
-#define _IMGCODEC_OSAL_H_
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#ifndef BOOL
-
-#define BOOL bool//unsigned short
-#endif
-
-#ifndef UCHAR
-
-#define UCHAR unsigned char
-#endif
-
-#ifndef BYTE
-
-#define BYTE unsigned char
-#endif
-
-#ifndef USHORT
-
-#define USHORT unsigned short
-#endif
-
-#ifndef UINT16
-
-#define UINT16 unsigned short
-#endif
-
-#ifndef UINT32
-
-#define UINT32 unsigned short
-#endif
-
-#ifndef UINT
-
-#define UINT unsigned int
-#endif
-
-#ifndef INT32
-
-#define INT32 unsigned int
-#endif
-
-#ifndef ULONG
-
-#define ULONG unsigned long
-#endif
-
-#ifndef TRUE
-#define TRUE true
-#endif
-
-#ifndef FALSE
-#define FALSE false
-#endif
-
-#ifndef INVALID_HOBJ
-//#define INVALID_HOBJ (-1)
-#define INVALID_HOBJ NULL
-#endif
-
-
-typedef void* HFile;
-
-#define AcMemalloc IfegMemAlloc
-#define AcMemfree IfegMemFree
-#define AcMemcmp IfegMemcmp
-#define AcMemset IfegMemset
-#define AcMemcpy IfegMemcpy
-
-typedef struct {
- ULONG fileSize; // File size
- ULONG* startAddr; // Only used at LFS
- ULONG attribute; // file attribute like directory or file, hidden, readonly, system, ...
- int iVol; // positioned volume
- ULONG allocatedSize; // real allocated size of file & directory in sub System
-} FmFileAttribute;
-
-void *IfegMemAlloc(unsigned int size);
-void IfegMemFree(void* pMem);
-void *IfegMemcpy(void *dest, const void *src, unsigned int count);
-void *IfegMemset(void *dest, int c, unsigned int count);
-int IfegMemcmp(const void* pMem1, const void* pMem2, size_t length);
-
-ULONG IfegGetAvailableMemSize(void);
-
-HFile DrmOpenFile(const char* szPathName);
-BOOL DrmReadFile(HFile hFile, void* pBuffer, ULONG bufLen, ULONG* pReadLen);
-long DrmTellFile(HFile hFile);
-BOOL DrmSeekFile(HFile hFile, long position, long offset);
-BOOL DrmGetFileAttributes(const char* szPathName, FmFileAttribute* pFileAttr);
-BOOL DrmCloseFile(HFile hFile);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif // _IMGCODEC_OSAL_H_
-
diff --git a/src/include/codec/img-codec-parser.h b/src/include/codec/img-codec-parser.h
index 550db1b..1682d84 100755
--- a/src/include/codec/img-codec-parser.h
+++ b/src/include/codec/img-codec-parser.h
@@ -22,6 +22,11 @@
#ifndef _IMGCODEC_PARSER_H_
#define _IMGCODEC_PARSER_H_
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -31,11 +36,14 @@ extern "C" {
#define PNG_HEADER_LENGTH 8
#define JPG_HEADER_LENGTH 2
#define GIF_HEADER_LENGTH 3
-#define TIFF_HEADER_LENGTH 2
#define BMP_HEADER_LENGTH 2
#define WBMP_HEADER_LENGTH 2
-#define TIFF_IMAGE_WIDTH 0x100
-#define TIFF_IMAGE_HEIGHT 0x101
+
+#define JPG_HEADER_TYPE_LENGTH 2
+#define JPG_BLOCK_SIZE_LENGTH 2
+#define JPG_IMAGE_SIZE_LENGTH 8
+
+#define FILE_READ_SIZE 4096
typedef enum {
IMG_CODEC_UNKNOWN_TYPE = -2,
@@ -52,9 +60,17 @@ typedef enum {
IMG_CODEC_DRM = (1 << 8),
} ImgCodecType;
-//ImgCodecType ImgGetInfoFile(const char*filePath, ImgImageInfo *imgInfo);
+typedef struct _stream {
+ FILE *fd;
+ unsigned int buffpos;
+ unsigned int filepos;
+ unsigned int filesize;
+ unsigned int buffend;
+ unsigned int debugpos;
+ unsigned char *buffer;
+} IFEGSTREAMCTRL;
+
int ImgGetImageInfo(const char *filePath, ImgCodecType *type, unsigned int *width, unsigned int *height);
-int ImgGetImageInfoForThumb(const char *filePath, ImgCodecType *type, unsigned int *width, unsigned int *height);
#ifdef __cplusplus
}
diff --git a/src/include/codec/img-codec.h b/src/include/codec/img-codec.h
deleted file mode 100755
index 2af624a..0000000
--- a/src/include/codec/img-codec.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * libmedia-thumbnail
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _IMGCODEC_H_
-#define _IMGCODEC_H_
-
-#include "img-codec-common.h"
-#include "img-codec-parser.h"
-#include "img-codec-agif.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-unsigned int* ImgGetFirstFrameAGIFAtSize(const char *szFileName, unsigned int width, unsigned int height);
-
-int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width, int height);
-
-
-AGifFrameInfo* ImgCreateAGIFFrame(const char *szFileName, unsigned int width, unsigned int height, unsigned int bgColor, BOOL bLoop);
-
-void ImgDestroyAGIFFrame(AGifFrameInfo* pFrameData);
-
-ImgFastCodecInfo ImgGetNextAGIFFrame(AGifFrameInfo *gFrameData, BOOL bCenterAlign);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif // _IMGCODEC_H_