Skip to content
Snippets Groups Projects
Commit 0768e7d4 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Use calculated bitrate

parent 9e81a790
No related branches found
No related tags found
Loading
Pipeline #15949 passed
This commit is part of merge request !146. Comments created here will be created in the context of that merge request.
......@@ -172,7 +172,7 @@ static uint64_t calculateBitrate(definition_t def, bitrate_t rate) {
switch (def) {
case definition_t::UHD4k : bitrate = 24.0f; break;
case definition_t::HTC_VIVE : bitrate = 16.0f; break;
case definition_t::HD1080 : bitrate = 12.0f; break;
case definition_t::HD1080 : bitrate = 16.0f; break;
case definition_t::HD720 : bitrate = 8.0f; break;
case definition_t::SD576 :
case definition_t::SD480 : bitrate = 4.0f; break;
......@@ -186,6 +186,9 @@ static uint64_t calculateBitrate(definition_t def, bitrate_t rate) {
bool NvPipeEncoder::_createEncoder(const cv::Mat &in, definition_t def, bitrate_t rate) {
if (_encoderMatch(in, def) && nvenc_) return true;
uint64_t bitrate = calculateBitrate(def, rate);
LOG(INFO) << "Calculated bitrate: " << bitrate;
if (in.type() == CV_32F) is_float_channel_ = true;
else is_float_channel_ = false;
current_definition_ = def;
......@@ -196,7 +199,7 @@ bool NvPipeEncoder::_createEncoder(const cv::Mat &in, definition_t def, bitrate_
(is_float_channel_) ? NVPIPE_UINT16 : NVPIPE_RGBA32,
(preference_ == codec_t::Any || preference_ == codec_t::HEVC) ? NVPIPE_HEVC : NVPIPE_H264,
(is_float_channel_) ? NVPIPE_LOSSLESS : NVPIPE_LOSSY,
16*1000*1000,
bitrate,
fps, // FPS
ftl::codecs::getWidth(def), // Output Width
ftl::codecs::getHeight(def) // Output Height
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment