Skip to content

Commit

Permalink
Keep upstream's PAR value
Browse files Browse the repository at this point in the history
  • Loading branch information
chainikdn committed Sep 6, 2020
1 parent a82fdde commit 6a4951b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions avisynth_filter/src/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,12 @@ auto CAviSynthFilter::GenerateMediaType(int definition, const AM_MEDIA_TYPE *tem

if (SUCCEEDED(CheckVideoInfo2Type(newMediaType))) {
VIDEOINFOHEADER2 *newVih2 = reinterpret_cast<VIDEOINFOHEADER2 *>(newMediaType->pbFormat);
const int gcd = std::gcd(_avsScriptVideoInfo.width, _avsScriptVideoInfo.height);
newVih2->dwPictAspectRatioX = _avsScriptVideoInfo.width / gcd;
newVih2->dwPictAspectRatioY = _avsScriptVideoInfo.height / gcd;
newBmi = &newVih2->bmiHeader;
const __int64 ax = static_cast<__int64>(_avsScriptVideoInfo.width) * newVih2->dwPictAspectRatioX * std::abs(newBmi->biHeight);
const __int64 ay = static_cast<__int64>(_avsScriptVideoInfo.height) * newVih2->dwPictAspectRatioY * newBmi->biWidth;
const __int64 gcd = std::gcd(ax, ay);
newVih2->dwPictAspectRatioX = static_cast<DWORD>(ax / gcd);
newVih2->dwPictAspectRatioY = static_cast<DWORD>(ay / gcd);
} else {
newBmi = &newVih->bmiHeader;
}
Expand Down

0 comments on commit 6a4951b

Please sign in to comment.