Compare commits
1 Commits
main
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46f31c0d2c |
@@ -5,6 +5,32 @@
|
||||
|
||||
#include <tmc_jpeg.h>
|
||||
|
||||
enum TMCCJPEGOutputFormat {
|
||||
TMCC_JPEG_OUTPUT_RGB565 = 0,
|
||||
TMCC_JPEG_OUTPUT_RGBA8 = 1,
|
||||
TMCC_JPEG_OUTPUT_Y8U8V8 = 2
|
||||
};
|
||||
|
||||
enum TMCJpegMarker {
|
||||
TMC_JPEG_MARKER_SOF0 = 0xFFC0,
|
||||
TMC_JPEG_MARKER_SOF2 = 0xFFC2,
|
||||
TMC_JPEG_MARKER_DHT = 0xFFC4,
|
||||
TMC_JPEG_MARKER_RST0 = 0xFFD0,
|
||||
TMC_JPEG_MARKER_RST7 = 0xFFD7,
|
||||
TMC_JPEG_MARKER_SOI = 0xFFD8,
|
||||
TMC_JPEG_MARKER_EOI = 0xFFD9,
|
||||
TMC_JPEG_MARKER_SOS = 0xFFDA,
|
||||
TMC_JPEG_MARKER_DQT = 0xFFDB,
|
||||
TMC_JPEG_MARKER_DNL = 0xFFDC,
|
||||
TMC_JPEG_MARKER_DRI = 0xFFDD,
|
||||
TMC_JPEG_MARKER_APP0 = 0xFFE0,
|
||||
TMC_JPEG_MARKER_APP1 = 0xFFE1,
|
||||
TMC_JPEG_MARKER_APP15 = 0xFFEF,
|
||||
TMC_JPEG_MARKER_COM = 0xFFFE,
|
||||
TMC_JPEG_MARKER_PREFIX = 0xFF00,
|
||||
TMC_JPEG_MARKER_FILL = 0xFFFF,
|
||||
};
|
||||
|
||||
typedef s32(TMCDecodeFunc)(s32* block, u8* conv_row_ptr, u32* dcPredictRowPtr, TMCCJPEGDecWork* work);
|
||||
typedef void(TMCIdctFunc)(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag);
|
||||
typedef void(TMCConverterFunc)(TMCCJPEGDecWork*, s32 x, s32 y);
|
||||
@@ -50,7 +76,7 @@ typedef struct {
|
||||
u8 quantTblFlag[4]; // 0x1790
|
||||
u8 dcTblFlag[2]; // 0x1794
|
||||
u8 acTblFlag[2]; // 0x1796
|
||||
} TMCUnknownInfo;
|
||||
} TMCJpegTableInfo;
|
||||
|
||||
typedef struct {
|
||||
u16 frameWidth; // 0x00
|
||||
@@ -193,7 +219,7 @@ typedef struct {
|
||||
} TMCHuffParam;
|
||||
|
||||
s32 TMCJPEGDEC_make_huffdec(const u8* dht_spec, u8* tbl, TMCHuffParam* hp);
|
||||
void TMCJPEGDEC_set_HuffmanTable(TMCHuffParam* tbl, s32 tblType, s32 tblID, TMCUnknownInfo* work);
|
||||
void TMCJPEGDEC_set_HuffmanTable(TMCHuffParam* tbl, s32 tblType, s32 tblID, TMCJpegTableInfo* work);
|
||||
|
||||
s32 TMCJPEGDEC_decompmcu(u32 maxMCU, u32 mcuCount, TMCCJPEGDecWork* work, void* buf);
|
||||
s32 TMCJPEGDEC_imagestart(TMCCJPEGDecWork* work);
|
||||
|
||||
@@ -17,7 +17,8 @@ s32 TMCCJPEGDecInit(TMCCJPEGDecState* state, TMCCJPEGDecInitParam* param) {
|
||||
|
||||
if (param->unk_0x24 != 0) {
|
||||
result = -1;
|
||||
} else if (param->unk_0x2C != 0 && param->unk_0x2C != 1 && param->unk_0x2C != 2) {
|
||||
} else if (param->unk_0x2C != TMCC_JPEG_OUTPUT_RGB565 && param->unk_0x2C != TMCC_JPEG_OUTPUT_RGBA8 &&
|
||||
param->unk_0x2C != TMCC_JPEG_OUTPUT_Y8U8V8) {
|
||||
result = -1;
|
||||
} else {
|
||||
state->unk_0x21 = param->unk_0x24;
|
||||
@@ -58,19 +59,19 @@ s32 TMCCJPEGDecInit(TMCCJPEGDecState* state, TMCCJPEGDecInitParam* param) {
|
||||
result = TMCJPEGDEC_Setsize(work);
|
||||
if (result >= 0) {
|
||||
switch (state->converterType) {
|
||||
case 0:
|
||||
case TMCC_JPEG_OUTPUT_RGB565:
|
||||
result = TMCJPEGDEC_set_converterRGB565(work);
|
||||
if (result < 0) {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case TMCC_JPEG_OUTPUT_RGBA8:
|
||||
result = TMCJPEGDEC_set_converterRGBA8(work);
|
||||
if (result < 0) {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case TMCC_JPEG_OUTPUT_Y8U8V8:
|
||||
result = TMCJPEGDEC_set_converterY8U8V8(work);
|
||||
if (result < 0) {
|
||||
goto error;
|
||||
@@ -104,7 +105,7 @@ s32 TMCCJPEGDecodeRGB565(TMCCJPEGDecState* state, s32 initResult, void* texBuffe
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (state->converterType != 0) {
|
||||
if (state->converterType != TMCC_JPEG_OUTPUT_RGB565) {
|
||||
return -4;
|
||||
}
|
||||
|
||||
@@ -173,19 +174,19 @@ s32 TMCCJPEGDecSetResolution(TMCCJPEGDecState* state, u32 scale) {
|
||||
}
|
||||
|
||||
switch (state->converterType) {
|
||||
case 0:
|
||||
case TMCC_JPEG_OUTPUT_RGB565:
|
||||
result = TMCJPEGDEC_set_converterRGB565(work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case TMCC_JPEG_OUTPUT_RGBA8:
|
||||
result = TMCJPEGDEC_set_converterRGBA8(work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case TMCC_JPEG_OUTPUT_Y8U8V8:
|
||||
result = TMCJPEGDEC_set_converterY8U8V8(work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
|
||||
@@ -52,7 +52,7 @@ static inline s32 decodeLongHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TM
|
||||
limit->bitLength = entry[0];
|
||||
limit->symbol = entry[1];
|
||||
*decoded = *limit;
|
||||
if (code > (u32)decoded->bitLength) {
|
||||
if (code > decoded->bitLength) {
|
||||
continue;
|
||||
}
|
||||
{
|
||||
@@ -101,7 +101,7 @@ static inline s32 decodeACHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TMCC
|
||||
limit->bitLength = entry[0];
|
||||
limit->symbol = entry[1];
|
||||
*decoded = *limit;
|
||||
if (code > (u32)decoded->bitLength) {
|
||||
if (code > decoded->bitLength) {
|
||||
continue;
|
||||
}
|
||||
{
|
||||
@@ -173,7 +173,8 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
|
||||
if (r != 0) {
|
||||
if (work->bitCount <= r) {
|
||||
s32 load_ret;
|
||||
if (load_ret = TMCJPEGDEC_load_buff(work), load_ret < 0) {
|
||||
load_ret = TMCJPEGDEC_load_buff(work);
|
||||
if (load_ret < 0) {
|
||||
return load_ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <stddef.h>
|
||||
#include <tmc_jpeg_internal.h>
|
||||
|
||||
static s32 refillJpegBufferAfterFF(TMCCJPEGDecWork* work);
|
||||
@@ -9,23 +10,24 @@ s32 TMCJPEGDEC_init_ptr_buff(TMCCJPEGDecWork* work, void* param) {
|
||||
u8* newEnd;
|
||||
u8* bufOrg;
|
||||
u32 newRemaining;
|
||||
const TMCCJPEGDecInitParam* input = (const TMCCJPEGDecInitParam*)((u8*)param - offsetof(TMCCJPEGDecInitParam, pBuf2));
|
||||
|
||||
if (((u32*)param)[0] & 0x1F)
|
||||
if ((u32)input->pBuf2 & 0x1F)
|
||||
return -1;
|
||||
if (((u32*)param)[1] & 0x1F)
|
||||
if (input->buf2Size & 0x1F)
|
||||
return -1;
|
||||
if (((u32*)param)[2] == 0)
|
||||
if (input->dataSize == 0)
|
||||
return -1;
|
||||
if (((u32*)param)[1] < 0x10040)
|
||||
if (input->buf2Size < 0x10040)
|
||||
return -1;
|
||||
|
||||
work->pBufOrg = (u8*)((u32*)param)[0];
|
||||
work->pBufOrg = input->pBuf2;
|
||||
dest = work->pBufOrg + 0x20;
|
||||
work->bufLen = ((u32*)param)[1] - 0x20;
|
||||
readSize = ((u32*)param)[2];
|
||||
work->bufLen = input->buf2Size - 0x20;
|
||||
readSize = input->dataSize;
|
||||
work->remaining = readSize;
|
||||
work->pCallback = (void*)((u32*)param)[3];
|
||||
work->pCbCtx = (void*)((u32*)param)[4];
|
||||
work->pCallback = input->pCallback;
|
||||
work->pCbCtx = input->pContext;
|
||||
if (work->bufLen - 0x20 < readSize) {
|
||||
readSize = work->bufLen - 0x20;
|
||||
}
|
||||
|
||||
@@ -48,8 +48,11 @@ s32 TMCJPEGDEC_rewind_ptr(TMCCJPEGDecWork* work) {
|
||||
return r;
|
||||
}
|
||||
|
||||
if ((u8)bitBuf == 0xFF && (r = TMCJPEGDEC_move_ptr(-1, work), r < 0)) {
|
||||
return r;
|
||||
if ((u8)bitBuf == 0xFF) {
|
||||
r = TMCJPEGDEC_move_ptr(-1, work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
bitBuf >>= 8;
|
||||
|
||||
@@ -120,7 +120,7 @@ s32 TMCJPEGDEC_make_huffdec(const u8* dht, u8* tb, TMCHuffParam* hp) {
|
||||
|
||||
|
||||
|
||||
void TMCJPEGDEC_set_HuffmanTable(TMCHuffParam* tbl, s32 tblType, s32 tblID, TMCUnknownInfo* info) {
|
||||
void TMCJPEGDEC_set_HuffmanTable(TMCHuffParam* tbl, s32 tblType, s32 tblID, TMCJpegTableInfo* info) {
|
||||
TMCCJPEGDecWork* work = (TMCCJPEGDecWork*)info;
|
||||
void* hufftable;
|
||||
void* maxcode;
|
||||
|
||||
@@ -2,6 +2,37 @@
|
||||
#include <tmc_jpeg.h>
|
||||
#include <tmc_jpeg_internal.h>
|
||||
|
||||
enum TMCExifFormat {
|
||||
TMC_EXIF_LITTLE_ENDIAN = 0x4949,
|
||||
TMC_EXIF_BIG_ENDIAN = 0x4D4D,
|
||||
TMC_EXIF_TIFF_MAGIC = 42,
|
||||
TMC_EXIF_TYPE_SHORT = 3,
|
||||
TMC_EXIF_TYPE_LONG = 4,
|
||||
TMC_EXIF_COMPRESSION_JPEG = 6
|
||||
};
|
||||
|
||||
enum TMCExifTag {
|
||||
TMC_EXIF_TAG_COMPRESSION = 0x0103,
|
||||
TMC_EXIF_TAG_STRIP_OFFSETS = 0x0111,
|
||||
TMC_EXIF_TAG_ORIENTATION = 0x0112,
|
||||
TMC_EXIF_TAG_X_RESOLUTION = 0x011A,
|
||||
TMC_EXIF_TAG_Y_RESOLUTION = 0x011B,
|
||||
TMC_EXIF_TAG_PLANAR_CONFIGURATION = 0x011C,
|
||||
TMC_EXIF_TAG_RESOLUTION_UNIT = 0x0128,
|
||||
TMC_EXIF_TAG_TRANSFER_FUNCTION = 0x012D,
|
||||
TMC_EXIF_TAG_DATE_TIME = 0x0132,
|
||||
TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT = 0x0201,
|
||||
TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = 0x0202,
|
||||
TMC_EXIF_TAG_YCBCR_POSITIONING = 0x0213,
|
||||
TMC_EXIF_TAG_EXIF_IFD = 0x8769,
|
||||
TMC_EXIF_TAG_EXIF_VERSION = 0x9000,
|
||||
TMC_EXIF_TAG_COMPONENTS_CONFIGURATION = 0x9101,
|
||||
TMC_EXIF_TAG_FLASHPIX_VERSION = 0xA000,
|
||||
TMC_EXIF_TAG_COLOR_SPACE = 0xA001,
|
||||
TMC_EXIF_TAG_PIXEL_X_DIMENSION = 0xA002,
|
||||
TMC_EXIF_TAG_PIXEL_Y_DIMENSION = 0xA003,
|
||||
};
|
||||
|
||||
static s32 TMCJPEGDEC_exif_parse(const u8* data, u32 size, TMCCJPEGDecExifData* pInfo);
|
||||
static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, u8* entry);
|
||||
static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, const u8* entry);
|
||||
@@ -9,23 +40,23 @@ static s32 TMCJPEGDEC_ThumbnailCheck(TMCCJPEGDecInitParam* param, TMCCJPEGDecExi
|
||||
|
||||
static u16 readU16(const u8* p, u16 byteOrder) {
|
||||
u32 raw = p[1] << 8 | p[0];
|
||||
if (byteOrder == 0x4949) {
|
||||
return (u16)raw;
|
||||
if (byteOrder == TMC_EXIF_LITTLE_ENDIAN) {
|
||||
return raw;
|
||||
}
|
||||
return (u16)(raw >> 8 & 0xFF | (raw & 0xFF) << 8);
|
||||
return raw >> 8 & 0xFF | (raw & 0xFF) << 8;
|
||||
}
|
||||
|
||||
static u16 readExifU16(const u8* data, u16 byteOrder) {
|
||||
u16 value = data[0] | data[1] << 8;
|
||||
if (byteOrder == 0x4949) {
|
||||
if (byteOrder == TMC_EXIF_LITTLE_ENDIAN) {
|
||||
return (u16)value;
|
||||
}
|
||||
return (u16)(value >> 8 & 255 | (value & 255) << 8);
|
||||
return value >> 8 & 255 | (value & 255) << 8;
|
||||
}
|
||||
|
||||
static u32 readU32(const u8* p, u16 byteOrder) {
|
||||
u32 raw = p[1] << 8 | p[0] | p[2] << 16 | p[3] << 24;
|
||||
if (byteOrder == 0x4949) {
|
||||
if (byteOrder == TMC_EXIF_LITTLE_ENDIAN) {
|
||||
return raw;
|
||||
}
|
||||
return (raw >> 24) | ((raw >> 8) & 0xFF00) | ((raw & 0xFF00) << 8) | ((raw & 0xFF) << 24);
|
||||
@@ -46,7 +77,7 @@ s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pPa
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(work, 0, 0x19E8);
|
||||
memset(work, 0, sizeof(TMCCJPEGDecWork));
|
||||
|
||||
result = TMCJPEGDEC_init_ptr_buff(work, &pParam->pBuf2);
|
||||
if (result < 0) {
|
||||
@@ -61,7 +92,7 @@ s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pPa
|
||||
return result;
|
||||
}
|
||||
|
||||
if (soi != 0xFFD8) {
|
||||
if (soi != TMC_JPEG_MARKER_SOI) {
|
||||
return -0x20;
|
||||
}
|
||||
}
|
||||
@@ -72,7 +103,7 @@ s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pPa
|
||||
return result;
|
||||
}
|
||||
|
||||
if (marker == 0xFFE1) {
|
||||
if (marker == TMC_JPEG_MARKER_APP1) {
|
||||
result = TMCJPEGDEC_get_wbyte(&segSize, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
@@ -87,7 +118,7 @@ s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pPa
|
||||
return result;
|
||||
}
|
||||
|
||||
if (sig[0] == 0x45 && sig[1] == 0x78 && sig[2] == 0x69 && sig[3] == 0x66) {
|
||||
if (sig[0] == 'E' && sig[1] == 'x' && sig[2] == 'i' && sig[3] == 'f') {
|
||||
*pOffset = dataSize - work->remaining - TMCJPEGDEC_chk_possible_size(work) - 8;
|
||||
*pSize = segSize + 2;
|
||||
return 0;
|
||||
@@ -107,7 +138,7 @@ s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pPa
|
||||
|
||||
segSize -= 2;
|
||||
|
||||
if (marker >= 0xFFE0 && marker <= 0xFFEF) {
|
||||
if (marker >= TMC_JPEG_MARKER_APP0 && marker <= TMC_JPEG_MARKER_APP15) {
|
||||
result = TMCJPEGDEC_move_ptr(segSize, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
@@ -116,21 +147,21 @@ s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pPa
|
||||
}
|
||||
|
||||
switch (marker) {
|
||||
case 0xFFC0:
|
||||
case 0xFFC2:
|
||||
case 0xFFC4:
|
||||
case 0xFFDB:
|
||||
case 0xFFDC:
|
||||
case 0xFFDD:
|
||||
case 0xFFFE:
|
||||
case TMC_JPEG_MARKER_SOF0:
|
||||
case TMC_JPEG_MARKER_SOF2:
|
||||
case TMC_JPEG_MARKER_DHT:
|
||||
case TMC_JPEG_MARKER_DQT:
|
||||
case TMC_JPEG_MARKER_DNL:
|
||||
case TMC_JPEG_MARKER_DRI:
|
||||
case TMC_JPEG_MARKER_COM:
|
||||
result = TMCJPEGDEC_move_ptr(segSize, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
case 0xFFDA:
|
||||
case TMC_JPEG_MARKER_SOS:
|
||||
return -2;
|
||||
case 0xFFD9:
|
||||
case TMC_JPEG_MARKER_EOI:
|
||||
return -2;
|
||||
default:
|
||||
return -0x2F;
|
||||
@@ -150,18 +181,18 @@ s32 TMCCJPEGDecGetInfoEXIF(TMCCJPEGDecExifInfo* pInfo, TMCCJPEGDecInitParam* pPa
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(pInfo, 0, 0x6D4);
|
||||
memset(work, 0, 0x19E8);
|
||||
memset(pInfo, 0, sizeof(TMCCJPEGDecExifInfo));
|
||||
memset(work, 0, sizeof(TMCCJPEGDecWork));
|
||||
|
||||
// TODO: this seems wrong. wrong parameter type?
|
||||
work->pState = (TMCCJPEGDecState*)pInfo;
|
||||
pInfo->pWorkBuf = work;
|
||||
|
||||
if (readU16(pParam->pBuf2, 0x4D4D) != 0xFFE1) {
|
||||
if (readU16(pParam->pBuf2, TMC_EXIF_BIG_ENDIAN) != TMC_JPEG_MARKER_APP1) {
|
||||
return -0x45;
|
||||
}
|
||||
|
||||
segSize = readU16((const u8*)pParam->pBuf2 + 2, 0x4D4D);
|
||||
segSize = readU16((const u8*)pParam->pBuf2 + 2, TMC_EXIF_BIG_ENDIAN);
|
||||
if (segSize < 2) {
|
||||
return -0x45;
|
||||
}
|
||||
@@ -186,7 +217,7 @@ s32 TMCCJPEGDecGetInfoEXIF(TMCCJPEGDecExifInfo* pInfo, TMCCJPEGDecInitParam* pPa
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = TMCJPEGDEC_init_buff_thumbnail((TMCCJPEGDecWork*)&pInfo->exifData, (u8*)work, (u8*)pParam + 0x10);
|
||||
result = TMCJPEGDEC_init_buff_thumbnail((TMCCJPEGDecWork*)&pInfo->exifData, (u8*)work, (u8*)&pParam->pBuf2);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
@@ -211,19 +242,19 @@ s32 TMCCJPEGDecGetInfoEXIF(TMCCJPEGDecExifInfo* pInfo, TMCCJPEGDecInitParam* pPa
|
||||
}
|
||||
|
||||
switch (pInfo->converterType) {
|
||||
case 0:
|
||||
case TMCC_JPEG_OUTPUT_RGB565:
|
||||
result = TMCJPEGDEC_set_converterRGB565(work);
|
||||
if (result < 0) {
|
||||
goto _error;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case TMCC_JPEG_OUTPUT_RGBA8:
|
||||
result = TMCJPEGDEC_set_converterRGBA8(work);
|
||||
if (result < 0) {
|
||||
goto _error;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case TMCC_JPEG_OUTPUT_Y8U8V8:
|
||||
result = TMCJPEGDEC_set_converterY8U8V8(work);
|
||||
if (result < 0) {
|
||||
goto _error;
|
||||
@@ -262,10 +293,10 @@ static s32 TMCJPEGDEC_exif_parse(const u8* entries, u32 size, TMCCJPEGDecExifDat
|
||||
return -161;
|
||||
}
|
||||
byteOrder = data[0] | data[1] << 8;
|
||||
if (byteOrder != 0x4D4D && byteOrder != 0x4949) {
|
||||
if (byteOrder != TMC_EXIF_BIG_ENDIAN && byteOrder != TMC_EXIF_LITTLE_ENDIAN) {
|
||||
return -161;
|
||||
}
|
||||
if (readExifU16(data + 2, byteOrder) != 42) {
|
||||
if (readExifU16(data + 2, byteOrder) != TMC_EXIF_TIFF_MAGIC) {
|
||||
return -161;
|
||||
}
|
||||
ifdOffset = readU32(data + 4, byteOrder);
|
||||
@@ -349,23 +380,23 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
type = readExifU16(entry + 2, byteOrder);
|
||||
|
||||
switch (tag) {
|
||||
case 0x0103:
|
||||
case 0x0111:
|
||||
case 0x0201:
|
||||
case 0x0202: {
|
||||
case TMC_EXIF_TAG_COMPRESSION:
|
||||
case TMC_EXIF_TAG_STRIP_OFFSETS:
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT:
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: {
|
||||
break;
|
||||
}
|
||||
case 0x0112: {
|
||||
case TMC_EXIF_TAG_ORIENTATION: {
|
||||
pInfo->orientation = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x011A: {
|
||||
case TMC_EXIF_TAG_X_RESOLUTION: {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResNum = readU32(p, byteOrder);
|
||||
@@ -373,19 +404,19 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResDen = readU32(p, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x011B: {
|
||||
case TMC_EXIF_TAG_Y_RESOLUTION: {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->yResNum = readU32(p, byteOrder);
|
||||
@@ -393,17 +424,17 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->yResDen = readU32(p, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x0128: {
|
||||
case TMC_EXIF_TAG_RESOLUTION_UNIT: {
|
||||
pInfo->resUnit = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x012D: {
|
||||
case TMC_EXIF_TAG_TRANSFER_FUNCTION: {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
u32 channel;
|
||||
u32 index;
|
||||
@@ -422,7 +453,7 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 0x0132: {
|
||||
case TMC_EXIF_TAG_DATE_TIME: {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
@@ -439,52 +470,52 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 0x0213: {
|
||||
case TMC_EXIF_TAG_YCBCR_POSITIONING: {
|
||||
pInfo->yCbCrPos = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x8769: {
|
||||
case TMC_EXIF_TAG_EXIF_IFD: {
|
||||
pInfo->nextIfdOffset = readU32(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x9000: {
|
||||
case TMC_EXIF_TAG_EXIF_VERSION: {
|
||||
pInfo->exifVer[0] = entry[8];
|
||||
pInfo->exifVer[1] = entry[9];
|
||||
pInfo->exifVer[2] = entry[10];
|
||||
pInfo->exifVer[3] = entry[11];
|
||||
return;
|
||||
}
|
||||
case 0x9101: {
|
||||
case TMC_EXIF_TAG_COMPONENTS_CONFIGURATION: {
|
||||
pInfo->flashVer[0] = entry[8];
|
||||
pInfo->flashVer[1] = entry[9];
|
||||
pInfo->flashVer[2] = entry[10];
|
||||
pInfo->flashVer[3] = entry[11];
|
||||
return;
|
||||
}
|
||||
case 0xA000: {
|
||||
case TMC_EXIF_TAG_FLASHPIX_VERSION: {
|
||||
pInfo->flashPixVer[0] = entry[8];
|
||||
pInfo->flashPixVer[1] = entry[9];
|
||||
pInfo->flashPixVer[2] = entry[10];
|
||||
pInfo->flashPixVer[3] = entry[11];
|
||||
return;
|
||||
}
|
||||
case 0xA001: {
|
||||
case TMC_EXIF_TAG_COLOR_SPACE: {
|
||||
pInfo->colorSpace = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0xA002: {
|
||||
if (type == 3) {
|
||||
case TMC_EXIF_TAG_PIXEL_X_DIMENSION: {
|
||||
if (type == TMC_EXIF_TYPE_SHORT) {
|
||||
pInfo->pixelXDim = readU16(entry + 8, byteOrder);
|
||||
} else if (type == 4) {
|
||||
} else if (type == TMC_EXIF_TYPE_LONG) {
|
||||
pInfo->pixelXDim = readU32(entry + 8, byteOrder);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case 0xA003: {
|
||||
if (type == 3) {
|
||||
case TMC_EXIF_TAG_PIXEL_Y_DIMENSION: {
|
||||
if (type == TMC_EXIF_TYPE_SHORT) {
|
||||
pInfo->pixelYDim = readU16(entry + 8, byteOrder);
|
||||
} else if (type == 4) {
|
||||
} else if (type == TMC_EXIF_TYPE_LONG) {
|
||||
pInfo->pixelYDim = readU32(entry + 8, byteOrder);
|
||||
}
|
||||
return;
|
||||
@@ -496,22 +527,22 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
s32 tag = readU16(entry, byteOrder);
|
||||
|
||||
switch (tag) {
|
||||
case 0x0132:
|
||||
case 0x0111:
|
||||
case 0x0112:
|
||||
case 0x012D:
|
||||
case 0x0213:
|
||||
case 0x8769:
|
||||
case 0x9000:
|
||||
case 0x9101:
|
||||
case 0x011C:
|
||||
case 0xA000:
|
||||
case 0xA001:
|
||||
case 0xA002:
|
||||
case 0xA003: {
|
||||
case TMC_EXIF_TAG_DATE_TIME:
|
||||
case TMC_EXIF_TAG_STRIP_OFFSETS:
|
||||
case TMC_EXIF_TAG_ORIENTATION:
|
||||
case TMC_EXIF_TAG_TRANSFER_FUNCTION:
|
||||
case TMC_EXIF_TAG_YCBCR_POSITIONING:
|
||||
case TMC_EXIF_TAG_EXIF_IFD:
|
||||
case TMC_EXIF_TAG_EXIF_VERSION:
|
||||
case TMC_EXIF_TAG_COMPONENTS_CONFIGURATION:
|
||||
case TMC_EXIF_TAG_PLANAR_CONFIGURATION:
|
||||
case TMC_EXIF_TAG_FLASHPIX_VERSION:
|
||||
case TMC_EXIF_TAG_COLOR_SPACE:
|
||||
case TMC_EXIF_TAG_PIXEL_X_DIMENSION:
|
||||
case TMC_EXIF_TAG_PIXEL_Y_DIMENSION: {
|
||||
break;
|
||||
}
|
||||
case 0x011A: {
|
||||
case TMC_EXIF_TAG_X_RESOLUTION: {
|
||||
u32 offset;
|
||||
const u8* p;
|
||||
offset = readU32(entry + 8, byteOrder);
|
||||
@@ -519,7 +550,7 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResNumIfd1 = readU32(p, byteOrder);
|
||||
@@ -527,13 +558,13 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResDenIfd1 = readU32(p, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x011B: {
|
||||
case TMC_EXIF_TAG_Y_RESOLUTION: {
|
||||
u32 offset;
|
||||
const u8* p;
|
||||
offset = readU32(entry + 8, byteOrder);
|
||||
@@ -541,7 +572,7 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->planarConfigIfd1 = readU32(p, byteOrder);
|
||||
@@ -549,25 +580,25 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->yResDenIfd1 = readU32(p, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x0128: {
|
||||
case TMC_EXIF_TAG_RESOLUTION_UNIT: {
|
||||
pInfo->resUnitIfd1 = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x0103: {
|
||||
case TMC_EXIF_TAG_COMPRESSION: {
|
||||
pInfo->compressionIfd1 = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x0201: {
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT: {
|
||||
pInfo->thumbnailOffset = readU32(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x0202: {
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: {
|
||||
pInfo->thumbnailLength = readU32(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
@@ -589,7 +620,7 @@ static s32 TMCJPEGDEC_ThumbnailCheck(TMCCJPEGDecInitParam* param, TMCCJPEGDecExi
|
||||
return -0xA0;
|
||||
}
|
||||
|
||||
if (info->exifData.compressionIfd1 != 6) {
|
||||
if (info->exifData.compressionIfd1 != TMC_EXIF_COMPRESSION_JPEG) {
|
||||
return -0xA0;
|
||||
}
|
||||
|
||||
@@ -612,7 +643,8 @@ static s32 TMCJPEGDEC_ThumbnailCheck(TMCCJPEGDecInitParam* param, TMCCJPEGDecExi
|
||||
|
||||
info->thumbFlag = 0;
|
||||
|
||||
if (param->unk_0x2C != 0 && param->unk_0x2C != 1 && param->unk_0x2C != 2) {
|
||||
if (param->unk_0x2C != TMCC_JPEG_OUTPUT_RGB565 && param->unk_0x2C != TMCC_JPEG_OUTPUT_RGBA8 &&
|
||||
param->unk_0x2C != TMCC_JPEG_OUTPUT_Y8U8V8) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
|
||||
s32 TMCJPEGDEC_Decompscan(TMCCJPEGDecWork* work) {
|
||||
s32 r = TMCJPEGDEC_scanstart(work);
|
||||
return r < 0 ? r : (work->scanCount == 1) ? 0 : r;
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
if (work->scanCount == 1) {
|
||||
return 0;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
s32 TMCJPEGDEC_Setsize(TMCCJPEGDecWork* work) {
|
||||
|
||||
@@ -21,8 +21,8 @@ s32 TMCJPEGDEC_decompmcu(u32 maxMCU, u32 mcuCount, TMCCJPEGDecWork* work, void*
|
||||
u8* compMapPtr;
|
||||
u32* mcuDataInfo;
|
||||
|
||||
u8* curBlockInfo;
|
||||
u8* specificConvRowPtr;
|
||||
u8** curBlockInfo;
|
||||
u8** specificConvRowPtr;
|
||||
|
||||
u8* blockCountPtr;
|
||||
u8* entTblBase;
|
||||
@@ -35,7 +35,7 @@ s32 TMCJPEGDEC_decompmcu(u32 maxMCU, u32 mcuCount, TMCCJPEGDecWork* work, void*
|
||||
u8* frameInfo;
|
||||
u8* scaleInfo;
|
||||
|
||||
u8* convRowPtrs;
|
||||
u8** convRowPtrs;
|
||||
TMCCJPEGDecState* state;
|
||||
|
||||
TMCIdctFunc* idctFunc;
|
||||
@@ -44,10 +44,10 @@ s32 TMCJPEGDEC_decompmcu(u32 maxMCU, u32 mcuCount, TMCCJPEGDecWork* work, void*
|
||||
|
||||
state = work->pState;
|
||||
compMapBase = work->compMap;
|
||||
frameInfo = (u8*)work + 0x17f0;
|
||||
frameInfo = (u8*)&work->frameWidth;
|
||||
compMapPtr = compMapBase;
|
||||
scaleInfo = (u8*)work + 0x58;
|
||||
convRowPtrs = (u8*)work + 0x183c;
|
||||
scaleInfo = &work->scaleFlag;
|
||||
convRowPtrs = work->pConvRowPtrs;
|
||||
mcuDataInfo = (u32*)(compMapBase + 4);
|
||||
mcuIdx = 0;
|
||||
|
||||
@@ -57,13 +57,13 @@ s32 TMCJPEGDEC_decompmcu(u32 maxMCU, u32 mcuCount, TMCCJPEGDecWork* work, void*
|
||||
|
||||
pitch = work->pitch;
|
||||
|
||||
while (mcuIdx < (s32) * (frameInfo + 0x1b)) {
|
||||
while (mcuIdx < ((TMCJpegFrameInfo*)frameInfo)->scanCompCount) {
|
||||
compIdx = *compMapPtr;
|
||||
entTblBase = scaleInfo + ((u32) * (compMapBase + compIdx + 0x18) << 8);
|
||||
TMCJPEGDEC_set_entropytbl((TMCCJPEGDecWork*)scaleInfo, *(compMapBase + compIdx + 0x1c), *(compMapBase + compIdx + 0x20));
|
||||
|
||||
curBlockInfo = convRowPtrs;
|
||||
specificConvRowPtr = convRowPtrs + (compIdx << 2);
|
||||
specificConvRowPtr = convRowPtrs + compIdx;
|
||||
blockCountPtr = frameInfo + mcuIdx;
|
||||
blockIdx = 0;
|
||||
|
||||
@@ -76,16 +76,16 @@ s32 TMCJPEGDEC_decompmcu(u32 maxMCU, u32 mcuCount, TMCCJPEGDecWork* work, void*
|
||||
return ret;
|
||||
|
||||
if (compIdx == 0) {
|
||||
idctFunc(stackBlock, *(u8**)(curBlockInfo), pitch, ret);
|
||||
idctFunc(stackBlock, *curBlockInfo, pitch, ret);
|
||||
} else {
|
||||
idctLumiFunc(stackBlock, *(u8**)(specificConvRowPtr + 0x10), pitch, ret);
|
||||
idctLumiFunc(stackBlock, specificConvRowPtr[4], pitch, ret);
|
||||
}
|
||||
|
||||
curBlockInfo += 4;
|
||||
curBlockInfo++;
|
||||
blockIdx++;
|
||||
}
|
||||
|
||||
mcuDataInfo = (u32*)((u8*)mcuDataInfo + 4);
|
||||
mcuDataInfo++;
|
||||
mcuIdx++;
|
||||
compMapPtr++;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ s32 TMCJPEGDEC_decompmcu(u32 maxMCU, u32 mcuCount, TMCCJPEGDecWork* work, void*
|
||||
work->pConverterFuncEdge(work, maxMCU, mcuCount);
|
||||
}
|
||||
|
||||
if (*(u16*)(frameInfo + 0x2a) != 0) {
|
||||
if (((TMCJpegFrameInfo*)frameInfo)->restartInterval != 0) {
|
||||
s32 r = TMCJPEGDEC_restart_interval(work, maxMCU, mcuCount);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
@@ -126,7 +126,7 @@ s32 TMCJPEGDEC_imagestart(TMCCJPEGDecWork* work) {
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
if (marker != 0xFFD8) {
|
||||
if (marker != TMC_JPEG_MARKER_SOI) {
|
||||
return -0x20;
|
||||
}
|
||||
marker = 0;
|
||||
@@ -134,7 +134,7 @@ s32 TMCJPEGDEC_imagestart(TMCCJPEGDecWork* work) {
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
if (marker != 0xFFC0) {
|
||||
if (marker != TMC_JPEG_MARKER_SOF0) {
|
||||
return -0x10;
|
||||
}
|
||||
r = TMCJPEGDEC_parse_sof(work);
|
||||
@@ -162,7 +162,7 @@ s32 TMCJPEGDEC_imageend(TMCCJPEGDecWork* work) {
|
||||
return r;
|
||||
}
|
||||
|
||||
if (marker != 0xFFD9) {
|
||||
if (marker != TMC_JPEG_MARKER_EOI) {
|
||||
work->pState->decodeResult = -0x21;
|
||||
return 0;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ s32 TMCJPEGDEC_scanstart(TMCCJPEGDecWork* work) {
|
||||
return r;
|
||||
}
|
||||
|
||||
if (marker != 0xFFDA) {
|
||||
if (marker != TMC_JPEG_MARKER_SOS) {
|
||||
return -0x22;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ s32 TMCJPEGDEC_scan_varinit(TMCCJPEGDecWork* work) {
|
||||
p->mcuXCount2 = p->mcuXCount2 + ((u8)remY != 0 ? 1 : 0);
|
||||
p->mcuTotal = (u32)p->mcuYCount * (u32)p->mcuXCount2;
|
||||
|
||||
for (idx = 0; idx < (s32)p->scanCompCount; idx++) {
|
||||
for (idx = 0; idx < p->scanCompCount; idx++) {
|
||||
u8 compId;
|
||||
u32 blocks;
|
||||
|
||||
@@ -322,19 +322,19 @@ s32 TMCJPEGDEC_restart_interval(TMCCJPEGDecWork* work, u32 maxMCU, u32 mcuCount)
|
||||
return result;
|
||||
}
|
||||
result = TMCJPEGDEC_get_wbyte(&marker, work);
|
||||
if (marker == 0xFFD9) {
|
||||
if (marker == TMC_JPEG_MARKER_EOI) {
|
||||
work->scanCount = 1;
|
||||
}
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
if (marker >= 0xFFC0 && (marker < 0xFFD0 || marker > 0xFFD7)) {
|
||||
if (marker >= TMC_JPEG_MARKER_SOF0 && (marker < TMC_JPEG_MARKER_RST0 || marker > TMC_JPEG_MARKER_RST7)) {
|
||||
result = TMCJPEGDEC_move_ptr(-2, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
s32 expected = work->rstMarkerIdx + 0xFFD0;
|
||||
s32 expected = work->rstMarkerIdx + TMC_JPEG_MARKER_RST0;
|
||||
if (marker != expected) {
|
||||
return -0x23;
|
||||
}
|
||||
@@ -435,58 +435,58 @@ static s32 TMCJPEGDEC_parse_para(u16* marker, TMCCJPEGDecWork* work) {
|
||||
do {
|
||||
result = TMCJPEGDEC_get_wbyte(&local, work);
|
||||
if (result < 0) {
|
||||
if (result == TMCC_ERROR_UNDERFLOW && local == 0xFFD9) {
|
||||
if (result == TMCC_ERROR_UNDERFLOW && local == TMC_JPEG_MARKER_EOI) {
|
||||
result = 0;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
while (local == 0xFFFF) {
|
||||
while (local == TMC_JPEG_MARKER_FILL) {
|
||||
result = TMCJPEGDEC_get_byte(&byte, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
local = 0xFF00 | byte;
|
||||
local = TMC_JPEG_MARKER_PREFIX | byte;
|
||||
}
|
||||
|
||||
if (local >= 0xFFE0 && local <= 0xFFEF) {
|
||||
if (local >= TMC_JPEG_MARKER_APP0 && local <= TMC_JPEG_MARKER_APP15) {
|
||||
result = parseApplication(work);
|
||||
} else {
|
||||
switch ((s32)local) {
|
||||
case 0xFFC4: {
|
||||
switch (local) {
|
||||
case TMC_JPEG_MARKER_DHT: {
|
||||
result = TMCJPEGDEC_parse_dht(firstMarker, work);
|
||||
break;
|
||||
}
|
||||
case 0xFFDB: {
|
||||
case TMC_JPEG_MARKER_DQT: {
|
||||
result = TMCJPEGDEC_parse_dqt(work);
|
||||
break;
|
||||
}
|
||||
case 0xFFDD: {
|
||||
case TMC_JPEG_MARKER_DRI: {
|
||||
result = parseRestartInterval(work);
|
||||
break;
|
||||
}
|
||||
case 0xFFDC: {
|
||||
case TMC_JPEG_MARKER_DNL: {
|
||||
result = parseNumberOfLines(work);
|
||||
break;
|
||||
}
|
||||
case 0xFFFE: {
|
||||
case TMC_JPEG_MARKER_COM: {
|
||||
result = parseComment(work);
|
||||
break;
|
||||
}
|
||||
case 0xFFC0: {
|
||||
case TMC_JPEG_MARKER_SOF0: {
|
||||
keepGoing = 1;
|
||||
break;
|
||||
}
|
||||
case 0xFFC2: {
|
||||
case TMC_JPEG_MARKER_SOF2: {
|
||||
keepGoing = 1;
|
||||
break;
|
||||
}
|
||||
case 0xFFDA: {
|
||||
case TMC_JPEG_MARKER_SOS: {
|
||||
keepGoing = 1;
|
||||
break;
|
||||
}
|
||||
case 0xFFD9: {
|
||||
case TMC_JPEG_MARKER_EOI: {
|
||||
work->scanCount = 1;
|
||||
keepGoing = 1;
|
||||
break;
|
||||
@@ -508,16 +508,16 @@ static s32 TMCJPEGDEC_parse_para(u16* marker, TMCCJPEGDecWork* work) {
|
||||
}
|
||||
|
||||
static s32 TMCJPEGDEC_parse_dht(s32 first, TMCCJPEGDecWork* work) {
|
||||
TMCUnknownInfo* scaleInfo;
|
||||
TMCJpegTableInfo* scaleInfo;
|
||||
u16 len;
|
||||
u8 countBuf[17];
|
||||
u8 symBuf[256];
|
||||
s32 r;
|
||||
TMCHuffParam tblSet;
|
||||
|
||||
scaleInfo = (TMCUnknownInfo*)&work->scaleFlag;
|
||||
scaleInfo = (TMCJpegTableInfo*)&work->scaleFlag;
|
||||
|
||||
memset(countBuf, 0, 17);
|
||||
memset(countBuf, 0, sizeof(countBuf));
|
||||
|
||||
r = TMCJPEGDEC_get_wbyte(&len, work);
|
||||
if (r < 0) {
|
||||
@@ -627,7 +627,7 @@ static s32 TMCJPEGDEC_parse_dqt(TMCCJPEGDecWork* work) {
|
||||
return -0x41;
|
||||
}
|
||||
|
||||
((TMCUnknownInfo*)scaleInfo)->quantTblFlag[qtInfo] = 1;
|
||||
((TMCJpegTableInfo*)scaleInfo)->quantTblFlag[qtInfo] = 1;
|
||||
|
||||
zigPtr = TMCJPEGDEC_Zigzag_data;
|
||||
for (zzIdx = 0; zzIdx < 64; zzIdx++) {
|
||||
@@ -947,7 +947,7 @@ _parse_sof_return:
|
||||
}
|
||||
#else
|
||||
static s32 TMCJPEGDEC_parse_sof(TMCCJPEGDecWork* work) {
|
||||
TMCJpegFrameInfo* frameInfo = (TMCJpegFrameInfo*)((u8*)work + 0x17f0);
|
||||
TMCJpegFrameInfo* frameInfo = (TMCJpegFrameInfo*)&work->frameWidth;
|
||||
|
||||
u16 len;
|
||||
u8 precision;
|
||||
@@ -1145,7 +1145,7 @@ static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
|
||||
} TMCComponentInfo;
|
||||
s32 idx;
|
||||
TMCComponentInfo* components;
|
||||
TMCUnknownInfo* scalePtr;
|
||||
TMCJpegTableInfo* scalePtr;
|
||||
TMCComponentInfo* mapPtr;
|
||||
|
||||
s32 dcTbl;
|
||||
@@ -1158,7 +1158,7 @@ static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
|
||||
u8 scanByte;
|
||||
|
||||
components = (TMCComponentInfo*)work->compMap;
|
||||
scalePtr = (TMCUnknownInfo*)&work->scaleFlag;
|
||||
scalePtr = (TMCJpegTableInfo*)&work->scaleFlag;
|
||||
|
||||
r = TMCJPEGDEC_get_wbyte(&len, work);
|
||||
if (r < 0) {
|
||||
@@ -1179,13 +1179,13 @@ static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
|
||||
return -0x51;
|
||||
}
|
||||
|
||||
for (idx = 0; idx < (s32)work->scanCompCount; idx++) {
|
||||
for (idx = 0; idx < work->scanCompCount; idx++) {
|
||||
r = TMCJPEGDEC_get_byte(&scanByte, work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
for (ci = 0; ci < (s32)work->compCount; ci++) {
|
||||
for (ci = 0; ci < work->compCount; ci++) {
|
||||
if ((s32)scanByte == (s32)components->id[ci]) {
|
||||
components->map[idx] = ci;
|
||||
mapPtr = (TMCComponentInfo*)&components->map[idx];
|
||||
|
||||
@@ -76,7 +76,7 @@ void TMCJPEGDEC_IdctBlock4x4(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag
|
||||
bp[0] = clampU8((evsum + oddrot) >> 11);
|
||||
bp[pitch] = clampU8((cd + rot) >> 11);
|
||||
bp[pitch * 2] = clampU8((cd - rot) >> 11);
|
||||
bp[pitch * 4 - pitch] = clampU8((evsum - oddrot) >> 11);
|
||||
bp[pitch * 3] = clampU8((evsum - oddrot) >> 11);
|
||||
|
||||
idx -= 1;
|
||||
}
|
||||
@@ -99,10 +99,10 @@ void TMCJPEGDEC_IdctBlock2x2(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag
|
||||
even_diff = a0b - a1;
|
||||
odd_sum = b0 + b1;
|
||||
rot = b0 - b1;
|
||||
bp[0] = (u8)clampU8((even_sum + odd_sum) >> 11);
|
||||
bp[pitch] = (u8)clampU8((even_sum - odd_sum) >> 11);
|
||||
bp[1] = (u8)clampU8((even_diff + rot) >> 11);
|
||||
(bp + pitch)[1] = (u8)clampU8((even_diff - rot) >> 11);
|
||||
bp[0] = clampU8((even_sum + odd_sum) >> 11);
|
||||
bp[pitch] = clampU8((even_sum - odd_sum) >> 11);
|
||||
bp[1] = clampU8((even_diff + rot) >> 11);
|
||||
(bp + pitch)[1] = clampU8((even_diff - rot) >> 11);
|
||||
}
|
||||
|
||||
void TMCJPEGDEC_IdctBlock1x1(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag) {
|
||||
|
||||
@@ -40,7 +40,8 @@ s32 TMCJPEGDEC_decode_iquant_rc(s32* block, u8* conv_row_ptr, u32* dc_predict_ro
|
||||
conv_row = (s32*)conv_row_ptr;
|
||||
dcf = work->pDCFast;
|
||||
if (work->bitCount <= 8) {
|
||||
if (r = TMCJPEGDEC_load_buff(work), r < 0) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +62,8 @@ s32 TMCJPEGDEC_decode_iquant_rc(s32* block, u8* conv_row_ptr, u32* dc_predict_ro
|
||||
|
||||
if (val != 0) {
|
||||
if (work->bitCount <= val) {
|
||||
if (r = TMCJPEGDEC_load_buff(work), r < 0) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -82,7 +84,8 @@ s32 TMCJPEGDEC_decode_iquant_rc(s32* block, u8* conv_row_ptr, u32* dc_predict_ro
|
||||
idx = 1;
|
||||
do {
|
||||
if (work->bitCount <= 8) {
|
||||
if (r = TMCJPEGDEC_load_buff(work), r < 0) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -92,10 +95,11 @@ s32 TMCJPEGDEC_decode_iquant_rc(s32* block, u8* conv_row_ptr, u32* dc_predict_ro
|
||||
val = *ac_entry;
|
||||
if (val != 0) {
|
||||
tmp = val;
|
||||
val = *(ac_entry + 1);
|
||||
val = ac_entry[1];
|
||||
work->bitCount -= tmp;
|
||||
} else {
|
||||
if (val = TMCJPEGDEC_vl_decode_rc(ac_vl, ac_sym, work), val < 0) {
|
||||
val = TMCJPEGDEC_vl_decode_rc(ac_vl, ac_sym, work);
|
||||
if (val < 0) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
@@ -107,7 +111,8 @@ s32 TMCJPEGDEC_decode_iquant_rc(s32* block, u8* conv_row_ptr, u32* dc_predict_ro
|
||||
idx += val;
|
||||
|
||||
if (work->bitCount <= t) {
|
||||
if (r = TMCJPEGDEC_load_buff(work), r < 0) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -156,7 +161,7 @@ static s32 TMCJPEGDEC_vl_decode_rc(u32* huff_tbl, u8* huff_sym, TMCCJPEGDecWork*
|
||||
}
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
entry = (u16*)((u8*)huff_tbl + 0x24);
|
||||
entry = (u16*)(huff_tbl + 9);
|
||||
bit_data = work->bitBuf;
|
||||
i = 9;
|
||||
bit_pos -= 9;
|
||||
@@ -186,11 +191,10 @@ static s32 TMCJPEGDEC_vl_decode_rc(u32* huff_tbl, u8* huff_sym, TMCCJPEGDecWork*
|
||||
} HuffEnt;
|
||||
HuffEnt local = *(HuffEnt*)entry;
|
||||
u32 combined = *(u32*)&local;
|
||||
u32 combined2 = combined;
|
||||
u16 th = *(u16*)&combined2;
|
||||
u16 th = *(u16*)&combined;
|
||||
s32 tmp;
|
||||
|
||||
if (code > (u32)th) {
|
||||
if (code > th) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
209
tools/decomp-assist/rx38.cleanup.md
Normal file
209
tools/decomp-assist/rx38.cleanup.md
Normal file
@@ -0,0 +1,209 @@
|
||||
# rx38 expression cleanup
|
||||
|
||||
Base: `5a2113c1b1d1eee25bfd77f07c1ab43e2ae9efc9`, branch `agent/w1005/rx38`.
|
||||
Scope: TMC_JPEG except texturecvtr and buffer/idct_block_var.c.
|
||||
|
||||
Acceptance: preserve complete object bytes for every accepted edit, all objdiff measurements, identical string pools, and the full 43U DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`. The cleanup assignment supersedes the generic request to increase exact function counts. Existing mismatches must stay unchanged.
|
||||
|
||||
Fresh baseline: full build passes, 1027 source object hashes saved, all 11 owned unit pools identical. EXIF has two existing mismatches: TMCJPEGDEC_IFD0_tag_parse 99.49065%, TMCJPEGDEC_IFD1_tag_parse 96.14876%. All other owned functions are exact. Baseline objects, report, trial details, and build logs are in `/tmp/rx38-cleanup`.
|
||||
|
||||
Preserve `TMCCJPEGDecInitParam.unk_0x24` and `.unk_0x2C`: `src/utility/iplJpegDecoder.cpp` uses them outside the assigned scope. Their observed roles are thumbnail decoding and output converter selection. Leave unknown storage without proven roles unchanged. Excluded sources use none of the candidate placeholder identifiers.
|
||||
|
||||
## Trials
|
||||
|
||||
- KEEP protocol names: JPEG marker values, EXIF tags/byte order/types, converter choices, and Exif signature characters. All 15 JPEG library objects byte-identical. Anonymous public enum changed unrelated C++ generated symbols; replaced with named internal enums.
|
||||
- KEEP type name: TMCUnknownInfo -> TMCJpegTableInfo, based on Huffman/quantization table use.
|
||||
- REVERT public state.unk_0x21 -> thumbnailMode. Original-header rebuild reproduced baseline exactly; rename changed debug records and ELF section ordering in iplNandSDWorker and iplNandSDCardManager. Preserve the entire public header to keep those out-of-scope objects identical. Public EXIF field renames have the same constraint.
|
||||
- EXIF tag names checked against [libexif tag declarations](https://libexif.sourceforge.net/internals/exif-tag_8h.html).
|
||||
- REVERT `decapi`: TMCCJPEGDecInit header result ternary to if/else. TMCCJPEGDecInit.
|
||||
- REVERT `decapi`: TMCCJPEGDecInit scan result ternary to condition. TMCCJPEGDecInit.
|
||||
- KEEP `jdec`: TMCJPEGDEC_Decompscan nested ternary to early returns. whole object byte-identical.
|
||||
- REVERT `jdec`: TMCJPEGDEC_Setsize redundant s32 promotion cast. TMCJPEGDEC_Setsize.
|
||||
- REVERT `exif_parse`: readExifU16 remove same-type return cast. TMCJPEGDEC_IFD0_tag_parse, TMCJPEGDEC_exif_parse.
|
||||
- KEEP `exif_parse`: EXIF memset sizes from existing types. whole object byte-identical.
|
||||
- KEEP `exif_parse`: EXIF thumbnail input address from pBuf2 member. whole object byte-identical.
|
||||
- KEEP `getcode`: TMCJPEGDEC_rewind_ptr split comma-expression callback. whole object byte-identical.
|
||||
- KEEP `buffer_system`: TMCJPEGDEC_init_ptr_buff use TMCCJPEGDecInitParam members. whole object byte-identical.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_decompmcu replace three work byte offsets with members. whole object byte-identical.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_decompmcu increment typed DC predictor pointer. whole object byte-identical.
|
||||
- REVERT `jdec_main`: TMCJPEGDEC_decompmcu use dcPredict array member. TMCJPEGDEC_decompmcu.
|
||||
- REVERT `jdec_main`: TMCJPEGDEC_decompmcu use component quantization table member. TMCJPEGDEC_decompmcu.
|
||||
- REVERT `jdec_main`: TMCJPEGDEC_decompmcu use DC and AC table selector members. TMCJPEGDEC_decompmcu.
|
||||
- KEEP `idct_resolution_change_var`: TMCJPEGDEC_IdctBlock2x2 remove same-type u8 casts. whole object byte-identical.
|
||||
- REVERT `idct_resolution_change_var`: clampU8 nested ternary to early returns. TMCJPEGDEC_IdctBlock1x1, TMCJPEGDEC_IdctBlock2x2, TMCJPEGDEC_IdctBlock4x4.
|
||||
- REVERT `idct_resolution_change_var`: clampS8 nested ternary to early returns. TMCJPEGDEC_IdctBlock1x1_Col, TMCJPEGDEC_IdctBlock2x2_Col, TMCJPEGDEC_IdctBlock4x4_Col.
|
||||
- KEEP `iqdec_b65_frv32`: TMCJPEGDEC_decode_iquant split comma-expression refill. whole object byte-identical.
|
||||
- KEEP `iqdec_b65_frv32`: Huffman helpers remove redundant comparison promotion casts. whole object byte-identical.
|
||||
- KEEP `iqdec_resolution_change_a3`: TMCJPEGDEC_decode_iquant_rc split refill and decode comma expressions. whole object byte-identical.
|
||||
- KEEP `iqdec_resolution_change_a3`: TMCJPEGDEC_decode_iquant_rc use AC entry indexing. whole object byte-identical.
|
||||
- KEEP `iqdec_resolution_change_a3`: TMCJPEGDEC_vl_decode_rc use typed Huffman table offset. whole object byte-identical.
|
||||
- REVERT `iqdec_resolution_change_a3`: TMCJPEGDEC_vl_decode_rc use existing HuffEnt member instead of type punning. TMCJPEGDEC_vl_decode_rc.
|
||||
- KEEP `iqdec_resolution_change_a3`: TMCJPEGDEC_vl_decode_rc remove redundant comparison promotion. whole object byte-identical.
|
||||
- KEEP `idct_resolution_change_var`: TMCJPEGDEC_IdctBlock4x4 simplify pitch multiplication. whole object byte-identical.
|
||||
- REVERT `idct_resolution_change_var`: TMCJPEGDEC_IdctBlock2x2 use direct buffer indexing. TMCJPEGDEC_IdctBlock2x2.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_parse_para remove redundant switch promotion. whole object byte-identical.
|
||||
- REVERT `jdec_main`: TMCJPEGDEC_parse_sos remove redundant byte comparison promotions. TMCJPEGDEC_parse_sos.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_parse_sos remove redundant component count promotions. whole object byte-identical.
|
||||
- REVERT `jdec_main`: TMCJPEGDEC_decompmcu use typed frame fields and block counts. TMCJPEGDEC_decompmcu.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_decompmcu use typed conversion row pointers. whole object byte-identical.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_scan_varinit remove promoted scan count cast. whole object byte-identical.
|
||||
- REVERT `jdec_main`: TMCJPEGDEC_set_entropytbl remove redundant signed casts. TMCJPEGDEC_set_entropytbl.
|
||||
- REVERT `decapi`: TMCCJPEGDecInit replace header ternary with existing helper. TMCCJPEGDecInit.
|
||||
- REVERT `decapi`: TMCCJPEGDecInit split only inner header ternary. TMCCJPEGDecInit.
|
||||
- REVERT `buffer_system`: TMCJPEGDEC_get_wbyte remove first empty else. TMCJPEGDEC_get_wbyte.
|
||||
- REVERT `buffer_system`: TMCJPEGDEC_get_wbyte remove remaining empty else branches. TMCJPEGDEC_get_wbyte.
|
||||
- REVERT `buffer_system`: TMCJPEGDEC_get_sbyte remove empty else. TMCJPEGDEC_get_sbyte.
|
||||
- Tooling retry: multi-file helper passed absolute object paths to Ninja, which rejected them. Source restored; retried with build-relative paths.
|
||||
- REVERT TMCJPEGDEC_init_buff_thumbnail use actual parameter types and remove four casts. getcode: TMCJPEGDEC_init_buff_thumbnail.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_parse_dht use count buffer size. whole object byte-identical.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_decompmcu use existing frame scan field. whole object byte-identical.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_decompmcu use existing restart interval field. whole object byte-identical.
|
||||
- KEEP `exif_parse`: readU16 remove implicit return conversions. whole object byte-identical.
|
||||
- KEEP `exif_parse`: readExifU16 remove redundant narrowed return expression. whole object byte-identical.
|
||||
- REVERT `jdec_main`: TMCJPEGDEC_decompmcu keep a typed frame pointer. TMCJPEGDEC_decompmcu.
|
||||
- A dependent cast trial was skipped after the typed-frame trial reverted; retried against the retained source below. Quick gate passed with zero regressions, forbidden patterns, or readability warnings.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_decompmcu remove redundant scan count promotion. whole object byte-identical.
|
||||
- REVERT `jdec_main`: TMCJPEGDEC_decompmcu read blockCount member using original frame base. TMCJPEGDEC_decompmcu.
|
||||
|
||||
## Scope audit
|
||||
|
||||
Reviewed all 11 owned units in baseline object order. jpformat contains fixed sampling/zigzag tables with no requested expression cleanup. No SDK GX/NAND/ES/CARD/button/scene constants or BOOL-returning call comparisons occur in the owned code. Public placeholder fields remain for the scope and object-byte reasons above; unreferenced opaque storage has no proven field role. Excluded sources and their identifiers are unchanged. Existing assembly is unchanged.
|
||||
|
||||
IFD0 and IFD1 remain open for matching, as required by this cleanup task. Both received distinct compiled cleanup passes for tag names, reader return conversions, and rational-field bounds. IFD0 also received field-type names. Transfer/date literal sizes remain unchanged; the optional grouped edit was skipped before writing source because its replacement spans overlapped. Every retained pass preserves the complete EXIF object. IFD0 still lacks one dispatch instruction and differs in registers; IFD1 retains dispatch and register differences. No attempt claims a new exact match.
|
||||
- First full clean gate passes for all 11 owned units; DOL hash and all baseline metrics unchanged. Final source-review trials follow.
|
||||
- KEEP `jdec_main`: TMCJPEGDEC_parse_sof portable fallback remove intermediate byte-pointer cast. whole object byte-identical.
|
||||
- REVERT `jdec`: TMCJPEGDEC_Setsize keep arithmetic grouping without redundant s32 cast. TMCJPEGDEC_Setsize.
|
||||
- KEEP `iqdec_resolution_change_a3`: TMCJPEGDEC_vl_decode_rc collapse same-type temporary copy. whole object byte-identical.
|
||||
- KEEP `exif_parse`: IFD0 and IFD1 rational bounds use scalar size. whole object byte-identical.
|
||||
- Source review: the portable SOF fallback address cleanup is equivalent by member offset, but this branch is excluded by __MWERKS__; it is not claimed as a new measured function improvement. Public-header rename was reverted rather than adding private layout/name macros.
|
||||
- After the first clean gate and final trials, all 1027 complete source objects still equal their saved baseline bytes, including all 15 JPEG objects and every excluded unit.
|
||||
|
||||
## Accepted cleanup counts
|
||||
|
||||
Counts describe changed expression sites, not functions. Constant substitutions total 119: 103 uses of 45 named constants, four signature characters, and 12 sizeof expressions. Casts: 16, including one portable fallback cast. Control flow: 8. Member/pointer expressions: 23, including the portable fallback address. Type names: 1, TMCJpegTableInfo. Other expressions: one pitch multiplication and one redundant temporary copy. The trial log records 28 retained groups and 23 reverted groups; the initial protocol/type-name group and public-header rollback were measured separately.
|
||||
|
||||
## Final verification
|
||||
|
||||
Full clean, non-quick gate for all 11 owned units: PASS. Scope totals are unchanged: instruction-exact functions 47/49 -> 47/49, matched code 17724/20616 -> 17724/20616 bytes, matched data 632/632 -> 632/632 bytes. The data total includes untouched jpformat. All per-function fuzzy scores and link metrics are unchanged.
|
||||
|
||||
```text
|
||||
Whole-object SHA256: 1027/1027 unchanged
|
||||
Objdiff measures/sections/functions: 1027 units unchanged
|
||||
Pools: 11/11 identical; ctxdiff: 47 exact functions with zero differences; 2 existing mismatches
|
||||
main.dol SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
BYTE PRESERVATION PASS
|
||||
```
|
||||
|
||||
Final gate command, run from this worktree:
|
||||
|
||||
```sh
|
||||
python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/buffer/mkhdec3 \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/buffer/buffer_system \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/buffer/getcode \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/api/decapi \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jpformat \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/reschange/iqdec_resolution_change_a3 \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/reschange/idct_resolution_change_var \
|
||||
libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32 \
|
||||
--base 5a2113c1b1d1eee25bfd77f07c1ab43e2ae9efc9
|
||||
```
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/mkhdec3] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/mkhdec3] objdiff: code 1228/1228 data None/None functions 2/2 fuzzy 100.0000 linked code 1228
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/mkhdec3] instruction-exact functions: 2/2
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/mkhdec3] section .text size 1228 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/mkhdec3] baseline: code 1228/1228 data None functions 2 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/buffer_system] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/buffer_system] objdiff: code 2444/2444 data None/None functions 10/10 fuzzy 100.0000 linked code 2444
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/buffer_system] instruction-exact functions: 10/10
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/buffer_system] section .text size 2444 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/buffer_system] baseline: code 2444/2444 data None functions 10 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/getcode] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/getcode] objdiff: code 316/316 data None/None functions 3/3 fuzzy 100.0000 linked code 316
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/getcode] instruction-exact functions: 3/3
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/getcode] section .text size 316 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/buffer/getcode] baseline: code 316/316 data None functions 3 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/api/decapi] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/api/decapi] objdiff: code 1100/1100 data None/None functions 3/3 fuzzy 100.0000 linked code 1100
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/api/decapi] instruction-exact functions: 3/3
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/api/decapi] section .text size 1100 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/api/decapi] baseline: code 1100/1100 data None functions 3 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec] objdiff: code 1020/1020 data None/None functions 3/3 fuzzy 100.0000 linked code 1020
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec] instruction-exact functions: 3/3
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec] section .text size 1020 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec] baseline: code 1020/1020 data None functions 3 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] objdiff: code 5604/5604 data 256/256 functions 13/13 fuzzy 100.0000 linked code 5604
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] instruction-exact functions: 13/13
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] section .rodata size 256 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] section .text size 5604 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] baseline: code 5604/5604 data 256 functions 13 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jpformat] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jpformat] objdiff: code None/None data 376/376 functions 0/None fuzzy 100.0000 linked code 0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jpformat] instruction-exact functions: 0/0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jpformat] section .rodata size 368 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jpformat] section .sdata2 size 8 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jpformat] baseline: code None/None data 376 functions 0 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] objdiff: code 2196/5088 data None/None functions 4/6 fuzzy 99.0747 linked code 0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] instruction-exact functions: 4/6
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] section .text size 5088 match 99.074684
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] below 100: TMCJPEGDEC_IFD0_tag_parse 99.49065
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] below 100: TMCJPEGDEC_IFD1_tag_parse 96.14876
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] baseline: code 2196/5088 data None functions 4 fuzzy 99.0747
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/iqdec_resolution_change_a3] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/iqdec_resolution_change_a3] objdiff: code 908/908 data None/None functions 2/2 fuzzy 100.0000 linked code 908
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/iqdec_resolution_change_a3] instruction-exact functions: 2/2
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/iqdec_resolution_change_a3] section .text size 908 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/iqdec_resolution_change_a3] baseline: code 908/908 data None functions 2 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/idct_resolution_change_var] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/idct_resolution_change_var] objdiff: code 1804/1804 data None/None functions 6/6 fuzzy 100.0000 linked code 1804
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/idct_resolution_change_var] instruction-exact functions: 6/6
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/idct_resolution_change_var] section .text size 1804 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/reschange/idct_resolution_change_var] baseline: code 1804/1804 data None functions 6 fuzzy 100.0000
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32] objdiff: code 1104/1104 data None/None functions 1/1 fuzzy 100.0000 linked code 1104
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32] instruction-exact functions: 1/1
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32] section .text size 1104 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32] baseline: code 1104/1104 data None functions 1 fuzzy 100.0000
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 93.96723 -> 93.96723
|
||||
global fuzzy_match_percent: 99.81488 -> 99.81488
|
||||
global complete_code_percent: 80.08451 -> 80.08451
|
||||
global matched_data_percent: 99.99410 -> 99.99410
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## Files and commits
|
||||
|
||||
```text
|
||||
libs/RVLMiddleware/TMC_JPEG/include/tmc_jpeg_internal.h
|
||||
libs/RVLMiddleware/TMC_JPEG/src/api/decapi.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/buffer/buffer_system.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/buffer/getcode.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/buffer/mkhdec3.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/reschange/idct_resolution_change_var.c
|
||||
libs/RVLMiddleware/TMC_JPEG/src/reschange/iqdec_resolution_change_a3.c
|
||||
```
|
||||
|
||||
```text
|
||||
77bd7716 refactor: simplify jpeg coefficient and idct expressions
|
||||
ca241ddd refactor: simplify jpeg buffer expressions
|
||||
1ce715e1 refactor: name jpeg markers and clean parser expressions
|
||||
```
|
||||
|
||||
Remaining constraints: public field names used by the external JPEG wrapper remain unchanged. Renaming the state thumbnail field changed unrelated debug objects and was reverted. Opaque storage with no proven role remains unnamed. No excluded source, existing assembly block, configuration, or link status changed. No remote writes were performed.
|
||||
Reference in New Issue
Block a user