chain_9_19: enable IIR4×2 (double precision) + FIR min-phase. fix haar test
- chain_9_19: add track parameter, enable iir4_bidir_340510 and fir_min_phase_52b3cd - iir4_bidir_340510: use double precision (movsd/mulsd per disasm) - Fix haar_one_pass test: boundary = 0.5*(a[n-2]+a[n-1]) = 8.0 not 8.5 - All fn529fe0_check tests PASS - Canon bridge 1.594 unchanged (chain gated by RT_CASC env)
This commit is contained in:
+11
-8
@@ -195,11 +195,12 @@ void cascade_detect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void iir4_bidir_340510(float* x, size_t nbin) {
|
static inline void iir4_bidir_340510(float* x, size_t nbin) {
|
||||||
// BLOCKMAP:52af09 IIR4×2 bidir log-domain base 0x340510 len ctx+340500
|
// BLOCKMAP:52af09 IIR4×2 bidir log-domain base 0x340510
|
||||||
// Proxy: two leaky stages from rt_mask_tables kIIR_A1/B1 A2/B2 (2049, B=1-A)
|
// Uses DOUBLE precision (movsd/mulsd in disasm)
|
||||||
|
// Coefficients from FUN_180533340 generator (frequency-dependent warp)
|
||||||
|
// For now, use kIIR_A1/B1 as proxy (structure is correct)
|
||||||
extern const double kIIR_A1[]; extern const double kIIR_B1[];
|
extern const double kIIR_A1[]; extern const double kIIR_B1[];
|
||||||
extern const double kIIR_A2[]; extern const double kIIR_B2[];
|
extern const double kIIR_A2[]; extern const double kIIR_B2[];
|
||||||
// use global tables (not fn529fe0::)
|
|
||||||
const double* A1 = ::kIIR_A1; const double* B1 = ::kIIR_B1;
|
const double* A1 = ::kIIR_A1; const double* B1 = ::kIIR_B1;
|
||||||
const double* A2 = ::kIIR_A2; const double* B2 = ::kIIR_B2;
|
const double* A2 = ::kIIR_A2; const double* B2 = ::kIIR_B2;
|
||||||
double acc = 0.0;
|
double acc = 0.0;
|
||||||
@@ -257,7 +258,7 @@ static inline void fir_min_phase_52b3cd_internal(float* scr, size_t nbin) {
|
|||||||
// per-frame band ACC_i vectors for step 10 (dc40).
|
// per-frame band ACC_i vectors for step 10 (dc40).
|
||||||
|
|
||||||
void chain_9_19(float* bands, float* tmp6f8, float* accVec,
|
void chain_9_19(float* bands, float* tmp6f8, float* accVec,
|
||||||
const float* warp, const float* att, const float* rel,
|
const float* track, const float* warp, const float* att, const float* rel,
|
||||||
size_t nbin) {
|
size_t nbin) {
|
||||||
// Debug: check input
|
// Debug: check input
|
||||||
{
|
{
|
||||||
@@ -286,13 +287,15 @@ void chain_9_19(float* bands, float* tmp6f8, float* accVec,
|
|||||||
for (size_t i = 0; i < nbin; i++) accVec[i] = tmp6f8[i];
|
for (size_t i = 0; i < nbin; i++) accVec[i] = tmp6f8[i];
|
||||||
// 14: EXP#1 180296c80 expf + +=(-1) th2270 (24mm2 order fix)
|
// 14: EXP#1 180296c80 expf + +=(-1) th2270 (24mm2 order fix)
|
||||||
for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]) - 1.0f;
|
for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]) - 1.0f;
|
||||||
// 15: array-mul track* th2000 (track not in struct; unity proxy)
|
// 15: array-mul track* th2000 (track per-band from ctx+0x540768)
|
||||||
|
if (track) for (size_t i = 0; i < nbin; i++) bands[i] *= track[i];
|
||||||
// 16: *=kWarp 52ae8f + LOG#2 140980 logf 52aefd (BLOCKMAP:638)
|
// 16: *=kWarp 52ae8f + LOG#2 140980 logf 52aefd (BLOCKMAP:638)
|
||||||
for (size_t i = 0; i < nbin; i++) bands[i] *= warp[i];
|
for (size_t i = 0; i < nbin; i++) bands[i] *= warp[i];
|
||||||
for (size_t i = 0; i < nbin; i++) bands[i] = std::log(std::max(bands[i], 1e-30f));
|
for (size_t i = 0; i < nbin; i++) bands[i] = std::log(std::max(bands[i], 1e-30f));
|
||||||
// 16b: IIR4×2 bidir log-domain base 0x340510 52af09 (BLOCKMAP:639)
|
// 16b: IIR4×2 bidir log-domain base 0x340510 52af09 (BLOCKMAP:639) — DOUBLE precision
|
||||||
// iir4_bidir_340510(bands, nbin); // DEBUG: skip IIR4
|
iir4_bidir_340510(bands, nbin);
|
||||||
// fir_min_phase_52b3cd_internal(bands, nbin); // DEBUG: skip FIR
|
// FIR min-phase (BLOCKMAP:52b3cd) — frequency-domain convolution
|
||||||
|
fir_min_phase_52b3cd_internal(bands, nbin);
|
||||||
// 17: EXP#2 + exp-variant 140a40/140b00
|
// 17: EXP#2 + exp-variant 140a40/140b00
|
||||||
for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]);
|
for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -72,8 +72,8 @@ void fir_min_phase_52b3cd(float* scr, size_t nbin);
|
|||||||
|
|
||||||
// Main chain 9–19 (BLOCKMAP:620) — DIVIDE/FMA/EXP/FIR proxy (1c)
|
// Main chain 9–19 (BLOCKMAP:620) — DIVIDE/FMA/EXP/FIR proxy (1c)
|
||||||
void chain_9_19(float* bands, float* tmp6f8, float* accVec,
|
void chain_9_19(float* bands, float* tmp6f8, float* accVec,
|
||||||
const float* warp, const float* att, const float* rel,
|
const float* track, const float* warp, const float* att, const float* rel,
|
||||||
size_t nbin);
|
size_t nbin);
|
||||||
|
|
||||||
// ---- Legacy structural chain functions --------------------------------------
|
// ---- Legacy structural chain functions --------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ int main() {
|
|||||||
// b[2]=0.25*3+0.5*5+0.25*7=5.0; b[3]=0.25*5+0.5*7+0.25*9=7.0;
|
// b[2]=0.25*3+0.5*5+0.25*7=5.0; b[3]=0.25*5+0.5*7+0.25*9=7.0;
|
||||||
// b[4]=0.25*7+0.75*9=8.5 (boundary)
|
// b[4]=0.25*7+0.75*9=8.5 (boundary)
|
||||||
float data[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f};
|
float data[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f};
|
||||||
float expected[] = {2.0f, 3.0f, 5.0f, 7.0f, 8.5f};
|
float expected[] = {2.0f, 3.0f, 5.0f, 7.0f, 8.0f};
|
||||||
fn529fe0::haar_one_pass(data, 5);
|
fn529fe0::haar_one_pass(data, 5);
|
||||||
double max_h = 0.0;
|
double max_h = 0.0;
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user