]> granicus.if.org Git - libvpx/commitdiff
Change to segment_feature_data[][] structure.
authorPaul Wilkins <paulwilkins@google.com>
Tue, 13 Sep 2011 11:58:04 +0000 (12:58 +0100)
committerPaul Wilkins <paulwilkins@google.com>
Tue, 13 Sep 2011 11:58:04 +0000 (12:58 +0100)
This data structure is  now [Segment ID][Features]
rather than [Features][Segment_ID]

I propose as a separate modification to make the experimental
bit stream reflect this such that all the features for a segment
are coded together.

Change-Id: I581e4e3ca2033bdbdef3d9300977a8202f55b4fb

vp8/common/blockd.h
vp8/common/loopfilter.c
vp8/decoder/decodframe.c
vp8/encoder/bitstream.c
vp8/encoder/onyx_int.h
vp8/encoder/picklpf.c
vp8/encoder/quantize.c

index 873c67467b5eac0e4415f2c72488125680667c2d..72f848c03436f80af576f047b8eb6276c310253a 100644 (file)
@@ -253,7 +253,7 @@ typedef struct MacroBlockD
 #endif
 
     // Segment features
-    signed char segment_feature_data[SEG_LVL_MAX][MAX_MB_SEGMENTS];
+    signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
 
     /* mode_based Loop filter adjustment */
     unsigned char mode_ref_lf_delta_enabled;
index b74521622cbac70b338d3dd2d6f96c5ace2f2aed..346a43560db01f8ef0f063ad75516a3912839a37 100644 (file)
@@ -221,11 +221,11 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm,
             /* Abs value */
             if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA)
             {
-                lvl_seg = mbd->segment_feature_data[SEG_LVL_ALT_LF][seg];
+                lvl_seg = mbd->segment_feature_data[seg][SEG_LVL_ALT_LF];
             }
             else  /* Delta Value */
             {
-                lvl_seg += mbd->segment_feature_data[SEG_LVL_ALT_LF][seg];
+                lvl_seg += mbd->segment_feature_data[seg][SEG_LVL_ALT_LF];
                 lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63: lvl_seg) : 0;
             }
         }
@@ -541,13 +541,13 @@ void vp8_loop_filter_partial_frame
         {    /* Abs value */
             if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA)
             {
-                lvl_seg[i] = mbd->segment_feature_data[SEG_LVL_ALT_LF][i];
+                lvl_seg[i] = mbd->segment_feature_data[i][SEG_LVL_ALT_LF];
             }
             /* Delta Value */
             else
             {
                 lvl_seg[i] = default_filt_lvl
-                        + mbd->segment_feature_data[SEG_LVL_ALT_LF][i];
+                        + mbd->segment_feature_data[i][SEG_LVL_ALT_LF];
                 lvl_seg[i] = (lvl_seg[i] > 0) ?
                         ((lvl_seg[i] > 63) ? 63: lvl_seg[i]) : 0;
             }
index 02ac80aabe08f7f5bcec86b64adbcb5a4515b0bf..4c98808592c94f412f0c74a72992dce2de94e433 100644 (file)
@@ -80,12 +80,13 @@ void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd)
     {
         /* Abs Value */
         if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
-            QIndex = xd->segment_feature_data[SEG_LVL_ALT_Q][mbmi->segment_id];
+            QIndex = xd->segment_feature_data[mbmi->segment_id][SEG_LVL_ALT_Q];
 
         /* Delta Value */
         else
         {
-            QIndex = pc->base_qindex + xd->segment_feature_data[SEG_LVL_ALT_Q][mbmi->segment_id];
+            QIndex = pc->base_qindex +
+                xd->segment_feature_data[mbmi->segment_id][SEG_LVL_ALT_Q];
             QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0;    /* Clamp to valid range */
         }
     }
@@ -946,13 +947,13 @@ int vp8_decode_frame(VP8D_COMP *pbi)
                     /* Frame level data */
                     if (vp8_read_bit(bc))
                     {
-                        xd->segment_feature_data[i][j] = (signed char)vp8_read_literal(bc, mb_feature_data_bits[i]);
+                        xd->segment_feature_data[j][i] = (signed char)vp8_read_literal(bc, mb_feature_data_bits[i]);
 
                         if (vp8_read_bit(bc))
-                            xd->segment_feature_data[i][j] = -xd->segment_feature_data[i][j];
+                            xd->segment_feature_data[j][i] = -xd->segment_feature_data[j][i];
                     }
                     else
-                        xd->segment_feature_data[i][j] = 0;
+                        xd->segment_feature_data[j][i] = 0;
                 }
             }
         }
