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

Side by Side Diff: media/gpu/video_decode_accelerator_unittest.cc

Issue 2927893002: Remove FORMAT_RGB from gfx::PngCodec (Closed)
Patch Set: Fix win compile errors Created 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // The bulk of this file is support code; sorry about that. Here's an overview 5 // The bulk of this file is support code; sorry about that. Here's an overview
6 // to hopefully help readers of this code: 6 // to hopefully help readers of this code:
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or
8 // Win/EGL. 8 // Win/EGL.
9 // - ClientState is an enum for the state of the decode client used by the test. 9 // - ClientState is an enum for the state of the decode client used by the test.
10 // - ClientStateNotification is a barrier abstraction that allows the test code 10 // - ClientStateNotification is a barrier abstraction that allows the test code
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 LOG(INFO) << "Decoder " << i << " fps: " << client->frames_per_second(); 1520 LOG(INFO) << "Decoder " << i << " fps: " << client->frames_per_second();
1521 if (!render_as_thumbnails) { 1521 if (!render_as_thumbnails) {
1522 int min_fps = suppress_rendering ? video_file->min_fps_no_render 1522 int min_fps = suppress_rendering ? video_file->min_fps_no_render
1523 : video_file->min_fps_render; 1523 : video_file->min_fps_render;
1524 if (min_fps > 0 && !test_reuse_delay) 1524 if (min_fps > 0 && !test_reuse_delay)
1525 EXPECT_GT(client->frames_per_second(), min_fps); 1525 EXPECT_GT(client->frames_per_second(), min_fps);
1526 } 1526 }
1527 } 1527 }
1528 1528
1529 if (render_as_thumbnails) { 1529 if (render_as_thumbnails) {
1530 std::vector<unsigned char> rgb; 1530 std::vector<unsigned char> rgba;
1531 bool alpha_solid; 1531 bool alpha_solid;
1532 base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC, 1532 base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC,
1533 base::WaitableEvent::InitialState::NOT_SIGNALED); 1533 base::WaitableEvent::InitialState::NOT_SIGNALED);
1534 g_env->GetRenderingTaskRunner()->PostTask( 1534 g_env->GetRenderingTaskRunner()->PostTask(
1535 FROM_HERE, base::Bind(&RenderingHelper::GetThumbnailsAsRGB, 1535 FROM_HERE, base::Bind(&RenderingHelper::GetThumbnailsAsRGBA,
1536 base::Unretained(&rendering_helper_), &rgb, 1536 base::Unretained(&rendering_helper_), &rgba,
1537 &alpha_solid, &done)); 1537 &alpha_solid, &done));
1538 done.Wait(); 1538 done.Wait();
1539 1539
1540 std::vector<std::string> golden_md5s; 1540 std::vector<std::string> golden_md5s;
1541 std::string md5_string = base::MD5String( 1541 std::string md5_string = base::MD5String(
1542 base::StringPiece(reinterpret_cast<char*>(&rgb[0]), rgb.size())); 1542 base::StringPiece(reinterpret_cast<char*>(&rgba[0]), rgba.size()));
1543 ReadGoldenThumbnailMD5s(test_video_files_[0].get(), &golden_md5s); 1543 ReadGoldenThumbnailMD5s(test_video_files_[0].get(), &golden_md5s);
1544 std::vector<std::string>::iterator match = 1544 std::vector<std::string>::iterator match =
1545 find(golden_md5s.begin(), golden_md5s.end(), md5_string); 1545 find(golden_md5s.begin(), golden_md5s.end(), md5_string);
1546 if (match == golden_md5s.end()) { 1546 if (match == golden_md5s.end()) {
1547 // Convert raw RGB into PNG for export. 1547 // Convert raw RGBA into PNG for export.
1548 std::vector<unsigned char> png; 1548 std::vector<unsigned char> png;
1549 gfx::PNGCodec::Encode(&rgb[0], 1549 gfx::PNGCodec::Encode(&rgba[0], gfx::PNGCodec::FORMAT_RGBA,
1550 gfx::PNGCodec::FORMAT_RGB,
1551 kThumbnailsPageSize, 1550 kThumbnailsPageSize,
1552 kThumbnailsPageSize.width() * 3, 1551 kThumbnailsPageSize.width() * 4, true,
1553 true, 1552 std::vector<gfx::PNGCodec::Comment>(), &png);
1554 std::vector<gfx::PNGCodec::Comment>(),
1555 &png);
1556 1553
1557 LOG(ERROR) << "Unknown thumbnails MD5: " << md5_string; 1554 LOG(ERROR) << "Unknown thumbnails MD5: " << md5_string;
1558 1555
1559 base::FilePath filepath(test_video_files_[0]->file_name); 1556 base::FilePath filepath(test_video_files_[0]->file_name);
1560 if (!g_thumbnail_output_dir.empty() && 1557 if (!g_thumbnail_output_dir.empty() &&
1561 base::DirectoryExists(g_thumbnail_output_dir)) { 1558 base::DirectoryExists(g_thumbnail_output_dir)) {
1562 // Write bad thumbnails image to where --thumbnail_output_dir assigned. 1559 // Write bad thumbnails image to where --thumbnail_output_dir assigned.
1563 filepath = g_thumbnail_output_dir.Append(filepath.BaseName()); 1560 filepath = g_thumbnail_output_dir.Append(filepath.BaseName());
1564 } else { 1561 } else {
1565 // Fallback to write to test data directory. 1562 // Fallback to write to test data directory.
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 media::g_thumbnail_output_dir = base::FilePath(it->second.c_str()); 1915 media::g_thumbnail_output_dir = base::FilePath(it->second.c_str());
1919 } 1916 }
1920 } 1917 }
1921 1918
1922 base::ShadowingAtExitManager at_exit_manager; 1919 base::ShadowingAtExitManager at_exit_manager;
1923 1920
1924 return base::LaunchUnitTestsSerially( 1921 return base::LaunchUnitTestsSerially(
1925 argc, argv, 1922 argc, argv,
1926 base::Bind(&media::VDATestSuite::Run, base::Unretained(&test_suite))); 1923 base::Bind(&media::VDATestSuite::Run, base::Unretained(&test_suite)));
1927 } 1924 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698