From 58126f92bf96236d7ceda3d959b7db99f3c043c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Mon, 7 Jun 2021 12:14:09 +0200 Subject: [PATCH] Update the only 3 remaining kFilterBilinear to kFilterBox. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bilinear is faster but lesser quality, box is best quality. Our code base has disagreed about which filter to use for quite some time, causing aliasing bug reports. In an effort to avoid aliasing artifacts and make our scaling filters more predictable, we're updating all uses to kFilterBox. WebRTC already uses kFilterBox everywhere except for these three places. The main discrepency was between Chromium and WebRTC but that has already been fixed. This CL fixes the last remaining bilinears. This brings the WebRTC kFilterBox use count up from 11 to 14 and the kFilterBilinear use count down from 3 to 0. Bug: chromium:1212630 Change-Id: I5fe4aa92b9275d65b91ea97925533055d190d317 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221372 Reviewed-by: Ilya Nikolaevskiy Reviewed-by: Harald Alvestrand Reviewed-by: Erik Språng Commit-Queue: Henrik Boström Cr-Commit-Position: refs/heads/master@{#34248} --- api/video/nv12_buffer.cc | 3 +-- modules/video_coding/codecs/h264/h264_encoder_impl.cc | 2 +- rtc_tools/frame_analyzer/video_geometry_aligner.cc | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/api/video/nv12_buffer.cc b/api/video/nv12_buffer.cc index 974620ba27..37d688b88b 100644 --- a/api/video/nv12_buffer.cc +++ b/api/video/nv12_buffer.cc @@ -144,11 +144,10 @@ void NV12Buffer::CropAndScaleFrom(const NV12BufferInterface& src, const uint8_t* uv_plane = src.DataUV() + src.StrideUV() * uv_offset_y + uv_offset_x * 2; - // kFilterBox is unsupported in libyuv, so using kFilterBilinear instead. int res = libyuv::NV12Scale(y_plane, src.StrideY(), uv_plane, src.StrideUV(), crop_width, crop_height, MutableDataY(), StrideY(), MutableDataUV(), StrideUV(), width(), - height(), libyuv::kFilterBilinear); + height(), libyuv::kFilterBox); RTC_DCHECK_EQ(res, 0); } diff --git a/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/modules/video_coding/codecs/h264/h264_encoder_impl.cc index 949c51bafa..733f00f5c0 100644 --- a/modules/video_coding/codecs/h264/h264_encoder_impl.cc +++ b/modules/video_coding/codecs/h264/h264_encoder_impl.cc @@ -445,7 +445,7 @@ int32_t H264EncoderImpl::Encode( pictures_[i].iStride[0], pictures_[i].pData[1], pictures_[i].iStride[1], pictures_[i].pData[2], pictures_[i].iStride[2], configurations_[i].width, - configurations_[i].height, libyuv::kFilterBilinear); + configurations_[i].height, libyuv::kFilterBox); } if (!configurations_[i].sending) { diff --git a/rtc_tools/frame_analyzer/video_geometry_aligner.cc b/rtc_tools/frame_analyzer/video_geometry_aligner.cc index db397bc3a5..88da26d4d0 100644 --- a/rtc_tools/frame_analyzer/video_geometry_aligner.cc +++ b/rtc_tools/frame_analyzer/video_geometry_aligner.cc @@ -61,7 +61,7 @@ rtc::scoped_refptr CropAndZoom( adjusted_frame->MutableDataY(), adjusted_frame->StrideY(), adjusted_frame->MutableDataU(), adjusted_frame->StrideU(), adjusted_frame->MutableDataV(), adjusted_frame->StrideV(), - frame->width(), frame->height(), libyuv::kFilterBilinear); + frame->width(), frame->height(), libyuv::kFilterBox); return adjusted_frame; }