• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FLAKE.FlacFrame类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CUETools.Codecs.FLAKE.FlacFrame的典型用法代码示例。如果您正苦于以下问题:C# FlacFrame类的具体用法?C# FlacFrame怎么用?C# FlacFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FlacFrame类属于CUETools.Codecs.FLAKE命名空间,在下文中一共展示了FlacFrame类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FlakeReader

        public FlakeReader(string path, Stream IO)
        {
            _path = path;
            _IO = IO != null ? IO : new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 0x10000);

            crc8 = new Crc8();
            crc16 = new Crc16();

            _framesBuffer = new byte[0x20000];
            decode_metadata();

            frame = new FlacFrame(PCM.ChannelCount);
            framereader = new BitReader();

            //max_frame_size = 16 + ((Flake.MAX_BLOCKSIZE * PCM.BitsPerSample * PCM.ChannelCount + 1) + 7) >> 3);
            if (((int)max_frame_size * PCM.BitsPerSample * PCM.ChannelCount * 2 >> 3) > _framesBuffer.Length)
            {
                byte[] temp = _framesBuffer;
                _framesBuffer = new byte[((int)max_frame_size * PCM.BitsPerSample * PCM.ChannelCount * 2 >> 3)];
                if (_framesBufferLength > 0)
                    Array.Copy(temp, _framesBufferOffset, _framesBuffer, 0, _framesBufferLength);
                _framesBufferOffset = 0;
            }
            _samplesInBuffer = 0;

            if ((PCM.BitsPerSample != 16 && PCM.BitsPerSample != 24) || PCM.ChannelCount != 2 || (PCM.SampleRate != 44100 && PCM.SampleRate != 48000))
                throw new Exception("invalid flac file");

            samplesBuffer = new int[Flake.MAX_BLOCKSIZE * PCM.ChannelCount];
            residualBuffer = new int[Flake.MAX_BLOCKSIZE * PCM.ChannelCount];
        }
开发者ID:Alyasko,项目名称:ComputerSpeechControl,代码行数:31,代码来源:FlakeReader.cs


示例2: FlakeReader

        public FlakeReader(Stream IO)
        {
            if (IO == null)
            {
                throw new ArgumentNullException("IO");
            }

            _IO = IO;

            crc8 = new Crc8();

            _framesBuffer = new byte[0x20000];
            decode_metadata();

            frame = new FlacFrame(PCM.ChannelCount);
            framereader = new BitReader();

            //max_frame_size = 16 + ((Flake.MAX_BLOCKSIZE * PCM.BitsPerSample * PCM.ChannelCount + 1) + 7) >> 3);
            if (((int)max_frame_size * PCM.BitsPerSample * PCM.ChannelCount * 2 >> 3) > _framesBuffer.Length)
            {
                byte[] temp = _framesBuffer;
                _framesBuffer = new byte[((int)max_frame_size * PCM.BitsPerSample * PCM.ChannelCount * 2 >> 3)];
                if (_framesBufferLength > 0)
                    Array.Copy(temp, _framesBufferOffset, _framesBuffer, 0, _framesBufferLength);
                _framesBufferOffset = 0;
            }
            _samplesInBuffer = 0;

            if (PCM.BitsPerSample != 16 && PCM.BitsPerSample != 24)
                throw new Exception("invalid flac file");

            samplesBuffer = new int[Flake.MAX_BLOCKSIZE * PCM.ChannelCount];
            residualBuffer = new int[Flake.MAX_BLOCKSIZE * PCM.ChannelCount];
        }
开发者ID:teekay,项目名称:FLACTools,代码行数:34,代码来源:FlakeReader.cs


示例3: decode_subframe_fixed

        unsafe void decode_subframe_fixed(BitReader bitreader, FlacFrame frame, int ch)
        {
            // warm-up samples
            int obits = frame.subframes[ch].obits;
            for (int i = 0; i < frame.subframes[ch].best.order; i++)
                frame.subframes[ch].best.residual[i] = bitreader.readbits_signed(obits);

            // residual
            decode_residual(bitreader, frame, ch);
        }
