summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-08-12 23:41:33 +0200
committerCarl Hetherington <cth@carlh.net>2020-09-13 20:22:44 +0200
commitdbb5577ff761cfd25f154fc54c2dc7e111a31c77 (patch)
treecf9e1184ebe36a63f6906628ca879a6436f68e5d /src/lib
parentda93921d843b8eb9c3d0d77a7a7d629beb5d1f86 (diff)
Magic value DecodePasses=22 makes worst case decode times much less, can play BT@ER with ~3 dropped frames.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cpu_player_video_preparer.cc2
-rw-r--r--src/lib/fastvideo_player_video_preparer.cc18
2 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/cpu_player_video_preparer.cc b/src/lib/cpu_player_video_preparer.cc
index 0891189b3..adddfd866 100644
--- a/src/lib/cpu_player_video_preparer.cc
+++ b/src/lib/cpu_player_video_preparer.cc
@@ -43,7 +43,7 @@ try
LOG_TIMING("start-prepare in %1", thread_id());
video->prepare (_pixel_format, _aligned, _fast);
LOG_TIMING("finish-prepare in %1", thread_id());
- timestamped_printf("cpu finishes %d\n", video->time.frames_round(24));
+ //timestamped_printf("cpu finishes %d\n", video->time.frames_round(24));
}
}
catch (...)
diff --git a/src/lib/fastvideo_player_video_preparer.cc b/src/lib/fastvideo_player_video_preparer.cc
index 6e092c060..13b78bfad 100644
--- a/src/lib/fastvideo_player_video_preparer.cc
+++ b/src/lib/fastvideo_player_video_preparer.cc
@@ -108,18 +108,15 @@ FastvideoPlayerVideoPreparer::send_to_gpu (shared_ptr<PlayerVideo> pv, shared_pt
_setup_done = true;
}
- //std::cout << "add to batch.\n";
- timestamped_printf("fv sends %d to gpu\n", pv->time.frames_round(24));
+ //timestamped_printf("fv sends %d to gpu\n", pv->time.frames_round(24));
fastDecoderJ2kAddImageToBatch(_decoder, proxy->j2k().data().get(), proxy->j2k().size());
_batch.push_back (pv);
int free_slots = 0;
fastDecoderJ2kFreeSlotsInBatch(_decoder, &free_slots);
- timestamped_printf("now %d slots left.\n", free_slots);
- //std::cout << free_slots << " left in batch.\n";
if (free_slots == 0) {
/* Do some decoding */
- timestamped_printf("tx & extract\n");
+ PeriodTimer pt("tx/extract");
transform_and_extract ();
}
@@ -130,6 +127,7 @@ FastvideoPlayerVideoPreparer::send_to_gpu (shared_ptr<PlayerVideo> pv, shared_pt
void
FastvideoPlayerVideoPreparer::transform_and_extract ()
{
+ StateTimer st("transform_and_extract", "tx");
fastDecoderJ2kReport_t report;
fastStatus_t r = fastDecoderJ2kTransformBatch(_decoder, &report);
if (r != FAST_OK) {
@@ -142,8 +140,7 @@ FastvideoPlayerVideoPreparer::transform_and_extract ()
DCPOMATIC_ASSERT (index <= _batch.size());
shared_ptr<PlayerVideo> pv = _batch[index].lock();
if (pv) {
- //std::cout << "got a pv for batch number " << index << "\n";
- /* XXX: this should be memlocked or whatever fastMalloc does */
+ st.set("copy gpu -> host");
shared_ptr<J2KImageProxy> proxy = const_pointer_cast<J2KImageProxy>(dynamic_pointer_cast<const J2KImageProxy>(pv->image_proxy()));
DCPOMATIC_ASSERT (proxy);
fastExportParameters_t export_parameters;
@@ -153,7 +150,9 @@ FastvideoPlayerVideoPreparer::transform_and_extract ()
if (r != FAST_OK) {
throw FastvideoError ("ExportToHostCopy", r);
}
+ //timestamped_printf("fv copies _decoded to Image\n");
+ st.set("convert to Image");
shared_ptr<dcpomatic::Image> image(new dcpomatic::Image(AV_PIX_FMT_XYZ12LE, size, true));
uint8_t* from = reinterpret_cast<uint8_t*>(_decoded);
uint16_t* to = reinterpret_cast<uint16_t*>(image->data()[0]);
@@ -169,7 +168,7 @@ FastvideoPlayerVideoPreparer::transform_and_extract ()
to += image->stride()[0] / 2;
}
- timestamped_printf("fv sets image for %d\n", pv->time.frames_round(24));
+ //timestamped_printf("fv sets image for %d\n", pv->time.frames_round(24));
proxy->set_image (image);
_cpu.request (pv);
@@ -178,6 +177,7 @@ FastvideoPlayerVideoPreparer::transform_and_extract ()
if (images_left == 0) {
break;
}
+ st.set("get next");
fastStatus_t r = fastDecoderJ2kGetNextDecodedImage(_decoder, &report, &images_left);
if (r != FAST_OK) {
throw FastvideoError ("DecoderJ2kGetNextDecodedImage", r);
@@ -218,7 +218,7 @@ FastvideoPlayerVideoPreparer::setup (dcp::Data sample)
parameters.truncationMode = 0;
parameters.truncationRate = 0;
- parameters.DecodePasses = 0;
+ parameters.DecodePasses = 22;
parameters.imageInfo = &info;
parameters.maxStreamSize = max_stream_size;