Support lowres capture
This commit is contained in:
@ -115,6 +115,10 @@ int camera_set_params(camera_t *camera)
|
||||
// DEVICE_SET_OPTION(camera->camera, VBLANK, 1636);
|
||||
// DEVICE_SET_OPTION(camera->camera, HBLANK, 6906);
|
||||
|
||||
// DEVICE_SET_OPTION(camera->isp_srgb, RED_BALANCE, 2120);
|
||||
// DEVICE_SET_OPTION(camera->isp_srgb, BLUE_BALANCE, 1472);
|
||||
// DEVICE_SET_OPTION(camera->isp_srgb, DIGITAL_GAIN, 1007);
|
||||
|
||||
DEVICE_SET_OPTION2(camera->codec_jpeg, JPEG, COMPRESSION_QUALITY, 80);
|
||||
|
||||
DEVICE_SET_OPTION2(camera->codec_h264, MPEG_VIDEO, BITRATE, 5000 * 1000);
|
||||
|
@ -32,9 +32,11 @@ typedef struct camera_s {
|
||||
device_t *legacy_isp; // convert pRAA/YUVU into YUVU
|
||||
device_t *isp_srgb;
|
||||
device_t *isp_yuuv;
|
||||
device_t *isp_yuuv_low;
|
||||
device_t *isp_yuuv_lowres;
|
||||
device_t *codec_jpeg; // encode YUVU into JPEG
|
||||
device_t *codec_h264; // encode YUVU into H264
|
||||
device_t *codec_jpeg_lowres; // encode YUVU into JPEG
|
||||
device_t *codec_h264_lowres; // encode YUVU into H264
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -12,31 +12,22 @@ void write_yuvu(buffer_t *buffer);
|
||||
|
||||
int camera_configure_isp(camera_t *camera, float high_div, float low_div)
|
||||
{
|
||||
buffer_list_t *src = camera->camera->capture_list;
|
||||
|
||||
camera->isp_srgb = device_open("ISP", "/dev/video13");
|
||||
camera->isp_yuuv = device_open("ISP-YUUV", "/dev/video14");
|
||||
camera->isp_yuuv->output_device = camera->isp_srgb;
|
||||
camera->codec_jpeg = device_open("JPEG", "/dev/video31");
|
||||
camera->codec_h264 = device_open("H264", "/dev/video11");
|
||||
|
||||
if (device_open_buffer_list_output(camera->isp_srgb, src) < 0 ||
|
||||
device_open_buffer_list_capture(camera->isp_yuuv, src, high_div, V4L2_PIX_FMT_YUYV, true) < 0) {
|
||||
if (device_open_buffer_list_output(camera->isp_srgb, camera->camera->capture_list) < 0 ||
|
||||
device_open_buffer_list_capture(camera->isp_yuuv, camera->camera->capture_list, high_div, V4L2_PIX_FMT_YUYV, true) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (low_div >= 1) {
|
||||
camera->isp_yuuv_low = device_open("ISP-YUUV-LOW", "/dev/video15");
|
||||
camera->isp_yuuv_low->output_device = camera->isp_srgb;
|
||||
camera->isp_yuuv->output_device = camera->isp_srgb;
|
||||
|
||||
if (device_open_buffer_list_capture(camera->isp_yuuv_low, src, low_div, V4L2_PIX_FMT_YUYV, true) < 0) {
|
||||
return -1;
|
||||
}
|
||||
link_t *links = camera->links;
|
||||
*links++ = (link_t){ camera->camera->capture_list, { camera->isp_srgb->output_list } };
|
||||
|
||||
src = camera->isp_yuuv_low->capture_list;
|
||||
} else {
|
||||
src = camera->isp_yuuv->capture_list;
|
||||
}
|
||||
buffer_list_t *src = camera->isp_yuuv->capture_list;
|
||||
|
||||
if (device_open_buffer_list_output(camera->codec_jpeg, src) < 0 ||
|
||||
device_open_buffer_list_capture(camera->codec_jpeg, src, 1.0, V4L2_PIX_FMT_JPEG, true) < 0) {
|
||||
@ -48,22 +39,38 @@ int camera_configure_isp(camera_t *camera, float high_div, float low_div)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// DEVICE_SET_OPTION(camera->isp_srgb, RED_BALANCE, 2120);
|
||||
// DEVICE_SET_OPTION(camera->isp_srgb, BLUE_BALANCE, 1472);
|
||||
// DEVICE_SET_OPTION(camera->isp_srgb, DIGITAL_GAIN, 1007);
|
||||
|
||||
link_t *links = camera->links;
|
||||
|
||||
*links++ = (link_t){ camera->camera->capture_list, { camera->isp_srgb->output_list } };
|
||||
|
||||
if (camera->isp_yuuv_low) {
|
||||
*links++ = (link_t){ camera->isp_yuuv->capture_list, { } };
|
||||
*links++ = (link_t){ camera->isp_yuuv_low->capture_list, { camera->codec_jpeg->output_list, camera->codec_h264->output_list }, { write_yuvu } };
|
||||
} else {
|
||||
*links++ = (link_t){ camera->isp_yuuv->capture_list, { camera->codec_jpeg->output_list, camera->codec_h264->output_list }, { write_yuvu } };
|
||||
}
|
||||
|
||||
*links++ = (link_t){ camera->isp_yuuv->capture_list, { camera->codec_jpeg->output_list, camera->codec_h264->output_list }, { write_yuvu } };
|
||||
*links++ = (link_t){ camera->codec_jpeg->capture_list, { }, { http_jpeg_capture, http_jpeg_needs_buffer } };
|
||||
*links++ = (link_t){ camera->codec_h264->capture_list, { }, { http_h264_capture, http_h264_needs_buffer } };
|
||||
|
||||
// all done
|
||||
if (low_div < 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
camera->isp_yuuv_lowres = device_open("ISP-YUUV-LOW", "/dev/video15");
|
||||
camera->codec_jpeg_lowres = device_open("JPEG-LOW", "/dev/video31");
|
||||
camera->codec_h264_lowres = device_open("H264-LOW", "/dev/video11");
|
||||
|
||||
if (device_open_buffer_list_capture(camera->isp_yuuv_lowres, camera->camera->capture_list, low_div, V4L2_PIX_FMT_YUYV, true) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
camera->isp_yuuv_lowres->output_device = camera->isp_srgb;
|
||||
src = camera->isp_yuuv_lowres->capture_list;
|
||||
|
||||
if (device_open_buffer_list_output(camera->codec_jpeg_lowres, src) < 0 ||
|
||||
device_open_buffer_list_capture(camera->codec_jpeg_lowres, src, 1.0, V4L2_PIX_FMT_JPEG, true) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (device_open_buffer_list_output(camera->codec_h264_lowres, src) < 0 ||
|
||||
device_open_buffer_list_capture(camera->codec_h264_lowres, src, 1.0, V4L2_PIX_FMT_H264, true) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*links++ = (link_t){ camera->isp_yuuv_lowres->capture_list, { camera->codec_jpeg_lowres->output_list, camera->codec_h264_lowres->output_list }, { write_yuvu } };
|
||||
*links++ = (link_t){ camera->codec_jpeg_lowres->capture_list, { }, { http_jpeg_lowres_capture, http_jpeg_needs_buffer } };
|
||||
*links++ = (link_t){ camera->codec_h264_lowres->capture_list, { }, { http_h264_lowres_capture, http_h264_needs_buffer } };
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user