34 lines
843 B
C++
34 lines
843 B
C++
#include "tbb/pipeline.h"
|
|
|
|
#include "pipeline.hh"
|
|
#include "filterSample/grey.hh"
|
|
|
|
Pipeline::Pipeline(std::list<VideoReader> input, VideoWriter output)
|
|
: input_(input), output_(output)
|
|
{
|
|
this->pipeline_.add_filter(this->input_.front());
|
|
}
|
|
|
|
bool Pipeline::add_filter(std::string filter)
|
|
{
|
|
if (filter == "grey" || filter == "gray")
|
|
this->pipeline_.add_filter(*(new Grey()));
|
|
else
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
void Pipeline::run()
|
|
{
|
|
int minframe = this->input_.front().framecount_get();
|
|
for (auto it = this->input_.begin(); it != this->input_.end(); ++it)
|
|
if (minframe > it->framecount_get())
|
|
minframe = it->framecount_get();
|
|
for (auto it = this->input_.begin(); it != this->input_.end(); ++it)
|
|
it->maxframe_set(minframe);
|
|
|
|
this->pipeline_.add_filter(this->output_);
|
|
this->pipeline_.run(CHUNK_SIZE);
|
|
}
|