~ubuntu-branches/ubuntu/trusty/gst-libav1.0/trusty-proposed

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavcodec/kmvc.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-07-13 11:39:37 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20130713113937-46ye1u0rcmfbxs7e
Tags: 1.0.8-1
New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#include "avcodec.h"
31
31
#include "bytestream.h"
 
32
#include "internal.h"
 
33
#include "libavutil/common.h"
32
34
 
33
35
#define KMVC_KEYFRAME 0x80
34
36
#define KMVC_PALETTE  0x40
46
48
    int palsize;
47
49
    uint32_t pal[MAX_PALSIZE];
48
50
    uint8_t *cur, *prev;
49
 
    uint8_t *frm0, *frm1;
 
51
    uint8_t frm0[320 * 200], frm1[320 * 200];
50
52
    GetByteContext g;
51
53
} KmvcContext;
52
54
 
55
57
    int bitbuf;
56
58
} BitBuf;
57
59
 
58
 
#define BLK(data, x, y)  data[(x) + (y) * 320]
 
60
#define BLK(data, x, y)  data[av_clip((x) + (y) * 320, 0, 320 * 200 -1)]
59
61
 
60
62
#define kmvc_init_getbits(bb, g)  bb.bits = 7; bb.bitbuf = bytestream2_get_byte(g);
61
63
 
367
369
        return -1;
368
370
    }
369
371
 
370
 
    c->frm0 = av_mallocz(320 * 200);
371
 
    c->frm1 = av_mallocz(320 * 200);
372
372
    c->cur = c->frm0;
373
373
    c->prev = c->frm1;
374
374
 
401
401
    return 0;
402
402
}
403
403
 
404
 
 
405
 
 
406
 
/*
407
 
 * Uninit kmvc decoder
408
 
 */
409
 
static av_cold int decode_end(AVCodecContext * avctx)
410
 
{
411
 
    KmvcContext *const c = avctx->priv_data;
412
 
 
413
 
    av_freep(&c->frm0);
414
 
    av_freep(&c->frm1);
415
 
    if (c->pic.data[0])
416
 
        avctx->release_buffer(avctx, &c->pic);
417
 
 
418
 
    return 0;
419
 
}
420
 
 
421
404
AVCodec ff_kmvc_decoder = {
422
405
    .name           = "kmvc",
423
406
    .type           = AVMEDIA_TYPE_VIDEO,
424
407
    .id             = CODEC_ID_KMVC,
425
408
    .priv_data_size = sizeof(KmvcContext),
426
409
    .init           = decode_init,
427
 
    .close          = decode_end,
428
410
    .decode         = decode_frame,
429
411
    .capabilities   = CODEC_CAP_DR1,
430
412
    .long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),