gframe.cpp
1.27 KB
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
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2020 Intel Corporation
#include "precomp.hpp"
#include <opencv2/gapi/gframe.hpp>
#include <opencv2/gapi/media.hpp>
#include "api/gorigin.hpp"
// cv::GFrame public implementation //////////////////////////////////////////////
cv::GFrame::GFrame()
: m_priv(new GOrigin(GShape::GFRAME, GNode::Param())) {
}
cv::GFrame::GFrame(const GNode &n, std::size_t out)
: m_priv(new GOrigin(GShape::GFRAME, n, out)) {
}
cv::GOrigin& cv::GFrame::priv() {
return *m_priv;
}
const cv::GOrigin& cv::GFrame::priv() const {
return *m_priv;
}
namespace cv {
bool GFrameDesc::operator== (const GFrameDesc &rhs) const {
return fmt == rhs.fmt && size == rhs.size;
}
GFrameDesc descr_of(const cv::MediaFrame &frame) {
return frame.desc();
}
std::ostream& operator<<(std::ostream& os, const cv::GFrameDesc &d) {
os << '[';
switch (d.fmt) {
case MediaFormat::BGR: os << "BGR"; break;
case MediaFormat::NV12: os << "NV12"; break;
default: GAPI_Assert(false && "Invalid media format");
}
os << ' ' << d.size << ']';
return os;
}
} // namespace cv