From de8d5a0d80daba0b840a4f9714aee238966ab0a4 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 22 Feb 2012 23:57:55 +0100 Subject: snapshot: Use AEWB algorithm Signed-off-by: Laurent Pinchart --- Makefile | 2 +- snapshot.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e4de38d..107e34d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ LDFLAGS := -Lisp LIBS := -lomap3isp -lrt OBJ_LIVE := live.o events.o iq.o videoout.o -OBJ_SNAP := snapshot.o events.o +OBJ_SNAP := snapshot.o events.o iq.o %.o : %.c $(CC) $(CFLAGS) -c -o $@ $< diff --git a/snapshot.c b/snapshot.c index 712195a..59da5b5 100644 --- a/snapshot.c +++ b/snapshot.c @@ -49,6 +49,7 @@ #include "isp/v4l2-pool.h" #include "events.h" +#include "iq.h" #define MEDIA_DEVICE "/dev/media0" @@ -95,8 +96,20 @@ static struct snapshot snap = { .skip = 2, }; +static struct iq_tuning *iq = NULL; + static struct events events; +/* ----------------------------------------------------------------------------- + * Image quality + */ + +static void __iq_aewb_process(struct omap3_isp_device *isp __attribute__((__unused__)), + const struct omap3_isp_aewb_stats *stats) +{ + iq_aewb_process(iq, stats); +} + /* ----------------------------------------------------------------------------- * Events */ @@ -493,6 +506,7 @@ int main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unu ops.snapshot_ready = snapshot_process; ops.watch_fd = __events_watch_fd; ops.unwatch_fd = __events_unwatch_fd; + ops.aewb_ready = __iq_aewb_process; isp = omap3_isp_open(MEDIA_DEVICE, &ops); if (isp == NULL) { @@ -510,6 +524,12 @@ int main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unu if (ret < 0) goto cleanup; + iq = iq_init(isp); + if (iq == NULL) { + printf("error: unable to initialize image quality tuning\n"); + goto cleanup; + } + /* Start the viewfinder if needed. */ if (vf.enabled) { ret = omap3_isp_viewfinder_start(isp); @@ -560,6 +580,8 @@ cleanup: omap3_isp_close(isp); if (vf.enabled) viewfinder_cleanup(isp); + if (iq) + iq_cleanup(iq); return exit_code; } -- cgit v1.2.3