public void Cleanup() { JumpStartPage = null; JumpLastPage = null; JumpNextPage = null; JumpEndPage = null; DuplicateSelectModeChanged = null; JudgeModeChanged = null; ApplyFilter = null; RemoveSite = null; AddSite = null; RemoveHBin = null; AddHBin = null; RemoveSBin = null; AddSBin = null; _filter = null; _dataAcquire = null; Data = null; AllSites = null; AllHBins = null; AllSBins = null; EnabledSites = null; EnabledHBins = null; EnabledSBins = null; JudgeMode = null; DuplicateMode = null; GC.Collect(); }
public int Open(FilterSetup setup) { _dx?.RemoveRef(); _dx = setup.DirectXContext.AddRef(); var setupInput = setup.InputSetups[0].FilterSpec; _uploader = DirectXUploader.Create(_dx, setupInput.pix_fmt, setupInput.width, setupInput.height); return(0); }
public FilterData(FilterSetup filterSetup, int chipsCount, int itemsCount) { Filter = filterSetup; ChipFilter = new bool[chipsCount]; ItemFilter = new bool[itemsCount]; SitesSummary = new Dictionary <byte, IChipSummary>(); Summary = null; StatisticList = new Dictionary <TestID, IItemStatistic>(); }
public int Open(FilterSetup setup) { _dx?.RemoveRef(); _dx = setup.DirectXContext.AddRef(); var setupInput = setup.InputSetups[0].FilterSpec; _transform = DirectXTransformer.Create(_dx, setup.OutputSpec.pix_fmt, setupInput.width, setupInput.height); return(0); }
public void UpdateItemFilter(FilterSetup filter, ref bool[] itemsFilter) { for (int i = 0; i < _testItems.Count; i++) { if (filter.maskTestIDs.Contains(_testItems.Keys.ElementAt(i))) { itemsFilter[i] = true; } } }
public int Open(FilterSetup filterSetup) { var inputSpecs = filterSetup.InputSetups.Select(s => s.FilterSpec).ToArray(); _inputs = inputSpecs.Length; int res = FilterContext_Open(_handle, ref inputSpecs[0], inputSpecs.Length, ref filterSetup.OutputSpec, Core.StringToBytes(filterSetup.FilterSpec)); _opened = res >= 0; return(res); }
public int Open(FilterSetup setup) { _dx?.RemoveRef(); _dx = setup.DirectXContext.AddRef(); var setupInput = setup.InputSetups[0].FilterSpec; _width = setupInput.width; _height = setupInput.height; return(0); }
private void CreateDefaultFilters() { CreateFilter("Full File"); foreach (var v in _sites) { FilterSetup f = new FilterSetup("Site:" + v.Key); f.EnableSingleSite(_sites.Keys.ToList(), v.Key); CreateFilter(f); } }
public void UpdateFilter(int filterId, FilterSetup newFilter) { _testChips.UpdateChipFilter(newFilter, ref _filterList[filterId].ChipFilter); _testItems.UpdateItemFilter(newFilter, ref _filterList[filterId].ItemFilter); _testChips.UpdateSummaryFiltered(_filterList[filterId].ChipFilter, ref _filterList[filterId].SitesSummary); _filterList[filterId].Summary = ChipSummary.Combine(_filterList[filterId].SitesSummary); foreach (var t in GetFilteredTestIDs_Info(filterId)) { //if(_filterList[filterId].StatisticList.ContainsKey(t.Key)) _filterList[filterId].StatisticList[t.Key] = new ItemStatistic(GetFilteredItemData(t.Key, filterId), t.Value.LoLimit, t.Value.HiLimit); //else // _filterList[filterId].StatisticList.Add(t.Key, new ItemStatistic(GetFilteredItemData(t.Key, filterId), t.Value.LoLimit, t.Value.HiLimit)); } }
public int CreateFilter(FilterSetup filter) { int key = System.DateTime.UtcNow.Ticks.GetHashCode(); while (_filterList.ContainsKey(key)) { key++; } _filterList.Add(key, new FilterData(filter, _testChips.ChipsCount, _testItems.ItemsCount)); _testChips.UpdateChipFilter(filter, ref _filterList[key].ChipFilter); _testItems.UpdateItemFilter(filter, ref _filterList[key].ChipFilter); _testChips.UpdateSummaryFiltered(_filterList[key].ChipFilter, ref _filterList[key].SitesSummary); _filterList[key].Summary = ChipSummary.Combine(_filterList[key].SitesSummary); foreach (var t in GetFilteredTestIDs_Info(key)) { _filterList[key].StatisticList.Add(t.Key, new ItemStatistic(GetFilteredItemData(t.Key, key), t.Value.LoLimit, t.Value.HiLimit)); } return(key); }
public static FromPool <Frame> CreateFrameFFMpeg(FixedFrameData data, FixedFrameConfig config, IStreamerBase streamer) { DecoderContextFFMpeg decoder = null; FilterContextFFMpeg filter = null; Packet packet = null; Frame decodedFrame = null; Frame filteredFrame = null; Frame result = null; try { decoder = new DecoderContextFFMpeg(); int codecId = 0; int pix_fmt = 0; switch (data.Type) { case SingleFrameType.Png: codecId = Core.Const.CODEC_ID_PNG; pix_fmt = Core.Const.PIX_FMT_RGBA; break; case SingleFrameType.Jpg: codecId = Core.Const.CODEC_ID_MJPEG; pix_fmt = Core.Const.PIX_FMT_YUVJ422P; break; default: throw new NotSupportedException(); } var decoderSetup = new DecoderSetup(DecoderContextFFMpeg.Type, new CodecProperties { codec_id = codecId, format = pix_fmt }, null); Core.Checked(decoder.Open(decoderSetup), "Open decoder failed"); packet = streamer.PacketPool.Rent(); packet.InitFromBuffer(data.Buffer, Core.GetCurrentTime()); Core.Checked(decoder.Write(packet), "Write packet to decoder"); decodedFrame = streamer.FramePool.Rent(); Core.Checked((int)decoder.Read(decodedFrame), "Read frame from decoder"); var desiredWidth = config.Width; var desiredHeight = config.Height; string filterSpec = desiredWidth == decodedFrame.Properties.Width && desiredHeight == decodedFrame.Properties.Height ? "null" : $"scale=w={desiredWidth}:h={desiredHeight}"; filter = new FilterContextFFMpeg(); var filterSetup = new FilterSetup { Type = FilterContextFFMpeg.Type, FilterSpec = $"[in0]{filterSpec}[out]", InputSetups = new[] { new FilterInputSetup(new FilterInputSpec { width = decodedFrame.Properties.Width, height = decodedFrame.Properties.Height, pix_fmt = decodedFrame.Properties.Format, sample_aspect_ratio = new AVRational { num = 1, den = 1 }, time_base = new AVRational { num = 1, den = 1000 }, color_range = decoder.Config.CodecProperties.color_range, BestQuality = 1 }) }, OutputSpec = new FilterOutputSpec { pix_fmt = config.PixelFormat } }; Core.Checked(filter.Open(filterSetup), "Failed to create filter"); Core.Checked(filter.Write(decodedFrame, 0), "Write frame to filter"); filteredFrame = streamer.FramePool.Rent(); Core.Checked((int)filter.Read(filteredFrame), "Read frame from filter"); result = filteredFrame; filteredFrame = null; } catch (Exception e) { Core.LogError(e, $"Failed to precreate image {data.DataId}"); } decoder?.Dispose(); filter?.Dispose(); streamer.PacketPool.Back(packet); streamer.FramePool.Back(decodedFrame); streamer.FramePool.Back(filteredFrame); if (result == null) { return(null); } return(new FromPool <Frame>(result, streamer.FramePool)); }
public void UpdateChipFilter(FilterSetup filter, ref bool[] chipsFilter) { if (!filter.ifmaskDuplicateChips && filter.DuplicateSelectMode == DuplicateSelectMode.AllDuplicate) { for (int i = 0; i < _testChips.Count; i++) { chipsFilter[i] = true; } } else { for (int i = 0; i < _testChips.Count; i++) { chipsFilter[i] = false; } } for (int i = 0; i < _testChips.Count; i++) { //init if (!filter.ifmaskDuplicateChips && filter.DuplicateSelectMode == DuplicateSelectMode.AllDuplicate) { for (int j = i + 1; j < _testChips.Count; j++) { if (filter.DuplicateJudgeMode == DuplicateJudgeMode.ID) { if (_testChips[i].PartId == _testChips[j].PartId) { chipsFilter[i] = false; chipsFilter[j] = false; } } else { if (_testChips[i].WaferCord == _testChips[j].WaferCord) { chipsFilter[i] = false; chipsFilter[j] = false; } } } } if (!filter.ifMaskOrEnableIds) { if (filter.maskChips.Contains(_testChips[i].PartId)) { chipsFilter[i] = true; continue; } } else { if (!filter.maskChips.Contains(_testChips[i].PartId)) { chipsFilter[i] = true; continue; } } if (!filter.ifMaskOrEnableCords) { //cords if (filter.maskCords.Contains(_testChips[i].WaferCord)) { chipsFilter[i] = true; continue; } } else { if (!filter.maskCords.Contains(_testChips[i].WaferCord)) { chipsFilter[i] = true; continue; } } //site if (filter.maskSites.Contains(_testChips[i].Site)) { chipsFilter[i] = true; continue; } //softbin if (filter.maskSoftBins.Contains(_testChips[i].SoftBin)) { chipsFilter[i] = true; continue; } //hardbin if (filter.maskHardBins.Contains(_testChips[i].HardBin)) { chipsFilter[i] = true; continue; } } if (filter.ifmaskDuplicateChips) { //dupicate chip if (filter.DuplicateSelectMode == DuplicateSelectMode.SelectFirst) { for (int i = 0; i < _testChips.Count; i++) { for (int j = i + 1; j < _testChips.Count; j++) { if (filter.DuplicateJudgeMode == DuplicateJudgeMode.ID) { if (_testChips[i].PartId == _testChips[j].PartId) { chipsFilter[j] = true; } } else { if (_testChips[i].WaferCord == _testChips[j].WaferCord) { chipsFilter[j] = true; } } } } } else if (filter.DuplicateSelectMode == DuplicateSelectMode.SelectLast) { for (int i = _testChips.Count - 1; i >= 0; i--) { for (int j = i - 1; j >= 0; j--) { if (filter.DuplicateJudgeMode == DuplicateJudgeMode.ID) { if (_testChips[i].PartId == _testChips[j].PartId) { chipsFilter[j] = true; } } else { if (_testChips[i].WaferCord == _testChips[j].WaferCord) { chipsFilter[j] = true; } } } } } else { for (int i = 0; i < _testChips.Count; i++) { for (int j = i + 1; j < _testChips.Count; j++) { if (filter.DuplicateJudgeMode == DuplicateJudgeMode.ID) { if (_testChips[i].PartId == _testChips[j].PartId) { chipsFilter[j] = true; chipsFilter[i] = true; } } else { if (_testChips[i].WaferCord == _testChips[j].WaferCord) { chipsFilter[j] = true; chipsFilter[i] = true; } } } } } } }
public int Open(FilterSetup setup) { return(0); }
public DataGridTabViewModel(IDataAcquire dataAcquire, int filterId, int tag) { _filterId = filterId; Tag = tag; _dataAcquire = dataAcquire; _filter = _dataAcquire.GetFilterSetup(_filterId); _duplicateSelectMode = DuplicateSelectMode.SelectFirst; _judgeMode = DuplicateJudgeMode.ID; if (_dataAcquire.FileName.Length > 15) { TabTitle = _dataAcquire.FileName.Substring(0, 15) + "..."; } else { TabTitle = _dataAcquire.FileName; } FilePath = _dataAcquire.FilePath; CountPerPage = DefaultPerPageCount; TotalCount = _dataAcquire.GetFilteredChipSummary(_filterId).TotalCount; TotalPages = TotalCount / CountPerPage + 1; CurrentPageIndex = 1; UpdateDataToStartPage(); AllSites = new ObservableCollection <byte>(_dataAcquire.GetSites()); AllHBins = new ObservableCollection <ushort>(_dataAcquire.GetHardBins()); AllSBins = new ObservableCollection <ushort>(_dataAcquire.GetSoftBins()); EnabledSites = new ObservableCollection <byte>(AllSites.Except(_filter.maskSites)); EnabledHBins = new ObservableCollection <ushort>(AllHBins.Except(_filter.maskHardBins)); EnabledSBins = new ObservableCollection <ushort>(AllSBins.Except(_filter.maskSoftBins)); ifmaskDuplicateChips = _filter.ifmaskDuplicateChips; DuplicateMode = new List <string>(); DuplicateMode.Add(DuplicateSelectMode.SelectFirst.ToString()); DuplicateMode.Add(DuplicateSelectMode.SelectLast.ToString()); DuplicateMode.Add(DuplicateSelectMode.AllDuplicate.ToString()); JudgeMode = new List <string>(); JudgeMode.Add(DuplicateJudgeMode.ID.ToString()); JudgeMode.Add(DuplicateJudgeMode.Cord.ToString()); MaskEnableCords = ""; MaskEnableChips = ""; JumpStartPage = new DelegateCommand(() => { UpdateDataToStartPage(); }); JumpLastPage = new DelegateCommand(() => { UpdateDataToLastPage(); }); JumpNextPage = new DelegateCommand(() => { UpdateDataToNextPage(); }); JumpEndPage = new DelegateCommand(() => { UpdateDataToEndPage(); }); ClearIDs = new DelegateCommand(() => { MaskEnableChips = ""; RaisePropertyChanged("MaskEnableChips"); }); ClearCords = new DelegateCommand(() => { MaskEnableCords = ""; RaisePropertyChanged("MaskEnableCords"); }); ExportToExcel = new DelegateCommand(() => { ExportToExcelAction(); }); RemoveSite = new DelegateCommand <MouseButtonEventArgs>((e) => { var v = ((ListBox)(e.Source)); if (v.Items.Count > 1 && v.SelectedIndex >= 0) { EnabledSites.RemoveAt(v.SelectedIndex); } }); AddSite = new DelegateCommand <MouseButtonEventArgs>((e) => { var v = ((ListBox)(e.Source)); if (v.SelectedIndex >= 0 && !EnabledSites.Contains((byte)v.SelectedItem)) { EnabledSites.Add((byte)v.SelectedItem); } }); RemoveHBin = new DelegateCommand <MouseButtonEventArgs>((e) => { var v = ((ListBox)(e.Source)); if (v.Items.Count > 1 && v.SelectedIndex >= 0) { EnabledHBins.RemoveAt(v.SelectedIndex); } }); AddHBin = new DelegateCommand <MouseButtonEventArgs>((e) => { var v = ((ListBox)(e.Source)); if (v.SelectedIndex >= 0 && !EnabledHBins.Contains((ushort)v.SelectedItem)) { EnabledHBins.Add((ushort)v.SelectedItem); } }); RemoveSBin = new DelegateCommand <MouseButtonEventArgs>((e) => { var v = ((ListBox)(e.Source)); if (v.Items.Count > 1 && v.SelectedIndex >= 0) { EnabledSBins.RemoveAt(v.SelectedIndex); } }); AddSBin = new DelegateCommand <MouseButtonEventArgs>((e) => { var v = ((ListBox)(e.Source)); if (v.SelectedIndex >= 0 && !EnabledSBins.Contains((ushort)v.SelectedItem)) { EnabledSBins.Add((ushort)v.SelectedItem); } }); DuplicateSelectModeChanged = new DelegateCommand <SelectionChangedEventArgs>((e) => { var v = ((ComboBox)e.Source).SelectedItem; _duplicateSelectMode = (DuplicateSelectMode)Enum.Parse(typeof(DuplicateSelectMode), v.ToString()); }); JudgeModeChanged = new DelegateCommand <SelectionChangedEventArgs>((e) => { var v = ((ComboBox)e.Source).SelectedItem; _judgeMode = (DuplicateJudgeMode)Enum.Parse(typeof(DuplicateJudgeMode), v.ToString()); }); ApplyFilter = new DelegateCommand(() => { UpdateFilter(); }); CreateHistogram = new DelegateCommand <RoutedEventArgs>((e) => { ; }); }