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

Side by Side Diff: cc/output/renderer_pixeltest.cc

Issue 2380673002: Clean up code to use VideoFrameMetadata::MergeMetadataFrom() when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up code to use VideoFrameMetadata::MergeMetadataFrom() when appropriate. Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/media/media_stream_video_capturer_source_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 default: 304 default:
305 NOTREACHED(); 305 NOTREACHED();
306 return nullptr; 306 return nullptr;
307 } 307 }
308 scoped_refptr<media::VideoFrame> ret = media::VideoFrame::CreateFrame( 308 scoped_refptr<media::VideoFrame> ret = media::VideoFrame::CreateFrame(
309 format, video_frame->coded_size(), video_frame->visible_rect(), 309 format, video_frame->coded_size(), video_frame->visible_rect(),
310 video_frame->natural_size(), video_frame->timestamp()); 310 video_frame->natural_size(), video_frame->timestamp());
311 311
312 // Copy all metadata. 312 // Copy all metadata.
313 base::DictionaryValue tmp; 313 ret->metadata()->MergeMetadataFrom(video_frame->metadata());
314 video_frame->metadata()->MergeInternalValuesInto(&tmp);
315 ret->metadata()->MergeInternalValuesFrom(tmp);
316 314
317 for (int plane = media::VideoFrame::kYPlane; 315 for (int plane = media::VideoFrame::kYPlane;
318 plane <= media::VideoFrame::kVPlane; ++plane) { 316 plane <= media::VideoFrame::kVPlane; ++plane) {
319 int width = video_frame->row_bytes(plane); 317 int width = video_frame->row_bytes(plane);
320 const uint8_t* src = video_frame->data(plane); 318 const uint8_t* src = video_frame->data(plane);
321 uint16_t* dst = reinterpret_cast<uint16_t*>(ret->data(plane)); 319 uint16_t* dst = reinterpret_cast<uint16_t*>(ret->data(plane));
322 for (int row = 0; row < video_frame->rows(plane); row++) { 320 for (int row = 0; row < video_frame->rows(plane); row++) {
323 for (int x = 0; x < width; x++) { 321 for (int x = 0; x < width; x++) {
324 // Replicate the top bits into the lower bits, this way 322 // Replicate the top bits into the lower bits, this way
325 // 0xFF becomes 0x3FF. 323 // 0xFF becomes 0x3FF.
(...skipping 2847 matching lines...) Expand 10 before | Expand all | Expand 10 after
3173 3171
3174 EXPECT_TRUE(this->RunPixelTest( 3172 EXPECT_TRUE(this->RunPixelTest(
3175 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")), 3173 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")),
3176 FuzzyPixelOffByOneComparator(true))); 3174 FuzzyPixelOffByOneComparator(true)));
3177 } 3175 }
3178 3176
3179 #endif // !defined(OS_ANDROID) 3177 #endif // !defined(OS_ANDROID)
3180 3178
3181 } // namespace 3179 } // namespace
3182 } // namespace cc 3180 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream_video_capturer_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698