[libav-devel] [PATCH 2/2] vpx: Support version 1.3.0
--- I tied the supported formats to the ABI version. configure | 12 ++-- libavcodec/libvpx.c| 8 ++-- libavcodec/libvpxenc.c | 6 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/configure b/configure index a416dc2..8cb53d2 100755 --- a/configure +++ b/configure @@ -4312,19 +4312,19 @@ enabled libvo_amrwbenc require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_in enabled libvorbis require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg enabled libvpx { enabled libvpx_vp8_decoder { -require vpx = 1.4.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver -lvpx || -die ERROR: libvpx encoder version must be =1.4.0; +require_pkg_config vpx = 1.3.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver || +die ERROR: libvpx encoder version must be = 1.3.0; } enabled libvpx_vp8_encoder { -require vpx = 1.4.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver -lvpx || -die ERROR: libvpx encoder version must be =1.4.0; +require_pkg_config vpx = 1.3.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver || +die ERROR: libvpx encoder version must be = 1.3.0; } enabled libvpx_vp9_decoder { -require vpx = 1.4.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver -lvpx || +require_pkg_config vpx = 1.3.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver || disable libvpx_vp9_decoder; } enabled libvpx_vp9_encoder { -require vpx = 1.4.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver -lvpx || +require_pkg_config vpx = 1.3.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver || disable libvpx_vp9_encoder; } } diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c index 603ed13..230bc49 100644 --- a/libavcodec/libvpx.c +++ b/libavcodec/libvpx.c @@ -39,11 +39,13 @@ enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img) 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_I440: return AV_PIX_FMT_YUV440P; case VPX_IMG_FMT_444A: return AV_PIX_FMT_YUVA444P; +#ifdef VPX_IMG_FMT_HIGHBITDEPTH +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; } } @@ -65,11 +67,13 @@ vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat pix) 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_YUV440P: return VPX_IMG_FMT_I440; case AV_PIX_FMT_YUVA444P: return VPX_IMG_FMT_444A; +#ifdef VPX_IMG_FMT_HIGHBITDEPTH +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; } } diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 16d239d..1b0b9e7 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -653,8 +653,12 @@ AVCodec ff_libvpx_vp9_encoder = { .close = vp8_free, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, .pix_fmts = (const enum AVPixelFormat[]) { -AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, +AV_PIX_FMT_YUV420P, +#if VPX_IMAGE_ABI_VERSION = 3 +AV_PIX_FMT_YUV422P, +AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P, +#endif AV_PIX_FMT_NONE, }, .profiles = NULL_IF_CONFIG_SMALL(profiles), -- 2.3.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/2] vpx: Support version 1.3.0
On 11/06/15 11:56 AM, Luca Barbato wrote: --- I tied the supported formats to the ABI version. configure | 12 ++-- libavcodec/libvpx.c| 8 ++-- libavcodec/libvpxenc.c | 6 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/configure b/configure index a416dc2..8cb53d2 100755 --- a/configure +++ b/configure @@ -4312,19 +4312,19 @@ enabled libvo_amrwbenc require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_in enabled libvorbis require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg enabled libvpx { enabled libvpx_vp8_decoder { -require vpx = 1.4.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver -lvpx || -die ERROR: libvpx encoder version must be =1.4.0; +require_pkg_config vpx = 1.3.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver || +die ERROR: libvpx encoder version must be = 1.3.0; } enabled libvpx_vp8_encoder { -require vpx = 1.4.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver -lvpx || -die ERROR: libvpx encoder version must be =1.4.0; +require_pkg_config vpx = 1.3.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver || +die ERROR: libvpx encoder version must be = 1.3.0; } enabled libvpx_vp9_decoder { -require vpx = 1.4.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver -lvpx || +require_pkg_config vpx = 1.3.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver || disable libvpx_vp9_decoder; } enabled libvpx_vp9_encoder { -require vpx = 1.4.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver -lvpx || +require_pkg_config vpx = 1.3.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver || disable libvpx_vp9_encoder; Using require_pkg_config() makes configure abort if the check fails, so the disable() calls are dead code. That's why use_pkg_config() and check_pkg_config exist. Also, checking for the decoding/encoding header and the init function is apparently not enough. You need to check for the decoding/encoding interfaces vpx_codec_vp[89]_[cd]x because libvpx can be built without one or more of the four components. enabled libvpx require_pkg_config vpx = 1.3.0 vpx/vpx_codec.h vpx_codec_version { enabled libvpx_vp8_decoder { check_pkg_config vpx vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_vp8_dx || disable libvpx_vp8_decoder; } enabled libvpx_vp8_encoder { check_pkg_config vpx vpx/vpx_encoder.h vpx/vp8cx.h vpx_codec_vp8_cx || disable libvpx_vp8_encoder; } enabled libvpx_vp9_decoder { check_pkg_config vpx vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_vp9_dx || disable libvpx_vp9_decoder; } enabled libvpx_vp9_encoder { check_pkg_config vpx vpx/vpx_encoder.h vpx/vp8cx.h vpx_codec_vp9_cx || disable libvpx_vp9_encoder; } } Updated from the version i posted in a previous email (Which was wrong as it only checked for the header and init function). This will first check for a recent libvpx, then for each component. } } diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c index 603ed13..230bc49 100644 --- a/libavcodec/libvpx.c +++ b/libavcodec/libvpx.c @@ -39,11 +39,13 @@ enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img) 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_I440: return AV_PIX_FMT_YUV440P; case VPX_IMG_FMT_444A: return AV_PIX_FMT_YUVA444P; +#ifdef VPX_IMG_FMT_HIGHBITDEPTH +case VPX_IMG_FMT_I440: return AV_PIX_FMT_YUV440P; The correct guard for VPX_IMG_FMT_I440 is VPX_IMAGE_ABI_VERSION =3. libvpx git snapshots post 1.3.0 and pre 1.4.0 may fail because they may define VPX_IMG_FMT_HIGHBITDEPTH but not VPX_IMG_FMT_I440. 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; } } @@ -65,11 +67,13 @@ vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat pix) 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_YUV440P: return VPX_IMG_FMT_I440; case AV_PIX_FMT_YUVA444P: return VPX_IMG_FMT_444A; +#ifdef VPX_IMG_FMT_HIGHBITDEPTH +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;
Re: [libav-devel] [PATCH 2/2] vpx: Support version 1.3.0
On 11/06/15 21:16, James Almer wrote: On 11/06/15 11:56 AM, Luca Barbato wrote: --- I tied the supported formats to the ABI version. configure | 12 ++-- libavcodec/libvpx.c| 8 ++-- libavcodec/libvpxenc.c | 6 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/configure b/configure index a416dc2..8cb53d2 100755 --- a/configure +++ b/configure @@ -4312,19 +4312,19 @@ enabled libvo_amrwbenc require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_in enabled libvorbis require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg enabled libvpx { enabled libvpx_vp8_decoder { -require vpx = 1.4.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver -lvpx || -die ERROR: libvpx encoder version must be =1.4.0; +require_pkg_config vpx = 1.3.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver || +die ERROR: libvpx encoder version must be = 1.3.0; } enabled libvpx_vp8_encoder { -require vpx = 1.4.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver -lvpx || -die ERROR: libvpx encoder version must be =1.4.0; +require_pkg_config vpx = 1.3.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver || +die ERROR: libvpx encoder version must be = 1.3.0; } enabled libvpx_vp9_decoder { -require vpx = 1.4.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver -lvpx || +require_pkg_config vpx = 1.3.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver || disable libvpx_vp9_decoder; } enabled libvpx_vp9_encoder { -require vpx = 1.4.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver -lvpx || +require_pkg_config vpx = 1.3.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver || disable libvpx_vp9_encoder; Using require_pkg_config() makes configure abort if the check fails, so the disable() calls are dead code. That's why use_pkg_config() and check_pkg_config exist. Also, checking for the decoding/encoding header and the init function is apparently not enough. You need to check for the decoding/encoding interfaces vpx_codec_vp[89]_[cd]x because libvpx can be built without one or more of the four components. enabled libvpx require_pkg_config vpx = 1.3.0 vpx/vpx_codec.h vpx_codec_version { enabled libvpx_vp8_decoder { check_pkg_config vpx vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_vp8_dx || disable libvpx_vp8_decoder; } enabled libvpx_vp8_encoder { check_pkg_config vpx vpx/vpx_encoder.h vpx/vp8cx.h vpx_codec_vp8_cx || disable libvpx_vp8_encoder; } enabled libvpx_vp9_decoder { check_pkg_config vpx vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_vp9_dx || disable libvpx_vp9_decoder; } enabled libvpx_vp9_encoder { check_pkg_config vpx vpx/vpx_encoder.h vpx/vp8cx.h vpx_codec_vp9_cx || disable libvpx_vp9_encoder; } } Updated from the version i posted in a previous email (Which was wrong as it only checked for the header and init function). This will first check for a recent libvpx, then for each component. } } diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c index 603ed13..230bc49 100644 --- a/libavcodec/libvpx.c +++ b/libavcodec/libvpx.c @@ -39,11 +39,13 @@ enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img) 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_I440: return AV_PIX_FMT_YUV440P; case VPX_IMG_FMT_444A: return AV_PIX_FMT_YUVA444P; +#ifdef VPX_IMG_FMT_HIGHBITDEPTH +case VPX_IMG_FMT_I440: return AV_PIX_FMT_YUV440P; The correct guard for VPX_IMG_FMT_I440 is VPX_IMAGE_ABI_VERSION =3. libvpx git snapshots post 1.3.0 and pre 1.4.0 may fail because they may define VPX_IMG_FMT_HIGHBITDEPTH but not VPX_IMG_FMT_I440. I'll use it everywhere then, thanks a lot! lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel