summaryrefslogtreecommitdiff
path: root/src/codec
diff options
context:
space:
mode:
authorhj kim <backto.kim@samsung.com>2015-06-04 21:09:04 -0700
committerhj kim <backto.kim@samsung.com>2015-06-04 21:09:04 -0700
commit999b9402a56d7c9738d6d632eff2f90004bbfbaf (patch)
tree31416fd3ece796751014dab252673fc71b278240 /src/codec
parentc896230ef091a244204b17bc9ab0ffa974ce2031 (diff)
downloadlibmedia-thumbnail-accepted/tizen/wearable/20150606.054548.tar.gz
libmedia-thumbnail-accepted/tizen/wearable/20150606.054548.tar.bz2
libmedia-thumbnail-accepted/tizen/wearable/20150606.054548.zip
This reverts commit c896230ef091a244204b17bc9ab0ffa974ce2031. Change-Id: I94ec0a56f7c3d84ad76645b91310494b96d41932
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/IfegDecodeAGIF.c6
-rw-r--r--src/codec/img-codec-osal.c2
-rw-r--r--src/codec/img-codec-parser.c117
3 files changed, 78 insertions, 47 deletions
diff --git a/src/codec/IfegDecodeAGIF.c b/src/codec/IfegDecodeAGIF.c
index e1e5a11..dad124b 100644
--- a/src/codec/IfegDecodeAGIF.c
+++ b/src/codec/IfegDecodeAGIF.c
@@ -47,7 +47,7 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh
int inputPos = 0;
int inputPos_temp = 0;
- AGifFrameInfo *pFrameData;
+ AGifFrameInfo *pFrameData;
if (0 == (pFrameData = IfegMemAlloc(sizeof(AGifFrameInfo)))) {
return 0;
}
@@ -126,7 +126,7 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh
backcolor_parsing = (unsigned short)((pEncodedData[inputPos+backcolor_index*3] >> 3)<<11) | ((pEncodedData[inputPos+backcolor_index*3+1] >> 2)<<5) | (pEncodedData[inputPos+backcolor_index*3+2] >> 3);
}
- /* graphic extension block */
+ /* graphic extension block */
if (pEncodedData[14+header_temp] == 0xF9 || pEncodedData[14+19+header_temp] == 0xF9) {
if (transparent == 1 && backcolor_index == transIndex) {
@@ -690,7 +690,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
if (pFrameData->nLoopCount == -1) {
break;
} else if (pFrameData->bLoop || (pFrameData->nRepeatCount <= pFrameData->nLoopCount) || (pFrameData->nLoopCount == 0)) {
- /* Background Color */
+ /* Background Color */
pImage16 = (unsigned short *)pFrameData->pPrevImg;
for (i = 0; i < expected_width * expected_height; i++) {
diff --git a/src/codec/img-codec-osal.c b/src/codec/img-codec-osal.c
index 47062bc..46eb130 100644
--- a/src/codec/img-codec-osal.c
+++ b/src/codec/img-codec-osal.c
@@ -24,7 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
+
//#include <drm-service.h>
#include <drm_client.h>
diff --git a/src/codec/img-codec-parser.c b/src/codec/img-codec-parser.c
index dd04455..26027b9 100644
--- a/src/codec/img-codec-parser.c
+++ b/src/codec/img-codec-parser.c
@@ -28,7 +28,6 @@
#include <sys/time.h>
#endif
-#include <media-util-err.h>
#include "media-thumb-debug.h"
#include "img-codec-common.h"
#include "img-codec-parser.h"
@@ -424,7 +423,7 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
unsigned char tmp;
if (DrmReadFile(hFile, EncodedDataBuffer, 32, &fileread) ==
- FALSE) {
+ FALSE) {
thumb_err("DrmReadFile was failed");
return IMG_CODEC_NONE;
}
@@ -446,7 +445,7 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
tmp = *(EncodedDataBuffer + 20);
/* If image is interlaced then multiple should be 2 */
if (tmp) {
- thumb_dbg("Interlaced PNG Image.");
+ thumb_dbg("Interlaced PNG Image.\n");
}
thumb_dbg("IMG_CODEC_PNG\n");
return IMG_CODEC_PNG;
@@ -470,22 +469,23 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
}
if (pWidth) {
*pWidth =
- EncodedDataBuffer[18] | (EncodedDataBuffer[19] << 8)
- | (EncodedDataBuffer[20] << 16) |
- (EncodedDataBuffer[21] << 24);
+ EncodedDataBuffer[18] | (EncodedDataBuffer[19] << 8)
+ | (EncodedDataBuffer[20] << 16) |
+ (EncodedDataBuffer[21] << 24);
}
if (pHeight) {
*pHeight =
- EncodedDataBuffer[22] | (EncodedDataBuffer[23] << 8)
- | (EncodedDataBuffer[24] << 16) |
- (EncodedDataBuffer[25] << 24);
+ EncodedDataBuffer[22] | (EncodedDataBuffer[23] << 8)
+ | (EncodedDataBuffer[24] << 16) |
+ (EncodedDataBuffer[25] << 24);
}
thumb_dbg("IMG_CODEC_BMP");
return IMG_CODEC_BMP;
}
/*********************** GIF *************************/
- else if (AcMemcmp(EncodedDataBuffer, gIfegGIFHeader, GIF_HEADER_LENGTH) == 0) {
+ else if (AcMemcmp(EncodedDataBuffer, gIfegGIFHeader, GIF_HEADER_LENGTH)
+ == 0) {
unsigned int tablelength = 0;
unsigned int imagecount = 0;
int finished = 0;
@@ -498,7 +498,8 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
- if (DrmReadFile(hFile, &EncodedDataBuffer[8], 5, &fileread) == FALSE) {
+ if (DrmReadFile(hFile, &EncodedDataBuffer[8], 5, &fileread) ==
+ FALSE) {
thumb_err("DrmReadFile was failed");
return IMG_CODEC_NONE;
@@ -509,10 +510,10 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
}
if (EncodedDataBuffer[0] != 'G' || EncodedDataBuffer[1] != 'I'
- || EncodedDataBuffer[2] != 'F' || EncodedDataBuffer[3] < '0'
- || EncodedDataBuffer[3] > '9' || EncodedDataBuffer[4] < '0'
- || EncodedDataBuffer[4] > '9' || EncodedDataBuffer[5] < 'A'
- || EncodedDataBuffer[5] > 'z') {
+ || EncodedDataBuffer[2] != 'F' || EncodedDataBuffer[3] < '0'
+ || EncodedDataBuffer[3] > '9' || EncodedDataBuffer[4] < '0'
+ || EncodedDataBuffer[4] > '9' || EncodedDataBuffer[5] < 'A'
+ || EncodedDataBuffer[5] > 'z') {
thumb_warn("IMG_CODEC_UNKNOWN_TYPE in GIF");
return IMG_CODEC_UNKNOWN_TYPE;
}
@@ -526,14 +527,17 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
EncodedDataBuffer[8] | (EncodedDataBuffer[9] << 8);
}
- thumb_dbg("Logical width : %d, Height : %d", *pWidth, *pHeight);
+ thumb_dbg("Logical width : %d, Height : %d", *pWidth,
+ *pHeight);
if ((EncodedDataBuffer[10] & 0x80) != 0) { /* Global color table */
temp = (EncodedDataBuffer[10] & 0x7) + 1;
tablelength = (1 << temp) * 3;
- if ((tablelength * sizeof(char)) > sizeof(EncodedDataBuffer)) {
- thumb_warn("_ImgGetInfoStreaming :table length is more than buffer length");
+ if ((tablelength * sizeof(char)) >
+ sizeof(EncodedDataBuffer)) {
+ thumb_warn
+ ("_ImgGetInfoStreaming :table length is more than buffer length");
return IMG_CODEC_UNKNOWN_TYPE;
}
@@ -542,7 +546,9 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
/* coverity[ -tainted_data_argument : EncodedDataBuffer ] */
- if (DrmReadFile(hFile, EncodedDataBuffer, tablelength, &fileread) == FALSE) {
+ if (DrmReadFile
+ (hFile, EncodedDataBuffer, tablelength,
+ &fileread) == FALSE) {
thumb_err("DrmReadFile was failed");
return IMG_CODEC_NONE;
@@ -582,11 +588,14 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
- switch (EncodedDataBuffer[ifegstreamctrl.buffpos++]) {
+ switch (EncodedDataBuffer
+ [ifegstreamctrl.buffpos++]) {
case 0xf9: /* Graphic control extension block */
- if (_CheckBuffer(&ifegstreamctrl, 6) == 0) {
- thumb_warn("_CheckBuffer was failed");
+ if (_CheckBuffer(&ifegstreamctrl, 6) ==
+ 0) {
+ thumb_warn
+ ("_CheckBuffer was failed");
return IMG_CODEC_UNKNOWN_TYPE;
}
@@ -600,20 +609,28 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
case 0x01: /* Plain Text block */
case 0xfe: /* Comment Extension block */
case 0xff: /* Appliation Extension block */
- if (_CheckBuffer(&ifegstreamctrl, 1) == 0) {
- thumb_warn("_CheckBuffer was failed");
+ if (_CheckBuffer(&ifegstreamctrl, 1) ==
+ 0) {
+ thumb_warn
+ ("_CheckBuffer was failed");
return IMG_CODEC_UNKNOWN_TYPE;
}
- if (ifegstreamctrl.buffpos > sizeof(EncodedDataBuffer)) {
- thumb_warn("buffer position exceeds buffer max length ");
+ if (ifegstreamctrl.buffpos >
+ sizeof(EncodedDataBuffer)) {
+ thumb_warn
+ ("buffer position exceeds buffer max length ");
return IMG_CODEC_UNKNOWN_TYPE;
}
while ((ifegstreamctrl.buffpos < sizeof(EncodedDataBuffer)) && ((length = EncodedDataBuffer[ifegstreamctrl.buffpos++]) > 0)) { /* get the data length */
- if (_CheckBuffer(&ifegstreamctrl, length) == 0) {
- thumb_warn("_CheckBuffer was failed");
- return IMG_CODEC_UNKNOWN_TYPE;
+ if (_CheckBuffer
+ (&ifegstreamctrl,
+ length) == 0) {
+ thumb_warn
+ ("_CheckBuffer was failed");
+ return
+ IMG_CODEC_UNKNOWN_TYPE;
}
/* Check integer overflow */
@@ -622,7 +639,8 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
- ifegstreamctrl.buffpos += (length);
+ ifegstreamctrl.buffpos +=
+ (length);
/* File End Check */
}
break;
@@ -703,38 +721,51 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
- temp = EncodedDataBuffer[ifegstreamctrl.buffpos++];
+ temp =
+ EncodedDataBuffer[ifegstreamctrl.buffpos++];
if (temp < 2 || 9 < temp) {
return IMG_CODEC_UNKNOWN_TYPE;
}
do {
- if (_CheckBuffer(&ifegstreamctrl, 1) == 0) {
- thumb_warn("_CheckBuffer was failed");
+ if (_CheckBuffer(&ifegstreamctrl, 1) ==
+ 0) {
+ thumb_warn
+ ("_CheckBuffer was failed");
return IMG_CODEC_UNKNOWN_TYPE;
}
- length =EncodedDataBuffer[ifegstreamctrl.buffpos++];
+ length =
+ EncodedDataBuffer[ifegstreamctrl.
+ buffpos++];
if ((length + ifegstreamctrl.buffpos) > ifegstreamctrl.buffend) {
length =
- length +
- ifegstreamctrl.buffpos -
- ifegstreamctrl.buffend;
- if (DrmSeekFile(ifegstreamctrl.fd, SEEK_CUR, length) == FALSE) {
+ length +
+ ifegstreamctrl.buffpos -
+ ifegstreamctrl.buffend;
+ if (DrmSeekFile
+ (ifegstreamctrl.fd,
+ SEEK_CUR,
+ length) == FALSE) {
if (imagecount) {
if (pNumberOfFrames)
*pNumberOfFrames
= 2;
- thumb_dbg("IMG_CODEC_AGIF");
- return IMG_CODEC_AGIF;
+ thumb_dbg
+ ("IMG_CODEC_AGIF");
+ return
+ IMG_CODEC_AGIF;
}
- return IMG_CODEC_UNKNOWN_TYPE;
+ return
+ IMG_CODEC_UNKNOWN_TYPE;
}
- ifegstreamctrl.filepos += length;
+ ifegstreamctrl.filepos +=
+ length;
ifegstreamctrl.buffpos = 0;
ifegstreamctrl.buffend = 0;
} else {
- ifegstreamctrl.buffpos +=length;
+ ifegstreamctrl.buffpos +=
+ length;
}
/* File End Check */