1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#include "panoPipeline.hpp"
#include "buffer.hpp"
namespace VideoStitch {
namespace Core {
PanoPipeline::PanoPipeline(PanoStitcherImplBase<StitchOutput>* stitcher,
const std::vector<Input::VideoReader*>& readers, const std::vector<PreProcessor*>& preprocs,
PostProcessor* postproc)
: VideoPipeline(readers, preprocs, postproc), stitcher(stitcher) {}
PanoPipeline::~PanoPipeline() { delete stitcher; }
Potential<PanoPipeline> PanoPipeline::createPanoPipeline(PanoStitcherImplBase<StitchOutput>* stitcher,
const std::vector<Input::VideoReader*>& readers,
const std::vector<PreProcessor*>& preprocs,
PostProcessor* postproc) {
PanoPipeline* ret = new PanoPipeline(stitcher, readers, preprocs, postproc);
Status initStatus = ret->init();
if (!initStatus.ok()) {
delete ret;
ret = nullptr;
return initStatus;
}
return ret;
}
Status PanoPipeline::stitch(mtime_t date, FrameRate frameRate,
std::map<readerid_t, Input::PotentialFrame>& inputBuffers, Output* output) {
std::vector<ExtractOutput*> ext;
return stitchAndExtract(date, frameRate, inputBuffers, output, ext, nullptr);
}
Status PanoPipeline::stitchAndExtract(mtime_t date, FrameRate frameRate,
std::map<readerid_t, Input::PotentialFrame>& inputBuffers, Output* output,
std::vector<ExtractOutput*> extracts, AlgorithmOutput* algo) {
FAIL_RETURN(extract(date, frameRate, inputBuffers, extracts, algo));
return stitcher->stitch(date, frameRate.timestampToFrame(date), postproc, inputBuffers, readers, preprocs, output);
}
Status PanoPipeline::setup(const ImageMergerFactory& mergerFactory, const ImageWarperFactory& warperFactory,
const ImageFlowFactory& flowFactory, const StereoRigDefinition*) {
return stitcher->setup(mergerFactory, warperFactory, flowFactory, readers);
}
} // namespace Core
} // namespace VideoStitch