Skip to content

Commit

Permalink
PreInitialize video yuv data to black pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
SaiyansKing committed Oct 31, 2023
1 parent 095ebcb commit 2400a1f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions D3D11Engine/zBinkPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ int __fastcall BinkPlayerPlayFrame(DWORD BinkPlayer)
video->textureU->Init(INT2(vidWidth / 2, vidHeight / 2), D3D11Texture::ETextureFormat::TF_R8, 1, nullptr, "Video Texture U");
video->textureV->Init(INT2(vidWidth / 2, vidHeight / 2), D3D11Texture::ETextureFormat::TF_R8, 1, nullptr, "Video Texture V");
video->textureData = new unsigned char[(vidWidth * vidHeight) + ((vidWidth / 2) * (vidHeight / 2)) * 2];

// Init textureData as black pixel yuv data
unsigned char* dataY = video->textureData;
memset( dataY, 16, vidWidth * vidHeight );
unsigned char* dataV = dataY + (vidWidth * vidHeight);
memset( dataV, 128, (vidWidth / 2) * (vidHeight / 2) );
unsigned char* dataU = dataV + ((vidWidth / 2) * (vidHeight / 2));
memset( dataU, 128, (vidWidth / 2) * (vidHeight / 2) );
}
reinterpret_cast<void( __stdcall* )(void*, void*, int, DWORD, DWORD, DWORD, DWORD)>(BinkCopyToBuffer)
(video->vid, video->textureData, vidWidth, vidHeight, 0, 0, 0x70000000L | 15);
Expand Down

0 comments on commit 2400a1f

Please sign in to comment.