Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw img frame types #116

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 33 additions & 32 deletions include/depthai-shared/datatype/RawImgFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,52 +46,55 @@ struct RawImgFrame : public RawBuffer {
NONE
};

static constexpr int typeToBpp(Type type) {
static constexpr float typeToBpp(Type type) {
switch(type) {
case Type::YUV422p:
return 2;
break;
case Type::YUV422i:
return 1;
return 2;
break;
case Type::YUV444p:
return 1;
return 3;
break;
case Type::YUV420p:
return 1;
case Type::YUV444i:
return 3;
break;
case Type::YUV422p:
return 1;
case Type::YUV420p:
return 1.5f;
break;
case Type::YUV400p:
return 1;
return 1.5f;
break;
case Type::RGBA8888:
return 1;
return 4;
break;
case Type::RGB161616:
return 2;
return 6;
break;
case Type::RGB888p:
return 1;
break;
case Type::BGR888p:
return 1;
return 3;
break;
case Type::RGB888i:
return 1;
return 3;
break;
case Type::BGR888p:
return 3;
break;
case Type::BGR888i:
return 1;
return 3;
break;
case Type::RGBF16F16F16p:
return 2;
break;
case Type::BGRF16F16F16p:
return 2;
return 6;
break;
case Type::RGBF16F16F16i:
return 2;
return 6;
break;
case Type::BGRF16F16F16p:
return 6;
break;
case Type::BGRF16F16F16i:
return 2;
return 6;
break;
case Type::GRAY8:
return 1;
Expand All @@ -100,13 +103,13 @@ struct RawImgFrame : public RawBuffer {
return 2;
break;
case Type::LUT2:
return 1;
return 0.125f;
break;
case Type::LUT4:
return 1;
return 0.25f;
break;
case Type::LUT16:
return 1;
return 0.5f;
break;
case Type::RAW16:
return 2;
Expand All @@ -124,19 +127,16 @@ struct RawImgFrame : public RawBuffer {
return 1;
break;
case Type::PACK10:
return 2;
return 1.25f;
break;
case Type::PACK12:
return 2;
break;
case Type::YUV444i:
return 1;
return 1.5f;
break;
case Type::NV12:
return 1;
return 1.5f;
break;
case Type::NV21:
return 1;
return 1.5f;
break;
case Type::BITSTREAM:
return 1;
Expand Down Expand Up @@ -179,6 +179,7 @@ struct RawImgFrame : public RawBuffer {
int64_t sequenceNum = 0; // increments for each frame
Timestamp ts = {}; // generation timestamp, synced to host time
Timestamp tsDevice = {}; // generation timestamp, direct device monotonic clock
dai::FrameEvent event = dai::FrameEvent::NONE;

void serialize(std::vector<std::uint8_t>& metadata, DatatypeEnum& datatype) const override {
metadata = utility::serialize(*this);
Expand Down