aic: Fix decoding files with odd dimensions

Message ID 20150303164333.43D065DD4E@aruru.libav.org
State New
Headers show

Commit Message

Janne Grunau March 3, 2015, 4:43 p.m.
Module: libav
Branch: master
Commit: e878ec0d47cd6228c367b2f3128b76d7523f7255

Author:    Vittorio Giovara <vittorio.giovara@gmail.com>
Committer: Vittorio Giovara <vittorio.giovara@gmail.com>
Date:      Fri Feb 27 19:00:25 2015 +0000

aic: Fix decoding files with odd dimensions

Normally the aic decoder finds the proper slice combination (multiple of
some number less than 32) but in case of odd width, it resorts to the
default values, which were actually swapped.
The number of slices is modified to account for such odd width cases.

CC: libav-stable@libav.org

---

 libavcodec/aic.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index dac9d8b..5687dbe 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -434,8 +434,8 @@  static av_cold int aic_decode_init(AVCodecContext *avctx)
     ctx->mb_width  = FFALIGN(avctx->width,  16) >> 4;
     ctx->mb_height = FFALIGN(avctx->height, 16) >> 4;
 
-    ctx->num_x_slices = 16;
-    ctx->slice_width  = ctx->mb_width / 16;
+    ctx->num_x_slices = (ctx->mb_width + 15) >> 4;
+    ctx->slice_width  = 16;
     for (i = 1; i < 32; i++) {
         if (!(ctx->mb_width % i) && (ctx->mb_width / i < 32)) {
             ctx->slice_width  = ctx->mb_width / i;