aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/jpeg/grey.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-09-05 17:06:14 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-09-05 17:06:14 -0700
commit23f602a07a570de8a3a356b6b156fe036c38ab27 (patch)
treedf0746687069b53ef0ffa6ccfee955b67ad184c9 /com32/lib/jpeg/grey.c
parent0cd5e05574453627bc9d5fba7bb9c6a6b2d3dd22 (diff)
downloadsyslinux.git-23f602a07a570de8a3a356b6b156fe036c38ab27.tar.gz
syslinux.git-23f602a07a570de8a3a356b6b156fe036c38ab27.tar.xz
syslinux.git-23f602a07a570de8a3a356b6b156fe036c38ab27.zip
Augment tinyjpeg so that we can decode straight into the buffer;
clear the screen on startup.
Diffstat (limited to 'com32/lib/jpeg/grey.c')
-rw-r--r--com32/lib/jpeg/grey.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/com32/lib/jpeg/grey.c b/com32/lib/jpeg/grey.c
index edeb74a9..bb55b7e2 100644
--- a/com32/lib/jpeg/grey.c
+++ b/com32/lib/jpeg/grey.c
@@ -54,7 +54,7 @@ static void YCrCB_to_Grey_1x1(struct jdec_private *priv)
p = priv->plane[0];
y = priv->Y;
- offset_to_next_row = priv->width;
+ offset_to_next_row = priv->bytes_per_row[0];
for (i=0; i<8; i++) {
memcpy(p, y, 8);
@@ -74,14 +74,16 @@ static void YCrCB_to_Grey_2x1(struct jdec_private *priv)
const unsigned char *y;
unsigned char *p;
unsigned int i;
+ int offset_to_next_row;
p = priv->plane[0];
y = priv->Y;
+ offset_to_next_row = priv->bytes_per_row[0];
for (i=0; i<8; i++) {
memcpy(p, y, 16);
y += 16;
- p += priv->width;
+ p += offset_to_next_row;
}
}
@@ -99,14 +101,16 @@ static void YCrCB_to_Grey_1x2(struct jdec_private *priv)
const unsigned char *y;
unsigned char *p;
unsigned int i;
+ int offset_to_next_row;
p = priv->plane[0];
y = priv->Y;
+ offset_to_next_row = priv->bytes_per_row[0];
for (i=0; i<16; i++) {
memcpy(p, y, 8);
y += 8;
- p += priv->width;
+ p += offset_to_next_row;
}
}
@@ -123,24 +127,29 @@ static void YCrCB_to_Grey_2x2(struct jdec_private *priv)
const unsigned char *y;
unsigned char *p;
unsigned int i;
+ int offset_to_next_row;
p = priv->plane[0];
y = priv->Y;
+ offset_to_next_row = priv->bytes_per_row[0];
for (i=0; i<16; i++) {
memcpy(p, y, 16);
y += 16;
- p += priv->width;
+ p += offset_to_next_row;
}
}
static int initialize_grey(struct jdec_private *priv,
- unsigned int *bytes_per_blocklines,
- unsigned int *bytes_per_mcu)
+ 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 * 3);
- bytes_per_blocklines[0] = priv->width * 3;
+ if (!priv->bytes_per_row[0])
+ priv->bytes_per_row[0] = priv->width * 3;
+
+ bytes_per_blocklines[0] = priv->bytes_per_row[0];
bytes_per_mcu[0] = 3*8;
return !priv->components[0];