Skip to content

Commit

Permalink
Update the only 3 remaining kFilterBilinear to kFilterBox.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Harald Alvestrand <[email protected]>
Reviewed-by: Erik Språng <[email protected]>
Commit-Queue: Henrik Boström <[email protected]>
Cr-Commit-Position: refs/heads/master@{#34248}
  • Loading branch information
henbos authored and WebRTC LUCI CQ committed Jun 8, 2021
1 parent d9a135b commit 58126f9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions api/video/nv12_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/video_coding/codecs/h264/h264_encoder_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion rtc_tools/frame_analyzer/video_geometry_aligner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ rtc::scoped_refptr<I420BufferInterface> 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;
}
Expand Down

0 comments on commit 58126f9

Please sign in to comment.