diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-03-03 10:57:38 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-03-03 10:57:38 +0000 |
commit | 72f86ec013714d15cdef4e9e541ab87f34b670ec (patch) | |
tree | 8370cb9699cdaf57f857ecfc28333497db56673b /libavcodec/h264.c | |
parent | 54063e37c1cb346e020a054a3e0b4bec0c80cb2c (diff) | |
download | ffmpeg-72f86ec013714d15cdef4e9e541ab87f34b670ec.tar.gz |
Simplify implicit_weight table init.
Originally committed as revision 22168 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 15c414745b..0bc8739ce3 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1435,16 +1435,14 @@ static void implicit_weight_table(H264Context *h){ for(ref1=0; ref1 < h->ref_count[1]; ref1++){ int poc1 = h->ref_list[1][ref1].poc; int td = av_clip(poc1 - poc0, -128, 127); + h->implicit_weight[ref0][ref1] = 32; if(td){ int tb = av_clip(cur_poc - poc0, -128, 127); int tx = (16384 + (FFABS(td) >> 1)) / td; - int dist_scale_factor = av_clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; - if(dist_scale_factor < -64 || dist_scale_factor > 128) - h->implicit_weight[ref0][ref1] = 32; - else + int dist_scale_factor = (tb*tx + 32) >> 8; + if(dist_scale_factor >= -64 && dist_scale_factor <= 128) h->implicit_weight[ref0][ref1] = 64 - dist_scale_factor; - }else - h->implicit_weight[ref0][ref1] = 32; + } } } } |