H.261 does not have B-frames.
Unified · Split
| @@ -537,7 +537,7 @@ static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4) · 536 unmodified lines | |||
| 537 | /** | 537 | /** |
| 538 | * get fullpel ME search limits. | 538 | * get fullpel ME search limits. |
| 539 | */ | 539 | */ |
| 540 | static inline void get_limits(MpegEncContext *s, int x, int y) | 540 | static inline void get_limits(MpegEncContext *s, int x, int y, int bframe) |
| 541 | { | 541 | { |
| 542 | MotionEstContext * const c= &s->me; | 542 | MotionEstContext * const c= &s->me; |
| 543 | int range= c->avctx->me_range >> (1 + !!(c->flags&FLAG_QPEL)); | 543 | int range= c->avctx->me_range >> (1 + !!(c->flags&FLAG_QPEL)); |
| @@ -551,7 +551,7 @@ static inline void get_limits(MpegEncContext *s, int x, int y) · 7 unmodified lines | |||
| 551 | c->ymin = - y - 16; | 551 | c->ymin = - y - 16; |
| 552 | c->xmax = - x + s->width; | 552 | c->xmax = - x + s->width; |
| 553 | c->ymax = - y + s->height; | 553 | c->ymax = - y + s->height; |
| 554 | } else if (s->out_format == FMT_H261){ | 554 | } else if (!(av_builtin_constant_p(bframe) && bframe) && s->out_format == FMT_H261){ |
| 555 | // Search range of H.261 is different from other codec standards | 555 | // Search range of H.261 is different from other codec standards |
| 556 | c->xmin = (x > 15) ? - 15 : 0; | 556 | c->xmin = (x > 15) ? - 15 : 0; |
| 557 | c->ymin = (y > 15) ? - 15 : 0; | 557 | c->ymin = (y > 15) ? - 15 : 0; |
| @@ -921,7 +921,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, · 363 unmodified lines | |||
| 921 | c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp); | 921 | c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp); |
| 922 | c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV; | 922 | c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV; |
| 923 | 923 | ||
| 924 | get_limits(s, 16*mb_x, 16*mb_y); | 924 | get_limits(s, 16*mb_x, 16*mb_y, 0); |
| 925 | c->skip=0; | 925 | c->skip=0; |
| 926 | 926 | ||
| 927 | /* intra / predictive decision */ | 927 | /* intra / predictive decision */ |
| @@ -1088,7 +1088,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, · 160 unmodified lines | |||
| 1088 | c->pre_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp); | 1088 | c->pre_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp); |
| 1089 | c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV; | 1089 | c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV; |
| 1090 | 1090 | ||
| 1091 | get_limits(s, 16*mb_x, 16*mb_y); | 1091 | get_limits(s, 16*mb_x, 16*mb_y, 0); |
| 1092 | c->skip=0; | 1092 | c->skip=0; |
| 1093 | 1093 | ||
| 1094 | P_LEFT[0] = s->p_mv_table[xy + 1][0]; | 1094 | P_LEFT[0] = s->p_mv_table[xy + 1][0]; |
| @@ -1140,7 +1140,7 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y, · 45 unmodified lines | |||
| 1140 | 1140 | ||
| 1141 | c->current_mv_penalty= mv_penalty; | 1141 | c->current_mv_penalty= mv_penalty; |
| 1142 | 1142 | ||
| 1143 | get_limits(s, 16*mb_x, 16*mb_y); | 1143 | get_limits(s, 16*mb_x, 16*mb_y, 1); |
| 1144 | 1144 | ||
| 1145 | if (s->motion_est != FF_ME_ZERO) { | 1145 | if (s->motion_est != FF_ME_ZERO) { |
| 1146 | P_LEFT[0] = mv_table[mot_xy - 1][0]; | 1146 | P_LEFT[0] = mv_table[mot_xy - 1][0]; |
| @@ -1489,7 +1489,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y) · 342 unmodified lines | |||
| 1489 | if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) | 1489 | if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) |
| 1490 | dmin= get_mb_score(s, mx, my, 0, 0, 0, 16, 1); | 1490 | dmin= get_mb_score(s, mx, my, 0, 0, 0, 16, 1); |
| 1491 | 1491 | ||
| 1492 | get_limits(s, 16*mb_x, 16*mb_y); //restore c->?min/max, maybe not needed | 1492 | get_limits(s, 16*mb_x, 16*mb_y, 1); //restore c->?min/max, maybe not needed |
| 1493 | 1493 | ||
| 1494 | mv_table[mot_xy][0]= mx; | 1494 | mv_table[mot_xy][0]= mx; |
| 1495 | mv_table[mot_xy][1]= my; | 1495 | mv_table[mot_xy][1]= my; |
| @@ -1509,7 +1509,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, · 13 unmodified lines | |||
| 1509 | init_ref(c, s->new_pic->data, s->last_pic.data, | 1509 | init_ref(c, s->new_pic->data, s->last_pic.data, |
| 1510 | s->next_pic.data, 16 * mb_x, 16 * mb_y, 2); | 1510 | s->next_pic.data, 16 * mb_x, 16 * mb_y, 2); |
| 1511 | 1511 | ||
| 1512 | get_limits(s, 16*mb_x, 16*mb_y); | 1512 | get_limits(s, 16*mb_x, 16*mb_y, 1); |
| 1513 | 1513 | ||
| 1514 | c->skip=0; | 1514 | c->skip=0; |
| 1515 | 1515 | ||