shithub: libvpx

Download patch

ref: 0ca0a536f5d42c338cc21b76f95c5617867ff756
parent: 08ae94404fcd20990216c80c149b33b2e89ee3a1
parent: c05c58f8ff99b11fa003cc4b1eca2ffb9d463528
author: Marco Paniconi <[email protected]>
date: Tue Sep 29 13:47:39 EDT 2015

Merge "aq-mode for SVC: Add consec_zero_mv to layer context."

--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -55,7 +55,6 @@
       int layer = LAYER_IDS_TO_IDX(sl, tl, oxcf->ts_number_layers);
       LAYER_CONTEXT *const lc = &svc->layer_context[layer];
       RATE_CONTROL *const lrc = &lc->rc;
-      size_t last_coded_q_map_size;
       int i;
       lc->current_video_frame_in_layer = 0;
       lc->layer_size = 0;
@@ -105,14 +104,18 @@
       // Cyclic refresh is only applied on base temporal layer.
       if (oxcf->ss_number_layers > 1 &&
           tl == 0) {
+        size_t last_coded_q_map_size;
+        size_t consec_zero_mv_size;
         lc->sb_index = 0;
         lc->map = vpx_malloc(mi_rows * mi_cols * sizeof(signed char));
         memset(lc->map, 0, mi_rows * mi_cols);
-        last_coded_q_map_size =
-            mi_rows * mi_cols * sizeof(uint8_t);
+        last_coded_q_map_size = mi_rows * mi_cols * sizeof(uint8_t);
         lc->last_coded_q_map = vpx_malloc(last_coded_q_map_size);
         assert(MAXQ <= 255);
         memset(lc->last_coded_q_map, MAXQ, last_coded_q_map_size);
+        consec_zero_mv_size = mi_rows * mi_cols * sizeof(uint8_t);
+        lc->consec_zero_mv = vpx_malloc(consec_zero_mv_size);
+        memset(lc->consec_zero_mv, 0, consec_zero_mv_size);
        }
     }
   }
@@ -286,10 +289,13 @@
     CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
     signed char *temp = cr->map;
     uint8_t *temp2 = cr->last_coded_q_map;
+    uint8_t *temp3 = cr->consec_zero_mv;
     cr->map = lc->map;
     lc->map = temp;
     cr->last_coded_q_map = lc->last_coded_q_map;
     lc->last_coded_q_map = temp2;
+    cr->consec_zero_mv = lc->consec_zero_mv;
+    lc->consec_zero_mv = temp3;
     cr->sb_index = lc->sb_index;
   }
 }
@@ -311,10 +317,13 @@
     CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
     signed char *temp = lc->map;
     uint8_t *temp2 = lc->last_coded_q_map;
+    uint8_t *temp3 = lc->consec_zero_mv;
     lc->map = cr->map;
     cr->map = temp;
     lc->last_coded_q_map = cr->last_coded_q_map;
     cr->last_coded_q_map = temp2;
+    lc->consec_zero_mv = cr->consec_zero_mv;
+    cr->consec_zero_mv = temp3;
     lc->sb_index = cr->sb_index;
   }
 }
@@ -721,6 +730,8 @@
           vpx_free(lc->map);
         if (lc->last_coded_q_map)
           vpx_free(lc->last_coded_q_map);
+        if (lc->consec_zero_mv)
+          vpx_free(lc->consec_zero_mv);
     }
   }
 }
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -45,6 +45,7 @@
   int sb_index;
   signed char *map;
   uint8_t *last_coded_q_map;
+  uint8_t *consec_zero_mv;
 } LAYER_CONTEXT;
 
 typedef struct {