aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-08-17 12:16:57 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-08-28 11:15:14 (GMT)
commitf533d5b9fcba2ae12282776c5c8bab2f91bb8c10 (patch)
tree94a57490f6683046e90b55523275087c6c56f264
parent018842e4f1f5bf1dc92981707316766e046a5440 (diff)
Fix depth on filters and fileio
V4L2 uses depth as bits per pixel, while filters and file io uses it as bits per byte. Do the conversion. Fixes a regression on Camorama filters. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--src/callbacks.c8
-rw-r--r--src/fileio.c10
2 files changed, 9 insertions, 9 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 8c7799d..1d8e1cb 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -487,8 +487,8 @@ static void
apply_filters(cam* cam) {
/* v4l has reverse rgb order from what camora expect so call the color
filter to fix things up before running the user selected filters */
- camorama_filter_color_filter(NULL, cam->pic_buf, cam->width, cam->height, cam->depth);
- camorama_filter_chain_apply(cam->filter_chain, cam->pic_buf, cam->width, cam->height, cam->depth);
+ camorama_filter_color_filter(NULL, cam->pic_buf, cam->width, cam->height, cam->depth / 8);
+ camorama_filter_chain_apply(cam->filter_chain, cam->pic_buf, cam->width, cam->height, cam->depth / 8);
#warning "FIXME: enable the threshold channel filter"
// if((effect_mask & CAMORAMA_FILTER_THRESHOLD_CHANNEL) != 0)
// threshold_channel (cam->pic_buf, cam->width, cam->height, cam->dither);
@@ -520,7 +520,7 @@ read_timeout_func(cam* cam) {
*/
if (cam->pixformat == V4L2_PIX_FMT_YUV420) {
- yuv420p_to_rgb (cam->pic_buf, cam->tmp, cam->width, cam->height, cam->depth);
+ yuv420p_to_rgb (cam->pic_buf, cam->tmp, cam->width, cam->height, cam->depth / 8);
pic_buf = cam->tmp;
}
@@ -552,7 +552,7 @@ gint timeout_func (cam * cam)
* refer the frame
*/
if (cam->pixformat == V4L2_PIX_FMT_YUV420) {
- yuv420p_to_rgb (cam->pic_buf, cam->tmp, cam->width, cam->height, cam->depth);
+ yuv420p_to_rgb (cam->pic_buf, cam->tmp, cam->width, cam->height, cam->depth / 8);
pic_buf = cam->tmp;
}
diff --git a/src/fileio.c b/src/fileio.c
index ff6897f..da98050 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -174,10 +174,10 @@ void remote_save (cam * cam)
* exit (0);
* }
*
- * tmp = malloc (sizeof (char) * cam->width * cam->height * cam->depth * 2);
+ * tmp = malloc (sizeof (char) * cam->width * cam->height * cam->depth * 2 / 8);
* while (!feof (fp))
* {
- * bytes += fread (tmp, 1, cam->width * cam->height * cam->depth, fp);
+ * bytes += fread (tmp, 1, cam->width * cam->height * cam->depth / 8, fp);
* }
* fclose (fp);
*
@@ -280,9 +280,9 @@ void save_thread (cam * cam)
//exit (0);
}
- tmp = malloc (sizeof (char) * cam->width * cam->height * cam->depth * 2);
+ tmp = malloc (sizeof (char) * cam->width * cam->height * cam->depth * 2 / 8);
while (!feof (fp)) {
- bytes += fread (tmp, 1, cam->width * cam->height * cam->depth, fp);
+ bytes += fread (tmp, 1, cam->width * cam->height * cam->depth / 8, fp);
}
fclose (fp);
@@ -367,7 +367,7 @@ int local_save (cam * cam)
ext = g_strdup ((gchar *) "jpeg");
}
//cam->tmp = NULL;
- //memcpy (cam->tmp, cam->pic_buf, cam->width * cam->height * cam->depth);
+ //memcpy (cam->tmp, cam->pic_buf, cam->width * cam->height * cam->depth / 8);
if (cam->timestamp == TRUE) {
add_rgb_text (cam->tmp, cam->width, cam->height, cam->ts_string,

Privacy Policy