Skip to content

Commit

Permalink
Duplicate destination result line is better...
Browse files Browse the repository at this point in the history
Signed-off-by: jpsdr <jpsdr.psx@free.fr>
  • Loading branch information
jpsdr committed Jul 17, 2020
1 parent 4771fbc commit fc18e76
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions nnedi3/nnedi3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1204,15 +1204,13 @@ PVideoFrame __stdcall nnedi3::GetFrame(int n, IScriptEnvironment *env)

if (vi.Is420() && ((vi.height & 3)!=0))
{
ptrdiff_t src_offsetU=(src->GetHeight(PLANAR_U)-1)*src->GetPitch(PLANAR_U);
ptrdiff_t src_offsetV=(src->GetHeight(PLANAR_V)-1)*src->GetPitch(PLANAR_V);
ptrdiff_t dst_offsetU=(dst->GetHeight(PLANAR_U)-1)*dst->GetPitch(PLANAR_U);
ptrdiff_t dst_offsetV=(dst->GetHeight(PLANAR_V)-1)*dst->GetPitch(PLANAR_V);

memcpy(dst->GetWritePtr(PLANAR_U)+dst_offsetU,src->GetReadPtr(PLANAR_U)+src_offsetU,
src->GetRowSize(PLANAR_U));
memcpy(dst->GetWritePtr(PLANAR_V)+dst_offsetV,src->GetReadPtr(PLANAR_V)+src_offsetV,
src->GetRowSize(PLANAR_V));
ptrdiff_t dst_offsetU=(dst->GetHeight(PLANAR_U)-2)*dst->GetPitch(PLANAR_U);
ptrdiff_t dst_offsetV=(dst->GetHeight(PLANAR_V)-2)*dst->GetPitch(PLANAR_V);

memcpy(dst->GetWritePtr(PLANAR_U)+(dst_offsetU+dst->GetPitch(PLANAR_U)),
dst->GetWritePtr(PLANAR_U)+dst_offsetU,dst->GetRowSize(PLANAR_U));
memcpy(dst->GetWritePtr(PLANAR_V)+(dst_offsetV+dst->GetPitch(PLANAR_V)),
dst->GetWritePtr(PLANAR_V)+dst_offsetV,dst->GetRowSize(PLANAR_V));
}

return dst;
Expand Down

0 comments on commit fc18e76

Please sign in to comment.