Skip to content

Commit

Permalink
theoradec: Set telemetry options only if they are nonzero
Browse files Browse the repository at this point in the history
Setting telemetry options, even to zero, causes libtheora to enable an expensive code path. For large enough videos (e.g. 1920x1080) this can increase the time to decode each frame by 30-40 ms, which can be enough to cause noticeable stutter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/892>
  • Loading branch information
zfigura authored and GStreamer Merge Bot committed Oct 22, 2020
1 parent 4972041 commit 18d3b67
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ext/theora/gsttheoradec.c
Expand Up @@ -471,19 +471,23 @@ theora_handle_type_packet (GstTheoraDec * dec)
/* done */
dec->decoder = th_decode_alloc (&dec->info, dec->setup);

if (th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_MV,
if (dec->telemetry_mv &&
th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_MV,
&dec->telemetry_mv, sizeof (dec->telemetry_mv)) != TH_EIMPL) {
GST_WARNING_OBJECT (dec, "Could not enable MV visualisation");
}
if (th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_MBMODE,
if (dec->telemetry_mbmode &&
th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_MBMODE,
&dec->telemetry_mbmode, sizeof (dec->telemetry_mbmode)) != TH_EIMPL) {
GST_WARNING_OBJECT (dec, "Could not enable MB mode visualisation");
}
if (th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_QI,
if (dec->telemetry_qi &&
th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_QI,
&dec->telemetry_qi, sizeof (dec->telemetry_qi)) != TH_EIMPL) {
GST_WARNING_OBJECT (dec, "Could not enable QI mode visualisation");
}
if (th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_BITS,
if (dec->telemetry_bits &&
th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_BITS,
&dec->telemetry_bits, sizeof (dec->telemetry_bits)) != TH_EIMPL) {
GST_WARNING_OBJECT (dec, "Could not enable BITS mode visualisation");
}
Expand Down

0 comments on commit 18d3b67

Please sign in to comment.