shithub: libvpx

Download patch

ref: ca97594a8adbbc3d4e3be835d96e16945fd09bee
parent: c875803def7344aa69334f4dada2a3812a10a964
parent: 227deb503e381b86fccae3fd92ee92baacec0948
author: Jingning Han <jingning@google.com>
date: Mon Oct 15 23:49:25 EDT 2018

Merge "Add encoder side frame buffer for tpl model"

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2359,11 +2359,10 @@
   vp9_set_speed_features_framesize_dependent(cpi);
 
   if (cpi->sf.enable_tpl_model) {
+    const int mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
+    const int mi_rows = mi_cols_aligned_to_sb(cm->mi_rows);
     // TODO(jingning): Reduce the actual memory use for tpl model build up.
     for (frame = 0; frame < MAX_ARF_GOP_SIZE; ++frame) {
-      int mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
-      int mi_rows = mi_cols_aligned_to_sb(cm->mi_rows);
-
       CHECK_MEM_ERROR(cm, cpi->tpl_stats[frame].tpl_stats_ptr,
                       vpx_calloc(mi_rows * mi_cols,
                                  sizeof(*cpi->tpl_stats[frame].tpl_stats_ptr)));
@@ -2373,6 +2372,11 @@
       cpi->tpl_stats[frame].stride = mi_cols;
       cpi->tpl_stats[frame].mi_rows = cm->mi_rows;
       cpi->tpl_stats[frame].mi_cols = cm->mi_cols;
+    }
+
+    for (frame = 0; frame < REF_FRAMES; ++frame) {
+      cpi->enc_frame_buf[frame].mem_valid = 0;
+      cpi->enc_frame_buf[frame].released = 1;
     }
   }
 
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -495,6 +495,12 @@
   struct scale_factors sf;
 } ARNRFilterData;
 
+typedef struct EncFrameBuf {
+  int mem_valid;
+  int released;
+  YV12_BUFFER_CONFIG frame;
+} EncFrameBuf;
+
 // Maximum operating frame buffer size needed for a GOP using ARF reference.
 #define MAX_ARF_GOP_SIZE (2 * MAX_LAG_BUFFERS)
 
@@ -522,7 +528,8 @@
   YV12_BUFFER_CONFIG *raw_source_frame;
 
   TplDepFrame tpl_stats[MAX_ARF_GOP_SIZE];
-  YV12_BUFFER_CONFIG *tpl_recon_frames[REFS_PER_FRAME + 1];
+  YV12_BUFFER_CONFIG *tpl_recon_frames[REF_FRAMES];
+  EncFrameBuf enc_frame_buf[REF_FRAMES];
 
   TileDataEnc *tile_data;
   int allocated_tiles;  // Keep track of memory allocated for tiles.