]> granicus.if.org Git - libvpx/commitdiff
Add quantize_index to EncodeFrameResult
authorangiebird <angiebird@google.com>
Tue, 12 Nov 2019 16:56:13 +0000 (08:56 -0800)
committerangiebird <angiebird@google.com>
Mon, 18 Nov 2019 19:37:24 +0000 (11:37 -0800)
Change-Id: Idfb36a8bfa264df8294eba70424fd25fa5d88cda

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.h
vp9/simple_encode.cc
vp9/simple_encode.h

index c080ad47dc1ca9109130f56f0499dc486f839085..3104e71d1b2f0b62632b905b93c60c6308327ee1 100644 (file)
@@ -7095,7 +7095,7 @@ static void update_encode_frame_result(ENCODE_FRAME_RESULT *encode_frame_result,
                                        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 @@ static void update_encode_frame_result(ENCODE_FRAME_RESULT *encode_frame_result,
   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 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
     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 @@ void vp9_set_svc(VP9_COMP *cpi, int use_svc) {
   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 &
index 66526bd00df0412fd80e7fd81ad35a3a6e3ed645..e12945f41838ac220fc58244c2885eb3658c037b 100644 (file)
@@ -827,6 +827,7 @@ typedef struct ENCODE_FRAME_RESULT {
   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 @@ static INLINE void stack_init(int *stack, int length) {
   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 ||
index 4d7ec3084c9207aa0156934c89114a2922c170a5..018d50a1eee90a302595779204d6f33ac1c0bcdc 100644 (file)
@@ -92,6 +92,7 @@ static void update_encode_frame_result(
       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,
index fa1847161d1354cfab050a81aa380349ce1211dd..48a86d0562d9b5b95d8f6879d7e7e0592794c240 100644 (file)
@@ -16,7 +16,7 @@ struct EncodeFrameResult {
   std::unique_ptr<unsigned char[]> coding_data;
   double psnr;
   uint64_t sse;
-  // TODO(angiebird): int quantize_index ;
+  int quantize_index;
 };
 
 class SimpleEncode {