~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/vp6.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:
1
 
/**
2
 
 * @file
3
 
 * VP6 compatible video decoder
4
 
 *
 
1
/*
5
2
 * Copyright (C) 2006  Aurelien Jacobs <aurel@gnuage.org>
6
3
 *
7
 
 * The VP6F decoder accepts an optional 1 byte extradata. It is composed of:
8
 
 *  - upper 4bits: difference between encoded width and visible width
9
 
 *  - lower 4bits: difference between encoded height and visible height
10
 
 *
11
4
 * This file is part of Libav.
12
5
 *
13
6
 * Libav is free software; you can redistribute it and/or
25
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26
19
 */
27
20
 
 
21
/**
 
22
 * @file
 
23
 * VP6 compatible video decoder
 
24
 *
 
25
 * The VP6F decoder accepts an optional 1 byte extradata. It is composed of:
 
26
 *  - upper 4 bits: difference between encoded width and visible width
 
27
 *  - lower 4 bits: difference between encoded height and visible height
 
28
 */
 
29
 
28
30
#include <stdlib.h>
29
31
 
30
32
#include "avcodec.h"
137
139
    if (coeff_offset) {
138
140
        buf      += coeff_offset;
139
141
        buf_size -= coeff_offset;
140
 
        if (buf_size < 0)
 
142
        if (buf_size < 0) {
 
143
            if (s->framep[VP56_FRAME_CURRENT]->key_frame)
 
144
                avcodec_set_dimensions(s->avctx, 0, 0);
141
145
            return 0;
 
146
        }
142
147
        if (s->use_huffman) {
143
148
            s->parse_coeff = vp6_parse_coeff_huffman;
144
149
            init_get_bits(&s->gb, buf, buf_size<<3);
213
218
    return (a->count - b->count)*16 + (b->sym - a->sym);
214
219
}
215
220
 
216
 
static void vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
217
 
                                const uint8_t *map, unsigned size, VLC *vlc)
 
221
static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
 
222
                               const uint8_t *map, unsigned size, VLC *vlc)
218
223
{
219
224
    Node nodes[2*VP6_MAX_HUFF_SIZE], *tmp = &nodes[size];
220
225
    int a, b, i;
229
234
    }
230
235
 
231
236
    free_vlc(vlc);
232
 
    /* then build the huffman tree accodring to probabilities */
233
 
    ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp,
234
 
                       FF_HUFFMAN_FLAG_HNODE_FIRST);
 
237
    /* then build the huffman tree according to probabilities */
 
238
    return ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp,
 
239
                              FF_HUFFMAN_FLAG_HNODE_FIRST);
235
240
}
236
241
 
237
 
static void vp6_parse_coeff_models(VP56Context *s)
 
242
static int vp6_parse_coeff_models(VP56Context *s)
238
243
{
239
244
    VP56RangeCoder *c = &s->c;
240
245
    VP56Model *model = s->modelp;
279
284
 
280
285
    if (s->use_huffman) {
281
286
        for (pt=0; pt<2; pt++) {
282
 
            vp6_build_huff_tree(s, model->coeff_dccv[pt],
283
 
                                vp6_huff_coeff_map, 12, &s->dccv_vlc[pt]);
284
 
            vp6_build_huff_tree(s, model->coeff_runv[pt],
285
 
                                vp6_huff_run_map, 9, &s->runv_vlc[pt]);
 
287
            if (vp6_build_huff_tree(s, model->coeff_dccv[pt],
 
288
                                    vp6_huff_coeff_map, 12, &s->dccv_vlc[pt]))
 
289
                return -1;
 
290
            if (vp6_build_huff_tree(s, model->coeff_runv[pt],
 
291
                                    vp6_huff_run_map, 9, &s->runv_vlc[pt]))
 
292
                return -1;
286
293
            for (ct=0; ct<3; ct++)
287
294
                for (cg = 0; cg < 6; cg++)
288
 
                    vp6_build_huff_tree(s, model->coeff_ract[pt][ct][cg],
289
 
                                        vp6_huff_coeff_map, 12,
290
 
                                        &s->ract_vlc[pt][ct][cg]);
 
295
                    if (vp6_build_huff_tree(s, model->coeff_ract[pt][ct][cg],
 
296
                                            vp6_huff_coeff_map, 12,
 
297
                                            &s->ract_vlc[pt][ct][cg]))
 
298
                        return -1;
291
299
        }
292
300
        memset(s->nb_null, 0, sizeof(s->nb_null));
293
301
    } else {
297
305
            for (node=0; node<5; node++)
298
306
                model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255);
299
307
    }
 
308
    return 0;
300
309
}
301
310
 
