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.
#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.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
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.
#define xs(width, name, var, subs,...)
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
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
#define AV_CEIL_RSHIFT(a, b)