Use legacy isp to rescale outputs
This commit is contained in:
parent
80b69bd3eb
commit
5160bdeb3d
@ -49,7 +49,7 @@ typedef struct camera_s {
|
|||||||
device_t *camera;
|
device_t *camera;
|
||||||
device_t *decoder; // decode JPEG/H264 into YUVU
|
device_t *decoder; // decode JPEG/H264 into YUVU
|
||||||
device_t *isp;
|
device_t *isp;
|
||||||
device_t *legacy_isp;
|
device_t *legacy_isp[2];
|
||||||
device_t *codec_jpeg[2]; // encode YUVU into JPEG
|
device_t *codec_jpeg[2]; // encode YUVU into JPEG
|
||||||
device_t *codec_h264[2]; // encode YUVU into H264
|
device_t *codec_h264[2]; // encode YUVU into H264
|
||||||
};
|
};
|
||||||
@ -76,4 +76,4 @@ int camera_configure_decoder(camera_t *camera, buffer_list_t *src_capture);
|
|||||||
int camera_configure_v4l2(camera_t *camera);
|
int camera_configure_v4l2(camera_t *camera);
|
||||||
int camera_configure_libcamera(camera_t *camera);
|
int camera_configure_libcamera(camera_t *camera);
|
||||||
int camera_configure_isp(camera_t *camera, buffer_list_t *src, float high_div, float low_div);
|
int camera_configure_isp(camera_t *camera, buffer_list_t *src, float high_div, float low_div);
|
||||||
int camera_configure_legacy_isp(camera_t *camera, buffer_list_t *src, float div);
|
int camera_configure_legacy_isp(camera_t *camera, buffer_list_t *src, float div, int res);
|
||||||
|
@ -26,6 +26,14 @@ int camera_configure_decoder(camera_t *camera, buffer_list_t *src_capture)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (camera->options.low_res_factor > 1) {
|
||||||
|
float div = camera->options.low_res_factor / camera->options.high_res_factor;
|
||||||
|
|
||||||
|
if (camera_configure_legacy_isp(camera, decoder_capture, div, 1) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (device_set_decoder_start(camera->decoder, true) < 0) {
|
if (device_set_decoder_start(camera->decoder, true) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,18 @@
|
|||||||
#include "device/buffer_list.h"
|
#include "device/buffer_list.h"
|
||||||
#include "http/http.h"
|
#include "http/http.h"
|
||||||
|
|
||||||
int camera_configure_legacy_isp(camera_t *camera, buffer_list_t *src_capture, float div)
|
int camera_configure_legacy_isp(camera_t *camera, buffer_list_t *src_capture, float div, int res)
|
||||||
{
|
{
|
||||||
camera->legacy_isp = device_v4l2_open("ISP", "/dev/video12");
|
camera->legacy_isp[res] = device_v4l2_open("ISP", "/dev/video12");
|
||||||
|
|
||||||
buffer_list_t *isp_output = device_open_buffer_list_output(
|
buffer_list_t *isp_output = device_open_buffer_list_output(
|
||||||
camera->legacy_isp, src_capture);
|
camera->legacy_isp[res], src_capture);
|
||||||
buffer_list_t *isp_capture = device_open_buffer_list_capture(
|
buffer_list_t *isp_capture = device_open_buffer_list_capture(
|
||||||
camera->legacy_isp, isp_output, div, V4L2_PIX_FMT_YUYV, true);
|
camera->legacy_isp[res], isp_output, div, V4L2_PIX_FMT_YUYV, true);
|
||||||
|
|
||||||
camera_capture_add_output(camera, src_capture, isp_output);
|
camera_capture_add_output(camera, src_capture, isp_output);
|
||||||
|
|
||||||
if (camera_configure_output(camera, isp_capture, 0) < 0) {
|
if (camera_configure_output(camera, isp_capture, res) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,14 @@ int camera_configure_libcamera(camera_t *camera)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (camera->options.low_res_factor > 1) {
|
||||||
|
float div = camera->options.low_res_factor / camera->options.high_res_factor;
|
||||||
|
|
||||||
|
if (camera_configure_legacy_isp(camera, camera_capture, div, 1) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -57,7 +57,7 @@ int camera_configure_v4l2(camera_t *camera)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (camera_configure_legacy_isp(camera, camera_capture, camera->options.high_res_factor) < 0) {
|
if (camera_configure_legacy_isp(camera, camera_capture, camera->options.high_res_factor, 0) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user