302
311
static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
367
376
        if (b > 3) pt = 1;
368
377
        vlc_coeff = &s->dccv_vlc[pt];
369
378
 
370
 
        for (coeff_idx=0; coeff_idx<64; ) {
 
379
        for (coeff_idx = 0;;) {
371
380
            int run = 1;
372
381
            if (coeff_idx<2 && s->nb_null[coeff_idx][pt]) {
373
382
                s->nb_null[coeff_idx][pt]--;
404
413
                }
405
414
            }
406
415
            coeff_idx+=run;
 
416
            if (coeff_idx >= 64)
 
417
                break;
407
418
            cg = FFMIN(vp6_coeff_groups[coeff_idx], 3);
408
419
            vlc_coeff = &s->ract_vlc[pt][ct][cg];
409
420
        }
431
442
        model1 = model->coeff_dccv[pt];
432
443
        model2 = model->coeff_dcct[pt][ctx];
433
444
 
434
 
        for (coeff_idx=0; coeff_idx<64; ) {
 
445
        coeff_idx = 0;
 
446
        for (;;) {
435
447
            if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {
436
448
                /* parse a coeff */
437
449
                if (vp56_rac_get_prob(c, model2[2])) {
472
484
                            run += vp56_rac_get_prob(c, model3[i+8]) << i;
473
485
                }
474
486
            }
475
 
 
476
 
            cg = vp6_coeff_groups[coeff_idx+=run];
 
487
            coeff_idx += run;
 
488
            if (coeff_idx >= 64)
 
489
                break;
 
490
            cg = vp6_coeff_groups[coeff_idx];
477
491
            model1 = model2 = model->coeff_ract[pt][ct][cg];
478
492
        }
479
493
 
607
621
}
608
622
 
609
623
AVCodec ff_vp6_decoder = {
610
 
    "vp6",
611
 
    AVMEDIA_TYPE_VIDEO,
612
 
    CODEC_ID_VP6,
613
 
    sizeof(VP56Context),
614
 
    vp6_decode_init,
615
 
    NULL,
616
 
    vp6_decode_free,
617
 
    ff_vp56_decode_frame,
618
 
    CODEC_CAP_DR1,
 
624
    .name           = "vp6",
 
625
    .type           = AVMEDIA_TYPE_VIDEO,
 
626
    .id             = CODEC_ID_VP6,
 
627
    .priv_data_size = sizeof(VP56Context),
 
628
    .init           = vp6_decode_init,
 
629
    .close          = vp6_decode_free,
 
630
    .decode         = ff_vp56_decode_frame,
 
631
    .capabilities   = CODEC_CAP_DR1,
619
632
    .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
620
633
};
621
634
 
622
635
/* flash version, not flipped upside-down */
623
636
AVCodec ff_vp6f_decoder = {
624
 
    "vp6f",
625
 
    AVMEDIA_TYPE_VIDEO,
626
 
    CODEC_ID_VP6F,
627
 
    sizeof(VP56Context),
628
 
    vp6_decode_init,
629
 
    NULL,
630
 
    vp6_decode_free,
631
 
    ff_vp56_decode_frame,
632
 
    CODEC_CAP_DR1,
 
637
    .name           = "vp6f",
 
638
    .type           = AVMEDIA_TYPE_VIDEO,
 
639
    .id             = CODEC_ID_VP6F,
 
640
    .priv_data_size = sizeof(VP56Context),
 
641
    .init           = vp6_decode_init,
 
642
    .close          = vp6_decode_free,
 
643
    .decode         = ff_vp56_decode_frame,
 
644
    .capabilities   = CODEC_CAP_DR1,
633
645
    .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
634
646
};
635
647
 
636
648
/* flash version, not flipped upside-down, with alpha channel */
637
649
AVCodec ff_vp6a_decoder = {
638
 
    "vp6a",
639
 
    AVMEDIA_TYPE_VIDEO,
640
 
    CODEC_ID_VP6A,
641
 
    sizeof(VP56Context),
642
 
    vp6_decode_init,
643
 
    NULL,
644
 
    vp6_decode_free,
645
 
    ff_vp56_decode_frame,
646
 
    CODEC_CAP_DR1,
 
650
    .name           = "vp6a",
 
651
    .type           = AVMEDIA_TYPE_VIDEO,
 
652
    .id             = CODEC_ID_VP6A,
 
653
    .priv_data_size = sizeof(VP56Context),
 
654
    .init           = vp6_decode_init,
 
655
    .close          = vp6_decode_free,
 
656
    .decode         = ff_vp56_decode_frame,
 
657
    .capabilities   = CODEC_CAP_DR1,
647
658
    .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),
648
659
};