~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/msmpeg4.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * MSMPEG4 backend for ffmpeg encoder and decoder
 
2
 * MSMPEG4 backend for encoder and decoder
3
3
 * Copyright (c) 2001 Fabrice Bellard
4
4
 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5
5
 *
24
24
 
25
25
/**
26
26
 * @file
27
 
 * MSMPEG4 backend for ffmpeg encoder and decoder.
 
27
 * MSMPEG4 backend for encoder and decoder
28
28
 */
29
29
 
30
30
#include "avcodec.h"
62
62
/* vc1 externs */
63
63
extern const uint8_t wmv3_dc_scale_table[32];
64
64
 
65
 
#ifdef DEBUG
66
 
int frame_count = 0;
67
 
#endif
68
 
 
69
65
#include "msmpeg4data.h"
70
66
 
71
67
#if CONFIG_ENCODERS //strangely gcc includes this even if it is not referenced
270
266
 
271
267
        for(i=0; i<NB_RL_TABLES; i++){
272
268
            int level;
273
 
            for(level=0; level<=MAX_LEVEL; level++){
 
269
            for (level = 1; level <= MAX_LEVEL; level++) {
274
270
                int run;
275
271
                for(run=0; run<=MAX_RUN; run++){
276
272
                    int last;
355
351
{
356
352
    find_best_tables(s);
357
353
 
358
 
    align_put_bits(&s->pb);
 
354
    avpriv_align_put_bits(&s->pb);
359
355
    put_bits(&s->pb, 2, s->pict_type - 1);
360
356
 
361
357
    put_bits(&s->pb, 5, s->qscale);
780
776
            }else{
781
777
                if(n<4){
782
778
                    wrap= s->linesize;
783
 
                    dest= s->current_picture.data[0] + (((n>>1) + 2*s->mb_y) * 8*  wrap ) + ((n&1) + 2*s->mb_x) * 8;
 
779
                    dest= s->current_picture.f.data[0] + (((n >> 1) + 2*s->mb_y) * 8*  wrap ) + ((n & 1) + 2*s->mb_x) * 8;
784
780
                }else{
785
781
                    wrap= s->uvlinesize;
786
 
                    dest= s->current_picture.data[n-3] + (s->mb_y * 8 * wrap) + s->mb_x * 8;
 
782
                    dest= s->current_picture.f.data[n - 3] + (s->mb_y * 8 * wrap) + s->mb_x * 8;
787
783
                }
788
784
                if(s->mb_x==0) a= (1024 + (scale>>1))/scale;
789
785
                else           a= get_dc(dest-8, wrap, scale*8);
1172
1168
{
1173
1169
    int cbp, code, i;
1174
1170
    uint8_t *coded_val;
1175
 
    uint32_t * const mb_type_ptr= &s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ];
 
1171
    uint32_t * const mb_type_ptr = &s->current_picture.f.mb_type[s->mb_x + s->mb_y*s->mb_stride];
1176
1172
 
1177
1173
    if (s->pict_type == AV_PICTURE_TYPE_P) {
1178
1174
        if (s->use_skip_mb_code) {
1695
1691
                    if(s->msmpeg4_version<=3){
1696
1692
                        last=  SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
1697
1693
                        run=   SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
1698
 
                        level= SHOW_SBITS(re, &s->gb, 8); LAST_SKIP_CACHE(re, &s->gb, 8);
 
1694
                        level= SHOW_SBITS(re, &s->gb, 8);
1699
1695
                        SKIP_COUNTER(re, &s->gb, 1+6+8);
1700
1696
                    }else{
1701
1697
                        int sign;
1814
1810
            i-= 192;
1815
1811
            if(i&(~63)){
1816
1812
                const int left= get_bits_left(&s->gb);
1817
 
                if(((i+192 == 64 && level/qmul==-1) || s->error_recognition<=1) && left>=0){
 
1813
                if(((i+192 == 64 && level/qmul==-1) || !(s->err_recognition&AV_EF_BITSTREAM)) && left>=0){
1818
1814
                    av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
1819
1815
                    break;
1820
1816
                }else{
1884
1880
}
1885
1881
 
1886
1882
AVCodec ff_msmpeg4v1_decoder = {
1887
 
    "msmpeg4v1",
1888
 
    AVMEDIA_TYPE_VIDEO,
1889
 
    CODEC_ID_MSMPEG4V1,
1890
 
    sizeof(MpegEncContext),
1891
 
    ff_msmpeg4_decode_init,
1892
 
    NULL,
1893
 
    ff_h263_decode_end,
1894
 
    ff_h263_decode_frame,
1895
 
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
 
1883
    .name           = "msmpeg4v1",
 
1884
    .type           = AVMEDIA_TYPE_VIDEO,
 
1885
    .id             = CODEC_ID_MSMPEG4V1,
 
1886
    .priv_data_size = sizeof(MpegEncContext),
 
1887
    .init           = ff_msmpeg4_decode_init,
 
1888
    .close          = ff_h263_decode_end,
 
1889
    .decode         = ff_h263_decode_frame,
 
1890
    .capabilities   = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1896
1891
    .max_lowres= 3,
1897
1892
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
1898
1893
    .pix_fmts= ff_pixfmt_list_420,
1899
1894
};
1900
1895
 
1901
1896
AVCodec ff_msmpeg4v2_decoder = {
1902
 
    "msmpeg4v2",
1903
 
    AVMEDIA_TYPE_VIDEO,
1904
 
    CODEC_ID_MSMPEG4V2,
1905
 
    sizeof(MpegEncContext),
1906
 
    ff_msmpeg4_decode_init,
1907
 
    NULL,
1908
 
    ff_h263_decode_end,
1909
 
    ff_h263_decode_frame,
1910
 
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
 
1897
    .name           = "msmpeg4v2",
 
1898
    .type           = AVMEDIA_TYPE_VIDEO,
 
1899
    .id             = CODEC_ID_MSMPEG4V2,
 
1900
    .priv_data_size = sizeof(MpegEncContext),
 
1901
    .init           = ff_msmpeg4_decode_init,
 
1902
    .close          = ff_h263_decode_end,
 
1903
    .decode         = ff_h263_decode_frame,
 
1904
    .capabilities   = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1911
1905
    .max_lowres= 3,
1912
1906
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
1913
1907
    .pix_fmts= ff_pixfmt_list_420,
1914
1908
};
1915
1909
 
1916
1910
AVCodec ff_msmpeg4v3_decoder = {
1917
 
    "msmpeg4",
1918
 
    AVMEDIA_TYPE_VIDEO,
1919
 
    CODEC_ID_MSMPEG4V3,
1920
 
    sizeof(MpegEncContext),
1921
 
    ff_msmpeg4_decode_init,
1922
 
    NULL,
1923
 
    ff_h263_decode_end,
1924
 
    ff_h263_decode_frame,
1925
 
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
 
1911
    .name           = "msmpeg4",
 
1912
    .type           = AVMEDIA_TYPE_VIDEO,
 
1913
    .id             = CODEC_ID_MSMPEG4V3,
 
1914
    .priv_data_size = sizeof(MpegEncContext),
 
1915
    .init           = ff_msmpeg4_decode_init,
 
1916
    .close          = ff_h263_decode_end,
 
1917
    .decode         = ff_h263_decode_frame,
 
1918
    .capabilities   = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1926
1919
    .max_lowres= 3,
1927
1920
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
1928
1921
    .pix_fmts= ff_pixfmt_list_420,
1929
1922
};
1930
1923
 
1931
1924
AVCodec ff_wmv1_decoder = {
1932
 
    "wmv1",
1933
 
    AVMEDIA_TYPE_VIDEO,
1934
 
    CODEC_ID_WMV1,
1935
 
    sizeof(MpegEncContext),
1936
 
    ff_msmpeg4_decode_init,
1937
 
    NULL,
1938
 
    ff_h263_decode_end,
1939
 
    ff_h263_decode_frame,
1940
 
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
 
1925
    .name           = "wmv1",
 
1926
    .type           = AVMEDIA_TYPE_VIDEO,
 
1927
    .id             = CODEC_ID_WMV1,
 
1928
    .priv_data_size = sizeof(MpegEncContext),
 
1929
    .init           = ff_msmpeg4_decode_init,
 
1930
    .close          = ff_h263_decode_end,
 
1931
    .decode         = ff_h263_decode_frame,
 
1932
    .capabilities   = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1941
1933
    .max_lowres= 3,
1942
1934
    .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
1943
1935
    .pix_fmts= ff_pixfmt_list_420,