Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinyu Li authored and Xinyu Li committed Aug 6, 2024
1 parent 888fc5f commit 1827e3f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
15 changes: 14 additions & 1 deletion src/bb/image-io/gendc_separator/ComponentHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,23 @@ class ComponentHeader : public Header{
return *this;
}

int getGroupID(){
int64_t getGroupID(){
return GroupId_;
}

int64_t getTypeId(){
return TypeId_;
}

int16_t getSourceId(){
return SourceId_;
}

int16_t getPartCount(){
return PartCount_;
}


size_t GenerateDescriptor(char* ptr, size_t offset=0){
offset = GenerateHeader(ptr, offset);

Expand Down
16 changes: 15 additions & 1 deletion src/bb/image-io/gendc_separator/ContainerHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,24 @@ class ContainerHeader : public Header{
return *this;
}

ComponentHeader getComponentByIndex(int ith_component_index){
ComponentHeader getComponentByIndex(int ith_component_index){
return component_header_[ith_component_index];
}

int32_t getFirstComponentIndexByTypeID(int64_t type_id){
int cnt = 0;
for (ComponentHeader &ch : component_header_){
if (ch.isComponentValid()){
if (type_id==ch.getTypeId()){
return cnt;
}
}
++cnt;
}
return -1;
}


int32_t getDescriptorSize(){
return DescriptorSize_;
}
Expand Down
18 changes: 14 additions & 4 deletions src/bb/image-io/rt_u3v.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "gendc_separator/ContainerHeader.h"
#include "gendc_separator/tools.h"

#define ComponentIDIntensity 1
#ifdef _WIN32
#define GOBJECT_FILE "gobject-2.0-0"
#define ARAVIS_FILE "aravis-0.8-0"
Expand Down Expand Up @@ -975,8 +976,6 @@ class U3VRealCam: public U3V{

if(isGenDC(buffer)){
gendc_descriptor_= ContainerHeader(buffer);
std::cout<<"Group id is"<<gendc_descriptor_.getComponentByIndex(0).getGroupID()<<std::endl;
group_id = gendc_descriptor_.getComponentByIndex(0).getGroupID();
std::tuple<int32_t, int32_t> data_comp_and_part = gendc_descriptor_.getFirstAvailableDataOffset(true);
if (std::get<0>(data_comp_and_part) == -1){
devices_[i].is_data_image_ = false;
Expand All @@ -992,6 +991,13 @@ class U3VRealCam: public U3V{
if (frame_count_method_ == FrameCountMethod::TYPESPECIFIC3){
devices_[i].framecount_offset_ = gendc_descriptor_.getOffsetFromTypeSpecific(std::get<0>(data_comp_and_part), std::get<1>(data_comp_and_part), 3, 0);
}

int32_t image_component_index = gendc_descriptor_.getFirstComponentIndexByTypeID(ComponentIDIntensity);
if (image_component_index == -1){
throw ::std::runtime_error("No available component found");
}
ComponentHeader image_component = gendc_descriptor_.getComponentByIndex(image_component_index);
group_id = gendc_descriptor_.getComponentByIndex(image_component_index).getGroupID();
}
free(buffer);
}else{
Expand Down Expand Up @@ -1457,8 +1463,6 @@ class U3VGenDC: public U3V{

if(isGenDC(buffer)){
gendc_descriptor_= ContainerHeader(buffer);
std::cout<<"Group id is"<<gendc_descriptor_.getComponentByIndex(0).getGroupID()<<std::endl;
group_id = gendc_descriptor_.getComponentByIndex(0).getGroupID();
std::tuple<int32_t, int32_t> data_comp_and_part = gendc_descriptor_.getFirstAvailableDataOffset(true);
if (std::get<0>(data_comp_and_part) == -1){
devices_[i].is_data_image_ = false;
Expand All @@ -1474,6 +1478,12 @@ class U3VGenDC: public U3V{
if (frame_count_method_ == FrameCountMethod::TYPESPECIFIC3){
devices_[i].framecount_offset_ = gendc_descriptor_.getOffsetFromTypeSpecific(std::get<0>(data_comp_and_part), std::get<1>(data_comp_and_part), 3, 0);
}
int32_t image_component_index = gendc_descriptor_.getFirstComponentIndexByTypeID(ComponentIDIntensity);
if (image_component_index == -1){
throw ::std::runtime_error("No available component found");
}
ComponentHeader image_component = gendc_descriptor_.getComponentByIndex(image_component_index);
group_id = gendc_descriptor_.getComponentByIndex(image_component_index).getGroupID();
}
free(buffer);
}else{
Expand Down

0 comments on commit 1827e3f

Please sign in to comment.