Commit 8738ffcd authored by Vittorio Giovara's avatar Vittorio Giovara

vpx: Drop codec capabilities check

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 frames in case the library has no support.
parent 40475d78
--- 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
*
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment