Cortado yuv thread patch

"Benjamin M. Schwartz" <[email protected]>
Newsgroups gmane.comp.multimedia.ogg.theora.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The attached patch splits Theora decode and YUV2RGB into separate threads.
 These are by far the two most computationally demanding components of
Cortado, so by splitting them we can substantially improve performance on
multiprocessor machines.  I have verified that the patch does split these
into two threads, and performance does appear to improve.

I cannot test this patch properly right now for things like its effect on
sync.  Please apply and experiment.

- --Ben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkriFeIACgkQUJT6e6HFtqQzCACeM4qndVjtLHR6mjIx4ta2KgCT
ql0AnRRpLGX5bT02P27nX1R+frYAKyi7
=vJFR
-----END PGP SIGNATURE-----

_______________________________________________
theora-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/theora-dev
cortado_yuv_thread.diff (text/plain, 2.2 KB)
diff --git a/src/com/fluendo/player/CortadoPipeline.java b/src/com/fluendo/player/CortadoPipeline.java
index bc55b10..47a108f 100644
--- a/src/com/fluendo/player/CortadoPipeline.java
+++ b/src/com/fluendo/player/CortadoPipeline.java
@@ -48,7 +48,7 @@ public class CortadoPipeline extends Pipeline implements PadListener, CapsListen
   private Element audiodec;
   private Element videosink;
   private Element audiosink;
-  private Element v_queue, a_queue;
+  private Element v_queue, v_queue2, a_queue;
   private Element overlay;
   private Pad asinkpad, ovsinkpad, oksinkpad;
   private Pad apad, vpad;
@@ -109,7 +109,10 @@ public class CortadoPipeline extends Pipeline implements PadListener, CapsListen
       a_queue.setState (PAUSE);
     }
     else if (enableVideo && mime.equals("video/x-theora")) {
+      // Constructs a chain of the form
+      // oggdemux -> v_queue -> theoradec -> v_queue2 -> videosink
       v_queue = ElementFactory.makeByName("queue", "v_queue");
+      v_queue2 = ElementFactory.makeByName("queue", "v_queue2");
       if (v_queue == null) {
         noSuchElement ("queue");
 	    return;
@@ -119,10 +122,12 @@ public class CortadoPipeline extends Pipeline implements PadListener, CapsListen
         return;
 
       add(v_queue);
+      add(v_queue2);
 
       pad.link(v_queue.getPad("sink"));
       v_queue.getPad("src").link(videodec.getPad("sink"));
-      if (!videodec.getPad("src").link(ovsinkpad)) {
+      videodec.getPad("src").link(v_queue2.getPad("sink"));
+      if (!v_queue2.getPad("src").link(ovsinkpad)) {
         postMessage (Message.newError (this, "videosink already linked"));
         return;
       }
@@ -131,6 +136,7 @@ public class CortadoPipeline extends Pipeline implements PadListener, CapsListen
 
       videodec.setState (PAUSE);
       v_queue.setState (PAUSE);
+      v_queue2.setState (PAUSE);
     }
     else if (enableVideo && mime.equals("image/jpeg")) {
       if (!setupVideoDec ("jpegdec")) {
@@ -668,6 +674,10 @@ public class CortadoPipeline extends Pipeline implements PadListener, CapsListen
       remove (v_queue);
       v_queue = null;
     }
+    if (v_queue2 != null) {
+      remove (v_queue2);
+      v_queue2 = null;
+    }
     if (a_queue != null) {
       remove (a_queue);
       a_queue = null;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.