[FFmpeg-devel] [PATCH] avcodec: add Apple Pixlet decoder
Paul B Mahol
onemda at gmail.com
Thu Dec 22 19:27:58 EET 2016
On 12/22/16, Michael Niedermayer <michael at niedermayer.cc> wrote:
> 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))
>
Fixed locally, I also removed lowres support, can be readded if wanted. and
I changed code so it does not have so many memcpy calls.
Gonna apply, unless I see objections.
More information about the ffmpeg-devel
mailing list