91 {
92 config_ = cameraconfig;
93
94 if (config_->pixel_format() == "yuyv") {
95 pixel_format_ = V4L2_PIX_FMT_YUYV;
96 } else if (config_->pixel_format() == "uyvy") {
97 pixel_format_ = V4L2_PIX_FMT_UYVY;
98 } else if (config_->pixel_format() == "mjpeg") {
99 pixel_format_ = V4L2_PIX_FMT_MJPEG;
100 } else if (config_->pixel_format() == "yuvmono10") {
101 pixel_format_ = V4L2_PIX_FMT_YUYV;
102 config_->set_monochrome(true);
103 } else if (config_->pixel_format() == "rgb24") {
104 pixel_format_ = V4L2_PIX_FMT_RGB24;
105 } else {
106 pixel_format_ = V4L2_PIX_FMT_YUYV;
107 AERROR <<
"Wrong pixel fromat:" << config_->pixel_format()
108 << ",must be yuyv | uyvy | mjpeg | yuvmono10 | rgb24";
109 return false;
110 }
111 if (pixel_format_ == V4L2_PIX_FMT_MJPEG) {
112 init_mjpeg_decoder(config_->width(), config_->height());
113 }
114
115
116 frame_warning_interval_ = static_cast<float>(1.5 / config_->frame_rate());
117
118 frame_drop_interval_ = static_cast<float>(0.9 / config_->frame_rate());
119 frame_drop_interval_ns_ = static_cast<uint64_t>(frame_drop_interval_ * 1000 * 1000 * 1000);
120
121#ifdef __aarch64__
122 handler_ = CudaConvertHandler(config_->width(), config_->height());
123 if (!handler_.Init()) {
124 AERROR <<
"Init cuda convert handler error";
125 return false;
126 }
127#endif
128
129 return true;
130}