History

avcodec/motion_est: Optimize dead code away

H.261 does not have B-frames.

Andreas Rheinhardt committed 2 years ago

Commit b28bf831 parent bbb10f11 file · +7 −7Browse files

Unified · Split

libavcodec/motion_est.c+7−7
@@ -537,7 +537,7 @@ static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4) · 536 unmodified lines
537537 /**
538538 * get fullpel ME search limits.
539539 */
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)
541541 {
542542 MotionEstContext * const c= &s->me;
543543 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
551551 c->ymin = - y - 16;
552552 c->xmax = - x + s->width;
553553 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){
555555 // Search range of H.261 is different from other codec standards
556556 c->xmin = (x > 15) ? - 15 : 0;
557557 c->ymin = (y > 15) ? - 15 : 0;
@@ -921,7 +921,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, · 363 unmodified lines
921921 c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
922922 c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
923923
924− get_limits(s, 16*mb_x, 16*mb_y);
924+ get_limits(s, 16*mb_x, 16*mb_y, 0);
925925 c->skip=0;
926926
927927 /* intra / predictive decision */
@@ -1088,7 +1088,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, · 160 unmodified lines
10881088 c->pre_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp);
10891089 c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
10901090
1091− get_limits(s, 16*mb_x, 16*mb_y);
1091+ get_limits(s, 16*mb_x, 16*mb_y, 0);
10921092 c->skip=0;
10931093
10941094 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
11401140
11411141 c->current_mv_penalty= mv_penalty;
11421142
1143− get_limits(s, 16*mb_x, 16*mb_y);
1143+ get_limits(s, 16*mb_x, 16*mb_y, 1);
11441144
11451145 if (s->motion_est != FF_ME_ZERO) {
11461146 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
14891489 if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
14901490 dmin= get_mb_score(s, mx, my, 0, 0, 0, 16, 1);
14911491
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
14931493
14941494 mv_table[mot_xy][0]= mx;
14951495 mv_table[mot_xy][1]= my;
@@ -1509,7 +1509,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, · 13 unmodified lines
15091509 init_ref(c, s->new_pic->data, s->last_pic.data,
15101510 s->next_pic.data, 16 * mb_x, 16 * mb_y, 2);
15111511
1512− get_limits(s, 16*mb_x, 16*mb_y);
1512+ get_limits(s, 16*mb_x, 16*mb_y, 1);
15131513
15141514 c->skip=0;
15151515

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t