public void ComputeCutTimeBlocks(int viewingIndex) { cutFrameBlocks[viewingIndex] = new BlockFrames(); List <int> currentCut = cut[viewingIndex].frames; currentCut.Sort(); for (int c = 0; c < currentCut.Count; c++) { Block block = new Block(); block.start = currentCut[c]; block.end = currentCut[c] + 1; block.postProcessWarning = (allArcs[viewingIndex].frames[currentCut[c]] != validArcs[viewingIndex].frames[c]); // Used post-process heuristic. block.penalized = extraCosts[viewingIndex].costs[c] > 0; // After applying post-process heuristic, introduced extra cost. cutFrameBlocks[viewingIndex].blocks.Add(block); } }
public void ComputeBlockValidFrames(int viewingDirectionIndex) { List <int> validFrames = GetValidFrames(viewingDirectionIndex); BlockFrames validBlockFrames = new BlockFrames(); validBlockFrames.blocks = new List <Block>(); Block currentBlock = new Block(); bool insideBlock = false; for (int i = 0; i < validFrames.Count; i++) { if (validFrames[i] == 1) { if (!insideBlock) { insideBlock = true; currentBlock = new Block(); currentBlock.start = i; } } else { if (insideBlock) { insideBlock = false; currentBlock.end = i; // Up to but not including i. validBlockFrames.blocks.Add(currentBlock); currentBlock = null; } } } if (insideBlock) { insideBlock = false; currentBlock.end = validFrames.Count; // Up to but not including validFrames.Count. validBlockFrames.blocks.Add(currentBlock); } validFrameBlocks[viewingDirectionIndex] = validBlockFrames; }