From d596f2b32264e79029ead5cc3f9d4dee22c2f49e Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Mon, 14 Jan 2013 17:55:43 +0200 Subject: rtpdec: Make variables that should wrap unsigned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the behaviour defined when they wrap around. The value assigned to expected_prior was a uint32_t already. Signed-off-by: Martin Storsjö --- libavformat/rtpdec.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 6c808cdd57..b34e099b32 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -83,9 +83,9 @@ typedef struct RTPStatistics { uint32_t base_seq; ///< base sequence number uint32_t bad_seq; ///< last bad sequence number + 1 int probation; ///< sequence packets till source is valid - int received; ///< packets received - int expected_prior; ///< packets expected in last interval - int received_prior; ///< packets received in last interval + uint32_t received; ///< packets received + uint32_t expected_prior; ///< packets expected in last interval + uint32_t received_prior; ///< packets received in last interval uint32_t transit; ///< relative transit time for previous packet uint32_t jitter; ///< estimated jitter. } RTPStatistics; -- cgit v1.2.3 From 66aabd76a9c0eaa65baad72453ca09eb161fee25 Mon Sep 17 00:00:00 2001 From: Tom Finegan Date: Sat, 15 Dec 2012 23:18:41 +0100 Subject: mkv: support vp9 tag --- libavcodec/avcodec.h | 1 + libavformat/matroska.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index e57170b509..09b9b42ec7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -267,6 +267,7 @@ enum AVCodecID { AV_CODEC_ID_MTS2, AV_CODEC_ID_CLLC, AV_CODEC_ID_MSS2, + AV_CODEC_ID_VP9, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 5d1c13406a..7976be04a3 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -79,6 +79,7 @@ const CodecTags ff_mkv_codec_tags[]={ {"V_THEORA" , AV_CODEC_ID_THEORA}, {"V_UNCOMPRESSED" , AV_CODEC_ID_RAWVIDEO}, {"V_VP8" , AV_CODEC_ID_VP8}, + {"V_VP9" , AV_CODEC_ID_VP9}, {"" , AV_CODEC_ID_NONE} }; -- cgit v1.2.3 From 23a610b9d66a512afed8627d294f4ae7b16153a0 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 15 Dec 2012 23:26:07 +0100 Subject: nut: support vp9 tag --- libavformat/nut.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/nut.c b/libavformat/nut.c index 196e04e54f..9267226ac6 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -39,6 +39,7 @@ const AVCodecTag ff_nut_data_tags[] = { }; const AVCodecTag ff_nut_video_tags[] = { + { AV_CODEC_ID_VP9, MKTAG('V', 'P', '9', '0') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 15 ) }, { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 15 ) }, { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 16 ) }, -- cgit v1.2.3 From dab1f543fcac7ad3dcdd427fc1b859667c82aaa2 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 20 Dec 2012 17:22:06 +0100 Subject: libvpx: support vp9 This feature is experimental use at your risk --- libavcodec/allcodecs.c | 1 + libavcodec/codec_desc.c | 7 +++++++ libavcodec/libvpxdec.c | 26 ++++++++++++++++++++++++-- libavcodec/libvpxenc.c | 38 ++++++++++++++++++++++++++++++++++++-- 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 4622a03491..1aed693fa5 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -427,6 +427,7 @@ void avcodec_register_all(void) REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc); REGISTER_ENCODER(LIBVORBIS, libvorbis); REGISTER_ENCDEC (LIBVPX, libvpx); + REGISTER_ENCDEC (LIBVPX, libvpx_vp9); REGISTER_ENCODER(LIBX264, libx264); REGISTER_ENCODER(LIBXAVS, libxavs); REGISTER_ENCODER(LIBXVID, libxvid); diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 77b3653312..fe2cbab0ba 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1012,6 +1012,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("On2 VP8"), .props = AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_VP9, + .type = AVMEDIA_TYPE_VIDEO, + .name = "vp9", + .long_name = NULL_IF_CONFIG_SMALL("Google VP9"), + .props = AV_CODEC_PROP_LOSSY, + }, { .id = AV_CODEC_ID_PICTOR, .type = AVMEDIA_TYPE_VIDEO, diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 6419e281b7..06ca69dc61 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -35,10 +35,10 @@ typedef struct VP8DecoderContext { struct vpx_codec_ctx decoder; } VP8Context; -static av_cold int vp8_init(AVCodecContext *avctx) +static av_cold int vpx_init(AVCodecContext *avctx, + const struct vpx_codec_iface *iface) { VP8Context *ctx = avctx->priv_data; - const struct vpx_codec_iface *iface = &vpx_codec_vp8_dx_algo; struct vpx_codec_dec_cfg deccfg = { /* token partitions+1 would be a decent choice */ .threads = FFMIN(avctx->thread_count, 16) @@ -58,6 +58,11 @@ static av_cold int vp8_init(AVCodecContext *avctx) return 0; } +static av_cold int vp8_init(AVCodecContext *avctx) +{ + return vpx_init(avctx, &vpx_codec_vp8_dx_algo); +} + static int vp8_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { @@ -123,3 +128,20 @@ AVCodec ff_libvpx_decoder = { .capabilities = CODEC_CAP_AUTO_THREADS, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), }; + +static av_cold int vp9_init(AVCodecContext *avctx) +{ + return vpx_init(avctx, &vpx_codec_vp9_dx_algo); +} + +AVCodec ff_libvpx_vp9_decoder = { + .name = "libvpx-vp9", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_VP9, + .priv_data_size = sizeof(VP8Context), + .init = vp9_init, + .close = vp8_free, + .decode = vp8_decode, + .capabilities = CODEC_CAP_AUTO_THREADS | CODEC_CAP_EXPERIMENTAL, + .long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"), +}; diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 17b9800f25..7f7cad9e3a 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -214,10 +214,10 @@ static av_cold int vp8_free(AVCodecContext *avctx) return 0; } -static av_cold int vp8_init(AVCodecContext *avctx) +static av_cold int vpx_init(AVCodecContext *avctx, + const struct vpx_codec_iface *iface) { VP8Context *ctx = avctx->priv_data; - const struct vpx_codec_iface *iface = &vpx_codec_vp8_cx_algo; struct vpx_codec_enc_cfg enccfg; int res; @@ -362,6 +362,11 @@ static av_cold int vp8_init(AVCodecContext *avctx) return 0; } +static av_cold int vp8_init(AVCodecContext *avctx) +{ + return vpx_init(avctx, &vpx_codec_vp8_cx_algo); +} + static inline void cx_pktcpy(struct FrameListData *dst, const struct vpx_codec_cx_pkt *src) { @@ -594,3 +599,32 @@ AVCodec ff_libvpx_encoder = { .priv_class = &class, .defaults = defaults, }; + + +static av_cold int vp9_init(AVCodecContext *avctx) +{ + return vpx_init(avctx, &vpx_codec_vp9_cx_algo); +} + +static const AVClass class_vp9 = { + .class_name = "libvpx encoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + + +AVCodec ff_libvpx_vp9_encoder = { + .name = "libvpx-vp9", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_VP9, + .priv_data_size = sizeof(VP8Context), + .init = vp9_init, + .encode2 = vp8_encode, + .close = vp8_free, + .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS | CODEC_CAP_EXPERIMENTAL, + .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, + .long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"), + .priv_class = &class_vp9, + .defaults = defaults, +}; -- cgit v1.2.3 From 3f111804eb5c603a344706b84b7164cbf7b4e0df Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 30 Dec 2012 19:40:20 +0100 Subject: libvpx: make vp8 and vp9 selectable Support older libvpx versions. --- configure | 16 ++++++++++------ libavcodec/Makefile | 6 ++++-- libavcodec/allcodecs.c | 4 ++-- libavcodec/libvpxdec.c | 16 ++++++++++------ libavcodec/libvpxenc.c | 34 ++++++++++++++++++---------------- 5 files changed, 44 insertions(+), 32 deletions(-) diff --git a/configure b/configure index a2bf6e186a..554d578bb9 100755 --- a/configure +++ b/configure @@ -197,7 +197,7 @@ External library support: --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no] --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no] --enable-libvorbis enable Vorbis encoding via libvorbis [no] - --enable-libvpx enable VP8 de/encoding via libvpx [no] + --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no] --enable-libx264 enable H.264 encoding via x264 [no] --enable-libxavs enable AVS encoding via xavs [no] --enable-libxvid enable Xvid encoding via xvidcore, @@ -1660,8 +1660,10 @@ libtheora_encoder_deps="libtheora" libvo_aacenc_encoder_deps="libvo_aacenc" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" libvorbis_encoder_deps="libvorbis" -libvpx_decoder_deps="libvpx" -libvpx_encoder_deps="libvpx" +libvpx_vp8_decoder_deps="libvpx" +libvpx_vp8_encoder_deps="libvpx" +libvpx_vp9_decoder_deps="libvpx" +libvpx_vp9_encoder_deps="libvpx" libx264_encoder_deps="libx264" libxavs_encoder_deps="libxavs" libxvid_encoder_deps="libxvid" @@ -3485,10 +3487,12 @@ enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -l enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg enabled libvpx && { - enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || + enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || die "ERROR: libvpx decoder version must be >=0.9.1"; } - enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx || - die "ERROR: libvpx encoder version must be >=0.9.6"; } } + enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx || + die "ERROR: libvpx encoder version must be >=0.9.6"; } + enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; } + enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } } enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && { check_cpp_condition x264.h "X264_BUILD >= 118" || die "ERROR: libx264 version must be >= 0.118."; } diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 2330f85fbb..f1a07d0a98 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -594,8 +594,10 @@ OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbis.o audio_frame_queue.o \ vorbis_data.o vorbis_parser.o -OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o -OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o +OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o +OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o +OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o +OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 1aed693fa5..8bfa60329a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -426,8 +426,8 @@ void avcodec_register_all(void) REGISTER_ENCODER(LIBVO_AACENC, libvo_aacenc); REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc); REGISTER_ENCODER(LIBVORBIS, libvorbis); - REGISTER_ENCDEC (LIBVPX, libvpx); - REGISTER_ENCDEC (LIBVPX, libvpx_vp9); + REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8); + REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9); REGISTER_ENCODER(LIBX264, libx264); REGISTER_ENCODER(LIBXAVS, libxavs); REGISTER_ENCODER(LIBXVID, libxvid); diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 06ca69dc61..54eee31dcf 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -58,11 +58,6 @@ static av_cold int vpx_init(AVCodecContext *avctx, return 0; } -static av_cold int vp8_init(AVCodecContext *avctx) -{ - return vpx_init(avctx, &vpx_codec_vp8_dx_algo); -} - static int vp8_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { @@ -117,7 +112,13 @@ static av_cold int vp8_free(AVCodecContext *avctx) return 0; } -AVCodec ff_libvpx_decoder = { +#if CONFIG_LIBVPX_VP8_DECODER +static av_cold int vp8_init(AVCodecContext *avctx) +{ + return vpx_init(avctx, &vpx_codec_vp8_dx_algo); +} + +AVCodec ff_libvpx_vp8_decoder = { .name = "libvpx", .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_VP8, @@ -128,7 +129,9 @@ AVCodec ff_libvpx_decoder = { .capabilities = CODEC_CAP_AUTO_THREADS, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), }; +#endif /* CONFIG_LIBVPX_VP8_DECODER */ +#if CONFIG_LIBVPX_VP9_DECODER static av_cold int vp9_init(AVCodecContext *avctx) { return vpx_init(avctx, &vpx_codec_vp9_dx_algo); @@ -145,3 +148,4 @@ AVCodec ff_libvpx_vp9_decoder = { .capabilities = CODEC_CAP_AUTO_THREADS | CODEC_CAP_EXPERIMENTAL, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"), }; +#endif /* CONFIG_LIBVPX_VP9_DECODER */ diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 7f7cad9e3a..0ecc2f913b 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -362,11 +362,6 @@ static av_cold int vpx_init(AVCodecContext *avctx, return 0; } -static av_cold int vp8_init(AVCodecContext *avctx) -{ - return vpx_init(avctx, &vpx_codec_vp8_cx_algo); -} - static inline void cx_pktcpy(struct FrameListData *dst, const struct vpx_codec_cx_pkt *src) { @@ -570,13 +565,6 @@ static const AVOption options[] = { { NULL } }; -static const AVClass class = { - .class_name = "libvpx encoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - static const AVCodecDefault defaults[] = { { "qmin", "-1" }, { "qmax", "-1" }, @@ -585,7 +573,20 @@ static const AVCodecDefault defaults[] = { { NULL }, }; -AVCodec ff_libvpx_encoder = { +#if CONFIG_LIBVPX_VP8_ENCODER +static av_cold int vp8_init(AVCodecContext *avctx) +{ + return vpx_init(avctx, &vpx_codec_vp8_cx_algo); +} + +static const AVClass class_vp8 = { + .class_name = "libvpx encoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + +AVCodec ff_libvpx_vp8_encoder = { .name = "libvpx", .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_VP8, @@ -596,11 +597,12 @@ AVCodec ff_libvpx_encoder = { .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), - .priv_class = &class, + .priv_class = &class_vp8, .defaults = defaults, }; +#endif /* CONFIG_LIBVPX_VP8_ENCODER */ - +#if CONFIG_LIBVPX_VP9_ENCODER static av_cold int vp9_init(AVCodecContext *avctx) { return vpx_init(avctx, &vpx_codec_vp9_cx_algo); @@ -613,7 +615,6 @@ static const AVClass class_vp9 = { .version = LIBAVUTIL_VERSION_INT, }; - AVCodec ff_libvpx_vp9_encoder = { .name = "libvpx-vp9", .type = AVMEDIA_TYPE_VIDEO, @@ -628,3 +629,4 @@ AVCodec ff_libvpx_vp9_encoder = { .priv_class = &class_vp9, .defaults = defaults, }; +#endif /* CONFIG_LIBVPX_VP9_ENCODER */ -- cgit v1.2.3