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

Side by Side Diff: bench/nanobench.cpp

Issue 2035793002: Add color correction benchmark - with comparison to qcms (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 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 | « bench/ColorCodecBench.cpp ('k') | include/codec/SkCodec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <ctype.h> 8 #include <ctype.h>
9 9
10 #include "nanobench.h" 10 #include "nanobench.h"
11 11
12 #include "AndroidCodecBench.h" 12 #include "AndroidCodecBench.h"
13 #include "Benchmark.h" 13 #include "Benchmark.h"
14 #include "BitmapRegionDecoderBench.h" 14 #include "BitmapRegionDecoderBench.h"
15 #include "CodecBench.h" 15 #include "CodecBench.h"
16 #include "CodecBenchPriv.h" 16 #include "CodecBenchPriv.h"
17 #include "ColorCodecBench.h"
17 #include "CrashHandler.h" 18 #include "CrashHandler.h"
18 #include "GMBench.h" 19 #include "GMBench.h"
19 #include "ProcStats.h" 20 #include "ProcStats.h"
20 #include "ResultsWriter.h" 21 #include "ResultsWriter.h"
21 #include "RecordingBench.h" 22 #include "RecordingBench.h"
22 #include "SKPAnimationBench.h" 23 #include "SKPAnimationBench.h"
23 #include "SKPBench.h" 24 #include "SKPBench.h"
24 #include "Stats.h" 25 #include "Stats.h"
25 26
26 #include "SkAndroidCodec.h" 27 #include "SkAndroidCodec.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 public: 552 public:
552 BenchmarkStream() : fBenches(BenchRegistry::Head()) 553 BenchmarkStream() : fBenches(BenchRegistry::Head())
553 , fGMs(skiagm::GMRegistry::Head()) 554 , fGMs(skiagm::GMRegistry::Head())
554 , fCurrentRecording(0) 555 , fCurrentRecording(0)
555 , fCurrentScale(0) 556 , fCurrentScale(0)
556 , fCurrentSKP(0) 557 , fCurrentSKP(0)
557 , fCurrentUseMPD(0) 558 , fCurrentUseMPD(0)
558 , fCurrentCodec(0) 559 , fCurrentCodec(0)
559 , fCurrentAndroidCodec(0) 560 , fCurrentAndroidCodec(0)
560 , fCurrentBRDImage(0) 561 , fCurrentBRDImage(0)
562 , fCurrentColorImage(0)
561 , fCurrentColorType(0) 563 , fCurrentColorType(0)
562 , fCurrentAlphaType(0) 564 , fCurrentAlphaType(0)
563 , fCurrentSubsetType(0) 565 , fCurrentSubsetType(0)
564 , fCurrentSampleSize(0) 566 , fCurrentSampleSize(0)
565 , fCurrentAnimSKP(0) { 567 , fCurrentAnimSKP(0) {
566 for (int i = 0; i < FLAGS_skps.count(); i++) { 568 for (int i = 0; i < FLAGS_skps.count(); i++) {
567 if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { 569 if (SkStrEndsWith(FLAGS_skps[i], ".skp")) {
568 fSKPs.push_back() = FLAGS_skps[i]; 570 fSKPs.push_back() = FLAGS_skps[i];
569 } else { 571 } else {
570 SkOSFile::Iter it(FLAGS_skps[i], ".skp"); 572 SkOSFile::Iter it(FLAGS_skps[i], ".skp");
(...skipping 24 matching lines...) Expand all
595 597
596 if (FLAGS_mpd) { 598 if (FLAGS_mpd) {
597 fUseMPDs.push_back() = true; 599 fUseMPDs.push_back() = true;
598 } 600 }
599 fUseMPDs.push_back() = false; 601 fUseMPDs.push_back() = false;
600 602
601 // Prepare the images for decoding 603 // Prepare the images for decoding
602 if (!CollectImages(FLAGS_images, &fImages)) { 604 if (!CollectImages(FLAGS_images, &fImages)) {
603 exit(1); 605 exit(1);
604 } 606 }
607 if (!CollectImages(FLAGS_colorImages, &fColorImages)) {
608 exit(1);
609 }
605 610
606 // Choose the candidate color types for image decoding 611 // Choose the candidate color types for image decoding
607 const SkColorType colorTypes[] = 612 const SkColorType colorTypes[] =
608 { kN32_SkColorType, 613 { kN32_SkColorType,
609 kRGB_565_SkColorType, 614 kRGB_565_SkColorType,
610 kAlpha_8_SkColorType, 615 kAlpha_8_SkColorType,
611 kIndex_8_SkColorType, 616 kIndex_8_SkColorType,
612 kGray_8_SkColorType }; 617 kGray_8_SkColorType };
613 fColorTypes.reset(colorTypes, SK_ARRAY_COUNT(colorTypes)); 618 fColorTypes.reset(colorTypes, SK_ARRAY_COUNT(colorTypes));
614 } 619 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 } 915 }
911 fCurrentSubsetType = 0; 916 fCurrentSubsetType = 0;
912 fCurrentSampleSize++; 917 fCurrentSampleSize++;
913 } 918 }
914 fCurrentSampleSize = 0; 919 fCurrentSampleSize = 0;
915 fCurrentColorType++; 920 fCurrentColorType++;
916 } 921 }
917 fCurrentColorType = 0; 922 fCurrentColorType = 0;
918 } 923 }
919 924
925 while (fCurrentColorImage < fColorImages.count()) {
926 fSourceType = "colorimage";
927 fBenchType = "skcolorcodec";
928 const SkString& path = fColorImages[fCurrentColorImage];
929 fCurrentColorImage++;
930 sk_sp<SkData> encoded = SkData::MakeFromFileName(path.c_str());
931 if (encoded) {
932 return new ColorCodecBench(SkOSPath::Basename(path.c_str()).c_st r(),
933 std::move(encoded));
934 } else {
935 SkDebugf("Could not read file %s.\n", path.c_str());
936 }
937 }
938
920 return nullptr; 939 return nullptr;
921 } 940 }
922 941
923 void fillCurrentOptions(ResultsWriter* log) const { 942 void fillCurrentOptions(ResultsWriter* log) const {
924 log->configOption("source_type", fSourceType); 943 log->configOption("source_type", fSourceType);
925 log->configOption("bench_type", fBenchType); 944 log->configOption("bench_type", fBenchType);
926 if (0 == strcmp(fSourceType, "skp")) { 945 if (0 == strcmp(fSourceType, "skp")) {
927 log->configOption("clip", 946 log->configOption("clip",
928 SkStringPrintf("%d %d %d %d", fClip.fLeft, fClip.fTop, 947 SkStringPrintf("%d %d %d %d", fClip.fLeft, fClip.fTop,
929 fClip.fRight, fClip.fBottom).c _str()); 948 fClip.fRight, fClip.fBottom).c _str());
(...skipping 23 matching lines...) Expand all
953 kLastSingle_SubsetType = kBottomRight_SubsetType, 972 kLastSingle_SubsetType = kBottomRight_SubsetType,
954 }; 973 };
955 974
956 const BenchRegistry* fBenches; 975 const BenchRegistry* fBenches;
957 const skiagm::GMRegistry* fGMs; 976 const skiagm::GMRegistry* fGMs;
958 SkIRect fClip; 977 SkIRect fClip;
959 SkTArray<SkScalar> fScales; 978 SkTArray<SkScalar> fScales;
960 SkTArray<SkString> fSKPs; 979 SkTArray<SkString> fSKPs;
961 SkTArray<bool> fUseMPDs; 980 SkTArray<bool> fUseMPDs;
962 SkTArray<SkString> fImages; 981 SkTArray<SkString> fImages;
982 SkTArray<SkString> fColorImages;
963 SkTArray<SkColorType, true> fColorTypes; 983 SkTArray<SkColorType, true> fColorTypes;
964 SkScalar fZoomMax; 984 SkScalar fZoomMax;
965 double fZoomPeriodMs; 985 double fZoomPeriodMs;
966 986
967 double fSKPBytes, fSKPOps; 987 double fSKPBytes, fSKPOps;
968 988
969 const char* fSourceType; // What we're benching: bench, GM, SKP, ... 989 const char* fSourceType; // What we're benching: bench, GM, SKP, ...
970 const char* fBenchType; // How we bench it: micro, recording, playback, .. . 990 const char* fBenchType; // How we bench it: micro, recording, playback, .. .
971 int fCurrentRecording; 991 int fCurrentRecording;
972 int fCurrentScale; 992 int fCurrentScale;
973 int fCurrentSKP; 993 int fCurrentSKP;
974 int fCurrentUseMPD; 994 int fCurrentUseMPD;
975 int fCurrentCodec; 995 int fCurrentCodec;
976 int fCurrentAndroidCodec; 996 int fCurrentAndroidCodec;
977 int fCurrentBRDImage; 997 int fCurrentBRDImage;
998 int fCurrentColorImage;
978 int fCurrentColorType; 999 int fCurrentColorType;
979 int fCurrentAlphaType; 1000 int fCurrentAlphaType;
980 int fCurrentSubsetType; 1001 int fCurrentSubsetType;
981 int fCurrentSampleSize; 1002 int fCurrentSampleSize;
982 int fCurrentAnimSKP; 1003 int fCurrentAnimSKP;
983 }; 1004 };
984 1005
985 // Some runs (mostly, Valgrind) are so slow that the bot framework thinks we've hung. 1006 // Some runs (mostly, Valgrind) are so slow that the bot framework thinks we've hung.
986 // This prints something every once in a while so that it knows we're still work ing. 1007 // This prints something every once in a while so that it knows we're still work ing.
987 static void start_keepalive() { 1008 static void start_keepalive() {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 1286
1266 return 0; 1287 return 0;
1267 } 1288 }
1268 1289
1269 #if !defined SK_BUILD_FOR_IOS 1290 #if !defined SK_BUILD_FOR_IOS
1270 int main(int argc, char** argv) { 1291 int main(int argc, char** argv) {
1271 SkCommandLineFlags::Parse(argc, argv); 1292 SkCommandLineFlags::Parse(argc, argv);
1272 return nanobench_main(); 1293 return nanobench_main();
1273 } 1294 }
1274 #endif 1295 #endif
OLDNEW
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | include/codec/SkCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698