mirror of https://github.com/odrling/Aegisub
Some fix to VFR... maybe...
Originally committed to SVN as r299.
This commit is contained in:
parent
72299b508c
commit
a42321a7d9
|
@ -457,8 +457,12 @@ std::vector<int> PRSSubtitleFormat::GetFrameRanges() {
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Optimize the image by tweaking the colors
|
// 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))
|
#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) {
|
void PRSSubtitleFormat::OptimizeImage(wxImage &image) {
|
||||||
// Get the raw data
|
// Get the raw data
|
||||||
unsigned char *data = (unsigned char*) image.GetData();
|
unsigned char *data = (unsigned char*) image.GetData();
|
||||||
|
|
|
@ -279,8 +279,9 @@ int FrameRate::PFrameAtTime(int ms,bool useceil) {
|
||||||
else if (FrameRateType == VFR) {
|
else if (FrameRateType == VFR) {
|
||||||
// Get last
|
// Get last
|
||||||
double trueLast;
|
double trueLast;
|
||||||
if (useceil) trueLast = ceil(last_time);
|
//if (useceil) trueLast = ceil(last_time);
|
||||||
else trueLast = floor(last_time);
|
//else trueLast = floor(last_time);
|
||||||
|
trueLast = Frame[Frame.size()-1];
|
||||||
|
|
||||||
// Inside VFR range
|
// Inside VFR range
|
||||||
if (ms < trueLast) {
|
if (ms < trueLast) {
|
||||||
|
|
|
@ -150,8 +150,8 @@ void VideoDisplay::SetVideo(const wxString &filename) {
|
||||||
// Unload video
|
// Unload video
|
||||||
delete provider;
|
delete provider;
|
||||||
provider = NULL;
|
provider = NULL;
|
||||||
if (VFR_Output.GetFrameRateType() == VFR) VFR_Output.Unload();
|
//if (VFR_Output.GetFrameRateType() == VFR) VFR_Output.Unload();
|
||||||
VFR_Input.Unload();
|
//VFR_Input.Unload();
|
||||||
videoName = _T("");
|
videoName = _T("");
|
||||||
loaded = false;
|
loaded = false;
|
||||||
frame_n = 0;
|
frame_n = 0;
|
||||||
|
|
Loading…
Reference in New Issue