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


C# ByteArray.WriteBuffer方法代码示例

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


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

示例1: Encode


//.........这里部分代码省略.........
            {

                xposCollection.Add( xpos );
                yposCollection.Add( ypos );

        //				RGB2YUV(image, xpos, ypos);
        //				DCY = ProcessDU(YDU, fdtbl_Y,  DCY, YDC_HT,  YAC_HT,  ref output, ref bytepos, ref bytenew);
        //				DCU = ProcessDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT, ref output, ref bytepos, ref bytenew);
        //				DCV = ProcessDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT, ref output, ref bytepos, ref bytenew);
        //

                //				Debug.Log( numberOfBlocks );
                numberOfBlocks++;
                if( numberOfBlocks == resetInterval)
                {
                    numberOfBlocks = 0;

        //					Debug.Log(blockNumber);
        //					WriteWord(0xFFD0 + blockNumber, ref output);
        //
        //					blockNumber = ++blockNumber % 8;
        //
        //					bytenew=0;
        //					bytepos=7;
        //					DCY = 0;
        //					DCU = 0;
        //					DCV = 0;
                    count++;

                    taskQueue.Enqueue( new Task(count, xposCollection, yposCollection ) );
                    xposCollection.Clear();
                    yposCollection.Clear();

                }
        //
        //				//If running on a single core system, then give some time to do other stuff
        //				if( cores == 1 )
        //					Thread.Sleep(0);
            }
        }

        System.DateTime dt = System.DateTime.Now;

        ThreadStart threadStart = delegate { ProcessTask(); };
        Thread worker = new Thread(threadStart);
        worker.IsBackground = true;
        worker.Start();

        ThreadStart threadStart2 = delegate { ProcessTask(); };
        Thread worker2 = new Thread(threadStart2);
        worker2.IsBackground = true;
        worker2.Start();

        ThreadStart threadStart3 = delegate { ProcessTask(); };
        Thread worker3 = new Thread(threadStart3);
        worker3.IsBackground = true;
        worker3.Start();

        ThreadStart threadStart4 = delegate { ProcessTask(); };
        Thread worker4 = new Thread(threadStart4);
        worker4.IsBackground = true;
        worker4.Start();

        //		Thread worker3 = new Thread(ProcessTask);
        //		worker3.Start();

        worker.Join();
        worker2.Join();
        worker3.Join();
        worker4.Join();
        Debug.Log(worker.IsAlive);

        //		Thread.Sleep(1000);
        Debug.Log("WorkDone : " + (System.DateTime.Now - dt));

        //		mainBuffer.WriteBuffer(output.GetAllBytes());
        Debug.Log("Number of reset words: " + count);

        //Merge everything
        foreach(KeyValuePair<int, Task> kvp in completedTasks)
        {
        //			Debug.Log(kvp.Key);
            mainBuffer.WriteBuffer( kvp.Value.buffer.GetAllBytes() );

        }

        // Do the bit alignment of the EOI marker
        if ( bytepos >= 0 )
        {
            BitString fillbits = new BitString();
            fillbits.length = bytepos+1;
            fillbits.value = (1<<(bytepos+1))-1;
            WriteBits(fillbits);
        }

        WriteWord(0xFFD9); //EOI

        //Signal we are done
        isDone = true;
    }
开发者ID:kzoink,项目名称:unity-jpeg-encoder,代码行数:101,代码来源:JPGEncoder.cs


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