Modify VP8 encoding to improve performance
authorKartik Anand <kartik.anand@samsung.com>
Fri, 1 Oct 2021 08:06:57 +0000 (13:36 +0530)
committerYoungjae Shin <yj99.shin@samsung.com>
Thu, 28 Oct 2021 10:30:43 +0000 (19:30 +0900)
* Modify VP8 encoding to improve performance

* Add/modify gstreamer elements to improve video input pipeline performance

Change-Id: I982d387b78a3b6ae1b59e2825569e8ffb20df5e4

subprojects/libbeyond-peer_nn/src/peer.cc
subprojects/libbeyond-peer_nn/src/peer_grpc_client_gst.cc

index 256a0173cde8691d166f1b1ec2d2b0f9725d645a..12dd2b8d497e789ea42ab97595cbdadb033d40bd 100644 (file)
@@ -183,14 +183,13 @@ void Peer::ConfigureVideoInput(beyond_input_config *config, std::ostringstream &
 {
     client_format << "video/x-raw,format=" << config->config.video.frame.format;
     client_format << ",width=" << config->config.video.frame.width << ",height=" << config->config.video.frame.height << ",framerate=" << config->config.video.fps << "/1";
-    if (strstr(config->config.video.frame.format, "I420")) {
-        client_format << " ! vp8enc";
-    } else {
+    if (strstr(config->config.video.frame.format, "I420") == nullptr) {
         // Note: VP8 only supports I420 format
-        client_format << " ! videoconvert ! video/x-raw,format=I420 ! vp8enc";
+        client_format << " ! videoconvert ! video/x-raw,format=I420";
     }
+    client_format << " ! vp8enc end-usage=cbr cpu-used=4 threads=2 deadline=2 target-bitrate=256000 undershoot=95 keyframe-max-dist=999999 max-quantizer=56 min-quantizer=4 ! queue";
 
-    server_format << "vp8dec ! videoconvert";
+    server_format << "vp8dec ! queue ! videoconvert";
     if (config->config.video.frame.width != config->config.video.frame.convert_width || config->config.video.frame.height != config->config.video.frame.convert_height) {
         server_format << " ! videoscale ";
     }
@@ -203,6 +202,7 @@ void Peer::ConfigureVideoInput(beyond_input_config *config, std::ostringstream &
         server_format << " ! tensor_transform mode=" << config->config.video.frame.transform_mode;
         server_format << " option=" << config->config.video.frame.transform_option;
     }
+    server_format << " ! queue leaky=2 max-size-buffers=1";
 }
 
 int Peer::ConfigureInput(const beyond_config *options)
index 2746684158c4386b2ff052a3cc57f187e9d901f3..12ec8c26042d32879df28dcd8ac652dec1424711 100644 (file)
@@ -489,7 +489,7 @@ int Peer::GrpcClient::Gst::Prepare(const char *host, int requestPort, int respon
         return -EFAULT;
     }
 
-    desc->request = g_strdup_printf("appsrc name=" SRCX_NAME " ! %s ! queue leaky=2 max-size-buffers=1 ! %s", infoString, postPipeline);
+    desc->request = g_strdup_printf("appsrc name=" SRCX_NAME " ! queue leaky=2 max-size-buffers=1 ! %s ! %s", infoString, postPipeline);
     g_free(postPipeline);
     postPipeline = nullptr;
     free(infoString);