SER should now work with RAW video data

master
Steffen Pohle 1 year ago
parent ef6100dee0
commit c01339b7b9

@ -16,6 +16,7 @@ Configuration::Configuration() {
debugpath = NULL; debugpath = NULL;
readdumppath = NULL; readdumppath = NULL;
destpath = "./"; destpath = "./";
show_debugwin = 0;
}; };
@ -362,12 +363,6 @@ void Configuration::LoadConfig(std::string filename) {
} }
} }
printf ("%s:%d show debug window\n", __FILE__, __LINE__);
GtkWidget *wnd = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "window-debug"));
if (wnd) {
gtk_widget_show (wnd);
}
setlocale (LC_ALL, s.c_str()); setlocale (LC_ALL, s.c_str());
// we need to update the gui so floating numbers will displayed with the correct // we need to update the gui so floating numbers will displayed with the correct

@ -27,6 +27,7 @@ public:
char *debugpath; char *debugpath;
char *readdumppath; char *readdumppath;
int debayer_mode = 0; // 0..simple mode, 1..bilinear int debayer_mode = 0; // 0..simple mode, 1..bilinear
int show_debugwin = 0;
Configuration(); Configuration();
~Configuration(); ~Configuration();

@ -142,9 +142,6 @@ void convert_debug_dumpframe(unsigned char *ptrsrc, int srcsize, uint32_t pixelf
* close file and reset all data * close file and reset all data
*/ */
void convert_debug_close() { void convert_debug_close() {
printf ("%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__);
if (convert_debug_fd != -1) { if (convert_debug_fd != -1) {
close (convert_debug_fd); close (convert_debug_fd);
convert_debug_fd = -1; convert_debug_fd = -1;
@ -513,11 +510,13 @@ int PixCopy(unsigned char *srcdata, uint32_t srcpixfmt, int srcw, int srch,
switch (srcpixfmt) { switch (srcpixfmt) {
case (V4L2_PIX_FMT_SGRBG8): case (V4L2_PIX_FMT_SGRBG8):
bytesperpixel = 1;
break;
case (V4L2_PIX_FMT_SGRBG16):
bytesperpixel = 2; bytesperpixel = 2;
break; break;
case (V4L2_PIX_FMT_BGR32): case (V4L2_PIX_FMT_BGR32):
case (V4L2_PIX_FMT_RGB32): case (V4L2_PIX_FMT_RGB32):
case (V4L2_PIX_FMT_SGRBG16):
bytesperpixel = 4; bytesperpixel = 4;
break; break;
case (V4L2_PIX_FMT_BGR24): case (V4L2_PIX_FMT_BGR24):
@ -528,8 +527,6 @@ int PixCopy(unsigned char *srcdata, uint32_t srcpixfmt, int srcw, int srch,
return 0; return 0;
} }
debug_drawraw(srcdata, srcpixfmt, srcw, srch);
// //
// calculate image size and allocate memory if needed // calculate image size and allocate memory if needed
dsize = (*dsth) * (*dstw) * bytesperpixel; dsize = (*dsth) * (*dstw) * bytesperpixel;
@ -540,46 +537,18 @@ int PixCopy(unsigned char *srcdata, uint32_t srcpixfmt, int srcw, int srch,
} }
unsigned char *dptr, *sptr; unsigned char *dptr, *sptr;
int y, dy, x, dx, i, d; int y, dy, x, dx;
// debug_drawraw(srcdata, srcpixfmt, srcw, srch);
for (y = regiony & (~1), dy = 0; dy < *dsth && y < srch; y++, dy++) { for (y = regiony & (~1), dy = 0; dy < *dsth && y < srch; y++, dy++) {
for (x = regionx & (~1), dx = 0; dx < *dstw && x < srcw; x++, dx++) {
dptr = (*dstdataptr) + bytesperpixel * ( dy * *dstw + dx);
sptr = (srcdata) + bytesperpixel * ( y * srcw + x);
for (d = 0, i = 0; i < bytesperpixel; i++) {
dptr[i] = sptr[i];
d += sptr[i];
}
// printf (" %-3d",d);
}
// printf ("\n");
}
// printf ("%s:%d\n", __FILE__, __LINE__);
/* int dy, y = regiony & (~1);
int dx, x;
for (dptr = *dstdataptr, dy = 0; dy < *dsth; dy++, y++) {
x = regionx & (~1); x = regionx & (~1);
sptr = (srcdata + bytesperpixel * (y * srcw + x)); dptr = (*dstdataptr) + bytesperpixel * (dy * *dstw);
// printf ("\n"); sptr = (srcdata) + bytesperpixel * ( y * srcw + x);
for (dx = 0; dx < (*dstw * bytesperpixel); dx++, dptr++, sptr++) { for (dx = (*dstw*bytesperpixel); dx > 0; dx--, dptr++, sptr++)
*dptr = *sptr; *dptr = *sptr;
// printf ("%x[%x] ", *dptr, *sptr);
int x1, x2, y1, y2;
y1 = (sptr - srcdata) / (bytesperpixel * srcw);
x1 = ((sptr - srcdata) % (bytesperpixel * srcw)) / bytesperpixel;
y2 = (dptr - *dstdataptr) / (bytesperpixel * (*dstw));
x2 = ((dptr - *dstdataptr) % (bytesperpixel * (*dstw))) / bytesperpixel;
printf ("copy [%d , %d] ---> [ %d , %d] (%d , %d) Value: %d -> %d\n", x1,y1, x2, y2, dx, dy, *sptr, *dptr);
}
} }
*/
if (config.show_debugwin) debug_drawraw(*dstdataptr, srcpixfmt, *dstw, *dsth);
return 1; return 1;
} }

@ -115,11 +115,13 @@ void debug_drawraw(unsigned char *data, int pixfmt, int w, int h) {
switch (pixfmt) { switch (pixfmt) {
case (V4L2_PIX_FMT_SGRBG8): case (V4L2_PIX_FMT_SGRBG8):
bytesperpixel = 1;
break;
case (V4L2_PIX_FMT_SGRBG16):
bytesperpixel = 2; bytesperpixel = 2;
break; break;
case (V4L2_PIX_FMT_BGR32): case (V4L2_PIX_FMT_BGR32):
case (V4L2_PIX_FMT_RGB32): case (V4L2_PIX_FMT_RGB32):
case (V4L2_PIX_FMT_SGRBG16):
bytesperpixel = 4; bytesperpixel = 4;
break; break;
case (V4L2_PIX_FMT_BGR24): case (V4L2_PIX_FMT_BGR24):

@ -81,6 +81,15 @@ void cb_window_show (GtkWidget *widget, gpointer data) {
// //
// load config and setup elements // load config and setup elements
config.LoadDefault(); config.LoadDefault();
//
// show debug output window.
if (config.show_debugwin) {
printf ("%s:%d show debug window\n", __FILE__, __LINE__);
GtkWidget *wnd = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "window-debug"));
if (wnd) gtk_widget_show (wnd);
}
GtkWidget *cfg_rgbenc = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "menu-settings-bilinearrgb")); GtkWidget *cfg_rgbenc = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "menu-settings-bilinearrgb"));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(cfg_rgbenc), (config.debayer_mode != 0)); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(cfg_rgbenc), (config.debayer_mode != 0));

@ -40,6 +40,7 @@ int main (int argc, char **argv) {
printf ("Command Line Options for testing purpose:\n"); printf ("Command Line Options for testing purpose:\n");
printf (" -d <debugpath> destination for video debugging path\n"); printf (" -d <debugpath> destination for video debugging path\n");
printf (" -dd disable debugging path\n"); printf (" -dd disable debugging path\n");
printf (" -dw show debug window\n");
printf ("\n"); printf ("\n");
printf (" -rd <debugpath> read video from dumpfile folder\n"); printf (" -rd <debugpath> read video from dumpfile folder\n");
printf ("\n"); printf ("\n");
@ -51,9 +52,11 @@ int main (int argc, char **argv) {
config.debugpath = argv[i]; config.debugpath = argv[i];
} }
if (strcmp (argv[i], "-dd") == 0) { if (strcmp (argv[i], "-dd") == 0) {
i++;
config.debugpath = NULL; config.debugpath = NULL;
} }
if (strcmp (argv[i], "-dw") == 0) {
config.show_debugwin = 1;
}
if (strcmp (argv[i], "-rd") == 0) { if (strcmp (argv[i], "-rd") == 0) {
i++; i++;
config.readdumppath = argv[i]; config.readdumppath = argv[i];

@ -42,14 +42,6 @@ int VideoFrameRaw::CopyFrom(int spixfmt, int sw, int sh, int ssize, unsigned cha
pixfmt = spixfmt; pixfmt = spixfmt;
memcpy (data, sdata, ssize); memcpy (data, sdata, ssize);
/* int i, x, y, d;
for (y = 0; y < w; y++) for (x = 0; x < w; x++) {
for (i = 0, d = 0; i < 4; i++) {
d += data[4* (y*w+x)];
}
if (d > 1000) printf ("%d,%d -> %d\n", x, y, d);
}
*/
return 1; return 1;
} }
@ -98,37 +90,6 @@ int VideoFrameRaw::RectCopyFrom(VideoFrameRaw *src, int rectx, int recty, int re
&data, &size, &w, &h, &data, &size, &w, &h,
rectx, recty, rectw, recth); rectx, recty, rectw, recth);
/*
for (int i = 0; i < size; i++) if (data[i] > 0) {
printf ("%s:%d found data in destination.\n", __FILE__, __LINE__);
break;
}
for (int i = 0; i < src->size; i++) if (src->data[i] > 0) {
printf ("%s:%d found data in source.\n", __FILE__, __LINE__);
break;
}
int bytesperpixel = 3;
int dsize = 0;
switch (src->pixfmt) {
case (V4L2_PIX_FMT_SGRBG8):
bytesperpixel = 2;
break;
case (V4L2_PIX_FMT_BGR32):
case (V4L2_PIX_FMT_RGB32):
case (V4L2_PIX_FMT_SGRBG16):
bytesperpixel = 4;
break;
case (V4L2_PIX_FMT_BGR24):
case (V4L2_PIX_FMT_RGB24):
bytesperpixel = 3;
break;
default:
return 0;
}
*/
return res; return res;
} }
@ -233,7 +194,6 @@ void VideoFrame::CopyTo(FloatImage *dest) {
} }
void VideoFrame::ToPixbuf(GdkPixbuf** dest) { void VideoFrame::ToPixbuf(GdkPixbuf** dest) {
int destw, desth, bytelen; int destw, desth, bytelen;
unsigned char *destpixel; unsigned char *destpixel;

Loading…
Cancel
Save