aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/jpeg/rgba32.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/jpeg/rgba32.c')
-rw-r--r--com32/lib/jpeg/rgba32.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/com32/lib/jpeg/rgba32.c b/com32/lib/jpeg/rgba32.c
index 2934bcd8..2ad91125 100644
--- a/com32/lib/jpeg/rgba32.c
+++ b/com32/lib/jpeg/rgba32.c
@@ -84,7 +84,7 @@ static void YCrCB_to_RGBA32_1x1(struct jdec_private *priv)
Y = priv->Y;
Cb = priv->Cb;
Cr = priv->Cr;
- offset_to_next_row = priv->width*4 - 8*4;
+ offset_to_next_row = priv->bytes_per_row[0] - 8*4;
for (i=0; i<8; i++) {
for (j=0;j<8;j++) {
@@ -140,7 +140,7 @@ static void YCrCB_to_RGBA32_2x1(struct jdec_private *priv)
Y = priv->Y;
Cb = priv->Cb;
Cr = priv->Cr;
- offset_to_next_row = priv->width*4 - 16*4;
+ offset_to_next_row = priv->bytes_per_row[0] - 16*4;
for (i=0; i<8; i++) {
for (j=0; j<8; j++) {
@@ -206,11 +206,11 @@ static void YCrCB_to_RGBA32_1x2(struct jdec_private *priv)
#define FIX(x) ((int)((x) * (1UL<<SCALEBITS) + 0.5))
p = priv->plane[0];
- p2 = priv->plane[0] + priv->width*4;
+ p2 = priv->plane[0] + priv->bytes_per_row[0];
Y = priv->Y;
Cb = priv->Cb;
Cr = priv->Cr;
- offset_to_next_row = 2*priv->width*4 - 8*4;
+ offset_to_next_row = 2*priv->bytes_per_row[0] - 8*4;
for (i=0; i<8; i++) {
for (j=0; j<8; j++) {
@@ -277,11 +277,11 @@ static void YCrCB_to_RGBA32_2x2(struct jdec_private *priv)
#define FIX(x) ((int)((x) * (1UL<<SCALEBITS) + 0.5))
p = priv->plane[0];
- p2 = priv->plane[0] + priv->width*4;
+ p2 = priv->plane[0] + priv->bytes_per_row[0];
Y = priv->Y;
Cb = priv->Cb;
Cr = priv->Cr;
- offset_to_next_row = (priv->width*4*2) - 16*4;
+ offset_to_next_row = 2*priv->bytes_per_row[0] - 16*4;
for (i=0; i<8; i++) {
for (j=0;j<8;j++) {
@@ -353,7 +353,10 @@ static int initialize_rgba32(struct jdec_private *priv,
{
if (priv->components[0] == NULL)
priv->components[0] = (uint8_t *)malloc(priv->width * priv->height * 4);
- bytes_per_blocklines[0] = priv->width * 4;
+ if (!priv->bytes_per_row[0])
+ priv->bytes_per_row[0] = priv->width * 4;
+
+ bytes_per_blocklines[0] = priv->bytes_per_row[0];
bytes_per_mcu[0] = 4*8;
return !priv->components[0];