Compare commits

...

1 Commits

2 changed files with 571 additions and 641 deletions

View File

@@ -106,192 +106,43 @@ s32 TMCJPEGDEC_decompmcu(u32 maxMCU, u32 mcuCount, TMCCJPEGDecWork* work, void*
return 0;
}
#ifdef __MWERKS__
asm s32 TMCJPEGDEC_imagestart(register TMCCJPEGDecWork* work) {
nofralloc
static inline void initZigzag(TMCCJPEGDecWork* work) {
const u8* zigzag = TMCJPEGDEC_Zigzag_data;
s32 i;
work->restartInterval = 0;
work->scanCount = 0;
for (i = 0; i < 64; i++) {
work->zigzagData[i] = *zigzag++ << 2;
}
stwu r1, -0x20(r1)
mflr r0
lis r8, TMCJPEGDEC_Zigzag_data@ha
li r4, 0
stw r0, 0x24(r1)
li r0, 4
addi r8, r8, TMCJPEGDEC_Zigzag_data@l
li r7, 0
stw r31, 0x1c(r1)
mr r31, r3
sth r4, 0x181a(r3)
stb r4, 0x181c(r3)
mtctr r0
_imagestart_loop:
lbz r6, 0(r8)
add r9, r3, r7
lbz r5, 1(r8)
addi r7, r7, 8
rlwinm r6, r6, 2, 0x18, 0x1d
lbz r4, 2(r8)
stb r6, 0x458(r9)
rlwinm r5, r5, 2, 0x18, 0x1d
rlwinm r6, r4, 2, 0x18, 0x1d
lbz r0, 3(r8)
stb r5, 0x459(r9)
rlwinm r5, r0, 2, 0x18, 0x1d
lbz r4, 4(r8)
stb r6, 0x45a(r9)
rlwinm r6, r4, 2, 0x18, 0x1d
lbz r4, 6(r8)
stb r5, 0x45b(r9)
lbz r0, 5(r8)
rlwinm r4, r4, 2, 0x18, 0x1d
stb r6, 0x45c(r9)
rlwinm r5, r0, 2, 0x18, 0x1d
lbz r0, 7(r8)
stb r5, 0x45d(r9)
lbz r6, 8(r8)
rlwinm r0, r0, 2, 0x18, 0x1d
stb r4, 0x45e(r9)
lbz r5, 9(r8)
rlwinm r6, r6, 2, 0x18, 0x1d
stb r0, 0x45f(r9)
add r9, r3, r7
lbz r4, 0xa(r8)
rlwinm r5, r5, 2, 0x18, 0x1d
stb r6, 0x458(r9)
addi r7, r7, 8
rlwinm r6, r4, 2, 0x18, 0x1d
lbz r0, 0xb(r8)
stb r5, 0x459(r9)
rlwinm r5, r0, 2, 0x18, 0x1d
lbz r4, 0xc(r8)
stb r6, 0x45a(r9)
rlwinm r6, r4, 2, 0x18, 0x1d
lbz r4, 0xe(r8)
stb r5, 0x45b(r9)
lbz r0, 0xd(r8)
rlwinm r4, r4, 2, 0x18, 0x1d
stb r6, 0x45c(r9)
rlwinm r5, r0, 2, 0x18, 0x1d
lbz r0, 0xf(r8)
stb r5, 0x45d(r9)
addi r8, r8, 0x10
rlwinm r0, r0, 2, 0x18, 0x1d
stb r4, 0x45e(r9)
stb r0, 0x45f(r9)
bdnz _imagestart_loop
mr r4, r31
addi r3, r1, 8
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _imagestart_have_marker
b _imagestart_return
_imagestart_have_marker:
lhz r0, 8(r1)
cmplwi r0, 0xffd8
beq _imagestart_parse
li r3, -0x20
b _imagestart_return
_imagestart_parse:
li r0, 0
mr r4, r31
sth r0, 8(r1)
addi r3, r1, 8
bl TMCJPEGDEC_parse_para
cmpwi r3, 0
bge _imagestart_check_sof
b _imagestart_return
_imagestart_check_sof:
lhz r0, 8(r1)
cmplwi r0, 0xffc0
beq _imagestart_parse_sof
li r3, -0x10
b _imagestart_return
_imagestart_parse_sof:
mr r3, r31
bl TMCJPEGDEC_parse_sof
srawi r0, r3, 0x1f
and r3, r3, r0
_imagestart_return:
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
mtlr r0
addi r1, r1, 0x20
blr
}
#else
s32 TMCJPEGDEC_imagestart(TMCCJPEGDecWork* work) {
u16 marker;
s32 r;
u32 off;
u8* p;
int i;
const u8* zigzag;
zigzag = TMCJPEGDEC_Zigzag_data;
work->restartInterval = 0;
work->scanCount = 0;
off = 0;
i = 4;
do {
p = (u8*)work + off;
off += 8;
p[0x458] = (zigzag[0] & 0x3F) << 2;
p[0x459] = (zigzag[1] & 0x3F) << 2;
p[0x45a] = (zigzag[2] & 0x3F) << 2;
p[0x45b] = (zigzag[3] & 0x3F) << 2;
p[0x45c] = (zigzag[4] & 0x3F) << 2;
p[0x45e] = (zigzag[6] & 0x3F) << 2;
p[0x45d] = (zigzag[5] & 0x3F) << 2;
p[0x45f] = (zigzag[7] & 0x3F) << 2;
p = (u8*)work + off;
off += 8;
p[0x458] = (zigzag[8] & 0x3F) << 2;
p[0x459] = (zigzag[9] & 0x3F) << 2;
p[0x45a] = (zigzag[10] & 0x3F) << 2;
p[0x45b] = (zigzag[11] & 0x3F) << 2;
p[0x45c] = (zigzag[12] & 0x3F) << 2;
p[0x45d] = (zigzag[13] & 0x3F) << 2;
p[0x45e] = (zigzag[14] & 0x3F) << 2;
p[0x45f] = (zigzag[15] & 0x3F) << 2;
zigzag += 16;
} while (--i != 0);
initZigzag(work);
r = TMCJPEGDEC_get_wbyte(&marker, work);
if (r < 0) {
return r;
}
if (marker != 0xFFD8) {
return -0x20;
}
marker = 0;
r = TMCJPEGDEC_parse_para(&marker, work);
if (r < 0) {
return r;
}
if (marker != 0xFFC0) {
return -0x10;
}
r = TMCJPEGDEC_parse_sof(work);
if (r < 0) {
return r;
}
return 0;
}
#endif
s32 TMCJPEGDEC_imageend(TMCCJPEGDecWork* work) {
if (work->pState->unk_0x21 == 1)
@@ -783,266 +634,85 @@ s32 TMCJPEGDEC_restart_interval(TMCCJPEGDecWork* work, u32 maxMCU, u32 mcuCount)
}
#endif
#ifdef __MWERKS__
static asm s32 TMCJPEGDEC_parse_para(register u16* marker, register TMCCJPEGDecWork* work) {
nofralloc
stwu r1, -0x30(r1)
mflr r0
stw r0, 0x34(r1)
stmw r26, 0x18(r1)
mr r28, r3
mr r29, r4
li r31, 0
lis r26, 1
li r27, 1
lhz r30, 0(r3)
_parse_para_loop:
mr r4, r29
addi r3, r1, 0x12
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_para_marker_loaded
cmpwi r3, -0x90
bne _parse_para_return
lhz r0, 0x12(r1)
cmplwi r0, 0xffd9
bne _parse_para_return
li r3, 0
b _parse_para_marker_loaded
b _parse_para_return
_parse_para_marker_loaded:
lhz r0, 0x12(r1)
b _parse_para_marker_condition
_parse_para_marker_byte:
mr r4, r29
addi r3, r1, 8
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_para_marker_byte_loaded
b _parse_para_return
_parse_para_marker_byte_loaded:
lbz r0, 8(r1)
ori r0, r0, 0xff00
sth r0, 0x12(r1)
_parse_para_marker_condition:
clrlwi r4, r0, 0x10
cmplwi r4, 0xffff
beq _parse_para_marker_byte
cmplwi r4, 0xffe0
blt _parse_para_switch
cmplwi r4, 0xffef
bgt _parse_para_switch
mr r4, r29
addi r3, r1, 0x10
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_para_app_length
b _parse_para_check_result
_parse_para_app_length:
lhz r3, 0x10(r1)
cmplwi r3, 2
bge _parse_para_app_move
li r3, -0x45
b _parse_para_check_result
_parse_para_app_move:
addi r0, r3, -2
mr r4, r29
sth r0, 0x10(r1)
clrlwi r3, r0, 0x10
bl TMCJPEGDEC_move_ptr
srawi r0, r3, 0x1f
and r3, r3, r0
srawi r0, r3, 0x1f
and r3, r3, r0
b _parse_para_check_result
_parse_para_switch:
addi r0, r26, -0x27
cmpw r4, r0
beq _parse_para_eoi
bge _parse_para_switch_ge_ffc2
addi r0, r26, -0x3e
cmpw r4, r0
beq _parse_para_sos
bge _parse_para_switch_ge_ffc4
addi r0, r26, -0x40
cmpw r4, r0
beq _parse_para_sof
b _parse_para_unknown
_parse_para_switch_ge_ffc4:
addi r0, r26, -0x3c
cmpw r4, r0
beq _parse_para_dht
b _parse_para_unknown
_parse_para_switch_ge_ffc2:
addi r0, r26, -0x23
cmpw r4, r0
beq _parse_para_dri
bge _parse_para_switch_ge_ffdc
addi r0, r26, -0x25
cmpw r4, r0
beq _parse_para_dqt
bge _parse_para_dnl
b _parse_para_com_marker
_parse_para_switch_ge_ffdc:
addi r0, r26, -2
cmpw r4, r0
beq _parse_para_com
b _parse_para_unknown
_parse_para_dht:
mr r3, r30
mr r4, r29
bl TMCJPEGDEC_parse_dht
b _parse_para_check_result
_parse_para_dqt:
mr r3, r29
bl TMCJPEGDEC_parse_dqt
b _parse_para_check_result
_parse_para_dri:
mr r4, r29
addi r3, r1, 0xe
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_para_dri_length
b _parse_para_check_result
_parse_para_dri_length:
lhz r0, 0xe(r1)
cmplwi r0, 4
beq _parse_para_dri_value
li r3, -0x42
b _parse_para_check_result
_parse_para_dri_value:
mr r4, r29
addi r3, r1, 0xe
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_para_dri_store
b _parse_para_check_result
_parse_para_dri_store:
lhz r0, 0xe(r1)
li r3, 0
sth r0, 0x181a(r29)
b _parse_para_check_result
_parse_para_dnl:
mr r4, r29
addi r3, r1, 0xc
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_para_dnl_length
b _parse_para_check_result
_parse_para_dnl_length:
lhz r0, 0xc(r1)
cmplwi r0, 4
beq _parse_para_dnl_value
li r3, -0x43
b _parse_para_check_result
_parse_para_dnl_value:
mr r4, r29
addi r3, r1, 0xc
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_para_dnl_store
b _parse_para_check_result
_parse_para_dnl_store:
lhz r0, 0xc(r1)
li r3, 0
sth r0, 0x17f2(r29)
b _parse_para_check_result
_parse_para_com:
mr r4, r29
addi r3, r1, 0xa
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_para_com_length
b _parse_para_check_result
_parse_para_com_length:
lhz r3, 0xa(r1)
cmplwi r3, 2
bge _parse_para_com_move
li r3, -0x44
b _parse_para_check_result
_parse_para_com_move:
addi r0, r3, -2
mr r4, r29
sth r0, 0xa(r1)
clrlwi r3, r0, 0x10
bl TMCJPEGDEC_move_ptr
srawi r0, r3, 0x1f
and r3, r3, r0
srawi r0, r3, 0x1f
and r3, r3, r0
b _parse_para_check_result
_parse_para_sof:
li r31, 1
b _parse_para_check_result
_parse_para_sos:
li r31, 1
b _parse_para_check_result
_parse_para_com_marker:
li r31, 1
b _parse_para_check_result
_parse_para_eoi:
stb r27, 0x181c(r29)
li r31, 1
b _parse_para_check_result
_parse_para_unknown:
li r3, -0x2f
_parse_para_check_result:
cmpwi r3, 0
bge _parse_para_keep_going
li r31, 1
_parse_para_keep_going:
cmpwi r31, 0
beq _parse_para_loop
lhz r0, 0x12(r1)
sth r0, 0(r28)
_parse_para_return:
lmw r26, 0x18(r1)
lwz r0, 0x34(r1)
mtlr r0
addi r1, r1, 0x30
blr
static inline s32 skipSegmentData(u16 length, TMCCJPEGDecWork* work) {
s32 result = TMCJPEGDEC_move_ptr(length, work);
if (result < 0) {
return result;
}
return 0;
}
#else
static inline s32 parseApplication(TMCCJPEGDecWork* work) {
u16 length;
s32 result = TMCJPEGDEC_get_wbyte(&length, work);
if (result < 0) {
return result;
}
if (length < 2) {
return -0x45;
}
length -= 2;
result = skipSegmentData(length, work);
if (result < 0) {
return result;
}
return 0;
}
static inline s32 parseRestartInterval(TMCCJPEGDecWork* work) {
u16 length;
s32 result = TMCJPEGDEC_get_wbyte(&length, work);
if (result < 0) {
return result;
}
if (length != 4) {
return -0x42;
}
result = TMCJPEGDEC_get_wbyte(&length, work);
if (result < 0) {
return result;
}
work->restartInterval = length;
return 0;
}
static inline s32 parseNumberOfLines(TMCCJPEGDecWork* work) {
u16 length;
s32 result = TMCJPEGDEC_get_wbyte(&length, work);
if (result < 0) {
return result;
}
if (length != 4) {
return -0x43;
}
result = TMCJPEGDEC_get_wbyte(&length, work);
if (result < 0) {
return result;
}
work->frameHeight = length;
return 0;
}
static inline s32 parseComment(TMCCJPEGDecWork* work) {
u16 length;
s32 result = TMCJPEGDEC_get_wbyte(&length, work);
if (result < 0) {
return result;
}
if (length < 2) {
return -0x44;
}
length -= 2;
result = skipSegmentData(length, work);
if (result < 0) {
return result;
}
return 0;
}
static s32 TMCJPEGDEC_parse_para(u16* marker, TMCCJPEGDecWork* work) {
u8 byte;
u16 local;
u16 appSize;
u16 driSize;
u16 dnlSize;
u16 comSize;
s32 result;
u32 keepGoing = 0;
@@ -1067,18 +737,7 @@ static s32 TMCJPEGDEC_parse_para(u16* marker, TMCCJPEGDecWork* work) {
}
if (local >= 0xFFE0 && local <= 0xFFEF) {
result = TMCJPEGDEC_get_wbyte(&appSize, work);
if (result < 0) {
goto _check;
}
if (appSize < 2) {
result = -0x45;
goto _check;
}
appSize -= 2;
result = TMCJPEGDEC_move_ptr(appSize, work);
result = result & (result >> 31);
result = result & (result >> 31);
result = parseApplication(work);
} else {
switch ((s32)local) {
case 0xFFC4: {
@@ -1090,48 +749,15 @@ static s32 TMCJPEGDEC_parse_para(u16* marker, TMCCJPEGDecWork* work) {
break;
}
case 0xFFDD: {
result = TMCJPEGDEC_get_wbyte(&driSize, work);
if (result >= 0) {
if (driSize != 4) {
result = -0x42;
} else {
result = TMCJPEGDEC_get_wbyte(&driSize, work);
if (result < 0) {
goto _check;
}
work->restartInterval = driSize;
result = 0;
}
}
result = parseRestartInterval(work);
break;
}
case 0xFFDC: {
result = TMCJPEGDEC_get_wbyte(&dnlSize, work);
if (result >= 0) {
if (dnlSize != 4) {
result = -0x43;
} else {
result = TMCJPEGDEC_get_wbyte(&dnlSize, work);
if (result >= 0) {
work->frameHeight = dnlSize;
result = 0;
}
}
}
result = parseNumberOfLines(work);
break;
}
case 0xFFFE: {
result = TMCJPEGDEC_get_wbyte(&comSize, work);
if (result >= 0) {
if (comSize < 2) {
result = -0x44;
} else {
comSize -= 2;
result = TMCJPEGDEC_move_ptr(comSize, work);
result = result & result >> 31;
result = result & result >> 31;
}
}
result = parseComment(work);
break;
}
case 0xFFC0: {
@@ -1158,7 +784,6 @@ static s32 TMCJPEGDEC_parse_para(u16* marker, TMCCJPEGDecWork* work) {
}
}
_check:
if (result < 0) {
keepGoing = 1;
}
@@ -1167,7 +792,6 @@ static s32 TMCJPEGDEC_parse_para(u16* marker, TMCCJPEGDecWork* work) {
*marker = local;
return result;
}
#endif
#ifdef __MWERKS__
static asm s32 TMCJPEGDEC_parse_dht(register s32 first, register TMCCJPEGDecWork* work) {
@@ -1959,167 +1583,19 @@ static s32 TMCJPEGDEC_parse_sof(TMCCJPEGDecWork* work) {
}
#endif
#ifdef __MWERKS__
static asm s32 TMCJPEGDEC_parse_sos(register TMCCJPEGDecWork* work) {
nofralloc
stwu r1, -0x30(r1)
mflr r0
stw r0, 0x34(r1)
stmw r27, 0x1c(r1)
mr r28, r3
addi r30, r3, 0x2c
addi r29, r3, 0x58
addi r3, r1, 0xa
mr r4, r28
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_sos_have_length
b _parse_sos_return
_parse_sos_have_length:
lhz r0, 0xa(r1)
cmplwi r0, 2
bge _parse_sos_have_count
li r3, -0x51
b _parse_sos_return
_parse_sos_have_count:
mr r4, r28
addi r3, r1, 8
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_sos_store_count
b _parse_sos_return
_parse_sos_store_count:
lbz r3, 8(r1)
cmplwi r3, 4
stb r3, 0x180b(r28)
bgt _parse_sos_bad_count
lbz r0, 0x180a(r28)
cmplw r3, r0
beq _parse_sos_count_valid
_parse_sos_bad_count:
li r3, -0x51
b _parse_sos_return
_parse_sos_count_valid:
li r31, 0
b _parse_sos_loop_condition
_parse_sos_loop:
mr r4, r28
addi r3, r1, 8
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_sos_have_component
b _parse_sos_return
_parse_sos_have_component:
lbz r0, 0x180a(r28)
li r5, 0
lbz r4, 8(r1)
mtctr r0
cmpwi r0, 0
ble _parse_sos_bad_component
_parse_sos_find_component:
add r3, r30, r5
lbz r0, 0x14(r3)
cmpw r4, r0
bne _parse_sos_next_component
stbx r5, r30, r31
add r27, r30, r31
b _parse_sos_found_component
_parse_sos_next_component:
addi r5, r5, 1
bdnz _parse_sos_find_component
_parse_sos_bad_component:
li r3, -0x51
b _parse_sos_return
_parse_sos_found_component:
mr r4, r28
addi r3, r1, 8
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_sos_have_tables
b _parse_sos_return
_parse_sos_have_tables:
lbz r0, 8(r1)
srawi r5, r0, 4
clrlwi r6, r0, 0x1c
cmpwi r5, 1
bgt _parse_sos_bad_tables
cmpwi r6, 1
ble _parse_sos_tables_valid
_parse_sos_bad_tables:
li r3, -0x51
b _parse_sos_return
_parse_sos_tables_valid:
lbz r0, 0(r27)
add r3, r29, r5
add r4, r30, r0
stb r5, 0x1c(r4)
lbz r0, 0(r27)
add r4, r30, r0
stb r6, 0x20(r4)
lbz r0, 0x1794(r3)
cmplwi r0, 1
beq _parse_sos_ac_valid
li r3, -0x40
b _parse_sos_return
_parse_sos_ac_valid:
add r3, r29, r6
lbz r0, 0x1796(r3)
cmplwi r0, 1
beq _parse_sos_quant_valid
li r3, -0x40
b _parse_sos_return
_parse_sos_quant_valid:
lbz r0, 0x18(r27)
add r3, r29, r0
lbz r0, 0x1790(r3)
cmplwi r0, 1
beq _parse_sos_next
li r3, -0x41
b _parse_sos_return
_parse_sos_next:
addi r31, r31, 1
_parse_sos_loop_condition:
lbz r0, 0x180b(r28)
cmpw r31, r0
blt _parse_sos_loop
mr r4, r28
li r3, 3
bl TMCJPEGDEC_move_ptr
srawi r0, r3, 0x1f
and r3, r3, r0
_parse_sos_return:
lmw r27, 0x1c(r1)
lwz r0, 0x34(r1)
mtlr r0
addi r1, r1, 0x30
blr
}
#else
static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
typedef struct {
u8 map[4];
u32 dcPredict[4];
u8 id[4];
u8 quantTable[4];
u8 dcTable[4];
u8 acTable[4];
} TMCComponentInfo;
s32 idx;
u8* compPtr;
TMCComponentInfo* components;
TMCUnknownInfo* scalePtr;
u8* mapPtr;
TMCComponentInfo* mapPtr;
s32 dcTbl;
s32 acTbl;
@@ -2130,7 +1606,7 @@ static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
s32 ci;
u8 scanByte;
compPtr = (u8*)work->compMap;
components = (TMCComponentInfo*)work->compMap;
scalePtr = (TMCUnknownInfo*)&work->scaleFlag;
r = TMCJPEGDEC_get_wbyte(&len, work);
@@ -2146,12 +1622,12 @@ static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
return r;
}
if (scanByte > 4 || scanByte != work->compCount) {
work->scanCompCount = scanByte;
if (work->scanCompCount > 4 || work->scanCompCount != work->compCount) {
return -0x51;
}
work->scanCompCount = scanByte;
for (idx = 0; idx < (s32)work->scanCompCount; idx++) {
r = TMCJPEGDEC_get_byte(&scanByte, work);
if (r < 0) {
@@ -2159,18 +1635,15 @@ static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
}
for (ci = 0; ci < (s32)work->compCount; ci++) {
if ((s32)compPtr[ci + 0x14] == (s32)scanByte) {
compPtr[idx] = ci;
mapPtr = compPtr + idx;
break;
if ((s32)scanByte == (s32)components->id[ci]) {
components->map[idx] = ci;
mapPtr = (TMCComponentInfo*)&components->map[idx];
goto componentFound;
}
}
return -0x51;
// TODO: This isn't right...
if (ci >= (s32)work->compCount) {
return -0x51;
}
componentFound:
r = TMCJPEGDEC_get_byte(&scanByte, work);
if (r < 0) {
return r;
@@ -2183,8 +1656,8 @@ static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
return -0x51;
}
compPtr[*mapPtr + 0x1c] = dcTbl;
compPtr[*mapPtr + 0x20] = acTbl;
components->dcTable[mapPtr->map[0]] = dcTbl;
components->acTable[mapPtr->map[0]] = acTbl;
if (scalePtr->dcTblFlag[dcTbl] != 1) {
return -0x40;
@@ -2194,15 +1667,17 @@ static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
return -0x40;
}
if (scalePtr->quantTblFlag[mapPtr[0x18]] != 1) {
if (scalePtr->quantTblFlag[mapPtr->quantTable[0]] != 1) {
return -0x41;
}
}
moveResult = TMCJPEGDEC_move_ptr(3, work);
return moveResult & (moveResult >> 31);
if (moveResult < 0) {
return moveResult;
}
return 0;
}
#endif
#ifdef __MWERKS__
asm s32 TMCJPEGDEC_err_restart(register TMCCJPEGDecWork* work) {

View File

@@ -0,0 +1,455 @@
# da4 de-asm attempts
Scope: jdec_main, getcode, mkhdec3, iqdec_resolution_change_a3 in this worktree only.
Baseline: 7aa71d2930ed6d903fa00eff756f97f75a11a82d; origin/main 7aa71d2930ed6d903fa00eff756f97f75a11a82d.
Acceptance: readable C, exact-name objdiff 100%, ctxdiff zero differences, identical pool, full gate and retail DOL SHA1. Each converted function gets a separate commit.
Prior trials: tools/decomp-assist/asm-conversions.attempts.md, lines 450-538.
TMCJPEGDEC_init_buff_thumbnail / getcode1: Existing array C baseline, compare to Ghidra before rewriting typed input.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x88 base 0x88 insns 34/34; diffs 3: [24, 25, 26]; objdiff 99.55882. Evidence: /tmp/da4/getcode1.
TMCJPEGDEC_init_buff_thumbnail / getcode2: Typed input buffer, destination work and EXIF fields. Ghidra stores remaining before end and mark.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x88 base 0x88 insns 34/34; diffs 4: [24, 25, 26, 28]; objdiff 99.26471. Evidence: /tmp/da4/getcode2.
TMCJPEGDEC_init_buff_thumbnail / getcode3: Separate current pointer, preserving buffer assignment and subsequent pointer lifetime.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x88 base 0x88 insns 34/34; diffs 4: [24, 25, 26, 28]; objdiff 99.26471. Evidence: /tmp/da4/getcode3.
TMCJPEGDEC_imagestart / imagestart1: Natural 64-element zigzag loop with shared result exit matching Ghidra branches.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x18c base 0x190 insns 99/100; --- replace mine 2:3 base 2:3; objdiff 93.3. Evidence: /tmp/da4/imagestart1.
TMCJPEGDEC_imagestart / imagestart2: Named zigzag walker and explicit else branches as in matched buffer_system.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x188 base 0x190 insns 98/100; --- replace mine 2:3 base 2:3; objdiff 95.5. Evidence: /tmp/da4/imagestart2.
TMCJPEGDEC_init_buff_thumbnail / getcode4: Reuse pointer for thumbnail start and end, allocator lever 18b.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x88 base 0x88 insns 34/34; diffs 6: [24, 25, 26, 28, 30, 31]; objdiff 98.82353. Evidence: /tmp/da4/getcode4.
TMCJPEGDEC_imagestart / imagestart3: Ghidra nested successful parse paths; named walker before index declaration.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x18c base 0x190 insns 99/100; --- replace mine 7:8 base 7:8; objdiff 94.35. Evidence: /tmp/da4/imagestart3.
TMCJPEGDEC_init_buff_thumbnail / getcode5: Commuted thumbnail offset/length addition.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x88 base 0x88 insns 34/34; diffs 4: [24, 25, 26, 28]; objdiff 99.26471. Evidence: /tmp/da4/getcode5.
TMCJPEGDEC_imagestart / image-l0-f0: Named/indexed zigzag loop; error exit form 0; instructions 100/100, aligned differences 40.
TMCJPEGDEC_init_buff_thumbnail / get-False-0-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_imagestart / image-l0-f1: Named/indexed zigzag loop; error exit form 1; instructions 98/100, aligned differences 67.
TMCJPEGDEC_imagestart / image-l0-f2: Named/indexed zigzag loop; error exit form 2; instructions 98/100, aligned differences 67.
TMCJPEGDEC_init_buff_thumbnail / get-False-0-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_imagestart / image-l0-f3: Named/indexed zigzag loop; error exit form 3; instructions 100/100, aligned differences 40.
TMCJPEGDEC_init_buff_thumbnail / get-False-1-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 6.
TMCJPEGDEC_imagestart / image-l1-f0: Named/indexed zigzag loop; error exit form 0; instructions 100/100, aligned differences 40.
TMCJPEGDEC_init_buff_thumbnail / get-False-1-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 6.
TMCJPEGDEC_imagestart / image-l1-f1: Named/indexed zigzag loop; error exit form 1; instructions 98/100, aligned differences 67.
TMCJPEGDEC_init_buff_thumbnail / get-False-2-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_imagestart / image-l1-f2: Named/indexed zigzag loop; error exit form 2; instructions 98/100, aligned differences 67.
TMCJPEGDEC_init_buff_thumbnail / get-False-2-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-False-3-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 3.
TMCJPEGDEC_imagestart / image-l1-f3: Named/indexed zigzag loop; error exit form 3; instructions 100/100, aligned differences 40.
TMCJPEGDEC_imagestart / image-l2-f0: Named/indexed zigzag loop; error exit form 0; instructions 100/100, aligned differences 21.
TMCJPEGDEC_imagestart / image-l2-f1: Named/indexed zigzag loop; error exit form 1; instructions 98/100, aligned differences 48.
TMCJPEGDEC_init_buff_thumbnail / get-False-3-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 3.
TMCJPEGDEC_imagestart / image-l2-f2: Named/indexed zigzag loop; error exit form 2; instructions 98/100, aligned differences 48.
TMCJPEGDEC_init_buff_thumbnail / get-False-4-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_imagestart / image-l2-f3: Named/indexed zigzag loop; error exit form 3; instructions 100/100, aligned differences 21.
TMCJPEGDEC_init_buff_thumbnail / get-False-4-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-True-0-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_imagestart / image-l3-f0: Named/indexed zigzag loop; error exit form 0; instructions 100/100, aligned differences 40.
TMCJPEGDEC_init_buff_thumbnail / get-True-0-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-True-1-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 6.
TMCJPEGDEC_imagestart / image-l3-f1: Named/indexed zigzag loop; error exit form 1; instructions 98/100, aligned differences 67.
TMCJPEGDEC_init_buff_thumbnail / get-True-1-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 6.
TMCJPEGDEC_imagestart / image-l3-f2: Named/indexed zigzag loop; error exit form 2; instructions 98/100, aligned differences 67.
TMCJPEGDEC_imagestart / image-l3-f3: Named/indexed zigzag loop; error exit form 3; instructions 100/100, aligned differences 40.
TMCJPEGDEC_init_buff_thumbnail / get-True-2-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-True-2-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-True-3-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 3.
TMCJPEGDEC_init_buff_thumbnail / get-True-3-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 3.
TMCJPEGDEC_init_buff_thumbnail / get-True-4-False: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-True-4-True: Typed pointer/integer source arithmetic and named length; instructions 34/34, aligned differences 4.
TMCJPEGDEC_scan_varinit / scan1: Frame member view and direct sampling array access, lever 16.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x204 base 0x204 insns 129/129; diffs 9: [8, 9, 10, 11, 12, 13, 15, 20, 21]; objdiff 99.496124. Evidence: /tmp/da4/scan1.
TMCJPEGDEC_scan_varinit / scan-decls-0: Sample/scale/table/index role declaration order; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-decls-1: Sample/scale/table/index role declaration order; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-decls-2: Sample/scale/table/index role declaration order; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-decls-3: Sample/scale/table/index role declaration order; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-decls-4: Sample/scale/table/index role declaration order; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-decls-5: Sample/scale/table/index role declaration order; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-decls-6: Sample/scale/table/index role declaration order; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-decls-7: Sample/scale/table/index role declaration order; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-inline: Inline boundary for single-component geometry; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-direct-0: Remove sample temporaries and test arithmetic width; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-direct-1: Remove sample temporaries and test arithmetic width; instructions 129/129, aligned differences 9.
TMCJPEGDEC_imagestart / imagestart4: Minimal named walker loop with direct error returns.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x190 base 0x190 insns 100/100; diffs 21: [7, 14, 16, 19, 23, 26, 29, 32, 35, 38, 41, 42, 45, 46, 49, 52, 55, 58, 61, 64]; objdiff 98.75. Evidence: /tmp/da4/imagestart4.
TMCJPEGDEC_scan_varinit / scan-direct-2: Remove sample temporaries and test arithmetic width; instructions 129/129, aligned differences 9.
TMCJPEGDEC_init_buff_thumbnail / get-offset-0: Named offset reused as thumbnail address; instructions 34/34, aligned differences 6.
TMCJPEGDEC_init_buff_thumbnail / get-offset-1: Named offset reused as thumbnail address; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-offset-2: Named offset reused as thumbnail address; instructions 34/34, aligned differences 6.
TMCJPEGDEC_init_buff_thumbnail / get-offset-3: Named offset reused as thumbnail address; instructions 34/34, aligned differences 8.
TMCJPEGDEC_init_buff_thumbnail / get-offset-4: Named offset reused as thumbnail address; instructions 34/34, aligned differences 6.
TMCJPEGDEC_init_buff_thumbnail / get-offset-5: Named offset reused as thumbnail address; instructions 34/34, aligned differences 8.
TMCJPEGDEC_init_buff_thumbnail / get-inline: Inline EXIF start calculation; instructions 34/34, aligned differences 4.
TMCJPEGDEC_imagestart / image-inline-0: Inline zigzag initialization; instructions 100/100, aligned differences 0.
TMCJPEGDEC_restart_interval / restart-0: Direct error returns, Ghidra integer-width truncation and coordinate order; instructions 93/93, aligned differences 26.
TMCJPEGDEC_restart_interval / restart-1: Direct error returns, Ghidra integer-width truncation and coordinate order; instructions 93/93, aligned differences 26.
TMCJPEGDEC_restart_interval / restart-2: Direct error returns, Ghidra integer-width truncation and coordinate order; instructions 94/93, aligned differences 44.
TMCJPEGDEC_restart_interval / restart-3: Direct error returns, Ghidra integer-width truncation and coordinate order; instructions 94/93, aligned differences 45.
Accepted TMCJPEGDEC_imagestart: inline initialization of zigzag bytes removes the iterator/base register swap; plain C loop, no forced instructions. ctxdiff 100/100 instructions, diffs 0; exact-name objdiff 100.0; .text 5604/5604, .rodata 256/256, functions 13/13. Full clean gate passed, 0 regressions, 0 forbidden patterns, 0 readability warnings. DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Gate evidence /tmp/da4/imagestart-gate.log.
TMCJPEGDEC_parse_para / para-nested: Nested underflow/EOI error paths as target; instructions 178/183, aligned differences 116.
TMCJPEGDEC_parse_para / para-helpers-0: Inline segment parsers, nested successful byte-reader returns; instructions 184/183, aligned differences 165.
TMCJPEGDEC_parse_para / para-helpers-1: Inline segment parsers, nested successful byte-reader returns; instructions 184/183, aligned differences 165.
TMCJPEGDEC_parse_para / para-helpers-2: Inline segment parsers, nested successful byte-reader returns; instructions 184/183, aligned differences 165.
TMCJPEGDEC_parse_para / para-helpers-3: Inline segment parsers, nested successful byte-reader returns; instructions 184/183, aligned differences 165.
TMCJPEGDEC_parse_dht / dht-0: Count loop, typed header fields, or inline symbol-count helper; instructions 120/120, aligned differences 16.
TMCJPEGDEC_parse_dht / dht-1: Count loop, typed header fields, or inline symbol-count helper; instructions 120/120, aligned differences 16.
TMCJPEGDEC_parse_dht / dht-2: Count loop, typed header fields, or inline symbol-count helper; instructions 120/120, aligned differences 16.
TMCJPEGDEC_parse_dht / dht-3: Count loop, typed header fields, or inline symbol-count helper; instructions 120/120, aligned differences 16.
TMCJPEGDEC_parse_dht / dht-4: Count loop, typed header fields, or inline symbol-count helper; instructions 120/120, aligned differences 16.
TMCJPEGDEC_parse_dht / dht-5: Count loop, typed header fields, or inline symbol-count helper; instructions 120/120, aligned differences 34.
TMCJPEGDEC_parse_para / para-current: Inline segment-parser candidate after nested error checks.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x2e0 base 0x2dc insns 184/183; --- replace mine 14:15 base 14:15; objdiff 99.45355. Evidence: /tmp/da4/para-current.
TMCJPEGDEC_decode_iquant_rc / iquant1: Typed coefficient/Huffman indexing follows target Ghidra data flow.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x29c base 0x29c insns 167/167; diffs 15: [51, 52, 53, 54, 55, 56, 76, 78, 79, 132, 134, 136, 139, 142, 147]; objdiff 99.461075. Evidence: /tmp/da4/iquant1.
TMCJPEGDEC_parse_para / para2: Inline segment parsers with combined underflow and EOI exception.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x2dc base 0x2dc insns 183/183; diffs 0: []; objdiff 100.0. Evidence: /tmp/da4/para2.
TMCJPEGDEC_decode_iquant_rc / iquant-0: Direct zigzag access, pointer declaration lifetime, bit-position width or shift type; instructions 167/167, aligned differences 73.
TMCJPEGDEC_decode_iquant_rc / iquant-1: Direct zigzag access, pointer declaration lifetime, bit-position width or shift type; instructions 167/167, aligned differences 36.
TMCJPEGDEC_decode_iquant_rc / iquant-2: Direct zigzag access, pointer declaration lifetime, bit-position width or shift type; instructions 167/167, aligned differences 15.
TMCJPEGDEC_decode_iquant_rc / iquant-3: Direct zigzag access, pointer declaration lifetime, bit-position width or shift type; instructions 167/167, aligned differences 15.
TMCJPEGDEC_decode_iquant_rc / iquant-inline-0: Inline coefficient sign-extension helper; instructions 167/167, aligned differences 77.
TMCJPEGDEC_decode_iquant_rc / iquant-inline-1: Inline coefficient sign-extension helper; instructions 167/167, aligned differences 7.
TMCJPEGDEC_parse_sos / sos-0: Typed component view, mapping stored after successful search and early scan count store; instructions 114/112, aligned differences 90.
TMCJPEGDEC_parse_sos / sos-1: Typed component view, mapping stored after successful search and early scan count store; instructions 114/112, aligned differences 90.
TMCJPEGDEC_parse_sos / sos-2: Typed component view, mapping stored after successful search and early scan count store; instructions 114/112, aligned differences 90.
TMCJPEGDEC_parse_sos / sos-3: Typed component view, mapping stored after successful search and early scan count store; instructions 112/112, aligned differences 56.
TMCJPEGDEC_scan_varinit / scan-more-0: Sampling pair aggregate, arithmetic inline boundary, or coefficient row view; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-more-1: Sampling pair aggregate, arithmetic inline boundary, or coefficient row view; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-more-2: Sampling pair aggregate, arithmetic inline boundary, or coefficient row view; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-more-3: Sampling pair aggregate, arithmetic inline boundary, or coefficient row view; instructions 129/129, aligned differences 9.
TMCJPEGDEC_scan_varinit / scan-more-4: Sampling pair aggregate, arithmetic inline boundary, or coefficient row view; instructions 129/129, aligned differences 9.
TMCJPEGDEC_err_restart / err-0: Unsigned next-position division and target final posX subtraction; coordinate arithmetic forms; instructions 113/115, aligned differences 71.
TMCJPEGDEC_make_huffdec / mkhdec-0: Ghidra canonical Huffman sizes/codes, typed halfword entries, signed counter loop forms; instructions 193/200, aligned differences 177.
TMCJPEGDEC_err_restart / err-1: Unsigned next-position division and target final posX subtraction; coordinate arithmetic forms; instructions 113/115, aligned differences 71.
TMCJPEGDEC_make_huffdec / mkhdec-1: Ghidra canonical Huffman sizes/codes, typed halfword entries, signed counter loop forms; instructions 195/200, aligned differences 174.
TMCJPEGDEC_make_huffdec / mkhdec-2: Ghidra canonical Huffman sizes/codes, typed halfword entries, signed counter loop forms; instructions 193/200, aligned differences 177.
TMCJPEGDEC_err_restart / err-2: Unsigned next-position division and target final posX subtraction; coordinate arithmetic forms; instructions 113/115, aligned differences 71.
TMCJPEGDEC_err_restart / err-3: Unsigned next-position division and target final posX subtraction; coordinate arithmetic forms; instructions 113/115, aligned differences 71.
TMCJPEGDEC_make_huffdec / mkhdec-3: Ghidra canonical Huffman sizes/codes, typed halfword entries, signed counter loop forms; instructions 193/200, aligned differences 177.
TMCJPEGDEC_err_restart / err-4: Unsigned next-position division and target final posX subtraction; coordinate arithmetic forms; instructions 113/115, aligned differences 71.
TMCJPEGDEC_make_huffdec / mkhdec-4: Ghidra canonical Huffman sizes/codes, typed halfword entries, signed counter loop forms; instructions 193/200, aligned differences 177.
TMCJPEGDEC_parse_sos / sos-corrected-0: Correct target component-found branch and re-read stored scan count; instructions 112/112, aligned differences 0.
Accepted TMCJPEGDEC_parse_para: inline helpers for APP, DRI, DNL and COM parsing recreate separate stack locals and error-return paths. Segment-skip helper provides the two nested success clamps without bitwise result tricks. Combined underflow/EOI exception matches the final branch. Exact-name objdiff 100.0; ctxdiff 183/183, diffs 0. Full clean GATE PASS, 0 regressions/patterns/readability warnings, DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Evidence /tmp/da4/para-gate.log.
TMCJPEGDEC_parse_sos / sos-exact: Matched typed component table and component-found control flow.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x1c0 base 0x1c0 insns 112/112; diffs 0: []; objdiff 100.0. Evidence: /tmp/da4/sos-exact.
TMCJPEGDEC_decode_iquant_rc / iquant-more-0: Independent AC value lifetime, signedness, inline parameter const or indexed product form; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-more-1: Independent AC value lifetime, signedness, inline parameter const or indexed product form; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-more-2: Independent AC value lifetime, signedness, inline parameter const or indexed product form; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-more-3: Independent AC value lifetime, signedness, inline parameter const or indexed product form; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-more-4: Independent AC value lifetime, signedness, inline parameter const or indexed product form; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-more-5: Independent AC value lifetime, signedness, inline parameter const or indexed product form; instructions 167/167, aligned differences 7.
TMCJPEGDEC_err_restart / err-corrected-0: Marker loop exits before recovery; 16-bit position locals and target grouped sum; instructions 114/115, aligned differences 72.
TMCJPEGDEC_decode_iquant_rc / iquant-more-6: Independent AC value lifetime, signedness, inline parameter const or indexed product form; instructions 167/167, aligned differences 7.
TMCJPEGDEC_err_restart / err-corrected-1: Marker loop exits before recovery; 16-bit position locals and target grouped sum; instructions 114/115, aligned differences 72.
TMCJPEGDEC_err_restart / err-corrected-2: Marker loop exits before recovery; 16-bit position locals and target grouped sum; instructions 113/115, aligned differences 71.
TMCJPEGDEC_err_restart / err-corrected-3: Marker loop exits before recovery; 16-bit position locals and target grouped sum; instructions 114/115, aligned differences 72.
TMCJPEGDEC_parse_sof / sof-0: Ghidra reused byte/word inputs, full sampling search, and inferred coordinate widths; instructions 219/223, aligned differences 203.
TMCJPEGDEC_parse_sof / sof-1: Ghidra reused byte/word inputs, full sampling search, and inferred coordinate widths; instructions 219/223, aligned differences 203.
TMCJPEGDEC_parse_sof / sof-2: Ghidra reused byte/word inputs, full sampling search, and inferred coordinate widths; instructions 221/223, aligned differences 205.
TMCJPEGDEC_parse_sof / sof-3: Ghidra reused byte/word inputs, full sampling search, and inferred coordinate widths; instructions 219/223, aligned differences 203.
TMCJPEGDEC_decode_iquant_rc / iquant-final-0: AC store inline, output-reference value, reused coefficient, mask width or explicit AC block; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-final-1: AC store inline, output-reference value, reused coefficient, mask width or explicit AC block; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-final-2: AC store inline, output-reference value, reused coefficient, mask width or explicit AC block; instructions 167/167, aligned differences 8.
TMCJPEGDEC_decode_iquant_rc / iquant-final-3: AC store inline, output-reference value, reused coefficient, mask width or explicit AC block; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-final-4: AC store inline, output-reference value, reused coefficient, mask width or explicit AC block; instructions 167/167, aligned differences 7.
TMCJPEGDEC_decode_iquant_rc / iquant-final-5: AC store inline, output-reference value, reused coefficient, mask width or explicit AC block; instructions 167/167, aligned differences 71.
TMCJPEGDEC_parse_dht / dht-more-0: Header-local lifetime, narrowed table ID or inline nibble extraction; instructions 120/120, aligned differences 27.
TMCJPEGDEC_parse_dht / dht-more-1: Header-local lifetime, narrowed table ID or inline nibble extraction; instructions 120/120, aligned differences 16.
TMCJPEGDEC_parse_dht / dht-more-2: Header-local lifetime, narrowed table ID or inline nibble extraction; instructions 120/120, aligned differences 16.
TMCJPEGDEC_parse_dht / dht-more-3: Header-local lifetime, narrowed table ID or inline nibble extraction; instructions 120/120, aligned differences 9.
TMCJPEGDEC_parse_dht / dht-more-4: Header-local lifetime, narrowed table ID or inline nibble extraction; instructions 120/120, aligned differences 9.
TMCJPEGDEC_parse_dht / dht-more-5: Header-local lifetime, narrowed table ID or inline nibble extraction; instructions 120/120, aligned differences 9.
TMCJPEGDEC_restart_interval / restart-more-0: Natural marker local and inline position update; instructions 93/93, aligned differences 23.
TMCJPEGDEC_restart_interval / restart-more-1: Natural marker local and inline position update; instructions 93/93, aligned differences 26.
TMCJPEGDEC_restart_interval / restart-more-2: Natural marker local and inline position update; instructions 93/93, aligned differences 26.
TMCJPEGDEC_restart_interval / restart-more-3: Natural marker local and inline position update; instructions 93/93, aligned differences 20.
TMCJPEGDEC_restart_interval / restart-more-4: Natural marker local and inline position update; instructions 93/93, aligned differences 17.
TMCJPEGDEC_restart_interval / restart-more-5: Natural marker local and inline position update; instructions 93/93, aligned differences 20.
Accepted TMCJPEGDEC_parse_sos: reused stored scan count, typed component-table view, and explicit component-found error path. Ghidra mapping loop checks were verified against original instructions. Exact-name objdiff 100.0, ctxdiff 112/112 diffs 0. Full clean GATE PASS; 0 regressions/patterns/readability warnings; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Evidence /tmp/da4/sos-gate.log.
TMCJPEGDEC_parse_dht / dht-final-0: Header scalar versus walker lifetime and grouped decoded table fields; instructions 120/120, aligned differences 30.
TMCJPEGDEC_parse_dht / dht-final-1: Header scalar versus walker lifetime and grouped decoded table fields; instructions 120/120, aligned differences 9.
TMCJPEGDEC_parse_dht / dht-final-2: Header scalar versus walker lifetime and grouped decoded table fields; instructions 120/120, aligned differences 9.
TMCJPEGDEC_parse_dht / dht-final-3: Header scalar versus walker lifetime and grouped decoded table fields; instructions 120/120, aligned differences 9.
TMCJPEGDEC_make_huffdec / mkhdec-scopes-0: Independent locals per Huffman sizes, codes, valptr and lookup phases; instructions 195/200, aligned differences 174.
TMCJPEGDEC_make_huffdec / mkhdec-scopes-1: Independent locals per Huffman sizes, codes, valptr and lookup phases; instructions 198/200, aligned differences 136.
TMCJPEGDEC_parse_dht / dht-final-4: Header scalar versus walker lifetime and grouped decoded table fields; instructions 120/120, aligned differences 9.
TMCJPEGDEC_make_huffdec / mkhdec-scopes-2: Independent locals per Huffman sizes, codes, valptr and lookup phases; instructions 195/200, aligned differences 171.
TMCJPEGDEC_parse_dht / dht-final-5: Header scalar versus walker lifetime and grouped decoded table fields; instructions 120/120, aligned differences 9.
TMCJPEGDEC_make_huffdec / mkhdec-scopes-3: Independent locals per Huffman sizes, codes, valptr and lookup phases; instructions 195/200, aligned differences 174.
TMCJPEGDEC_parse_dht / dht-final-6: Header scalar versus walker lifetime and grouped decoded table fields; instructions 121/120, aligned differences 107.
TMCJPEGDEC_parse_dht / dht-final-7: Header scalar versus walker lifetime and grouped decoded table fields; instructions 120/120, aligned differences 9.
TMCJPEGDEC_parse_sof / sof-current: Shared byte/word temporaries and 16-bit MCU counts, full sampling search.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x374 base 0x37c insns 221/223; --- replace mine 3:6 base 3:7; objdiff 82.28251. Evidence: /tmp/da4/sof-current.
TMCJPEGDEC_init_buff_thumbnail / get-final-0: Reuse source/start pointer parameter or group thumbnail pointers; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-final-1: Reuse source/start pointer parameter or group thumbnail pointers; instructions 34/34, aligned differences 6.
TMCJPEGDEC_init_buff_thumbnail / get-final-2: Reuse source/start pointer parameter or group thumbnail pointers; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-final-3: Reuse source/start pointer parameter or group thumbnail pointers; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-final-4: Reuse source/start pointer parameter or group thumbnail pointers; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-final-5: Reuse source/start pointer parameter or group thumbnail pointers; instructions 34/34, aligned differences 4.
TMCJPEGDEC_parse_sof / sof-corrected-0: Typed component base, 16-bit maximum sampling, shared scalar input, inline validation; instructions 220/223, aligned differences 140.
TMCJPEGDEC_parse_sof / sof-corrected-1: Typed component base, 16-bit maximum sampling, shared scalar input, inline validation; instructions 222/223, aligned differences 142.
TMCJPEGDEC_parse_sof / sof-corrected-2: Typed component base, 16-bit maximum sampling, shared scalar input, inline validation; instructions 222/223, aligned differences 142.
TMCJPEGDEC_parse_sof / sof-corrected-3: Typed component base, 16-bit maximum sampling, shared scalar input, inline validation; instructions 222/223, aligned differences 142.
TMCJPEGDEC_make_huffdec / mkhdec-final-0: Huffman phase declaration order and indexed versus walking table entries; instructions 198/200, aligned differences 133.
TMCJPEGDEC_make_huffdec / mkhdec-final-1: Huffman phase declaration order and indexed versus walking table entries; instructions 198/200, aligned differences 136.
TMCJPEGDEC_make_huffdec / mkhdec-final-2: Huffman phase declaration order and indexed versus walking table entries; instructions 175/200, aligned differences 115.
TMCJPEGDEC_make_huffdec / mkhdec-final-3: Huffman phase declaration order and indexed versus walking table entries; instructions 196/200, aligned differences 134.
TMCJPEGDEC_make_huffdec / mkhdec-final-4: Huffman phase declaration order and indexed versus walking table entries; instructions 196/200, aligned differences 134.
TMCJPEGDEC_init_buff_thumbnail / get-helper-0: Inline input copy/validation or thumbnail-buffer initialization; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-helper-1: Inline input copy/validation or thumbnail-buffer initialization; instructions 39/34, aligned differences 25.
TMCJPEGDEC_init_buff_thumbnail / get-helper-2: Inline input copy/validation or thumbnail-buffer initialization; instructions 34/34, aligned differences 4.
TMCJPEGDEC_parse_sof / sof-last-0: Explicit quotient arithmetic or inline sampling-layout search; instructions 222/223, aligned differences 142.
TMCJPEGDEC_parse_sof / sof-last-1: Explicit quotient arithmetic or inline sampling-layout search; instructions 222/223, aligned differences 143.
TMCJPEGDEC_parse_sof / sof-last-2: Explicit quotient arithmetic or inline sampling-layout search; instructions 222/223, aligned differences 143.
TMCJPEGDEC_parse_sof / sof-last-3: Explicit quotient arithmetic or inline sampling-layout search; instructions 222/223, aligned differences 143.
TMCJPEGDEC_scan_varinit / scan-pair-0: Named promoted horizontal/vertical scales, direct coefficient access; instructions 129/129, aligned differences 11.
TMCJPEGDEC_scan_varinit / scan-pair-1: Named promoted horizontal/vertical scales, direct coefficient access; instructions 129/129, aligned differences 14.
TMCJPEGDEC_scan_varinit / scan-width-0: Sampling scale width or direct component index; instructions 129/129, aligned differences 14.
TMCJPEGDEC_scan_varinit / scan-width-1: Sampling scale width or direct component index; instructions 131/129, aligned differences 122.
TMCJPEGDEC_parse_sof / sof2-current: Typed component base, constrained sampling maxima, and inline validation.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x378 base 0x37c insns 222/223; --- replace mine 5:7 base 5:7; objdiff 93.34529. Evidence: /tmp/da4/sof2-current.
TMCJPEGDEC_scan_varinit / scan-width-2: Sampling scale width or direct component index; instructions 129/129, aligned differences 11.
TMCJPEGDEC_make_huffdec / mkhdec-helper-0: Halfword arrays, countdown condition, or size-table inline helper; instructions 198/200, aligned differences 136.
TMCJPEGDEC_make_huffdec / mkhdec-helper-1: Halfword arrays, countdown condition, or size-table inline helper; instructions 196/200, aligned differences 134.
TMCJPEGDEC_make_huffdec / mkhdec-helper-2: Halfword arrays, countdown condition, or size-table inline helper; instructions 158/200, aligned differences 98.
TMCJPEGDEC_make_huffdec / mkhdec-helper-3: Halfword arrays, countdown condition, or size-table inline helper; instructions 204/200, aligned differences 177.
TMCJPEGDEC_init_buff_thumbnail / get-typed-0: Typed EXIF/input buffer helper behind existing public ABI; instructions 35/34, aligned differences 25.
TMCJPEGDEC_init_buff_thumbnail / get-typed-1: Typed EXIF/input buffer helper behind existing public ABI; instructions 35/34, aligned differences 25.
TMCJPEGDEC_init_buff_thumbnail / get-typed-2: Typed EXIF/input buffer helper behind existing public ABI; instructions 35/34, aligned differences 25.
TMCJPEGDEC_init_buff_thumbnail / get-typed-3: Typed EXIF/input buffer helper behind existing public ABI; instructions 35/34, aligned differences 25.
TMCJPEGDEC_init_buff_thumbnail / get-typed-4: Typed EXIF/input buffer helper behind existing public ABI; instructions 35/34, aligned differences 25.
TMCJPEGDEC_parse_dht / dht-boundary-0: Count-read inline boundary, decoded header outputs or typed internal table parser; instructions 124/120, aligned differences 79.
TMCJPEGDEC_parse_dht / dht-boundary-1: Count-read inline boundary, decoded header outputs or typed internal table parser; instructions 120/120, aligned differences 16.
TMCJPEGDEC_err_restart / err-final-0: Independent full-width division/remainder and narrowed restart-step/position lifetimes; instructions 114/115, aligned differences 72.
TMCJPEGDEC_err_restart / err-final-1: Independent full-width division/remainder and narrowed restart-step/position lifetimes; instructions 114/115, aligned differences 72.
TMCJPEGDEC_err_restart / err-final-2: Independent full-width division/remainder and narrowed restart-step/position lifetimes; instructions 115/115, aligned differences 39.
TMCJPEGDEC_err_restart / err-final-3: Independent full-width division/remainder and narrowed restart-step/position lifetimes; instructions 114/115, aligned differences 72.
TMCJPEGDEC_init_buff_thumbnail / get-arith-0: Address assignment expression or independent length/current/end values; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-arith-1: Address assignment expression or independent length/current/end values; instructions 34/34, aligned differences 8.
TMCJPEGDEC_init_buff_thumbnail / get-arith-2: Address assignment expression or independent length/current/end values; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-arith-3: Address assignment expression or independent length/current/end values; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-arith-4: Address assignment expression or independent length/current/end values; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-arith-5: Address assignment expression or independent length/current/end values; instructions 34/34, aligned differences 4.
TMCJPEGDEC_parse_dht / dht-walker-0: Narrowed inline return, count-array start inline or direct indexing; instructions 120/120, aligned differences 13.
TMCJPEGDEC_parse_dht / dht-walker-1: Narrowed inline return, count-array start inline or direct indexing; instructions 120/120, aligned differences 9.
TMCJPEGDEC_parse_dht / dht-walker-2: Narrowed inline return, count-array start inline or direct indexing; instructions 120/120, aligned differences 9.
TMCJPEGDEC_parse_dht / dht-walker-3: Narrowed inline return, count-array start inline or direct indexing; instructions 120/120, aligned differences 6.
TMCJPEGDEC_parse_dht / dht-walker-4: Narrowed inline return, count-array start inline or direct indexing; instructions 120/120, aligned differences 9.
TMCJPEGDEC_init_buff_thumbnail / get-view-0: EXIF triple array view or explicit current address with existing word-buffer representation; instructions 34/34, aligned differences 3.
TMCJPEGDEC_init_buff_thumbnail / get-view-1: EXIF triple array view or explicit current address with existing word-buffer representation; instructions 34/34, aligned differences 3.
TMCJPEGDEC_init_buff_thumbnail / get-view-2: EXIF triple array view or explicit current address with existing word-buffer representation; instructions 34/34, aligned differences 3.
TMCJPEGDEC_init_buff_thumbnail / get-view-3: EXIF triple array view or explicit current address with existing word-buffer representation; instructions 34/34, aligned differences 3.
TMCJPEGDEC_restart_interval / restart-final-0: Original block-scoped marker reset and field loads with corrected truncation points; instructions 94/93, aligned differences 42.
TMCJPEGDEC_restart_interval / restart-final-1: Original block-scoped marker reset and field loads with corrected truncation points; instructions 93/93, aligned differences 23.
Search tooling: copied srcsearch.py to /tmp/da4/srcsearch.py with definition-only function discovery. Stock finder could select a forward declaration or call before the definition. Shared source-search concurrency limit retained. Initial thumbnail search completed 154 trials with no gain; scan_varinit search completed 239 trials with no gain. Later searches queued behind all 24 shared slots, rather than increasing the limiter.
TMCJPEGDEC_restart_interval / restart-final-2: Original block-scoped marker reset and field loads with corrected truncation points; instructions 93/93, aligned differences 23.
TMCJPEGDEC_restart_interval / restart-final-3: Original block-scoped marker reset and field loads with corrected truncation points; instructions 94/93, aligned differences 53.
TMCJPEGDEC_parse_sof / sof-types-0: Sampling maxima declared before persistent pointers; zero checks narrow as target proves; instructions 222/223, aligned differences 129.
TMCJPEGDEC_parse_sof / sof-types-1: Sampling maxima declared before persistent pointers; zero checks narrow as target proves; instructions 222/223, aligned differences 135.
TMCJPEGDEC_parse_sof / sof-types-2: Sampling maxima declared before persistent pointers; zero checks narrow as target proves; instructions 222/223, aligned differences 143.
TMCJPEGDEC_parse_dht / dht-types-0: Decoded class/ID order and walker lifetime around count summation; instructions 120/120, aligned differences 6.
TMCJPEGDEC_parse_sof / sof-types-3: Sampling maxima declared before persistent pointers; zero checks narrow as target proves; instructions 222/223, aligned differences 129.
TMCJPEGDEC_parse_dht / dht-types-1: Decoded class/ID order and walker lifetime around count summation; instructions 120/120, aligned differences 13.
TMCJPEGDEC_parse_dht / dht-types-2: Decoded class/ID order and walker lifetime around count summation; instructions 120/120, aligned differences 27.
TMCJPEGDEC_parse_dht / dht-types-3: Decoded class/ID order and walker lifetime around count summation; instructions 120/120, aligned differences 6.
TMCJPEGDEC_parse_dht / dht-types-4: Decoded class/ID order and walker lifetime around count summation; instructions 120/120, aligned differences 6.
TMCJPEGDEC_parse_sof / sof-unsized: Unsized local extern declaration, target materializes sample-count table with lis/addi.
POOL IDENTICAL up to 0 (mine=0 base=0); src 0x378 base 0x37c insns 222/223; --- replace mine 12:13 base 12:13; objdiff 94.37668. Evidence: /tmp/da4/sof-unsized.
TMCJPEGDEC_init_buff_thumbnail / get-fields-0: Explicit current/end pointer fields or indexed thumbnail offset; instructions 35/34, aligned differences 11.
TMCJPEGDEC_init_buff_thumbnail / get-fields-1: Explicit current/end pointer fields or indexed thumbnail offset; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-fields-2: Explicit current/end pointer fields or indexed thumbnail offset; instructions 34/34, aligned differences 4.
TMCJPEGDEC_init_buff_thumbnail / get-fields-3: Explicit current/end pointer fields or indexed thumbnail offset; instructions 35/34, aligned differences 12.
Restored all unaccepted worktree C candidates to the last validated commits while searches continue from isolated snapshots. No source change is being kept at a fuzzy-only score. The failed whole-parser inline trial removed the static parse_dht symbol and was rejected immediately.
TMCJPEGDEC_parse_sof / sof-incomplete-array: Diagnostic: incomplete SampleComps extern declaration matches target lis/addi instead of SDA reference; isolated temporary header; instructions 223/223, aligned differences 84.
TMCJPEGDEC_init_buff_thumbnail / handoff-evidence: Representative rejected C candidate for persistent-worker handoff; instructions 34/34, aligned differences 3.
TMCJPEGDEC_scan_varinit / handoff-evidence: Representative rejected C candidate for persistent-worker handoff; instructions 129/129, aligned differences 9.
TMCJPEGDEC_restart_interval / handoff-evidence: Representative rejected C candidate for persistent-worker handoff; instructions 93/93, aligned differences 17.
TMCJPEGDEC_parse_dht / handoff-evidence: Representative rejected C candidate for persistent-worker handoff; instructions 120/120, aligned differences 6.
TMCJPEGDEC_parse_sof / handoff-evidence: Representative rejected C candidate for persistent-worker handoff; instructions 222/223, aligned differences 129.
TMCJPEGDEC_err_restart / handoff-evidence: Representative rejected C candidate for persistent-worker handoff; instructions 115/115, aligned differences 39.
TMCJPEGDEC_make_huffdec / handoff-evidence: Representative rejected C candidate for persistent-worker handoff; instructions 198/200, aligned differences 133.
TMCJPEGDEC_decode_iquant_rc / handoff-evidence: Representative rejected C candidate for persistent-worker handoff; instructions 167/167, aligned differences 7.
Unconverted function handoff evidence, all candidates rejected and original asm retained:
- TMCJPEGDEC_init_buff_thumbnail: C objdiff 99.55882; instruction delta 0, aligned differences 3; source /tmp/da4/TMCJPEGDEC_init_buff_thumbnail-variants/get-view-0.c.
- TMCJPEGDEC_scan_varinit: C objdiff 99.496124; instruction delta 0, aligned differences 9; source /tmp/da4/TMCJPEGDEC_scan_varinit-variants/scan-decls-0.c.
- TMCJPEGDEC_restart_interval: C objdiff 96.77419; instruction delta 0, aligned differences 17; source /tmp/da4/TMCJPEGDEC_restart_interval-variants/restart-more-4.c.
- TMCJPEGDEC_parse_dht: C objdiff 99.708336; instruction delta 0, aligned differences 6; source /tmp/da4/TMCJPEGDEC_parse_dht-variants/dht-types-0.c.
- TMCJPEGDEC_parse_sof: C objdiff 94.37668; instruction delta -1, aligned differences 129; source /tmp/da4/TMCJPEGDEC_parse_sof-variants/sof-types-0.c.
- TMCJPEGDEC_err_restart: C objdiff 78.33044; instruction delta 0, aligned differences 39; source /tmp/da4/TMCJPEGDEC_err_restart-variants/err-final-2.c.
- TMCJPEGDEC_make_huffdec: C objdiff 78.43; instruction delta -2, aligned differences 133; source /tmp/da4/TMCJPEGDEC_make_huffdec-variants/mkhdec-final-0.c.
- TMCJPEGDEC_decode_iquant_rc: C objdiff 99.76048; instruction delta 0, aligned differences 7; source /tmp/da4/TMCJPEGDEC_decode_iquant_rc-variants/iquant-inline-1.c.
Final retained state
Converted: TMCJPEGDEC_imagestart (014a5167), TMCJPEGDEC_parse_para (f518779c), TMCJPEGDEC_parse_sos (a6b74133). Each received an independent clean gate before its separate commit.
Every other assigned function remains original assembly, unresolved rather than classified as legitimate vendor assembly. No target instruction requires retaining assembly; the remaining problem is reproducing compiler output in C.
Compiled source trials by function: TMCJPEGDEC_init_buff_thumbnail=61, TMCJPEGDEC_imagestart=21, TMCJPEGDEC_scan_varinit=24, TMCJPEGDEC_restart_interval=15, TMCJPEGDEC_parse_para=7, TMCJPEGDEC_parse_dht=33, TMCJPEGDEC_decode_iquant_rc=21, TMCJPEGDEC_parse_sos=6, TMCJPEGDEC_err_restart=14, TMCJPEGDEC_make_huffdec=19, TMCJPEGDEC_parse_sof=21. All eight unconverted functions have at least three distinct compiled source attempts.
Useful continuation findings: init_buff_thumbnail receives EXIF data through its legacy work pointer. make_huffdec valptr contains 16-bit code/index pairs; its fallback byte stores are wrong. parse_sof reuses one byte and one word input variable, scans all sample layouts, and materializes SampleComps with lis/addi. An isolated unsized-extern header diagnostic restores 223 instructions but leaves 84 register/order differences, so no header change was retained. err_restart final subtraction reads posX, not posY, and original division is signed despite Ghidra guessing unsigned.
Applicable levers covered: inline helpers; signedness and widths; const pointers/parameters; separate or reused locals; declaration order; block scopes; counted loops; source search; direct array access; Ghidra and allocator/copy-lifetime hypotheses. eZiText-only spellings, thunk ordering and aggregate/global section boundaries do not apply to these functions. Prior-art gh search was excluded by the worker no-gh contract. No compiler/version flag sweep, new asm, use-site volatile, register keyword, pinned label or shared-layout trick was retained.
Final clean verification
```
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[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/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/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/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
regressions vs baseline: 0
global matched_code_percent: 92.73726 -> 92.73726
global fuzzy_match_percent: 99.78007 -> 99.78007
global complete_code_percent: 76.40339 -> 76.40339
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
```
Search completion and resource limit
getcode-search:
```
target counts {'TMCJPEGDEC_init_buff_thumbnail': 34} start {'TMCJPEGDEC_init_buff_thumbnail': 34} {'TMCJPEGDEC_init_buff_thumbnail': 99.26471}
done 154 trials; best-nodrop energy -99.2647
```
scan-search:
```
target counts {'TMCJPEGDEC_scan_varinit': 129} start {'TMCJPEGDEC_scan_varinit': 129} {'TMCJPEGDEC_scan_varinit': 99.496124}
done 239 trials; best-nodrop energy -99.4961
```
getcode-search2:
```
target counts {'TMCJPEGDEC_init_buff_thumbnail': 34} start {'TMCJPEGDEC_init_buff_thumbnail': 34} {'TMCJPEGDEC_init_buff_thumbnail': 99.55882}
done 57 trials; best-nodrop energy -99.5588
```
iquant-search:
```
target counts {'TMCJPEGDEC_decode_iquant_rc': 167} start {'TMCJPEGDEC_decode_iquant_rc': 167} {'TMCJPEGDEC_decode_iquant_rc': 99.76048}
done 70 trials; best-nodrop energy -99.7605
```
sof-search:
```
target counts {'TMCJPEGDEC_parse_sof': 223} start {'TMCJPEGDEC_parse_sof': 222} {'TMCJPEGDEC_parse_sof': 93.34529}
done 79 trials; best-nodrop energy -91.3453
```
err-search:
```
target counts {'TMCJPEGDEC_err_restart': 115} start {'TMCJPEGDEC_err_restart': 115} {'TMCJPEGDEC_err_restart': 78.33044}
it 10 best-nodrop -78.4174 cnt {'TMCJPEGDEC_err_restart': 115} score [78.41739]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [78.41739]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [78.41739]
it 26 best-nodrop -79.6957 cnt {'TMCJPEGDEC_err_restart': 115} score [79.695656]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.695656]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.695656]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.695656]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.695656]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.608696]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.608696]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.608696]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.608696]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.608696]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [79.608696]
it 39 best-nodrop -85.0435 cnt {'TMCJPEGDEC_err_restart': 115} score [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.95652]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [84.91304]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
it 80 best-nodrop -85.1304 cnt {'TMCJPEGDEC_err_restart': 115} score [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.13043]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
SOLUTION {'TMCJPEGDEC_err_restart': 115} [85.04348]
done 106 trials; best-nodrop energy -85.1304
```
restart-search: cancelled own queued process after 1093 seconds without acquiring a shared search slot; zero trials ran.
dht-search: cancelled own queued process after 948 seconds without acquiring a shared search slot; zero trials ran.
mkhdec-search: cancelled own queued process after 828 seconds without acquiring a shared search slot; zero trials ran.
dht-search2: cancelled own queued process after 383 seconds without acquiring a shared search slot; zero trials ran.
The stopped jobs wrote only temporary search snapshots. No other worker process or shared limiter was changed. Source search completed on thumbnail initialization, scan geometry, coefficient decoding, frame-header parsing and restart error recovery. Huffman-table building, Huffman-header parsing and restart-interval search remained resource-blocked after their manual C trials.
Final audit: 11 assigned functions, 242 logged compiled trials. Every unconverted function has at least three distinct source-level trials. Retained exact count 20 -> 20, matched code 8056 -> 8056 bytes, matched data 256 -> 256 bytes; asm bodies 11 -> 8. Eight conversions remain unresolved. No push, PR, merge, rebase, worktree switch or outside-worktree edit occurred.