diff options
Diffstat (limited to 'src/codec')
-rwxr-xr-x | src/codec/IfegDecodeAGIF.c | 178 | ||||
-rwxr-xr-x | src/codec/img-codec-parser.c | 45 | ||||
-rwxr-xr-x | src/codec/img-codec.c | 75 |
3 files changed, 116 insertions, 182 deletions
diff --git a/src/codec/IfegDecodeAGIF.c b/src/codec/IfegDecodeAGIF.c index 6fc2f1a..8b53226 100755 --- a/src/codec/IfegDecodeAGIF.c +++ b/src/codec/IfegDecodeAGIF.c @@ -25,10 +25,10 @@ -#define MAX_CODES 4096 +#define MAX_CODES 4096 -int __FastImgGetNextFrameAGIF_NoBuffer (AGifFrameInfo *pFrameData, BOOL bCenterAlign); -int __FastImgGetNextFrameAGIF_UseBuffer (AGifFrameInfo *pFrameData, BOOL bCenterAlign); +int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAlign); +int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAlign); int image_left_pos_N = 0; /* left position of image in Logical screeen */ int image_top_pos_N = 0; @@ -85,14 +85,14 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh pFrameData->nRepeatCount = 0; - thumb_dbg("10st data : 0x%x , global color table num : %d", pEncodedData[10], header_temp); + thumb_dbg("10st data : 0x%x , global color table num : %d", pEncodedData[10], header_temp); thumb_dbg("13: 0x%x ,14: 0x%x, 15: 0x%x, nRepeatCount : %d, nLoopCount : %d", pEncodedData[13+header_temp], pEncodedData[14+header_temp], pEncodedData[15+header_temp], pFrameData->nRepeatCount, pFrameData->nLoopCount); backcolor_index = pEncodedData[11]; if (pEncodedData[14+header_temp] == 0xF9) { transparent = pEncodedData[16+header_temp] & 0x01; - transIndex = pEncodedData[19+header_temp]; + transIndex = pEncodedData[19+header_temp]; 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); } else if (pEncodedData[14+19+header_temp] == 0xF9) { @@ -110,14 +110,14 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh if (pEncodedData[14+header_temp] == 0xF9 || pEncodedData[14+19+header_temp] == 0xF9) { if (transparent == 1 && backcolor_index == transIndex) { - image_backcolor = ui_backcolor; + image_backcolor = ui_backcolor; } else if (transparent == 1 && backcolor_index != transIndex) { image_backcolor = backcolor_parsing; } else { - image_backcolor = backcolor_parsing; + image_backcolor = backcolor_parsing; } } else { - image_backcolor = backcolor_parsing; + image_backcolor = backcolor_parsing; } #if MODE == 0 @@ -145,7 +145,7 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh #if MODE == 2 if (((pFrameData->logi_wdt <= width) && (pFrameData->logi_hgt <= height))) { - if (0 == (pFrameData->pPrevImg = IfegMemAlloc(sizeof(unsigned char)*width*height*2))) { + if (0 == (pFrameData->pPrevImg = IfegMemAlloc(sizeof(unsigned char)*width*height*2))) { if (pFrameData) { IfegMemFree(pFrameData); pFrameData = 0; @@ -154,7 +154,7 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh } pFrameData->useBuffer = 0; } else { - if (0 == (pFrameData->pPrevImg = IfegMemAlloc(sizeof(unsigned int)*pFrameData->logi_wdt*pFrameData->logi_hgt))) { + if (0 == (pFrameData->pPrevImg = IfegMemAlloc(sizeof(unsigned int)*pFrameData->logi_wdt*pFrameData->logi_hgt))) { if (pFrameData) { IfegMemFree(pFrameData); pFrameData = 0; @@ -566,8 +566,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl inputPos = pFrameData->offset; done_prefix = IfegMemAlloc(sizeof(unsigned char)*(MAX_CODES+1)); - if (done_prefix == 0) - { + if (done_prefix == 0) { thumb_err("Failed to allocate memory for check buffer."); return -1; } @@ -969,7 +968,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl out_x = 0, out_y = -dechgt; /* Color Resolution */ - if ((buffer[8] & 0x80) == 0) { /* Logical color table */ + if ((buffer[8] & 0x80) == 0) { /* Logical color table */ /* use global table */ } else { /* Logical color table */ IfegMemset(dacbox, 0, 1024); @@ -1104,7 +1103,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl } /* Now that we've pushed the decoded string (in reverse order) * onto the stack, lets pop it off and put it into our decode - * buffer... And when the decode buffer is full, write another + * buffer... And when the decode buffer is full, write another * line... */ while (sp > dstack) { @@ -1126,7 +1125,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl if (!flag) { out_x = 0, out_y += dechgt; } - } else { /* interlaced image */ + } else { /* interlaced image */ if (inter_step == 1) { startloc += 8; } else if (inter_step == 2) { @@ -1219,7 +1218,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl a_x += orgwdt, c_x += orgwdt; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32 + (b_x/orgwdt)) += 0x1000000; *(pImage32_2 + (d_x/orgwdt)) += 0x1000000; @@ -1285,7 +1284,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl c_x += orgwdt; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32_2 + (d_x/orgwdt)) += 0x1000000; d_x += orgwdt; @@ -1326,7 +1325,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl *(pImage32_2 + (c_x/orgwdt)) += pDacbox[val1]; a_x += orgwdt, c_x += orgwdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/orgwdt)) += pDacbox[val1]; *(pImage32_2 + (d_x/orgwdt)) += pDacbox[val1]; b_x += orgwdt, d_x += orgwdt; @@ -1350,7 +1349,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl *(pImage32 + (a_x/orgwdt)) += pDacbox[val1]; a_x += orgwdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/orgwdt)) += pDacbox[val1]; b_x += orgwdt; } @@ -1460,8 +1459,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl IfegMemset(done_prefix, 0, sizeof(unsigned char)*(MAX_CODES+1)); while (code >= newcodes) { *sp++ = suffix[code]; - if ((code == prefix[code]) || (done_prefix[code] == 1)) - { + if ((code == prefix[code]) || (done_prefix[code] == 1)) { thumb_err("Circular entry in table."); if (decoderline != 0) { IfegMemFree(decoderline); @@ -1815,7 +1813,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA /* Color Resolution */ IfegMemset(global_dacbox, 0, 1024); numcolors = (buffer[10] & 0x7) + 1; - if ((buffer[10] & 0x80) == 0) { /* Global color table */ + if ((buffer[10] & 0x80) == 0) { /* Global color table */ global_dacbox[0] = 0x000000; global_dacbox[1] = 0x3f3f3f; numcolors = 2; @@ -2110,7 +2108,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA out_x = 0, out_y = -dechgt; /* Color Resolution */ - if ((buffer[8] & 0x80) == 0) { /* Logical color table */ + if ((buffer[8] & 0x80) == 0) { /* Logical color table */ ;/* use global table */ } else { /* Logical color table */ IfegMemset(dacbox, 0, 1024); @@ -2164,14 +2162,14 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA if (logi_hgt < (image_top_pos + orghgt)) { for (i = 0; i < logi_hgt - image_top_pos; i++) { for (j = 0; j < orgwdt; j++) { - pImage32[j] = 0x1000000; /* set ui color */ + pImage32[j] = 0x1000000; /* set ui color */ } pImage32 += logi_wdt; } } else { for (i = 0; i < orghgt; i++) { for (j = 0; j < orgwdt; j++) { - pImage32[j] = 0x1000000; /* set ui color */ + pImage32[j] = 0x1000000; /* set ui color */ } pImage32 += logi_wdt; } @@ -2203,7 +2201,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -2223,7 +2221,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -2240,7 +2238,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -2362,7 +2360,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA } /* Now that we've pushed the decoded string (in reverse order) * onto the stack, lets pop it off and put it into our decode - * buffer... And when the decode buffer is full, write another + * buffer... And when the decode buffer is full, write another * line... */ while (sp > dstack) { @@ -2478,7 +2476,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -2502,7 +2500,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA a_x += logi_wdt, c_x += logi_wdt; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos]; @@ -2524,7 +2522,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -2547,7 +2545,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -2567,7 +2565,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA a_x += logi_wdt; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos]; b_x += logi_wdt; @@ -2585,7 +2583,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -2604,7 +2602,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -2624,7 +2622,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA c_x += logi_wdt; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos]; d_x += logi_wdt; @@ -2642,7 +2640,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -2682,7 +2680,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -2699,7 +2697,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += pDacbox[val1]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1]; *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1]; b_x += logi_wdt, d_x += logi_wdt; @@ -2714,7 +2712,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -2737,7 +2735,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -2753,7 +2751,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += pDacbox[val1]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1]; b_x += logi_wdt; } @@ -2766,7 +2764,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -2786,7 +2784,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -2801,7 +2799,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += pDacbox[val1]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1]; d_x += logi_wdt; } @@ -2814,7 +2812,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -3040,7 +3038,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -3064,7 +3062,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA a_x += logi_wdt, c_x += logi_wdt; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos]; @@ -3087,7 +3085,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -3110,7 +3108,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -3130,7 +3128,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA a_x += logi_wdt; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos]; b_x += logi_wdt; @@ -3149,7 +3147,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -3169,7 +3167,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -3189,7 +3187,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA c_x += logi_wdt; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos]; d_x += logi_wdt; @@ -3208,7 +3206,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -3249,7 +3247,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -3267,7 +3265,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA a_x += logi_wdt, c_x += logi_wdt; backGround[i+image_left_pos] = backcolor888; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1]; *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1]; b_x += logi_wdt, d_x += logi_wdt; @@ -3283,7 +3281,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -3306,7 +3304,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -3323,7 +3321,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA a_x += logi_wdt; backGround[i+image_left_pos] = backcolor888; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1]; b_x += logi_wdt; backGround[i+image_left_pos] = backcolor888; @@ -3337,7 +3335,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -3357,7 +3355,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -3373,7 +3371,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA c_x += logi_wdt; backGround[i+image_left_pos] = backcolor888; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1]; d_x += logi_wdt; backGround[i+image_left_pos] = backcolor888; @@ -3387,7 +3385,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -3511,7 +3509,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA } /* Now that we've pushed the decoded string (in reverse order) * onto the stack, lets pop it off and put it into our decode - * buffer... And when the decode buffer is full, write another + * buffer... And when the decode buffer is full, write another * line... */ while (sp > dstack) { @@ -3528,7 +3526,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA len = orgwdt; } - if (interLaced == 0) { /* interlaced image */ + if (interLaced == 0) { /* interlaced image */ if (!flag) { out_x = 0, out_y += dechgt; } @@ -3628,7 +3626,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -3653,7 +3651,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA backGround[i+image_left_pos] = pDacbox[val1]; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos]; @@ -3676,7 +3674,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -3699,7 +3697,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -3720,7 +3718,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA backGround[i+image_left_pos] = pDacbox[val1]; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos]; b_x += logi_wdt; @@ -3739,7 +3737,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -3759,7 +3757,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -3780,7 +3778,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA backGround[i+image_left_pos] = pDacbox[val1]; } } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { if (val1 == transIndex) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos]; d_x += logi_wdt; @@ -3799,7 +3797,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -3840,7 +3838,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -3859,7 +3857,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA a_x += logi_wdt, c_x += logi_wdt; backGround[i+image_left_pos] = pDacbox[val1]; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1]; *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1]; b_x += logi_wdt, d_x += logi_wdt; @@ -3875,7 +3873,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -3898,7 +3896,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -3915,7 +3913,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA a_x += logi_wdt; backGround[i+image_left_pos] = pDacbox[val1]; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1]; b_x += logi_wdt; backGround[i+image_left_pos] = pDacbox[val1]; @@ -3929,7 +3927,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -3948,7 +3946,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -3964,7 +3962,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA c_x += logi_wdt; backGround[i+image_left_pos] = pDacbox[val1]; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1]; d_x += logi_wdt; backGround[i+image_left_pos] = pDacbox[val1]; @@ -3978,7 +3976,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -4146,7 +4144,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; a_x += logi_wdt, c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; b_x += logi_wdt, d_x += logi_wdt; @@ -4166,7 +4164,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32 + (a_x/logi_wdt)) += backGround[i]; a_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32 + (b_x/logi_wdt)) += backGround[i]; b_x += logi_wdt; } @@ -4183,7 +4181,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA *(pImage32_2 + (c_x/logi_wdt)) += backGround[i]; c_x += logi_wdt; } - if (0 <= d2 && d2 < decwdt) { + if (0 <= d2 && d2 < decwdt) { *(pImage32_2 + (d_x/logi_wdt)) += backGround[i]; d_x += logi_wdt; } @@ -4207,7 +4205,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA } - /* 565 Conversion */ + /* 565 Conversion */ pImage32 = (unsigned int *)(pDecBuf); for (i = 0, k = margin_hgt1_2; i < dechgt; i++) { @@ -4216,7 +4214,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA if ((*pImage32>>24) == 0) { *(pImage16++) = ((*pImage32 & 0xf80000) >> 8) | ((*pImage32 & 0xfc00) >> 5) | ((*pImage32 & 0xf8) >> 3); } else if ((*pImage32 >> 24) == 1) { - *(pImage16++) = (((*pImage32 & 0xf80000) >> 6) / 3) | (((*pImage32 & 0xfc00) >> 3)/3) | (((*pImage32 & 0xf8) >> 1)/3); + *(pImage16++) = (((*pImage32 & 0xf80000) >> 6) / 3) | (((*pImage32 & 0xfc00) >> 3)/3) | (((*pImage32 & 0xf8) >> 1)/3); } else if ((*pImage32 >> 24) == 2) { *(pImage16++) = ((*pImage32 & 0xf80000) >> 7) | ((*pImage32 & 0xfc00) >> 4) | ((*pImage32 & 0xf8) >> 2); } else { diff --git a/src/codec/img-codec-parser.c b/src/codec/img-codec-parser.c index 8cc94d5..0bd76ea 100755 --- a/src/codec/img-codec-parser.c +++ b/src/codec/img-codec-parser.c @@ -44,9 +44,9 @@ #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 JPG_HEADER_TYPE_LENGTH 2 +#define JPG_BLOCK_SIZE_LENGTH 2 +#define JPG_IMAGE_SIZE_LENGTH 8 #define FILE_READ_SIZE 4096 typedef struct _stream { @@ -75,9 +75,7 @@ static int _CheckBuffer(IFEGSTREAMCTRL *pIfegstreamctrl, unsigned int size) } if (pIfegstreamctrl->buffpos == 0) { - if (DrmReadFile - (pIfegstreamctrl->fd, pIfegstreamctrl->buffer, - FILE_READ_SIZE, &fileread) == FALSE) { + if (DrmReadFile(pIfegstreamctrl->fd, pIfegstreamctrl->buffer, FILE_READ_SIZE, &fileread) == FALSE) { return 0; } if (fileread == 0) { @@ -88,29 +86,20 @@ static int _CheckBuffer(IFEGSTREAMCTRL *pIfegstreamctrl, unsigned int size) pIfegstreamctrl->buffpos = 0; } else { - if (size >= 2048 - || pIfegstreamctrl->buffend - - pIfegstreamctrl->buffpos > FILE_READ_SIZE) { + if (size >= 2048 || pIfegstreamctrl->buffend - pIfegstreamctrl->buffpos > FILE_READ_SIZE) { return 0; } AcMemcpy(pIfegstreamctrl->buffer, - &pIfegstreamctrl->buffer[pIfegstreamctrl-> - buffpos], + &pIfegstreamctrl->buffer[pIfegstreamctrl->buffpos], pIfegstreamctrl->buffend - pIfegstreamctrl->buffpos); - if (DrmReadFile - (pIfegstreamctrl->fd, - &pIfegstreamctrl->buffer[pIfegstreamctrl->buffend - - pIfegstreamctrl->buffpos], - pIfegstreamctrl->buffpos, &fileread) == FALSE) { + if (DrmReadFile(pIfegstreamctrl->fd, &pIfegstreamctrl->buffer[pIfegstreamctrl->buffend - pIfegstreamctrl->buffpos], pIfegstreamctrl->buffpos, &fileread) == FALSE) { return 0; } if (fileread == 0) { return 0; } - pIfegstreamctrl->buffend = - pIfegstreamctrl->buffend - - pIfegstreamctrl->buffpos + fileread; + pIfegstreamctrl->buffend = pIfegstreamctrl->buffend - pIfegstreamctrl->buffpos + fileread; pIfegstreamctrl->buffpos = 0; pIfegstreamctrl->filepos += fileread; } @@ -135,7 +124,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt, unsigned int *pHeight = NULL; int ret = MS_MEDIA_ERR_NONE; - if (type == NULL || width == NULL ||height == NULL ) { + if (type == NULL || width == NULL || height == NULL) { return MS_MEDIA_ERR_INVALID_PARAMETER; } else { pWidth = width; @@ -225,7 +214,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt, thumb_dbg("IMG_CODEC_JPEG"); *type = IMG_CODEC_JPEG; } - /*********************** PNG *************************/ + /*********************** PNG *************************/ else if (AcMemcmp(EncodedDataBuffer, gIfegPNGHeader, PNG_HEADER_LENGTH) == 0) { unsigned char tmp; @@ -257,7 +246,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt, thumb_dbg("IMG_CODEC_PNG"); *type = IMG_CODEC_PNG; } - /*********************** BMP *************************/ + /*********************** BMP *************************/ else if (AcMemcmp(EncodedDataBuffer, gIfegBMPHeader, BMP_HEADER_LENGTH) == 0) { /* Parse BMP File and get image width and image height */ if (DrmReadFile(hFile, &EncodedDataBuffer[8], 18, &fileread) == FALSE) { @@ -277,13 +266,13 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt, if (pHeight) { // add the reference function abs(). may have negative height values in bmp header. *pHeight = abs(EncodedDataBuffer[22] | (EncodedDataBuffer[23] << 8) | - (EncodedDataBuffer[24] << 16) | (EncodedDataBuffer[25] << 24)); + (EncodedDataBuffer[24] << 16) | (EncodedDataBuffer[25] << 24)); } thumb_dbg("IMG_CODEC_BMP"); *type = IMG_CODEC_BMP; } - /*********************** GIF *************************/ + /*********************** GIF *************************/ else if (AcMemcmp(EncodedDataBuffer, gIfegGIFHeader, GIF_HEADER_LENGTH) == 0) { unsigned int tablelength = 0; unsigned int imagecount = 0; @@ -438,7 +427,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt, img_block_w = EncodedDataBuffer[ifegstreamctrl.buffpos + 4] |(EncodedDataBuffer[ifegstreamctrl.buffpos + 5] << 8); img_block_h = EncodedDataBuffer[ifegstreamctrl.buffpos + 6] |(EncodedDataBuffer[ifegstreamctrl.buffpos + 7] << 8); - thumb_dbg ("Image block width : %d, Height : %d, left:%d, top:%d", img_block_w, img_block_h); + thumb_dbg("Image block width : %d, Height : %d, left : %d, top : %d", img_block_w, img_block_h); *pWidth = img_block_w; *pHeight = img_block_h; @@ -475,7 +464,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt, return ret; } - length =EncodedDataBuffer[ifegstreamctrl.buffpos++]; + length = EncodedDataBuffer[ifegstreamctrl.buffpos++]; if ((length + ifegstreamctrl.buffpos) > ifegstreamctrl.buffend) { length = length + @@ -493,7 +482,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt, ifegstreamctrl.buffpos = 0; ifegstreamctrl.buffend = 0; } else { - ifegstreamctrl.buffpos +=length; + ifegstreamctrl.buffpos += length; } /* File End Check */ @@ -516,7 +505,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt, thumb_dbg("IMG_CODEC_GIF"); *type = IMG_CODEC_GIF; } - /*********************** WBMP *************************/ + /*********************** WBMP *************************/ else if ((AcMemcmp(EncodedDataBuffer, gIfegWBMPHeader, WBMP_HEADER_LENGTH) == 0) && (strcasecmp(fileExt, "wbmp") == 0)) { /* Parse BMP File and get image width and image height */ diff --git a/src/codec/img-codec.c b/src/codec/img-codec.c index a27495c..1887e47 100755 --- a/src/codec/img-codec.c +++ b/src/codec/img-codec.c @@ -32,32 +32,25 @@ unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName, unsigned char *raw_data = NULL; if (szFileName == NULL) { - thumb_err - ("ImgGetFirstFrameAGIFAtSize: Input File Name is NULL"); + thumb_err("ImgGetFirstFrameAGIFAtSize: Input File Name is NULL"); return NULL; } if (width == 0 || height == 0) { - thumb_err - ("ImgGetFirstFrameAGIFAtSize: Input width or height is zero"); + thumb_err("ImgGetFirstFrameAGIFAtSize: Input width or height is zero"); return NULL; } - pFrameInfo = - ImgCreateAGIFFrame(szFileName, width, - height, 0, FALSE); + pFrameInfo = ImgCreateAGIFFrame(szFileName, width, height, 0, FALSE); if (pFrameInfo && pFrameInfo->pOutBits) { ImgGetNextAGIFFrame(pFrameInfo, TRUE); - if (ImgConvertRGB565ToRGB888 - (pFrameInfo->pOutBits, &pDecodedRGB888Buf, - pFrameInfo->width, pFrameInfo->height)) { + if (ImgConvertRGB565ToRGB888(pFrameInfo->pOutBits, &pDecodedRGB888Buf, pFrameInfo->width, pFrameInfo->height)) { if (pDecodedRGB888Buf) { free(pFrameInfo->pOutBits); pFrameInfo->pOutBits = pDecodedRGB888Buf; - unsigned char *src = - ((unsigned char *)(pFrameInfo->pOutBits)); + unsigned char *src = ((unsigned char *)(pFrameInfo->pOutBits)); unsigned int i = 0; @@ -76,8 +69,7 @@ unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName, unsigned char *dest = raw_data; while (i--) { if (dest != NULL) { - *dest = - *((unsigned char *)(src)); + *dest = *((unsigned char *)(src)); dest++; src++; } @@ -95,8 +87,7 @@ unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName, return (unsigned int *)raw_data; } -int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width, - int height) +int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width, int height) { unsigned short *rgb565buf = 0; unsigned char *rgb888Buf = 0; @@ -138,21 +129,7 @@ int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width, return TRUE; } -/** - * This function is wrapper function for "ImgFastCreateAGIFFrameData". - * - * @param szFileName[in] Specifies the read image data. - * @param width[in] Specifies a width of the image to be created. - * @param height[in] Specifies a height of the image to be created. - * @param bgColor[in] Specifies background color of output buffer. - * @param bLoop[in] Specifies looping condition whether infinte or once play. - * @return This fucntion returns AGifFrameInfo Structure's pointer. - * @see ImgFastCreateAGIFFrameData. - */ - -AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width, - unsigned int height, unsigned int bgColor, - BOOL bLoop) +AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width, unsigned int height, unsigned int bgColor, BOOL bLoop) { HFile hFile; FmFileAttribute fileAttrib; @@ -189,7 +166,7 @@ AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width, DrmCloseFile(hFile); return NULL; } - memset(pEncodedData,0,mem_alloc_size); + memset(pEncodedData, 0, mem_alloc_size); /* coverity[ -tainted_data_argument : pEncodedData ] */ if (DrmReadFile(hFile, pEncodedData, mem_alloc_size, &size) == FALSE) { thumb_err("DrmReadFile was failed"); @@ -207,24 +184,9 @@ AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width, DrmCloseFile(hFile); - return FastImgCreateAGIFFrameData(width, height, pEncodedData, - cFileSize, bgColor, bLoop); + return FastImgCreateAGIFFrameData(width, height, pEncodedData, cFileSize, bgColor, bLoop); } -/** - * This function is wrapper function for "ImgFastDestroyAGIFFrameData". - * - * @param pFrameData[in] - * @return void - * @see ImgFastDestroyAGIFFrameData. - * @see ImgFastDestroyAGIFFrameData. - * - * @note ImgFastDestroyAGIFFrameData function set free all memory in AGifFrameInfo structure - * even pEncodedData - * - * @author rubric(sinjae4b.lee@samsung.com) - */ - void ImgDestroyAGIFFrame(AGifFrameInfo *pFrameData) { SysAssert(pFrameData); @@ -232,22 +194,7 @@ void ImgDestroyAGIFFrame(AGifFrameInfo *pFrameData) FastImgDestroyAGIFFrameData(pFrameData); } -/** - * This function is wrapper function for "ImgFastGetNextFrameAGIF". - * - * @param pFrameData[in] - * @param bCenterAlign Specifies true if you want center align in output buffer, else left top align - * @return This fucntion returns True or False as decoding result. - * @see ImgFastGetNextFrameAGIF. - * - * @note This function returns one frame data it decoded. - * next time, returns next decoded frame data... and so on. - * - * @author rubric(sinjae4b.lee@samsung.com) - */ - -ImgFastCodecInfo ImgGetNextAGIFFrame(AGifFrameInfo *gFrameData, - BOOL bCenterAlign) +ImgFastCodecInfo ImgGetNextAGIFFrame(AGifFrameInfo *gFrameData, BOOL bCenterAlign) { int iResult; |