[FFmpeg-devel] [PATCH]Support SOLID_GRAY lagarith frames
Michael Niedermayer
michaelni at gmx.at
Tue Jan 22 15:53:24 CET 2013
On Tue, Jan 22, 2013 at 12:56:39PM +0100, Carl Eugen Hoyos wrote:
> On Tuesday 22 January 2013 12:17:27 pm Paul B Mahol wrote:
> > >> > for (j = 0; j < avctx->height; j++) {
> > >> > + if (frametype == FRAME_SOLID_RGBA) {
> > >>
> > >> if/else in loop when it is not needed/pointless.
> > >
> > > Please elaborate.
> >
> > add another loop for gray case.
>
> Done.
>
> New patch attached, thank you, Carl Eugen
> lagarith.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
> 5cc02984ecf2fcfadafa65d88593dd88d5055fbd patchlagssolidgray2.diff
> diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
> index 486e326..6074a7f 100644
> --- a/libavcodec/lagarith.c
> +++ b/libavcodec/lagarith.c
> @@ -535,6 +535,14 @@ static int lag_decode_frame(AVCodecContext *avctx,
> switch (frametype) {
> case FRAME_SOLID_RGBA:
> avctx->pix_fmt = AV_PIX_FMT_RGB32;
> + case FRAME_SOLID_GRAY:
> + if (frametype == FRAME_SOLID_GRAY)
> + if (avctx->bits_per_coded_sample == 24) {
> + avctx->pix_fmt = AV_PIX_FMT_RGB24;
> + } else {
> + avctx->pix_fmt = AV_PIX_FMT_0RGB32;
> + planes = 4;
> + }
>
> if (ff_thread_get_buffer(avctx, p) < 0) {
> av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> @@ -542,11 +550,16 @@ static int lag_decode_frame(AVCodecContext *avctx,
> }
>
> dst = p->data[0];
> + if (frametype == FRAME_SOLID_RGBA) {
> for (j = 0; j < avctx->height; j++) {
> for (i = 0; i < avctx->width; i++)
> AV_WN32(dst + i * 4, offset_gu);
> dst += p->linesize[0];
> }
> + } else {
> + for (j = 0; j < avctx->height; j++)
> + memset(dst, buf[1], avctx->width * planes);
this repeatly memsets dst without advancing the pointer
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130122/a77c8a91/attachment.asc>
More information about the ffmpeg-devel
mailing list