32 case VP8_ENC_ERROR_OUT_OF_MEMORY:
33 case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY:
35 case VP8_ENC_ERROR_NULL_PARAMETER:
36 case VP8_ENC_ERROR_INVALID_CONFIGURATION:
37 case VP8_ENC_ERROR_BAD_DIMENSION:
58 if (s->
preset >= WEBP_PRESET_DEFAULT) {
66 ret = WebPConfigInit(&s->
config);
74 ret = WebPValidateConfig(&s->
config);
88 WebPPicture **pic_ptr) {
90 WebPPicture *pic =
NULL;
93 if (avctx->
width > WEBP_MAX_DIMENSION || avctx->
height > WEBP_MAX_DIMENSION) {
95 WEBP_MAX_DIMENSION, WEBP_MAX_DIMENSION);
104 ret = WebPPictureInit(pic);
109 pic->width = avctx->
width;
110 pic->height = avctx->
height;
118 "Using libwebp for RGB-to-YUV conversion. You may want "
119 "to consider passing in YUV instead for lossy "
125 pic->argb = (uint32_t *)frame->
data[0];
126 pic->argb_stride = frame->
linesize[0] / 4;
131 "Copying frame due to differing chroma linesizes.\n");
135 alt_frame = *alt_frame_ptr;
164 for (y = 0; y < frame->
height; y+= bs) {
165 for (x = 0; x < frame->
width; x+= bs) {
168 for (p = 0; p < 3; p++) {
174 for (y2 = ys; y2 <
FFMIN(ys + bs2, h); y2++) {
175 for (x2 = xs; x2 <
FFMIN(xs + bs2, w); x2++) {
184 for (p = 0; p < 3; p++) {
190 for (y2 = ys; y2 <
FFMIN(ys + bs2, h); y2++) {
192 & frame->
data[p][frame->
linesize[p] * y2 + xs], FFMIN(bs2, w-xs));
195 for (y2 = y; y2 <
FFMIN(y+bs, frame->
height); y2++) {
198 FFMIN(bs, frame->
width-x));
206 pic->y = frame->
data[0];
207 pic->u = frame->
data[1];
208 pic->v = frame->
data[2];
210 pic->uv_stride = frame->
linesize[1];
212 pic->colorspace = WEBP_YUV420A;
213 pic->a = frame->
data[3];
216 WebPCleanupTransparentArea(pic);
218 pic->colorspace = WEBP_YUV420;
228 "Using libwebp for YUV-to-RGB conversion. You may want "
229 "to consider passing in RGB instead for lossless "
234 #if (WEBP_ENCODER_ABI_VERSION <= 0x201)
239 pic->memory_ = (
void*)1;
240 ret = WebPPictureYUVAToARGB(pic);
243 "WebPPictureYUVAToARGB() failed with error: %d\n",
245 ret = libwebp_error_to_averror(pic->error_code);
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int sse(MpegEncContext *s, uint8_t *src1, uint8_t *src2, int w, int h, int stride)
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static av_cold int end(AVCodecContext *avctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
WebP encoder using libwebp: common structs and methods.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s, const AVFrame *frame, AVFrame **alt_frame_ptr, WebPPicture **pic_ptr)
av_cold int ff_libwebp_encode_init_common(AVCodecContext *avctx)
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
int width
picture width / height.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
int ff_libwebp_error_to_averror(int err)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
int global_quality
Global quality for codecs which cannot change it per frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
static av_always_inline int diff(const uint32_t a, const uint32_t b)
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
#define AV_CEIL_RSHIFT(a, b)