On Thursday 18 February 2016 09:40:01 pm Nicolas George wrote: > Initial patch by Carl Eugen Hoyos. > > Fix trac ticket #5249.
Patch with (automatic) support for 8, 10 and 12 bit gbr attached. Please comment, Carl Eugen
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 8992497..c1c1fbe 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -106,6 +106,7 @@ typedef struct VP8EncoderContext { int aq_mode; int drop_threshold; int noise_sensitivity; + int vpx_cs; } VP8Context; /** String mappings for enum vp8e_enc_control_id */ @@ -277,6 +278,7 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps, struct vpx_codec_enc_cfg *enccfg, vpx_codec_flags_t *flags, vpx_img_fmt_t *img_fmt) { + VP8Context *ctx = avctx->priv_data; #ifdef VPX_IMG_FMT_HIGHBITDEPTH enccfg->g_bit_depth = enccfg->g_input_bit_depth = 8; #endif @@ -295,6 +297,8 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps, *img_fmt = VPX_IMG_FMT_I440; return 0; #endif + case AV_PIX_FMT_GBRP: + ctx->vpx_cs = VPX_CS_SRGB; case AV_PIX_FMT_YUV444P: enccfg->g_profile = 1; *img_fmt = VPX_IMG_FMT_I444; @@ -335,11 +339,15 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps, } break; #endif + case AV_PIX_FMT_GBRP10LE: + case AV_PIX_FMT_GBRP12LE: + ctx->vpx_cs = VPX_CS_SRGB; case AV_PIX_FMT_YUV444P10LE: case AV_PIX_FMT_YUV444P12LE: if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { enccfg->g_bit_depth = enccfg->g_input_bit_depth = - avctx->pix_fmt == AV_PIX_FMT_YUV444P10LE ? 10 : 12; + avctx->pix_fmt == AV_PIX_FMT_YUV444P10LE || + avctx->pix_fmt == AV_PIX_FMT_GBRP10LE ? 10 : 12; enccfg->g_profile = 3; *img_fmt = VPX_IMG_FMT_I44416; *flags |= VPX_CODEC_USE_HIGHBITDEPTH; @@ -358,7 +366,11 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps, static void set_colorspace(AVCodecContext *avctx) { enum vpx_color_space vpx_cs; + VP8Context *ctx = avctx->priv_data; + if (ctx->vpx_cs) { + vpx_cs = ctx->vpx_cs; + } else { switch (avctx->colorspace) { case AVCOL_SPC_RGB: vpx_cs = VPX_CS_SRGB; break; case AVCOL_SPC_BT709: vpx_cs = VPX_CS_BT_709; break; @@ -373,6 +385,7 @@ static void set_colorspace(AVCodecContext *avctx) avctx->colorspace); return; } + } codecctl_int(avctx, VP9E_SET_COLOR_SPACE, vpx_cs); } #endif
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel