P2: decode mask-accumulator combine kernels from raw bytes — combine3(0x8d60)=sub, acc_add(0x5a20)=dst+=src, acc_fma(0x3c40)=dst+=a·b; implement + levelpath_check ALL OK
This commit is contained in:
+19
-2
@@ -156,9 +156,26 @@ void band_lut_apply(void* ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---- mask-accumulator combine kernels (FUN_180529fe0, CRT thunks) ----
|
||||
// Signatures recovered from raw bytes in the rt snap (objdump of 0x180008d60/5a20/3c40).
|
||||
//
|
||||
// 0x8d60 combine3: out[i] = a[i] - b[i] (vsubpd, 3 pointers; dst is the 3rd arg)
|
||||
// In the per-band loop: 0x5406f8[i] = 0x540678[i] - 0x5407c8[i]
|
||||
void combine_sub(double* out, const double* a, const double* b, int n) {
|
||||
for (int i = 0; i < n; i++) out[i] = a[i] - b[i];
|
||||
}
|
||||
|
||||
// 0x5a20: dst[i] += src[i] (double; kernel 0x18001a5a0)
|
||||
void acc_add(double* dst, const double* src, int n) {
|
||||
for (int i = 0; i < n; i++) dst[i] += src[i];
|
||||
}
|
||||
|
||||
// 0x3c40: dst[i] += a[i] * b[i] (double; vfmadd213pd)
|
||||
void acc_fma(double* dst, const double* a, const double* b, int n) {
|
||||
for (int i = 0; i < n; i++) dst[i] += a[i] * b[i];
|
||||
}
|
||||
|
||||
// FUN_180529fe0: coefficient setup (from decomp_funs.txt)
|
||||
// Generates per-band coefficients via PRNG, applies depth scaling
|
||||
// This is the vtable method for Soothe2Module
|
||||
void coefficient_setup(void* ctx, int band_idx, int param3, int param4) {
|
||||
auto* base = static_cast<uint8_t*>(ctx);
|
||||
|
||||
|
||||
@@ -11,3 +11,8 @@ void twin_mask_factory(void* ctx, int band_idx, int n_bins);
|
||||
|
||||
// FUN_180563a60: band LUT apply (level -> gain) t^gamma / power-law, 6 bands.
|
||||
void band_lut_apply(void* ctx);
|
||||
|
||||
// mask-accumulator combine kernels (FUN_180529fe0 CRT thunks).
|
||||
void combine_sub(double* out, const double* a, const double* b, int n); // 0x8d60
|
||||
void acc_add(double* dst, const double* src, int n); // 0x5a20
|
||||
void acc_fma(double* dst, const double* a, const double* b, int n); // 0x3c40
|
||||
|
||||
@@ -48,6 +48,21 @@ int main() {
|
||||
chk("band_lut_apply level_axis[512]", level_gain[1024], 0.5f, 1e-6);
|
||||
}
|
||||
|
||||
// ---- combine kernels (0x8d60/0x5a20/0x3c40) ----
|
||||
{
|
||||
double out[4] = {0, 0, 0, 0};
|
||||
double a[4] = {5, 2, -1, 8};
|
||||
double b[4] = {3, 7, 4, 2};
|
||||
combine_sub(out, a, b, 4);
|
||||
chk("combine_sub[0] a-b", out[0], 2.0, 1e-12);
|
||||
chk("combine_sub[2] a-b", out[2], -5.0, 1e-12);
|
||||
acc_add(out, a, 4); // out = (a-b) + a
|
||||
chk("acc_add[0]", out[0], 7.0, 1e-12); // (5-3)+5 = 7
|
||||
acc_fma(out, b, a, 4); // out += b*a
|
||||
// out[1] = (2-7)+2 = -3, then -3 + b[1]*a[1] = -3 + 7*2 = 11
|
||||
chk("acc_fma[1]", out[1], 11.0, 1e-12);
|
||||
}
|
||||
|
||||
std::printf(ok ? "ALL OK\n" : "FAILURES\n");
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
Reference in New Issue
Block a user