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

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

Issue 147993010: Cast: end2end bug fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + nits Created 6 years, 10 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/linux_output_window.cc ('k') | media/cast/transport/pacing/paced_sender.cc » ('j') | 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 5241f698c74efdd3a94bcbd907a29a709c904ea7..742be6fba3b838375c4c52654655ea4214acaabd 100644
--- a/media/cast/test/utility/video_utility.cc
+++ b/media/cast/test/utility/video_utility.cc
@@ -38,26 +38,34 @@ double I420PSNR(const scoped_refptr<media::VideoFrame>& frame1,
void PopulateVideoFrame(VideoFrame* frame, int start_value) {
int width = frame->coded_size().width();
int height = frame->coded_size().height();
- int half_width = (width + 1) / 2;
+ int stride_y = frame->stride(VideoFrame::kYPlane);
+ int stride_u = frame->stride(VideoFrame::kUPlane);
+ int stride_v = frame->stride(VideoFrame::kVPlane);
int half_height = (height + 1) / 2;
uint8* y_plane = frame->data(VideoFrame::kYPlane);
uint8* u_plane = frame->data(VideoFrame::kUPlane);
uint8* v_plane = frame->data(VideoFrame::kVPlane);
// Set Y.
- for (int i = 0; i < width * height; ++i) {
- y_plane[i] = static_cast<uint8>(start_value + i);
- }
+ for (int j = 0; j < height; ++j)
+ for (int i = 0; i < stride_y; ++i) {
+ *y_plane = static_cast<uint8>(start_value + i + j);
+ ++y_plane;
+ }
// Set U.
- for (int i = 0; i < half_width * half_height; ++i) {
- u_plane[i] = static_cast<uint8>(start_value + i);
- }
+ for (int j = 0; j < half_height; ++j)
+ for (int i = 0; i < stride_u; ++i) {
+ *u_plane = static_cast<uint8>(start_value + i + j);
+ ++u_plane;
+ }
// Set V.
- for (int i = 0; i < half_width * half_height; ++i) {
- v_plane[i] = static_cast<uint8>(start_value + i);
- }
+ for (int j = 0; j < half_height; ++j)
+ for (int i = 0; i < stride_v; ++i) {
+ *v_plane = static_cast<uint8>(start_value + i + j);
+ ++v_plane;
+ }
}
bool PopulateVideoFrameFromFile(VideoFrame* frame, FILE* video_file) {
« no previous file with comments | « media/cast/test/linux_output_window.cc ('k') | media/cast/transport/pacing/paced_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698