~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/interplayvideo.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc, Andrew Starr-Bochicchio, Lionel Le Folgoc
  • Date: 2008-12-26 00:10:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081226001006-2040ls9680bd1blt
Tags: 1.1.7-0.2ubuntu1
[ Andrew Starr-Bochicchio ]
* Merge from debian-multimedia (LP: #298547), Ubuntu Changes:
 - For ffmpeg-related build-deps, fix versionized dependencies
   as the ubuntu versioning is different than debian-multimedia's.

[ Lionel Le Folgoc ]
* LP: #311412 is fixed since the 1.1.7~rc1-0.1 revision.
* debian/patches/03_ffmpeg.diff: updated to fix FTBFS due to libswscale API
  change (cherry-pick from Gentoo #234383).

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * You should have received a copy of the GNU Lesser General Public
18
18
 * License along with FFmpeg; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
 
 *
21
20
 */
22
21
 
23
22
/**
40
39
#include <string.h>
41
40
#include <unistd.h>
42
41
 
43
 
#include "common.h"
44
42
#include "avcodec.h"
 
43
#include "bytestream.h"
45
44
#include "dsputil.h"
46
45
 
47
46
#define PALETTE_COUNT 256
61
60
    AVFrame second_last_frame;
62
61
    AVFrame last_frame;
63
62
    AVFrame current_frame;
64
 
    unsigned char *decoding_map;
 
63
    const unsigned char *decoding_map;
65
64
    int decoding_map_size;
66
65
 
67
 
    unsigned char *buf;
 
66
    const unsigned char *buf;
68
67
    int size;
69
68
 
70
 
    unsigned char *stream_ptr;
71
 
    unsigned char *stream_end;
 
69
    const unsigned char *stream_ptr;
 
70
    const unsigned char *stream_end;
72
71
    unsigned char *pixel_ptr;
73
72
    int line_inc;
74
73
    int stride;
298
297
 
299
298
        /* need 2 more bytes from the stream */
300
299
        CHECK_STREAM_PTR(2);
301
 
        B[0] = *s->stream_ptr++;
302
 
        B[1] = *s->stream_ptr++;
303
300
 
304
 
        flags = (B[1] << 8) | B[0];
 
301
        flags = bytestream_get_le16(&s->stream_ptr);
305
302
        bitmask = 0x0001;
306
303
        for (y = 0; y < 8; y += 2) {
307
304
            for (x = 0; x < 8; x += 2, bitmask <<= 1) {
479
476
{
480
477
    int x, y;
481
478
    unsigned char P[4];
482
 
    unsigned char B[4];
483
479
    unsigned int flags = 0;
484
480
    int shifter = 0;
485
481
    unsigned char pix;
497
493
 
498
494
        for (y = 0; y < 8; y++) {
499
495
            /* get the next set of 8 2-bit flags */
500
 
            flags = (s->stream_ptr[1] << 8) | s->stream_ptr[0];
501
 
            s->stream_ptr += 2;
 
496
            flags = bytestream_get_le16(&s->stream_ptr);
502
497
            for (x = 0, shifter = 0; x < 8; x++, shifter += 2) {
503
498
                *s->pixel_ptr++ = P[(flags >> shifter) & 0x03];
504
499
            }
510
505
        /* 1 of 4 colors for each 2x2 block, need 4 more bytes */
511
506
        CHECK_STREAM_PTR(4);
512
507
 
513
 
        B[0] = *s->stream_ptr++;
514
 
        B[1] = *s->stream_ptr++;
515
 
        B[2] = *s->stream_ptr++;
516
 
        B[3] = *s->stream_ptr++;
517
 
        flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
 
508
        flags = bytestream_get_le32(&s->stream_ptr);
518
509
        shifter = 0;
519
510
 
520
511
        for (y = 0; y < 8; y += 2) {
536
527
        for (y = 0; y < 8; y++) {
537
528
            /* time to reload flags? */
538
529
            if ((y == 0) || (y == 4)) {
539
 
                B[0] = *s->stream_ptr++;
540
 
                B[1] = *s->stream_ptr++;
541
 
                B[2] = *s->stream_ptr++;
542
 
                B[3] = *s->stream_ptr++;
543
 
                flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
 
530
                flags = bytestream_get_le32(&s->stream_ptr);
544
531
                shifter = 0;
545
532
            }
546
533
            for (x = 0; x < 8; x += 2, shifter += 2) {
559
546
        for (y = 0; y < 8; y += 2) {
560
547
            /* time to reload flags? */
561
548
            if ((y == 0) || (y == 4)) {
562
 
                B[0] = *s->stream_ptr++;
563
 
                B[1] = *s->stream_ptr++;
564
 
                B[2] = *s->stream_ptr++;
565
 
                B[3] = *s->stream_ptr++;
566
 
                flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
 
549
                flags = bytestream_get_le32(&s->stream_ptr);
567
550
                shifter = 0;
568
551
            }
569
552
            for (x = 0; x < 8; x++, shifter += 2) {
821
804
    s->line_inc = s->stride - 8;
822
805
    s->upper_motion_limit_offset = (s->avctx->height - 8) * s->stride
823
806
        + s->avctx->width - 8;
824
 
    s->dsp = s->dsp;
825
807
 
826
808
    for (y = 0; y < (s->stride * s->avctx->height); y += s->stride * 8) {
827
809
        for (x = y; x < y + s->avctx->width; x += 8) {
853
835
    }
854
836
}
855
837
 
856
 
static int ipvideo_decode_init(AVCodecContext *avctx)
 
838
static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
857
839
{
858
840
    IpvideoContext *s = avctx->priv_data;
859
841
 
865
847
    }
866
848
 
867
849
    avctx->pix_fmt = PIX_FMT_PAL8;
868
 
    avctx->has_b_frames = 0;
869
850
    dsputil_init(&s->dsp, avctx);
870
851
 
871
852
    /* decoding map contains 4 bits of information per 8x8 block */
897
878
 
898
879
static int ipvideo_decode_frame(AVCodecContext *avctx,
899
880
                                void *data, int *data_size,
900
 
                                uint8_t *buf, int buf_size)
 
881
                                const uint8_t *buf, int buf_size)
901
882
{
902
883
    IpvideoContext *s = avctx->priv_data;
903
884
    AVPaletteControl *palette_control = avctx->palctrl;
938
919
    return buf_size;
939
920
}
940
921
 
941
 
static int ipvideo_decode_end(AVCodecContext *avctx)
 
922
static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
942
923
{
943
924
    IpvideoContext *s = avctx->priv_data;
944
925
 
961
942
    ipvideo_decode_end,
962
943
    ipvideo_decode_frame,
963
944
    CODEC_CAP_DR1,
 
945
    .long_name = "Interplay MVE Video",
964
946
};