Skip to content

Commit

Permalink
Pad uneven biWidth value for compatibility with MPCVR
Browse files Browse the repository at this point in the history
  • Loading branch information
clsid2 committed Oct 11, 2023
1 parent acf6659 commit 378c231
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions decoder/LAVVideo/LAVPixFmtConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ void CLAVPixFmtConverter::GetMediaType(CMediaType *mt, int index, LONG biWidth,
{
pBIH->biWidth = FFALIGN(biWidth, 48);
}
else if ((biWidth & 1) && (guid == MEDIASUBTYPE_NV12 || guid == MEDIASUBTYPE_YV12 || guid == MEDIASUBTYPE_YUY2 || guid == MEDIASUBTYPE_I420))
{
pBIH->biWidth = FFALIGN(biWidth, 2);
}

mt->SetSampleSize(pBIH->biSizeImage);
mt->SetTemporalCompression(0);
Expand Down
5 changes: 5 additions & 0 deletions decoder/LAVVideo/LAVVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,10 @@ HRESULT CLAVVideo::ReconnectOutput(int width, int height, AVRational ar, DXVA2_E
{
pBIH->biWidth = FFALIGN(width, 48);
}
else if ((width & 1) && (mt.subtype == MEDIASUBTYPE_NV12 || mt.subtype == MEDIASUBTYPE_YV12 || mt.subtype == MEDIASUBTYPE_YUY2 || mt.subtype == MEDIASUBTYPE_I420))
{
pBIH->biWidth = FFALIGN(width, 2);
}

HRESULT hrQA = m_pOutput->GetConnected()->QueryAccept(&mt);
if (bDXVA)
Expand Down Expand Up @@ -1630,6 +1634,7 @@ HRESULT CLAVVideo::ReconnectOutput(int width, int height, AVRational ar, DXVA2_E
else
{
DbgLog((LOG_TRACE, 10, L"-> Receive Connection failed (hr: %x); QueryAccept: %x", hr, hrQA));
return E_FAIL;
}
}
if (bNeedReconnect && !bDXVA)
Expand Down

0 comments on commit 378c231

Please sign in to comment.