summaryrefslogtreecommitdiff
path: root/libavcodec/scpr.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-02-24 12:01:30 +0100
committerPaul B Mahol <onemda@gmail.com>2017-02-24 12:02:48 +0100
commit178cd50c47aa5b7db03f7ce7a3f2934857dbd35b (patch)
tree0706d14f567973b8fd069665cfbb5da5b55c4e33 /libavcodec/scpr.c
parentfa3e49568dc856a66825985878b15eda21e67ab6 (diff)
avcodec/scpr: make sure that component value is <= 0x1F for 16 bpc
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/scpr.c')
-rw-r--r--libavcodec/scpr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index 5555d812e8..0802dd4d70 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -58,6 +58,7 @@ typedef struct SCPRContext {
unsigned nbx, nby;
unsigned nbcount;
unsigned *blocks;
+ unsigned cbits;
int cxshift;
} SCPRContext;
@@ -241,7 +242,7 @@ static int decode_unit(SCPRContext *s, PixelModel *pixel, unsigned step, unsigne
}
pixel->total_freq = totfr;
- *rval = c;
+ *rval = c & s->cbits;
return 0;
}
@@ -789,6 +790,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
s->cxshift = avctx->bits_per_coded_sample == 16 ? 0 : 2;
+ s->cbits = avctx->bits_per_coded_sample == 16 ? 0x1F : 0xFF;
s->nbx = (avctx->width + 15) / 16;
s->nby = (avctx->height + 15) / 16;
s->nbcount = s->nbx * s->nby;