00001 #ifndef Impala_Core_VideoJob_StageScheme_h 00002 #define Impala_Core_VideoJob_StageScheme_h 00003 00004 #include "Basis/ILog.h" 00005 #include "Core/VideoJob/StepScheme.h" 00006 00007 namespace Impala 00008 { 00009 namespace Core 00010 { 00011 namespace VideoJob 00012 { 00013 00014 /*********************************************************************** 00015 An instance of this class represents a scheme of processing stages 00016 for the processing of video collections. A stage scheme consists of 00017 a sequence of stages. A stage defines a range of steps that have to be 00018 performed sequentially. Subsequent stages will differ in that they apply 00019 to processing of either individual videos or the video set as a whole 00020 (collectively). 00021 ************************************************************************/ 00022 00023 class StageScheme 00024 { 00025 00026 public: 00027 00028 typedef struct Stage 00029 { 00030 int firstStepNr; 00031 int lastStepNr; 00032 bool isIndiv; 00033 } Stage; 00034 00035 typedef StepScheme::Step Step; 00036 00037 StageScheme(const StepScheme& processingScheme) 00038 { 00039 int nrOfSteps = processingScheme.Size(); 00040 if (nrOfSteps > 0) 00041 { 00042 bool stageIsIndiv = processingScheme.GetStep(0).isIndiv; 00043 Stage stage = {0, 0, stageIsIndiv}; 00044 for (int i = 1; i < nrOfSteps; i++) 00045 { 00046 Step step = processingScheme.GetStep(i); 00047 if (!step.isIndiv || !stageIsIndiv) 00048 { // non-indiv. stages have only one step 00049 mStages.push_back(stage); 00050 stage.firstStepNr = i; 00051 stageIsIndiv = step.isIndiv; 00052 stage.isIndiv = stageIsIndiv; 00053 } 00054 stage.lastStepNr = i; 00055 } 00056 mStages.push_back(stage); 00057 } 00058 } 00059 00060 int 00061 Size() 00062 { 00063 return mStages.size(); 00064 } 00065 00066 bool 00067 IsIndivStage(int stageNr) 00068 { 00069 return mStages[stageNr].isIndiv; 00070 } 00071 00072 bool 00073 IsLastStepOfStage(int stepNr, int stageNr) 00074 { 00075 return (stepNr == mStages[stageNr].lastStepNr); 00076 } 00077 00078 int 00079 FirstStepOfStage(int stageNr) 00080 { 00081 return (mStages[stageNr].firstStepNr); 00082 } 00083 00084 int 00085 FirstStageNr() 00086 { 00087 return 0; 00088 } 00089 00090 00091 private: 00092 00093 ILOG_VAR_DECL; 00094 00095 std::vector<Stage> mStages; 00096 00097 }; // class 00098 00099 ILOG_VAR_INIT(StageScheme, Impala.Core.VideoJob); 00100 00101 } // namespace 00102 } // namespace 00103 } // namespace 00104 00105 #endif