* [PATCH] libv4l - spca561: Have static decoding tables
@ 2009-10-06 6:51 Jean-Francois Moine
0 siblings, 0 replies; only message in thread
From: Jean-Francois Moine @ 2009-10-06 6:51 UTC (permalink / raw)
To: Hans de Goede; +Cc: V4L Mailing List
[-- Attachment #1: Type: text/plain, Size: 316 bytes --]
Hello Hans,
Searching the image encoding type of a new (but old!) webcam and tracing
some decoding functions, I was surprised to see a move of constant
tables to the stack in internal_spca561_decode.
Best regards.
--
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
[-- Attachment #2: libv4l-spca561.patch --]
[-- Type: text/x-patch, Size: 3726 bytes --]
libv4l - spca561: Have static decoding tables
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
diff -r fbecc4a86361 v4l2-apps/libv4l/libv4lconvert/spca561-decompress.c
--- a/v4l2-apps/libv4l/libv4lconvert/spca561-decompress.c Mon Oct 05 10:41:30 2009 +0200
+++ b/v4l2-apps/libv4l/libv4lconvert/spca561-decompress.c Tue Oct 06 08:37:30 2009 +0200
@@ -308,7 +308,7 @@
static int accum[8 * 8 * 8];
static int i_hits[8 * 8 * 8];
- const int nbits_A[] =
+ static const int nbits_A[] =
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1,
@@ -336,7 +336,7 @@
3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
};
- const int tab_A[] =
+ static const int tab_A[] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
@@ -371,7 +371,7 @@
1
};
- const int nbits_B[] =
+ static const int nbits_B[] =
{ 0, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3,
@@ -399,7 +399,7 @@
1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
};
- const int tab_B[] =
+ static const int tab_B[] =
{ 0xff, -4, 3, 3, -3, -3, -3, -3, 2, 2, 2, 2, 2, 2, 2, 2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
1, 1,
@@ -434,7 +434,7 @@
0, 0, 0, 0, 0, 0, 0,
};
- const int nbits_C[] =
+ static const int nbits_C[] =
{ 0, 0, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4,
@@ -462,7 +462,7 @@
2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
};
- const int tab_C[] =
+ static const int tab_C[] =
{ 0xff, 0xfe, 6, -7, 5, 5, -6, -6, 4, 4, 4, 4, -5, -5, -5, -5,
3, 3, 3, 3, 3, 3, 3, 3, -4, -4, -4, -4, -4, -4, -4, -4, 2,
2, 2, 2,
@@ -498,7 +498,7 @@
-1,
};
- const int nbits_D[] =
+ static const int nbits_D[] =
{ 0, 0, 0, 0, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5,
@@ -526,7 +526,7 @@
3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
};
- const int tab_D[] =
+ static const int tab_D[] =
{ 0xff, 0xfe, 0xfd, 0xfc, 10, -11, 11, -12, 8, 8, -9, -9, 9, 9,
-10, -10, 6, 6, 6, 6, -7, -7, -7, -7, 7, 7, 7, 7, -8, -8,
-8, -8,
@@ -564,7 +564,7 @@
};
/* a_curve[19 + i] = ... [-19..19] => [-160..160] */
- const int a_curve[] =
+ static const int a_curve[] =
{ -160, -144, -128, -112, -98, -88, -80, -72, -64, -56, -48,
-40, -32, -24, -18, -12, -8, -5, -2, 0, 2, 5, 8, 12, 18,
24, 32,
@@ -572,7 +572,7 @@
72, 80, 88, 98, 112, 128, 144, 160
};
/* clamp0_255[256 + i] = min(max(i,255),0) */
- const unsigned char clamp0_255[] =
+ static const unsigned char clamp0_255[] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
@@ -681,14 +681,14 @@
255
};
/* abs_clamp15[19 + i] = min(abs(i), 15) */
- const int abs_clamp15[] =
+ static const int abs_clamp15[] =
{ 15, 15, 15, 15, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
15, 15,
15
};
/* diff_encoding[256 + i] = ... */
- const int diff_encoding[] =
+ static const int diff_encoding[] =
{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-10-06 6:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-06 6:51 [PATCH] libv4l - spca561: Have static decoding tables Jean-Francois Moine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).