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

Side by Side Diff: content/common/gpu/media/video_encode_accelerator_unittest.cc

Issue 318833002: fix sign-compare warning. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/memory_mapped_file.h" 9 #include "base/files/memory_mapped_file.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 // Without it, AppendToFile() will not work. 526 // Without it, AppendToFile() will not work.
527 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); 527 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0));
528 } 528 }
529 529
530 input_buffer_size_ = 530 input_buffer_size_ =
531 media::VideoFrame::AllocationSize(kInputFormat, test_stream.size); 531 media::VideoFrame::AllocationSize(kInputFormat, test_stream.size);
532 CHECK_GT(input_buffer_size_, 0UL); 532 CHECK_GT(input_buffer_size_, 0UL);
533 533
534 // Calculate the number of frames in the input stream by dividing its length 534 // Calculate the number of frames in the input stream by dividing its length
535 // in bytes by frame size in bytes. 535 // in bytes by frame size in bytes.
536 CHECK_EQ(test_stream_.input_file.length() % input_buffer_size_, 0) 536 CHECK_EQ(test_stream_.input_file.length() % input_buffer_size_, 0UL)
537 << "Stream byte size is not a product of calculated frame byte size"; 537 << "Stream byte size is not a product of calculated frame byte size";
538 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_; 538 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_;
539 CHECK_GT(num_frames_in_stream_, 0UL); 539 CHECK_GT(num_frames_in_stream_, 0UL);
540 CHECK_LE(num_frames_in_stream_, kMaxFrameNum); 540 CHECK_LE(num_frames_in_stream_, kMaxFrameNum);
541 541
542 // We may need to loop over the stream more than once if more frames than 542 // We may need to loop over the stream more than once if more frames than
543 // provided is required for bitrate tests. 543 // provided is required for bitrate tests.
544 if (force_bitrate_ && num_frames_in_stream_ < kMinFramesForBitrateTests) { 544 if (force_bitrate_ && num_frames_in_stream_ < kMinFramesForBitrateTests) {
545 DVLOG(1) << "Stream too short for bitrate test (" << num_frames_in_stream_ 545 DVLOG(1) << "Stream too short for bitrate test (" << num_frames_in_stream_
546 << " frames), will loop it to reach " << kMinFramesForBitrateTests 546 << " frames), will loop it to reach " << kMinFramesForBitrateTests
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 // we'll be treating ourselves to random corruption. 615 // we'll be treating ourselves to random corruption.
616 // Since we are just mmapping and passing chunks of the input file, to ensure 616 // Since we are just mmapping and passing chunks of the input file, to ensure
617 // alignment, if the starting virtual addresses of the frames in it were not 617 // alignment, if the starting virtual addresses of the frames in it were not
618 // 64 byte-aligned, we'd have to use a separate set of input buffers and copy 618 // 64 byte-aligned, we'd have to use a separate set of input buffers and copy
619 // the frames into them before sending to the encoder. It would have been an 619 // the frames into them before sending to the encoder. It would have been an
620 // overkill here though, because, for now at least, we only test resolutions 620 // overkill here though, because, for now at least, we only test resolutions
621 // that result in proper alignment, and it would have also interfered with 621 // that result in proper alignment, and it would have also interfered with
622 // performance testing. So just assert that the frame size is a multiple of 622 // performance testing. So just assert that the frame size is a multiple of
623 // 64 bytes. This ensures all frames start at 64-byte boundary, because 623 // 64 bytes. This ensures all frames start at 64-byte boundary, because
624 // MemoryMappedFile should be mmapp()ed at virtual page start as well. 624 // MemoryMappedFile should be mmapp()ed at virtual page start as well.
625 ASSERT_EQ(input_buffer_size_ & 63, 0u) 625 ASSERT_EQ(input_buffer_size_ & 63, static_cast<size_t>(0))
xhwang 2014/06/05 00:26:28 Will 0u work?
626 << "Frame size has to be a multiple of 64 bytes"; 626 << "Frame size has to be a multiple of 64 bytes";
627 ASSERT_EQ(reinterpret_cast<off_t>(test_stream_.input_file.data()) & 63, 0) 627 ASSERT_EQ(reinterpret_cast<off_t>(test_stream_.input_file.data()) & 63,
628 static_cast<size_t>(0))
xhwang 2014/06/05 00:26:28 ditto
628 << "Mapped file should be mapped at a 64 byte boundary"; 629 << "Mapped file should be mapped at a 64 byte boundary";
629 #endif 630 #endif
630 631
631 num_required_input_buffers_ = input_count; 632 num_required_input_buffers_ = input_count;
632 ASSERT_GT(num_required_input_buffers_, 0UL); 633 ASSERT_GT(num_required_input_buffers_, 0UL);
633 634
634 output_buffer_size_ = output_size; 635 output_buffer_size_ = output_size;
635 ASSERT_GT(output_buffer_size_, 0UL); 636 ASSERT_GT(output_buffer_size_, 0UL);
636 637
637 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) { 638 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) {
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 test_stream_data->assign(it->second.c_str()); 1019 test_stream_data->assign(it->second.c_str());
1019 continue; 1020 continue;
1020 } 1021 }
1021 if (it->first == "v" || it->first == "vmodule") 1022 if (it->first == "v" || it->first == "vmodule")
1022 continue; 1023 continue;
1023 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 1024 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
1024 } 1025 }
1025 1026
1026 return RUN_ALL_TESTS(); 1027 return RUN_ALL_TESTS();
1027 } 1028 }
OLDNEW
« 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