comparison motion_est.c @ 1064:b32afefe7d33 libavcodec

* UINTX -> uintx_t INTX -> intx_t
author kabi
date Tue, 11 Feb 2003 16:35:48 +0000
parents bb5de8a59da8
children d3b93dc997a3
comparison
equal deleted inserted replaced
1063:fdeac9642346 1064:b32afefe7d33
385 else 385 else
386 s->me.get_mb_score= simple_hpel_get_mb_score; 386 s->me.get_mb_score= simple_hpel_get_mb_score;
387 } 387 }
388 } 388 }
389 389
390 static int pix_dev(UINT8 * pix, int line_size, int mean) 390 static int pix_dev(uint8_t * pix, int line_size, int mean)
391 { 391 {
392 int s, i, j; 392 int s, i, j;
393 393
394 s = 0; 394 s = 0;
395 for (i = 0; i < 16; i++) { 395 for (i = 0; i < 16; i++) {
420 int *mx_ptr, int *my_ptr, int range, 420 int *mx_ptr, int *my_ptr, int range,
421 int xmin, int ymin, int xmax, int ymax, uint8_t *ref_picture) 421 int xmin, int ymin, int xmax, int ymax, uint8_t *ref_picture)
422 { 422 {
423 int x1, y1, x2, y2, xx, yy, x, y; 423 int x1, y1, x2, y2, xx, yy, x, y;
424 int mx, my, dmin, d; 424 int mx, my, dmin, d;
425 UINT8 *pix; 425 uint8_t *pix;
426 426
427 xx = 16 * s->mb_x; 427 xx = 16 * s->mb_x;
428 yy = 16 * s->mb_y; 428 yy = 16 * s->mb_y;
429 x1 = xx - range + 1; /* we loose one pixel to avoid boundary pb with half pixel pred */ 429 x1 = xx - range + 1; /* we loose one pixel to avoid boundary pb with half pixel pred */
430 if (x1 < xmin) 430 if (x1 < xmin)
474 int *mx_ptr, int *my_ptr, int range, 474 int *mx_ptr, int *my_ptr, int range,
475 int xmin, int ymin, int xmax, int ymax, uint8_t *ref_picture) 475 int xmin, int ymin, int xmax, int ymax, uint8_t *ref_picture)
476 { 476 {
477 int x1, y1, x2, y2, xx, yy, x, y; 477 int x1, y1, x2, y2, xx, yy, x, y;
478 int mx, my, dmin, d; 478 int mx, my, dmin, d;
479 UINT8 *pix; 479 uint8_t *pix;
480 480
481 xx = s->mb_x << 4; 481 xx = s->mb_x << 4;
482 yy = s->mb_y << 4; 482 yy = s->mb_y << 4;
483 483
484 /* Left limit */ 484 /* Left limit */
550 int *mx_ptr, int *my_ptr, int range, 550 int *mx_ptr, int *my_ptr, int range,
551 int xmin, int ymin, int xmax, int ymax, uint8_t *ref_picture) 551 int xmin, int ymin, int xmax, int ymax, uint8_t *ref_picture)
552 { 552 {
553 int x1, y1, x2, y2, xx, yy, x, y, lastx, d; 553 int x1, y1, x2, y2, xx, yy, x, y, lastx, d;
554 int mx, my, dminx, dminy; 554 int mx, my, dminx, dminy;
555 UINT8 *pix; 555 uint8_t *pix;
556 556
557 xx = s->mb_x << 4; 557 xx = s->mb_x << 4;
558 yy = s->mb_y << 4; 558 yy = s->mb_y << 4;
559 559
560 /* Left limit */ 560 /* Left limit */
655 { 655 {
656 uint8_t *ref_picture= picture->data[0]; 656 uint8_t *ref_picture= picture->data[0];
657 uint32_t *score_map= s->me.score_map; 657 uint32_t *score_map= s->me.score_map;
658 const int penalty_factor= s->me.sub_penalty_factor; 658 const int penalty_factor= s->me.sub_penalty_factor;
659 int mx, my, xx, yy, dminh; 659 int mx, my, xx, yy, dminh;
660 UINT8 *pix, *ptr; 660 uint8_t *pix, *ptr;
661 op_pixels_abs_func pix_abs_x2; 661 op_pixels_abs_func pix_abs_x2;
662 op_pixels_abs_func pix_abs_y2; 662 op_pixels_abs_func pix_abs_y2;
663 op_pixels_abs_func pix_abs_xy2; 663 op_pixels_abs_func pix_abs_xy2;
664 664
665 if(size==0){ 665 if(size==0){
962 } 962 }
963 963
964 void ff_estimate_p_frame_motion(MpegEncContext * s, 964 void ff_estimate_p_frame_motion(MpegEncContext * s,
965 int mb_x, int mb_y) 965 int mb_x, int mb_y)
966 { 966 {
967 UINT8 *pix, *ppix; 967 uint8_t *pix, *ppix;
968 int sum, varc, vard, mx, my, range, dmin, xx, yy; 968 int sum, varc, vard, mx, my, range, dmin, xx, yy;
969 int xmin, ymin, xmax, ymax; 969 int xmin, ymin, xmax, ymax;
970 int rel_xmin, rel_ymin, rel_xmax, rel_ymax; 970 int rel_xmin, rel_ymin, rel_xmax, rel_ymax;
971 int pred_x=0, pred_y=0; 971 int pred_x=0, pred_y=0;
972 int P[10][2]; 972 int P[10][2];
1300 int pred_bx, int pred_by) 1300 int pred_bx, int pred_by)
1301 { 1301 {
1302 //FIXME optimize? 1302 //FIXME optimize?
1303 //FIXME move into template? 1303 //FIXME move into template?
1304 //FIXME better f_code prediction (max mv & distance) 1304 //FIXME better f_code prediction (max mv & distance)
1305 UINT16 *mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame 1305 uint16_t *mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
1306 uint8_t *dest_y = s->me.scratchpad; 1306 uint8_t *dest_y = s->me.scratchpad;
1307 uint8_t *ptr; 1307 uint8_t *ptr;
1308 int dxy; 1308 int dxy;
1309 int src_x, src_y; 1309 int src_x, src_y;
1310 int fbmin; 1310 int fbmin;
1533 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type) 1533 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
1534 { 1534 {
1535 if(s->me_method>=ME_EPZS){ 1535 if(s->me_method>=ME_EPZS){
1536 int score[8]; 1536 int score[8];
1537 int i, y; 1537 int i, y;
1538 UINT8 * fcode_tab= s->fcode_tab; 1538 uint8_t * fcode_tab= s->fcode_tab;
1539 int best_fcode=-1; 1539 int best_fcode=-1;
1540 int best_score=-10000000; 1540 int best_score=-10000000;
1541 1541
1542 for(i=0; i<8; i++) score[i]= s->mb_num*(8-i); 1542 for(i=0; i<8; i++) score[i]= s->mb_num*(8-i);
1543 1543
1582 1582
1583 void ff_fix_long_p_mvs(MpegEncContext * s) 1583 void ff_fix_long_p_mvs(MpegEncContext * s)
1584 { 1584 {
1585 const int f_code= s->f_code; 1585 const int f_code= s->f_code;
1586 int y; 1586 int y;
1587 UINT8 * fcode_tab= s->fcode_tab; 1587 uint8_t * fcode_tab= s->fcode_tab;
1588 //int clip=0; 1588 //int clip=0;
1589 //int noclip=0; 1589 //int noclip=0;
1590 /* clip / convert to intra 16x16 type MVs */ 1590 /* clip / convert to intra 16x16 type MVs */
1591 for(y=0; y<s->mb_height; y++){ 1591 for(y=0; y<s->mb_height; y++){
1592 int x; 1592 int x;
1646 } 1646 }
1647 1647
1648 void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type) 1648 void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type)
1649 { 1649 {
1650 int y; 1650 int y;
1651 UINT8 * fcode_tab= s->fcode_tab; 1651 uint8_t * fcode_tab= s->fcode_tab;
1652 1652
1653 // RAL: 8 in MPEG-1, 16 in MPEG-4 1653 // RAL: 8 in MPEG-1, 16 in MPEG-4
1654 int range = (((s->codec_id == CODEC_ID_MPEG1VIDEO) ? 8 : 16) << f_code); 1654 int range = (((s->codec_id == CODEC_ID_MPEG1VIDEO) ? 8 : 16) << f_code);
1655 1655
1656 /* clip / convert to intra 16x16 type MVs */ 1656 /* clip / convert to intra 16x16 type MVs */