History

avcodec/mpegvideo_motion: Remove dead checks for existence of reference

These references now always exist due to dummy frames. Also remove the corresponding checks in the lowres code in mpegvideo_dec.c.

Andreas Rheinhardt committed 2 years ago

Commit f44d2121 parent c85508f2 files · +8 −16Browse files

Unified · Split

2 files
  1. libavcodec/mpegvideo_dec.c +4 −8
  2. libavcodec/mpegvideo_motion.c +4 −8
libavcodec/mpegvideo_dec.c+4−8
@@ -862,8 +862,8 @@ static inline void MPV_motion_lowres(MpegEncContext *s, · 861 unmodified lines
862862 s->mv[dir][1][0], s->mv[dir][1][1],
863863 block_s, mb_y);
864864 } else {
865− if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field
866− || !ref_picture[0]) {
865+ if (s->picture_structure != s->field_select[dir][0] + 1 &&
866+ s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
867867 ref_picture = s->current_picture_ptr->f->data;
868868 }
869869 mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
@@ -877,9 +877,8 @@ static inline void MPV_motion_lowres(MpegEncContext *s, · 7 unmodified lines
877877 for (int i = 0; i < 2; i++) {
878878 uint8_t *const *ref2picture;
879879
880− if ((s->picture_structure == s->field_select[dir][i] + 1 ||
881− s->pict_type == AV_PICTURE_TYPE_B || s->first_field) &&
882− ref_picture[0]) {
880+ if (s->picture_structure == s->field_select[dir][i] + 1 ||
881+ s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
883882 ref2picture = ref_picture;
884883 } else {
885884 ref2picture = s->current_picture_ptr->f->data;
@@ -910,9 +909,6 @@ static inline void MPV_motion_lowres(MpegEncContext *s, · 24 unmodified lines
910909 pix_op = s->h264chroma.avg_h264_chroma_pixels_tab;
911910 }
912911 } else {
913− if (!ref_picture[0]) {
914− ref_picture = s->current_picture_ptr->f->data;
915− }
916912 for (int i = 0; i < 2; i++) {
917913 mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
918914 0, 0, s->picture_structure != i + 1,
libavcodec/mpegvideo_motion.c+4−8
@@ -739,8 +739,8 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, · 738 unmodified lines
739739 s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
740740 }
741741 } else {
742− if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field
743− || !ref_picture[0]) {
742+ if (s->picture_structure != s->field_select[dir][0] + 1 &&
743+ s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
744744 ref_picture = s->current_picture_ptr->f->data;
745745 }
746746
@@ -755,9 +755,8 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, · 8 unmodified lines
755755 for (i = 0; i < 2; i++) {
756756 uint8_t *const *ref2picture;
757757
758− if ((s->picture_structure == s->field_select[dir][i] + 1 ||
759− s->pict_type == AV_PICTURE_TYPE_B || s->first_field) &&
760− ref_picture[0]) {
758+ if (s->picture_structure == s->field_select[dir][i] + 1 ||
759+ s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
761760 ref2picture = ref_picture;
762761 } else {
763762 ref2picture = s->current_picture_ptr->f->data;
@@ -787,9 +786,6 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, · 23 unmodified lines
787786 pix_op = s->hdsp.avg_pixels_tab;
788787 }
789788 } else {
790− if (!ref_picture[0]) {
791− ref_picture = s->current_picture_ptr->f->data;
792− }
793789 for (i = 0; i < 2; i++) {
794790 mpeg_motion(s, dest_y, dest_cb, dest_cr,
795791 s->picture_structure != i + 1,

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