1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit 'c4bfa098072ba338d83555d6e2199f7e1e64ffff'

* commit 'c4bfa098072ba338d83555d6e2199f7e1e64ffff':
  Add a WebP decoder

Conflicts:
	Changelog
	doc/general.texi
	libavcodec/Makefile
	libavcodec/avcodec.h
	libavcodec/version.h
	libavformat/img2.c

The previously existing webp decoder is disabled as the new
one supports lossless mode and alpha while the previous does not.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-09-19 12:06:39 +02:00
commit b26ccf218d
10 changed files with 1502 additions and 33 deletions

View File

@ -26,6 +26,7 @@ version <next>
- adelay filter
- pullup filter ported from libmpcodecs
- ffprobe -read_intervals option
- Lossless and alpha support for WebP decoder
version 2.0:

View File

@ -488,6 +488,8 @@ following image formats are supported:
@tab YUV, JPEG and some extension is not supported yet.
@item Truevision Targa @tab X @tab X
@tab Targa (.TGA) image format
@item WebP @tab @tab X
@tab WebP image format
@item XBM @tab X @tab X
@tab X BitMap image format
@item XFace @tab X @tab X

View File

@ -476,6 +476,7 @@ OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
OBJS-$(CONFIG_WAVPACK_ENCODER) += wavpackenc.o
OBJS-$(CONFIG_WEBP_DECODER) += vp8.o vp8dsp.o vp56rac.o
OBJS-$(CONFIG_WEBP_DECODER) += webp.o
OBJS-$(CONFIG_WEBVTT_DECODER) += webvttdec.o
OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma_common.o
OBJS-$(CONFIG_WMAPRO_DECODER) += wmaprodec.o wma.o wma_common.o

View File

@ -275,6 +275,7 @@ enum AVCodecID {
AV_CODEC_ID_AIC,
AV_CODEC_ID_ESCAPE130_DEPRECATED,
AV_CODEC_ID_G2M_DEPRECATED,
AV_CODEC_ID_WEBP_DEPRECATED,
AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),

View File

@ -1044,13 +1044,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Google VP9"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_WEBP,
.type = AVMEDIA_TYPE_VIDEO,
.name = "webp",
.long_name = NULL_IF_CONFIG_SMALL("WebP"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_PICTOR,
.type = AVMEDIA_TYPE_VIDEO,
@ -1393,6 +1386,14 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Go2Meeting"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_WEBP,
.type = AVMEDIA_TYPE_VIDEO,
.name = "webp",
.long_name = NULL_IF_CONFIG_SMALL("WebP"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
AV_CODEC_PROP_LOSSLESS,
},
/* various PCM "codecs" */
{

View File

@ -2487,6 +2487,7 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
case AV_CODEC_ID_TAK_DEPRECATED : return AV_CODEC_ID_TAK;
case AV_CODEC_ID_ESCAPE130_DEPRECATED : return AV_CODEC_ID_ESCAPE130;
case AV_CODEC_ID_G2M_DEPRECATED : return AV_CODEC_ID_G2M;
case AV_CODEC_ID_WEBP_DEPRECATED: return AV_CODEC_ID_WEBP;
default : return id;
}
}

View File

@ -29,8 +29,8 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 31
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_MINOR 32
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

View File

@ -1854,8 +1854,8 @@ static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata,
return 0;
}
static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
VP8Context *s = avctx->priv_data;
int ret, i, referenced, num_jobs;
@ -2009,7 +2009,7 @@ err:
return ret;
}
static av_cold int vp8_decode_free(AVCodecContext *avctx)
av_cold int ff_vp8_decode_free(AVCodecContext *avctx)
{
VP8Context *s = avctx->priv_data;
int i;
@ -2032,7 +2032,7 @@ static av_cold int vp8_init_frames(VP8Context *s)
return 0;
}
static av_cold int vp8_decode_init(AVCodecContext *avctx)
av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
{
VP8Context *s = avctx->priv_data;
int ret;
@ -2046,7 +2046,7 @@ static av_cold int vp8_decode_init(AVCodecContext *avctx)
ff_vp8dsp_init(&s->vp8dsp);
if ((ret = vp8_init_frames(s)) < 0) {
vp8_decode_free(avctx);
ff_vp8_decode_free(avctx);
return ret;
}
@ -2061,7 +2061,7 @@ static av_cold int vp8_decode_init_thread_copy(AVCodecContext *avctx)
s->avctx = avctx;
if ((ret = vp8_init_frames(s)) < 0) {
vp8_decode_free(avctx);
ff_vp8_decode_free(avctx);
return ret;
}
@ -2147,7 +2147,7 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
pkt.data = buf;
pkt.size = buf_size;
return vp8_decode_frame(avctx, data, data_size, &pkt);
return ff_vp8_decode_frame(avctx, data, data_size, &pkt);
}
AVCodec ff_vp8_decoder = {
@ -2155,9 +2155,9 @@ AVCodec ff_vp8_decoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VP8,
.priv_data_size = sizeof(VP8Context),
.init = vp8_decode_init,
.close = vp8_decode_free,
.decode = vp8_decode_frame,
.init = ff_vp8_decode_init,
.close = ff_vp8_decode_free,
.decode = ff_vp8_decode_frame,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS | CODEC_CAP_SLICE_THREADS,
.flush = vp8_decode_flush,
.long_name = NULL_IF_CONFIG_SMALL("On2 VP8"),
@ -2165,17 +2165,17 @@ AVCodec ff_vp8_decoder = {
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp8_decode_update_thread_context),
};
AVCodec ff_webp_decoder = {
.name = "webp",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_WEBP,
.priv_data_size = sizeof(VP8Context),
.init = vp8_decode_init,
.close = vp8_decode_free,
.decode = webp_decode_frame,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS | CODEC_CAP_SLICE_THREADS,
.flush = vp8_decode_flush,
.long_name = NULL_IF_CONFIG_SMALL("WebP"),
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp8_decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp8_decode_update_thread_context),
};
// AVCodec ff_webp_decoder = {
// .name = "webp",
// .type = AVMEDIA_TYPE_VIDEO,
// .id = AV_CODEC_ID_WEBP,
// .priv_data_size = sizeof(VP8Context),
// .init = vp8_decode_init,
// .close = vp8_decode_free,
// .decode = webp_decode_frame,
// .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS | CODEC_CAP_SLICE_THREADS,
// .flush = vp8_decode_flush,
// .long_name = NULL_IF_CONFIG_SMALL("WebP"),
// .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp8_decode_init_thread_copy),
// .update_thread_context = ONLY_IF_THREADS_ENABLED(vp8_decode_update_thread_context),
// };

View File

@ -271,4 +271,11 @@ typedef struct VP8Context {
int mb_layout;
} VP8Context;
int ff_vp8_decode_init(AVCodecContext *avctx);
int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt);
int ff_vp8_decode_free(AVCodecContext *avctx);
#endif /* AVCODEC_VP8_H */

1455
libavcodec/webp.c Normal file

File diff suppressed because it is too large Load Diff