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

Side by Side Diff: fuzz/FuzzPaeth.cpp

Issue 1711753002: Remove FuzzPaeth now that we have some real Fuzzes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 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
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "Fuzz.h"
9 #include <stdlib.h>
10
11 // This really is just an example Fuzz*.cpp file.
12 // It tests that two different ways of calculating the Paeth predictor function are equivalent.
13
14 static uint8_t paeth_std(uint8_t a, uint8_t b, uint8_t c) {
15 int p = a+b-c;
16
17 int pa = abs(p-a),
18 pb = abs(p-b),
19 pc = abs(p-c);
20
21 if (pb < pa) { pa = pb; a = b; }
22 if (pc < pa) { a = c; }
23 return a;
24 }
25
26 static uint8_t paeth_alt(uint8_t a, uint8_t b, uint8_t c) {
27 int min = SkTMin(a,b),
28 max = SkTMax(a,b);
29 int delta = (max-min)/3;
30
31 if (c <= min+delta) return max;
32 if (c >= max-delta) return min;
33 return c;
34 }
35
36 DEF_FUZZ(Paeth, fuzz) {
37 auto a = fuzz->nextB(),
38 b = fuzz->nextB(),
39 c = fuzz->nextB();
40 SkDebugf("Paeth(%d,%d,%d)\n", a,b,c);
41
42 if (a == b && b == c) {
43 fuzz->signalBoring(); // Not really boring, just demoing signalBoring() .
44 }
45
46 if (paeth_alt(a,b,c) != paeth_std(a,b,c)) {
47 fuzz->signalBug();
48 }
49 }
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