[x264-devel] commit: Improve reference_invalid support (Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Thu Jul 22 09:18:17 CEST 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Wed Jul 21 17:40:14 2010 -0700| [62997d61611309c9e5ffe124a0b49ca55263fbaf] | committer: Jason Garrett-Glaser 

Improve reference_invalid support
Reference invalidation can now be used to invalidate multiple frames at a time, rather than being limited to one per encoder_encode call.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=62997d61611309c9e5ffe124a0b49ca55263fbaf
---

 common/common.h   |    1 -
 encoder/encoder.c |   14 ++++----------
 x264.h            |    2 +-
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/common/common.h b/common/common.h
index 69e7152..161f053 100644
--- a/common/common.h
+++ b/common/common.h
@@ -430,7 +430,6 @@ struct x264_t
     int             i_cpb_delay_lookahead;
 
     int             b_queued_intra_refresh;
-    int64_t         i_reference_invalidate_pts;
     int64_t         i_last_idr_pts;
 
     /* We use only one SPS and one PPS */
diff --git a/encoder/encoder.c b/encoder/encoder.c
index d72c9f8..ae82059 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -2230,7 +2230,10 @@ int x264_encoder_invalidate_reference( x264_t *h, int64_t pts )
         return -1;
     }
     h = h->thread[h->i_thread_phase];
-    h->i_reference_invalidate_pts = pts;
+    if( pts >= h->i_last_idr_pts )
+        for( int i = 0; h->frames.reference[i]; i++ )
+            if( pts <= h->frames.reference[i]->i_pts )
+                h->frames.reference[i]->b_corrupt = 1;
     return 0;
 }
 
@@ -2379,15 +2382,6 @@ int     x264_encoder_encode( x264_t *h,
             h->fenc->param->param_free( h->fenc->param );
     }
 
-    if( h->i_reference_invalidate_pts )
-    {
-        if( h->i_reference_invalidate_pts >= h->i_last_idr_pts )
-            for( int i = 0; h->frames.reference[i]; i++ )
-                if( h->i_reference_invalidate_pts <= h->frames.reference[i]->i_pts )
-                    h->frames.reference[i]->b_corrupt = 1;
-        h->i_reference_invalidate_pts = 0;
-    }
-
     if( !IS_X264_TYPE_I( h->fenc->i_type ) )
     {
         int valid_refs_left = 0;
diff --git a/x264.h b/x264.h
index 5710e64..683a024 100644
--- a/x264.h
+++ b/x264.h
@@ -744,7 +744,7 @@ void    x264_encoder_intra_refresh( x264_t * );
  *      In multi-pass encoding, if x264_encoder_invalidate_reference is called differently in each pass,
  *      behavior is undefined.
  *
- *      Should not be called during an x264_encoder_encode.
+ *      Should not be called during an x264_encoder_encode, but multiple calls can be made simultaneously.
  *
  *      Returns 0 on success, negative on failure. */
 int x264_encoder_invalidate_reference( x264_t *, int64_t pts );



More information about the x264-devel mailing list