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
56
57
58
59
60
61
62
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "textureTarget.hpp"
#include "gpu/hostBuffer.hpp"
#include "gpu/uniqueBuffer.hpp"
#include "libvideostitch/input.hpp"
#include "libvideostitch/output.hpp"
#include "libvideostitch/panoDef.hpp"
#include <vector>
namespace VideoStitch {
namespace Core {
/**
* @brief The InputsMap class manage computation and storage of the inputs map
* This inputs map contains for each pixel of the destination cubemap the list of inputs which are used to produce it.
*/
class InputsMapCubemap {
public:
static Potential<InputsMapCubemap> create(const PanoDefinition &pano);
virtual ~InputsMapCubemap();
public:
Status compute(const std::map<readerid_t, Input::VideoReader *> &, const PanoDefinition &);
GPU::Buffer<uint32_t> getMask(TextureTarget t) {
switch (t) {
case CUBE_MAP_POSITIVE_X:
return xPos.borrow();
case CUBE_MAP_NEGATIVE_X:
return xNeg.borrow();
case CUBE_MAP_POSITIVE_Y:
return yPos.borrow();
case CUBE_MAP_NEGATIVE_Y:
return yNeg.borrow();
case CUBE_MAP_POSITIVE_Z:
return zPos.borrow();
case CUBE_MAP_NEGATIVE_Z:
return zNeg.borrow();
default:
assert(false);
return xPos.borrow();
}
}
private:
explicit InputsMapCubemap(const PanoDefinition &pano);
Status allocateBuffers();
GPU::UniqueBuffer<uint32_t> xPos, xNeg, yPos, yNeg, zPos, zNeg;
int64_t length;
};
} // namespace Core
} // namespace VideoStitch