diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-05-31 23:52:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-01 00:48:48 +0200 |
commit | 6dc709f0f5c5e019ac9a1ea51bb06c04edc1e208 (patch) | |
tree | 3e8c38753500aecd8f651405ffb65071393a105f /libavcodec | |
parent | 59a70422b1bba8b413c0f13d2489f3fac41e6413 (diff) | |
download | ffmpeg-6dc709f0f5c5e019ac9a1ea51bb06c04edc1e208.tar.gz |
avcodec/cljr: support width%4 encoding
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/cljr.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c index 9b2bf60dfa..8d1d1a0c72 100644 --- a/libavcodec/cljr.c +++ b/libavcodec/cljr.c @@ -124,12 +124,18 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *luma = &p->data[0][y * p->linesize[0]]; uint8_t *cb = &p->data[1][y * p->linesize[1]]; uint8_t *cr = &p->data[2][y * p->linesize[2]]; + uint8_t luma_tmp[4]; for (x = 0; x < avctx->width; x += 4) { switch (a->dither_type) { case 0: dither = 0x492A0000; break; case 1: dither = dither * 1664525 + 1013904223; break; case 2: dither = ordered_dither[ y&1 ][ (x>>2)&1 ];break; } + if (x+3 >= avctx->width) { + memset(luma_tmp, 0, sizeof(luma_tmp)); + memcpy(luma_tmp, luma, avctx->width - x); + luma = luma_tmp; + } put_bits(&pb, 5, (249*(luma[3] + (dither>>29) )) >> 11); put_bits(&pb, 5, (249*(luma[2] + ((dither>>26)&7))) >> 11); put_bits(&pb, 5, (249*(luma[1] + ((dither>>23)&7))) >> 11); |