Skip to content

Commit

Permalink
MpcDvdVideoDecoder и RoQSplitter - теперь используют, по возможности,…
Browse files Browse the repository at this point in the history
… конвертацию I420 -> NV12 с помощью SSE2.
  • Loading branch information
Aleksoid1978 committed Nov 21, 2024
1 parent ea4dbc0 commit 7b5831c
Show file tree
Hide file tree
Showing 16 changed files with 333 additions and 277 deletions.
2 changes: 2 additions & 0 deletions src/DSUtil/DSUtil.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
<ClInclude Include="Mpeg2Def.h" />
<ClInclude Include="NullRenderers.h" />
<ClInclude Include="Packet.h" />
<ClInclude Include="pixconv\pixconv_sse2_templates.h" />
<ClInclude Include="pixconv\yuv420_nv12_unscaled.h" />
<ClInclude Include="PixelUtils.h" />
<ClInclude Include="PixelUtils_AviSynth.h" />
<ClInclude Include="PixelUtils_VirtualDub.h" />
Expand Down
9 changes: 9 additions & 0 deletions src/DSUtil/DSUtil.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<UniqueIdentifier>{2b09c18b-87fc-47da-a366-3e14c0b9d40f}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc</Extensions>
</Filter>
<Filter Include="pixconv">
<UniqueIdentifier>{8a2c62ac-ed7f-4998-83c0-a29a67fadbdf}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="DSMPropertyBag.cpp">
Expand Down Expand Up @@ -268,5 +271,11 @@
<ClInclude Include="ISOLang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="pixconv\pixconv_sse2_templates.h">
<Filter>pixconv</Filter>
</ClInclude>
<ClInclude Include="pixconv\yuv420_nv12_unscaled.h">
<Filter>pixconv</Filter>
</ClInclude>
</ItemGroup>
</Project>
19 changes: 17 additions & 2 deletions src/DSUtil/PixelUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) 2020 see Authors.txt
* (C) 2020-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand All @@ -23,6 +23,8 @@
#include "PixelUtils_VirtualDub.h"
#include "PixelUtils.h"

#include "pixconv/yuv420_nv12_unscaled.h"

void CopyPlane(const UINT h, BYTE* dst, UINT dst_pitch, const BYTE* src, UINT src_pitch)
{
if (dst_pitch == src_pitch) {
Expand All @@ -39,8 +41,21 @@ void CopyPlane(const UINT h, BYTE* dst, UINT dst_pitch, const BYTE* src, UINT sr
}
}

void CopyI420toNV12(UINT h, BYTE* dst, UINT dst_pitch, const BYTE* const src[3], UINT src_pitch)
void CopyI420toNV12(UINT w, UINT h, BYTE* dst, UINT dst_pitch, const BYTE* const src[3], UINT src_pitch)
{
if (!(dst_pitch % 16) && !(src_pitch % 16)) {
const ptrdiff_t srcStride[3] = { src_pitch, src_pitch / 2, src_pitch / 2 };

uint8_t* dstData[2] = {};
dstData[0] = dst;
dstData[1] = dstData[0] + dst_pitch * h;
const ptrdiff_t dstStride[] = { dst_pitch, dst_pitch };

convert_yuv420_nv12(src, srcStride, dstData, w, h, dstStride);

return;
}

CopyPlane(h, dst, dst_pitch, src[0], src_pitch); // Y

dst += dst_pitch * h;
Expand Down
4 changes: 2 additions & 2 deletions src/DSUtil/PixelUtils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) 2020 see Authors.txt
* (C) 2020-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand All @@ -22,7 +22,7 @@

extern void CopyPlane(const UINT h, BYTE* dst, UINT dst_pitch, const BYTE* src, UINT src_pitch);

extern void CopyI420toNV12(UINT h, BYTE* dst, UINT dst_pitch, const BYTE* const src[3], UINT src_pitch);
extern void CopyI420toNV12(UINT w, UINT h, BYTE* dst, UINT dst_pitch, const BYTE* const src[3], UINT src_pitch);
extern void CopyI420toYV12(UINT h, BYTE* dst, UINT dst_pitch, const BYTE* const src[3], UINT src_pitch);

extern void ConvertI420toYUY2(UINT h, BYTE* dst, UINT dst_pitch, const BYTE* const src[3], UINT src_pitch, const bool bInterlaced);
Expand Down
Loading

0 comments on commit 7b5831c

Please sign in to comment.