index 7c4ec9a887d3baa88496957f89f878767518f44d..889f09e49ef09ebb634b9bbcf3f658298d8425f8 100644 (file)
@@ -1852,7 +1852,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
                 // For each of the segments
                 for (j = 0; j < MAX_MB_SEGMENTS; j++)
                 {
-                    Data = xd->segment_feature_data[i][j];
+                    Data = xd->segment_feature_data[j][i];
 
                     // Frame level data
                     if (Data)
index 403508bb09842cbefae22503094a0d3eea7b8b94..b01392c8edb49b8836a269acfe9ff219d86e191c 100644 (file)
@@ -478,7 +478,7 @@ typedef struct VP8_COMP
     unsigned char *segmentation_map;
 
     // Segment data (can be deltas or absolute values)
-    signed char segment_feature_data[SEG_LVL_MAX][MAX_MB_SEGMENTS];
+    signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
 
     // segment threashold for encode breakout
     int  segment_encode_breakout[MAX_MB_SEGMENTS];
index 3a6117f6f37d8b7aae51497a4996369f6977eb75..df8a2b2793deff3018ae6e24fcd539440bc8eaf3 100644 (file)
@@ -259,10 +259,10 @@ void vp8cx_set_alt_lf_level(VP8_COMP *cpi, int filt_val)
     MACROBLOCKD *mbd = &cpi->mb.e_mbd;
     (void) filt_val;
 
-    mbd->segment_feature_data[SEG_LVL_ALT_LF][0] = cpi->segment_feature_data[SEG_LVL_ALT_LF][0];
-    mbd->segment_feature_data[SEG_LVL_ALT_LF][1] = cpi->segment_feature_data[SEG_LVL_ALT_LF][1];
-    mbd->segment_feature_data[SEG_LVL_ALT_LF][2] = cpi->segment_feature_data[SEG_LVL_ALT_LF][2];
-    mbd->segment_feature_data[SEG_LVL_ALT_LF][3] = cpi->segment_feature_data[SEG_LVL_ALT_LF][3];
+    mbd->segment_feature_data[0][SEG_LVL_ALT_LF] = cpi->segment_feature_data[0][SEG_LVL_ALT_LF];
+    mbd->segment_feature_data[1][SEG_LVL_ALT_LF] = cpi->segment_feature_data[1][SEG_LVL_ALT_LF];
+    mbd->segment_feature_data[2][SEG_LVL_ALT_LF] = cpi->segment_feature_data[2[SEG_LVL_ALT_LF]];
+    mbd->segment_feature_data[3][SEG_LVL_ALT_LF] = cpi->segment_feature_data[3][SEG_LVL_ALT_LF];
 }
 
 void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
index 200d1ae0a144fa89ffd0fdcb08e6b2908f69b2ec..13009bb3f1b2f99d1abbf8463ba7c4accd4f8044 100644 (file)
@@ -1174,11 +1174,11 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
         // Abs Value
         if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
 
-            QIndex = xd->segment_feature_data[SEG_LVL_ALT_Q][xd->mode_info_context->mbmi.segment_id];
+            QIndex = xd->segment_feature_data[xd->mode_info_context->mbmi.segment_id][SEG_LVL_ALT_Q];
         // Delta Value
         else
         {
-            QIndex = cpi->common.base_qindex + xd->segment_feature_data[SEG_LVL_ALT_Q][xd->mode_info_context->mbmi.segment_id];
+            QIndex = cpi->common.base_qindex + xd->segment_feature_data[xd->mode_info_context->mbmi.segment_id][SEG_LVL_ALT_Q];
             QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0;    // Clamp to valid range
         }
     }
@@ -1316,10 +1316,10 @@ void vp8_set_quantizer(struct VP8_COMP *cpi, int Q)
 
 
     // Set Segment specific quatizers
-    mbd->segment_feature_data[SEG_LVL_ALT_Q][0] = cpi->segment_feature_data[SEG_LVL_ALT_Q][0];
-    mbd->segment_feature_data[SEG_LVL_ALT_Q][1] = cpi->segment_feature_data[SEG_LVL_ALT_Q][1];
-    mbd->segment_feature_data[SEG_LVL_ALT_Q][2] = cpi->segment_feature_data[SEG_LVL_ALT_Q][2];
-    mbd->segment_feature_data[SEG_LVL_ALT_Q][3] = cpi->segment_feature_data[SEG_LVL_ALT_Q][3];
+    mbd->segment_feature_data[0][SEG_LVL_ALT_Q] = cpi->segment_feature_data[0][SEG_LVL_ALT_Q];
+    mbd->segment_feature_data[1][SEG_LVL_ALT_Q] = cpi->segment_feature_data[1][SEG_LVL_ALT_Q];
+    mbd->segment_feature_data[2][SEG_LVL_ALT_Q] = cpi->segment_feature_data[2][SEG_LVL_ALT_Q];
+    mbd->segment_feature_data[3][SEG_LVL_ALT_Q] = cpi->segment_feature_data[3][SEG_LVL_ALT_Q];
 
     /* quantizer has to be reinitialized for any delta_q changes */
     if(update)