[x264-devel] commit: Implement direct temporal + interlaced (Jason Garrett-Glaser )

git version control git at videolan.org
Mon Feb 15 10:10:45 CET 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Fri Feb 12 03:33:54 2010 -0800| [58fd85453ec62d829663887b960ff7f2fbbc22d1] | committer: Jason Garrett-Glaser 

Implement direct temporal + interlaced
This was much easier than I expected.
It will also be basically useless until TFF/BFF support gets in, since it requires delta_poc_bottom to be set correctly to work well.

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

 common/common.h     |    5 +++--
 common/macroblock.c |    8 ++++----
 encoder/encoder.c   |    5 -----
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/common/common.h b/common/common.h
index 8b1b05a..e2e8fac 100644
--- a/common/common.h
+++ b/common/common.h
@@ -654,11 +654,12 @@ struct x264_t
         int     i_chroma_lambda2_offset;
 
         /* B_direct and weighted prediction */
-        int16_t dist_scale_factor[16][2];
+        int16_t dist_scale_factor_buf[2][16][2];
+        int16_t (*dist_scale_factor)[2];
         int8_t bipred_weight_buf[2][32][4];
         int8_t (*bipred_weight)[4];
         /* maps fref1[0]'s ref indices into the current list0 */
-#define map_col_to_list0(col) h->mb.map_col_to_list0[col+2]
+#define map_col_to_list0(col) h->mb.map_col_to_list0[(col)+2]
         int8_t  map_col_to_list0[18];
         int ref_blind_dupe; /* The index of the blind reference frame duplicate. */
     } mb;
diff --git a/common/macroblock.c b/common/macroblock.c
index 10f09ac..cc9a3fd 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -190,7 +190,8 @@ static int x264_mb_predict_mv_direct16x16_temporal( x264_t *h )
         const int x8 = i8%2;
         const int y8 = i8/2;
         const int i_part_8x8 = i_mb_8x8 + x8 + y8 * h->mb.i_b8_stride;
-        const int i_ref = map_col_to_list0(h->fref1[0]->ref[0][i_part_8x8]);
+        const int i_ref1_ref = h->fref1[0]->ref[0][i_part_8x8];
+        const int i_ref = (map_col_to_list0(i_ref1_ref>>h->sh.b_mbaff) << h->sh.b_mbaff) + (i_ref1_ref&h->sh.b_mbaff);
 
         if( i_ref >= 0 )
         {
@@ -1238,6 +1239,7 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
         if( h->sh.i_type == SLICE_TYPE_B )
         {
             h->mb.bipred_weight = h->mb.bipred_weight_buf[h->mb.b_interlaced&(i_mb_y&1)];
+            h->mb.dist_scale_factor = h->mb.dist_scale_factor_buf[h->mb.b_interlaced&(i_mb_y&1)];
             if( h->param.b_cabac )
             {
                 uint8_t skipbp;
@@ -1477,9 +1479,7 @@ void x264_macroblock_bipred_init( x264_t *h )
                     dist_scale_factor = x264_clip3( (tb * tx + 32) >> 6, -1024, 1023 );
                 }
 
-                // FIXME: will need this if we ever do temporal MV pred with interlaced
-                if( !h->sh.b_mbaff )
-                    h->mb.dist_scale_factor[i_ref0][i_ref1] = dist_scale_factor;
+                h->mb.dist_scale_factor_buf[field][i_ref0][i_ref1] = dist_scale_factor;
 
                 dist_scale_factor >>= 2;
                 if( h->param.analyse.b_weighted_bipred
diff --git a/encoder/encoder.c b/encoder/encoder.c
index d43a758..9efe88a 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -430,11 +430,6 @@ static int x264_validate_parameters( x264_t *h )
             x264_log( h, X264_LOG_WARNING, "interlace + me=esa is not implemented\n" );
             h->param.analyse.i_me_method = X264_ME_UMH;
         }
-        if( h->param.analyse.i_direct_mv_pred > X264_DIRECT_PRED_SPATIAL )
-        {
-            x264_log( h, X264_LOG_WARNING, "interlace + direct=temporal is not implemented\n" );
-            h->param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL;
-        }
         if( h->param.analyse.i_weighted_pred > 0 )
         {
             x264_log( h, X264_LOG_WARNING, "interlace + weightp is not implemented\n" );



More information about the x264-devel mailing list