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.
This commit is contained in:
Shreesh Adiga 2020-11-27 15:55:51 +05:30 committed by avih
parent 24525e4ef9
commit 4dd5fdc087
1 changed files with 18 additions and 11 deletions

View File

@ -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);