X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fbmp.c;h=c4f6044cb465772396037731a752568c25851d9a;hb=a247ac640df3da573cd661065bf53f37863e2b46;hp=65d239e4f8d8d72d3649bca2630f33b7b2797ca9;hpb=14fe81b3a88dfe4dbac12e8715f9a3f05b5ef1bf;p=ffmpeg diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index 65d239e4f8d..c4f6044cb46 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -291,7 +291,7 @@ static int bmp_decode_frame(AVCodecContext *avctx, case 1: for (i = 0; i < avctx->height; i++) { int j; - for (j = 0; j < n; j++) { + for (j = 0; j < avctx->width >> 3; j++) { ptr[j*8+0] = buf[j] >> 7; ptr[j*8+1] = (buf[j] >> 6) & 1; ptr[j*8+2] = (buf[j] >> 5) & 1; @@ -301,6 +301,9 @@ static int bmp_decode_frame(AVCodecContext *avctx, ptr[j*8+6] = (buf[j] >> 1) & 1; ptr[j*8+7] = buf[j] & 1; } + for (j = 0; j < (avctx->width & 7); j++) { + ptr[avctx->width - (avctx->width & 7) + j] = buf[avctx->width >> 3] >> (7 - j) & 1; + } buf += n; ptr += linesize; } @@ -362,7 +365,7 @@ static int bmp_decode_frame(AVCodecContext *avctx, return buf_size; } -AVCodec ff_bmp_decoder = { +const AVCodec ff_bmp_decoder = { .name = "bmp", .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"), .type = AVMEDIA_TYPE_VIDEO,