[vlc-devel] [PATCH] vpx: Drop codec capabilities check
Vittorio Giovara
vittorio.giovara at gmail.com
Sun Oct 2 03:40:26 CEST 2016
The codec capabilities were only used to check for high bit depth
support, but the provided symbol only works for encoders. So just
gracefully fail to decode fames in case the library has no support.
---
contrib/src/vpx/libvpx-noencoder.patch | 26 --------------------------
contrib/src/vpx/rules.mak | 1 -
modules/codec/vpx.c | 12 ++----------
3 files changed, 2 insertions(+), 37 deletions(-)
delete mode 100644 contrib/src/vpx/libvpx-noencoder.patch
diff --git a/contrib/src/vpx/libvpx-noencoder.patch b/contrib/src/vpx/libvpx-noencoder.patch
deleted file mode 100644
index 27f9e4d..0000000
--- a/contrib/src/vpx/libvpx-noencoder.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- libvpx/vpx/vpx_encoder.h.orig 2016-09-29 13:16:43.275060163 +0200
-+++ libvpx/vpx/vpx_encoder.h 2016-09-29 13:17:25.606960648 +0200
-@@ -83,10 +83,6 @@
- */
- #define VPX_CODEC_CAP_OUTPUT_PARTITION 0x20000
-
--/*! Can support input images at greater than 8 bitdepth.
-- */
--#define VPX_CODEC_CAP_HIGHBITDEPTH 0x40000
--
- /*! \brief Initialization-time Feature Enabling
- *
- * Certain codec features must be known at initialization time, to allow
-
---- libvpx/vpx/vpx_codec.h.orig 2016-09-29 13:17:21.970969167 +0200
-+++ libvpx/vpx/vpx_codec.h 2016-09-29 13:17:57.098887090 +0200
-@@ -154,6 +154,9 @@
- #define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
- #define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
-
-+/*! Can support input images at greater than 8 bitdepth.
-+ */
-+#define VPX_CODEC_CAP_HIGHBITDEPTH 0x40000
-
- /*! \brief Initialization-time Feature Enabling
- *
diff --git a/contrib/src/vpx/rules.mak b/contrib/src/vpx/rules.mak
index 6172ad1..2b31eb7 100644
--- a/contrib/src/vpx/rules.mak
+++ b/contrib/src/vpx/rules.mak
@@ -18,7 +18,6 @@ libvpx: libvpx-$(VPX_VERSION).tar.bz2 .sum-vpx
$(APPLY) $(SRC)/vpx/libvpx-mac.patch
$(APPLY) $(SRC)/vpx/libvpx-ios.patch
$(APPLY) $(SRC)/vpx/libvpx-arm.patch
- $(APPLY) $(SRC)/vpx/libvpx-noencoder.patch
ifdef HAVE_ANDROID
$(APPLY) $(SRC)/vpx/libvpx-android.patch
endif
diff --git a/modules/codec/vpx.c b/modules/codec/vpx.c
index 93e618d..15e3a27 100644
--- a/modules/codec/vpx.c
+++ b/modules/codec/vpx.c
@@ -99,7 +99,6 @@ static void vpx_err_msg(vlc_object_t *this, struct vpx_codec_ctx *ctx,
struct decoder_sys_t
{
struct vpx_codec_ctx ctx;
- vpx_codec_caps_t codec_caps;
};
static const struct
@@ -144,13 +143,10 @@ static const struct
{ VLC_CODEC_I444_16L, VPX_IMG_FMT_I44416, 16, 0 },
};
-static vlc_fourcc_t FindVlcChroma( struct vpx_image *img, vpx_codec_caps_t codec_caps )
+static vlc_fourcc_t FindVlcChroma( struct vpx_image *img )
{
uint8_t hack = (img->fmt & VPX_IMG_FMT_I444) && (img->cs == VPX_CS_SRGB);
- if( img->bit_depth > 8 && !(codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) )
- return 0;
-
for( unsigned int i = 0; i < ARRAY_SIZE(chroma_table); i++ )
if( chroma_table[i].i_chroma_id == img->fmt &&
chroma_table[i].i_bitdepth == img->bit_depth &&
@@ -210,7 +206,7 @@ static picture_t *Decode(decoder_t *dec, block_t **pp_block)
mtime_t pts = *pkt_pts;
free(pkt_pts);
- dec->fmt_out.i_codec = FindVlcChroma(img, dec->p_sys->codec_caps);
+ dec->fmt_out.i_codec = FindVlcChroma(img);
if( dec->fmt_out.i_codec == 0 ) {
msg_Err(dec, "Unsupported output colorspace %d", img->fmt);
@@ -283,7 +279,6 @@ static int OpenDecoder(vlc_object_t *p_this)
{
decoder_t *dec = (decoder_t *)p_this;
const struct vpx_codec_iface *iface;
- vpx_codec_caps_t codec_caps = 0;
int vp_version;
switch (dec->fmt_in.i_codec)
@@ -296,7 +291,6 @@ static int OpenDecoder(vlc_object_t *p_this)
#endif
#ifdef ENABLE_VP9_DECODER
case VLC_CODEC_VP9:
- codec_caps = vpx_codec_get_caps(vpx_codec_vp9_dx());
iface = &vpx_codec_vp9_dx_algo;
vp_version = 9;
break;
@@ -323,8 +317,6 @@ static int OpenDecoder(vlc_object_t *p_this)
return VLC_EGENERIC;;
}
- dec->p_sys->codec_caps = codec_caps;
-
dec->pf_decode_video = Decode;
dec->fmt_out.i_cat = VIDEO_ES;
--
2.10.0
More information about the vlc-devel
mailing list