summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2016-09-28 17:49:39 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2016-09-28 17:49:39 +0200
commit83bf40f3cfcf4b7545e41836b37f21806004f136 (patch)
tree45da019b69aabaf47bc6ca7fc2efaceca65db3bb /libavcodec
parent58776ccbdb4d2e5f07d1d0fe12a1529cffe949c0 (diff)
lavc/8bps: Fix 32bit output of 24bit video.
Regression since / partial revert of ba3bb53b
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/8bps.c13
-rw-r--r--libavcodec/version.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index 46344e0e43..49fd445494 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -41,7 +41,7 @@
static const enum AVPixelFormat pixfmt_rgb24[] = {
- AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE };
+ AV_PIX_FMT_BGR24, AV_PIX_FMT_0RGB32, AV_PIX_FMT_NONE };
typedef struct EightBpsContext {
AVCodecContext *avctx;
@@ -65,6 +65,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
unsigned int dlen, p, row;
const unsigned char *lp, *dp, *ep;
unsigned char count;
+ unsigned int px_inc;
unsigned int planes = c->planes;
unsigned char *planemap = c->planemap;
int ret;
@@ -77,6 +78,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
/* Set data pointer after line lengths */
dp = encoded + planes * (height << 1);
+ px_inc = planes + (avctx->pix_fmt == AV_PIX_FMT_0RGB32);
+
for (p = 0; p < planes; p++) {
/* Lines length pointer for this plane */
lp = encoded + p * (height << 1);
@@ -95,21 +98,21 @@ static int decode_frame(AVCodecContext *avctx, void *data,
if ((count = *dp++) <= 127) {
count++;
dlen -= count + 1;
- if (pixptr_end - pixptr < count * planes)
+ if (pixptr_end - pixptr < count * px_inc)
break;
if (ep - dp < count)
return AVERROR_INVALIDDATA;
while (count--) {
*pixptr = *dp++;
- pixptr += planes;
+ pixptr += px_inc;
}
} else {
count = 257 - count;
- if (pixptr_end - pixptr < count * planes)
+ if (pixptr_end - pixptr < count * px_inc)
break;
while (count--) {
*pixptr = *dp;
- pixptr += planes;
+ pixptr += px_inc;
}
dp++;
dlen -= 2;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 636c9d64fe..e7778e9bc0 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 58
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \