New upstream release 0.8.8
- Add patches from upstream git to improve Pixart JPEG decoding - Add patch from upstream git to fix building with latest kernels (rhbz#823863)
This commit is contained in:
parent
4a60185935
commit
352a2ee69f
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
/v4l-utils-0.8.4.tar.bz2
|
||||
/v4l-utils-0.8.5.tar.bz2
|
||||
/v4l-utils-0.8.7.tar.bz2
|
||||
/v4l-utils-0.8.8.tar.bz2
|
||||
|
||||
55
0001-dvb-Fix-spelling-errors-found-by-lintian.patch
Normal file
55
0001-dvb-Fix-spelling-errors-found-by-lintian.patch
Normal file
@ -0,0 +1,55 @@
|
||||
From ef5beb9f065a3fdd48156df2a02b45a747b52477 Mon Sep 17 00:00:00 2001
|
||||
From: Gregor Jasny <gjasny@googlemail.com>
|
||||
Date: Sat, 14 Apr 2012 23:12:15 +0200
|
||||
Subject: [PATCH 01/12] dvb: Fix spelling errors found by lintian
|
||||
|
||||
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
|
||||
(cherry picked from commit 1c900164cca4eac31d7b967289915929bc672ae7)
|
||||
---
|
||||
utils/dvb/README | 2 +-
|
||||
utils/dvb/dvbv5-scan.c | 2 +-
|
||||
utils/dvb/dvbv5-zap.c | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/utils/dvb/README b/utils/dvb/README
|
||||
index c6cbf3e..76bb32a 100644
|
||||
--- a/utils/dvb/README
|
||||
+++ b/utils/dvb/README
|
||||
@@ -7,7 +7,7 @@ using its latest V5 API. The tools can also work with the DVBv3 API.
|
||||
The current tools are:
|
||||
|
||||
dvb-fe-tool - a simple test application, that reads from the frontend.
|
||||
- it also allows to change the default delivery system.
|
||||
+ it also allows one to change the default delivery system.
|
||||
In the future, it may be used to change any property
|
||||
via command line.
|
||||
|
||||
diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
|
||||
index c7365bc..dcb5cfe 100644
|
||||
--- a/utils/dvb/dvbv5-scan.c
|
||||
+++ b/utils/dvb/dvbv5-scan.c
|
||||
@@ -57,7 +57,7 @@ static const struct argp_option options[] = {
|
||||
{"lnbf", 'l', "LNBf_type", 0, "type of LNBf to use. 'help' lists the available ones", 0},
|
||||
{"sat_number", 'S', "satellite_number", 0, "satellite number. If not specified, disable DISEqC", 0},
|
||||
{"freq_bpf", 'U', "frequency", 0, "SCR/Unicable band-pass filter frequency to use, in kHz", 0},
|
||||
- {"wait", 'W', "time", 0, "adds aditional wait time for DISEqC command completion", 0},
|
||||
+ {"wait", 'W', "time", 0, "adds additional wait time for DISEqC command completion", 0},
|
||||
{"nit", 'N', NULL, 0, "use data from NIT table on the output file", 0},
|
||||
{"get_frontend",'G', NULL, 0, "use data from get_frontend on the output file", 0},
|
||||
{"verbose", 'v', NULL, 0, "be (very) verbose", 0},
|
||||
diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
|
||||
index 0dc6d20..c8aaf9d 100644
|
||||
--- a/utils/dvb/dvbv5-zap.c
|
||||
+++ b/utils/dvb/dvbv5-zap.c
|
||||
@@ -65,7 +65,7 @@ static const struct argp_option options[] = {
|
||||
{"lnbf", 'l', "LNBf_type", 0, "type of LNBf to use. 'help' lists the available ones", 0},
|
||||
{"sat_number", 'S', "satellite_number", 0, "satellite number. If not specified, disable DISEqC", 0},
|
||||
{"freq_bpf", 'U', "frequency", 0, "SCR/Unicable band-pass filter frequency to use, in kHz", 0},
|
||||
- {"wait", 'W', "time", 0, "adds aditional wait time for DISEqC command completion", 0},
|
||||
+ {"wait", 'W', "time", 0, "adds additional wait time for DISEqC command completion", 0},
|
||||
{"channels", 'c', "file", 0, "read channels list from 'file'", 0},
|
||||
{"exit", 'x', NULL, 0, "exit after tuning", 0},
|
||||
{"record", 'r', NULL, 0, "set up /dev/dvb/adapterX/dvr0 for TS recording", 0},
|
||||
--
|
||||
1.7.10
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
From 3df030fe82a31556695dc147e2a28288bbe12cf8 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sat, 7 Apr 2012 16:31:12 +0200
|
||||
Subject: [PATCH 1/5] libv4lconver/tinyjpeg: Fix out of bounds array usage
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
lib/libv4lconvert/tinyjpeg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg.c b/lib/libv4lconvert/tinyjpeg.c
|
||||
index e308f63..967e0be 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg.c
|
||||
+++ b/lib/libv4lconvert/tinyjpeg.c
|
||||
@@ -2556,7 +2556,7 @@ int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **component
|
||||
{
|
||||
int i;
|
||||
|
||||
- for (i = 0; priv->components[i] && i < COMPONENTS; i++)
|
||||
+ for (i = 0; i < COMPONENTS && priv->components[i]; i++)
|
||||
components[i] = priv->components[i];
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
1.7.9.3
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
From 40a6547a0f93f571772672fed2de8de17e02d1bb Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Mon, 23 Apr 2012 19:43:07 +0200
|
||||
Subject: [PATCH 02/12] libv4lconvert: Fix decoding of 160x120 Pixart JPEG
|
||||
images
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
lib/libv4lconvert/tinyjpeg.c | 16 +++++++++++++---
|
||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg.c b/lib/libv4lconvert/tinyjpeg.c
|
||||
index 2c2d4af..d2a7d3f 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg.c
|
||||
+++ b/lib/libv4lconvert/tinyjpeg.c
|
||||
@@ -2101,7 +2101,17 @@ static int pixart_filter(struct jdec_private *priv, unsigned char *dest,
|
||||
{
|
||||
int chunksize, copied = 0;
|
||||
|
||||
- /* Skip mysterious first data byte */
|
||||
+ /* The first data bytes encodes the image size:
|
||||
+ 0x60: 160x120
|
||||
+ 0x61: 320x240
|
||||
+ 0x62: 640x480
|
||||
+ 160x120 images are not chunked due to their small size!
|
||||
+ */
|
||||
+ if (src[0] == 0x60) {
|
||||
+ memcpy(dest, src + 1, n - 1);
|
||||
+ return n - 1;
|
||||
+ }
|
||||
+
|
||||
src++;
|
||||
n--;
|
||||
|
||||
@@ -2124,8 +2134,8 @@ kernel: 0xff 0xff 0x00 0xff 0x96, and we skip one unknown byte */
|
||||
|
||||
if (src[0] != 0xff || src[1] != 0xff || src[2] != 0xff)
|
||||
error("Missing Pixart ff ff ff xx header, "
|
||||
- "got: %02x %02x %02x %02x\n",
|
||||
- src[0], src[1], src[2], src[3]);
|
||||
+ "got: %02x %02x %02x %02x, copied sofar: %d\n",
|
||||
+ src[0], src[1], src[2], src[3], copied);
|
||||
if (src[3] > 6)
|
||||
error("Unexpected Pixart chunk size: %d\n", src[3]);
|
||||
|
||||
--
|
||||
1.7.10
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
From e186777daeaa717b7d919e932f7d3be10156d572 Mon Sep 17 00:00:00 2001
|
||||
From: Jean-Francois Moine <moinejf@free.fr>
|
||||
Date: Fri, 23 Mar 2012 20:19:45 +0100
|
||||
Subject: [PATCH 2/5] tinyjpeg: Better luminance quantization table for Pixart
|
||||
JPEG
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
An other luminance quantization table gives a better quality to the
|
||||
Pixart images created by the webcams handled by the gspca drivers
|
||||
pac7302 and pac7311 (pixel format 'PJPG').
|
||||
|
||||
Tests have been done with 5 different pac7302 webcams. The marker was
|
||||
always 0x44.
|
||||
|
||||
Signed-off-by: Jean-François Moine <moinejf@free.fr>
|
||||
---
|
||||
lib/libv4lconvert/tinyjpeg.c | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg.c b/lib/libv4lconvert/tinyjpeg.c
|
||||
index 967e0be..2c2d4af 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg.c
|
||||
+++ b/lib/libv4lconvert/tinyjpeg.c
|
||||
@@ -206,14 +206,14 @@ static const unsigned char val_ac_chrominance[] = {
|
||||
};
|
||||
|
||||
const unsigned char pixart_quantization[][64] = { {
|
||||
- 0x07, 0x07, 0x08, 0x0a, 0x09, 0x07, 0x0d, 0x0b,
|
||||
- 0x0c, 0x0d, 0x11, 0x10, 0x0f, 0x12, 0x17, 0x27,
|
||||
- 0x1a, 0x18, 0x16, 0x16, 0x18, 0x31, 0x23, 0x25,
|
||||
- 0x1d, 0x28, 0x3a, 0x33, 0x3d, 0x3c, 0x39, 0x33,
|
||||
- 0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, 0x44,
|
||||
- 0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57,
|
||||
- 0x5f, 0x62, 0x67, 0x68, 0x67, 0x3e, 0x4d, 0x71,
|
||||
- 0x79, 0x70, 0x64, 0x78, 0x5c, 0x65, 0x67, 0x63,
|
||||
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20,
|
||||
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
+ 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
},
|
||||
{
|
||||
0x11, 0x12, 0x12, 0x18, 0x15, 0x18, 0x2f, 0x1a,
|
||||
--
|
||||
1.7.9.3
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
From 09dfce3c1ed184326c5ac2acde61bc5ba3798058 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sat, 21 Apr 2012 14:39:58 +0200
|
||||
Subject: [PATCH 03/12] Revert "tinyjpeg: Better luminance quantization table
|
||||
for Pixart JPEG"
|
||||
|
||||
This reverts commit e186777daeaa717b7d919e932f7d3be10156d572.
|
||||
---
|
||||
lib/libv4lconvert/tinyjpeg.c | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg.c b/lib/libv4lconvert/tinyjpeg.c
|
||||
index d2a7d3f..756ad9c 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg.c
|
||||
+++ b/lib/libv4lconvert/tinyjpeg.c
|
||||
@@ -206,14 +206,14 @@ static const unsigned char val_ac_chrominance[] = {
|
||||
};
|
||||
|
||||
const unsigned char pixart_quantization[][64] = { {
|
||||
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10,
|
||||
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
- 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20,
|
||||
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
- 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
+ 0x07, 0x07, 0x08, 0x0a, 0x09, 0x07, 0x0d, 0x0b,
|
||||
+ 0x0c, 0x0d, 0x11, 0x10, 0x0f, 0x12, 0x17, 0x27,
|
||||
+ 0x1a, 0x18, 0x16, 0x16, 0x18, 0x31, 0x23, 0x25,
|
||||
+ 0x1d, 0x28, 0x3a, 0x33, 0x3d, 0x3c, 0x39, 0x33,
|
||||
+ 0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, 0x44,
|
||||
+ 0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57,
|
||||
+ 0x5f, 0x62, 0x67, 0x68, 0x67, 0x3e, 0x4d, 0x71,
|
||||
+ 0x79, 0x70, 0x64, 0x78, 0x5c, 0x65, 0x67, 0x63,
|
||||
},
|
||||
{
|
||||
0x11, 0x12, 0x12, 0x18, 0x15, 0x18, 0x2f, 0x1a,
|
||||
--
|
||||
1.7.10
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
From e681916636373959c39b3f13a44e145106119b68 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sun, 8 Apr 2012 11:27:52 +0200
|
||||
Subject: [PATCH 3/5] libv4lconver: Add 06f8:301b pac7302 based cam to the
|
||||
quirk table
|
||||
|
||||
Reported-by: Jean-Francois Moine <moinejf@free.fr>
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
lib/libv4lconvert/control/libv4lcontrol.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
index 701483b..25b502a 100644
|
||||
--- a/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
+++ b/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
@@ -203,6 +203,8 @@ static const struct v4lcontrol_flags_info v4lcontrol_flags[] = {
|
||||
V4LCONTROL_ROTATED_90_JPEG | V4LCONTROL_WANTS_WB, 1500 },
|
||||
{ 0x06f8, 0x3009, 0, NULL, NULL,
|
||||
V4LCONTROL_ROTATED_90_JPEG | V4LCONTROL_WANTS_WB, 1500 },
|
||||
+ { 0x06f8, 0x301b, 0, NULL, NULL,
|
||||
+ V4LCONTROL_ROTATED_90_JPEG | V4LCONTROL_WANTS_WB, 1500 },
|
||||
{ 0x145f, 0x013c, 0, NULL, NULL,
|
||||
V4LCONTROL_ROTATED_90_JPEG | V4LCONTROL_WANTS_WB, 1500 },
|
||||
/* Pac7311 based devices */
|
||||
--
|
||||
1.7.9.3
|
||||
|
||||
150
0004-libv4lconvert-Dynamic-quantization-tables-for-Pixart.patch
Normal file
150
0004-libv4lconvert-Dynamic-quantization-tables-for-Pixart.patch
Normal file
@ -0,0 +1,150 @@
|
||||
From 7b9ee388ca510e818dc9f248c8cd6c2ffe40fa94 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Mon, 23 Apr 2012 23:03:40 +0200
|
||||
Subject: [PATCH 04/12] libv4lconvert: Dynamic quantization tables for Pixart
|
||||
JPEG
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Inspired by a patch from Jean-François Moine <moinejf@free.fr>, I've spend
|
||||
4 days on a row investigating (through trial and error) Pixart's JPEG
|
||||
compression. This patch accumulates what I've learned from this, giving 2
|
||||
important improvements:
|
||||
1) Support for properly decompressing pac7302 generated images where some
|
||||
of the MCU-s are compressed with a lower quality / higher quantization
|
||||
values
|
||||
2) Proper chrominance quantization tables for Pixart JPEG, getting rid of
|
||||
the sometimes horribly over saturation our decompression code was causing
|
||||
|
||||
The support for dynamic quantization tables this patch adds also allows us to
|
||||
enable lower compression ratios in the kernel driver when running at a lower
|
||||
framerate, resulting in better image quality.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
lib/libv4lconvert/tinyjpeg-internal.h | 1 +
|
||||
lib/libv4lconvert/tinyjpeg.c | 77 ++++++++++++++++++++++-----------
|
||||
2 files changed, 53 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg-internal.h b/lib/libv4lconvert/tinyjpeg-internal.h
|
||||
index 702a2a2..4041251 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg-internal.h
|
||||
+++ b/lib/libv4lconvert/tinyjpeg-internal.h
|
||||
@@ -103,6 +103,7 @@ struct jdec_private {
|
||||
#if SANITY_CHECK
|
||||
unsigned int current_cid; /* For planar JPEG */
|
||||
#endif
|
||||
+ unsigned char marker; /* for PJPG (Pixart JPEG) */
|
||||
|
||||
/* Temp space used after the IDCT to store each components */
|
||||
uint8_t Y[64 * 4], Cr[64], Cb[64];
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg.c b/lib/libv4lconvert/tinyjpeg.c
|
||||
index 756ad9c..dd77d0f 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg.c
|
||||
+++ b/lib/libv4lconvert/tinyjpeg.c
|
||||
@@ -205,9 +205,11 @@ static const unsigned char val_ac_chrominance[] = {
|
||||
0xf9, 0xfa
|
||||
};
|
||||
|
||||
-const unsigned char pixart_quantization[][64] = { {
|
||||
- 0x07, 0x07, 0x08, 0x0a, 0x09, 0x07, 0x0d, 0x0b,
|
||||
- 0x0c, 0x0d, 0x11, 0x10, 0x0f, 0x12, 0x17, 0x27,
|
||||
+/* Standard JPEG quantization tables from Annex K of the JPEG standard.
|
||||
+ Note unlike in Annex K the entries here are in zigzag order! */
|
||||
+const unsigned char standard_quantization[][64] = { {
|
||||
+ 0x10, 0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e,
|
||||
+ 0x0d, 0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28,
|
||||
0x1a, 0x18, 0x16, 0x16, 0x18, 0x31, 0x23, 0x25,
|
||||
0x1d, 0x28, 0x3a, 0x33, 0x3d, 0x3c, 0x39, 0x33,
|
||||
0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, 0x44,
|
||||
@@ -1376,25 +1378,57 @@ static void decode_MCU_2x1_3planes(struct jdec_private *priv)
|
||||
IDCT(&priv->component_infos[cCr], priv->Cr, 8);
|
||||
}
|
||||
|
||||
+static void build_quantization_table(float *qtable, const unsigned char *ref_table);
|
||||
+
|
||||
static void pixart_decode_MCU_2x1_3planes(struct jdec_private *priv)
|
||||
{
|
||||
unsigned char marker;
|
||||
|
||||
- look_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream, 8, marker);
|
||||
- /* I think the marker indicates which quantization table to use, iow
|
||||
- a Pixart JPEG may have a different quantization table per MCU, most
|
||||
- MCU's have 0x44 as marker for which our special Pixart quantization
|
||||
- tables are correct. Unfortunately with a 7302 some blocks also have 0x48,
|
||||
- and sometimes even other values. As 0x48 is quite common too, we really
|
||||
- need to find out the correct table for that, as currently the blocks
|
||||
- with a 0x48 marker look wrong. During normal operation the marker stays
|
||||
- within the range below, if it gets out of this range we're most likely
|
||||
- decoding garbage */
|
||||
- if (marker < 0x20 || marker > 0x7f) {
|
||||
- snprintf(priv->error_string, sizeof(priv->error_string),
|
||||
- "Pixart JPEG error: invalid MCU marker: 0x%02x\n",
|
||||
- (unsigned int)marker);
|
||||
- longjmp(priv->jump_state, -EIO);
|
||||
+ look_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream,
|
||||
+ 8, marker);
|
||||
+
|
||||
+ /* Pixart JPEG MCU-s are preceded by a marker indicating the quality
|
||||
+ setting with which the MCU is compressed, IOW the MCU-s may have a
|
||||
+ different quantization table per MCU. So if the marker changes we
|
||||
+ need to rebuild the quantization tables. */
|
||||
+ if (marker != priv->marker) {
|
||||
+ int i, j, comp;
|
||||
+ unsigned char qt[64];
|
||||
+ /* These values have been found by trial and error and seem to
|
||||
+ work reasonably. Markers with index 0 - 7 are never
|
||||
+ generated by the hardware, so they are likely wrong. */
|
||||
+ const int qfactor[32] = {
|
||||
+ 10, 12, 14, 16, 18, 20, 22, 24,
|
||||
+ 25, 30, 35, 40, 45, 50, 55, 60,
|
||||
+ 64, 68, 80, 90, 100, 120, 140, 160,
|
||||
+ 180, 200, 220, 240, 260, 280, 300, 320
|
||||
+ };
|
||||
+
|
||||
+ i = (marker & 0x7c) >> 2; /* Bits 0 and 1 are always 0 */
|
||||
+ comp = qfactor[i];
|
||||
+
|
||||
+ /* And another special Pixart feature, the DC quantization
|
||||
+ factor is fixed! */
|
||||
+ qt[0] = 7;
|
||||
+ for (i = 1; i < 64; i++) {
|
||||
+ j = (standard_quantization[0][i] * comp + 50) / 100;
|
||||
+ qt[i] = (j < 255) ? j : 255;
|
||||
+ }
|
||||
+ build_quantization_table(priv->Q_tables[0], qt);
|
||||
+
|
||||
+ /* And yet another Pixart JPEG special feature, Pixart JPEG
|
||||
+ uses the luminance table for chrominance too! Either
|
||||
+ as is or with all values multiplied by 2, this is encoded
|
||||
+ in bit 7 of the marker. */
|
||||
+ if (!(marker & 0x80)) {
|
||||
+ for (i = 0; i < 64; i++) {
|
||||
+ j = qt[i] * 2;
|
||||
+ qt[i] = (j < 255) ? j : 255;
|
||||
+ }
|
||||
+ }
|
||||
+ build_quantization_table(priv->Q_tables[1], qt);
|
||||
+
|
||||
+ priv->marker = marker;
|
||||
}
|
||||
skip_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream, 8);
|
||||
|
||||
@@ -1944,13 +1978,6 @@ static int parse_JFIF(struct jdec_private *priv, const unsigned char *stream)
|
||||
(!dqt_marker_found && !(priv->flags & TINYJPEG_FLAGS_PIXART_JPEG)))
|
||||
goto bogus_jpeg_format;
|
||||
|
||||
- if (priv->flags & TINYJPEG_FLAGS_PIXART_JPEG) {
|
||||
- if (!priv->default_huffman_table_initialized) {
|
||||
- build_quantization_table(priv->Q_tables[0], pixart_quantization[0]);
|
||||
- build_quantization_table(priv->Q_tables[1], pixart_quantization[1]);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if (!dht_marker_found) {
|
||||
trace("No Huffman table loaded, using the default one\n");
|
||||
if (build_default_huffman_tables(priv))
|
||||
--
|
||||
1.7.10
|
||||
|
||||
@ -1,542 +0,0 @@
|
||||
From 31d2b0b0e40c6c92984d5077bb1a324729c71e7d Mon Sep 17 00:00:00 2001
|
||||
From: Robert Abel <abel@uni-bielefeld.de>
|
||||
Date: Sat, 25 Feb 2012 18:12:38 +0100
|
||||
Subject: [PATCH 4/5] libv4lconvert: Use bytesperline instead of width
|
||||
|
||||
Basically, I found that libv4l and its conversion functions usually
|
||||
choose to ignore v4l2_pix_format.bytesperline, which seems to work out
|
||||
most of the time.
|
||||
|
||||
I'm currently working with the mt9v032 camera on a Gumstix Overo board.
|
||||
The mt9v032's driver pads output lines to 768 pixels, giving 0x900 bytes
|
||||
per line. All code in bayer.c (the camera uses raw bayer pattern) is
|
||||
written to assume bytesperline = width and thus everything goes horribly
|
||||
wrong.
|
||||
|
||||
Anyway, the patch for bayer => rgb as well as bayer => yuv is attached.
|
||||
Basically, every time where width was assumed to be the offset to the
|
||||
neighboring pixel below, now step is used.
|
||||
|
||||
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
|
||||
---
|
||||
lib/libv4lconvert/bayer.c | 219 ++++++++++++++++----------------
|
||||
lib/libv4lconvert/libv4lconvert-priv.h | 6 +-
|
||||
lib/libv4lconvert/libv4lconvert.c | 9 +-
|
||||
3 files changed, 119 insertions(+), 115 deletions(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/bayer.c b/lib/libv4lconvert/bayer.c
|
||||
index 924b8d4..d22db68 100644
|
||||
--- a/lib/libv4lconvert/bayer.c
|
||||
+++ b/lib/libv4lconvert/bayer.c
|
||||
@@ -44,7 +44,7 @@
|
||||
/* inspired by OpenCV's Bayer decoding */
|
||||
static void v4lconvert_border_bayer_line_to_bgr24(
|
||||
const unsigned char *bayer, const unsigned char *adjacent_bayer,
|
||||
- unsigned char *bgr, int width, int start_with_green, int blue_line)
|
||||
+ unsigned char *bgr, int width, const int start_with_green, const int blue_line)
|
||||
{
|
||||
int t0, t1;
|
||||
|
||||
@@ -164,11 +164,11 @@ static void v4lconvert_border_bayer_line_to_bgr24(
|
||||
|
||||
/* From libdc1394, which on turn was based on OpenCV's Bayer decoding */
|
||||
static void bayer_to_rgbbgr24(const unsigned char *bayer,
|
||||
- unsigned char *bgr, int width, int height, unsigned int pixfmt,
|
||||
+ unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt,
|
||||
int start_with_green, int blue_line)
|
||||
{
|
||||
/* render the first line */
|
||||
- v4lconvert_border_bayer_line_to_bgr24(bayer, bayer + width, bgr, width,
|
||||
+ v4lconvert_border_bayer_line_to_bgr24(bayer, bayer + stride, bgr, width,
|
||||
start_with_green, blue_line);
|
||||
bgr += width * 3;
|
||||
|
||||
@@ -179,139 +179,141 @@ static void bayer_to_rgbbgr24(const unsigned char *bayer,
|
||||
const unsigned char *bayer_end = bayer + (width - 2);
|
||||
|
||||
if (start_with_green) {
|
||||
- /* OpenCV has a bug in the next line, which was
|
||||
- t0 = (bayer[0] + bayer[width * 2] + 1) >> 1; */
|
||||
- t0 = (bayer[1] + bayer[width * 2 + 1] + 1) >> 1;
|
||||
+
|
||||
+ t0 = (bayer[1] + bayer[stride * 2 + 1] + 1) >> 1;
|
||||
/* Write first pixel */
|
||||
- t1 = (bayer[0] + bayer[width * 2] + bayer[width + 1] + 1) / 3;
|
||||
+ t1 = (bayer[0] + bayer[stride * 2] + bayer[stride + 1] + 1) / 3;
|
||||
if (blue_line) {
|
||||
*bgr++ = t0;
|
||||
*bgr++ = t1;
|
||||
- *bgr++ = bayer[width];
|
||||
+ *bgr++ = bayer[stride];
|
||||
} else {
|
||||
- *bgr++ = bayer[width];
|
||||
+ *bgr++ = bayer[stride];
|
||||
*bgr++ = t1;
|
||||
*bgr++ = t0;
|
||||
}
|
||||
|
||||
/* Write second pixel */
|
||||
- t1 = (bayer[width] + bayer[width + 2] + 1) >> 1;
|
||||
+ t1 = (bayer[stride] + bayer[stride + 2] + 1) >> 1;
|
||||
if (blue_line) {
|
||||
*bgr++ = t0;
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
*bgr++ = t1;
|
||||
} else {
|
||||
*bgr++ = t1;
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
*bgr++ = t0;
|
||||
}
|
||||
bayer++;
|
||||
} else {
|
||||
/* Write first pixel */
|
||||
- t0 = (bayer[0] + bayer[width * 2] + 1) >> 1;
|
||||
+ t0 = (bayer[0] + bayer[stride * 2] + 1) >> 1;
|
||||
if (blue_line) {
|
||||
*bgr++ = t0;
|
||||
- *bgr++ = bayer[width];
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
} else {
|
||||
- *bgr++ = bayer[width + 1];
|
||||
- *bgr++ = bayer[width];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
+ *bgr++ = bayer[stride];
|
||||
*bgr++ = t0;
|
||||
}
|
||||
}
|
||||
|
||||
if (blue_line) {
|
||||
for (; bayer <= bayer_end - 2; bayer += 2) {
|
||||
- t0 = (bayer[0] + bayer[2] + bayer[width * 2] +
|
||||
- bayer[width * 2 + 2] + 2) >> 2;
|
||||
- t1 = (bayer[1] + bayer[width] + bayer[width + 2] +
|
||||
- bayer[width * 2 + 1] + 2) >> 2;
|
||||
+ t0 = (bayer[0] + bayer[2] + bayer[stride * 2] +
|
||||
+ bayer[stride * 2 + 2] + 2) >> 2;
|
||||
+ t1 = (bayer[1] + bayer[stride] + bayer[stride + 2] +
|
||||
+ bayer[stride * 2 + 1] + 2) >> 2;
|
||||
*bgr++ = t0;
|
||||
*bgr++ = t1;
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
|
||||
- t0 = (bayer[2] + bayer[width * 2 + 2] + 1) >> 1;
|
||||
- t1 = (bayer[width + 1] + bayer[width + 3] + 1) >> 1;
|
||||
+ t0 = (bayer[2] + bayer[stride * 2 + 2] + 1) >> 1;
|
||||
+ t1 = (bayer[stride + 1] + bayer[stride + 3] + 1) >> 1;
|
||||
*bgr++ = t0;
|
||||
- *bgr++ = bayer[width + 2];
|
||||
+ *bgr++ = bayer[stride + 2];
|
||||
*bgr++ = t1;
|
||||
}
|
||||
} else {
|
||||
for (; bayer <= bayer_end - 2; bayer += 2) {
|
||||
- t0 = (bayer[0] + bayer[2] + bayer[width * 2] +
|
||||
- bayer[width * 2 + 2] + 2) >> 2;
|
||||
- t1 = (bayer[1] + bayer[width] + bayer[width + 2] +
|
||||
- bayer[width * 2 + 1] + 2) >> 2;
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ t0 = (bayer[0] + bayer[2] + bayer[stride * 2] +
|
||||
+ bayer[stride * 2 + 2] + 2) >> 2;
|
||||
+ t1 = (bayer[1] + bayer[stride] + bayer[stride + 2] +
|
||||
+ bayer[stride * 2 + 1] + 2) >> 2;
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
*bgr++ = t1;
|
||||
*bgr++ = t0;
|
||||
|
||||
- t0 = (bayer[2] + bayer[width * 2 + 2] + 1) >> 1;
|
||||
- t1 = (bayer[width + 1] + bayer[width + 3] + 1) >> 1;
|
||||
+ t0 = (bayer[2] + bayer[stride * 2 + 2] + 1) >> 1;
|
||||
+ t1 = (bayer[stride + 1] + bayer[stride + 3] + 1) >> 1;
|
||||
*bgr++ = t1;
|
||||
- *bgr++ = bayer[width + 2];
|
||||
+ *bgr++ = bayer[stride + 2];
|
||||
*bgr++ = t0;
|
||||
}
|
||||
}
|
||||
|
||||
if (bayer < bayer_end) {
|
||||
/* write second to last pixel */
|
||||
- t0 = (bayer[0] + bayer[2] + bayer[width * 2] +
|
||||
- bayer[width * 2 + 2] + 2) >> 2;
|
||||
- t1 = (bayer[1] + bayer[width] + bayer[width + 2] +
|
||||
- bayer[width * 2 + 1] + 2) >> 2;
|
||||
+ t0 = (bayer[0] + bayer[2] + bayer[stride * 2] +
|
||||
+ bayer[stride * 2 + 2] + 2) >> 2;
|
||||
+ t1 = (bayer[1] + bayer[stride] + bayer[stride + 2] +
|
||||
+ bayer[stride * 2 + 1] + 2) >> 2;
|
||||
if (blue_line) {
|
||||
*bgr++ = t0;
|
||||
*bgr++ = t1;
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
} else {
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
*bgr++ = t1;
|
||||
*bgr++ = t0;
|
||||
}
|
||||
/* write last pixel */
|
||||
- t0 = (bayer[2] + bayer[width * 2 + 2] + 1) >> 1;
|
||||
+ t0 = (bayer[2] + bayer[stride * 2 + 2] + 1) >> 1;
|
||||
if (blue_line) {
|
||||
*bgr++ = t0;
|
||||
- *bgr++ = bayer[width + 2];
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride + 2];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
} else {
|
||||
- *bgr++ = bayer[width + 1];
|
||||
- *bgr++ = bayer[width + 2];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
+ *bgr++ = bayer[stride + 2];
|
||||
*bgr++ = t0;
|
||||
}
|
||||
+
|
||||
bayer++;
|
||||
+
|
||||
} else {
|
||||
/* write last pixel */
|
||||
- t0 = (bayer[0] + bayer[width * 2] + 1) >> 1;
|
||||
- t1 = (bayer[1] + bayer[width * 2 + 1] + bayer[width] + 1) / 3;
|
||||
+ t0 = (bayer[0] + bayer[stride * 2] + 1) >> 1;
|
||||
+ t1 = (bayer[1] + bayer[stride * 2 + 1] + bayer[stride] + 1) / 3;
|
||||
if (blue_line) {
|
||||
*bgr++ = t0;
|
||||
*bgr++ = t1;
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
} else {
|
||||
- *bgr++ = bayer[width + 1];
|
||||
+ *bgr++ = bayer[stride + 1];
|
||||
*bgr++ = t1;
|
||||
*bgr++ = t0;
|
||||
}
|
||||
+
|
||||
}
|
||||
|
||||
- /* skip 2 border pixels */
|
||||
- bayer += 2;
|
||||
+ /* skip 2 border pixels and padding */
|
||||
+ bayer += (stride - width) + 2;
|
||||
|
||||
blue_line = !blue_line;
|
||||
start_with_green = !start_with_green;
|
||||
}
|
||||
|
||||
/* render the last line */
|
||||
- v4lconvert_border_bayer_line_to_bgr24(bayer + width, bayer, bgr, width,
|
||||
+ v4lconvert_border_bayer_line_to_bgr24(bayer + stride, bayer, bgr, width,
|
||||
!start_with_green, !blue_line);
|
||||
}
|
||||
|
||||
void v4lconvert_bayer_to_rgb24(const unsigned char *bayer,
|
||||
- unsigned char *bgr, int width, int height, unsigned int pixfmt)
|
||||
+ unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt)
|
||||
{
|
||||
- bayer_to_rgbbgr24(bayer, bgr, width, height, pixfmt,
|
||||
+ bayer_to_rgbbgr24(bayer, bgr, width, height, stride, pixfmt,
|
||||
pixfmt == V4L2_PIX_FMT_SGBRG8 /* start with green */
|
||||
|| pixfmt == V4L2_PIX_FMT_SGRBG8,
|
||||
pixfmt != V4L2_PIX_FMT_SBGGR8 /* blue line */
|
||||
@@ -319,9 +321,9 @@ void v4lconvert_bayer_to_rgb24(const unsigned char *bayer,
|
||||
}
|
||||
|
||||
void v4lconvert_bayer_to_bgr24(const unsigned char *bayer,
|
||||
- unsigned char *bgr, int width, int height, unsigned int pixfmt)
|
||||
+ unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt)
|
||||
{
|
||||
- bayer_to_rgbbgr24(bayer, bgr, width, height, pixfmt,
|
||||
+ bayer_to_rgbbgr24(bayer, bgr, width, height, stride, pixfmt,
|
||||
pixfmt == V4L2_PIX_FMT_SGBRG8 /* start with green */
|
||||
|| pixfmt == V4L2_PIX_FMT_SGRBG8,
|
||||
pixfmt == V4L2_PIX_FMT_SBGGR8 /* blue line */
|
||||
@@ -428,7 +430,7 @@ static void v4lconvert_border_bayer_line_to_y(
|
||||
}
|
||||
|
||||
void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
|
||||
- int width, int height, unsigned int src_pixfmt, int yvu)
|
||||
+ int width, int height, const unsigned int stride, unsigned int src_pixfmt, int yvu)
|
||||
{
|
||||
int blue_line = 0, start_with_green = 0, x, y;
|
||||
unsigned char *ydst = yuv;
|
||||
@@ -451,12 +453,12 @@ void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
|
||||
|
||||
b = bayer[x];
|
||||
g = bayer[x + 1];
|
||||
- g += bayer[x + width];
|
||||
- r = bayer[x + width + 1];
|
||||
+ g += bayer[x + stride];
|
||||
+ r = bayer[x + stride + 1];
|
||||
*udst++ = (-4878 * r - 4789 * g + 14456 * b + 4210688) >> 15;
|
||||
*vdst++ = (14456 * r - 6052 * g - 2351 * b + 4210688) >> 15;
|
||||
}
|
||||
- bayer += 2 * width;
|
||||
+ bayer += 2 * stride;
|
||||
}
|
||||
blue_line = 1;
|
||||
break;
|
||||
@@ -468,12 +470,12 @@ void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
|
||||
|
||||
r = bayer[x];
|
||||
g = bayer[x + 1];
|
||||
- g += bayer[x + width];
|
||||
- b = bayer[x + width + 1];
|
||||
+ g += bayer[x + stride];
|
||||
+ b = bayer[x + stride + 1];
|
||||
*udst++ = (-4878 * r - 4789 * g + 14456 * b + 4210688) >> 15;
|
||||
*vdst++ = (14456 * r - 6052 * g - 2351 * b + 4210688) >> 15;
|
||||
}
|
||||
- bayer += 2 * width;
|
||||
+ bayer += 2 * stride;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -484,12 +486,12 @@ void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
|
||||
|
||||
g = bayer[x];
|
||||
b = bayer[x + 1];
|
||||
- r = bayer[x + width];
|
||||
- g += bayer[x + width + 1];
|
||||
+ r = bayer[x + stride];
|
||||
+ g += bayer[x + stride + 1];
|
||||
*udst++ = (-4878 * r - 4789 * g + 14456 * b + 4210688) >> 15;
|
||||
*vdst++ = (14456 * r - 6052 * g - 2351 * b + 4210688) >> 15;
|
||||
}
|
||||
- bayer += 2 * width;
|
||||
+ bayer += 2 * stride;
|
||||
}
|
||||
blue_line = 1;
|
||||
start_with_green = 1;
|
||||
@@ -502,21 +504,22 @@ void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
|
||||
|
||||
g = bayer[x];
|
||||
r = bayer[x + 1];
|
||||
- b = bayer[x + width];
|
||||
- g += bayer[x + width + 1];
|
||||
+ b = bayer[x + stride];
|
||||
+ g += bayer[x + stride + 1];
|
||||
*udst++ = (-4878 * r - 4789 * g + 14456 * b + 4210688) >> 15;
|
||||
*vdst++ = (14456 * r - 6052 * g - 2351 * b + 4210688) >> 15;
|
||||
}
|
||||
- bayer += 2 * width;
|
||||
+ bayer += 2 * stride;
|
||||
}
|
||||
start_with_green = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
- bayer -= width * height;
|
||||
+ /* Point bayer back to start of frame */
|
||||
+ bayer -= stride * height;
|
||||
|
||||
/* render the first line */
|
||||
- v4lconvert_border_bayer_line_to_y(bayer, bayer + width, ydst, width,
|
||||
+ v4lconvert_border_bayer_line_to_y(bayer, bayer + stride, ydst, width,
|
||||
start_with_green, blue_line);
|
||||
ydst += width;
|
||||
|
||||
@@ -527,104 +530,104 @@ void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
|
||||
const unsigned char *bayer_end = bayer + (width - 2);
|
||||
|
||||
if (start_with_green) {
|
||||
- t0 = bayer[1] + bayer[width * 2 + 1];
|
||||
+ t0 = bayer[1] + bayer[stride * 2 + 1];
|
||||
/* Write first pixel */
|
||||
- t1 = bayer[0] + bayer[width * 2] + bayer[width + 1];
|
||||
+ t1 = bayer[0] + bayer[stride * 2] + bayer[stride + 1];
|
||||
if (blue_line)
|
||||
- *ydst++ = (8453 * bayer[width] + 5516 * t1 +
|
||||
+ *ydst++ = (8453 * bayer[stride] + 5516 * t1 +
|
||||
1661 * t0 + 524288) >> 15;
|
||||
else
|
||||
*ydst++ = (4226 * t0 + 5516 * t1 +
|
||||
- 3223 * bayer[width] + 524288) >> 15;
|
||||
+ 3223 * bayer[stride] + 524288) >> 15;
|
||||
|
||||
/* Write second pixel */
|
||||
- t1 = bayer[width] + bayer[width + 2];
|
||||
+ t1 = bayer[stride] + bayer[stride + 2];
|
||||
if (blue_line)
|
||||
- *ydst++ = (4226 * t1 + 16594 * bayer[width + 1] +
|
||||
+ *ydst++ = (4226 * t1 + 16594 * bayer[stride + 1] +
|
||||
1611 * t0 + 524288) >> 15;
|
||||
else
|
||||
- *ydst++ = (4226 * t0 + 16594 * bayer[width + 1] +
|
||||
+ *ydst++ = (4226 * t0 + 16594 * bayer[stride + 1] +
|
||||
1611 * t1 + 524288) >> 15;
|
||||
bayer++;
|
||||
} else {
|
||||
/* Write first pixel */
|
||||
- t0 = bayer[0] + bayer[width * 2];
|
||||
+ t0 = bayer[0] + bayer[stride * 2];
|
||||
if (blue_line) {
|
||||
- *ydst++ = (8453 * bayer[width + 1] + 16594 * bayer[width] +
|
||||
+ *ydst++ = (8453 * bayer[stride + 1] + 16594 * bayer[stride] +
|
||||
1661 * t0 + 524288) >> 15;
|
||||
} else {
|
||||
- *ydst++ = (4226 * t0 + 16594 * bayer[width] +
|
||||
- 3223 * bayer[width + 1] + 524288) >> 15;
|
||||
+ *ydst++ = (4226 * t0 + 16594 * bayer[stride] +
|
||||
+ 3223 * bayer[stride + 1] + 524288) >> 15;
|
||||
}
|
||||
}
|
||||
|
||||
if (blue_line) {
|
||||
for (; bayer <= bayer_end - 2; bayer += 2) {
|
||||
- t0 = bayer[0] + bayer[2] + bayer[width * 2] + bayer[width * 2 + 2];
|
||||
- t1 = bayer[1] + bayer[width] + bayer[width + 2] + bayer[width * 2 + 1];
|
||||
- *ydst++ = (8453 * bayer[width + 1] + 4148 * t1 +
|
||||
+ t0 = bayer[0] + bayer[2] + bayer[stride * 2] + bayer[stride * 2 + 2];
|
||||
+ t1 = bayer[1] + bayer[stride] + bayer[stride + 2] + bayer[stride * 2 + 1];
|
||||
+ *ydst++ = (8453 * bayer[stride + 1] + 4148 * t1 +
|
||||
806 * t0 + 524288) >> 15;
|
||||
|
||||
- t0 = bayer[2] + bayer[width * 2 + 2];
|
||||
- t1 = bayer[width + 1] + bayer[width + 3];
|
||||
- *ydst++ = (4226 * t1 + 16594 * bayer[width + 2] +
|
||||
+ t0 = bayer[2] + bayer[stride * 2 + 2];
|
||||
+ t1 = bayer[stride + 1] + bayer[stride + 3];
|
||||
+ *ydst++ = (4226 * t1 + 16594 * bayer[stride + 2] +
|
||||
1611 * t0 + 524288) >> 15;
|
||||
}
|
||||
} else {
|
||||
for (; bayer <= bayer_end - 2; bayer += 2) {
|
||||
- t0 = bayer[0] + bayer[2] + bayer[width * 2] + bayer[width * 2 + 2];
|
||||
- t1 = bayer[1] + bayer[width] + bayer[width + 2] + bayer[width * 2 + 1];
|
||||
+ t0 = bayer[0] + bayer[2] + bayer[stride * 2] + bayer[stride * 2 + 2];
|
||||
+ t1 = bayer[1] + bayer[stride] + bayer[stride + 2] + bayer[stride * 2 + 1];
|
||||
*ydst++ = (2113 * t0 + 4148 * t1 +
|
||||
- 3223 * bayer[width + 1] + 524288) >> 15;
|
||||
+ 3223 * bayer[stride + 1] + 524288) >> 15;
|
||||
|
||||
- t0 = bayer[2] + bayer[width * 2 + 2];
|
||||
- t1 = bayer[width + 1] + bayer[width + 3];
|
||||
- *ydst++ = (4226 * t0 + 16594 * bayer[width + 2] +
|
||||
+ t0 = bayer[2] + bayer[stride * 2 + 2];
|
||||
+ t1 = bayer[stride + 1] + bayer[stride + 3];
|
||||
+ *ydst++ = (4226 * t0 + 16594 * bayer[stride + 2] +
|
||||
1611 * t1 + 524288) >> 15;
|
||||
}
|
||||
}
|
||||
|
||||
if (bayer < bayer_end) {
|
||||
/* Write second to last pixel */
|
||||
- t0 = bayer[0] + bayer[2] + bayer[width * 2] + bayer[width * 2 + 2];
|
||||
- t1 = bayer[1] + bayer[width] + bayer[width + 2] + bayer[width * 2 + 1];
|
||||
+ t0 = bayer[0] + bayer[2] + bayer[stride * 2] + bayer[stride * 2 + 2];
|
||||
+ t1 = bayer[1] + bayer[stride] + bayer[stride + 2] + bayer[stride * 2 + 1];
|
||||
if (blue_line)
|
||||
- *ydst++ = (8453 * bayer[width + 1] + 4148 * t1 +
|
||||
+ *ydst++ = (8453 * bayer[stride + 1] + 4148 * t1 +
|
||||
806 * t0 + 524288) >> 15;
|
||||
else
|
||||
*ydst++ = (2113 * t0 + 4148 * t1 +
|
||||
- 3223 * bayer[width + 1] + 524288) >> 15;
|
||||
+ 3223 * bayer[stride + 1] + 524288) >> 15;
|
||||
|
||||
/* write last pixel */
|
||||
- t0 = bayer[2] + bayer[width * 2 + 2];
|
||||
+ t0 = bayer[2] + bayer[stride * 2 + 2];
|
||||
if (blue_line) {
|
||||
- *ydst++ = (8453 * bayer[width + 1] + 16594 * bayer[width + 2] +
|
||||
+ *ydst++ = (8453 * bayer[stride + 1] + 16594 * bayer[stride + 2] +
|
||||
1661 * t0 + 524288) >> 15;
|
||||
} else {
|
||||
- *ydst++ = (4226 * t0 + 16594 * bayer[width + 2] +
|
||||
- 3223 * bayer[width + 1] + 524288) >> 15;
|
||||
+ *ydst++ = (4226 * t0 + 16594 * bayer[stride + 2] +
|
||||
+ 3223 * bayer[stride + 1] + 524288) >> 15;
|
||||
}
|
||||
bayer++;
|
||||
} else {
|
||||
/* write last pixel */
|
||||
- t0 = bayer[0] + bayer[width * 2];
|
||||
- t1 = bayer[1] + bayer[width * 2 + 1] + bayer[width];
|
||||
+ t0 = bayer[0] + bayer[stride * 2];
|
||||
+ t1 = bayer[1] + bayer[stride * 2 + 1] + bayer[stride];
|
||||
if (blue_line)
|
||||
- *ydst++ = (8453 * bayer[width + 1] + 5516 * t1 +
|
||||
+ *ydst++ = (8453 * bayer[stride + 1] + 5516 * t1 +
|
||||
1661 * t0 + 524288) >> 15;
|
||||
else
|
||||
*ydst++ = (4226 * t0 + 5516 * t1 +
|
||||
- 3223 * bayer[width + 1] + 524288) >> 15;
|
||||
+ 3223 * bayer[stride + 1] + 524288) >> 15;
|
||||
}
|
||||
|
||||
- /* skip 2 border pixels */
|
||||
- bayer += 2;
|
||||
+ /* skip 2 border pixels and padding */
|
||||
+ bayer += (stride - width) + 2;
|
||||
|
||||
blue_line = !blue_line;
|
||||
start_with_green = !start_with_green;
|
||||
}
|
||||
|
||||
/* render the last line */
|
||||
- v4lconvert_border_bayer_line_to_y(bayer + width, bayer, ydst, width,
|
||||
+ v4lconvert_border_bayer_line_to_y(bayer + stride, bayer, ydst, width,
|
||||
!start_with_green, !blue_line);
|
||||
}
|
||||
diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h
|
||||
index 705a26d..5b76767 100644
|
||||
--- a/lib/libv4lconvert/libv4lconvert-priv.h
|
||||
+++ b/lib/libv4lconvert/libv4lconvert-priv.h
|
||||
@@ -230,13 +230,13 @@ void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst,
|
||||
int width, int height);
|
||||
|
||||
void v4lconvert_bayer_to_rgb24(const unsigned char *bayer,
|
||||
- unsigned char *rgb, int width, int height, unsigned int pixfmt);
|
||||
+ unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
|
||||
|
||||
void v4lconvert_bayer_to_bgr24(const unsigned char *bayer,
|
||||
- unsigned char *rgb, int width, int height, unsigned int pixfmt);
|
||||
+ unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
|
||||
|
||||
void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
|
||||
- int width, int height, unsigned int src_pixfmt, int yvu);
|
||||
+ int width, int height, const unsigned int stride, unsigned int src_pixfmt, int yvu);
|
||||
|
||||
void v4lconvert_hm12_to_rgb24(const unsigned char *src,
|
||||
unsigned char *dst, int width, int height);
|
||||
diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
|
||||
index 246e2c9..f44f9ff 100644
|
||||
--- a/lib/libv4lconvert/libv4lconvert.c
|
||||
+++ b/lib/libv4lconvert/libv4lconvert.c
|
||||
@@ -629,6 +629,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
|
||||
unsigned int src_pix_fmt = fmt->fmt.pix.pixelformat;
|
||||
unsigned int width = fmt->fmt.pix.width;
|
||||
unsigned int height = fmt->fmt.pix.height;
|
||||
+ unsigned int bytesperline = fmt->fmt.pix.bytesperline;
|
||||
|
||||
switch (src_pix_fmt) {
|
||||
/* JPG and variants */
|
||||
@@ -858,16 +859,16 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
|
||||
case V4L2_PIX_FMT_SRGGB8:
|
||||
switch (dest_pix_fmt) {
|
||||
case V4L2_PIX_FMT_RGB24:
|
||||
- v4lconvert_bayer_to_rgb24(src, dest, width, height, src_pix_fmt);
|
||||
+ v4lconvert_bayer_to_rgb24(src, dest, width, height, bytesperline, src_pix_fmt);
|
||||
break;
|
||||
case V4L2_PIX_FMT_BGR24:
|
||||
- v4lconvert_bayer_to_bgr24(src, dest, width, height, src_pix_fmt);
|
||||
+ v4lconvert_bayer_to_bgr24(src, dest, width, height, bytesperline, src_pix_fmt);
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV420:
|
||||
- v4lconvert_bayer_to_yuv420(src, dest, width, height, src_pix_fmt, 0);
|
||||
+ v4lconvert_bayer_to_yuv420(src, dest, width, height, bytesperline, src_pix_fmt, 0);
|
||||
break;
|
||||
case V4L2_PIX_FMT_YVU420:
|
||||
- v4lconvert_bayer_to_yuv420(src, dest, width, height, src_pix_fmt, 1);
|
||||
+ v4lconvert_bayer_to_yuv420(src, dest, width, height, bytesperline, src_pix_fmt, 1);
|
||||
break;
|
||||
}
|
||||
if (src_size < (width * height)) {
|
||||
--
|
||||
1.7.9.3
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
From 34da390c9b260fc94a1bf6a5dc9a574d09f6e6d1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
|
||||
Date: Mon, 9 Apr 2012 09:03:53 +0200
|
||||
Subject: [PATCH 5/5] Documentation spelling fixes
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
README.lib | 8 ++++----
|
||||
README.lib-multi-threading | 2 +-
|
||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/README.lib b/README.lib
|
||||
index 09638d4..bdafd6d 100644
|
||||
--- a/README.lib
|
||||
+++ b/README.lib
|
||||
@@ -4,7 +4,7 @@ Introduction
|
||||
libv4l is a collection of libraries which adds a thin abstraction layer on
|
||||
top of video4linux2 devices. The purpose of this (thin) layer is to make it
|
||||
easy for application writers to support a wide variety of devices without
|
||||
-having to write seperate code for different devices in the same class.
|
||||
+having to write separate code for different devices in the same class.
|
||||
|
||||
All libv4l components are licensed under the GNU Lesser General Public
|
||||
License version 2 or (at your option) any later version.
|
||||
@@ -121,7 +121,7 @@ would need to be extended with many more often chip dependent formats, like
|
||||
the bayer compression used by the spca561 and the (different) compression used
|
||||
by the pac207 and the (again different) compression used by the sn9c102. Adding
|
||||
support for all these formats should not be done at the application level, as
|
||||
-then it needs to be written for each application seperately. Licensing issues
|
||||
+then it needs to be written for each application separately. Licensing issues
|
||||
with the decompressors will then also become a problem as just cut and pasting
|
||||
from one application to another is bound to hit license incompatibilities.
|
||||
|
||||
@@ -156,14 +156,14 @@ Q: Why should I use libv4l2 in my app instead of direct device access
|
||||
combined with libv4lconvert?
|
||||
A: libv4l2 is mainly meant for quickly and easily adding support for more
|
||||
pixelformats to existing v4l2 applications. So if you feel better directly
|
||||
-accessing the device in combination with libv4lconvert thats fine too.
|
||||
+accessing the device in combination with libv4lconvert that's fine too.
|
||||
|
||||
Notice that libv4l2 also does emulation of the read() call on devices which
|
||||
do not support it in the driver. In the background this uses mmap buffers
|
||||
(even on devices which do support the read call). This mmap gives libv4lconvert
|
||||
zero-copy access to the captured frame, and then it can write the converted
|
||||
data directly to the buffer the application provided to v4l2_read(). Thus
|
||||
-another reason to use liv4l2 is to get the no memcpy advantage of the mmap
|
||||
+another reason to use libv4l2 is to get the no memcpy advantage of the mmap
|
||||
capture method combined with the simplicity of making a simple read() call.
|
||||
|
||||
|
||||
diff --git a/README.lib-multi-threading b/README.lib-multi-threading
|
||||
index 93b393c..e444dd4 100644
|
||||
--- a/README.lib-multi-threading
|
||||
+++ b/README.lib-multi-threading
|
||||
@@ -1,7 +1,7 @@
|
||||
libv4lconvert is not safe for using one convert instance as returned by
|
||||
v4lconvert_create from multiple threads, if you want to use one v4lconvert
|
||||
instance from multiple threads you must provide your own locking and make
|
||||
-sure no simultanious calls are made.
|
||||
+sure no simultaneous calls are made.
|
||||
|
||||
libv4l1 and libv4l2 are safe for multithread use *under* *the* *following*
|
||||
*conditions* :
|
||||
--
|
||||
1.7.9.3
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
From e2821f4bce9db15fcb463ba945fe7433773b9901 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Mon, 23 Apr 2012 23:18:24 +0200
|
||||
Subject: [PATCH 05/12] libv4lconvert: Drop Pixart JPEG frames with changing
|
||||
chrominance setting
|
||||
|
||||
Sometimes the pac7302 switches chrominance setting halfway though a
|
||||
frame, with a quite ugly looking result, so lets drop such frames.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
lib/libv4lconvert/tinyjpeg-internal.h | 1 +
|
||||
lib/libv4lconvert/tinyjpeg.c | 11 +++++++++++
|
||||
2 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg-internal.h b/lib/libv4lconvert/tinyjpeg-internal.h
|
||||
index 4041251..dcbcf27 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg-internal.h
|
||||
+++ b/lib/libv4lconvert/tinyjpeg-internal.h
|
||||
@@ -104,6 +104,7 @@ struct jdec_private {
|
||||
unsigned int current_cid; /* For planar JPEG */
|
||||
#endif
|
||||
unsigned char marker; /* for PJPG (Pixart JPEG) */
|
||||
+ unsigned char first_marker; /* for PJPG (Pixart JPEG) */
|
||||
|
||||
/* Temp space used after the IDCT to store each components */
|
||||
uint8_t Y[64 * 4], Cr[64], Cb[64];
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg.c b/lib/libv4lconvert/tinyjpeg.c
|
||||
index dd77d0f..8fc484e 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg.c
|
||||
+++ b/lib/libv4lconvert/tinyjpeg.c
|
||||
@@ -1387,6 +1387,16 @@ static void pixart_decode_MCU_2x1_3planes(struct jdec_private *priv)
|
||||
look_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream,
|
||||
8, marker);
|
||||
|
||||
+ /* Sometimes the pac7302 switches chrominance setting halfway though a
|
||||
+ frame, with a quite ugly looking result, so we drop such frames. */
|
||||
+ if (priv->first_marker == 0)
|
||||
+ priv->first_marker = marker;
|
||||
+ else if ((marker & 0x80) != (priv->first_marker & 0x80)) {
|
||||
+ snprintf(priv->error_string, sizeof(priv->error_string),
|
||||
+ "Pixart JPEG error: chrominance changed halfway\n");
|
||||
+ longjmp(priv->jump_state, -EIO);
|
||||
+ }
|
||||
+
|
||||
/* Pixart JPEG MCU-s are preceded by a marker indicating the quality
|
||||
setting with which the MCU is compressed, IOW the MCU-s may have a
|
||||
different quantization table per MCU. So if the marker changes we
|
||||
@@ -2224,6 +2234,7 @@ int tinyjpeg_decode(struct jdec_private *priv, int pixfmt)
|
||||
return length;
|
||||
priv->stream = priv->stream_filtered;
|
||||
priv->stream_end = priv->stream + length;
|
||||
+ priv->first_marker = 0;
|
||||
|
||||
decode_mcu_table = pixart_decode_mcu_3comp_table;
|
||||
}
|
||||
--
|
||||
1.7.10
|
||||
|
||||
132
0006-libv4lconvert-Further-Pixart-JPEG-decompression-twea.patch
Normal file
132
0006-libv4lconvert-Further-Pixart-JPEG-decompression-twea.patch
Normal file
@ -0,0 +1,132 @@
|
||||
From 33b272f8b45e8639f567e9aa24a7079b567e20de Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 27 Apr 2012 14:56:18 +0200
|
||||
Subject: [PATCH 06/12] libv4lconvert: Further Pixart JPEG decompression
|
||||
tweaks
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Many thanks to Jean-François Moine <moinejf@free.fr> for digging the
|
||||
quantization tables out of the windows driver.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
lib/libv4lconvert/tinyjpeg.c | 71 ++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 54 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg.c b/lib/libv4lconvert/tinyjpeg.c
|
||||
index 8fc484e..d227c79 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg.c
|
||||
+++ b/lib/libv4lconvert/tinyjpeg.c
|
||||
@@ -205,6 +205,7 @@ static const unsigned char val_ac_chrominance[] = {
|
||||
0xf9, 0xfa
|
||||
};
|
||||
|
||||
+#if 0 /* unused */
|
||||
/* Standard JPEG quantization tables from Annex K of the JPEG standard.
|
||||
Note unlike in Annex K the entries here are in zigzag order! */
|
||||
const unsigned char standard_quantization[][64] = { {
|
||||
@@ -228,6 +229,7 @@ const unsigned char standard_quantization[][64] = { {
|
||||
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
},
|
||||
};
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* 4 functions to manage the stream
|
||||
@@ -1402,39 +1404,74 @@ static void pixart_decode_MCU_2x1_3planes(struct jdec_private *priv)
|
||||
different quantization table per MCU. So if the marker changes we
|
||||
need to rebuild the quantization tables. */
|
||||
if (marker != priv->marker) {
|
||||
- int i, j, comp;
|
||||
+ int i, j, comp, lumi, chroma;
|
||||
unsigned char qt[64];
|
||||
/* These values have been found by trial and error and seem to
|
||||
work reasonably. Markers with index 0 - 7 are never
|
||||
generated by the hardware, so they are likely wrong. */
|
||||
const int qfactor[32] = {
|
||||
- 10, 12, 14, 16, 18, 20, 22, 24,
|
||||
25, 30, 35, 40, 45, 50, 55, 60,
|
||||
- 64, 68, 80, 90, 100, 120, 140, 160,
|
||||
- 180, 200, 220, 240, 260, 280, 300, 320
|
||||
+ 65, 70, 75, 80, 85, 90, 95, 100,
|
||||
+ 100, 100, 120, 140, 160, 180, 210, 240,
|
||||
+ 270, 300, 330, 360, 390, 420, 450, 480
|
||||
};
|
||||
+ /* These tables were found in SPC230NC.SYS */
|
||||
+ const unsigned char pixart_q[][64] = { {
|
||||
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
+ 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20,
|
||||
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
+ }, {
|
||||
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20,
|
||||
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
+ 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
+ }, {
|
||||
+ 0x08, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20,
|
||||
+ 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40,
|
||||
+ 0x40, 0x40, 0x40, 0x40, 0x63, 0x63, 0x63, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ }, {
|
||||
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20,
|
||||
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
|
||||
+ } };
|
||||
|
||||
i = (marker & 0x7c) >> 2; /* Bits 0 and 1 are always 0 */
|
||||
comp = qfactor[i];
|
||||
+ lumi = (marker & 0x40) ? 1 : 0;
|
||||
+ chroma = (marker & 0x80) ? 2 : 3;
|
||||
+ /* printf("marker %02x comp %d lumi %d chroma %d\n", marker, comp, lumi, chroma); */
|
||||
|
||||
- /* And another special Pixart feature, the DC quantization
|
||||
- factor is fixed! */
|
||||
- qt[0] = 7;
|
||||
+ /* Note the DC quantization factor is fixed! */
|
||||
+ qt[0] = pixart_q[lumi][0];
|
||||
for (i = 1; i < 64; i++) {
|
||||
- j = (standard_quantization[0][i] * comp + 50) / 100;
|
||||
+ j = (pixart_q[lumi][i] * comp + 50) / 100;
|
||||
qt[i] = (j < 255) ? j : 255;
|
||||
}
|
||||
build_quantization_table(priv->Q_tables[0], qt);
|
||||
|
||||
- /* And yet another Pixart JPEG special feature, Pixart JPEG
|
||||
- uses the luminance table for chrominance too! Either
|
||||
- as is or with all values multiplied by 2, this is encoded
|
||||
- in bit 7 of the marker. */
|
||||
- if (!(marker & 0x80)) {
|
||||
- for (i = 0; i < 64; i++) {
|
||||
- j = qt[i] * 2;
|
||||
- qt[i] = (j < 255) ? j : 255;
|
||||
- }
|
||||
+ qt[0] = pixart_q[chroma][0];
|
||||
+ for (i = 1; i < 64; i++) {
|
||||
+ j = (pixart_q[chroma][i] * comp + 50) / 100;
|
||||
+ qt[i] = (j < 255) ? j : 255;
|
||||
}
|
||||
build_quantization_table(priv->Q_tables[1], qt);
|
||||
|
||||
--
|
||||
1.7.10
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
From 6e43a82aee9ec84dfd016586ff8d4a11ac0ccaea Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 27 Apr 2012 17:40:53 +0200
|
||||
Subject: [PATCH 07/12] libv4lconvert: Fix interpretation of bit 7 of the
|
||||
Pixart JPEG marker
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
lib/libv4lconvert/tinyjpeg.c | 17 ++++++++++-------
|
||||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/tinyjpeg.c b/lib/libv4lconvert/tinyjpeg.c
|
||||
index d227c79..01bd409 100644
|
||||
--- a/lib/libv4lconvert/tinyjpeg.c
|
||||
+++ b/lib/libv4lconvert/tinyjpeg.c
|
||||
@@ -1404,7 +1404,7 @@ static void pixart_decode_MCU_2x1_3planes(struct jdec_private *priv)
|
||||
different quantization table per MCU. So if the marker changes we
|
||||
need to rebuild the quantization tables. */
|
||||
if (marker != priv->marker) {
|
||||
- int i, j, comp, lumi, chroma;
|
||||
+ int i, j, comp, lumi;
|
||||
unsigned char qt[64];
|
||||
/* These values have been found by trial and error and seem to
|
||||
work reasonably. Markers with index 0 - 7 are never
|
||||
@@ -1457,8 +1457,7 @@ static void pixart_decode_MCU_2x1_3planes(struct jdec_private *priv)
|
||||
i = (marker & 0x7c) >> 2; /* Bits 0 and 1 are always 0 */
|
||||
comp = qfactor[i];
|
||||
lumi = (marker & 0x40) ? 1 : 0;
|
||||
- chroma = (marker & 0x80) ? 2 : 3;
|
||||
- /* printf("marker %02x comp %d lumi %d chroma %d\n", marker, comp, lumi, chroma); */
|
||||
+ /* printf("marker %02x comp %d lumi %d\n", marker, comp, lumi); */
|
||||
|
||||
/* Note the DC quantization factor is fixed! */
|
||||
qt[0] = pixart_q[lumi][0];
|
||||
@@ -1468,10 +1467,14 @@ static void pixart_decode_MCU_2x1_3planes(struct jdec_private *priv)
|
||||
}
|
||||
build_quantization_table(priv->Q_tables[0], qt);
|
||||
|
||||
- qt[0] = pixart_q[chroma][0];
|
||||
- for (i = 1; i < 64; i++) {
|
||||
- j = (pixart_q[chroma][i] * comp + 50) / 100;
|
||||
- qt[i] = (j < 255) ? j : 255;
|
||||
+ /* If bit 7 of the marker is set chrominance uses the
|
||||
+ luminance quantization table */
|
||||
+ if (!(marker & 0x80)) {
|
||||
+ qt[0] = pixart_q[3][0];
|
||||
+ for (i = 1; i < 64; i++) {
|
||||
+ j = (pixart_q[3][i] * comp + 50) / 100;
|
||||
+ qt[i] = (j < 255) ? j : 255;
|
||||
+ }
|
||||
}
|
||||
build_quantization_table(priv->Q_tables[1], qt);
|
||||
|
||||
--
|
||||
1.7.10
|
||||
|
||||
26
0008-libv4lcontrol-Add-another-USB-ID-to-ASUS-table.patch
Normal file
26
0008-libv4lcontrol-Add-another-USB-ID-to-ASUS-table.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From a03edd3d4f87d792fc3476081f21cb1ab627d3fc Mon Sep 17 00:00:00 2001
|
||||
From: Gregor Jasny <gjasny@googlemail.com>
|
||||
Date: Thu, 10 May 2012 20:15:25 +0200
|
||||
Subject: [PATCH 08/12] libv4lcontrol: Add another USB ID to ASUS table
|
||||
|
||||
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
|
||||
(cherry picked from commit 2ba650f05f83f08885fcd7cada608b089c4776e4)
|
||||
---
|
||||
lib/libv4lconvert/control/libv4lcontrol.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
index 7b2150f..3648d91 100644
|
||||
--- a/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
+++ b/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
@@ -284,6 +284,7 @@ static const struct v4lcontrol_usb_id asus_camera_id[] = {
|
||||
{ 0x04f2, 0xb071 },
|
||||
{ 0x04f2, 0xb072 },
|
||||
{ 0x04f2, 0xb106 },
|
||||
+ { 0x04f2, 0xb169 },
|
||||
{ 0x04f2, 0xb16b },
|
||||
{ 0x04f2, 0xb1b9 },
|
||||
{ 0x04f2, 0xb1bb },
|
||||
--
|
||||
1.7.10
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
From 310e4b64d3116600c1bc085ac750098ec111141f Mon Sep 17 00:00:00 2001
|
||||
From: Jakob Haufe <sur5r@sur5r.net>
|
||||
Date: Thu, 10 May 2012 20:26:48 +0200
|
||||
Subject: [PATCH 09/12] libv4lcontrol: Add Lenovo Thinkpad X220 Tablet to
|
||||
upside down table
|
||||
|
||||
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
|
||||
(cherry picked from commit c8dc32601812326646e4e8fd1388a0cc9d2a512c)
|
||||
---
|
||||
lib/libv4lconvert/control/libv4lcontrol.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
index 3648d91..8795e2f 100644
|
||||
--- a/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
+++ b/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
@@ -132,6 +132,8 @@ static const struct v4lcontrol_flags_info v4lcontrol_flags[] = {
|
||||
{ 0x04f2, 0xb213, 0, "FUJITSU", "FJNBB19",
|
||||
V4LCONTROL_HFLIPPED | V4LCONTROL_VFLIPPED, 0,
|
||||
"FUJITSU", "LIFEBOOK NH751" },
|
||||
+ { 0x04f2, 0xb217, 0, "LENOVO", "42982YG",
|
||||
+ V4LCONTROL_HFLIPPED | V4LCONTROL_VFLIPPED },
|
||||
{ 0x04f2, 0xb217, 0, "LENOVO", "42992QG",
|
||||
V4LCONTROL_HFLIPPED | V4LCONTROL_VFLIPPED },
|
||||
{ 0x04f2, 0xb27c, 0, "LENOVO", "12973MG",
|
||||
--
|
||||
1.7.10
|
||||
|
||||
26
0010-libv4l2-Improve-VIDIOC_-_FMT-logging.patch
Normal file
26
0010-libv4l2-Improve-VIDIOC_-_FMT-logging.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 947f108f0860b5d55e4e506fa9521a797257d2b2 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 11 May 2012 13:51:03 +0200
|
||||
Subject: [PATCH 10/12] libv4l2: Improve VIDIOC_*_FMT logging
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
lib/libv4l2/log.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/lib/libv4l2/log.c b/lib/libv4l2/log.c
|
||||
index f7ce06f..377f553 100644
|
||||
--- a/lib/libv4l2/log.c
|
||||
+++ b/lib/libv4l2/log.c
|
||||
@@ -154,6 +154,8 @@ void v4l2_log_ioctl(unsigned long int request, void *arg, int result)
|
||||
(int)fmt->fmt.pix.sizeimage);
|
||||
fprintf(v4l2_log_file, " colorspace: %d, priv: %x\n",
|
||||
(int)fmt->fmt.pix.colorspace, (int)fmt->fmt.pix.priv);
|
||||
+ } else {
|
||||
+ fprintf(v4l2_log_file, " type: %d\n", (int)fmt->type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
--
|
||||
1.7.10
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
From 1539b9211634f3546d08fa36593b02bf2fa3903a Mon Sep 17 00:00:00 2001
|
||||
From: Gregor Jasny <gjasny@googlemail.com>
|
||||
Date: Thu, 2 Feb 2012 20:25:07 +0100
|
||||
Subject: [PATCH 11/12] libv4lconvert: replace strndupa with more portable
|
||||
strndup
|
||||
|
||||
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
|
||||
---
|
||||
lib/libv4lconvert/control/libv4lcontrol.c | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
index 8795e2f..f312354 100644
|
||||
--- a/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
+++ b/lib/libv4lconvert/control/libv4lcontrol.c
|
||||
@@ -452,6 +452,7 @@ static int find_dmi_string(const char **table_entries, const char *dmi_value)
|
||||
const char **entry_ptr;
|
||||
char *trimmed_dmi;
|
||||
size_t n;
|
||||
+ int found = 0;
|
||||
|
||||
if (!start) return 0;
|
||||
|
||||
@@ -459,16 +460,19 @@ static int find_dmi_string(const char **table_entries, const char *dmi_value)
|
||||
while (isspace(*start)) start++;
|
||||
n = strlen(start);
|
||||
while (n > 0 && isspace(start[n-1])) --n;
|
||||
- trimmed_dmi = strndupa(start, n);
|
||||
+ trimmed_dmi = strndup(start, n);
|
||||
|
||||
/* find trimmed value */
|
||||
for (entry_ptr = table_entries; *entry_ptr; entry_ptr++) {
|
||||
- const int found = fnmatch(*entry_ptr, trimmed_dmi, 0) == 0;
|
||||
+ found = fnmatch(*entry_ptr, trimmed_dmi, 0) == 0;
|
||||
/* fprintf(stderr, "find_dmi_string('%s', '%s'->'%s')=%i\n", *entry_ptr, dmi_value, trimmed_dmi, found); */
|
||||
if (found)
|
||||
- return 1;
|
||||
+ break;
|
||||
}
|
||||
- return 0;
|
||||
+
|
||||
+ free(trimmed_dmi);
|
||||
+
|
||||
+ return found;
|
||||
}
|
||||
|
||||
/*
|
||||
--
|
||||
1.7.10
|
||||
|
||||
41
0012-libdvbv5-Add-missing-includes.patch
Normal file
41
0012-libdvbv5-Add-missing-includes.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 9475926b6e50f60ac56175915cf82dd4f97d00ae Mon Sep 17 00:00:00 2001
|
||||
From: Gregor Jasny <gjasny@googlemail.com>
|
||||
Date: Tue, 15 May 2012 21:24:51 +0200
|
||||
Subject: [PATCH 12/12] libdvbv5: Add missing includes
|
||||
|
||||
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
|
||||
---
|
||||
utils/dvb/dvb-v5-std.h | 1 +
|
||||
utils/dvb/dvb-v5.h | 3 +++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/utils/dvb/dvb-v5-std.h b/utils/dvb/dvb-v5-std.h
|
||||
index 6403ad2..166bf55 100644
|
||||
--- a/utils/dvb/dvb-v5-std.h
|
||||
+++ b/utils/dvb/dvb-v5-std.h
|
||||
@@ -20,6 +20,7 @@
|
||||
* http://linuxtv.org/downloads/v4l-dvb-apis/FE_GET_SET_PROPERTY.html
|
||||
*/
|
||||
|
||||
+#include <stddef.h>
|
||||
#include "dvb_frontend.h"
|
||||
|
||||
const unsigned int sys_dvbt_props[] = {
|
||||
diff --git a/utils/dvb/dvb-v5.h b/utils/dvb/dvb-v5.h
|
||||
index 6ba6730..67cd725 100644
|
||||
--- a/utils/dvb/dvb-v5.h
|
||||
+++ b/utils/dvb/dvb-v5.h
|
||||
@@ -3,7 +3,10 @@
|
||||
*/
|
||||
#ifndef _DVB_V5_CONSTS_H
|
||||
#define _DVB_V5_CONSTS_H
|
||||
+
|
||||
+#include <stddef.h>
|
||||
#include "dvb_frontend.h"
|
||||
+
|
||||
struct fe_caps_name {
|
||||
unsigned idx;
|
||||
char *name;
|
||||
--
|
||||
1.7.10
|
||||
|
||||
2
sources
2
sources
@ -1 +1 @@
|
||||
d3506785ae022b6a37b986c66015bea3 v4l-utils-0.8.7.tar.bz2
|
||||
40fdda3f4055ed818012d7a7b5ef5be5 v4l-utils-0.8.8.tar.bz2
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Name: v4l-utils
|
||||
Version: 0.8.7
|
||||
Version: 0.8.8
|
||||
Release: 1%{?dist}
|
||||
Summary: Utilities for video4linux and DVB devices
|
||||
Group: Applications/System
|
||||
@ -8,11 +8,18 @@ License: GPLv2+ and GPLv2
|
||||
URL: http://www.linuxtv.org/downloads/v4l-utils/
|
||||
Source0: http://linuxtv.org/downloads/v4l-utils/v4l-utils-%{version}.tar.bz2
|
||||
# Bugfixes from upstream git, these can all be dropped with the next release
|
||||
Patch1: 0001-libv4lconver-tinyjpeg-Fix-out-of-bounds-array-usage.patch
|
||||
Patch2: 0002-tinyjpeg-Better-luminance-quantization-table-for-Pix.patch
|
||||
Patch3: 0003-libv4lconver-Add-06f8-301b-pac7302-based-cam-to-the-.patch
|
||||
Patch4: 0004-libv4lconvert-Use-bytesperline-instead-of-width.patch
|
||||
Patch5: 0005-Documentation-spelling-fixes.patch
|
||||
Patch1: 0001-dvb-Fix-spelling-errors-found-by-lintian.patch
|
||||
Patch2: 0002-libv4lconvert-Fix-decoding-of-160x120-Pixart-JPEG-im.patch
|
||||
Patch3: 0003-Revert-tinyjpeg-Better-luminance-quantization-table-.patch
|
||||
Patch4: 0004-libv4lconvert-Dynamic-quantization-tables-for-Pixart.patch
|
||||
Patch5: 0005-libv4lconvert-Drop-Pixart-JPEG-frames-with-changing-.patch
|
||||
Patch6: 0006-libv4lconvert-Further-Pixart-JPEG-decompression-twea.patch
|
||||
Patch7: 0007-libv4lconvert-Fix-interpretation-of-bit-7-of-the-Pix.patch
|
||||
Patch8: 0008-libv4lcontrol-Add-another-USB-ID-to-ASUS-table.patch
|
||||
Patch9: 0009-libv4lcontrol-Add-Lenovo-Thinkpad-X220-Tablet-to-ups.patch
|
||||
Patch10: 0010-libv4l2-Improve-VIDIOC_-_FMT-logging.patch
|
||||
Patch11: 0011-libv4lconvert-replace-strndupa-with-more-portable-st.patch
|
||||
Patch12: 0012-libdvbv5-Add-missing-includes.patch
|
||||
BuildRequires: libjpeg-devel qt4-devel kernel-headers desktop-file-utils
|
||||
# For /lib/udev/rules.d ownership
|
||||
Requires: udev
|
||||
@ -88,6 +95,13 @@ developing applications that use libv4l.
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
|
||||
|
||||
%build
|
||||
@ -161,6 +175,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue May 22 2012 Hans de Goede <hdegoede@redhat.com> - 0.8.8-1
|
||||
- New upstream release 0.8.8
|
||||
- Add patches from upstream git to improve Pixart JPEG decoding
|
||||
- Add patch from upstream git to fix building with latest kernels (rhbz#823863)
|
||||
|
||||
* Mon Apr 9 2012 Hans de Goede <hdegoede@redhat.com> - 0.8.7-1
|
||||
- New upstream release 0.8.7
|
||||
- Fixes rhbz#807656
|
||||
|
||||
Loading…
Reference in New Issue
Block a user