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; |
} |
} |