Hello. I'm trying to enable Demosaic feature in v4l2. I read in i.MX 8M Plus Applications Processor Reference manual, table 13-39 that Demosaic converts RAW Bayer pipeline data to 12-bit RGB. I am trying to set this with code I leveraged from isp-imx source, vvext.cpp, viv_private_ioctl(int fd, const char *cmd, char *request, char *response), and the only responses I'm seeing from the ioctl calls is "{\"result\": 0}".
Does anyone know if this return json string means demosaic is enabled? I know my v4l2 buffers contain the same Bayer data as they did before, which leads me to believe the VIDIOC_S_EXT_CTRLS ioctl is not working correctly. Does anyone know what response *will* be if the ioctl is successful?
Can you send me the code you change?
Hello. I didn't change any code from the original code in vvext.cpp, viv_private_ioctl(int fd, const char *cmd, char *request, char *response):
int viv_private_ioctl(const char *cmd, Json::Value& jsonRequest, Json::Value& jsonResponse) {
if (!cmd) {
ALOGE("cmd should not be null!");
return -1;
}
jsonRequest["id"] = cmd;
jsonRequest["streamid"] = streamid;
struct v4l2_ext_controls ecs;
struct v4l2_ext_control ec;
memset(&ecs, 0, sizeof(ecs));
memset(&ec, 0, sizeof(ec));
ec.string = new char[VIV_JSON_BUFFER_SIZE];
ec.id = V4L2_CID_VIV_EXTCTRL;
ec.size = 0;
ecs.controls = &ec;
ecs.count = 1;
::ioctl(fd, VIDIOC_G_EXT_CTRLS, &ecs);
strcpy(ec.string, jsonRequest.toStyledString().c_str());
int ret = ::ioctl(fd, VIDIOC_S_EXT_CTRLS, &ecs);
if (ret != 0)
return ret;
::ioctl(fd, VIDIOC_G_EXT_CTRLS, &ecs);
Json::Reader reader;
reader.parse(ec.string, jsonResponse, true);
delete ec.string;
ec.string = NULL;
return jsonResponse["MC_RET"].asInt();
}
Does this code work on the i.MX8Plus?
ISP V4L2 user guide shows that V4L2 source code support Demosaic.You can search "Demosaic" in this guide and you will find control code.
https://www.nxp.com.cn/webapp/Download?colCode=IMX8MPISPUV4L2IUG
Ok. So in the above definition of
viv_private_ioctl
What should the value of jsonResponse be after calling viv_private_ioctl?