| 526 | |
| 527 | |
| 528 | ILuint *GetCompChanLen(PSDHEAD *Head) |
| 529 | { |
| 530 | ILushort *RleTable; |
| 531 | ILuint *ChanLen, c, i, j; |
| 532 | |
| 533 | RleTable = (ILushort*)ialloc(Head->Height * ChannelNum * sizeof(ILushort)); |
| 534 | ChanLen = (ILuint*)ialloc(ChannelNum * sizeof(ILuint)); |
| 535 | if (RleTable == NULL || ChanLen == NULL) { |
| 536 | return NULL; |
| 537 | } |
| 538 | |
| 539 | if (iread(RleTable, sizeof(ILushort), Head->Height * ChannelNum) != Head->Height * ChannelNum) { |
| 540 | ifree(RleTable); |
| 541 | ifree(ChanLen); |
| 542 | return NULL; |
| 543 | } |
| 544 | #ifdef __LITTLE_ENDIAN__ |
| 545 | for (i = 0; i < Head->Height * ChannelNum; i++) { |
| 546 | iSwapUShort(&RleTable[i]); |
| 547 | } |
| 548 | #endif |
| 549 | |
| 550 | imemclear(ChanLen, ChannelNum * sizeof(ILuint)); |
| 551 | for (c = 0; c < ChannelNum; c++) { |
| 552 | j = c * Head->Height; |
| 553 | for (i = 0; i < Head->Height; i++) { |
| 554 | ChanLen[c] += RleTable[i + j]; |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | ifree(RleTable); |
| 559 | |
| 560 | return ChanLen; |
| 561 | } |
| 562 | |
| 563 | |
| 564 |
no test coverage detected