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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-09-24 17:07:00 UTC
  • mfrom: (1.1.17) (7.1.9 experimental)
  • Revision ID: package-import@ubuntu.com-20130924170700-4dg62s3pwl0pdakz
Tags: 1.2.0-1
* New upstream stable release:
  + debian/control:
    - Build depend on GStreamer and gst-plugins-base >= 1.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 */
22
22
 
23
23
#include "avcodec.h"
 
24
#include "internal.h"
 
25
#include "libavutil/common.h"
24
26
#include "libavutil/intreadwrite.h"
25
27
 
26
28
static av_cold int decode_init(AVCodecContext *avctx)
27
29
{
28
 
    avctx->pix_fmt     = PIX_FMT_YUV420P;
 
30
    avctx->pix_fmt     = AV_PIX_FMT_YUV420P;
29
31
    avctx->coded_frame = avcodec_alloc_frame();
30
32
    if (!avctx->coded_frame)
31
33
        return AVERROR(ENOMEM);
33
35
    return 0;
34
36
}
35
37
 
36
 
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
 
38
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
37
39
                        AVPacket *avpkt)
38
40
{
39
41
    int h, w;
51
53
    }
52
54
 
53
55
    pic->reference = 0;
54
 
    if ((ret = avctx->get_buffer(avctx, pic)) < 0)
 
56
    if ((ret = ff_get_buffer(avctx, pic)) < 0)
55
57
        return ret;
56
58
 
57
59
    pic->pict_type = AV_PICTURE_TYPE_I;
69
71
    V  = pic->data[2];
70
72
    for (h = 0; h < avctx->height; h += 2) {
71
73
        for (w = 0; w < avctx->width; w += 2) {
72
 
            AV_WN16A(Y1 + w, AV_RN16A(src));
73
 
            AV_WN16A(Y2 + w, AV_RN16A(src + 2));
 
74
            AV_COPY16(Y1 + w, src);
 
75
            AV_COPY16(Y2 + w, src + 2);
74
76
            U[w >> 1] = src[4] + 0x80;
75
77
            V[w >> 1] = src[5] + 0x80;
76
78
            src += 6;
81
83
        V  += pic->linesize[2];
82
84
    }
83
85
 
84
 
    *data_size      = sizeof(AVFrame);
 
86
    *got_frame = 1;
85
87
    *(AVFrame*)data = *pic;
86
88
 
87
89
    return avpkt->size;
101
103
    .name           = "dxtory",
102
104
    .long_name      = NULL_IF_CONFIG_SMALL("Dxtory"),
103
105
    .type           = AVMEDIA_TYPE_VIDEO,
104
 
    .id             = CODEC_ID_DXTORY,
 
106
    .id             = AV_CODEC_ID_DXTORY,
105
107
    .init           = decode_init,
106
108
    .close          = decode_close,
107
109
    .decode         = decode_frame,