~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/4xm.c

  • Committer: Gauvain Pocentek
  • Date: 2012-03-06 11:59:12 UTC
  • mfrom: (66.1.15 precise)
  • Revision ID: gauvain@pocentek.net-20120306115912-h9d6kt9j0l532oo5
* Merge from Ubuntu:
  - put back faac support
  - recommends apport-hooks-medibuntu
  - change Maintainer, Uploaders & Vcs-* fields.
* New upstream snapshot
* upload to unstable
* Build against external libmpeg2
* drop 51_FTBFS_arm.patch again
* no longer build depend on libcdparanoia-dev on the Hurd
* Fix FTBFS on the hurd.
  Thanks to Samuel Thibault <sthibault@debian.org> (Closes: #654974)
* Fix FTBFS on arm
* New upstream snapshot, Closes: #650339, #643621, #481807
* Imported Upstream version 1.0~rc4+svn34492
* Bump standards version
* Bump dependency on libav >= 4:0.8~, Closes: #653887
* Fix build-indep
* Build mplayer-gui again, Closes: #568514
* Drop debian/all-lang-config-mak.sh, no longer needed
* include .dfsg1 in version number
* remove get-orig-source target
* no longer prune compiler flags from the environment
* No longer advertise nor build 3fdx, mga and dxr3 backends,
  Closes: #496106, #442181, #533546
* beautify mplayer version identification string
* Brown paperbag upload.
* Next try to fix build failure on sparce after recent binutils change.
* Brown paperbag upload.
* Really fix build failure on sparc after recent binutils change.
* Properly set Replaces/Conflicts on mplayer2{,-dbg} to avoid
  file overwrite errors.
* Adjust versioning of mplayer listed in the mplayer-dbg's Depends field.
* Fix build failure on sparc after recent binutils change.
* Urgency medium bumped because of RC-level bugfix
  and speeding up x264 transition.
* Update to my @debian.org email.
* Upload to unstable
* Enable joystick support on Linux only, Closes: #638408
* Rebuild fixes toolchain issue on arm, Closes: #637077
* New upstream snapshot
* following the discussion started by Diego Biurrun <diego@biurrun.de>
  in debian-devel, I have prepared a new packaging of 'mplayer'
  (with code that comes from CVS)
* the upstream tar.bz cannot be distributed by Debian, since it contains
   CSS code; so I am repackaging it 
* I have tried my best to address all known issues:
  - the package contains the detailed Copyright made by Diego Biurrun 
  - the package does not contain CSS code, or  AFAIK other code on which 
     there is active patent enforcement
  - there is a script  debian/cvs-changelog.sh  that shows all changes
     done to files included in this source.
    This should comply with GPLv2 sec 2.a  (in spirit if not in letter)
    For this reason, the source code contains CVS directories.
* needs   make (>= 3.80) for 'html-chunked-$(1)' in DOCS/xml/Makefile

* some corrections, as suggested Diego Biurrun
  - binary codecs should go into /usr/lib/codecs (upstream default)
  - better template 'mplayer/install_codecs'
  - an empty 'font=' in mplayer.conf breaks mplayer: postinst corrected
* correction in 'mplayer/cfgnote'
* better mplayer.postinst and mplayer.config

* New upstream release
* better debian/copyright file
* do not ship a skin
* New upstream release
* changed DEB_BUILD_OPTIONS to DEB_BUILD_CONFIGURE ,
  DEB_BUILD_OPTIONS is used as in debian policy
* use gcc-3.4
* changed xlibs-dev to a long list of dependencies, for Debian/etch
* try to adhere to  http://www.mplayerhq.hu/DOCS/tech/binary-packaging.txt
  (see README.Debian for details)
* removed dependency on xlibmesa-dev, disabled opengl
* New upstream release
* Simon McVittie <hacks@pseudorandom.co.uk> wonderful work:
- Work around Debian bug #267442 (glibc's sys/uio.h and gcc's altivec.h have
  conflicting uses for __vector) by re-ordering #includes
- Fix potential symlink attack in ./configure
- Disable support for binary codecs on platforms for which those codecs
  aren't available; also disable the corresponding Debconf note when it's
  inappropriate
- Changed Build-Depends: so it works in pbuilder
- Explicitly build-depend on libjpeg62-dev, libfontconfig1-dev,
  libungif4-dev 
- Tweak debian/rules to avoid certain errors being ignored
- Use --language=all
* provide a target  'debian/rules get-orig-source' 
  that recreates the orig.tar.gz ; then use the above orig.tar.gz
* rewrote some parts of debian/rules
* don't clean and recompile docs if upstream ships them
* mplayer-doc was shipping too much stuff
* translated man pages where not installed properly
* compile with libdv4-dev
* correct README.Debian
* Forgot build-dep on libtheora
* Must not depend on libxvidcore
* New upstream release
* new release.
* rc1 to become 0.90
* new pre-release
* new pre-release
* gtk bug fixed.
* new release.
* version bumped
* 0.60 pre2 release
* 0.60 pre-release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
    AVFrame current_picture, last_picture;
