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

Debargha Mukherjee debargha at google.com
Mon Mar 30 19:26:39 CEST 2015


On Fri, Mar 27, 2015 at 8:07 PM, James Zern <jzern at google.com> wrote:

> On Fri, Mar 27, 2015 at 6:58 PM, Debargha Mukherjee <debargha at google.com>
> wrote:
> > [...]
>
> > +#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)
> > +static int set_pix_fmt(AVCodecContext *avctx, struct vpx_codec_enc_cfg
> *enccfg,
> > +                       vpx_codec_flags_t *flags, vpx_img_fmt_t
> *img_fmt) {
> > +    if (avctx->codec_id == AV_CODEC_ID_VP8 && avctx->pix_fmt !=
> AV_PIX_FMT_YUV420P) {
> >
>
> couldn't you just check a codec capability? what happens when vp9 is
> configured
> with high bitdepth encoding disabled?
>

I wanted to insulate against compiling with an older version of libvpx that
did not have the highbitdepth flags defined. This is how we did the
libvpxdec.
I have added a codec caps check also to the code.


>
> > +      av_log(avctx, AV_LOG_ERROR, "Can only encode YUV420P format to
> VP8.\n");
> > +      return AVERROR_INVALIDDATA;
> > +    }
> > +  switch (avctx->pix_fmt) {
> > +    case AV_PIX_FMT_YUV420P:
> >
>
> indent is wrong; 4 spaces in blocks, cases aligned.
>

Corrected.


>
> > -   if (avctx->profile != FF_PROFILE_UNKNOWN)
> > -       enccfg.g_profile = avctx->profile;
> > +    if (avctx->profile != FF_PROFILE_UNKNOWN) {
> > +        enccfg.g_profile = avctx->profile;
> > +    }
> > +
> >
>
> seems unrelated.
>

Corrected a minor indent issue.


>
> > @@ -709,7 +783,6 @@ static int vp8_encode(AVCodecContext *avctx,
> AVPacket *pkt,
> >      int64_t timestamp = 0;
> >      int res, coded_size;
> >      vpx_enc_frame_flags_t flags = 0;
> > -
> >      if (frame) {
> >          rawimg                      = &ctx->rawimg;
> >          rawimg->planes[VPX_PLANE_Y] = frame->data[0];
> > @@ -744,6 +817,7 @@ static int vp8_encode(AVCodecContext *avctx,
> AVPacket *pkt,
> >
> >      res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp,
> >                             avctx->ticks_per_frame, flags,
> ctx->deadline);
> > +
> >      if (res != VPX_CODEC_OK) {
> >          log_encoder_error(avctx, "Error encoding frame");
> >          return AVERROR_INVALIDDATA;
>
> same.
>

Removed.


> _______________________________________________
> 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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Support-for-VP9-high-color-high-bit-depth-encoding.patch
Type: text/x-patch
Size: 8473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150330/f201b8cd/attachment.bin>


More information about the ffmpeg-devel mailing list