From d9c22be57e21b6cef7c6514c890f970196a4f2e9 Mon Sep 17 00:00:00 2001 From: Steffen Pohle Date: Sat, 26 Nov 2022 00:01:40 +0100 Subject: [PATCH] save some time --- Makefile.rules.linux | 4 ++-- convert.cc | 7 +++++-- histogram.cc | 7 ++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile.rules.linux b/Makefile.rules.linux index 784621a..4867d20 100644 --- a/Makefile.rules.linux +++ b/Makefile.rules.linux @@ -2,10 +2,10 @@ TARGET = $(APP) CPP = c++ -CPPFLAGS = -std=c++11 -ggdb -Wall -Werror -O0 `pkg-config --cflags gtk+-3.0 gmodule-export-2.0` -Wl,--export-dynamic -I/usr/include -DBUILD_LINUX=1 +CPPFLAGS = -std=c++11 -pg -ggdb -Wall -Werror -O0 `pkg-config --cflags gtk+-3.0 gmodule-export-2.0` -Wl,--export-dynamic -I/usr/include -DBUILD_LINUX=1 INCLUDES = LDFLAGS = -LIBS = `pkg-config --libs gtk+-3.0 gmodule-export-2.0` -L/usr/lib -ljpeg -ltiff +LIBS = `pkg-config --libs gtk+-3.0 gmodule-export-2.0` -L/usr/lib -ljpeg -ltiff -pg OBJECTS = diff --git a/convert.cc b/convert.cc index b29d102..f6cfff8 100644 --- a/convert.cc +++ b/convert.cc @@ -346,8 +346,11 @@ int Convert (ConvertData *cdata, VideoFrame *dest, unsigned char *ptrsrc, int sr break; case (V4L2_PIX_FMT_SGRBG16): - // GG RR - // BB GG + // GG RR GG RR + // BB GG BB GG + // GG RR GG RR + // BB GG BB GG + uint16_t t; for (ys = 0, yd = 0; ys < (signed int)srch; ys++) { diff --git a/histogram.cc b/histogram.cc index a26cadd..c1d13d9 100644 --- a/histogram.cc +++ b/histogram.cc @@ -112,6 +112,11 @@ void cb_histogramda_draw(GtkWidget *area, cairo_t *cr, int w, int h, gpointer da * test function */ void histogram_update(VideoFrame *vf) { + + // save some time + static int to = 0; + if ((++to) % 8 == 0) to = 0; + int chan, i, x, y; if (vf == NULL) return; @@ -123,7 +128,7 @@ void histogram_update(VideoFrame *vf) { for (i = 0, x = 0; x < vf->w; x++) { for (y = 0; y < vf->h; y++) { for (chan = 0; chan < 3; chan++) { - histogram[chan][vf->data[3*(y*vf->w+x) + chan]]++; + histogram[chan][vf->data[i++]]++; } } }