133
133
    GetBitContext pre_gb;          ///< ac/dc prefix
134
134
    GetBitContext gb;
135
 
    const uint8_t *bytestream;
136
 
    const uint16_t *wordstream;
 
135
    GetByteContext g;
 
136
    GetByteContext g2;
137
137
    int mv[256];
138
138
    VLC pre_vlc;
139
139
    int last_dc;
277
277
    }
278
278
#endif
279
279
 
280
 
static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, int dc){
 
280
static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, unsigned dc){
281
281
   int i;
282
282
   dc*= 0x10001;
283
283
 
328
328
    assert(code>=0 && code<=6);
329
329
 
330
330
    if(code == 0){
331
 
        src += f->mv[ *f->bytestream++ ];
 
331
        src += f->mv[bytestream2_get_byte(&f->g)];
332
332
        if(start > src || src > end){
333
333
            av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
334
334
            return;
345
345
    }else if(code == 3 && f->version<2){
346
346
        mcdc(dst, src, log2w, h, stride, 1, 0);
347
347
    }else if(code == 4){
348
 
        src += f->mv[ *f->bytestream++ ];
 
348
        src += f->mv[bytestream2_get_byte(&f->g)];
349
349
        if(start > src || src > end){
350
350
            av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
351
351
            return;
352
352
        }
353
 
        mcdc(dst, src, log2w, h, stride, 1, av_le2ne16(*f->wordstream++));
 
353
        mcdc(dst, src, log2w, h, stride, 1, bytestream2_get_le16(&f->g2));
354
354
    }else if(code == 5){
355
 
        mcdc(dst, src, log2w, h, stride, 0, av_le2ne16(*f->wordstream++));
 
355
        mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16(&f->g2));
356
356
    }else if(code == 6){
357
357
        if(log2w){
358
 
            dst[0] = av_le2ne16(*f->wordstream++);
359
 
            dst[1] = av_le2ne16(*f->wordstream++);
 
358
            dst[0] = bytestream2_get_le16(&f->g2);
 
359
            dst[1] = bytestream2_get_le16(&f->g2);
360
360
        }else{
361
 
            dst[0     ] = av_le2ne16(*f->wordstream++);
362
 
            dst[stride] = av_le2ne16(*f->wordstream++);
 
361
            dst[0     ] = bytestream2_get_le16(&f->g2);
 
362
            dst[stride] = bytestream2_get_le16(&f->g2);
363
363
        }
364
364
    }
365
365
}
371
371
    uint16_t *src= (uint16_t*)f->last_picture.data[0];
372
372
    uint16_t *dst= (uint16_t*)f->current_picture.data[0];
373
373
    const int stride= f->current_picture.linesize[0]>>1;
374
 
    unsigned int bitstream_size, bytestream_size, wordstream_size, extra;
 
374
    unsigned int bitstream_size, bytestream_size, wordstream_size, extra, bytestream_offset, wordstream_offset;
375
375
 
376
376
    if(f->version>1){
377
377
        extra=20;
399
399
    if (!f->bitstream_buffer)
400
400
        return AVERROR(ENOMEM);
401
401
    f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
 
402
    memset((uint8_t*)f->bitstream_buffer + bitstream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
402
403
    init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size);
403
404
 
404
 
    f->wordstream= (const uint16_t*)(buf + extra + bitstream_size);
405
 
    f->bytestream= buf + extra + bitstream_size + wordstream_size;
 
405
    wordstream_offset = extra + bitstream_size;
 
406
    bytestream_offset = extra + bitstream_size + wordstream_size;
 
407
    bytestream2_init(&f->g2, buf + wordstream_offset, length - wordstream_offset);
 
408
    bytestream2_init(&f->g,  buf + bytestream_offset, length - bytestream_offset);
406
409
 
407
410
    init_mv(f);
408
411
 
414
417
        dst += 8*stride;
415
418
    }
416
419
 
417
 
    if(   bitstream_size != (get_bits_count(&f->gb)+31)/32*4
418
 
       || (((const char*)f->wordstream - (const char*)buf + 2)&~2) != extra + bitstream_size + wordstream_size
419
 
       || (((const char*)f->bytestream - (const char*)buf + 3)&~3) != extra + bitstream_size + wordstream_size + bytestream_size)
420
 
        av_log(f->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n",
421
 
            bitstream_size - (get_bits_count(&f->gb)+31)/32*4,
422
 
            -(((const char*)f->bytestream - (const char*)buf + 3)&~3) + (extra + bitstream_size + wordstream_size + bytestream_size),
423
 
            -(((const char*)f->wordstream - (const char*)buf + 2)&~2) + (extra + bitstream_size + wordstream_size)
424
 
        );
425
 
 
426
420
    return 0;
427
421
}
428
422
 
601
595
        len_tab[j]= len;
602
596
    }
603
597
 
604
 
    init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257,
605
 
             len_tab , 1, 1,
606
 
             bits_tab, 4, 4, 0);
 
598
    if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257,
 
599
                 len_tab , 1, 1,
 
600
                 bits_tab, 4, 4, 0))
 
601
        return NULL;
