From 744cc53445773e0da09693ba8cb23b1206df5f9d Mon Sep 17 00:00:00 2001 From: "yuzhuohuang@qq.com" Date: Mon, 15 Oct 2012 16:48:35 +0800 Subject: [PATCH] X64 transport [Part 3.2](Update VD Fix: P010/P016/NV12/NV21.) --- src/dsutil/vd.cpp | 22 ++++++++++++++++++++++ src/dsutil/vd.h | 4 +++- .../transform/basevideofilter/BaseVideoFilter.cpp | 8 ++------ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/dsutil/vd.cpp b/src/dsutil/vd.cpp index d13d746..8ffff10 100644 --- a/src/dsutil/vd.cpp +++ b/src/dsutil/vd.cpp @@ -376,3 +376,25 @@ bool BitBltFromI420ToYUY2Interlaced(int w, int h, BYTE* dst, int dstpitch, BYTE* return true; } + +bool BitBltFromP010ToP010(int w, int h, BYTE* dst, int dstpitch, const BYTE* src, int srcpitch) +{ + if (w <= 0 || h <= 0) { + return true; + } + ASSERT(dst && src && w*2<=srcpitch && w*2<=dstpitch && ((h&1)==0)); + VDMemcpyRect(dst, dstpitch, src, srcpitch, w*2, h+h/2); + + return true; +} + +bool BitBltFromNV12ToNV12(int w, int h, BYTE* dst, int dstpitch, const BYTE* src, int srcpitch) +{ + if (w <= 0 || h <= 0) { + return true; + } + ASSERT(dst && src && w<=srcpitch && w<=dstpitch && ((h&1)==0)); + VDMemcpyRect(dst, dstpitch, src, srcpitch, w, h+h/2); + + return true; +} diff --git a/src/dsutil/vd.h b/src/dsutil/vd.h index 65cf407..2a330ca 100644 --- a/src/dsutil/vd.h +++ b/src/dsutil/vd.h @@ -38,8 +38,10 @@ extern bool BitBltFromYUY2ToYUY2(int w, int h, BYTE* dst, int dstpitch, BYTE* sr extern bool BitBltFromYUY2ToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* src, int srcpitch); extern bool BitBltFromRGBToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* src, int srcpitch, int sbpp); +extern bool BitBltFromP010ToP010(int w, int h, BYTE* dst, int dstpitch, const BYTE* src, int srcpitch); +extern bool BitBltFromNV12ToNV12(int w, int h, BYTE* dst, int dstpitch, const BYTE* src, int srcpitch); + extern void DeinterlaceBlend(BYTE* dst, BYTE* src, DWORD rowbytes, DWORD h, DWORD dstpitch, DWORD srcpitch); extern void DeinterlaceBob(BYTE* dst, BYTE* src, DWORD rowbytes, DWORD h, DWORD dstpitch, DWORD srcpitch, bool topfield); extern void DeinterlaceELA_X8R8G8B8(BYTE* dst, BYTE* src, DWORD w, DWORD h, DWORD dstpitch, DWORD srcpitch, bool topfield); extern void DeinterlaceELA(BYTE* dst, BYTE* src, DWORD w, DWORD h, DWORD dstpitch, DWORD srcpitch, bool topfield); - diff --git a/src/filters/transform/basevideofilter/BaseVideoFilter.cpp b/src/filters/transform/basevideofilter/BaseVideoFilter.cpp index 6b57b93..49d9258 100644 --- a/src/filters/transform/basevideofilter/BaseVideoFilter.cpp +++ b/src/filters/transform/basevideofilter/BaseVideoFilter.cpp @@ -388,17 +388,13 @@ HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int { if (bihOut.biCompression != subtype.Data1) return VFW_E_TYPE_NOT_ACCEPTED; - //TODO: FIX ME! - BitBltFromYUY2ToYUY2(w*2, h, pOut, bihOut.biWidth*2, ppIn[0], pitchIn); - BitBltFromYUY2ToYUY2(w*2, h/2, pOut+bihOut.biWidth*2*h, bihOut.biWidth*2, ppIn[1], pitchIn); + BitBltFromP010ToP010(w, h, pOut, bihOut.biWidth*2, ppIn[0], pitchIn); } else if(subtype == MEDIASUBTYPE_NV12 || subtype == MEDIASUBTYPE_NV21) { if (bihOut.biCompression != subtype.Data1) return VFW_E_TYPE_NOT_ACCEPTED; - //TODO: FIX ME! - BitBltFromYUY2ToYUY2(w/2, h, pOut, bihOut.biWidth, ppIn[0], pitchIn); - BitBltFromYUY2ToYUY2(w/2, h/2, pOut+bihOut.biWidth*h, bihOut.biWidth, ppIn[1], pitchIn); + BitBltFromNV12ToNV12(w, h, pOut, bihOut.biWidth, ppIn[0], pitchIn); } else if(subtype == MEDIASUBTYPE_YUY2) { -- 2.11.4.GIT