summaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-01-10 13:23:34 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-16 11:09:20 -0200
commit1c852201a28601b1379857f615e99071211294c6 (patch)
treeb3a2b67c3d67bd9c9552af026a505062ce1cb78c /drivers/media/video
parent938d5b9e7c2e20a7e609ad5874c6e7d8d391e6e9 (diff)
[media] pwc: Avoid unnecessarily rebuilding the decoder tables
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/pwc/pwc-dec23.c6
-rw-r--r--drivers/media/video/pwc/pwc-dec23.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/video/pwc/pwc-dec23.c b/drivers/media/video/pwc/pwc-dec23.c
index 6d48c1f9068..98772efc5bd 100644
--- a/drivers/media/video/pwc/pwc-dec23.c
+++ b/drivers/media/video/pwc/pwc-dec23.c
@@ -301,6 +301,9 @@ void pwc_dec23_init(struct pwc_device *pdev, unsigned char *cmd)
mutex_init(&pdec->lock);
+ if (pdec->last_cmd_valid && pdec->last_cmd == cmd[2])
+ return;
+
if (DEVICE_USE_CODEC3(pdev->type)) {
flags = cmd[2] & 0x18;
if (flags == 8)
@@ -347,6 +350,9 @@ void pwc_dec23_init(struct pwc_device *pdev, unsigned char *cmd)
for (i=0; i<MAX_OUTER_CROP_VALUE; i++)
pwc_crop_table[MAX_OUTER_CROP_VALUE+256+i] = 255;
#endif
+
+ pdec->last_cmd = cmd[2];
+ pdec->last_cmd_valid = 1;
}
/*
diff --git a/drivers/media/video/pwc/pwc-dec23.h b/drivers/media/video/pwc/pwc-dec23.h
index a29068ee428..af31d6047bb 100644
--- a/drivers/media/video/pwc/pwc-dec23.h
+++ b/drivers/media/video/pwc/pwc-dec23.h
@@ -31,11 +31,14 @@ struct pwc_dec23_private
{
struct mutex lock;
+ unsigned char last_cmd, last_cmd_valid;
+
unsigned int scalebits;
unsigned int nbitsmask, nbits; /* Number of bits of a color in the compressed stream */
unsigned int reservoir;
unsigned int nbits_in_reservoir;
+
const unsigned char *stream;
int temp_colors[16];