Skip to content
Snippets Groups Projects
Commit b5c04e96 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

fix: iOS rotation when rescale

on iOS landscape mode corresponds to 90 or 270 degree. Current rescale
implementation will create output that is out of bounds for iOS frame.

Change-Id: I29c89402fc056714149f0ff2fe98e7b8bdf13565
parent 5f102d42
No related branches found
No related tags found
No related merge requests found
...@@ -43,9 +43,14 @@ getTransposeFilter(int rotation, std::string inputName, int width, int height, i ...@@ -43,9 +43,14 @@ getTransposeFilter(int rotation, std::string inputName, int width, int height, i
case 90: case 90:
case -270: case -270:
ss << "transpose=2"; ss << "transpose=2";
if (rescale) if (rescale) {
if (width > height)
ss << ", scale=w=-1:h=" << height ss << ", scale=w=-1:h=" << height
<< ", pad=" << width << ":" << height << ":(ow-iw)/2"; << ", pad=" << width << ":" << height << ":(ow-iw)/2";
else
ss << ", scale=w=" << width << ":h=-1"
<< ", pad=" << width << ":" << height << ":0:(oh-ih)/2";
}
break; break;
case 180 : case 180 :
case -180 : case -180 :
...@@ -54,9 +59,14 @@ getTransposeFilter(int rotation, std::string inputName, int width, int height, i ...@@ -54,9 +59,14 @@ getTransposeFilter(int rotation, std::string inputName, int width, int height, i
case 270 : case 270 :
case -90 : case -90 :
ss << "transpose=1"; ss << "transpose=1";
if (rescale) if (rescale) {
if (width > height)
ss << ", scale=w=-1:h=" << height ss << ", scale=w=-1:h=" << height
<< ", pad=" << width << ":" << height << ":(ow-iw)/2"; << ", pad=" << width << ":" << height << ":(ow-iw)/2";
else
ss << ", scale=w=" << width << ":h=-1"
<< ", pad=" << width << ":" << height << ":0:(oh-ih)/2";
}
break; break;
default : default :
return {}; return {};
......
...@@ -213,7 +213,7 @@ VideoMixer::render_frame(VideoFrame& output, const VideoFrame& input, ...@@ -213,7 +213,7 @@ VideoMixer::render_frame(VideoFrame& output, const VideoFrame& input,
const constexpr char filterIn[] = "mixin"; const constexpr char filterIn[] = "mixin";
if (angle != source->rotation) { if (angle != source->rotation) {
source->rotationFilter = video::getTransposeFilter(angle, filterIn, source->rotationFilter = video::getTransposeFilter(angle, filterIn,
frame->width(), frame->height(), frame->format(), true); frame->width(), frame->height(), frame->format(), false);
source->rotation = angle; source->rotation = angle;
} }
if (source->rotationFilter) { if (source->rotationFilter) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment