~ubuntu-branches/debian/squeeze/gstreamer0.10-ffmpeg/squeeze

« back to all changes in this revision

Viewing changes to gst-libs/ext/ffmpeg/libavcodec/4xm.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-02-19 18:14:59 UTC
  • mfrom: (4.1.5 experimental)
  • Revision ID: james.westby@ubuntu.com-20100219181459-mect96st3px2jfsi
Tags: 0.10.9.2-1
* New upstream pre-release:
  + debian/patches/03_restricted-caps.patch,
    debian/patches/04_ignore-vdpau.patch:
    - Dropped, merged upstream.
* debian/patches/03_too-new-codec-ids.patch:
  + Disable some ffmpeg codec IDs because Debian's
    ffmpeg is once again too old...

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "libavutil/intreadwrite.h"
28
28
#include "avcodec.h"
29
29
#include "dsputil.h"
30
 
#include "bitstream.h"
 
30
#include "get_bits.h"
31
31
#include "bytestream.h"
32
32
 
33
33
//#undef NDEBUG
137
137
    int mv[256];
138
138
    VLC pre_vlc;
139
139
    int last_dc;
140
 
    DECLARE_ALIGNED_8(DCTELEM, block[6][64]);
141
 
    uint8_t *bitstream_buffer;
 
140
    DECLARE_ALIGNED_16(DCTELEM, block)[6][64];
 
141
    void *bitstream_buffer;
142
142
    unsigned int bitstream_buffer_size;
143
143
    int version;
144
144
    CFrameBuffer cfrm[CFRAME_BUFFER_COUNT];
237
237
}
238
238
 
239
239
static av_cold void init_vlcs(FourXContext *f){
 
240
    static VLC_TYPE table[8][32][2];
240
241
    int i;
241
242
 
242
243
    for(i=0; i<8; i++){
 
244
        block_type_vlc[0][i].table= table[i];
 
245
        block_type_vlc[0][i].table_allocated= 32;
243
246
        init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7,
244
247
                 &block_type_tab[0][i][0][1], 2, 1,
245
 
                 &block_type_tab[0][i][0][0], 2, 1, 1);
 
248
                 &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
246
249
    }
247
250
}
248
251
 
375
378
        return -1;
376
379
    }
377
380
 
378
 
    f->bitstream_buffer= av_fast_realloc(f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
379
 
    f->dsp.bswap_buf((uint32_t*)f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
 
381
    av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
 
382
    if (!f->bitstream_buffer)
 
383
        return AVERROR(ENOMEM);
 
384
    f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
380
385
    init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size);
381
386
 
382
387
    f->wordstream= (const uint16_t*)(buf + extra + bitstream_size);
653
658
 
654
659
    prestream_size= length + buf - prestream;
655
660
 
656
 
    f->bitstream_buffer= av_fast_realloc(f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
657
 
    f->dsp.bswap_buf((uint32_t*)f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4);
 
661
    av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
 
662
    if (!f->bitstream_buffer)
 
663
        return AVERROR(ENOMEM);
 
664
    f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4);
658
665
    init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size);
659
666
 
660
667
    f->last_dc= 0*128*8*8;
677
684
 
678
685
static int decode_frame(AVCodecContext *avctx,
679
686
                        void *data, int *data_size,
680
 
                        const uint8_t *buf, int buf_size)
 
687
                        AVPacket *avpkt)
681
688
{
 
689
    const uint8_t *buf = avpkt->data;
 
690
    int buf_size = avpkt->size;
682
691
    FourXContext * const f = avctx->priv_data;
683
692
    AVFrame *picture = data;
684
693
    AVFrame *p, temp;
806
815
    init_vlcs(f);
807
816
 
808
817
    if(f->version>2) avctx->pix_fmt= PIX_FMT_RGB565;
809
 
    else             avctx->pix_fmt= PIX_FMT_RGB555;
 
818
    else             avctx->pix_fmt= PIX_FMT_BGR555;
810
819
 
811
820
    return 0;
812
821
}
823
832
        f->cfrm[i].allocated_size= 0;
824
833
    }
825
834
    free_vlc(&f->pre_vlc);
 
835
    if(f->current_picture.data[0])
 
836
        avctx->release_buffer(avctx, &f->current_picture);
 
837
    if(f->last_picture.data[0])
 
838
        avctx->release_buffer(avctx, &f->last_picture);
826
839
 
827
840
    return 0;
828
841
}
836
849
    NULL,
837
850
    decode_end,
838
851
    decode_frame,
839
 
    /*CODEC_CAP_DR1,*/
 
852
    CODEC_CAP_DR1,
840
853
    .long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
841
854
};
842
855