Skip to content

Commit d539e46

Browse files
authored
Merge pull request #366 from OpenShot/high-quality-scaling-bi-cubic
Change high quality scaling to use SWS_BICUBIC
2 parents 23ee6eb + 099c8cb commit d539e46

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/FFmpegReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ void FFmpegReader::ProcessVideoPacket(int64_t requested_frame) {
13391339

13401340
int scale_mode = SWS_FAST_BILINEAR;
13411341
if (openshot::Settings::Instance()->HIGH_QUALITY_SCALING) {
1342-
scale_mode = SWS_LANCZOS;
1342+
scale_mode = SWS_BICUBIC;
13431343
}
13441344
SwsContext *img_convert_ctx = sws_getContext(info.width, info.height, AV_GET_CODEC_PIXEL_FORMAT(pStream, pCodecCtx), width,
13451345
height, PIX_FMT_RGBA, scale_mode, NULL, NULL, NULL);

src/FFmpegWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,19 +2111,19 @@ void FFmpegWriter::OutputStreamInfo() {
21112111
void FFmpegWriter::InitScalers(int source_width, int source_height) {
21122112
int scale_mode = SWS_FAST_BILINEAR;
21132113
if (openshot::Settings::Instance()->HIGH_QUALITY_SCALING) {
2114-
scale_mode = SWS_LANCZOS;
2114+
scale_mode = SWS_BICUBIC;
21152115
}
21162116

21172117
// Init software rescalers vector (many of them, one for each thread)
21182118
for (int x = 0; x < num_of_rescalers; x++) {
21192119
// Init the software scaler from FFMpeg
21202120
#if IS_FFMPEG_3_2
21212121
if (hw_en_on && hw_en_supported) {
2122-
img_convert_ctx = sws_getContext(source_width, source_height, PIX_FMT_RGBA, info.width, info.height, AV_PIX_FMT_NV12, SWS_BILINEAR, NULL, NULL, NULL);
2122+
img_convert_ctx = sws_getContext(source_width, source_height, PIX_FMT_RGBA, info.width, info.height, AV_PIX_FMT_NV12, scale_mode, NULL, NULL, NULL);
21232123
} else
21242124
#endif
21252125
{
2126-
img_convert_ctx = sws_getContext(source_width, source_height, PIX_FMT_RGBA, info.width, info.height, AV_GET_CODEC_PIXEL_FORMAT(video_st, video_st->codec), SWS_BILINEAR,
2126+
img_convert_ctx = sws_getContext(source_width, source_height, PIX_FMT_RGBA, info.width, info.height, AV_GET_CODEC_PIXEL_FORMAT(video_st, video_st->codec), scale_mode,
21272127
NULL, NULL, NULL);
21282128
}
21292129

0 commit comments

Comments
 (0)