Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: remoting/codec/video_encoder_vpx.cc

Issue 851483005: Add 8 pixels of padding around each rectangle under VP9. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clientShape
Patch Set: Stop using AddRects() Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/codec/video_encoder_vpx.cc
diff --git a/remoting/codec/video_encoder_vpx.cc b/remoting/codec/video_encoder_vpx.cc
index d92d5b336e1fdbcdb2b6b341ef9a9b7158e64543..7149c95a6c3f108bad3115604b4e259a0167c9ba 100644
--- a/remoting/codec/video_encoder_vpx.cc
+++ b/remoting/codec/video_encoder_vpx.cc
@@ -373,18 +373,20 @@ void VideoEncoderVpx::PrepareImage(const webrtc::DesktopFrame& frame,
}
// Align the region to macroblocks, to avoid encoding artefacts.
+ // If VP9 is in use then we also pad the rectangles before aligning them, to
+ // avoid edge artefacts.
// This also ensures that all rectangles have even-aligned top-left, which
// is required for ConvertRGBToYUVWithRect() to work.
- std::vector<webrtc::DesktopRect> aligned_rects;
+ updated_region->Clear();
+ int padding = use_vp9_ ? 8 : 0;
for (webrtc::DesktopRegion::Iterator r(frame.updated_region());
!r.IsAtEnd(); r.Advance()) {
const webrtc::DesktopRect& rect = r.rect();
- aligned_rects.push_back(AlignRect(webrtc::DesktopRect::MakeLTRB(
- rect.left(), rect.top(), rect.right(), rect.bottom())));
+ updated_region->AddRect(AlignRect(webrtc::DesktopRect::MakeLTRB(
+ rect.left() - padding, rect.top() - padding, rect.right() + padding,
+ rect.bottom() + padding)));
}
- DCHECK(!aligned_rects.empty());
- updated_region->Clear();
- updated_region->AddRects(&aligned_rects[0], aligned_rects.size());
+ DCHECK(!updated_region->is_empty());
// Clip back to the screen dimensions, in case they're not macroblock aligned.
// The conversion routines don't require even width & height, so this is safe
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698