开发者ID:Alyasko,项目名称:ComputerSpeechControl,代码行数:10,代码来源:FlakeReader.cs


示例4: encode_residual_fixed_sub

		unsafe void encode_residual_fixed_sub(FlacFrame frame, int order, int ch)
		{
			if ((frame.subframes[ch].done_fixed & (1U << order)) != 0)
				return; // already calculated;

			frame.current.order = order;
			frame.current.type = SubframeType.Fixed;

			encode_residual_fixed(frame.current.residual, frame.subframes[ch].samples, frame.blocksize, frame.current.order);

			int pmax = get_max_p_order(eparams.max_partition_order, frame.blocksize, frame.current.order);
			int pmin = Math.Min(eparams.min_partition_order, pmax);
			frame.current.size = (uint)(frame.current.order * frame.subframes[ch].obits) + 6
				+ calc_rice_params(frame.current.rc, pmin, pmax, frame.current.residual, (uint)frame.blocksize, (uint)frame.current.order, PCM.BitsPerSample);

			frame.subframes[ch].done_fixed |= (1U << order);

			frame.ChooseBestSubframe(ch);
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:19,代码来源:FlakeWriter.cs


示例5: encode_frame

		unsafe int encode_frame(out int size)
		{
			fixed (int* s = samplesBuffer, r = residualBuffer)
			fixed (float* window = windowBuffer)
			{
				frame.InitSize(eparams.block_size, eparams.variable_block_size != 0);

				if (frame.blocksize != _windowsize && frame.blocksize > 4)
				{
					_windowsize = frame.blocksize;
					_windowcount = 0;
					calculate_window(window, lpc.window_welch, WindowFunction.Welch);
					calculate_window(window, lpc.window_tukey, WindowFunction.Tukey);
					calculate_window(window, lpc.window_flattop, WindowFunction.Flattop);
					calculate_window(window, lpc.window_hann, WindowFunction.Hann);
					calculate_window(window, lpc.window_bartlett, WindowFunction.Bartlett);
					if (_windowcount == 0)
						throw new Exception("invalid windowfunction");
				}

				if (channels != 2 || frame.blocksize <= 32 || eparams.stereo_method == StereoMethod.Independent)
				{
					frame.window_buffer = window;
					frame.current.residual = r + channels * Flake.MAX_BLOCKSIZE;
					frame.ch_mode = channels != 2 ? ChannelMode.NotStereo : ChannelMode.LeftRight;
					for (int ch = 0; ch < channels; ch++)
						frame.subframes[ch].Init(s + ch * Flake.MAX_BLOCKSIZE, r + ch * Flake.MAX_BLOCKSIZE,
							_pcm.BitsPerSample, get_wasted_bits(s + ch * Flake.MAX_BLOCKSIZE, frame.blocksize));

					for (int ch = 0; ch < channels; ch++)
						encode_residual_pass2(frame, ch);
				}
				else
				{
					//channel_decorrelation(s, s + Flake.MAX_BLOCKSIZE, s + 2 * Flake.MAX_BLOCKSIZE, s + 3 * Flake.MAX_BLOCKSIZE, frame.blocksize);
					frame.window_buffer = window;
					frame.current.residual = r + 4 * Flake.MAX_BLOCKSIZE;
					for (int ch = 0; ch < 4; ch++)
						frame.subframes[ch].Init(s + ch * Flake.MAX_BLOCKSIZE, r + ch * Flake.MAX_BLOCKSIZE,
							_pcm.BitsPerSample + (ch == 3 ? 1 : 0), get_wasted_bits(s + ch * Flake.MAX_BLOCKSIZE, frame.blocksize));

					//for (int ch = 0; ch < 4; ch++)
					//    for (int iWindow = 0; iWindow < _windowcount; iWindow++)
					//        frame.subframes[ch].lpc_ctx[iWindow].GetReflection(32, frame.subframes[ch].samples, frame.blocksize, frame.window_buffer + iWindow * Flake.MAX_BLOCKSIZE * 2);

					estimate_frame(frame, true);
					uint fs = measure_frame_size(frame, true);

					if (0 != eparams.variable_block_size)
					{
						FlacFrame frame2 = new FlacFrame(channels * 2);
						FlacFrame frame3 = new FlacFrame(channels * 2);
						int tumbler = 1;
						while ((frame.blocksize & 1) == 0 && frame.blocksize >= 1024)
						{
							frame2.InitSize(frame.blocksize / 2, true);
							frame2.window_buffer = frame.window_buffer + frame.blocksize;
							frame2.current.residual = r + tumbler * 5 * Flake.MAX_BLOCKSIZE;
							for (int ch = 0; ch < 4; ch++)
								frame2.subframes[ch].Init(frame.subframes[ch].samples, frame2.current.residual + (ch + 1) * frame2.blocksize,
									frame.subframes[ch].obits + frame.subframes[ch].wbits, frame.subframes[ch].wbits);
							estimate_frame(frame2, true);
							uint fs2 = measure_frame_size(frame2, true);
							uint fs3 = fs2;
							if (eparams.variable_block_size == 2 || eparams.variable_block_size == 4)
							{
								frame3.InitSize(frame2.blocksize, true);
								frame3.window_buffer = frame2.window_buffer;
								frame3.current.residual = frame2.current.residual + 5 * frame2.blocksize;
								for (int ch = 0; ch < 4; ch++)
									frame3.subframes[ch].Init(frame2.subframes[ch].samples + frame2.blocksize, frame3.current.residual + (ch + 1) * frame3.blocksize,
										frame.subframes[ch].obits + frame.subframes[ch].wbits, frame.subframes[ch].wbits);
								estimate_frame(frame3, true);
								fs3 = measure_frame_size(frame3, true);
							}
							if (fs2 + fs3 > fs)
								break;
							FlacFrame tmp = frame;
							frame = frame2;
							frame2 = tmp;
							fs = fs2;
							if (eparams.variable_block_size <= 2)
								break;
							tumbler = 1 - tumbler;
						}
					}

					frame.ChooseSubframes();
					encode_estimated_frame(frame);
				}

				BitWriter bitwriter = new BitWriter(frame_buffer, 0, max_frame_size);

				output_frame_header(frame, bitwriter);
				output_subframes(frame, bitwriter);
				output_frame_footer(bitwriter);

				if (bitwriter.Length >= max_frame_size)
					throw new Exception("buffer overflow");

//.........这里部分代码省略.........
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:101,代码来源:FlakeWriter.cs


示例6: measure_frame_size

		unsafe uint measure_frame_size(FlacFrame frame, bool do_midside)
		{
			// crude estimation of header/footer size
			uint total = (uint)(32 + ((BitReader.log2i(frame_count) + 4) / 5) * 8 + (eparams.variable_block_size != 0 ? 16 : 0) + 16);

			if (do_midside)
			{
				uint bitsBest = AudioSamples.UINT32_MAX;
				ChannelMode modeBest = ChannelMode.LeftRight;

				if (bitsBest > frame.subframes[2].best.size + frame.subframes[3].best.size)
				{
					bitsBest = frame.subframes[2].best.size + frame.subframes[3].best.size;
					modeBest = ChannelMode.MidSide;
				}
				if (bitsBest > frame.subframes[3].best.size + frame.subframes[1].best.size)
				{
					bitsBest = frame.subframes[3].best.size + frame.subframes[1].best.size;
					modeBest = ChannelMode.RightSide;
				}
				if (bitsBest > frame.subframes[3].best.size + frame.subframes[0].best.size)
				{
					bitsBest = frame.subframes[3].best.size + frame.subframes[0].best.size;
					modeBest = ChannelMode.LeftSide;
				}
				if (bitsBest > frame.subframes[0].best.size + frame.subframes[1].best.size)
				{
					bitsBest = frame.subframes[0].best.size + frame.subframes[1].best.size;
					modeBest = ChannelMode.LeftRight;
				}
				frame.ch_mode = modeBest;
				return total + bitsBest;
			}

			for (int ch = 0; ch < channels; ch++)
				total += frame.subframes[ch].best.size;
			return total;
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:38,代码来源:FlakeWriter.cs


示例7: FlakeWriter

		public FlakeWriter(string path, Stream IO, AudioPCMConfig pcm)
		{
			_pcm = pcm;

			//if (_pcm.BitsPerSample != 16)
			//    throw new Exception("Bits per sample must be 16.");
			if (_pcm.ChannelCount != 2)
				throw new Exception("ChannelCount must be 2.");

			channels = pcm.ChannelCount;

			// flake_validate_params

			_path = path;
			_IO = IO;

			samplesBuffer = new int[Flake.MAX_BLOCKSIZE * (channels == 2 ? 4 : channels)];
			residualBuffer = new int[Flake.MAX_BLOCKSIZE * (channels == 2 ? 10 : channels + 1)];
			windowBuffer = new float[Flake.MAX_BLOCKSIZE * 2 * lpc.MAX_LPC_WINDOWS];
			windowScale = new double[lpc.MAX_LPC_WINDOWS];

			eparams.flake_set_defaults(_compressionLevel);
			eparams.padding_size = 8192;

			crc8 = new Crc8();
			crc16 = new Crc16();
			frame = new FlacFrame(channels * 2);
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:28,代码来源:FlakeWriter.cs


示例8: encode_residual_pass2

		unsafe void encode_residual_pass2(FlacFrame frame, int ch)
		{
			encode_residual(frame, ch, eparams.prediction_type, eparams.order_method, 2, estimate_best_window(frame, ch));
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:4,代码来源:FlakeWriter.cs


示例9: output_subframes

		unsafe void output_subframes(FlacFrame frame, BitWriter bitwriter)
		{
			for (int ch = 0; ch < channels; ch++)
			{
				FlacSubframeInfo sub = frame.subframes[ch];
				// subframe header
				int type_code = (int) sub.best.type;
				if (sub.best.type == SubframeType.Fixed)
					type_code |= sub.best.order;
				if (sub.best.type == SubframeType.LPC)
					type_code |= sub.best.order - 1;
				bitwriter.writebits(1, 0);
				bitwriter.writebits(6, type_code);
				bitwriter.writebits(1, sub.wbits != 0 ? 1 : 0);
				if (sub.wbits > 0)
					bitwriter.writebits((int)sub.wbits, 1);

				// subframe
				switch (sub.best.type)
				{
					case SubframeType.Constant:
						output_subframe_constant(frame, bitwriter, sub);
						break;
					case SubframeType.Verbatim:
						output_subframe_verbatim(frame, bitwriter, sub);
						break;
					case SubframeType.Fixed:
						output_subframe_fixed(frame, bitwriter, sub);
						break;
					case SubframeType.LPC:
						output_subframe_lpc(frame, bitwriter, sub);
						break;
				}
			}
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:35,代码来源:FlakeWriter.cs


示例10: restore_samples_lpc

 unsafe void restore_samples_lpc(FlacFrame frame, int ch)
 {
     FlacSubframeInfo sub = frame.subframes[ch];
     ulong csum = 0;
     fixed (int* coefs = sub.best.coefs)
     {
         for (int i = sub.best.order; i > 0; i--)
             csum += (ulong)Math.Abs(coefs[i - 1]);
         if ((csum << sub.obits) >= 1UL << 32)
             lpc.decode_residual_long(sub.best.residual, sub.samples, frame.blocksize, sub.best.order, coefs, sub.best.shift);
         else
             lpc.decode_residual(sub.best.residual, sub.samples, frame.blocksize, sub.best.order, coefs, sub.best.shift);
     }
 }
开发者ID:Alyasko,项目名称:ComputerSpeechControl,代码行数:14,代码来源:FlakeReader.cs


示例11: restore_samples_fixed

        unsafe void restore_samples_fixed(FlacFrame frame, int ch)
        {
            FlacSubframeInfo sub = frame.subframes[ch];

            AudioSamples.MemCpy(sub.samples, sub.best.residual, sub.best.order);
            int* data = sub.samples + sub.best.order;
            int* residual = sub.best.residual + sub.best.order;
            int data_len = frame.blocksize - sub.best.order;
            int s0, s1, s2;
            switch (sub.best.order)
            {
                case 0:
                    AudioSamples.MemCpy(data, residual, data_len);
                    break;
                case 1:
                    s1 = data[-1];
                    for (int i = data_len; i > 0; i--)
                    {
                        s1 += *(residual++);
                        *(data++) = s1;
                    }
                    //data[i] = residual[i] + data[i - 1];
                    break;
                case 2:
                    s2 = data[-2];
                    s1 = data[-1];
                    for (int i = data_len; i > 0; i--)
                    {
                        s0 = *(residual++) + (s1 << 1) - s2;
                        *(data++) = s0;
                        s2 = s1;
                        s1 = s0;
                    }
                    //data[i] = residual[i] + data[i - 1] * 2  - data[i - 2];
                    break;
                case 3:
                    for (int i = 0; i < data_len; i++)
                        data[i] = residual[i] + (((data[i - 1] - data[i - 2]) << 1) + (data[i - 1] - data[i - 2])) + data[i - 3];
                    break;
                case 4:
                    for (int i = 0; i < data_len; i++)
                        data[i] = residual[i] + ((data[i - 1] + data[i - 3]) << 2) - ((data[i - 2] << 2) + (data[i - 2] << 1)) - data[i - 4];
                    break;
            }
        }
开发者ID:Alyasko,项目名称:ComputerSpeechControl,代码行数:45,代码来源:FlakeReader.cs


示例12: restore_samples

 unsafe void restore_samples(FlacFrame frame)
 {
     for (int ch = 0; ch < PCM.ChannelCount; ch++)
     {
         switch (frame.subframes[ch].best.type)
         {
             case SubframeType.Constant:
                 AudioSamples.MemSet(frame.subframes[ch].samples, frame.subframes[ch].best.residual[0], frame.blocksize);
                 break;
             case SubframeType.Verbatim:
                 AudioSamples.MemCpy(frame.subframes[ch].samples, frame.subframes[ch].best.residual, frame.blocksize);
                 break;
             case SubframeType.Fixed:
                 restore_samples_fixed(frame, ch);
                 break;
             case SubframeType.LPC:
                 restore_samples_lpc(frame, ch);
                 break;
         }
         if (frame.subframes[ch].wbits != 0)
         {
             int* s = frame.subframes[ch].samples;
             int x = (int) frame.subframes[ch].wbits;
             for (int i = frame.blocksize; i > 0; i--)
                 *(s++) <<= x;
         }
     }
     if (frame.ch_mode != ChannelMode.NotStereo)
     {
         int* l = frame.subframes[0].samples;
         int* r = frame.subframes[1].samples;
         switch (frame.ch_mode)
         {
             case ChannelMode.LeftRight:
                 break;
             case ChannelMode.MidSide:
                 for (int i = frame.blocksize; i > 0; i--)
                 {
                     int mid = *l;
                     int side = *r;
                     mid <<= 1;
                     mid |= (side & 1); /* i.e. if 'side' is odd... */
                     *(l++) = (mid + side) >> 1;
                     *(r++) = (mid - side) >> 1;
                 }
                 break;
             case ChannelMode.LeftSide:
                 for (int i = frame.blocksize; i > 0; i--)
                 {
                     int _l = *(l++), _r = *r;
                     *(r++) = _l - _r;
                 }
                 break;
             case ChannelMode.RightSide:
                 for (int i = frame.blocksize; i > 0; i--)
                     *(l++) += *(r++);
                 break;
         }
     }
 }
开发者ID:Alyasko,项目名称:ComputerSpeechControl,代码行数:60,代码来源:FlakeReader.cs


示例13: decode_subframe_verbatim

 unsafe void decode_subframe_verbatim(BitReader bitreader, FlacFrame frame, int ch)
 {
     int obits = frame.subframes[ch].obits;
     for (int i = 0; i < frame.blocksize; i++)
         frame.subframes[ch].best.residual[i] = bitreader.readbits_signed(obits);
 }
开发者ID:Alyasko,项目名称:ComputerSpeechControl,代码行数:6,代码来源:FlakeReader.cs


示例14: decode_subframe_lpc

        unsafe void decode_subframe_lpc(BitReader bitreader, FlacFrame frame, int ch)
        {
            // warm-up samples
            int obits = frame.subframes[ch].obits;
            for (int i = 0; i < frame.subframes[ch].best.order; i++)
                frame.subframes[ch].best.residual[i] = bitreader.readbits_signed(obits);

            // LPC coefficients
            frame.subframes[ch].best.cbits = (int)bitreader.readbits(4) + 1; // lpc_precision
            frame.subframes[ch].best.shift = bitreader.readbits_signed(5);
            if (frame.subframes[ch].best.shift < 0)
                throw new Exception("negative shift");
            for (int i = 0; i < frame.subframes[ch].best.order; i++)
                frame.subframes[ch].best.coefs[i] = bitreader.readbits_signed(frame.subframes[ch].best.cbits);

            // residual
            decode_residual(bitreader, frame, ch);
        }
开发者ID:Alyasko,项目名称:ComputerSpeechControl,代码行数:18,代码来源:FlakeReader.cs


示例15: output_subframe_fixed

		output_subframe_fixed(FlacFrame frame, BitWriter bitwriter, FlacSubframeInfo sub)
		{
			// warm-up samples
			for (int i = 0; i < sub.best.order; i++)
				bitwriter.writebits_signed(sub.obits, sub.best.residual[i]);

			// residual
			output_residual(frame, bitwriter, sub);
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:9,代码来源:FlakeWriter.cs


示例16: output_subframe_lpc

		output_subframe_lpc(FlacFrame frame, BitWriter bitwriter, FlacSubframeInfo sub)
		{
			// warm-up samples
			for (int i = 0; i < sub.best.order; i++)
				bitwriter.writebits_signed(sub.obits, sub.best.residual[i]);

			// LPC coefficients
			int cbits = 1;
			for (int i = 0; i < sub.best.order; i++)
				while (cbits < 16 && sub.best.coefs[i] != (sub.best.coefs[i] << (32 - cbits)) >> (32 - cbits))
					cbits++;
			bitwriter.writebits(4, cbits - 1);
			bitwriter.writebits_signed(5, sub.best.shift);
			for (int i = 0; i < sub.best.order; i++)
				bitwriter.writebits_signed(cbits, sub.best.coefs[i]);
			
			// residual
			output_residual(frame, bitwriter, sub);
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:19,代码来源:FlakeWriter.cs


示例17: FlakeWriter

        public FlakeWriter(Stream IO, FlakeWriterSettings settings)
        {
            m_settings = settings;

            //if (Settings.PCM.BitsPerSample != 16)
            //    throw new Exception("Bits per sample must be 16.");
            //if (Settings.PCM.ChannelCount != 2)
            //    throw new Exception("ChannelCount must be 2.");

            channels = Settings.PCM.ChannelCount;

            // flake_validate_params

            //_path = path;

            if (IO == null)
            {
                throw new ArgumentNullException("IO");

            }

            _IO = IO;

            samplesBuffer = new int[Flake.MAX_BLOCKSIZE * (channels == 2 ? 4 : channels)];
            residualBuffer = new int[Flake.MAX_BLOCKSIZE * (channels == 2 ? 10 : channels + 1)];
            windowBuffer = new float[Flake.MAX_BLOCKSIZE * 2 * lpc.MAX_LPC_WINDOWS];
            windowScale = new double[lpc.MAX_LPC_WINDOWS];

            var _compressionLevel = Settings.EncoderModeIndex;
            eparams.flake_set_defaults(_compressionLevel);

            crc8 = new Crc8();
            frame = new FlacFrame(channels * 2);
        }
开发者ID:teekay,项目名称:FLACTools,代码行数:34,代码来源:FlakeWriter.cs


示例18: encode_residual_pass1

		unsafe void encode_residual_pass1(FlacFrame frame, int ch, int best_window)
		{
			int max_prediction_order = eparams.max_prediction_order;
			int max_fixed_order = eparams.max_fixed_order;
			int min_fixed_order = eparams.min_fixed_order;
			int lpc_min_precision_search = eparams.lpc_min_precision_search;
			int lpc_max_precision_search = eparams.lpc_max_precision_search;
			int max_partition_order = eparams.max_partition_order;
			int estimation_depth = eparams.estimation_depth;
			eparams.min_fixed_order = 2;
			eparams.max_fixed_order = 2;
			eparams.lpc_min_precision_search = eparams.lpc_max_precision_search;
			eparams.max_prediction_order = 8;
			eparams.estimation_depth = 1;
			encode_residual(frame, ch, eparams.prediction_type, OrderMethod.Akaike, 1, best_window);
			eparams.min_fixed_order = min_fixed_order;
			eparams.max_fixed_order = max_fixed_order;
			eparams.max_prediction_order = max_prediction_order;
			eparams.lpc_min_precision_search = lpc_min_precision_search;
			eparams.lpc_max_precision_search = lpc_max_precision_search;
			eparams.max_partition_order = max_partition_order;
			eparams.estimation_depth = estimation_depth;
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:23,代码来源:FlakeWriter.cs


示例19: encode_residual_pass1

 unsafe void encode_residual_pass1(FlacFrame frame, int ch, int best_window)
 {
     int max_prediction_order = eparams.max_prediction_order;
     int max_fixed_order = eparams.max_fixed_order;
     int min_fixed_order = eparams.min_fixed_order;
     int lpc_min_precision_search = eparams.lpc_min_precision_search;
     int lpc_max_precision_search = eparams.lpc_max_precision_search;
     int max_partition_order = eparams.max_partition_order;
     int estimation_depth = eparams.estimation_depth;
     var development_mode = eparams.development_mode;
     eparams.min_fixed_order = 2;
     eparams.max_fixed_order = 2;
     eparams.lpc_min_precision_search = eparams.lpc_max_precision_search;
     eparams.max_prediction_order = Math.Min(eparams.max_prediction_order, Math.Max(eparams.min_prediction_order, 8));
     eparams.estimation_depth = 1;
     eparams.development_mode = Math.Min(eparams.development_mode, -1);
     encode_residual(frame, ch, eparams.prediction_type, OrderMethod.Akaike, 1, best_window);
     eparams.min_fixed_order = min_fixed_order;
     eparams.max_fixed_order = max_fixed_order;
     eparams.max_prediction_order = max_prediction_order;
     eparams.lpc_min_precision_search = lpc_min_precision_search;
     eparams.lpc_max_precision_search = lpc_max_precision_search;
     eparams.max_partition_order = max_partition_order;
     eparams.estimation_depth = estimation_depth;
     eparams.development_mode = development_mode;
 }
开发者ID:teekay,项目名称:FLACTools,代码行数:26,代码来源:FlakeWriter.cs


示例20: estimate_best_window

		unsafe int estimate_best_window(FlacFrame frame, int ch)
		{
			if (_windowcount == 1) 
				return 0;
			switch (eparams.window_method)
			{
				case WindowMethod.Estimate:
					{
						int best_window = -1;
						double best_error = 0;
						int order = 2;
						for (int i = 0; i < _windowcount; i++)
						{
							frame.subframes[ch].lpc_ctx[i].GetReflection(order, frame.subframes[ch].samples, frame.blocksize, frame.window_buffer + i * Flake.MAX_BLOCKSIZE * 2);
							double err = frame.subframes[ch].lpc_ctx[i].prediction_error[order - 1] / frame.subframes[ch].lpc_ctx[i].autocorr_values[0];
							//double err = frame.subframes[ch].lpc_ctx[i].autocorr_values[0] / frame.subframes[ch].lpc_ctx[i].autocorr_values[2];
							if (best_window == -1 || best_error > err)
							{
								best_window = i;
								best_error = err;
							}
						}
						return best_window;
					}
				case WindowMethod.Evaluate:
					encode_residual_pass1(frame, ch, -1);
					return frame.subframes[ch].best.type == SubframeType.LPC ? frame.subframes[ch].best.window : -1;
				case WindowMethod.Search:
					return -1;
			}
			return -1;
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:32,代码来源:FlakeWriter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CWrapped.Wrapped类代码示例发布时间:2022-05-24
下一篇:
C# CUBRIDClient.CUBRIDConnection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap