shithub: libvpx

Download patch

ref: 2b97860f971f1f0407595338241714c00c13bae3
parent: 56735c3fdb8401fb052f69cdaf2ebf16714bd21d
author: angiebird <[email protected]>
date: Tue Nov 12 03:56:13 EST 2019

Add quantize_index to EncodeFrameResult

Change-Id: Idfb36a8bfa264df8294eba70424fd25fa5d88cda

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -7095,7 +7095,7 @@
                                        FRAME_UPDATE_TYPE update_type,
                                        const YV12_BUFFER_CONFIG *source_frame,
                                        const YV12_BUFFER_CONFIG *coded_frame,
-                                       uint32_t bit_depth,
+                                       int quantize_index, uint32_t bit_depth,
                                        uint32_t input_bit_depth) {
   PSNR_STATS psnr;
 #if CONFIG_VP9_HIGHBITDEPTH
@@ -7110,6 +7110,7 @@
   encode_frame_result->sse = psnr.sse[0];
   encode_frame_result->show_idx = show_idx;
   encode_frame_result->update_type = update_type;
+  encode_frame_result->quantize_index = quantize_index;
 }
 #endif  // !CONFIG_REALTIME_ONLY
 
@@ -7406,8 +7407,8 @@
     update_encode_frame_result(
         encode_frame_result, source->show_idx,
         cpi->twopass.gf_group.update_type[cpi->twopass.gf_group.index],
-        cpi->Source, get_frame_new_buffer(cm), cpi->oxcf.input_bit_depth,
-        cm->bit_depth);
+        cpi->Source, get_frame_new_buffer(cm), vp9_get_quantizer(cpi),
+        cpi->oxcf.input_bit_depth, cm->bit_depth);
     vp9_twopass_postencode_update(cpi);
   } else if (cpi->use_svc) {
     SvcEncode(cpi, size, dest, frame_flags);
@@ -7714,7 +7715,7 @@
   return;
 }
 
-int vp9_get_quantizer(VP9_COMP *cpi) { return cpi->common.base_qindex; }
+int vp9_get_quantizer(const VP9_COMP *cpi) { return cpi->common.base_qindex; }
 
 void vp9_apply_encoding_flags(VP9_COMP *cpi, vpx_enc_frame_flags_t flags) {
   if (flags &
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -827,6 +827,7 @@
   FRAME_UPDATE_TYPE update_type;
   double psnr;
   uint64_t sse;
+  int quantize_index;
 } ENCODE_FRAME_RESULT;
 
 void vp9_initialize_enc(void);
@@ -899,7 +900,7 @@
   for (idx = 0; idx < length; ++idx) stack[idx] = -1;
 }
 
-int vp9_get_quantizer(struct VP9_COMP *cpi);
+int vp9_get_quantizer(const VP9_COMP *cpi);
 
 static INLINE int frame_is_kf_gf_arf(const VP9_COMP *cpi) {
   return frame_is_intra_only(&cpi->common) || cpi->refresh_alt_ref_frame ||
--- a/vp9/simple_encode.cc
+++ b/vp9/simple_encode.cc
@@ -92,6 +92,7 @@
       get_frame_type_from_update_type(encode_frame_info->update_type);
   encode_frame_result->psnr = encode_frame_info->psnr;
   encode_frame_result->sse = encode_frame_info->sse;
+  encode_frame_result->quantize_index = encode_frame_info->quantize_index;
 }
 
 SimpleEncode::SimpleEncode(int frame_width, int frame_height,
--- a/vp9/simple_encode.h
+++ b/vp9/simple_encode.h
@@ -16,7 +16,7 @@
   std::unique_ptr<unsigned char[]> coding_data;
   double psnr;
   uint64_t sse;
-  // TODO(angiebird): int quantize_index ;
+  int quantize_index;
 };
 
 class SimpleEncode {