~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to libavcodec/bitstream.c

  • Committer: William Grant
  • Date: 2007-02-03 03:16:07 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: william.grant@ubuntu.org.au-20070203031607-08gc2ompbz6spt9i
Update to 1.0rc1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * Copyright (c) 2000, 2001 Fabrice Bellard.
4
4
 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5
5
 *
6
 
 * This library is free software; you can redistribute it and/or
 
6
 * This file is part of FFmpeg.
 
7
 *
 
8
 * FFmpeg is free software; you can redistribute it and/or
7
9
 * modify it under the terms of the GNU Lesser General Public
8
10
 * License as published by the Free Software Foundation; either
9
 
 * version 2 of the License, or (at your option) any later version.
 
11
 * version 2.1 of the License, or (at your option) any later version.
10
12
 *
11
 
 * This library is distributed in the hope that it will be useful,
 
13
 * FFmpeg is distributed in the hope that it will be useful,
12
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
16
 * Lesser General Public License for more details.
15
17
 *
16
18
 * You should have received a copy of the GNU Lesser General Public
17
 
 * License along with this library; if not, write to the Free Software
 
19
 * License along with FFmpeg; if not, write to the Free Software
18
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
21
 *
20
22
 * alternative bitstream reader & writer by Michael Niedermayer <michaelni@gmx.at>
47
49
        put_bits(pbc, 8, 0);
48
50
}
49
51
 
50
 
/* bit input functions */
51
 
 
52
 
/**
53
 
 * reads 0-32 bits.
54
 
 */
55
 
unsigned int get_bits_long(GetBitContext *s, int n){
56
 
    if(n<=17) return get_bits(s, n);
57
 
    else{
58
 
        int ret= get_bits(s, 16) << (n-16);
59
 
        return ret | get_bits(s, n-16);
60
 
    }
61
 
}
62
 
 
63
 
/**
64
 
 * shows 0-32 bits.
65
 
 */
66
 
unsigned int show_bits_long(GetBitContext *s, int n){
67
 
    if(n<=17) return show_bits(s, n);
68
 
    else{
69
 
        GetBitContext gb= *s;
70
 
        int ret= get_bits_long(s, n);
71
 
        *s= gb;
72
 
        return ret;
73
 
    }
74
 
}
75
 
 
76
 
void align_get_bits(GetBitContext *s)
77
 
{
78
 
    int n= (-get_bits_count(s)) & 7;
79
 
    if(n) skip_bits(s, n);
80
 
}
81
 
 
82
 
int check_marker(GetBitContext *s, const char *msg)
83
 
{
84
 
    int bit= get_bits1(s);
85
 
    if(!bit)
86
 
            av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
87
 
 
88
 
    return bit;
89
 
}
90
 
 
91
52
/* VLC decoding */
92
53
 
93
54
//#define DEBUG_VLC