607
602
 
608
603
    return ptr;
609
604
}
619
614
    int x, y, x2, y2;
620
615
    const int width= f->avctx->width;
621
616
    const int height= f->avctx->height;
 
617
    const int mbs = (FFALIGN(width, 16) >> 4) * (FFALIGN(height, 16) >> 4);
622
618
    uint16_t *dst= (uint16_t*)f->current_picture.data[0];
623
619
    const int stride= f->current_picture.linesize[0]>>1;
 
620
    GetByteContext g3;
 
621
 
 
622
    if(length < mbs * 8) {
 
623
        av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
 
624
        return AVERROR_INVALIDDATA;
 
625
    }
 
626
    bytestream2_init(&g3, buf, length);
624
627
 
625
628
    for(y=0; y<height; y+=16){
626
629
        for(x=0; x<width; x+=16){
627
630
            unsigned int color[4], bits;
628
631
            memset(color, 0, sizeof(color));
629
632
//warning following is purely guessed ...
630
 
            color[0]= bytestream_get_le16(&buf);
631
 
            color[1]= bytestream_get_le16(&buf);
 
633
            color[0]= bytestream2_get_le16u(&g3);
 
634
            color[1]= bytestream2_get_le16u(&g3);
632
635
 
633
636
            if(color[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");
634
637
            if(color[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");
636
639
            color[2]= mix(color[0], color[1]);
637
640
            color[3]= mix(color[1], color[0]);
638
641
 
639
 
            bits= bytestream_get_le32(&buf);
 
642
            bits= bytestream2_get_le32u(&g3);
640
643
            for(y2=0; y2<16; y2++){
641
644
                for(x2=0; x2<16; x2++){
642
645
                    int index= 2*(x2>>2) + 8*(y2>>2);
645
648
            }
646
649
            dst+=16;
647
650
        }
648
 
        dst += 16*stride - width;
 
651
        dst += 16 * stride - x;
649
652
    }
650
653
 
651
654
    return 0;
655
658
    int x, y;
656
659
    const int width= f->avctx->width;
657
660
    const int height= f->avctx->height;
658
 
    uint16_t *dst= (uint16_t*)f->current_picture.data[0];
659
 
    const int stride= f->current_picture.linesize[0]>>1;
660
661
    const unsigned int bitstream_size= AV_RL32(buf);
661
 
    const int token_count av_unused = AV_RL32(buf + bitstream_size + 8);
662
 
    unsigned int prestream_size= 4*AV_RL32(buf + bitstream_size + 4);
663
 
    const uint8_t *prestream= buf + bitstream_size + 12;
 
662
    int token_count av_unused;
 
663
    unsigned int prestream_size;
 
664
    const uint8_t *prestream;
 
665
 
 
666
    if (length < bitstream_size + 12) {
 
667
        av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
 
668
        return AVERROR_INVALIDDATA;
 
669
    }
 
670
 
 
671
    token_count    = AV_RL32(buf + bitstream_size + 8);
 
672
    prestream_size = 4 * AV_RL32(buf + bitstream_size + 4);
 
673
    prestream      = buf + bitstream_size + 12;
664
674
 
665
675
    if(prestream_size + bitstream_size + 12 != length
666
676
       || bitstream_size > (1<<26)
679
689
    if (!f->bitstream_buffer)
680
690
        return AVERROR(ENOMEM);
681
691
    f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4);
 
692
    memset((uint8_t*)f->bitstream_buffer + prestream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
682
693
    init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size);
683
694
 
684
695
    f->last_dc= 0*128*8*8;
690
701
 
691
702
            idct_put(f, x, y);
692
703
        }
693
 
        dst += 16*stride;
694
704
    }
695
705
 
696
706
    if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
784
794
 
785
795
    if(frame_4cc == AV_RL32("ifr2")){
786
796
        p->pict_type= AV_PICTURE_TYPE_I;
787
 
        if(decode_i2_frame(f, buf-4, frame_size) < 0)
 
797
        if(decode_i2_frame(f, buf-4, frame_size + 4) < 0)
788
798
            return -1;
789
799
    }else if(frame_4cc == AV_RL32("ifrm")){
790
800
        p->pict_type= AV_PICTURE_TYPE_I;
866
876
}
867
877
 
868
878
AVCodec ff_fourxm_decoder = {
869
 
    "4xm",
870
 
    AVMEDIA_TYPE_VIDEO,
871
 
    CODEC_ID_4XM,
872
 
    sizeof(FourXContext),
873
 
    decode_init,
874
 
    NULL,
875
 
    decode_end,
876
 
    decode_frame,
877
 
    CODEC_CAP_DR1,
 
879
    .name           = "4xm",
 
880
    .type           = AVMEDIA_TYPE_VIDEO,
 
881
    .id             = CODEC_ID_4XM,
 
882
    .priv_data_size = sizeof(FourXContext),
 
883
    .init           = decode_init,
 
884
    .close          = decode_end,
 
885
    .decode         = decode_frame,
 
886
    .capabilities   = CODEC_CAP_DR1,
878
887
    .long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
879
888
};
880
889