From: Hans de Goede Date: Tue, 10 Jan 2012 16:23:34 +0000 (-0300) Subject: [media] pwc: Avoid unnecessarily rebuilding the decoder tables X-Git-Tag: firefly_0821_release~3680^2~2904^2~81 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1c852201a28601b1379857f615e99071211294c6;p=firefly-linux-kernel-4.4.55.git [media] pwc: Avoid unnecessarily rebuilding the decoder tables Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/pwc/pwc-dec23.c b/drivers/media/video/pwc/pwc-dec23.c index 6d48c1f90683..98772efc5bde 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; ilast_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 a29068ee428b..af31d6047bb2 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];