[vlc-devel] [PATCH 2/3] vpx: Decode additional profiles and high bit depth formats

Jean-Baptiste Kempf jb at videolan.org
Sun Sep 25 17:59:00 CEST 2016


On 25 Sep, Vittorio Giovara wrote :
> +    { VLC_CODEC_I420, VPX_IMG_FMT_I420, 0, 8, 0 },
> +    { VLC_CODEC_I422, VPX_IMG_FMT_I422, 0, 8, 0 },
> +    { VLC_CODEC_I444, VPX_IMG_FMT_I444, 0, 8, 0 },
> +    { VLC_CODEC_I440, VPX_IMG_FMT_I440, 0, 8, 0 },
> +
> +    { VLC_CODEC_J420, VPX_IMG_FMT_I420, 1, 8, 0 },
> +    { VLC_CODEC_J422, VPX_IMG_FMT_I422, 1, 8, 0 },
> +    { VLC_CODEC_J444, VPX_IMG_FMT_I444, 1, 8, 0 },
> +    { VLC_CODEC_J440, VPX_IMG_FMT_I440, 1, 8, 0 },
> +

Those 4 do not make sense, at all.

> +    { VLC_CODEC_YV12, VPX_IMG_FMT_YV12, 0, 8, 0 },
> +    { VLC_CODEC_YUVA, VPX_IMG_FMT_444A, 0, 8, 0 },
> +    { VLC_CODEC_YUYV, VPX_IMG_FMT_YUY2, 0, 8, 0 },
> +    { VLC_CODEC_UYVY, VPX_IMG_FMT_UYVY, 0, 8, 0 },
> +    { VLC_CODEC_YVYU, VPX_IMG_FMT_YVYU, 0, 8, 0 },
> +
> +    { VLC_CODEC_RGB15, VPX_IMG_FMT_RGB555, 0, 8, 0 },
> +    { VLC_CODEC_RGB16, VPX_IMG_FMT_RGB565, 0, 8, 0 },
> +    { VLC_CODEC_RGB24, VPX_IMG_FMT_RGB24, 0, 8, 0 },
> +    { VLC_CODEC_RGB32, VPX_IMG_FMT_RGB32, 0, 8, 0 },
> +
> +    { VLC_CODEC_ARGB, VPX_IMG_FMT_ARGB, 0, 8, 0 },
> +    { VLC_CODEC_BGRA, VPX_IMG_FMT_ARGB_LE, 0, 8, 0 },
> +
> +    { VLC_CODEC_GBR_PLANAR, VPX_IMG_FMT_I444, 0, 8, 1 }
> +    { VLC_CODEC_GBR_PLANAR_10L, VPX_IMG_FMT_I44416, 0, 10, 1 }
> +
> +    { VLC_CODEC_I420_10L, VPX_IMG_FMT_I42016, 0, 10, 0 },
> +    { VLC_CODEC_I422_10L, VPX_IMG_FMT_I42216, 0, 10, 0 },
> +    { VLC_CODEC_I444_10L, VPX_IMG_FMT_I44416, 0, 10, 0 },
> +
> +    { VLC_CODEC_I420_12L, VPX_IMG_FMT_I42016, 0, 12, 0 },
> +    { VLC_CODEC_I422_12L, VPX_IMG_FMT_I42216, 0, 12, 0 },
> +    { VLC_CODEC_I444_12L, VPX_IMG_FMT_I44416, 0, 12, 0 },
> +
> +    { VLC_CODEC_I444_16L, VPX_IMG_FMT_I44416, 0, 16, 0 },

I'm a bit surprised that all those exist in vpx, but ok.

> +static vlc_fourcc_t FindVlcChroma( struct vpx_image *img, vpx_codec_caps_t codec_caps )
> +{
> +    int 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( int i = 0; chroma_table[i].i_chroma != 0; i++ )
> +        if( chroma_table[i].i_chroma_id == img->fmt &&
> +            chroma_table[i].i_range == img->range &&
> +            chroma_table[i].i_bitdepth == img->bit_depth &&
> +            chroma_table[i].i_needs_hack == hack )
> +            return chroma_table[i].i_chroma;
> +
> +    return 0;
> +}
> +
>  /****************************************************************************
>   * Decode: the whole thing
>   ****************************************************************************/
> @@ -151,7 +219,9 @@ static picture_t *Decode(decoder_t *dec, block_t **pp_block)
>      mtime_t pts = *pkt_pts;
>      free(pkt_pts);
>  
> -    if (img->fmt != VPX_IMG_FMT_I420) {
> +    dec->fmt_out.i_codec = FindVlcChroma(img, dec->p_sys->codec_caps);
> +
> +    if( dec->fmt_out.i_codec == 0 ) {
>          msg_Err(dec, "Unsupported output colorspace %d", img->fmt);
>          return NULL;
>      }
> @@ -200,6 +270,7 @@ 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)
> @@ -212,6 +283,7 @@ 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_cx());
>          iface = &vpx_codec_vp9_dx_algo;
>          vp_version = 9;
>          break;
> @@ -238,12 +310,13 @@ 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;
>      dec->fmt_out.video.i_width = dec->fmt_in.video.i_width;
>      dec->fmt_out.video.i_height = dec->fmt_in.video.i_height;
> -    dec->fmt_out.i_codec = VLC_CODEC_I420;
>  
>      return VLC_SUCCESS;
>  }
> -- 
> 2.10.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the vlc-devel mailing list