[FFmpeg-devel] [PATCH]Fix 48bit loco png

Michael Niedermayer michaelni at gmx.at
Mon Jan 30 21:20:59 CET 2012


On Sun, Jan 29, 2012 at 10:25:11PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes 48bit loco png and simplifies the code imo.
> 
> Please review, Carl Eugen

>  pngdec.c |   82 ++++++++++++++++++++++-----------------------------------------
>  1 file changed, 29 insertions(+), 53 deletions(-)
> 0eaa274168842f4daa0c586be2a8080dcdd27e3e  patchpngloco.diff
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index c016a62..5573ee9 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -239,46 +239,19 @@ static void png_filter_row(PNGDecContext *s, uint8_t *dst, int filter_type,
>      }
>  }
>  
> -static av_always_inline void convert_to_rgb32_loco(uint8_t *dst, const uint8_t *src, int width, int loco)
> -{
> -    int j;
> -    unsigned int r, g, b, a;
> -
> -    for(j = 0;j < width; j++) {
> -        r = src[0];
> -        g = src[1];
> -        b = src[2];
> -        a = src[3];
> -        if(loco) {
> -            r = (r+g)&0xff;
> -            b = (b+g)&0xff;
> -        }
> -        dst[0] = r;
> -        dst[1] = g;
> -        dst[2] = b;
> -        dst[3] = a;
> -        dst += 4;
> -        src += 4;
> -    }

> +#define DELOCO(NAME, TYPE) \
> +static void deloco_ ## NAME(TYPE *dst, int size, int alpha) \

please call this something else
IRCT would work (for inverse reversible colorspace transform)
but YUV2RGB would too and while inaccurate should be understood by
more people
loco is something bigger than what these 3 lines do

otherwise the patch LGTM

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- 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/20120130/fcc4e581/attachment.asc>


More information about the ffmpeg-devel mailing list