Flutter Engine
The Flutter Engine
Classes | Macros | Functions | Variables
EncodeBench.cpp File Reference
#include "bench/Benchmark.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkStream.h"
#include "include/encode/SkJpegEncoder.h"
#include "include/encode/SkPngEncoder.h"
#include "include/encode/SkWebpEncoder.h"
#include "tools/DecodeUtils.h"

Go to the source code of this file.

Classes

class  EncodeBench
 

Macros

#define PNG(FLAG, ZLIBLEVEL)
 

Functions

static bool encode_jpeg (SkWStream *dst, const SkPixmap &src)
 
static bool encode_webp_lossy (SkWStream *dst, const SkPixmap &src)
 
static bool encode_webp_lossless (SkWStream *dst, const SkPixmap &src)
 
static bool encode_png (SkWStream *dst, const SkPixmap &src, SkPngEncoder::FilterFlag filters, int zlibLevel)
 
 DEF_BENCH (return new EncodeBench(srcs[0], &encode_jpeg, "JPEG"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], &encode_jpeg, "JPEG"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], encode_webp_lossy, "WEBP"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], encode_webp_lossy, "WEBP"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], encode_webp_lossless, "WEBP_LL"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], encode_webp_lossless, "WEBP_LL"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kAll, 6), "PNG"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kAll, 3), "PNG_3"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kAll, 1), "PNG_1"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kSub, 6), "PNG_6s"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kSub, 3), "PNG_3s"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kSub, 1), "PNG_1s"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kNone, 6), "PNG_6n"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kNone, 3), "PNG_3n"))
 
 DEF_BENCH (return new EncodeBench(srcs[0], PNG(kNone, 1), "PNG_1n"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kAll, 6), "PNG"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kAll, 3), "PNG_3"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kAll, 1), "PNG_1"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kSub, 6), "PNG_6s"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kSub, 3), "PNG_3s"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kSub, 1), "PNG_1s"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kNone, 6), "PNG_6n"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kNone, 3), "PNG_3n"))
 
 DEF_BENCH (return new EncodeBench(srcs[1], PNG(kNone, 1), "PNG_1n"))
 

Variables

static const char * srcs [2] = {"images/mandrill_512.png", "images/color_wheel.jpg"}
 

Macro Definition Documentation

◆ PNG

#define PNG (   FLAG,
  ZLIBLEVEL 
)
Value:
[](SkWStream* d, const SkPixmap& s) { \
return encode_png(d, s, SkPngEncoder::FilterFlag::FLAG, ZLIBLEVEL); }
static bool encode_png(SkWStream *dst, const SkPixmap &src, SkPngEncoder::FilterFlag filters, int zlibLevel)
Definition: EncodeBench.cpp:75
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
struct MyStruct s

Definition at line 85 of file EncodeBench.cpp.

Function Documentation

◆ DEF_BENCH() [1/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], &encode_jpeg, "JPEG")

◆ DEF_BENCH() [2/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], encode_webp_lossless, "WEBP_LL")

◆ DEF_BENCH() [3/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], encode_webp_lossy, "WEBP")

◆ DEF_BENCH() [4/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kAll, 1), "PNG_1")

◆ DEF_BENCH() [5/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kAll, 3), "PNG_3")

◆ DEF_BENCH() [6/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kAll, 6), "PNG")

◆ DEF_BENCH() [7/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kNone, 1), "PNG_1n")

◆ DEF_BENCH() [8/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kNone, 3), "PNG_3n")

◆ DEF_BENCH() [9/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kNone, 6), "PNG_6n")

◆ DEF_BENCH() [10/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kSub, 1), "PNG_1s")

◆ DEF_BENCH() [11/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kSub, 3), "PNG_3s")

◆ DEF_BENCH() [12/24]

DEF_BENCH ( return new   EncodeBenchsrcs[0], PNG(kSub, 6), "PNG_6s")

◆ DEF_BENCH() [13/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], &encode_jpeg, "JPEG")

◆ DEF_BENCH() [14/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], encode_webp_lossless, "WEBP_LL")

◆ DEF_BENCH() [15/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], encode_webp_lossy, "WEBP")

◆ DEF_BENCH() [16/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kAll, 1), "PNG_1")

◆ DEF_BENCH() [17/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kAll, 3), "PNG_3")

◆ DEF_BENCH() [18/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kAll, 6), "PNG")

◆ DEF_BENCH() [19/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kNone, 1), "PNG_1n")

◆ DEF_BENCH() [20/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kNone, 3), "PNG_3n")

◆ DEF_BENCH() [21/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kNone, 6), "PNG_6n")

◆ DEF_BENCH() [22/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kSub, 1), "PNG_1s")

◆ DEF_BENCH() [23/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kSub, 3), "PNG_3s")

◆ DEF_BENCH() [24/24]

DEF_BENCH ( return new   EncodeBenchsrcs[1], PNG(kSub, 6), "PNG_6s")

◆ encode_jpeg()

static bool encode_jpeg ( SkWStream dst,
const SkPixmap src 
)
static

Definition at line 55 of file EncodeBench.cpp.

55 {
57 opts.fQuality = 90;
58 return SkJpegEncoder::Encode(dst, src, opts);
59}
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
dst
Definition: cp.py:12

◆ encode_png()

static bool encode_png ( SkWStream dst,
const SkPixmap src,
SkPngEncoder::FilterFlag  filters,
int  zlibLevel 
)
static

Definition at line 75 of file EncodeBench.cpp.

78 {
80 opts.fFilterFlags = filters;
81 opts.fZLibLevel = zlibLevel;
82 return SkPngEncoder::Encode(dst, src, opts);
83}
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
FilterFlag fFilterFlags
Definition: SkPngEncoder.h:56

◆ encode_webp_lossless()

static bool encode_webp_lossless ( SkWStream dst,
const SkPixmap src 
)
static

Definition at line 68 of file EncodeBench.cpp.

68 {
71 opts.fQuality = 90;
72 return SkWebpEncoder::Encode(dst, src, opts);
73}
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
Compression fCompression
Definition: SkWebpEncoder.h:43

◆ encode_webp_lossy()

static bool encode_webp_lossy ( SkWStream dst,
const SkPixmap src 
)
static

Definition at line 61 of file EncodeBench.cpp.

Variable Documentation

◆ srcs

const char* srcs[2] = {"images/mandrill_512.png", "images/color_wheel.jpg"}
static

Definition at line 88 of file EncodeBench.cpp.