[FFmpeg-devel] Patch for High color and High bit-depth support
James Zern
jzern at google.com
Tue Apr 7 00:21:59 CEST 2015
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.
>
>>
>> > +#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.
>
>>
>> > - .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.
> 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.
More information about the ffmpeg-devel
mailing list