shithub: libvpx

Download patch

ref: bba710fcbd1d815f65e8effb135cd5afe6330824
parent: a917afabbb94e12da1107fda7edc52b174532304
author: Yaowu Xu <yaowu@google.com>
date: Thu Nov 17 13:31:00 EST 2011

added transform type to MB_MODE_INFO

this commit is to add an variable in the macroblock level mode
info structure to track the transform size used in each MB, so
the information can be used later in the loop filter to change
how loop filter works on MBs with different transform sizes.

Change-Id: Id0eeaba6cc854c6d1be00ed8d237b3d9e250e447

--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -180,6 +180,9 @@
 {
     MB_PREDICTION_MODE mode, uv_mode;
     MV_REFERENCE_FRAME ref_frame;
+#if CONFIG_T8X8
+    TX_SIZE txfm_size;
+#endif
     int_mv mv;
     unsigned char partitioning;
     unsigned char mb_skip_coeff;                                /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -210,9 +210,10 @@
     int i;
 
 #if CONFIG_T8X8
-    int tx_type = get_seg_tx_type(xd, xd->mode_info_context->mbmi.segment_id);
+    int tx_type = get_seg_tx_type( xd,
+                                  xd->mode_info_context->mbmi.segment_id);
+    xd->mode_info_context->mbmi.txfm_size = tx_type;
 #endif
-
 
     if (xd->mode_info_context->mbmi.mb_skip_coeff)
     {
--- a/vp8/encoder/encodeintra.c
+++ b/vp8/encoder/encodeintra.c
@@ -100,6 +100,7 @@
 #if CONFIG_T8X8
     int tx_type = get_seg_tx_type(&x->e_mbd,
                                   x->e_mbd.mode_info_context->mbmi.segment_id);
+    x->e_mbd.mode_info_context->mbmi.txfm_size = tx_type;
 #endif
 
     RECON_INVOKE(&rtcd->common->recon, build_intra_predictors_mby)(&x->e_mbd);
@@ -178,6 +179,7 @@
 #if CONFIG_T8X8
     int tx_type = get_seg_tx_type(&x->e_mbd,
                                   x->e_mbd.mode_info_context->mbmi.segment_id);
+    x->e_mbd.mode_info_context->mbmi.txfm_size = tx_type;
 #endif
 
     RECON_INVOKE(&rtcd->common->recon, build_intra_predictors_mbuv)(&x->e_mbd);
--- a/vp8/encoder/encodemb.c
+++ b/vp8/encoder/encodemb.c
@@ -1277,6 +1277,7 @@
 #if CONFIG_T8X8
     int tx_type = get_seg_tx_type(&x->e_mbd,
                                   x->e_mbd.mode_info_context->mbmi.segment_id);
+    x->e_mbd.mode_info_context->mbmi.txfm_size = tx_type;
 #endif
 
     vp8_build_inter_predictors_mb(&x->e_mbd);
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -476,18 +476,8 @@
             // Where relevant assume segment data is delta data
             xd->mb_segement_abs_delta = SEGMENT_DELTADATA;
 
-#if CONFIG_T8X8
-            // 8x8TX test code.
-            // This assignment does not necessarily make sense but is
-            // just to test the mechanism for now.
-            enable_segfeature(xd, 0, SEG_LVL_TRANSFORM);
-            set_segdata( xd, 0, SEG_LVL_TRANSFORM, TX_4X4 );
-            enable_segfeature(xd, 1, SEG_LVL_TRANSFORM);
-            set_segdata( xd, 1, SEG_LVL_TRANSFORM, TX_8X8 );
-#endif
         }
     }
-
     // All other frames if segmentation has been enabled
     else if ( xd->segmentation_enabled )
     {
@@ -586,6 +576,25 @@
             // No updeates.. leave things as they are.
             xd->update_mb_segmentation_map = 0;
             xd->update_mb_segmentation_data = 0;
+
+#if CONFIG_T8X8
+            {
+                vp8_disable_segmentation((VP8_PTR)cpi);
+                clearall_segfeatures(xd);
+                vp8_enable_segmentation((VP8_PTR)cpi);
+                // 8x8TX test code.
+                // This assignment does not necessarily make sense but is
+                // just to test the mechanism for now.
+                enable_segfeature(xd, 0, SEG_LVL_TRANSFORM);
+                set_segdata( xd, 0, SEG_LVL_TRANSFORM, TX_4X4 );
+                enable_segfeature(xd, 1, SEG_LVL_TRANSFORM);
+                set_segdata( xd, 1, SEG_LVL_TRANSFORM, TX_8X8 );
+                /* force every mb to use 8x8 transform for testing*/
+                vpx_memset(cpi->segmentation_map, 1,
+                    cpi->common.mb_rows * cpi->common.mb_cols);
+
+            }
+#endif
         }
     }
 }
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -457,7 +457,7 @@
     int has_y2_block;
     int skip = 1;
     int i = 0;
- 
+
     has_y2_block = (x->mode_info_context->mbmi.mode != B_PRED
                     && x->mode_info_context->mbmi.mode != SPLITMV);
     if (has_y2_block)
--