From a42321a7d91080a4314072c290e762b573423b75 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 4 Apr 2006 13:22:45 +0000 Subject: [PATCH] Some fix to VFR... maybe... Originally committed to SVN as r299. --- core/subtitle_format_prs.cpp | 4 ++++ core/vfr.cpp | 5 +++-- core/video_display.cpp | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/subtitle_format_prs.cpp b/core/subtitle_format_prs.cpp index 30aae8d40..0ce01f705 100644 --- a/core/subtitle_format_prs.cpp +++ b/core/subtitle_format_prs.cpp @@ -457,8 +457,12 @@ std::vector PRSSubtitleFormat::GetFrameRanges() { ///////////////////////////////////////////// // Optimize the image by tweaking the colors +// First, a little macro to help the comparisons down there #define IN_ERROR_MARGIN(col1,col2,error) ((col1 > col2 ? ((int)(col1-col2)) : ((int)(col2-col1))) <= (error)) +// Now, since I don't expect anyone to be able to decypher this... +// This "flood fills" the image based on alpha, to make it easier to compress, without affecting visual quality +// e.g. if you have a pixel with 25% opacity, then a difference of as much as 3 in the color channels won't have a visual impact void PRSSubtitleFormat::OptimizeImage(wxImage &image) { // Get the raw data unsigned char *data = (unsigned char*) image.GetData(); diff --git a/core/vfr.cpp b/core/vfr.cpp index 8c2473cf1..ba71bd9e0 100644 --- a/core/vfr.cpp +++ b/core/vfr.cpp @@ -279,8 +279,9 @@ int FrameRate::PFrameAtTime(int ms,bool useceil) { else if (FrameRateType == VFR) { // Get last double trueLast; - if (useceil) trueLast = ceil(last_time); - else trueLast = floor(last_time); + //if (useceil) trueLast = ceil(last_time); + //else trueLast = floor(last_time); + trueLast = Frame[Frame.size()-1]; // Inside VFR range if (ms < trueLast) { diff --git a/core/video_display.cpp b/core/video_display.cpp index f4999566f..ede352b44 100644 --- a/core/video_display.cpp +++ b/core/video_display.cpp @@ -150,8 +150,8 @@ void VideoDisplay::SetVideo(const wxString &filename) { // Unload video delete provider; provider = NULL; - if (VFR_Output.GetFrameRateType() == VFR) VFR_Output.Unload(); - VFR_Input.Unload(); + //if (VFR_Output.GetFrameRateType() == VFR) VFR_Output.Unload(); + //VFR_Input.Unload(); videoName = _T(""); loaded = false; frame_n = 0;