WIP: time simple video view. benchmark
authorCarl Hetherington <cth@carlh.net>
Wed, 28 Oct 2020 21:11:17 +0000 (22:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 28 Oct 2020 21:11:17 +0000 (22:11 +0100)
run/dcpomatic_player
src/lib/j2k_image_proxy.cc
src/wx/simple_video_view.cc

index 9dc1954cf2736b67f60e177d7fc43e84e6ca62da..9de29a70246244692b92064426f126b1594b7778 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 export LD_LIBRARY_PATH=build/src/lib:build/src/wx:build/src/asdcplib/src:/home/c.hetherington/lib:$LD_LIBRARY_PATH
-export DYLD_LIBRARY_PATH=build/src/lib:build/src/wx:build/src/asdcplib/src:/Users/c.hetherington/osx-environment/64/lib
+export DYLD_LIBRARY_PATH=build/src/lib:build/src/wx:build/src/asdcplib/src:/Users/carl/osx-environment/64/lib
 export DCPOMATIC_GRAPHICS=graphics
 if [ "$1" == "--debug" ]; then
     shift
index 08ebc343c26ce7cf8e9407582d215f80f2914e0b..80646c934dcc6d2b4f657a36adc729ea4e043a51 100644 (file)
@@ -144,16 +144,32 @@ J2KImageProxy::prepare (optional<dcp::Size> target_size) const
        }
 
        try {
-               shared_ptr<dcp::OpenJPEGImage> decompressed = dcp::decompress_j2k (const_cast<uint8_t*> (_data.data().get()), _data.size (), reduce);
+               // shared_ptr<dcp::OpenJPEGImage> decompressed = dcp::decompress_j2k (const_cast<uint8_t*> (_data.data().get()), _data.size (), reduce);
+               shared_ptr<dcp::OpenJPEGImage> decompressed (new dcp::OpenJPEGImage(dcp::Size(999, 540)));
                _image.reset (new Image (_pixel_format, decompressed->size(), true));
+               int const width = decompressed->size().width;
 
-               int const shift = 16 - decompressed->precision (0);
+               {
+                       int p = 0;
+                       int* decomp_0 = decompressed->data (0);
+                       int* decomp_1 = decompressed->data (1);
+                       int* decomp_2 = decompressed->data (2);
+                       for (int y = 0; y < decompressed->size().height; ++y) {
+                               for (int x = 0; x < width; ++x) {
+                                       decomp_0[p] = 65535;
+                                       decomp_1[p] = 0;
+                                       decomp_2[p] = 0;
+                                       ++p;
+                               }
+                       }
+               }
+               int const shift = 1;//16 - decompressed->precision (0);
+               // int const shift = 16 - decompressed->precision (0);
 
                /* Copy data in whatever format (sRGB or XYZ) into our Image; I'm assuming
                   the data is 12-bit either way.
                   */
 
-               int const width = decompressed->size().width;
 
                int p = 0;
                int* decomp_0 = decompressed->data (0);
index 97e582ce7fcd4cad8c848e509d67152bf12710fd..d873eabbe4607fee6669101ebf7670085b8efb6f 100644 (file)
@@ -60,12 +60,13 @@ SimpleVideoView::SimpleVideoView (FilmViewer* viewer, wxWindow* parent)
 void
 SimpleVideoView::paint ()
 {
-        _state_timer.set("paint-panel");
+        _state_timer.set("paint-panel-part1");
        wxPaintDC dc (_panel);
 
        dcp::Size const out_size = _viewer->out_size ();
        wxSize const panel_size = _panel->GetSize ();
 
+        _state_timer.set("paint-panel-part2");
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        if (_viewer->background_image()) {
                dc.Clear ();
@@ -83,10 +84,13 @@ SimpleVideoView::paint ()
                dc.Clear ();
        } else {
 
+        _state_timer.set("paint-panel-part3");
                wxImage frame (out_size.width, out_size.height, _image->data()[0], true);
+        _state_timer.set("paint-panel-part4");
                wxBitmap frame_bitmap (frame);
+        _state_timer.set("paint-panel-part5");
                dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2));
-
+        _state_timer.set("paint-panel-part6");
 #ifdef DCPOMATIC_VARIANT_SWAROOP
                DCPTime const period = DCPTime::from_seconds(Config::instance()->player_watermark_period() * 60);
                int64_t n = position().get() / period.get();
@@ -109,6 +113,8 @@ SimpleVideoView::paint ()
 #endif
        }
 
+        _state_timer.set("paint-panel-part7");
+
        if (out_size.width < panel_size.GetWidth()) {
                /* XXX: these colours are right for GNOME; may need adjusting for other OS */
                wxPen   p (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));