From f17f7e03e67e7b6c95260dc0658a715903df72f2 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 1 Apr 2006 13:27:57 +0000 Subject: [PATCH] Fixed flipping in the avisynth prs filter, but still glitchy and crashing Originally committed to SVN as r280. --- avisynth_prs/draw_prs.cpp | 2 ++ prs/prs_video_frame.cpp | 28 ++++++++++++++++++++++------ prs/prs_video_frame.h | 3 +++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/avisynth_prs/draw_prs.cpp b/avisynth_prs/draw_prs.cpp index 2a8e8d61e..3dae0df8c 100644 --- a/avisynth_prs/draw_prs.cpp +++ b/avisynth_prs/draw_prs.cpp @@ -84,6 +84,8 @@ PVideoFrame __stdcall DrawPRS::GetFrame(int n, IScriptEnvironment* env) { frame.h = avsFrame->GetHeight(); frame.pitch = avsFrame->GetPitch(); frame.colorSpace = ColorSpace_RGB32; + frame.flipColors = true; + frame.flipVertical = true; // Draw into the frame file.DrawFrame(n,&frame); diff --git a/prs/prs_video_frame.cpp b/prs/prs_video_frame.cpp index 50fc88e84..69b10e817 100644 --- a/prs/prs_video_frame.cpp +++ b/prs/prs_video_frame.cpp @@ -61,6 +61,8 @@ PRSVideoFrame::PRSVideoFrame () { w = 0; h = 0; ownData = false; + flipColors = false; + flipVertical = false; } @@ -82,6 +84,11 @@ void PRSVideoFrame::Overlay(PRSVideoFrame *dstFrame,int x,int y,unsigned char al const unsigned char *src; unsigned char *dst; + // Flip? + bool flipVer = flipVertical != dstFrame->flipVertical; + bool flipCol = flipColors != dstFrame->flipColors; + if (flipCol) y = dstFrame->h - h - y; + // Get boundaries int srcBpp = 4; int dstBpp = 4; @@ -93,23 +100,32 @@ void PRSVideoFrame::Overlay(PRSVideoFrame *dstFrame,int x,int y,unsigned char al int rowLen = MID(0,w,dstFrame->w - x); // Values - unsigned char sc1,sc2,sc3,a,ia; + unsigned char sc1,sc2,sc3,a,ia,aux; unsigned char dc1,dc2,dc3,da; // Draw each row for (int j=0;jdata[0] + (j+dstStarty)*dstRowLen + x*dstBpp; + dst = (unsigned char *) dstFrame->data[0] + x*dstBpp; + if (flipCol) dst += (h-j-1+dstStarty)*dstRowLen; + else dst += (j+dstStarty)*dstRowLen; // Draw the row for (int i=0;i