On Sat, Jun 20, 2015 at 12:29 PM, Ronald S. Bultje <rsbul...@gmail.com> wrote: > Hi, > > On Sat, Jun 20, 2015 at 3:15 PM, James Zern <jz...@google.com> wrote: > >> On Wed, Jun 17, 2015 at 12:20 PM, James Zern <jz...@google.com> wrote: >> > the vp9 bitstream supports 8 values: >> > unknown (default), bt601, bt709, smpte170, smpte240, bt2020, reserved >> > and sRGB. >> > --- >> > doc/encoders.texi | 12 ++++++++++++ >> > libavcodec/libvpxenc.c | 29 +++++++++++++++++++++++++++++ >> > 2 files changed, 41 insertions(+) >> > >> >> I'll submit this soon if there are no more comments. >> >> > diff --git a/doc/encoders.texi b/doc/encoders.texi >> > index 8b0ecb7..8fed2fc 100644 >> > --- a/doc/encoders.texi >> > +++ b/doc/encoders.texi >> > @@ -1550,6 +1550,18 @@ Enable frame parallel decodability features. >> > @item aq-mode >> > Set adaptive quantization mode (0: off (default), 1: variance 2: >> complexity, 3: >> > cyclic refresh). >> > +@item colorspace @emph{color-space} >> > +Set input color space. The VP9 bitstream supports signaling the >> following >> > +colorspaces: >> > +@table @option >> > +@item @samp{rgb} @emph{sRGB} >> > +@item @samp{bt709} @emph{bt709} >> > +@item @samp{unspecified} @emph{unknown} >> > +@item @samp{bt470bg} @emph{bt601} >> > +@item @samp{smpte170m} @emph{smpte170} >> > +@item @samp{smpte240m} @emph{smpte240} >> > +@item @samp{bt2020_ncl} @emph{bt2020} >> > +@end table >> > @end table >> > >> > @end table >> > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c >> > index 28a0e14..b2deb5d 100644 >> > --- a/libavcodec/libvpxenc.c >> > +++ b/libavcodec/libvpxenc.c >> > @@ -128,6 +128,9 @@ static const char *const ctlidstr[] = { >> > [VP9E_SET_TILE_ROWS] = "VP9E_SET_TILE_ROWS", >> > [VP9E_SET_FRAME_PARALLEL_DECODING] = >> "VP9E_SET_FRAME_PARALLEL_DECODING", >> > [VP9E_SET_AQ_MODE] = "VP9E_SET_AQ_MODE", >> > +#if VPX_ENCODER_ABI_VERSION > 8 >> > + [VP9E_SET_COLOR_SPACE] = "VP9E_SET_COLOR_SPACE", >> > +#endif >> > #endif >> > }; >> > >> > @@ -349,6 +352,29 @@ static int set_pix_fmt(AVCodecContext *avctx, >> vpx_codec_caps_t codec_caps, >> > av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format.\n"); >> > return AVERROR_INVALIDDATA; >> > } >> > + >> > +#if VPX_ENCODER_ABI_VERSION > 8 >> > +static void set_colorspace(AVCodecContext *avctx) >> > +{ >> > + enum vpx_color_space vpx_cs; >> > + >> > + switch (avctx->colorspace) { >> > + case AVCOL_SPC_RGB: vpx_cs = VPX_CS_SRGB; break; >> > + case AVCOL_SPC_BT709: vpx_cs = VPX_CS_BT_709; break; >> > + case AVCOL_SPC_UNSPECIFIED: vpx_cs = VPX_CS_UNKNOWN; break; >> > + case AVCOL_SPC_RESERVED: vpx_cs = VPX_CS_RESERVED; break; >> > + case AVCOL_SPC_BT470BG: vpx_cs = VPX_CS_BT_601; break; >> > + case AVCOL_SPC_SMPTE170M: vpx_cs = VPX_CS_SMPTE_170; break; >> > + case AVCOL_SPC_SMPTE240M: vpx_cs = VPX_CS_SMPTE_240; break; >> > + case AVCOL_SPC_BT2020_NCL: vpx_cs = VPX_CS_BT_2020; break; >> > + default: >> > + av_log(avctx, AV_LOG_WARNING, "Unsupported colorspace (%d)\n", >> > + avctx->colorspace); >> > + return; >> > + } >> > + codecctl_int(avctx, VP9E_SET_COLOR_SPACE, vpx_cs); >> > +} >> > +#endif >> > #endif >> > >> > static av_cold int vpx_init(AVCodecContext *avctx, >> > @@ -593,6 +619,9 @@ static av_cold int vpx_init(AVCodecContext *avctx, >> > codecctl_int(avctx, VP9E_SET_FRAME_PARALLEL_DECODING, >> ctx->frame_parallel); >> > if (ctx->aq_mode >= 0) >> > codecctl_int(avctx, VP9E_SET_AQ_MODE, ctx->aq_mode); >> > +#if VPX_ENCODER_ABI_VERSION > 8 >> > + set_colorspace(avctx); >> > +#endif >> > } >> > #endif >> > >> > -- >> > 2.2.0.rc0.207.ga3a616c >> > > Yes I think this is fine. >
applied. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel