int Yolov3PredictMethod::GetSrcImageSize(-
const std::vector<BaseDataPtr> &input, int &src_image_height,-
int &src_image_width) {-
HOBOT_CHECK(input.size() == 1); // image-
auto xstream_img = std::static_pointer_cast<-
XStreamData<std::shared_ptrhobot::vision::ImageFrame>>(input[0]);-
// alloc bpu-mem-
// 数据类型是nv12图像,y和uv分量分开alloc和存储-
// int y_length = input_img.width * input_img.width;-
int y_length = input_img.width * input_img.height;//chaged by xgs alloc half data-
int uv_length = y_length >> 1;-
cout<<"++++++++++++++++++++++++++++length of y is: “<<y_length<<” length og uv is: "<<uv_length<<endl;-
ret = HB_SYS_bpuMemAlloc(-
“in_data0”, y_length, true, &pre_resize_tensor.data);-
if (ret != 0) {-
LOGE << "bpu alloc mem failed: " << HB_BPU_getErrorName(ret);-
return -1;-
}-
ret = HB_SYS_bpuMemAlloc(-
“in_data1”, uv_length, true, &pre_resize_tensor.data_ext);-
if (ret != 0) {-
LOGE << "bpu alloc mem failed: " << HB_BPU_getErrorName(ret);-
// release alloced mem-
HB_SYS_bpuMemFree(&pre_resize_tensor.data);-
return -1;-
}-
// Copy y data to data0-