Use xfer function from libmegapixels instead of v4l
This commit is contained in:
@@ -23,7 +23,7 @@ struct _GLES2Debayer {
|
||||
};
|
||||
|
||||
GLES2Debayer *
|
||||
gles2_debayer_new(int format, uint32_t colorspace)
|
||||
gles2_debayer_new(int format, int xfer)
|
||||
{
|
||||
uint32_t pixfmt = libmegapixels_format_to_v4l_pixfmt(format);
|
||||
if (pixfmt != V4L2_PIX_FMT_SBGGR8 && pixfmt != V4L2_PIX_FMT_SGBRG8 &&
|
||||
@@ -38,7 +38,7 @@ gles2_debayer_new(int format, uint32_t colorspace)
|
||||
check_gl();
|
||||
|
||||
char format_def[96];
|
||||
bool is_srgb = colorspace == V4L2_COLORSPACE_SRGB;
|
||||
bool is_srgb = xfer == LIBMEGAPIXELS_XFER_SRGB;
|
||||
snprintf(format_def,
|
||||
96,
|
||||
"#define CFA_%s\n#define BITS_%d\n#define COLORSPACE_%s\n",
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
typedef struct _GLES2Debayer GLES2Debayer;
|
||||
|
||||
GLES2Debayer *gles2_debayer_new(int format, uint32_t colorspace);
|
||||
GLES2Debayer *gles2_debayer_new(int format, int xfer);
|
||||
void gles2_debayer_free(GLES2Debayer *self);
|
||||
|
||||
void gles2_debayer_use(GLES2Debayer *self);
|
||||
|
@@ -81,7 +81,6 @@ update_process_pipeline()
|
||||
.preview_width = state_io.preview_width,
|
||||
.preview_height = state_io.preview_height,
|
||||
.device_rotation = state_io.device_rotation,
|
||||
.colorspace = state_io.colorspace,
|
||||
|
||||
.gain.control = state_io.gain.control,
|
||||
.gain.auto_control = state_io.gain.auto_control,
|
||||
@@ -145,7 +144,6 @@ capture(MPPipeline *pipeline, const void *data)
|
||||
mp_camera_stop_capture(mpcamera);
|
||||
struct v4l2_format format = { 0 };
|
||||
libmegapixels_select_mode(state_io.camera, state_io.mode_capture, &format);
|
||||
state_io.colorspace = format.fmt.pix.colorspace;
|
||||
state_io.flush_pipeline = true;
|
||||
|
||||
mp_camera_start_capture(mpcamera);
|
||||
@@ -328,7 +326,6 @@ on_frame(MPBuffer buffer, void *_data)
|
||||
struct v4l2_format format = { 0 };
|
||||
libmegapixels_select_mode(
|
||||
state_io.camera, state_io.mode_preview, &format);
|
||||
state_io.colorspace = format.fmt.pix.colorspace;
|
||||
state_io.flush_pipeline = true;
|
||||
|
||||
mp_camera_start_capture(mpcamera);
|
||||
@@ -501,7 +498,6 @@ update_state(MPPipeline *pipeline, const mp_state_io *new_state)
|
||||
libmegapixels_select_mode(state_io.camera,
|
||||
state_io.mode_preview,
|
||||
&format);
|
||||
state_io.colorspace = format.fmt.pix.colorspace;
|
||||
}
|
||||
|
||||
mp_camera_start_capture(mpcamera);
|
||||
|
@@ -927,7 +927,7 @@ on_output_changed(bool format_changed)
|
||||
if (gles2_debayer)
|
||||
gles2_debayer_free(gles2_debayer);
|
||||
|
||||
gles2_debayer = gles2_debayer_new(state_proc.mode->format, state_proc.colorspace);
|
||||
gles2_debayer = gles2_debayer_new(state_proc.mode->format, state_proc.mode->xfer);
|
||||
check_gl();
|
||||
|
||||
gles2_debayer_use(gles2_debayer);
|
||||
@@ -990,7 +990,6 @@ update_state(MPPipeline *pipeline, const mp_state_proc *new_state)
|
||||
}
|
||||
|
||||
state_proc.mode = new_state->camera->current_mode;
|
||||
state_proc.colorspace = new_state->colorspace;
|
||||
|
||||
state_proc.preview_width = new_state->preview_width;
|
||||
state_proc.preview_height = new_state->preview_height;
|
||||
|
@@ -51,7 +51,6 @@ typedef struct state_io {
|
||||
int captures_remaining;
|
||||
bool flush_pipeline;
|
||||
int blank_frame_count;
|
||||
uint32_t colorspace;
|
||||
|
||||
// Control state
|
||||
controlstate gain;
|
||||
@@ -80,7 +79,6 @@ typedef struct state_proc {
|
||||
int counter;
|
||||
int preview_width;
|
||||
int preview_height;
|
||||
uint32_t colorspace;
|
||||
|
||||
// Device orientation in degrees
|
||||
int device_rotation;
|
||||
|
Reference in New Issue
Block a user