From a76cc1dafcf948cce93f6d258e33444206a83c45 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 28 Feb 2015 20:15:12 +0100 Subject: Revert "Revert recent vo_opengl related commits" Omitted a simple, but devastasting check. Fixed the relevant commits now. This reverts commit 8d24e9d9b8ad1b5d82139980eca148dc0f4a1eab. diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 9c8a643..f1ea03e 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1034,9 +1034,9 @@ static void compile_shaders(struct gl_video *p) shader_def_opt(&header_conv, "USE_CONV_GAMMA", use_conv_gamma); shader_def_opt(&header_conv, "USE_CONST_LUMA", use_const_luma); shader_def_opt(&header_conv, "USE_LINEAR_LIGHT_BT1886", - gamma_fun == MP_CSP_TRC_BT_1886); + use_linear_light && gamma_fun == MP_CSP_TRC_BT_1886); shader_def_opt(&header_conv, "USE_LINEAR_LIGHT_SRGB", - gamma_fun == MP_CSP_TRC_SRGB); + use_linear_light && gamma_fun == MP_CSP_TRC_SRGB); shader_def_opt(&header_conv, "USE_SIGMOID", use_sigmoid); if (p->opts.alpha_mode > 0 && p->has_alpha && p->plane_count > 3) shader_def(&header_conv, "USE_ALPHA_PLANE", "3"); --- video/image_writer.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'video/image_writer.c') diff --git a/video/image_writer.c b/video/image_writer.c index ff321cfd1f..700e1c4284 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -50,6 +50,7 @@ const struct image_writer_opts image_writer_opts_defaults = { .jpeg_dpi = 72, .jpeg_progressive = 0, .jpeg_baseline = 1, + .tag_csp = 1, }; #define OPT_BASE_STRUCT struct image_writer_opts @@ -65,6 +66,7 @@ const struct m_sub_options image_writer_conf = { OPT_INTRANGE("png-compression", png_compression, 0, 0, 9), OPT_INTRANGE("png-filter", png_filter, 0, 0, 5), OPT_STRING("format", format, 0), + OPT_FLAG("tag-colorspace", tag_csp, 0), {0}, }, .size = sizeof(struct image_writer_opts), @@ -131,6 +133,12 @@ static int write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) pic->format = avctx->pix_fmt; pic->width = avctx->width; pic->height = avctx->height; +#if HAVE_AVFRAME_CSP + if (ctx->opts->tag_csp) { + pic->color_primaries = mp_csp_prim_to_avcol_pri(image->params.primaries); + pic->color_trc = mp_csp_trc_to_avcol_trc(image->params.gamma); + } +#endif int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output); if (ret < 0) goto error_exit; -- cgit v1.2.3