diff options
author | Shreesh Adiga <16567adigashreesh@gmail.com> | 2020-11-27 15:55:51 +0530 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2020-11-27 15:31:24 +0200 |
commit | 4dd5fdc0876e30de6ddabc1a8ab0263a1d4404d3 (patch) | |
tree | ffd4a51bd875722b5d15bf9f7be9e02c66cd9514 /video/out | |
parent | 24525e4ef9ba27ab770fddfb2055f0d0dc8b3bea (diff) | |
download | mpv-4dd5fdc0876e30de6ddabc1a8ab0263a1d4404d3.tar.bz2 mpv-4dd5fdc0876e30de6ddabc1a8ab0263a1d4404d3.tar.xz |
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.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/vo_sixel.c | 29 |
1 files changed, 18 insertions, 11 deletions
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); |