瀏覽代碼

UI: Estimate better resolution if using NVENC

NVENC has increased its quality to bitrate ratio over the years with
recent generations of hardware, so do not increase the minimum estimated
bitrate if NVENC is chosen in the auto-configuration dialog.
jp9000 6 年之前
父節點
當前提交
a0e92303f2
共有 1 個文件被更改,包括 14 次插入5 次删除
  1. 14 5
      UI/window-basic-auto-config-test.cpp

+ 14 - 5
UI/window-basic-auto-config-test.cpp

@@ -796,8 +796,17 @@ void AutoConfigTestPage::FindIdealHardwareResolution()
 		if (!force && rate > maxDataRate)
 		if (!force && rate > maxDataRate)
 			return;
 			return;
 
 
-		int minBitrate = EstimateMinBitrate(cx, cy, fps_num, fps_den)
-			* 114 / 100;
+		AutoConfig::Encoder encType = wiz->streamingEncoder;
+		bool nvenc = encType == AutoConfig::Encoder::NVENC;
+
+		int minBitrate = EstimateMinBitrate(cx, cy, fps_num, fps_den);
+
+		/* most hardware encoders don't have a good quality to bitrate
+		 * ratio, so increase the minimum bitrate estimate for them.
+		 * NVENC currently is the exception because of the improvements
+		 * its made to its quality in recent generations. */
+		if (!nvenc) minBitrate = minBitrate * 114 / 100;
+
 		if (wiz->type == AutoConfig::Type::Recording)
 		if (wiz->type == AutoConfig::Type::Recording)
 			force = true;
 			force = true;
 		if (force || wiz->idealBitrate >= minBitrate)
 		if (force || wiz->idealBitrate >= minBitrate)
@@ -854,9 +863,6 @@ void AutoConfigTestPage::TestStreamEncoderThread()
 		}
 		}
 	}
 	}
 
 
-	if (preferHardware && !softwareTested && wiz->hardwareEncodingAvailable)
-		FindIdealHardwareResolution();
-
 	if (!softwareTested) {
 	if (!softwareTested) {
 		if (wiz->nvencAvailable)
 		if (wiz->nvencAvailable)
 			wiz->streamingEncoder = AutoConfig::Encoder::NVENC;
 			wiz->streamingEncoder = AutoConfig::Encoder::NVENC;
@@ -868,6 +874,9 @@ void AutoConfigTestPage::TestStreamEncoderThread()
 		wiz->streamingEncoder = AutoConfig::Encoder::x264;
 		wiz->streamingEncoder = AutoConfig::Encoder::x264;
 	}
 	}
 
 
+	if (preferHardware && !softwareTested && wiz->hardwareEncodingAvailable)
+		FindIdealHardwareResolution();
+
 	QMetaObject::invokeMethod(this, "NextStage");
 	QMetaObject::invokeMethod(this, "NextStage");
 }
 }