~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/h263dec.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:
91
91
        break;
92
92
    case CODEC_ID_VC1:
93
93
    case CODEC_ID_WMV3:
 
94
    case CODEC_ID_VC1IMAGE:
 
95
    case CODEC_ID_WMV3IMAGE:
94
96
        s->h263_pred = 1;
95
97
        s->msmpeg4_version=6;
96
98
        avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
125
127
}
126
128
 
127
129
/**
128
 
 * returns the number of bytes consumed for building the current frame
 
130
 * Return the number of bytes consumed for building the current frame.
129
131
 */
130
132
static int get_consumed_bytes(MpegEncContext *s, int buf_size){
131
133
    int pos= (get_bits_count(&s->gb)+7)>>3;
146
148
}
147
149
 
148
150
static int decode_slice(MpegEncContext *s){
149
 
    const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
 
151
    const int part_mask= s->partitioned_frame ? (ER_AC_END|ER_AC_ERROR) : 0x7F;
150
152
    const int mb_size= 16>>s->avctx->lowres;
151
153
    s->last_resync_gb= s->gb;
152
154
    s->first_slice_line= 1;
182
184
        /* per-row end of slice checks */
183
185
        if(s->msmpeg4_version){
184
186
            if(s->resync_mb_y + s->slice_height == s->mb_y){
185
 
                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
 
187
                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
186
188
 
187
189
                return 0;
188
190
            }
223
225
                        ff_h263_loop_filter(s);
224
226
 
225
227
//printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24));
226
 
                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
 
228
                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
227
229
 
228
230
                    s->padding_bug_score--;
229
231
 
236
238
                    return 0;
237
239
                }else if(ret==SLICE_NOEND){
238
240
                    av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy);
239
 
                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x+1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
 
241
                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x+1, s->mb_y, ER_MB_END&part_mask);
240
242
                    return -1;
241
243
                }
242
244
                av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
243
 
                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
 
245
                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
244
246
 
245
247
                return -1;
246
248
            }
308
310
            max_extra+= 17;
309
311
 
310
312
        /* buggy padding but the frame should still end approximately at the bitstream end */
311
 
        if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_recognition>=3)
 
313
        if((s->workaround_bugs&FF_BUG_NO_PADDING) && (s->err_recognition&AV_EF_BUFFER))
312
314
            max_extra+= 48;
313
315
        else if((s->workaround_bugs&FF_BUG_NO_PADDING))
314
316
            max_extra+= 256*256*256*64;
319
321
        else if(left<0){
320
322
            av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
321
323
        }else
322
 
            ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
 
324
            ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
323
325
 
324
326
        return 0;
325
327
    }
328
330
            get_bits_left(&s->gb),
329
331
            show_bits(&s->gb, 24), s->padding_bug_score);
330
332
 
331
 
    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
 
333
    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
332
334
 
333
335
    return -1;
334
336
}
394
396
 
395
397
    /* We need to set current_picture_ptr before reading the header,
396
398
     * otherwise we cannot store anyting in there */
397
 
    if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
 
399
    if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
398
400
        int i= ff_find_unused_picture(s, 0);
 
401
        if (i < 0)
 
402
            return i;
399
403
        s->current_picture_ptr= &s->picture[i];
400
404
    }
401
405
 
581
585
        s->gob_index = ff_h263_get_gob_height(s);
582
586
 
583
587
    // for skipping the frame
584
 
    s->current_picture.pict_type= s->pict_type;
585
 
    s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
 
588
    s->current_picture.f.pict_type = s->pict_type;
 
589
    s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
586
590
 
587
591
    /* skip B-frames if we don't have reference frames */
588
592
    if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)) return get_consumed_bytes(s, buf_size);
638
642
    s->mb_x=0;
639
643
    s->mb_y=0;
640
644
 
641
 
    decode_slice(s);
 
645
    ret = decode_slice(s);
642
646
    while(s->mb_y<s->mb_height){
643
647
        if(s->msmpeg4_version){
644
648
            if(s->slice_height==0 || s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
654
658
        if(s->msmpeg4_version<4 && s->h263_pred)
655
659
            ff_mpeg4_clean_buffers(s);
656
660
 
657
 
        decode_slice(s);
 
661
        if (decode_slice(s) < 0) ret = AVERROR_INVALIDDATA;
658
662
    }
659
663
 
660
664
    if (s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type==AV_PICTURE_TYPE_I)
661
665
        if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){
662
 
            s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR;
 
666
            s->error_status_table[s->mb_num-1]= ER_MB_ERROR;
663
667
        }
664
668
 
665
669
    assert(s->bitstream_buffer_size==0);
705
709
 
706
710
    MPV_frame_end(s);
707
711
 
708
 
assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
709
 
assert(s->current_picture.pict_type == s->pict_type);
 
712
    assert(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type);
 
713
    assert(s->current_picture.f.pict_type == s->pict_type);
710
714
    if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
711
715
        *pict= *(AVFrame*)s->current_picture_ptr;
712
716
    } else if (s->last_picture_ptr != NULL) {
722
726
av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
723
727
#endif
724
728
 
725
 
    return get_consumed_bytes(s, buf_size);
 
729
    return (ret && (avctx->err_recognition & AV_EF_EXPLODE))?ret:get_consumed_bytes(s, buf_size);
726
730
}
727
731
 
728
732
AVCodec ff_h263_decoder = {
729
 
    "h263",
730
 
    AVMEDIA_TYPE_VIDEO,
731
 
    CODEC_ID_H263,
732
 
    sizeof(MpegEncContext),
733
 
    ff_h263_decode_init,
734
 
    NULL,
735
 
    ff_h263_decode_end,
736
 
    ff_h263_decode_frame,
737
 
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
 
733
    .name           = "h263",
 
734
    .type           = AVMEDIA_TYPE_VIDEO,
 
735
    .id             = CODEC_ID_H263,
 
736
    .priv_data_size = sizeof(MpegEncContext),
 
737
    .init           = ff_h263_decode_init,
 
738
    .close          = ff_h263_decode_end,
 
739
    .decode         = ff_h263_decode_frame,
 
740
    .capabilities   = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
738
741
    .flush= ff_mpeg_flush,
739
742
    .max_lowres= 3,
740
743
    .long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),