Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Improved adaptive resolution algorithm #1145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions source/core/owt_base/FrameProcesser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,30 @@ void FrameProcesser::onFrame(const Frame& frame)
}
}

uint32_t width = (m_outWidth == 0 ? frame.additionalInfo.video.width : m_outWidth);
uint32_t height = (m_outHeight == 0 ? frame.additionalInfo.video.height : m_outHeight);
uint32_t width = frame.additionalInfo.video.width;
uint32_t height = frame.additionalInfo.video.height;
double aspectRatio = static_cast<double>(frame.additionalInfo.video.width) / static_cast<double>(frame.additionalInfo.video.height);

if(m_outWidth > 0 && m_outHeight == 0){

if(width > m_outWidth){
width = m_outWidth;
}

height = (int) ( static_cast<double>(width) / aspectRatio);

}else if(m_outWidth == 0 && m_outHeight > 0){

if(height > m_outHeight){
height = m_outHeight;
}

width = (int) ( static_cast<double>(height) * aspectRatio);

}else if(m_outWidth > 0 && m_outHeight > 0){
width = m_outWidth;
height = m_outHeight;
}

#ifdef ENABLE_MSDK
if (m_format == FRAME_FORMAT_MSDK) {
Expand Down