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-17 12:27:02 (GMT)
commitaf0c23dbaab384c8022432619632fce4f250dcf8 (patch)
tree84d56e0fb65208e54807b6268d06f577809f68dd
parentcbc8d0905488d9efe5c9ecb2e97076e27049c6b3 (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 0b7aaa1..986b95c 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