Skip to content

Commit

Permalink
Applied suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
asahtik committed Nov 7, 2023
1 parent 437cc34 commit 3d85f9f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/depthai/pipeline/node/VideoEncoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class VideoEncoder : public NodeCRTP<Node, VideoEncoder, VideoEncoderProperties>
Input input{*this, "in", Input::Type::SReceiver, true, 4, true, {{DatatypeEnum::ImgFrame, true}}};

/**
* Outputs ImgFrame message that carries BITSTREAM encoded (MJPEG, H264 or H265) frame data.
* Outputs ImgFrame message that carries BITSTREAM encoded (MJPEG, H264 or H265) frame data. Mutually exclusive with out.
*/
Output bitstream{*this, "bitstream", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}};

/**
* Outputs EncodedFrame message that carries encoded (MJPEG, H264 or H265) frame data.
* Outputs EncodedFrame message that carries encoded (MJPEG, H264 or H265) frame data. Mutually exclusive with bitstream.
*/
Output out{*this, "out", Output::Type::MSender, {{DatatypeEnum::EncodedFrame, false}}};

Expand Down
20 changes: 10 additions & 10 deletions src/pipeline/datatype/EncodedFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,35 @@ bool EncodedFrame::getLossless() const {
}
EncodedFrame::FrameType EncodedFrame::getFrameType() const {
if(frame.type == FrameType::Unknown) {
SliceType frameType;
utility::SliceType frameType;
switch(frame.profile) {
case RawEncodedFrame::Profile::JPEG:
frameType = SliceType::I;
frameType = utility::SliceType::I;
break;
case RawEncodedFrame::Profile::AVC:
frameType = getTypesH264(frame.data, true)[0];
frameType = utility::getTypesH264(frame.data, true)[0];
break;
case RawEncodedFrame::Profile::HEVC:
frameType = getTypesH265(frame.data, true)[0];
frameType = utility::getTypesH265(frame.data, true)[0];
break;
}
switch(frameType) {
case SliceType::P:
case utility::SliceType::P:
frame.type = FrameType::P;
break;
case SliceType::B:
case utility::SliceType::B:
frame.type = FrameType::B;
break;
case SliceType::I:
case utility::SliceType::I:
frame.type = FrameType::I;
break;
case SliceType::SP:
case utility::SliceType::SP:
frame.type = FrameType::P;
break;
case SliceType::SI:
case utility::SliceType::SI:
frame.type = FrameType::I;
break;
case SliceType::Unknown:
case utility::SliceType::Unknown:
frame.type = FrameType::Unknown;
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/utility/H26xParsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <tuple>

namespace dai {
namespace utility {

template <typename T>
struct H26xParser {
Expand Down Expand Up @@ -287,4 +288,5 @@ std::vector<SliceType> getTypesH265(buf& bs, bool breakOnFirst) {
return H265Parser::getTypes(bs, breakOnFirst);
}

} // namespace utility
} // namespace dai
2 changes: 2 additions & 0 deletions src/utility/H26xParsers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
#include <vector>

namespace dai {
namespace utility {

enum class Profile { H264, H265 };
enum class SliceType { P, B, I, SP, SI, Unknown };

std::vector<SliceType> getTypesH264(const std::vector<std::uint8_t>& bs, bool breakOnFirst = false);
std::vector<SliceType> getTypesH265(const std::vector<std::uint8_t>& bs, bool breakOnFirst = false);

} // namespace utility
} // namespace dai

0 comments on commit 3d85f9f

Please sign in to comment.