~ubuntu-branches/ubuntu/utopic/libav/utopic

« back to all changes in this revision

Viewing changes to libavcodec/pngdec.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-05-12 22:02:03 UTC
  • mfrom: (1.2.10)
  • mto: (1.1.15 experimental)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: package-import@ubuntu.com-20120512220203-u10qrbxzlcze8z3j
Tags: upstream-0.8.99-1537-gacb2c79
ImportĀ upstreamĀ versionĀ 0.8.99-1537-gacb2c79

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "avcodec.h"
23
23
#include "bytestream.h"
24
24
#include "png.h"
25
 
#include "dsputil.h"
 
25
#include "pngdsp.h"
26
26
 
27
27
/* TODO:
28
28
 * - add 2, 4 and 16 bit depth support
33
33
//#define DEBUG
34
34
 
35
35
typedef struct PNGDecContext {
36
 
    DSPContext dsp;
 
36
    PNGDSPContext dsp;
37
37
 
38
38
    GetByteContext gb;
39
39
    AVFrame picture1, picture2;
189
189
    }
190
190
 
191
191
/* NOTE: 'dst' can be equal to 'last' */
192
 
static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type,
 
192
static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type,
193
193
                           uint8_t *src, uint8_t *last, int size, int bpp)
194
194
{
195
195
    int i, p, r, g, b, a;
233
233
        if(bpp > 1 && size > 4) {
234
234
            // would write off the end of the array if we let it process the last pixel with bpp=3
235
235
            int w = bpp==4 ? size : size-3;
236
 
            dsp->add_png_paeth_prediction(dst+i, src+i, last+i, w-i, bpp);
 
236
            dsp->add_paeth_prediction(dst+i, src+i, last+i, w-i, bpp);
237
237
            i = w;
238
238
        }
239
239
        ff_add_png_paeth_prediction(dst+i, src+i, last+i, size-i, bpp);
630
630
    s->last_picture = &s->picture2;
631
631
    avcodec_get_frame_defaults(&s->picture1);
632
632
    avcodec_get_frame_defaults(&s->picture2);
633
 
    dsputil_init(&s->dsp, avctx);
 
633
    ff_pngdsp_init(&s->dsp);
634
634
 
635
635
    return 0;
636
636
}
656
656
    .close          = png_dec_end,
657
657
    .decode         = decode_frame,
658
658
    .capabilities   = CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
659
 
    .long_name = NULL_IF_CONFIG_SMALL("PNG image"),
 
659
    .long_name      = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
660
660
};