diff options
Diffstat (limited to 'com32/lib/jpeg/bgr24.c')
-rw-r--r-- | com32/lib/jpeg/bgr24.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/com32/lib/jpeg/bgr24.c b/com32/lib/jpeg/bgr24.c index 465d58e7..3f2f4f90 100644 --- a/com32/lib/jpeg/bgr24.c +++ b/com32/lib/jpeg/bgr24.c @@ -84,7 +84,7 @@ static void YCrCB_to_BGR24_1x1(struct jdec_private *priv) Y = priv->Y; Cb = priv->Cb; Cr = priv->Cr; - offset_to_next_row = priv->width*3 - 8*3; + offset_to_next_row = priv->bytes_per_row[0] - 8*3; for (i=0; i<8; i++) { for (j=0;j<8;j++) { @@ -140,7 +140,7 @@ static void YCrCB_to_BGR24_2x1(struct jdec_private *priv) Y = priv->Y; Cb = priv->Cb; Cr = priv->Cr; - offset_to_next_row = priv->width*3 - 16*3; + offset_to_next_row = priv->bytes_per_row[0] - 16*3; for (i=0; i<8; i++) { for (j=0; j<8; j++) { @@ -202,11 +202,11 @@ static void YCrCB_to_BGR24_1x2(struct jdec_private *priv) #define FIX(x) ((int)((x) * (1UL<<SCALEBITS) + 0.5)) p = priv->plane[0]; - p2 = priv->plane[0] + priv->width*3; + 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*3 - 8*3; + offset_to_next_row = 2*priv->bytes_per_row[0] - 8*3; for (i=0; i<8; i++) { for (j=0; j<8; j++) { @@ -270,11 +270,11 @@ static void YCrCB_to_BGR24_2x2(struct jdec_private *priv) #define FIX(x) ((int)((x) * (1UL<<SCALEBITS) + 0.5)) p = priv->plane[0]; - p2 = priv->plane[0] + priv->width*3; + p2 = priv->plane[0] + priv->bytes_per_row[0]; Y = priv->Y; Cb = priv->Cb; Cr = priv->Cr; - offset_to_next_row = (priv->width*3*2) - 16*3; + offset_to_next_row = 2*priv->bytes_per_row[0] - 16*3; for (i=0; i<8; i++) { for (j=0;j<8;j++) { @@ -338,7 +338,10 @@ static int initialize_bgr24(struct jdec_private *priv, { 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]; |