Re: [FFmpeg-devel] [PATCH 6/6] avcodec/apng: Add partial support for blending with PAL8 pixel format
On Mon, Jun 08, 2015 at 02:35:28PM +0200, Paul B Mahol wrote: > On 6/2/15, Donny Yang wrote: > > Currently restricted to blending pixels that only contain either > > 0 or 255 in their alpha components > > > > Signed-off-by: Donny Yang > > --- > > libavcodec/pngdec.c | 15 ++- > > 1 file changed, 14 insertions(+), 1 deletion(-) > > > > lgtm applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 6/6] avcodec/apng: Add partial support for blending with PAL8 pixel format
On 6/2/15, Donny Yang wrote: > Currently restricted to blending pixels that only contain either > 0 or 255 in their alpha components > > Signed-off-by: Donny Yang > --- > libavcodec/pngdec.c | 15 ++- > 1 file changed, 14 insertions(+), 1 deletion(-) > lgtm ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 6/6] avcodec/apng: Add partial support for blending with PAL8 pixel format
On Tue, Jun 02, 2015 at 03:49:27PM +, Donny Yang wrote: > Currently restricted to blending pixels that only contain either > 0 or 255 in their alpha components > > Signed-off-by: Donny Yang > --- > libavcodec/pngdec.c | 15 ++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c > index 1667530..4063347 100644 > --- a/libavcodec/pngdec.c > +++ b/libavcodec/pngdec.c > @@ -892,7 +892,8 @@ static int handle_p_frame_apng(AVCodecContext *avctx, > PNGDecContext *s, > > if (s->blend_op == APNG_BLEND_OP_OVER && > avctx->pix_fmt != AV_PIX_FMT_RGBA && > -avctx->pix_fmt != AV_PIX_FMT_GRAY8A) { > +avctx->pix_fmt != AV_PIX_FMT_GRAY8A && > +avctx->pix_fmt != AV_PIX_FMT_PAL8) { > avpriv_request_sample(avctx, "Blending with pixel format %s", >av_get_pix_fmt_name(avctx->pix_fmt)); > return AVERROR_PATCHWELCOME; > @@ -941,6 +942,11 @@ static int handle_p_frame_apng(AVCodecContext *avctx, > PNGDecContext *s, > foreground_alpha = foreground[1]; > background_alpha = background[1]; > break; > + > +case AV_PIX_FMT_PAL8: > +foreground_alpha = s->palette[foreground[0]] >> 24; > +background_alpha = s->palette[background[0]] >> 24; > +break; > } > > if (foreground_alpha == 0) > @@ -951,6 +957,13 @@ static int handle_p_frame_apng(AVCodecContext *avctx, > PNGDecContext *s, > continue; > } > > +if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { > +// TODO: Alpha blending with PAL8 will likely need the > entire image converted over to RGBA first yes, thats what i suspect as well [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 6/6] avcodec/apng: Add partial support for blending with PAL8 pixel format
Currently restricted to blending pixels that only contain either 0 or 255 in their alpha components Signed-off-by: Donny Yang --- libavcodec/pngdec.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 1667530..4063347 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -892,7 +892,8 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s, if (s->blend_op == APNG_BLEND_OP_OVER && avctx->pix_fmt != AV_PIX_FMT_RGBA && -avctx->pix_fmt != AV_PIX_FMT_GRAY8A) { +avctx->pix_fmt != AV_PIX_FMT_GRAY8A && +avctx->pix_fmt != AV_PIX_FMT_PAL8) { avpriv_request_sample(avctx, "Blending with pixel format %s", av_get_pix_fmt_name(avctx->pix_fmt)); return AVERROR_PATCHWELCOME; @@ -941,6 +942,11 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s, foreground_alpha = foreground[1]; background_alpha = background[1]; break; + +case AV_PIX_FMT_PAL8: +foreground_alpha = s->palette[foreground[0]] >> 24; +background_alpha = s->palette[background[0]] >> 24; +break; } if (foreground_alpha == 0) @@ -951,6 +957,13 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s, continue; } +if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { +// TODO: Alpha blending with PAL8 will likely need the entire image converted over to RGBA first +avpriv_request_sample(avctx, "Alpha blending palette samples"); +background[0] = foreground[0]; +continue; +} + output_alpha = foreground_alpha + FAST_DIV255((255 - foreground_alpha) * background_alpha); for (b = 0; b < s->bpp - 1; ++b) { -- 2.4.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel