From: David Flynn <[email protected]>

Previously, when pushing picture data into the decoder, there is an
assertion that an output_picture is avaliable from the output_queue.
This patch modifies the behaviour to nolonger execute the final
combining picture decoding stage unless it has an output picture.
The api state machine now requests a picture if any picture in the
processing queue is missing an output_picture (and the queue is empty).

Signed-off-by: David Flynn <[email protected]>
---
 schroedinger/schrodecoder.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/schroedinger/schrodecoder.c b/schroedinger/schrodecoder.c
index bcd3e1e..bb20164 100644
--- a/schroedinger/schrodecoder.c
+++ b/schroedinger/schrodecoder.c
@@ -588,7 +588,12 @@ schro_decoder_get_status_locked (SchroDecoder *decoder)
   }
   if (decoder->have_sequence_header &&
       schro_queue_is_empty (decoder->output_queue)) {
-    return SCHRO_DECODER_NEED_FRAME;
+    int i;
+    for(i=0;i<decoder->picture_queue->n;i++){
+      SchroPicture *picture = decoder->picture_queue->elements[i].data;
+      if (!picture->output_picture)
+        return SCHRO_DECODER_NEED_FRAME;
+    }
   }
   if (!schro_queue_is_full (decoder->picture_queue) && !decoder->flushing) {
     return SCHRO_DECODER_NEED_BITS;
@@ -863,9 +868,6 @@ schro_decoder_iterate_picture (SchroDecoder *decoder, 
SchroBuffer *buffer, Schro
 
     picture->stages[SCHRO_DECODER_STAGE_DONE].is_done = TRUE;
     picture->stages[SCHRO_DECODER_STAGE_DONE].is_needed = TRUE;
-  } else {
-    picture->output_picture = schro_queue_pull (decoder->output_queue);
-    SCHRO_ASSERT(picture->output_picture);
   }
 
   schro_async_lock (decoder->async);
@@ -1069,8 +1071,14 @@ schro_decoder_async_schedule (SchroDecoder *decoder,
     } else if (TODO(SCHRO_DECODER_STAGE_COMBINE) &&
         picture->stages[SCHRO_DECODER_STAGE_WAVELET_TRANSFORM].is_done &&
         picture->stages[SCHRO_DECODER_STAGE_MOTION_RENDER].is_done && 
render_ok) {
-      func = schro_decoder_x_combine;
-      stage = SCHRO_DECODER_STAGE_COMBINE;
+      if (!picture->output_picture) {
+        /* NB, there may not be anything in the output_queue */
+        picture->output_picture = schro_queue_pull (decoder->output_queue);
+      }
+      if (picture->output_picture) {
+        func = schro_decoder_x_combine;
+        stage = SCHRO_DECODER_STAGE_COMBINE;
+      }
     }
 
     if (func) {
-- 
1.5.6.5


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Schrodinger-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/schrodinger-devel

Reply via email to