[FFmpeg-devel] [PATCH] avcodec: add Apple Pixlet decoder

Michael Niedermayer michael at niedermayer.cc
Thu Dec 22 13:46:07 EET 2016


On Wed, Dec 21, 2016 at 09:16:40PM +0100, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  Changelog               |   1 +
>  doc/general.texi        |   1 +
>  libavcodec/Makefile     |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h    |   1 +
>  libavcodec/codec_desc.c |   7 +
>  libavcodec/pixlet.c     | 756 ++++++++++++++++++++++++++++++++++++++++++++++++
>  libavformat/isom.c      |   2 +
>  8 files changed, 770 insertions(+)
>  create mode 100644 libavcodec/pixlet.c
[...]
> +static void reconstruction(AVCodecContext *avctx,
> +                           int16_t *dest, unsigned width, unsigned height, ptrdiff_t stride, int nb_levels,
> +                           float *scaling_H, float *scaling_V, int lowres)
> +{
> +    PixletContext *ctx = avctx->priv_data;
> +    unsigned scaled_width, scaled_height;
> +    float scale_H, scale_V;
> +    int16_t *ptr, *tmp;
> +    int i, j, k;
> +
> +    scaled_height = height >> nb_levels;
> +    scaled_width  = width  >> nb_levels;
> +    tmp = ctx->filter[0];
> +
> +    for (i = 0; i < nb_levels; i++) {
> +        scaled_width  <<= 1;
> +        scaled_height <<= 1;
> +        scale_H = scaling_H[i + lowres];
> +        scale_V = scaling_V[i + lowres];
> +
> +        ptr = dest;
> +        for (j = 0; j < scaled_height; j++) {
> +            filter(ptr, ctx->filter[1], scaled_width, scale_V);
> +            ptr += stride;
> +        }
> +
> +        for (j = 0; j < scaled_width; j++) {
> +            ptr = dest + j;
> +            for (k = 0; k < scaled_height; k++) {
> +                tmp[k] = *ptr;
> +                ptr += stride;
> +            }
> +
> +            filter(tmp, ctx->filter[1], scaled_height, scale_H);
> +
> +            ptr = dest + j;
> +            for (k = 0; k < scaled_height; k++) {
> +                *ptr = tmp[k];
> +                ptr += stride;
> +            }
> +        }
> +    }
> +}
> +

> +#define SQR(a) (a * a)

missinng protection ()

#define SQR(a) ((a) * (a))



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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161222/6f84e604/attachment.sig>


More information about the ffmpeg-devel mailing list