diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-06-21 21:48:44 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-21 22:57:54 +0200 |
commit | 1e7008675b2d930955b0295808ef208d92e5639d (patch) | |
tree | 7613e4d48a8d265373b678fe709ec81ab3d1d308 | |
parent | 30e9ebb14f197bbc3fcbde467da39d1a79ac8d52 (diff) | |
parent | 8655c54160767de1a6b96f8bc310d6e4eaceff48 (diff) | |
download | ffmpeg-1e7008675b2d930955b0295808ef208d92e5639d.tar.gz |
Merge commit '8655c54160767de1a6b96f8bc310d6e4eaceff48'
* commit '8655c54160767de1a6b96f8bc310d6e4eaceff48':
libvpx: Support the vp9 extended profiles
Conflicts:
Changelog
configure
libavcodec/libvpx.c
libavcodec/libvpx.h
libavcodec/libvpxdec.c
libavcodec/libvpxenc.c
libavcodec/version.h
mostly not merged, as requested by jamrial
See: 01e59d48ed1a41b88107ed1d4d56ae0cbcd1a60e
See: 079b7f6eacc09bc2813fc1ddc230ab05022b69c2 and others
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rwxr-xr-x | configure | 32 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 9 | ||||
-rw-r--r-- | libavcodec/libvpx.c | 57 | ||||
-rw-r--r-- | libavcodec/libvpx.h | 2 | ||||
-rw-r--r-- | libavcodec/libvpxenc.c | 11 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
6 files changed, 100 insertions, 13 deletions
@@ -5141,13 +5141,33 @@ enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvi enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc 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_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_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx || - die "ERROR: libvpx encoder version must be >=0.9.7"; } - 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 VP9E_SET_AQ_MODE" -lvpx || disable libvpx_vp9_encoder; } } + enabled libvpx_vp8_decoder && { + use_pkg_config "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx || + 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_vp8_encoder && { + use_pkg_config "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx || + check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx || + die "ERROR: libvpx encoder version must be >=0.9.7"; + } + enabled libvpx_vp9_decoder && { + use_pkg_config "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx || + check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || + disable libvpx_vp9_decoder; + } + enabled libvpx_vp9_encoder && { + use_pkg_config "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx || + check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx || + disable libvpx_vp9_encoder; + } + if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then + die "libvpx enabled but no supported decoders found" + fi +} + enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack enabled libwebp && { enabled libwebp_encoder && require_pkg_config "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index b75b27e66f..25cb34f2a7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2924,17 +2924,16 @@ typedef struct AVCodecContext { #define FF_PROFILE_JPEG2000_DCINEMA_2K 3 #define FF_PROFILE_JPEG2000_DCINEMA_4K 4 +#define FF_PROFILE_VP9_0 0 +#define FF_PROFILE_VP9_1 1 +#define FF_PROFILE_VP9_2 2 +#define FF_PROFILE_VP9_3 3 #define FF_PROFILE_HEVC_MAIN 1 #define FF_PROFILE_HEVC_MAIN_10 2 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT 4 -#define FF_PROFILE_VP9_0 0 -#define FF_PROFILE_VP9_1 1 -#define FF_PROFILE_VP9_2 2 -#define FF_PROFILE_VP9_3 3 - /** * level * - encoding: Set by user. diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c index e0f9df3caa..602eb70f45 100644 --- a/libavcodec/libvpx.c +++ b/libavcodec/libvpx.c @@ -77,3 +77,60 @@ av_cold void ff_vp9_init_static(AVCodec *codec) } #endif } +#if 0 +enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img) +{ + switch (img) { + case VPX_IMG_FMT_RGB24: return AV_PIX_FMT_RGB24; + case VPX_IMG_FMT_RGB565: return AV_PIX_FMT_RGB565BE; + case VPX_IMG_FMT_RGB555: return AV_PIX_FMT_RGB555BE; + case VPX_IMG_FMT_UYVY: return AV_PIX_FMT_UYVY422; + case VPX_IMG_FMT_YUY2: return AV_PIX_FMT_YUYV422; + case VPX_IMG_FMT_YVYU: return AV_PIX_FMT_YVYU422; + case VPX_IMG_FMT_BGR24: return AV_PIX_FMT_BGR24; + case VPX_IMG_FMT_ARGB: return AV_PIX_FMT_ARGB; + case VPX_IMG_FMT_ARGB_LE: return AV_PIX_FMT_BGRA; + case VPX_IMG_FMT_RGB565_LE: return AV_PIX_FMT_RGB565LE; + case VPX_IMG_FMT_RGB555_LE: return AV_PIX_FMT_RGB555LE; + case VPX_IMG_FMT_I420: return AV_PIX_FMT_YUV420P; + case VPX_IMG_FMT_I422: return AV_PIX_FMT_YUV422P; + case VPX_IMG_FMT_I444: return AV_PIX_FMT_YUV444P; + case VPX_IMG_FMT_444A: return AV_PIX_FMT_YUVA444P; +#ifdef VPX_IMAGE_ABI_VERSION >= 3 + case VPX_IMG_FMT_I440: return AV_PIX_FMT_YUV440P; + case VPX_IMG_FMT_I42016: return AV_PIX_FMT_YUV420P16BE; + case VPX_IMG_FMT_I42216: return AV_PIX_FMT_YUV422P16BE; + case VPX_IMG_FMT_I44416: return AV_PIX_FMT_YUV444P16BE; +#endif + default: return AV_PIX_FMT_NONE; + } +} + +vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat pix) +{ + switch (pix) { + case AV_PIX_FMT_RGB24: return VPX_IMG_FMT_RGB24; + case AV_PIX_FMT_RGB565BE: return VPX_IMG_FMT_RGB565; + case AV_PIX_FMT_RGB555BE: return VPX_IMG_FMT_RGB555; + case AV_PIX_FMT_UYVY422: return VPX_IMG_FMT_UYVY; + case AV_PIX_FMT_YUYV422: return VPX_IMG_FMT_YUY2; + case AV_PIX_FMT_YVYU422: return VPX_IMG_FMT_YVYU; + case AV_PIX_FMT_BGR24: return VPX_IMG_FMT_BGR24; + case AV_PIX_FMT_ARGB: return VPX_IMG_FMT_ARGB; + case AV_PIX_FMT_BGRA: return VPX_IMG_FMT_ARGB_LE; + case AV_PIX_FMT_RGB565LE: return VPX_IMG_FMT_RGB565_LE; + case AV_PIX_FMT_RGB555LE: return VPX_IMG_FMT_RGB555_LE; + case AV_PIX_FMT_YUV420P: return VPX_IMG_FMT_I420; + case AV_PIX_FMT_YUV422P: return VPX_IMG_FMT_I422; + case AV_PIX_FMT_YUV444P: return VPX_IMG_FMT_I444; + case AV_PIX_FMT_YUVA444P: return VPX_IMG_FMT_444A; +#ifdef VPX_IMAGE_ABI_VERSION >= 3 + case AV_PIX_FMT_YUV440P: return VPX_IMG_FMT_I440; + case AV_PIX_FMT_YUV420P16BE: return VPX_IMG_FMT_I42016; + case AV_PIX_FMT_YUV422P16BE: return VPX_IMG_FMT_I42216; + case AV_PIX_FMT_YUV444P16BE: return VPX_IMG_FMT_I44416; +#endif + default: return VPX_IMG_FMT_NONE; + } +} +#endif diff --git a/libavcodec/libvpx.h b/libavcodec/libvpx.h index 36a275c5d2..41c246ba74 100644 --- a/libavcodec/libvpx.h +++ b/libavcodec/libvpx.h @@ -24,5 +24,7 @@ #include "avcodec.h" void ff_vp9_init_static(AVCodec *codec); +enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img); +vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat pix); #endif /* AVCODEC_LIBVPX_H */ diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index a5b750f8ba..a7303f8af3 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -381,7 +381,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, const struct vpx_codec_iface *iface) { VP8Context *ctx = avctx->priv_data; - struct vpx_codec_enc_cfg enccfg; + struct vpx_codec_enc_cfg enccfg = { 0 }; struct vpx_codec_enc_cfg enccfg_alpha; vpx_codec_flags_t flags = (avctx->flags & CODEC_FLAG_PSNR) ? VPX_CODEC_USE_PSNR : 0; int res; @@ -1056,6 +1056,14 @@ static const AVClass class_vp9 = { .version = LIBAVUTIL_VERSION_INT, }; +static const AVProfile profiles[] = { + { FF_PROFILE_VP9_0, "Profile 0" }, + { FF_PROFILE_VP9_1, "Profile 1" }, + { FF_PROFILE_VP9_2, "Profile 2" }, + { FF_PROFILE_VP9_3, "Profile 3" }, + { FF_PROFILE_UNKNOWN }, +}; + AVCodec ff_libvpx_vp9_encoder = { .name = "libvpx-vp9", .long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"), @@ -1066,6 +1074,7 @@ AVCodec ff_libvpx_vp9_encoder = { .encode2 = vp8_encode, .close = vp8_free, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, + .profiles = NULL_IF_CONFIG_SMALL(profiles), .priv_class = &class_vp9, .defaults = defaults, .init_static_data = ff_vp9_init_static, diff --git a/libavcodec/version.h b/libavcodec/version.h index 7490dd9a2c..f4d68bd85b 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -30,7 +30,7 @@ #define LIBAVCODEC_VERSION_MAJOR 56 #define LIBAVCODEC_VERSION_MINOR 42 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ |