yading@10
|
1 /*
|
yading@10
|
2 * MPEG1/2 common code
|
yading@10
|
3 * Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org>
|
yading@10
|
4 *
|
yading@10
|
5 * This file is part of FFmpeg.
|
yading@10
|
6 *
|
yading@10
|
7 * FFmpeg is free software; you can redistribute it and/or
|
yading@10
|
8 * modify it under the terms of the GNU Lesser General Public
|
yading@10
|
9 * License as published by the Free Software Foundation; either
|
yading@10
|
10 * version 2.1 of the License, or (at your option) any later version.
|
yading@10
|
11 *
|
yading@10
|
12 * FFmpeg is distributed in the hope that it will be useful,
|
yading@10
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@10
|
15 * Lesser General Public License for more details.
|
yading@10
|
16 *
|
yading@10
|
17 * You should have received a copy of the GNU Lesser General Public
|
yading@10
|
18 * License along with FFmpeg; if not, write to the Free Software
|
yading@10
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@10
|
20 */
|
yading@10
|
21
|
yading@10
|
22 #ifndef AVCODEC_MPEG12_H
|
yading@10
|
23 #define AVCODEC_MPEG12_H
|
yading@10
|
24
|
yading@10
|
25 #include "mpegvideo.h"
|
yading@10
|
26
|
yading@10
|
27 #define DC_VLC_BITS 9
|
yading@10
|
28 #define MV_VLC_BITS 9
|
yading@10
|
29 #define TEX_VLC_BITS 9
|
yading@10
|
30
|
yading@10
|
31 #define MBINCR_VLC_BITS 9
|
yading@10
|
32 #define MB_PAT_VLC_BITS 9
|
yading@10
|
33 #define MB_PTYPE_VLC_BITS 6
|
yading@10
|
34 #define MB_BTYPE_VLC_BITS 6
|
yading@10
|
35
|
yading@10
|
36 extern VLC ff_dc_lum_vlc;
|
yading@10
|
37 extern VLC ff_dc_chroma_vlc;
|
yading@10
|
38 extern VLC ff_mbincr_vlc;
|
yading@10
|
39 extern VLC ff_mb_ptype_vlc;
|
yading@10
|
40 extern VLC ff_mb_btype_vlc;
|
yading@10
|
41 extern VLC ff_mb_pat_vlc;
|
yading@10
|
42 extern VLC ff_mv_vlc;
|
yading@10
|
43
|
yading@10
|
44 extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
|
yading@10
|
45
|
yading@10
|
46 void ff_mpeg12_common_init(MpegEncContext *s);
|
yading@10
|
47 void ff_mpeg12_init_vlcs(void);
|
yading@10
|
48
|
yading@10
|
49 static inline int decode_dc(GetBitContext *gb, int component)
|
yading@10
|
50 {
|
yading@10
|
51 int code, diff;
|
yading@10
|
52
|
yading@10
|
53 if (component == 0) {
|
yading@10
|
54 code = get_vlc2(gb, ff_dc_lum_vlc.table, DC_VLC_BITS, 2);
|
yading@10
|
55 } else {
|
yading@10
|
56 code = get_vlc2(gb, ff_dc_chroma_vlc.table, DC_VLC_BITS, 2);
|
yading@10
|
57 }
|
yading@10
|
58 if (code < 0){
|
yading@10
|
59 av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n");
|
yading@10
|
60 return 0xffff;
|
yading@10
|
61 }
|
yading@10
|
62 if (code == 0) {
|
yading@10
|
63 diff = 0;
|
yading@10
|
64 } else {
|
yading@10
|
65 diff = get_xbits(gb, code);
|
yading@10
|
66 }
|
yading@10
|
67 return diff;
|
yading@10
|
68 }
|
yading@10
|
69
|
yading@10
|
70 int ff_mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, int n);
|
yading@10
|
71 void ff_mpeg1_clean_buffers(MpegEncContext *s);
|
yading@10
|
72 int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s);
|
yading@10
|
73
|
yading@10
|
74 #endif /* AVCODEC_MPEG12_H */
|