From e0761082b3e084782707797ab30ebb7d36351990 Mon Sep 17 00:00:00 2001 From: Xinyu Li Date: Tue, 16 Jul 2024 11:23:14 -0700 Subject: [PATCH 1/3] migrate to official aravis --- example/u3v_fake.cc | 16 ++++++++-------- src/bb/image-io/rt_u3v.h | 26 ++++++++++++++------------ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/example/u3v_fake.cc b/example/u3v_fake.cc index ec49e45b..490593b7 100644 --- a/example/u3v_fake.cc +++ b/example/u3v_fake.cc @@ -55,16 +55,17 @@ int main(int argc, char *argv[]) std::vector< int > buf_size = std::vector < int >{ width, height}; - std::vector> output; + std::vector> outputs; + std::vector> frame_counts; for (int i = 0; i < num_device; ++i){ - output.push_back(Halide::Buffer(buf_size)); + outputs.push_back(Halide::Buffer(buf_size)); + frame_counts.push_back(Halide::Buffer(1)); } - n["output"].bind(output); - Buffer frame_count(1); - n["frame_count"].bind(frame_count); + n["output"].bind(outputs); + n["frame_count"].bind(frame_counts); - // Obtain image data continuously for 100 frames to facilitate operation check. + // Obtain image data int user_input = -1; while(user_input == -1) { @@ -75,12 +76,11 @@ int main(int argc, char *argv[]) // Depends on sensor image pixel format, apply bit shift on images // Display the image for (int i = 0;imessage); } char* buffer; buffer = (char*) malloc(gendc_desc_size); - arv_device_get_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); + arv_device_set_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); if (err_) { throw std::runtime_error(err_->message); } @@ -1453,14 +1455,14 @@ class U3VGenDC: public U3V{ // Check each parameters for GenDC device ========================== if (is_gendc_){ log::info("\tDevice/USB {}::{} : {}", i, "GenDC", "Available"); - uint64_t gendc_desc_size = arv_device_get_register_feature_length(devices_[i].device_, "GenDCDescriptor", &err_); + uint64_t gendc_desc_size = 0; + arv_device_dup_register_feature_value(devices_[i].device_,"GenDCDescriptor", &gendc_desc_size, &err_ ); if (err_) { throw std::runtime_error(err_->message); } - char* buffer; buffer = (char*) malloc(gendc_desc_size); - arv_device_get_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); + arv_device_set_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); if (err_) { throw std::runtime_error(err_->message); } From 66c9c191f80bcd967fa39ffdedc19fd68cad2d47 Mon Sep 17 00:00:00 2001 From: Xinyu Li Date: Wed, 17 Jul 2024 09:58:46 -0700 Subject: [PATCH 2/3] update buffer --- src/bb/image-io/rt_u3v.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/bb/image-io/rt_u3v.h b/src/bb/image-io/rt_u3v.h index c2c0da26..9aa475cf 100644 --- a/src/bb/image-io/rt_u3v.h +++ b/src/bb/image-io/rt_u3v.h @@ -123,7 +123,7 @@ class U3V { using arv_device_set_register_feature_value_t = void(*)(ArvDevice*, const char*, uint64_t, void*, GError**); - using arv_device_dup_register_feature_value_t = void(*) (ArvDevice*, const char *, uint64_t *, GError **); + using arv_device_dup_register_feature_value_t = void*(*) (ArvDevice*, const char *, uint64_t *, GError **); using arv_device_create_stream_t = ArvStream*(*)(ArvDevice*, ArvStreamCallback*, void*, GError**); @@ -970,15 +970,14 @@ class U3VRealCam: public U3V{ if (is_gendc_){ log::info("\tDevice/USB {}::{} : {}", i, "GenDC", "Available"); uint64_t gendc_desc_size = 0; - arv_device_dup_register_feature_value(devices_[i].device_,"GenDCDescriptor", &gendc_desc_size, &err_ ); + char* buffer = reinterpret_cast(arv_device_dup_register_feature_value(devices_[i].device_,"GenDCDescriptor", &gendc_desc_size, &err_ )); if (err_) { throw std::runtime_error(err_->message); } - char* buffer; - buffer = (char*) malloc(gendc_desc_size); - arv_device_set_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); +// buffer = (char*) malloc(gendc_desc_size); +// arv_device_set_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); if (err_) { throw std::runtime_error(err_->message); } @@ -1456,13 +1455,13 @@ class U3VGenDC: public U3V{ if (is_gendc_){ log::info("\tDevice/USB {}::{} : {}", i, "GenDC", "Available"); uint64_t gendc_desc_size = 0; - arv_device_dup_register_feature_value(devices_[i].device_,"GenDCDescriptor", &gendc_desc_size, &err_ ); + char* buffer = reinterpret_cast(arv_device_dup_register_feature_value(devices_[i].device_,"GenDCDescriptor", &gendc_desc_size, &err_ )); if (err_) { throw std::runtime_error(err_->message); } - char* buffer; - buffer = (char*) malloc(gendc_desc_size); - arv_device_set_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); + +// buffer = (char*) malloc(gendc_desc_size); +// arv_device_set_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); if (err_) { throw std::runtime_error(err_->message); } From e5001d74f91ef5390f1020957a81c1287b1d05db Mon Sep 17 00:00:00 2001 From: Xinyu Li Date: Fri, 19 Jul 2024 14:34:05 -0700 Subject: [PATCH 3/3] delete set value --- src/bb/image-io/rt_u3v.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/bb/image-io/rt_u3v.h b/src/bb/image-io/rt_u3v.h index 9aa475cf..60c2f53c 100644 --- a/src/bb/image-io/rt_u3v.h +++ b/src/bb/image-io/rt_u3v.h @@ -121,8 +121,6 @@ class U3V { using arv_device_is_feature_available_t = bool(*)(ArvDevice*, const char*, GError**); - using arv_device_set_register_feature_value_t = void(*)(ArvDevice*, const char*, uint64_t, void*, GError**); - using arv_device_dup_register_feature_value_t = void*(*) (ArvDevice*, const char *, uint64_t *, GError **); using arv_device_create_stream_t = ArvStream*(*)(ArvDevice*, ArvStreamCallback*, void*, GError**); @@ -382,7 +380,6 @@ class U3V { GET_SYMBOL(arv_device_get_integer_feature_bounds, "arv_device_get_integer_feature_bounds"); GET_SYMBOL(arv_device_get_float_feature_bounds, "arv_device_get_float_feature_bounds"); - GET_SYMBOL(arv_device_set_register_feature_value, "arv_device_set_register_feature_value"); GET_SYMBOL(arv_device_dup_register_feature_value, "arv_device_dup_register_feature_value"); GET_SYMBOL(arv_device_create_stream, "arv_device_create_stream"); @@ -502,7 +499,6 @@ class U3V { arv_device_get_float_feature_bounds_t arv_device_get_float_feature_bounds; arv_device_is_feature_available_t arv_device_is_feature_available; - arv_device_set_register_feature_value_t arv_device_set_register_feature_value; arv_device_dup_register_feature_value_t arv_device_dup_register_feature_value; arv_device_create_stream_t arv_device_create_stream; @@ -975,12 +971,6 @@ class U3VRealCam: public U3V{ if (err_) { throw std::runtime_error(err_->message); } - -// buffer = (char*) malloc(gendc_desc_size); -// arv_device_set_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); - if (err_) { - throw std::runtime_error(err_->message); - } if(isGenDC(buffer)){ gendc_descriptor_= ContainerHeader(buffer); std::tuple data_comp_and_part = gendc_descriptor_.getFirstAvailableDataOffset(true); @@ -1460,11 +1450,6 @@ class U3VGenDC: public U3V{ throw std::runtime_error(err_->message); } -// buffer = (char*) malloc(gendc_desc_size); -// arv_device_set_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_); - if (err_) { - throw std::runtime_error(err_->message); - } if(isGenDC(buffer)){ gendc_descriptor_= ContainerHeader(buffer); std::tuple data_comp_and_part = gendc_descriptor_.getFirstAvailableDataOffset(true);