Libav 0.7.1
|
00001 /* 00002 * MPEG1/2 common code 00003 * Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org> 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * Libav is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef AVCODEC_MPEG12_H 00023 #define AVCODEC_MPEG12_H 00024 00025 #include "mpegvideo.h" 00026 00027 #define DC_VLC_BITS 9 00028 #define TEX_VLC_BITS 9 00029 00030 extern VLC ff_dc_lum_vlc; 00031 extern VLC ff_dc_chroma_vlc; 00032 00033 extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; 00034 00035 void ff_mpeg12_common_init(MpegEncContext *s); 00036 void ff_mpeg12_init_vlcs(void); 00037 00038 static inline int decode_dc(GetBitContext *gb, int component) 00039 { 00040 int code, diff; 00041 00042 if (component == 0) { 00043 code = get_vlc2(gb, ff_dc_lum_vlc.table, DC_VLC_BITS, 2); 00044 } else { 00045 code = get_vlc2(gb, ff_dc_chroma_vlc.table, DC_VLC_BITS, 2); 00046 } 00047 if (code < 0){ 00048 av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n"); 00049 return 0xffff; 00050 } 00051 if (code == 0) { 00052 diff = 0; 00053 } else { 00054 diff = get_xbits(gb, code); 00055 } 00056 return diff; 00057 } 00058 00059 extern int ff_mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n); 00060 00061 #endif /* AVCODEC_MPEG12_H */