[FFmpeg-devel] [PATCH] lavc: fix FF_LOSS_COLORQUANT detection for gray8a->pal8

Michael Niedermayer michaelni at gmx.at
Wed Jan 18 16:17:06 CET 2012


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/imgconvert.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index e600d1c..8b32230 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -456,8 +456,9 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_
     if (!pf->is_alpha && (ps->is_alpha && has_alpha))
         loss |= FF_LOSS_ALPHA;
     if (dst_pix_fmt == PIX_FMT_PAL8 &&
-        (src_pix_fmt != PIX_FMT_PAL8 && ps->color_type != FF_COLOR_GRAY))
+        (src_pix_fmt != PIX_FMT_PAL8 && (ps->color_type != FF_COLOR_GRAY || (ps->is_alpha && has_alpha))))
         loss |= FF_LOSS_COLORQUANT;
+
     return loss;
 }
 
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list