Use bounding_box() instead of render_text() for speed.
authorCarl Hetherington <cth@carlh.net>
Fri, 20 Jan 2023 22:53:54 +0000 (23:53 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 27 Feb 2023 13:47:25 +0000 (14:47 +0100)
src/lib/analyse_subtitles_job.cc

index d222ad3b8b28d9a98b67f2ec9386155e3c3b431b..f140f13d1ee514873d98d08b195825f7e7252c3b 100644 (file)
@@ -112,10 +112,10 @@ AnalyseSubtitlesJob::analyse(PlayerText const& text, TextType type)
 
        /* We can provide dummy values for time and frame rate here as they are only used to calculate fades */
        dcp::Size const frame = _film->frame_size();
-       for (auto i: render_text(text.string, frame, dcpomatic::DCPTime(), 24)) {
+       for (auto i: bounding_box(text.string, frame)) {
                dcpomatic::Rect<double> rect (
-                       double(i.position.x) / frame.width, double(i.position.y) / frame.height,
-                       double(i.image->size().width) / frame.width, double(i.image->size().height) / frame.height
+                       double(i.x) / frame.width, double(i.y) / frame.height,
+                       double(i.width) / frame.width, double(i.height) / frame.height
                        );
                if (!_bounding_box) {
                        _bounding_box = rect;