From 4dd5fdc0876e30de6ddabc1a8ab0263a1d4404d3 Mon Sep 17 00:00:00 2001 From: Shreesh Adiga <16567adigashreesh@gmail.com> Date: Fri, 27 Nov 2020 15:55:51 +0530 Subject: vo_sixel: skip testdither init in fixed palette testdither was being created irrespective of whether opt_fixedpal is set or not. In case of opt_fixedpal=1, testdither is not used in the `prepare_static_palette` code. Hence only initialize it when opt_fixedpal is 0. --- video/out/vo_sixel.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'video/out') diff --git a/video/out/vo_sixel.c b/video/out/vo_sixel.c index 3365daa48a..46c289dafe 100644 --- a/video/out/vo_sixel.c +++ b/video/out/vo_sixel.c @@ -299,12 +299,16 @@ static int reconfig(struct vo *vo, struct mp_image_params *params) vo->want_redraw = true; dealloc_dithers_and_buffer(vo); - SIXELSTATUS status = sixel_dither_new(&priv->testdither, - priv->opt_reqcolors, NULL); - if (SIXEL_FAILED(status)) { - MP_ERR(vo, "reconfig: Failed to create new dither: %s\n", - sixel_helper_format_error(status)); - return -1; + + // create testdither only if dynamic palette mode is set + if (!priv->opt_fixedpal) { + SIXELSTATUS status = sixel_dither_new(&priv->testdither, + priv->opt_reqcolors, NULL); + if (SIXEL_FAILED(status)) { + MP_ERR(vo, "reconfig: Failed to create new dither: %s\n", + sixel_helper_format_error(status)); + return -1; + } } priv->buffer = @@ -400,12 +404,15 @@ static int preinit(struct vo *vo) printf(ESC_USE_GLOBAL_COLOR_REG); priv->dither = NULL; - status = sixel_dither_new(&priv->testdither, priv->opt_reqcolors, NULL); - if (SIXEL_FAILED(status)) { - MP_ERR(vo, "preinit: Failed to create new dither: %s\n", - sixel_helper_format_error(status)); - return -1; + // create testdither only if dynamic palette mode is set + if (!priv->opt_fixedpal) { + status = sixel_dither_new(&priv->testdither, priv->opt_reqcolors, NULL); + if (SIXEL_FAILED(status)) { + MP_ERR(vo, "preinit: Failed to create new dither: %s\n", + sixel_helper_format_error(status)); + return -1; + } } resize(vo); -- cgit v1.2.3