FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
libwebpenc.c File Reference

WebP encoder using libwebp. More...

#include <webp/encode.h>
#include "libavutil/common.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  LibWebPContext
 

Macros

#define OFFSET(x)   offsetof(LibWebPContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int libwebp_error_to_averror (int err)
 
static av_cold int libwebp_encode_init (AVCodecContext *avctx)
 
static int libwebp_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static int libwebp_encode_close (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
class {
      class_name = "libwebp"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
static const AVCodecDefault libwebp_defaults []
 
AVCodec ff_libwebp_encoder
 

Detailed Description

WebP encoder using libwebp.

Definition in file libwebpenc.c.

Macro Definition Documentation

#define OFFSET (   x)    offsetof(LibWebPContext, x)

Definition at line 315 of file libwebpenc.c.

Definition at line 316 of file libwebpenc.c.

Function Documentation

static int libwebp_error_to_averror ( int  err)
static

Definition at line 49 of file libwebpenc.c.

Referenced by libwebp_encode_frame().

static av_cold int libwebp_encode_init ( AVCodecContext avctx)
static

Definition at line 63 of file libwebpenc.c.

static int libwebp_encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame frame,
int *  got_packet 
)
static

Definition at line 106 of file libwebpenc.c.

static int libwebp_encode_close ( AVCodecContext avctx)
static

Definition at line 306 of file libwebpenc.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{ "lossless", "Use lossless mode", OFFSET(lossless), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
{ "preset", "Configuration preset", OFFSET(preset), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, WEBP_PRESET_TEXT, VE, "preset" },
{ "none", "do not use a preset", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, VE, "preset" },
{ "default", "default preset", 0, AV_OPT_TYPE_CONST, { .i64 = WEBP_PRESET_DEFAULT }, 0, 0, VE, "preset" },
{ "picture", "digital picture, like portrait, inner shot", 0, AV_OPT_TYPE_CONST, { .i64 = WEBP_PRESET_PICTURE }, 0, 0, VE, "preset" },
{ "photo", "outdoor photograph, with natural lighting", 0, AV_OPT_TYPE_CONST, { .i64 = WEBP_PRESET_PHOTO }, 0, 0, VE, "preset" },
{ "drawing", "hand or line drawing, with high-contrast details", 0, AV_OPT_TYPE_CONST, { .i64 = WEBP_PRESET_DRAWING }, 0, 0, VE, "preset" },
{ "icon", "small-sized colorful images", 0, AV_OPT_TYPE_CONST, { .i64 = WEBP_PRESET_ICON }, 0, 0, VE, "preset" },
{ "text", "text-like", 0, AV_OPT_TYPE_CONST, { .i64 = WEBP_PRESET_TEXT }, 0, 0, VE, "preset" },
{ "cr_threshold","Conditional replenishment threshold", OFFSET(cr_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
{ "cr_size" ,"Conditional replenishment block size", OFFSET(cr_size) , AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 256, VE },
{ "quality" ,"Quality", OFFSET(quality), AV_OPT_TYPE_FLOAT, { .dbl = 75 }, 0, 100, VE },
{ NULL },
}

Definition at line 317 of file libwebpenc.c.

class_name = "libwebp"

Definition at line 335 of file libwebpenc.c.

Referenced by av_opt_show2().

item_name = av_default_item_name

Definition at line 336 of file libwebpenc.c.

option = options

Definition at line 338 of file libwebpenc.c.

const { ... }
const AVCodecDefault libwebp_defaults[]
static
Initial value:
= {
{ "compression_level", "4" },
{ "global_quality", "-1" },
{ NULL },
}

Definition at line 341 of file libwebpenc.c.

AVCodec ff_libwebp_encoder
Initial value:
= {
.name = "libwebp",
.long_name = NULL_IF_CONFIG_SMALL("libwebp WebP image"),
.priv_data_size = sizeof(LibWebPContext),
.pix_fmts = (const enum AVPixelFormat[]) {
},
.priv_class = &class,
.defaults = libwebp_defaults,
}

Definition at line 347 of file libwebpenc.c.