From: Niklas Haas <g...@haasn.dev>

This is not a good way of generating a PAL8 output. For starters, it totally
mangles the image quality, due to essentially generating BRG8 output instead.
It also drops the input alpha channel, if present. Secondly, we already have
a better way of generating PAL8 content: vf_palettegen/paletteuse.

In the long term, it would be a better idea for us to incorporate a
palettization filter as in internal sws pass when the user requests a palette
format as output. But for now, simply remove this hack.

Fixes: ticket #4444
Signed-off-by: Niklas Haas <g...@haasn.dev>
Sponsored-by: Sovereign Tech Fund
---
 libavfilter/vf_scale.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index d86e50f79b..fba5cc34d8 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -470,7 +470,7 @@ static int query_formats(const AVFilterContext *ctx,
     formats = NULL;
     while ((desc = av_pix_fmt_desc_next(desc))) {
         pix_fmt = av_pix_fmt_desc_get_id(desc);
-        if (sws_test_format(pix_fmt, 1) || pix_fmt == AV_PIX_FMT_PAL8) {
+        if (sws_test_format(pix_fmt, 1)) {
             if ((ret = ff_add_format(&formats, pix_fmt)) < 0)
                 return ret;
         }
@@ -845,11 +845,6 @@ scale:
         return 0;
     }
 
-    if (out->format == AV_PIX_FMT_PAL8) {
-        out->format = AV_PIX_FMT_BGR8;
-        avpriv_set_systematic_pal2((uint32_t*) out->data[1], out->format);
-    }
-
     ret = sws_scale_frame(scale->sws, out, in);
     av_frame_free(&in);
     out->flags = flags_orig;
-- 
2.47.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to