diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-09 18:32:29 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-09 19:04:47 +0100 |
commit | 523da37f4c512a5bde37ab30da3d7d4e67e48c94 (patch) | |
tree | 30dd7493b5f4a66b0883165c13cf82a6b560caf2 /libavcodec/cljr.c | |
parent | 74d9b2134081da5ad5d8320b5fb5ff1d871df61f (diff) | |
download | ffmpeg-streaming-523da37f4c512a5bde37ab30da3d7d4e67e48c94.zip ffmpeg-streaming-523da37f4c512a5bde37ab30da3d7d4e67e48c94.tar.gz |
cljrenc: 2x2 ordered dither support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/cljr.c')
-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 65a077b..ed0eede 100644 --- a/libavcodec/cljr.c +++ b/libavcodec/cljr.c @@ -137,6 +137,11 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, AVFrame *p = data; int x, y; uint32_t dither= avctx->frame_number; + static const uint32_t ordered_dither[2][2] = + { + { 0x10400000, 0x104F0000 }, + { 0xCB2A0000, 0xCB250000 }, + }; p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; @@ -151,6 +156,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, 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; } put_bits(&pb, 5, (luma[3] + (dither>>29) ) >> 3); put_bits(&pb, 5, (luma[2] + ((dither>>26)&7)) >> 3); |