aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/jpeg/grey.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-08-09 14:35:08 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-08-09 14:35:08 -0700
commit4b9ef3210bfe249acc1b63dadf6cf009275a9eaa (patch)
tree1d0e76b4d251509cb6b9ca5e29842bf5deddfdb9 /com32/lib/jpeg/grey.c
parentca49c72894c52d770bd7c2669337b32fe83c6c2e (diff)
downloadsyslinux.git-4b9ef3210bfe249acc1b63dadf6cf009275a9eaa.tar.gz
syslinux.git-4b9ef3210bfe249acc1b63dadf6cf009275a9eaa.tar.xz
syslinux.git-4b9ef3210bfe249acc1b63dadf6cf009275a9eaa.zip
tinyjpeg: fix yuv420p, correct some of the initalization code
Fix the yuv420p in the presence of partial pixels (if we have an odd number of pixels in this mode, we include the chroma pixel.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/lib/jpeg/grey.c')
-rw-r--r--com32/lib/jpeg/grey.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/com32/lib/jpeg/grey.c b/com32/lib/jpeg/grey.c
index 2f114744..6710ede6 100644
--- a/com32/lib/jpeg/grey.c
+++ b/com32/lib/jpeg/grey.c
@@ -91,12 +91,12 @@ static int initialize_grey(struct jdec_private *priv,
unsigned int *bytes_per_blocklines,
unsigned int *bytes_per_mcu)
{
- if (priv->components[0] == NULL)
- priv->components[0] = (uint8_t *)malloc(priv->width * priv->height);
if (!priv->bytes_per_row[0])
priv->bytes_per_row[0] = priv->width;
+ if (!priv->components[0])
+ priv->components[0] = malloc(priv->height * priv->bytes_per_row[0]);
- bytes_per_blocklines[0] = priv->bytes_per_row[0];
+ bytes_per_blocklines[0] = priv->bytes_per_row[0] << 3;
bytes_per_mcu[0] = 8;
return !priv->components[0];