mitk::Image::ImageDataItemPointer mitk::Image::GetChannelData_unlocked(int n, void *data, ImportMemoryManagementType importMemoryManagement) const { if(IsValidChannel(n)==false) return nullptr; ImageDataItemPointer ch, vol; ch=m_Channels[n]; if((ch.GetPointer()!=nullptr) && (ch->IsComplete())) return ch; // let's see if all volumes are set, so that we can (could) combine them to a channel if(IsChannelSet_unlocked(n)) { // if there is only one time frame we do not need to combine anything if(m_Dimensions[3]<=1) { vol=GetVolumeData_unlocked(0,n,data,importMemoryManagement); ch=new ImageDataItem(*vol, m_ImageDescriptor, 0, m_ImageDescriptor->GetNumberOfDimensions(), data, importMemoryManagement == ManageMemory); ch->SetComplete(true); } else { const size_t ptypeSize = this->m_ImageDescriptor->GetChannelTypeById(n).GetSize(); ch=m_Channels[n]; // ok, let's combine the volumes! if(ch.GetPointer()==nullptr) ch=new ImageDataItem(this->m_ImageDescriptor, -1, nullptr, true); ch->SetComplete(true); size_t size=m_OffsetTable[m_Dimension-1]*(ptypeSize); unsigned int t; auto slicesIt = m_Slices.begin()+n*m_Dimensions[2]*m_Dimensions[3]; for(t=0;t<m_Dimensions[3];++t) { int posVol; ImageDataItemPointer vol; posVol=GetVolumeIndex(t,n); vol=GetVolumeData_unlocked(t,n,data,importMemoryManagement); if(vol->GetParent()!=ch) { // copy data of volume in channel size_t offset = ((size_t) t)*m_OffsetTable[3]*(ptypeSize); std::memcpy(static_cast<char*>(ch->GetData())+offset, vol->GetData(), size); // REVEIW FIX mitkIpPicDescriptor * pic = vol->GetPicDescriptor(); // replace old volume with reference to channel vol=new ImageDataItem(*ch, m_ImageDescriptor, t, 3, data, importMemoryManagement == ManageMemory, offset); vol->SetComplete(true); //mitkIpFuncCopyTags(vol->GetPicDescriptor(), pic); m_Volumes[posVol]=vol; // get rid of slices - they may point to old volume ImageDataItemPointer dnull=nullptr; for(unsigned int i = 0; i < m_Dimensions[2]; ++i, ++slicesIt) { assert(slicesIt != m_Slices.end()); *slicesIt = dnull; } } } // REVIEW FIX // if(ch->GetPicDescriptor()->info->tags_head==NULL) // mitkIpFuncCopyTags(ch->GetPicDescriptor(), m_Volumes[GetVolumeIndex(0,n)]->GetPicDescriptor()); } return m_Channels[n]=ch; } // channel is unavailable. Can we calculate it? if((GetSource().IsNotNull()) && (GetSource()->Updating()==false)) { // ... wir muessen rechnen!!! .... m_RequestedRegion.SetIndex(0, 0); m_RequestedRegion.SetIndex(1, 0); m_RequestedRegion.SetIndex(2, 0); m_RequestedRegion.SetIndex(3, 0); m_RequestedRegion.SetIndex(4, n); m_RequestedRegion.SetSize(0, m_Dimensions[0]); m_RequestedRegion.SetSize(1, m_Dimensions[1]); m_RequestedRegion.SetSize(2, m_Dimensions[2]); m_RequestedRegion.SetSize(3, m_Dimensions[3]); m_RequestedRegion.SetSize(4, 1); m_RequestedRegionInitialized=true; GetSource()->Update(); // did it work? if(IsChannelSet_unlocked(n)) //yes: now we can call ourselves without the risk of a endless loop (see "if" above) return GetChannelData_unlocked(n,data,importMemoryManagement); else return nullptr; } else { ImageDataItemPointer item = AllocateChannelData_unlocked(n,data,importMemoryManagement); item->SetComplete(true); return item; } }
/* ================ AudioEmitterEx::OnSourceStop ================ */ void AudioEmitterEx::OnSourceStop( int channel ) { if ( IsValidChannel( channel ) ) sndChannels[channel] = OG_NULL; }
void N_ChannelCheck(struct rt_rtmp_adapter *pAd) { /*u8 ChannelNum = pAd->ChannelListNum; */ u8 Channel = pAd->CommonCfg.Channel; if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) { if (Channel > 14) { if ((Channel == 36) || (Channel == 44) || (Channel == 52) || (Channel == 60) || (Channel == 100) || (Channel == 108) || (Channel == 116) || (Channel == 124) || (Channel == 132) || (Channel == 149) || (Channel == 157)) { pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; } else if ((Channel == 40) || (Channel == 48) || (Channel == 56) || (Channel == 64) || (Channel == 104) || (Channel == 112) || (Channel == 120) || (Channel == 128) || (Channel == 136) || (Channel == 153) || (Channel == 161)) { pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; } else { pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; } } else { do { u8 ExtCh; u8 Dir = pAd->CommonCfg.RegTransmitSetting.field. EXTCHA; ExtCh = GetExtCh(Channel, Dir); if (IsValidChannel(pAd, ExtCh)) break; Dir = (Dir == EXTCHA_ABOVE) ? EXTCHA_BELOW : EXTCHA_ABOVE; ExtCh = GetExtCh(Channel, Dir); if (IsValidChannel(pAd, ExtCh)) { pAd->CommonCfg.RegTransmitSetting.field. EXTCHA = Dir; break; } pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; } while (FALSE); if (Channel == 14) { pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; /*pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() */ } } } }