diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-10-24 16:35:42 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-10-24 16:35:42 +0400 |
commit | 19591033f7145115790338bfd038b7ecb6ff39ee (patch) | |
tree | b62bc0bac42af65d1196de66b1118c47d38253af /libavcodec/ffv1.c | |
parent | 98d2f7a47f1ecc0d0025ac601e47f38f7706409f (diff) |
Fix the case with swaping states 127 and 129 in ffv1
Originally committed as revision 25562 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ffv1.c')
-rw-r--r-- | libavcodec/ffv1.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index eddac74cb6..2ac13a39f1 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -896,19 +896,23 @@ static av_cold int encode_init(AVCodecContext *avctx) double size0= COST2(i, i ) + COST2(i2, i2); double sizeX= COST2(i, i2) + COST2(i2, i ); - if(sizeX < size0 && i!=128 && i2!=128){ //128 is special we cant swap it around FIXME 127<->129 swap + if(sizeX < size0 && i!=128 && i2!=128){ int j; FFSWAP(int, s->state_transition[ i], s->state_transition[ i2]); - FFSWAP(int, s->state_transition[256-i], s->state_transition[256-i2]); FFSWAP(int, s->rc_stat[i ][0],s->rc_stat[ i2][0]); FFSWAP(int, s->rc_stat[i ][1],s->rc_stat[ i2][1]); + if(i != 256-i2){ + FFSWAP(int, s->state_transition[256-i], s->state_transition[256-i2]); FFSWAP(int, s->rc_stat[256-i][0],s->rc_stat[256-i2][0]); FFSWAP(int, s->rc_stat[256-i][1],s->rc_stat[256-i2][1]); + } for(j=1; j<256; j++){ if (s->state_transition[j] == i ) s->state_transition[j] = i2; else if(s->state_transition[j] == i2) s->state_transition[j] = i ; + if(i != 256-i2){ if (s->state_transition[256-j] == 256-i ) s->state_transition[256-j] = 256-i2; else if(s->state_transition[256-j] == 256-i2) s->state_transition[256-j] = 256-i ; + } } changed=1; } |