[FFmpeg-devel] Patch for High color and High bit-depth support

Michael Niedermayer michaelni at gmx.at
Wed Apr 8 01:12:50 CEST 2015


On Tue, Apr 07, 2015 at 02:30:34PM -0700, Debargha Mukherjee wrote:
> Resolutions inline.
> 
> On Mon, Apr 6, 2015 at 3:21 PM, James Zern <jzern at google.com> wrote:
> 
> > On Fri, Apr 3, 2015 at 6:37 PM, Debargha Mukherjee <debargha at google.com>
> > wrote:
> >
> > >>
> > >> You can probably merge profile 1 like 2/3 to cut down on the
> > duplication.
> > >> You
> > >> might want to set bitdepth to 8 by default reducing the ifdefs here too.
> > >>
> > >
> > > done.
> > >
> >
> > > +#ifdef VPX_IMG_FMT_HIGHBITDEPTH
> > > +    case AV_PIX_FMT_YUV420P10LE:
> > > +    case AV_PIX_FMT_YUV420P12LE:
> > > +        if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
> > > +            enccfg->g_bit_depth = enccfg->g_input_bit_depth =
> > > +                avctx->pix_fmt == AV_PIX_FMT_YUV420P10LE ? 10 : 12;
> > > +            enccfg->g_profile = 2;
> > > +            *img_fmt = VPX_IMG_FMT_I42016;
> > > +            *flags |= VPX_CODEC_USE_HIGHBITDEPTH;
> > > +            return 0;
> > > +        } else {
> > > +            break;
> > > +        }
> > >
> >
> > just drop the else, you return from the other block.
> >
> 
> Done.
> 
> 
> >
> > >
> > >>
> > >> > +#if CONFIG_LIBVPX_VP9_ENCODER
> > >> > +    if (avctx->codec_id == AV_CODEC_ID_VP9) {
> > >> > +        if (set_pix_fmt(avctx, codec_caps, &enccfg, &flags,
> > &img_fmt))
> > >> > +            return AVERROR(EINVAL);
> > >> > +        av_log(avctx, AV_LOG_INFO, "Bit-depth: %d\n",
> > >> enccfg.g_bit_depth);
> > >> >
> > >>
> > >> Won't build with a non-high-bitdepth build.
> > >>
> > >
> > > done.
> > >
> >
> > This should get output in dump_enc_cfg(), no? I think the log can be
> > dropped.
> >
> 
> Done.
> 
> 
> >
> > >
> > >>
> > >> > -    .pix_fmts       = (const enum AVPixelFormat[]){
> > AV_PIX_FMT_YUV420P,
> > >> AV_PIX_FMT_NONE },
> > >> > +    .pix_fmts       = (const enum AVPixelFormat[]){
> > AV_PIX_FMT_YUV420P,
> > >> > +
> > AV_PIX_FMT_YUV422P,
> > >> > +
> > AV_PIX_FMT_YUV444P,
> > >> > +#ifdef VPX_IMG_FMT_HIGHBITDEPTH
> > >> > +
> > >> AV_PIX_FMT_YUV420P10LE,
> > >> > +
> > >> AV_PIX_FMT_YUV422P10LE,
> > >> > +
> > >> AV_PIX_FMT_YUV444P10LE,
> > >> > +
> > >> AV_PIX_FMT_YUV420P12LE,
> > >> > +
> > >> AV_PIX_FMT_YUV422P12LE,
> > >> > +
> > >> AV_PIX_FMT_YUV444P12LE,
> > >> > +#endif
> > >>
> > >
> > > done using ff_vp9_init_static().
> > >
> > > diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
> > > index 5d29893..5111eed 100644
> > > --- a/libavcodec/libvpx.c
> > > +++ b/libavcodec/libvpx.c
> > > @@ -19,12 +19,47 @@
> > >   */
> > >
> > >  #include <vpx/vpx_codec.h>
> > > -
> > > +#include <vpx/vpx_encoder.h>
> > > +#include <vpx/vp8cx.h>
> > >
> >
> > You need to make sure the encoder is available. Keep the break between
> > local
> > and system headers.
> >
> 
> Kept the break.
> 
> 
> >
> > >      if (    vpx_codec_version_major() < 1
> > >          || (vpx_codec_version_major() == 1 && vpx_codec_version_minor()
> > < 3))
> > >          codec->capabilities |= CODEC_CAP_EXPERIMENTAL;
> > > +    if (    vpx_codec_version_major() == 1 && vpx_codec_version_minor()
> > >= 3) {
> > >
> >
> > 1.4.0 would be better for all high bitdepth since it wasn't working at
> > 1.3.0
> > and identifying anything in between would need a configure change. Also
> > check
> > for major > 1.
> >
> 
> Done.
> 
> 
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> 
> 
> -- 
> Debargha Mukherjee, Ph.D.
> Staff Software Engineer,
> Google, Inc.
> Email: debargha at google.com
> Phone: 408-234-5956 (cell)

>  libvpx.c    |   36 ++++++++++++++++++++++++++
>  libvpxenc.c |   83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 117 insertions(+), 2 deletions(-)
> 34db5acf9792c28b106393d11e441c85bac756f6  0001-Support-for-VP9-high-color-high-bit-depth-encoding.patch
> From cbbd046deb0ccdd8274d66faf5ec13efc1ad95ce Mon Sep 17 00:00:00 2001
> From: Deb Mukherjee <debargha at google.com>
> Date: Wed, 25 Mar 2015 17:10:16 -0700
> Subject: [PATCH] Support for VP9 high-color/high-bit-depth encoding
> 
> Patch to support VP9 encoding with new profiles 1-3.
> Profile 1 (8-bit 422/444) should work with default libvpx
> configuration.
> However you will need to configure libvpx with
> --enable-vp9-highbitdepth before building and linking
> with ffmpeg for profile 2 (10-/12-bit 420) and profile 3
> (10-/12-bit 422/444) encoding.
> 
> You may use the appropriate profile option on the
> command line:
> -profile:v 1 for 422/444 8-bit encoding
> -profile:v 2 for 420 10-/12- bit encoding
> -profile:v 3 for 422/444 10-/12-bit encoding
> If you do not use the -profile:v option, it will be deduced
> from the source format.
> ---
>  libavcodec/libvpx.c    | 36 ++++++++++++++++++++++
>  libavcodec/libvpxenc.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 117 insertions(+), 2 deletions(-)

fails with:
./configure  --enable-libvpx --enable-libopus

libavcodec/libvpx.c: In function ‘ff_vp9_init_static’:
libavcodec/libvpx.c:59:26: error: ‘VPX_CODEC_CAP_HIGHBITDEPTH’ undeclared (first use in this function)
libavcodec/libvpx.c:59:26: note: each undeclared identifier is reported only once for each function it appears in

./configure  --enable-libvpx
works (libavcodec/libvpx.o is not build, vp9 decoder and encoder is disabled)

grep vpx_codec_vp9 /usr/include/vpx/vp8dx.h /usr/local/include/vpx/vp8dx.h
/usr/local/include/vpx/vp8dx.h:extern vpx_codec_iface_t  vpx_codec_vp9_dx_algo;
/usr/local/include/vpx/vp8dx.h:extern vpx_codec_iface_t *vpx_codec_vp9_dx(void);

egrep -r 'VPX_CODEC_CAP_HIGHBITDEPTH|VP9E_SET_AQ_MODE' /usr/local/include/vpx/ /usr/include/vpx/
/usr/local/include/vpx/vp8cx.h:  VP9E_SET_AQ_MODE,
/usr/local/include/vpx/vp8cx.h:VPX_CTRL_USE_TYPE(VP9E_SET_AQ_MODE, unsigned int)


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150408/ea330214/attachment.asc>


More information about the ffmpeg-devel mailing list