CSPspEmu.Hle.Formats.audio.At3.MaiAT3PlusCoreDecoder.MAPCDSF_decodeTable0_Route2 C# (CSharp) Method

MAPCDSF_decodeTable0_Route2() static private method

static private MAPCDSF_decodeTable0_Route2 ( MaiBitReader mbr0, MaiAT3PlusCoreDecoderChnInfo chn_info ) : int
mbr0 CSPspEmu.Hle.Formats.audio.At3.SUB.MaiBitReader
chn_info MaiAT3PlusCoreDecoderChnInfo
return int
        static int MAPCDSF_decodeTable0_Route2(MaiBitReader mbr0, MaiAT3PlusCoreDecoderChnInfo chn_info)
        {
            int rs = 0;

            chn_info.table0_flag_data_num = mbr0.getWithI32Buffer(2);

            if ((rs = MAPCDSF_decodeTable0DataNum(mbr0, chn_info)) != 0) return rs;

            if (chn_info.table0_data_num0 != 0)
            {
                uint uk1c6f8 = (uint)mbr0.getWithI32Buffer(1);
                uint uk1c6e0 = (uint)mbr0.getWithI32Buffer(1);
                uint uk1c6f4 = (uint)mbr0.getWithI32Buffer(3);
                uint uk1c6f0 = (uint)mbr0.getWithI32Buffer(4);

                if (chn_info.table0_data_num0 != 0)
                {
                    uint* tmptable = stackalloc uint[0x20];
                    tmptable[0] = uk1c6f4;
                    for (uint a0 = 1; a0 < MAPCDSF_decodeTable0_Route2_table_s0[chn_info.table0_data_num0 - 1] + 1; a0++)
                    {
                        tmptable[a0] = uk1c6f4 - MAPCDSF_decodeTable0_Route2_table_s1[( (uk1c6f4 << 4) + uk1c6f0 ) * 9 + a0 - 1];
                    }

                    for (uint a0 = 0; a0 < chn_info.table0_data_num0; a0++)
                    {
                        chn_info.table0[a0] = tmptable[MAPCDSF_decodeTable0_Route2_table_s0[a0]];
                    }
                }

                var huff_table_now = MaiAT3PlusCoreDecoder_StaticData.MAPCDSD_huff_table0[uk1c6e0];

                if (uk1c6f8 != 0)
                {
                    for (uint a0 = 0; a0 < (chn_info.table0_data_num0 >> 1); a0++)
                    {
                        uint loc0 = (uint)mbr0.getWithI32Buffer(1);

                        if (0 == loc0)
                        {
                            chn_info.table0[a0 * 2] += (uint)MAPCDSF_getHuffValue(huff_table_now, mbr0);
                            chn_info.table0[a0 * 2 + 1] += MAPCDSF_getHuffValue(huff_table_now, mbr0);
                        }
                    }
                    for (uint a0 = ((chn_info.table0_data_num0 >> 1) << 1); a0 < chn_info.table0_data_num0; a0++)
                    {
                        chn_info.table0[a0] += MAPCDSF_getHuffValue(huff_table_now, mbr0);
                    }
                }
                else
                {
                    for (uint a0 = 0; a0 < chn_info.table0_data_num0; a0++)
                    {
                        chn_info.table0[a0] += MAPCDSF_getHuffValue(huff_table_now, mbr0);
                    }
                }

                for (uint a0 = 0; a0 < chn_info.table0_data_num0; a0++)
                {
                    chn_info.table0[a0] &= 0x7;
                }
            }

            if (0 != (rs = MAPCDSF_padTable0(mbr0, chn_info))) return rs;

            return rs;
        }
MaiAT3PlusCoreDecoder