Width is padded for ham encodings too.

Signed-off-by: Paul B Mahol <[email protected]>
---
 libavcodec/cdxl.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c
index a53a001..2e21836 100644
--- a/libavcodec/cdxl.c
+++ b/libavcodec/cdxl.c
@@ -60,9 +60,9 @@ static void import_palette(CDXLVideoContext *c, uint32_t 
*new_palette)
     }
 }
 
-static void bitplanar2chunky(CDXLVideoContext *c, int width,
-                             int linesize, uint8_t *out)
+static void bitplanar2chunky(CDXLVideoContext *c, int linesize, uint8_t *out)
 {
+    int padded_width = FFALIGN(c->avctx->width, 16);
     GetBitContext gb;
     int x, y, plane;
 
@@ -70,17 +70,16 @@ static void bitplanar2chunky(CDXLVideoContext *c, int width,
     memset(out, 0, linesize * c->avctx->height);
     for (plane = 0; plane < c->bpp; plane++)
         for (y = 0; y < c->avctx->height; y++)
-            for (x = 0; x < width; x++)
+            for (x = 0; x < padded_width; x++)
                 out[linesize * y + x] |= get_bits1(&gb) << plane;
 }
 
 static void cdxl_decode_rgb(CDXLVideoContext *c)
 {
     uint32_t *new_palette = (uint32_t *)c->frame.data[1];
-    int padded_width = FFALIGN(c->avctx->width, 16);
 
     import_palette(c, new_palette);
-    bitplanar2chunky(c, padded_width, c->frame.linesize[0], c->frame.data[0]);
+    bitplanar2chunky(c, c->frame.linesize[0], c->frame.data[0]);
 }
 
 static void cdxl_decode_ham6(CDXLVideoContext *c)
@@ -94,7 +93,7 @@ static void cdxl_decode_ham6(CDXLVideoContext *c)
     out = c->frame.data[0];
 
     import_palette(c, new_palette);
-    bitplanar2chunky(c, avctx->width, avctx->width, c->new_video);
+    bitplanar2chunky(c, avctx->width, c->new_video);
 
     for (y = 0; y < avctx->height; y++) {
         r = new_palette[0] & 0xFF0000;
@@ -137,7 +136,7 @@ static void cdxl_decode_ham8(CDXLVideoContext *c)
     out = c->frame.data[0];
 
     import_palette(c, new_palette);
-    bitplanar2chunky(c, avctx->width, avctx->width, c->new_video);
+    bitplanar2chunky(c, avctx->width, c->new_video);
 
     for (y = 0; y < avctx->height; y++) {
         r = new_palette[0] & 0xFF0000;
-- 
1.7.7

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to