19 #ifndef PAGESPEED_KERNEL_IMAGE_WEBP_OPTIMIZER_H_
20 #define PAGESPEED_KERNEL_IMAGE_WEBP_OPTIMIZER_H_
23 #include "third_party/libwebp/src/webp/encode.h"
24 #include "third_party/libwebp/src/webp/mux.h"
33 namespace net_instaweb {
39 namespace image_compression {
56 void CopyTo(WebPConfig* webp_config)
const;
120 static int ProgressHook(
int percent,
const WebPPicture* picture);
126 void FreeWebpStructs();
137 size_px next_scanline_;
147 size_px frame_stride_px_;
151 uint32_t* frame_position_px_;
154 uint32_t frame_bytes_per_pixel_;
157 WebPPicture webp_image_;
160 WebPPicture* webp_image_restore_;
166 WebPAnimEncoder* webp_encoder_;
169 WebPConfig libwebp_config_;
185 bool image_prepared_;
193 void* progress_hook_data_;
198 bool should_expand_gray_to_rgb_;
217 virtual bool Reset();
222 size_t buffer_length);
241 const uint8_t* image_buffer_;
244 PixelFormat pixel_format_;
247 size_t bytes_per_row_;
249 bool was_initialized_;
virtual ScanlineStatus WriteNextScanline(const void *scanline_bytes)
virtual ScanlineStatus FinalizeWrite()
int target_size
Parameters related to lossy compression only:
Definition: webp_optimizer.h:63
Definition: scanline_status.h:93
int alpha_quality
0: none, 1: fast, 2: best. Default is 1.
Definition: webp_optimizer.h:69
virtual PixelFormat GetPixelFormat()
Returns the pixel format that need to be used by writer.
Definition: webp_optimizer.h:233
WebpProgressHook progress_hook
If non-NULL, called during encoding.
Definition: webp_optimizer.h:81
virtual bool IsProgressive()
WebP does not have progressive mode.
Definition: webp_optimizer.h:237
virtual bool Reset()
Reset the scanline reader to its initial state.
bool(* WebpProgressHook)(int percent, void *user_data)
Definition: webp_optimizer.h:47
Definition: image_frame_interface.h:279
virtual size_t GetBytesPerScanline()
Return the number of bytes in a row (without padding).
Definition: webp_optimizer.h:230
virtual ScanlineStatus PrepareNextFrame(const FrameSpec *frame_spec)
frame_spec must remain valid while the frame is being written.
int method
quality/speed trade-off (0=fast, 6=slower-better)
Definition: webp_optimizer.h:60
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
int alpha_filtering
1 = compressed with WebP lossless). Default is 1.
Definition: webp_optimizer.h:67
Definition: webp_optimizer.h:93
Definition: webp_optimizer.h:211
Definition: image_frame_interface.h:43
Definition: image_frame_interface.h:79
Definition: webp_optimizer.h:43
virtual ScanlineStatus PrepareImage(const ImageSpec *image_spec)
Definition: scanline_interface.h:32
float quality
between 0 (smallest file) and 100 (biggest)
Definition: webp_optimizer.h:59
int alpha_compression
Takes precedence over the 'compression' parameter.
Definition: webp_optimizer.h:65
virtual size_t GetImageHeight()
Returns the height of the image.
Definition: webp_optimizer.h:234
size_px kmax
Maximum keyframe interval.
Definition: webp_optimizer.h:79
int lossless
Lossless encoding (0=lossy(default), 1=lossless).
Definition: webp_optimizer.h:58
Definition: image_util.h:198
virtual bool HasMoreScanLines()
Returns true if there are more scanlines to read.
Definition: webp_optimizer.h:232
virtual ScanlineStatus Initialize(const void *config, GoogleString *out)
Definition: message_handler.h:39
void * user_data
Definition: webp_optimizer.h:83
virtual size_t GetImageWidth()
Returns the width of the image.
Definition: webp_optimizer.h:235
virtual ScanlineStatus ReadNextScanlineWithStatus(void **out_scanline_bytes)
virtual ScanlineStatus InitializeWithStatus(const void *image_buffer, size_t buffer_length)
size_px kmin
Default is 100.
Definition: webp_optimizer.h:73