This otherwise generates an inconsistency between the frame state and the link state, since the link state is set to 1:1 explicitly when `reset_sar` is enabled, but this line of code unconditionally overwrote the output frame SAR with the value that would be computed in the absence of `reset_sar`. cf. vf_scale_cuda, which does this correctly
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -854,10 +854,14 @@ scale: · 853 unmodified lines | ||
| 854 | 854 | AV_SIDE_DATA_PROP_COLOR_DEPENDENT); |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | − av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den, | |
| 858 | − (int64_t)in->sample_aspect_ratio.num * outlink->h * link->w, | |
| 859 | − (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h, | |
| 860 | − INT_MAX); | |
| 857 | + if (scale->reset_sar) { | |
| 858 | + out->sample_aspect_ratio = outlink->sample_aspect_ratio; | |
| 859 | + } else { | |
| 860 | + av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den, | |
| 861 | + (int64_t)in->sample_aspect_ratio.num * outlink->h * link->w, | |
| 862 | + (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h, | |
| 863 | + INT_MAX); | |
| 864 | + } | |
| 861 | 865 | |
| 862 | 866 | if (sws_is_noop(out, in)) { |
| 863 | 867 | av_frame_free(&out); |