Add support for defining the transfer curve per mode

This commit is contained in:
Martijn Braam
2023-07-22 16:38:39 +02:00
parent 62f75fafcb
commit 8eb42d77e6
3 changed files with 18 additions and 2 deletions

View File

@@ -13,11 +13,11 @@ Rear: {
Rate: 15;
Format: "GRBG8";
Rotate: 270;
Transfer: "srgb";
# All the links on this platform are immutable
Pipeline: (
{Type: "Mode", Entity: "s5k3l6xx"},
{Type: "Rate", Entity: "s5k3l6xx"},
{Type: "Mode", Entity: "imx8mq-mipi-csi2"},
{Type: "Mode", Entity: "csi"},
);
@@ -28,9 +28,10 @@ Rear: {
Rate: 30;
Format: "GRBG8";
Rotate: 270;
Transfer: "srgb";
Pipeline: (
{Type: "Mode", Entity: "s5k3l6xx"},
{Type: "Rate", Entity: "s5k3l6xx"},
{Type: "Mode", Entity: "imx8mq-mipi-csi2"},
{Type: "Mode", Entity: "csi"},
);

View File

@@ -21,6 +21,9 @@ libmegapixels_find_config(char *configfile);
#define LIBMEGAPIXELS_CFA_GRBG 3
#define LIBMEGAPIXELS_CFA_RGGB 4
#define LIBMEGAPIXELS_XFER_RAW 0;
#define LIBMEGAPIXELS_XFER_SRGB 8;
struct _lmp_cmd {
int type;
const char *entity_from;
@@ -48,6 +51,7 @@ struct _lmp_mode {
int format;
int rotation;
int mirrored;
int xfer;
double focal_length;
double f_number;

View File

@@ -249,6 +249,17 @@ load_camera(libmegapixels_devconfig *config, config_t *cfg, const char *name)
mm->v4l_pixfmt = libmegapixels_format_to_v4l_pixfmt(mm->format);
mm->media_busfmt = libmegapixels_format_to_media_busfmt(mm->format);
const char *xfer;
if (config_setting_lookup_string(mode, "Transfer", &xfer)) {
if (strcmp(xfer, "srgb") == 0) {
mm->xfer = LIBMEGAPIXELS_XFER_SRGB;
} else {
mm->xfer = LIBMEGAPIXELS_XFER_RAW;
}
} else {
mm->xfer = LIBMEGAPIXELS_XFER_RAW;
}
if (!config_setting_lookup_int(mode, "Rotate", &mm->rotation)) {
mm->rotation = 0;
}