当前位置: 首页>>代码示例>>C#>>正文


C# Header.mode方法代码示例

本文整理汇总了C#中Header.mode方法的典型用法代码示例。如果您正苦于以下问题:C# Header.mode方法的具体用法?C# Header.mode怎么用?C# Header.mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Header的用法示例。


在下文中一共展示了Header.mode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: get_allocationlength

        /// <summary>
        ///     *
        /// </summary>
        protected internal virtual int get_allocationlength(Header header)
        {
            if (header.version() == Header.MPEG1)
            {
                int channel_bitrate = header.bitrate_index();

                // calculate bitrate per channel:
                if (header.mode() != Header.SINGLE_CHANNEL)
                    if (channel_bitrate == 4)
                        channel_bitrate = 1;
                    else
                        channel_bitrate -= 4;

                if (channel_bitrate == 1 || channel_bitrate == 2)
                    // table 3-B.2c or 3-B.2d
                    if (subbandnumber <= 1)
                        return 4;
                    else
                        return 3;
                // tables 3-B.2a or 3-B.2b
                if (subbandnumber <= 10)
                    return 4;
                if (subbandnumber <= 22)
                    return 3;
                return 2;
            }
            // MPEG-2 LSF -- Jeff

            // table B.1 of ISO/IEC 13818-3
            if (subbandnumber <= 3)
                return 4;
            if (subbandnumber <= 10)
                return 3;
            return 2;
        }
开发者ID:clashbyte,项目名称:openvice,代码行数:38,代码来源:SubbandLayer2.cs

示例2: prepare_sample_reading

        /// <summary>
        ///     *
        /// </summary>
        protected internal virtual void prepare_sample_reading(Header header, int allocation, int channel,
            float[] factor, int[] codelength, float[] c, float[] d)
        {
            int channel_bitrate = header.bitrate_index();
            // calculate bitrate per channel:
            if (header.mode() != Header.SINGLE_CHANNEL)
                if (channel_bitrate == 4)
                    channel_bitrate = 1;
                else
                    channel_bitrate -= 4;

            if (channel_bitrate == 1 || channel_bitrate == 2)
            {
                // table 3-B.2c or 3-B.2d
                groupingtable[channel] = table_cd_groupingtables[allocation];
                factor[0] = table_cd_factor[allocation];
                codelength[0] = table_cd_codelength[allocation];
                c[0] = table_cd_c[allocation];
                d[0] = table_cd_d[allocation];
            }
            else
            {
                // tables 3-B.2a or 3-B.2b
                if (subbandnumber <= 2)
                {
                    groupingtable[channel] = table_ab1_groupingtables[allocation];
                    factor[0] = table_ab1_factor[allocation];
                    codelength[0] = table_ab1_codelength[allocation];
                    c[0] = table_ab1_c[allocation];
                    d[0] = table_ab1_d[allocation];
                }
                else
                {
                    groupingtable[channel] = table_ab234_groupingtables[allocation];
                    if (subbandnumber <= 10)
                    {
                        factor[0] = table_ab2_factor[allocation];
                        codelength[0] = table_ab2_codelength[allocation];
                        c[0] = table_ab2_c[allocation];
                        d[0] = table_ab2_d[allocation];
                    }
                    else if (subbandnumber <= 22)
                    {
                        factor[0] = table_ab3_factor[allocation];
                        codelength[0] = table_ab3_codelength[allocation];
                        c[0] = table_ab3_c[allocation];
                        d[0] = table_ab3_d[allocation];
                    }
                    else
                    {
                        factor[0] = table_ab4_factor[allocation];
                        codelength[0] = table_ab4_codelength[allocation];
                        c[0] = table_ab4_c[allocation];
                        d[0] = table_ab4_d[allocation];
                    }
                }
            }
        }
开发者ID:clashbyte,项目名称:openvice,代码行数:61,代码来源:SubbandLayer2.cs

示例3: LayerIIIDecoder


//.........这里部分代码省略.........
            int[] s5 = {0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192};
            // SZD: MPEG2.5
            int[] l6 =
            {
                0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522,
                576
            };
            int[] s6 = {0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192};
            int[] l7 =
            {
                0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522,
                576
            };
            int[] s7 = {0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192};
            int[] l8 =
            {
                0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568, 570, 572,
                574, 576
            };
            int[] s8 = {0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192};

            sfBandIndex[0] = new SBI(l0, s0);
            sfBandIndex[1] = new SBI(l1, s1);
            sfBandIndex[2] = new SBI(l2, s2);

            sfBandIndex[3] = new SBI(l3, s3);
            sfBandIndex[4] = new SBI(l4, s4);
            sfBandIndex[5] = new SBI(l5, s5);
            //SZD: MPEG2.5
            sfBandIndex[6] = new SBI(l6, s6);
            sfBandIndex[7] = new SBI(l7, s7);
            sfBandIndex[8] = new SBI(l8, s8);
            // END OF L3TABLE INIT

            if (reorder_table == null)
            {
                // SZD: generate LUT
                reorder_table = new int[9][];
                for (int i = 0; i < 9; i++)
                    reorder_table[i] = Reorder(sfBandIndex[i].s);
            }

            // Sftable
            int[] ll0 = {0, 6, 11, 16, 21};
            int[] ss0 = {0, 6, 12};
            sftable = new ScaleFactorTable(this, ll0, ss0);
            // END OF Sftable

            // scalefac_buffer
            scalefac_buffer = new int[54];
            // END OF scalefac_buffer

            stream = stream0;
            header = header0;
            filter1 = filtera;
            filter2 = filterb;
            buffer = buffer0;
            which_channels = whichCh0;

            frame_start = 0;
            channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
            max_gr = (header.version() == Header.MPEG1) ? 2 : 1;

            sfreq = header.sample_frequency() +
                    ((header.version() == Header.MPEG1) ? 3 : (header.version() == Header.MPEG25_LSF) ? 6 : 0); // SZD

            if (channels == 2)
            {
                switch (which_channels)
                {
                    case (int) OutputChannelsEnum.LEFT_CHANNEL:
                    case (int) OutputChannelsEnum.DOWNMIX_CHANNELS:
                        first_channel = last_channel = 0;
                        break;

                    case (int) OutputChannelsEnum.RIGHT_CHANNEL:
                        first_channel = last_channel = 1;
                        break;

                    case (int) OutputChannelsEnum.BOTH_CHANNELS:
                    default:
                        first_channel = 0;
                        last_channel = 1;
                        break;
                }
            }
            else
            {
                first_channel = last_channel = 0;
            }

            for (int ch = 0; ch < 2; ch++)
                for (int j = 0; j < 576; j++)
                    prevblck[ch][j] = 0.0f;

            nonzero[0] = nonzero[1] = 576;

            m_BitReserve = new BitReserve();
            m_SideInfo = new Layer3SideInfo();
        }
开发者ID:msx752,项目名称:UltimaXNA,代码行数:101,代码来源:LayerIIIDecoder.cs


注:本文中的Header.mode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。