[FFmpeg-devel] [PATCH 5/6] avcodec/apng: Add support for blending with GRAY8A pixel format

Donny Yang work at kota.moe
Tue Jun 2 17:49:26 CEST 2015


Signed-off-by: Donny Yang <work at kota.moe>
---
 libavcodec/pngdec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 1f5c433..1667530 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -891,7 +891,8 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
         return AVERROR(ENOMEM);
 
     if (s->blend_op == APNG_BLEND_OP_OVER &&
-        avctx->pix_fmt != AV_PIX_FMT_RGBA) {
+        avctx->pix_fmt != AV_PIX_FMT_RGBA &&
+        avctx->pix_fmt != AV_PIX_FMT_GRAY8A) {
         avpriv_request_sample(avctx, "Blending with pixel format %s",
                               av_get_pix_fmt_name(avctx->pix_fmt));
         return AVERROR_PATCHWELCOME;
@@ -935,6 +936,11 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
                     foreground_alpha = foreground[3];
                     background_alpha = background[3];
                     break;
+
+                case AV_PIX_FMT_GRAY8A:
+                    foreground_alpha = foreground[1];
+                    background_alpha = background[1];
+                    break;
                 }
 
                 if (foreground_alpha == 0)
-- 
2.4.0


More information about the ffmpeg-devel mailing list