comparison h264.c @ 11338:444401d150d6 libavcodec

Simplify implicit_weight table init.
author michael
date Wed, 03 Mar 2010 10:57:38 +0000
parents e8e5dbbbf9c4
children a82cdda1f507
comparison
equal deleted inserted replaced
11337:15dd07e86519 11338:444401d150d6
1433 for(ref0=0; ref0 < h->ref_count[0]; ref0++){ 1433 for(ref0=0; ref0 < h->ref_count[0]; ref0++){
1434 int poc0 = h->ref_list[0][ref0].poc; 1434 int poc0 = h->ref_list[0][ref0].poc;
1435 for(ref1=0; ref1 < h->ref_count[1]; ref1++){ 1435 for(ref1=0; ref1 < h->ref_count[1]; ref1++){
1436 int poc1 = h->ref_list[1][ref1].poc; 1436 int poc1 = h->ref_list[1][ref1].poc;
1437 int td = av_clip(poc1 - poc0, -128, 127); 1437 int td = av_clip(poc1 - poc0, -128, 127);
1438 h->implicit_weight[ref0][ref1] = 32;
1438 if(td){ 1439 if(td){
1439 int tb = av_clip(cur_poc - poc0, -128, 127); 1440 int tb = av_clip(cur_poc - poc0, -128, 127);
1440 int tx = (16384 + (FFABS(td) >> 1)) / td; 1441 int tx = (16384 + (FFABS(td) >> 1)) / td;
1441 int dist_scale_factor = av_clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; 1442 int dist_scale_factor = (tb*tx + 32) >> 8;
1442 if(dist_scale_factor < -64 || dist_scale_factor > 128) 1443 if(dist_scale_factor >= -64 && dist_scale_factor <= 128)
1443 h->implicit_weight[ref0][ref1] = 32;
1444 else
1445 h->implicit_weight[ref0][ref1] = 64 - dist_scale_factor; 1444 h->implicit_weight[ref0][ref1] = 64 - dist_scale_factor;
1446 }else 1445 }
1447 h->implicit_weight[ref0][ref1] = 32;
1448 } 1446 }
1449 } 1447 }
1450 } 1448 }
1451 1449
1452 /** 1450 /**