Пример #1
0
 public PixelsMap(MergingMethod stMergingMethod, Area stArea, Format ePixelFormat, bool bIsBTLBackground)
 {
     this.stMergingMethod = stMergingMethod;
     if (bIsBTLBackground)
     {
         if (stMergingMethod.eDeviceType == MergingDevice.CUDA)
         {
             _nIndexTriple = (byte)_nIndexTripleMax;
             System.Threading.Interlocked.Increment(ref _nIndexTripleMax);
         }
         else
         {
             _nIndexTriple        = byte.MaxValue;
             _nIndexTripleCurrent = byte.MaxValue;
         }
         (new Logger()).WriteDebug("background pixelmap created [tripindex=" + _nIndexTriple + "]");
     }
     if (!_ahMergingHash_CommandsQueue.ContainsKey(stMergingMethod.nHash))
     {
         _ahMergingHash_CommandsQueue.Add(stMergingMethod.nHash, new ThreadBufferQueue <Command>(0, false));
         System.Threading.Thread cThreadWorker = null;
         if (stMergingMethod.eDeviceType == MergingDevice.CUDA)
         {
             if (1 > Preferences.nCUDAVersion)
             {
                 throw new Exception("There is no CUDA version in preferences");
             }
             //cThreadWorker = new System.Threading.Thread(() => CUDAWorker(stMergingMethod.nHash));
             new CUDAWorkers(stMergingMethod.nHash);
         }
         else if (stMergingMethod.eDeviceType == MergingDevice.DisComExternal)
         {
             //cThreadWorker = new System.Threading.Thread(() => DisComExternalWorker(stMergingMethod.nHash));
             new DisComExternalWorkers(stMergingMethod.nHash);
         }
         if (null != cThreadWorker)
         {
             cThreadWorker.IsBackground = true;
             cThreadWorker.Priority     = System.Threading.ThreadPriority.AboveNormal;
             cThreadWorker.Start();
         }
     }
     _dtCreate      = DateTime.Now;
     _bTemp         = false;
     _bProcessing   = false;
     _bDisposed     = false;
     _nID           = 0;
     nAlphaConstant = byte.MaxValue;
     bKeepAlive     = false;
     _cException    = null;
     _ePixelFormat  = ePixelFormat;
     _stArea        = stArea;
     _nBytesQty     = (uint)(_stArea.nWidth * _stArea.nHeight * Math.Abs((int)((int)ePixelFormat / 100)) / 8);
     _cSyncRoot     = new object();
     _cTiming       = new helpers.Logger.Timings("pixelsmap");
     _cTiming.TurnOff();
 }
Пример #2
0
 public Triple(MergingMethod stMergingMethod, Area stArea, Format ePixelFormat, bool bKeepAlive, AddToDisposeBTL dAddToDisposeBTL)
 {
     _dAddToDisposeBTL = dAddToDisposeBTL;
     _bFirstTime       = true;
     _stMergingMethod  = stMergingMethod;
     _oLock            = new object();
     aPMs = new PixelsMap[_nMaxTripleIndex];
     for (int nI = 0; nI < aPMs.Length; nI++)
     {
         aPMs[nI]               = new PixelsMap(stMergingMethod, stArea, ePixelFormat);
         aPMs[nI].bKeepAlive    = bKeepAlive;
         aPMs[nI]._nIndexTriple = (byte)nI;
     }
     _nCurrentPM = 0;
 }
Пример #3
0
 public PixelsMap(MergingMethod stMergingMethod, Area stArea, Format ePixelFormat)
     : this(stMergingMethod, stArea, ePixelFormat, false)
 {
 }