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
862 s->mv[dir][1][0], s->mv[dir][1][1],862 s->mv[dir][1][0], s->mv[dir][1][1],
863 block_s, mb_y);863 block_s, mb_y);
864 } else {864 } else {
865 if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field865 if (s->picture_structure != s->field_select[dir][0] + 1 &&
866 || !ref_picture[0]) {866 s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
867 ref_picture = s->current_picture_ptr->f->data;867 ref_picture = s->current_picture_ptr->f->data;
868 }868 }
869 mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,869 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
877 for (int i = 0; i < 2; i++) {877 for (int i = 0; i < 2; i++) {
878 uint8_t *const *ref2picture;878 uint8_t *const *ref2picture;
879 879
880 if ((s->picture_structure == s->field_select[dir][i] + 1 ||880 if (s->picture_structure == s->field_select[dir][i] + 1 ||
881 s->pict_type == AV_PICTURE_TYPE_B || s->first_field) &&881 s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
882 ref_picture[0]) {
883 ref2picture = ref_picture;882 ref2picture = ref_picture;
884 } else {883 } else {
885 ref2picture = s->current_picture_ptr->f->data;884 ref2picture = s->current_picture_ptr->f->data;
@@ -910,9 +909,6 @@ static inline void MPV_motion_lowres(MpegEncContext *s, · 24 unmodified lines
910 pix_op = s->h264chroma.avg_h264_chroma_pixels_tab;909 pix_op = s->h264chroma.avg_h264_chroma_pixels_tab;
911 }910 }
912 } else {911 } else {
913 if (!ref_picture[0]) {
914 ref_picture = s->current_picture_ptr->f->data;
915 }
916 for (int i = 0; i < 2; i++) {912 for (int i = 0; i < 2; i++) {
917 mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,913 mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
918 0, 0, s->picture_structure != i + 1,914 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
739 s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);739 s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
740 }740 }
741 } else {741 } else {
742 if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field742 if (s->picture_structure != s->field_select[dir][0] + 1 &&
743 || !ref_picture[0]) {743 s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
744 ref_picture = s->current_picture_ptr->f->data;744 ref_picture = s->current_picture_ptr->f->data;
745 }745 }
746 746
@@ -755,9 +755,8 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, · 8 unmodified lines
755 for (i = 0; i < 2; i++) {755 for (i = 0; i < 2; i++) {
756 uint8_t *const *ref2picture;756 uint8_t *const *ref2picture;
757 757
758 if ((s->picture_structure == s->field_select[dir][i] + 1 ||758 if (s->picture_structure == s->field_select[dir][i] + 1 ||
759 s->pict_type == AV_PICTURE_TYPE_B || s->first_field) &&759 s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
760 ref_picture[0]) {
761 ref2picture = ref_picture;760 ref2picture = ref_picture;
762 } else {761 } else {
763 ref2picture = s->current_picture_ptr->f->data;762 ref2picture = s->current_picture_ptr->f->data;
@@ -787,9 +786,6 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, · 23 unmodified lines
787 pix_op = s->hdsp.avg_pixels_tab;786 pix_op = s->hdsp.avg_pixels_tab;
788 }787 }
789 } else {788 } else {
790 if (!ref_picture[0]) {
791 ref_picture = s->current_picture_ptr->f->data;
792 }
793 for (i = 0; i < 2; i++) {789 for (i = 0; i < 2; i++) {
794 mpeg_motion(s, dest_y, dest_cb, dest_cr,790 mpeg_motion(s, dest_y, dest_cb, dest_cr,
795 s->picture_structure != i + 1,791 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