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

Unified Diff: media/cast/test/utility/video_utility.cc

Issue 892383002: RELAND: [Cast] Software encoder support for varying video frame sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for 'access to uninitialized memory' error. 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 | « media/cast/test/utility/video_utility.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/test/utility/video_utility.cc
diff --git a/media/cast/test/utility/video_utility.cc b/media/cast/test/utility/video_utility.cc
index 9741cd0b118003576becaec4d59897032d83c5f3..ff050dafcb5e3208113d668d8f1bb3774687dc3c 100644
--- a/media/cast/test/utility/video_utility.cc
+++ b/media/cast/test/utility/video_utility.cc
@@ -59,7 +59,11 @@ double I420SSIM(const scoped_refptr<media::VideoFrame>& frame1,
}
void PopulateVideoFrame(VideoFrame* frame, int start_value) {
- int height = frame->coded_size().height();
+ const gfx::Size frame_size = frame->coded_size();
+ const int stripe_size =
+ std::max(32, std::min(frame_size.width(), frame_size.height()) / 8) & -2;
+
+ int height = frame_size.height();
int stride_y = frame->stride(VideoFrame::kYPlane);
int stride_u = frame->stride(VideoFrame::kUPlane);
int stride_v = frame->stride(VideoFrame::kVPlane);
@@ -70,24 +74,30 @@ void PopulateVideoFrame(VideoFrame* frame, int start_value) {
// Set Y.
for (int j = 0; j < height; ++j) {
+ const int stripe_j = (j / stripe_size) * stripe_size;
for (int i = 0; i < stride_y; ++i) {
- *y_plane = static_cast<uint8>(start_value + i + j);
+ const int stripe_i = (i / stripe_size) * stripe_size;
+ *y_plane = static_cast<uint8>(start_value + stripe_i + stripe_j);
++y_plane;
}
}
// Set U.
for (int j = 0; j < half_height; ++j) {
+ const int stripe_j = (j / stripe_size) * stripe_size;
for (int i = 0; i < stride_u; ++i) {
- *u_plane = static_cast<uint8>(start_value + i + j);
+ const int stripe_i = (i / stripe_size) * stripe_size;
+ *u_plane = static_cast<uint8>(start_value + stripe_i + stripe_j);
++u_plane;
}
}
// Set V.
for (int j = 0; j < half_height; ++j) {
+ const int stripe_j = (j / stripe_size) * stripe_size;
for (int i = 0; i < stride_v; ++i) {
- *v_plane = static_cast<uint8>(start_value + i + j);
+ const int stripe_i = (i / stripe_size) * stripe_size;
+ *u_plane = static_cast<uint8>(start_value + stripe_i + stripe_j);
++v_plane;
}
}
« no previous file with comments | « media/cast/test/utility/video_utility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698