Skip to content
Snippets Groups Projects
Commit 41886925 authored by Philippe Gorley's avatar Philippe Gorley Committed by Philippe Gorley
Browse files

scaler: avoid unnecessary operations

Most of the time, the frame resolution is unchanged, and the scaler only
needs to convert pixel formats.

Also avoids this crash when size is the same: https://trac.ffmpeg.org/ticket/5356



Change-Id: I4c1c3e0a8b5bba8c937317074e8a9c5652fca407
Gitlab: #58
Reviewed-by: default avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent 5afddf94
No related branches found
No related tags found
No related merge requests found
......@@ -65,9 +65,18 @@ VideoScaler::scale(const VideoFrame& input, VideoFrame& output)
void
VideoScaler::scale_with_aspect(const VideoFrame& input, VideoFrame& output)
{
auto output_frame = output.pointer();
scale_and_pad(input, output, 0, 0, output_frame->width,
output_frame->height, true);
if (input.width() == output.width() && input.height() == output.height()) {
if (input.format() != output.format()) {
auto outPtr = convertFormat(input, (AVPixelFormat)output.format());
output.copyFrom(*outPtr);
} else {
output.copyFrom(input);
}
} else {
auto output_frame = output.pointer();
scale_and_pad(input, output, 0, 0, output_frame->width,
output_frame->height, true);
}
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment