Commit Graph

76 Commits

Author SHA1 Message Date
Thomas Goyne 6fad60e58d Use NSDMIs where applicable 2013-12-11 18:50:12 -08:00
Thomas Goyne a7f4fb5b87 Run clang-modernize on things 2013-11-23 09:57:22 -08:00
Thomas Goyne 01a38a5e86 Use more make_unique
Shuts up a bunch of Coverity false-positives and might fix a true
positive or two.
2013-10-23 17:08:12 -07:00
Thomas Goyne 2fdbc73721 Fully extract the resolution resampling logic from DialogResample 2013-07-09 08:35:50 -07:00
Thomas Goyne ce23d72399 Kill AssDialogue::GetMarginString
It didn't actually make the calling code any shorter or simpler.
2013-07-09 08:35:50 -07:00
Thomas Goyne bb83193253 Kill AssDialogue::SetMarginString
It's no longer used anywhere.
2013-07-09 08:35:50 -07:00
Thomas Goyne 1e0f08c0ed Mostly purge wxWidgets from non-UI stuff
Use boost::filesystem::path for all paths, and std::string for all other
strings, converting to/from wxString as close to the actual uses of wx
as possible.

Where possible, replace the uses of non-UI wxWidgets functionality with
the additions to the standard library in C++11, or the equivalents in
boost.

Move the path token management logic to libaegisub (and rewrite it in
the process).

Add a basic thread pool based on asio and std::thread to libaegisub.

This touches nearly every file in the project and a nontrivial amount of
code had to be rewritten entirely, so there's probably a lot of broken
stuff.
2013-02-06 13:22:15 -08:00
Thomas Goyne cbbcc35e4f Remove some pointless initializers in AssDialogue's constructor 2013-01-17 14:03:48 -08:00
Thomas Goyne 9a36e5cfe1 Add a unique ID to dialogue lines
This is needed to track lines across undo, as the previous method of
using the row number was slow and broke on inserts/deletes.
2013-01-14 08:37:03 -08:00
Thomas Goyne 7bc79b2d9f Significantly speed up AssDialogue::GetData
wxString::Format is astonishingly slow, and while this normally doesn't
particularly matter, AssEntry::EntryData's speed can become relevant on
large files.

Switch to a slightly more manual approach that's about four times as
fast.
2013-01-09 16:48:32 -08:00
Thomas Goyne 8f765f3955 Add AssOverrideBlockComment
Nothing actually wants to treat comments as plain text, so using the
same type for both just makes things more complex.
2012-12-31 07:09:32 -08:00
Thomas Goyne d49758edbf De-wxify AssOverride 2012-12-31 07:09:31 -08:00
Thomas Goyne d0f4d9df99 Replace all uses of lagi_wxString with to_wx 2012-12-22 15:18:38 -08:00
Thomas Goyne 534f574a87 Delete AssDialogue::StripTag
It is not actually used anywhere.
2012-12-10 17:43:29 -08:00
Thomas Goyne 8c2062f0c7 Store AssOverrideTags directly rather than a vector of pointers 2012-12-10 17:04:18 -08:00
Thomas Goyne d2a0a76ca9 Store AssOverrideParameters directly rather than a vector of pointers to them 2012-12-09 10:12:50 -08:00
Thomas Goyne 9b44f92235 Make AssEntry purely a base class and add AssInfo
Now that all the other junk is being dropped from the file, script info
lines are the only thing left which was a concrete AssEntry, and
AssEntry wasn't actually a very good way to store them.
2012-12-07 18:55:29 -08:00
Thomas Goyne 28705000bb Use boost::join in a handful of places 2012-12-07 08:25:47 -08:00
Thomas Goyne d5aae26d83 Use boost::flyweight to intern the wxString members of AssDialogue
100 no-op non-amend commits on a subtitle file with 6689 dialogue lines,
with the undo limit set to 100:

Without flyweight:
	No video open:
		Initial memory usage: 30.6 MB
		Final memory usage: 498.0 MB
		Elapsed time: 6.3 seconds
	Video open, using libass:
		Initial memory usage: 54.3 MB
		Final memory usage: 653.3 MB
		Elapsed time: 23.7 seconds

With flyweight:
	No video open:
		Initial memory usage: 26.0 MB
		Final memory usage: 104.5 MB
		Elapsed time: 3.0 seconds
	Video open, using libass:
		Initial memory usage: 46.7 MB
		Final memory usage: 251.8 MB
		Elapsed time: 13.0 seconds

No video open:
	Memory usage: -79%
	Time: -52%
Video open:
	Memory usage: -61.5%
	Time: -45%

100 no-op amend commits on a line in the middle of a subtitle file with
6689 dialogue lines, with video open:

Without flyweight:
	Initial memory usage: 48.2 MB
	Final memory usage: 182.3 MB
	Elapsed time: 22.3 seconds

With flyweight:
	Initial memory usage: 39.8 MB
	Final memory usage: 165.8 MB
	Elapsed time: 13.8 seconds

Note: The large jump in memory usage here is due to that the benchmark
is blocking the main thread, so at the end there are ~100 video frames
waiting to be displayed.
2012-12-05 18:43:44 -08:00
Thomas Goyne c1ed667025 Add the curly braces in AssDialogueBlockOverride::GetText
All of the calling code added them, so there's no reason not to just do
it in one place.
2012-12-04 19:49:05 -08:00
Thomas Goyne 1c176e8568 Store parsed dialogue blocks in a ptr_vector
This eliminates the need to explicitly delete the parsed blocks.

Also go ahead and remove AssDialogue::Blocks since it's really not a
very good idea in general.
2012-12-02 12:29:33 -08:00
Thomas Goyne b507f49cec Remove the pad argument from GetMarginString
It's no longer ever actually set to true.
2012-12-02 07:59:31 -08:00
Thomas Goyne 96cf5ea7ed Kill the #ifndef AGI_PRE guards
They don't actually improve compilation performance and make it more
annoying to modify what things are in the precompiled header.
2012-12-02 06:33:29 -08:00
Thomas Goyne 4e8e5b597c Change AssEntry::group to an enum 2012-11-25 14:01:50 -08:00
Thomas Goyne bdf7a0ca83 Parse unclosed override blocks as plain text as VSFilter does 2012-11-24 10:04:53 -08:00
Thomas Goyne 67df64e879 Use range-based for loops in a bunch of places 2012-11-12 18:35:25 -08:00
Thomas Goyne 99a20e4d1c Move InvalidMarginIdError to ass_dialogue.h 2012-10-26 17:26:53 -07:00
Thomas Goyne e44c47c863 Remove $Id$ markers since git doesn't support them 2012-10-25 17:39:49 -07:00
Thomas Goyne ff6394c95e Throw only real exceptions from subtitle io stuff 2012-10-25 17:39:49 -07:00
Thomas Goyne c7fd04a739 Rename ASS -> Ass in symbol names
Most types and functions used Ass, but a decent number used ASS, so make
them consistent.
2012-10-16 09:52:19 -07:00
Thomas Goyne 53433426bb Fix some stuff from Coverity Scan
Mostly just bugs in unreachable code and stylistic things, but there's a
few incorrect reachable things that were working by coincidence and
gratuitous dynamic_casts.
2012-10-15 18:16:09 -07:00
Thomas Goyne a1fad1f947 Drop support for ASS2
It is very unlikely that anyone has ever actually used ASS2 for
anything, and in practice it was not usable anyway as the bottom margin
was always either ignored or blindly overwritten.
2012-10-12 14:54:08 -07:00
Thomas Goyne a0c92f83f9 Fix some PVS-Studio warnings 2012-10-12 14:51:30 -07:00
Thomas Goyne d49e59653f Add a version of ParseASSTags that returns the blocks rather than mutating the line
Originally committed to SVN as r6626.
2012-03-28 23:58:50 +00:00
Thomas Goyne b32515da80 Strip trailing whitespace from all cpp and h files
Originally committed to SVN as r6600.
2012-03-25 04:05:06 +00:00
Thomas Goyne 75ae053958 Make some stuff const
Originally committed to SVN as r6590.
2012-03-20 00:39:10 +00:00
Thomas Goyne 759b8433c1 Silence some clang warnings
Originally committed to SVN as r6558.
2012-03-10 02:16:08 +00:00
Thomas Goyne fae7261bd0 Make AssTime::ParseASS a constructor overload instead
Originally committed to SVN as r6468.
2012-02-14 00:35:06 +00:00
Thomas Goyne 3af57cdbcd Copy the source line's group in AssDialogue's copy constructor as copying wxStrings is far faster than constructing new ones
Originally committed to SVN as r6409.
2012-02-01 00:47:49 +00:00
Thomas Goyne c2d3c910c7 Replace some uses of "" with wxString()
Despite special-casing zero-length input, wxString("") takes over four
times as long as wxString() - and on a 10k line script, this change cuts
AssFile's copy constructor's runtime in half.

Originally committed to SVN as r6401.
2012-01-31 00:44:43 +00:00
Thomas Goyne 2bc43eb886 Fix use of uninitialized variable when setting margins to an empty string
Originally committed to SVN as r6322.
2012-01-20 05:14:56 +00:00
Thomas Goyne 9cfe230682 Remove unused 'parent' member from AssDialogueBlock and make 'text' protected
Originally committed to SVN as r6165.
2011-12-26 22:21:08 +00:00
Thomas Goyne 7b4759cc13 Parse {} as an empty override block rather than an empty comment
Originally committed to SVN as r6164.
2011-12-26 22:21:02 +00:00
Thomas Goyne 71345af81a Overload operator int() on AssTime and remove GetMS/SetMS
Originally committed to SVN as r6123.
2011-12-22 21:28:51 +00:00
Thomas Goyne d28c4c4d8b Kill AssEntry::Valid, as there wasn't actually any way to get a fully-constructed entry with it set to false
Originally committed to SVN as r6034.
2011-12-22 21:14:51 +00:00
Thomas Goyne 56e6f7d5b2 Move ASS -> SRT tag conversion to the SRT subtitle format from AssDialogue
Originally committed to SVN as r5911.
2011-11-25 19:28:19 +00:00
Thomas Goyne 0992a839cc Port new SRT parser from 2.1.9. Updates #1301.
Originally committed to SVN as r5910.
2011-11-25 19:27:51 +00:00
Thomas Goyne cc147d1660 Eliminate uses of c_str made unnecessary by changed to wxString::Format in wx 2.9
Originally committed to SVN as r5612.
2011-09-28 19:43:48 +00:00
Thomas Goyne d990bbbb99 Eliminate all unnecessary uses of L and _T
Originally committed to SVN as r5611.
2011-09-28 19:43:11 +00:00
Thomas Goyne 2a51ad837e Fix non-precompiled header compilation
Originally committed to SVN as r4723.
2010-08-02 22:14:11 +00:00