shithub: libvpx

Download patch

ref: 7122eea6a42b136c6e4b59663847ba39e021b73a
parent: 246a65c6961cfa314d41780ec3909a2308a568c6
author: angiebird <angiebird@google.com>
date: Mon Aug 10 11:46:37 EDT 2020

Cosmetic change for simple_encode_test.cc

Change-Id: I50b4d38f7deceb5b416e72dd944d2ed31e42dafa

--- a/test/simple_encode_test.cc
+++ b/test/simple_encode_test.cc
@@ -172,15 +172,15 @@
   simple_encode.StartEncode();
   for (int i = 0; i < num_coding_frames; ++i) {
     EncodeFrameInfo encode_frame_info = simple_encode.GetNextEncodeFrameInfo();
-    int target_frame_bits = 20000;
-    if (encode_frame_info.frame_type == kFrameTypeKey ||
-        encode_frame_info.frame_type == kFrameTypeAltRef ||
-        encode_frame_info.frame_type == kFrameTypeGolden) {
-      target_frame_bits = 100000;
+    int target_frame_bits;
+    switch (encode_frame_info.frame_type) {
+      case kFrameTypeInter: target_frame_bits = 20000; break;
+      case kFrameTypeKey:
+      case kFrameTypeAltRef:
+      case kFrameTypeGolden: target_frame_bits = 100000; break;
+      case kFrameTypeOverlay: target_frame_bits = 2000; break;
+      default: target_frame_bits = 20000;
     }
-    if (encode_frame_info.frame_type == kFrameTypeOverlay) {
-      target_frame_bits = 2000;
-    }
 
     double percent_diff = 15;
     if (encode_frame_info.frame_type == kFrameTypeOverlay) {
@@ -194,8 +194,8 @@
     EXPECT_LE(recode_count, 7);
     EXPECT_GE(recode_count, 1);
 
-    double diff = fabs((double)encode_frame_result.coding_data_bit_size -
-                       target_frame_bits);
+    const double diff = fabs((double)encode_frame_result.coding_data_bit_size -
+                             target_frame_bits);
     EXPECT_LE(diff * 100 / target_frame_bits, percent_diff);
   }
   simple_encode.EndEncode();