diff options
| author | Random <28494085+Random06457@users.noreply.github.com> | 2020-04-16 20:08:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-16 14:08:23 -0400 |
| commit | 9ac1f8130ddbfdf394e11710021150f6c192fdcd (patch) | |
| tree | 13445dd52dd3deda1492695a0ece0baa6b6470f2 /src/code/z_jpeg.c | |
| parent | 045a92d7c31f4476ae9cff6910fb5a222b71f04f (diff) | |
Decompile jpegutils.c (#75)
* Decompile jpegutils.c
jpegutils.c : OK
* Fix a typo
* Fixes in PR #75
- Fix a type in JpegWork
- Remove clang-format off/on in z_quake.c
- Move the jpegutils rule at the end of makefile
Diffstat (limited to 'src/code/z_jpeg.c')
| -rw-r--r-- | src/code/z_jpeg.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 2cbd3191b..c18a8c869 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -97,8 +97,7 @@ void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y) { u16 Jpeg_GetU16(u8* ptr) { if (((u32)ptr & 1) == 0) { // if the address is aligned to 2 return *(u16*)ptr; - } - else { + } else { return *(u16*)(ptr - 1) << 8 | (*(u16*)(ptr + 1) >> 8); // ?? it's exactly like *(16*)ptr } } @@ -250,19 +249,19 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) { switch (ctx.dqtCount) { case 1: { - func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 3); + JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 3); break; } case 2: { - func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 1); - func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[1], 1); - func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[2], 1); + JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 1); + JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[1], 1); + JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[2], 1); break; } case 3: { - func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 1); - func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[1], 1); - func_800FF540(ctx.dqtPtr[2], &workBuff->qTables[2], 1); + JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 1); + JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[1], 1); + JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[2], &workBuff->qTables[2], 1); break; } default: @@ -277,22 +276,27 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) { switch (ctx.dhtCount) { case 1: { - if (func_800FF7FC(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLenghts, &workBuff->codes, 4)) { + if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLengths, &workBuff->codes, + 4)) { osSyncPrintf("Error : Cant' make huffman table.\n"); } break; } case 4: { - if (func_800FF7FC(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLenghts, &workBuff->codes, 1)) { + if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLengths, &workBuff->codes, + 1)) { osSyncPrintf("Error : Cant' make huffman table.\n"); } - if (func_800FF7FC(ctx.dhtPtr[1], &hTables[1], &workBuff->codesLenghts, &workBuff->codes, 1)) { + if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[1], &hTables[1], &workBuff->codesLengths, &workBuff->codes, + 1)) { osSyncPrintf("Error : Cant' make huffman table.\n"); } - if (func_800FF7FC(ctx.dhtPtr[2], &hTables[2], &workBuff->codesLenghts, &workBuff->codes, 1)) { + if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[2], &hTables[2], &workBuff->codesLengths, &workBuff->codes, + 1)) { osSyncPrintf("Error : Cant' make huffman table.\n"); } - if (func_800FF7FC(ctx.dhtPtr[3], &hTables[3], &workBuff->codesLenghts, &workBuff->codes, 1)) { + if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[3], &hTables[3], &workBuff->codesLengths, &workBuff->codes, + 1)) { osSyncPrintf("Error : Cant' make huffman table.\n"); } break; |
