|
|
@ -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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|