static int MAPCDSF_calcACCTableTableUnk3ByLastValue(MaiAT3PlusCoreDecoderChnACCTableTable table, MaiBitReader mbr0) { int rs = 0; for (int a0 = 0; a0 < (int)table.num_uk; a0++) { if (0 == a0) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0xA); } else if ( table.ptr0[a0 - 1].unk3 < 0x200) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0xA); } else if ( table.ptr0[a0 - 1].unk3 < 0x300) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x9) + 0x200; } else if ( table.ptr0[a0 - 1].unk3 < 0x380) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x8) + 0x300; } else if ( table.ptr0[a0 - 1].unk3 < 0x3C0) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x7) + 0x380; } else if ( table.ptr0[a0 - 1].unk3 < 0x3E0) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x6) + 0x3C0; } else if ( table.ptr0[a0 - 1].unk3 < 0x3F0) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x5) + 0x3E0; } else if ( table.ptr0[a0 - 1].unk3 < 0x3F8) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x4) + 0x3F0; } else if ( table.ptr0[a0 - 1].unk3 < 0x3FC) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x3) + 0x3F8; } else if (table.ptr0[a0 - 1].unk3 < 0x3FE) { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x2) + 0x3FC; } else { table.ptr0[a0].unk3 = mbr0.getWithI32Buffer(0x1) + 0x3FE; } } return rs; }
static int makeSL128(MaiAT3PlusCoreDecoderChnACCTableTable acc, float* lo, int num0, int num1, int acc_4, int acc_360, int chn) { fixed (byte* table_tmp0_o = _makeSL128_table_tmp0_o) fixed (byte* table_tmp1_o = _makeSL128_table_tmp1_o) { float* table_tmp0 = (float*)table_tmp0_o; float* table_tmp1 = (float*)table_tmp1_o; for (int a0 = 0; a0 < num1; a0++) lo[a0] = 0.0f; if (acc_4 == 0) { for (int a0 = 0; a0 < acc.num_uk; a0++) { float l259 = table_tmp0[acc.ptr0[a0].unk0] * table_tmp1[acc.ptr0[a0].unk1]; int atmp0 = acc.ptr0[a0].unk2; atmp0 &= 0x1F; atmp0 <<= 6; int ctmp0 = num0 - 0x80; ctmp0 *= acc.ptr0[a0].unk3; ctmp0 += atmp0; ctmp0 &= 0x7FF; for (int a1 = 0; a1 < num1; a1++) { lo[a1] += l259 * MaiAT3PlusCoreDecoder_StaticData.MAPCDSD_table_static_3[ctmp0]; ctmp0 += acc.ptr0[a0].unk3; ctmp0 &= 0x7FF; } } } else { for (int a0 = 0; a0 < acc.num_uk; a0++) { float l259 = table_tmp0[acc.ptr0[a0].unk0]; int atmp0 = acc.ptr0[a0].unk2; atmp0 &= 0x1F; atmp0 <<= 6; int ctmp0 = num0 - 0x80; ctmp0 *= acc.ptr0[a0].unk3; ctmp0 += atmp0; ctmp0 &= 0x7FF; for (int a1 = 0; a1 < num1; a1++) { lo[a1] += l259 * MaiAT3PlusCoreDecoder_StaticData.MAPCDSD_table_static_3[ctmp0]; ctmp0 += acc.ptr0[a0].unk3; ctmp0 &= 0x7FF; } } } if ((chn != 0) && (acc_360 != 0)) { for (int a1 = 0; a1 < num1; a1++) { lo[a1] *= -1.0f; } } float* l256 = stackalloc float[0x100]; { for (int a0 = 0; a0 < 0x100; a0++) l256[a0] = 1.0f; if (acc.unk[0] != 0) { for (int a0 = 0; a0 < acc.unk[2]; a0++) l256[a0] = 0.0f; l256[acc.unk[2]] = 0.0f; l256[acc.unk[2] + 1] = 0.1464233f; l256[acc.unk[2] + 2] = 0.5f; l256[acc.unk[2] + 3] = 0.8535767f; } if (acc.unk[1] != 0) { l256[acc.unk[3] - 4] = 0.8535767f; l256[acc.unk[3] - 3] = 0.5f; l256[acc.unk[3] - 2] = 0.1464233f; l256[acc.unk[3] - 1] = 0.0f; for (int a0 = acc.unk[3]; a0 < 0x100; a0++) l256[a0] = 0.0f; } } for (int a1 = 0; a1 < num1; a1++) { lo[a1] *= l256[num0 + a1]; } return 0; } }
static int MAPCDSF_calcACCTableTableUnk3ByAfterValue(MaiAT3PlusCoreDecoderChnACCTableTable table, MaiBitReader mbr0) { int rs = 0; int btmp0 = table.num_uk - 1; while (btmp0 >= 0) { // @TODO: Refactor gettings bits. if (btmp0 == (table.num_uk - 1) ) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0xA); } else if ( table.ptr0[btmp0 + 1].unk3 < 2) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x1); } else if ( table.ptr0[btmp0 + 1].unk3 < 4) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x2); } else if ( table.ptr0[btmp0 + 1].unk3 < 8) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x3); } else if ( table.ptr0[btmp0 + 1].unk3 < 0x10) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x4); } else if ( table.ptr0[btmp0 + 1].unk3 < 0x20) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x5); } else if ( table.ptr0[btmp0 + 1].unk3 < 0x40) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x6); } else if ( table.ptr0[btmp0 + 1].unk3 < 0x80) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x7); } else if ( table.ptr0[btmp0 + 1].unk3 < 0x100) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x8); } else if ( table.ptr0[btmp0 + 1].unk3 < 0x200) { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0x9); } else { table.ptr0[btmp0].unk3 = mbr0.getWithI32Buffer(0xA); } btmp0--; } return rs; }
int MAPCDDF_makeL128(MaiAT3PlusCoreDecoderChnACCTableTable acc5, int acc5_4, int acc5_360, MaiAT3PlusCoreDecoderChnACCTableTable acc6, int acc6_4, int acc6_360, float* l128, int chn) { int rs = 0; var lo256 = stackalloc float[0x100]; var lo128 = &lo256[0x80]; makeSL128(acc5, lo128, 0x80, 0x80, acc5_4, acc5_360, chn); makeSL128(acc6, lo256, 0, 0x80, acc6_4, acc6_360, chn); if ( (acc5.num_uk > 0) && (acc6.num_uk > 0) && (acc5.unk[3] - 0x80 >= acc6.unk[2]) ) { for (int a0 = 0; a0 < 0x80; a0++) { lo128[a0] *= MaiAT3PlusCoreDecoder_StaticData.MAPCDSD_table_static_5[a0]; lo256[a0] *= MaiAT3PlusCoreDecoder_StaticData.MAPCDSD_table_static_4[a0]; } } else { if (acc5.num_uk > 0) { if (acc5.unk[1] == 0) { for (int a0 = 0; a0 < 0x80; a0++) { lo128[a0] *= MaiAT3PlusCoreDecoder_StaticData.MAPCDSD_table_static_5[a0]; } } } if (acc6.num_uk > 0) { if (acc6.unk[0] == 0) { for (int a0 = 0; a0 < 0x80; a0++) lo256[a0] *= MaiAT3PlusCoreDecoder_StaticData.MAPCDSD_table_static_4[a0]; } } } for (int a0 = 0; a0 < 0x80; a0++) { l128[a0] = lo256[a0] + lo128[a0]; } return rs; }