Add a WebP decoder

Container and lossy decoding by Aneesh Dogra <aneesh@sugarlabs.org>
Lossless decoding by Justin Ruggles <justin.ruggles@gmail.com>
This commit is contained in:
Justin Ruggles 2013-04-16 22:42:26 +05:30
parent 9ae53c5860
commit c4bfa09807
12 changed files with 1488 additions and 10 deletions

View File

@ -33,6 +33,7 @@ version 10:
- avconv -t option can now be used for inputs, to limit the duration of
data read from an input file
- incomplete Voxware MetaSound decoder
- WebP decoder
version 9:

1
configure vendored
View File

@ -1692,6 +1692,7 @@ vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
vp6a_decoder_select="vp6_decoder"
vp6f_decoder_select="vp6_decoder"
vp8_decoder_select="h264pred videodsp"
webp_decoder_select="vp8_decoder"
wmapro_decoder_select="mdct sinewin"
wmav1_decoder_select="mdct sinewin"
wmav1_encoder_select="mdct sinewin"

View File

@ -412,6 +412,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
@tab X BitMap image format
@item XWD @tab X @tab X

View File

@ -390,6 +390,7 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o vp56dsp.o \
OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp8dsp.o vp56rac.o
OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
OBJS-$(CONFIG_WEBP_DECODER) += webp.o
OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma_common.o
OBJS-$(CONFIG_WMAPRO_DECODER) += wmaprodec.o wma.o wma_common.o
OBJS-$(CONFIG_WMAV1_DECODER) += wmadec.o wma.o wma_common.o aactab.o

View File

@ -253,6 +253,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(VP6F, vp6f);
REGISTER_DECODER(VP8, vp8);
REGISTER_DECODER(VQA, vqa);
REGISTER_DECODER(WEBP, webp);
REGISTER_ENCDEC (WMV1, wmv1);
REGISTER_ENCDEC (WMV2, wmv2);
REGISTER_DECODER(WMV3, wmv3);

View File

@ -273,6 +273,7 @@ enum AVCodecID {
AV_CODEC_ID_AIC,
AV_CODEC_ID_ESCAPE130,
AV_CODEC_ID_G2M,
AV_CODEC_ID_WEBP,
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs

View File

@ -1228,6 +1228,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

@ -27,7 +27,7 @@
*/
#define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 18
#define LIBAVCODEC_VERSION_MINOR 19
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

View File

@ -1853,8 +1853,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;
@ -2010,7 +2010,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;
@ -2033,7 +2033,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;
@ -2047,7 +2047,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;
}
@ -2062,7 +2062,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;
}
@ -2110,9 +2110,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"),

View File

@ -269,4 +269,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

View File

@ -65,6 +65,7 @@ static const IdStrMap img_tags[] = {
{ AV_CODEC_ID_JPEG2000, "j2k" },
{ AV_CODEC_ID_DPX, "dpx" },
{ AV_CODEC_ID_PICTOR, "pic" },
{ AV_CODEC_ID_WEBP, "webp" },
{ AV_CODEC_ID_XBM, "xbm" },
{ AV_CODEC_ID_XWD, "xwd" },
{ AV_CODEC_ID_NONE, NULL }