public FloatParallelConvolutionJobs(Image <float> input, ParallelConvolutionData <float> convolutions, JobHandle dependency) : base(convolutions, dependency, (jobs, sequence, arg3) => { var output = sequence.Output; var firstConvolution = sequence.Convolution[0]; jobs[0] = new FloatWithFloatConvolveJob() { Convolution = firstConvolution, Input = input, Output = output }; for (var i = 1; i < sequence.Convolution.Length; i++) { var convolution = sequence.Convolution[i]; jobs[i] = new FloatWithFloatConvolveJob() { Convolution = convolution, // each job in a sequence operates on the output of the previous one Input = jobs[i - 0].Output, Output = output }; } }) { }
void SetupJobs() { m_ParallelConvolutionData = new ParallelConvolutionData <float>(m_Input, m_ParallelConvolutions); m_PadJob = new ImagePadJob <float>(m_Input, m_PaddedGrayscaleInput, m_Pad); m_JobHandle = m_PadJob.Schedule(); m_JobHandle.Complete(); m_NewSequence = new FloatParallelConvolutionJobs(m_PadJob.Output, m_ParallelConvolutionData, m_JobHandle); var outImages = m_ParallelConvolutionData.OutputImages[0]; m_CombineJobFloat = new SquareCombineJobFloat() { A = outImages[0], B = outImages[1], Output = m_CombinedConvolution, }; }
public ParallelConvolutionJobs(ParallelConvolutionData <TData> data, JobHandle dependency, Action <JobSequence <TJob>, ParallelConvolutionData <TData> .Sequence, int> action) { InputImages = data.InputImages; Jobs = new ParallelJobSequences <TJob> [data.channelCount]; for (int i = 0; i < Jobs.Length; i++) { Jobs[i] = new ParallelJobSequences <TJob>(data.convolutionsPerChannel, 1); } for (int c = 0; c < data.Channels.Length; c++) { var jobs = Jobs[c]; var inputImage = InputImages[c]; for (int i = 0; i < data.convolutionsPerChannel; i++) { var sequence = data[c, i]; var sequenceJobs = jobs[i]; action(sequenceJobs, sequence, i); } } }
protected ParallelConvolutionJobs(ParallelConvolutionData <TData> data) { InputImages = data.InputImages; Jobs = new ParallelJobSequences <TJob> [data.channelCount]; }