Libav 0.7.1
|
00001 /* 00002 * RV30/40 decoder common data declarations 00003 * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov 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 00027 #ifndef AVCODEC_RV34_H 00028 #define AVCODEC_RV34_H 00029 00030 #include "avcodec.h" 00031 #include "dsputil.h" 00032 #include "mpegvideo.h" 00033 00034 #include "h264pred.h" 00035 00036 #define MB_TYPE_SEPARATE_DC 0x01000000 00037 #define IS_SEPARATE_DC(a) ((a) & MB_TYPE_SEPARATE_DC) 00038 00042 enum RV40BlockTypes{ 00043 RV34_MB_TYPE_INTRA, 00044 RV34_MB_TYPE_INTRA16x16, 00045 RV34_MB_P_16x16, 00046 RV34_MB_P_8x8, 00047 RV34_MB_B_FORWARD, 00048 RV34_MB_B_BACKWARD, 00049 RV34_MB_SKIP, 00050 RV34_MB_B_DIRECT, 00051 RV34_MB_P_16x8, 00052 RV34_MB_P_8x16, 00053 RV34_MB_B_BIDIR, 00054 RV34_MB_P_MIX16x16, 00055 RV34_MB_TYPES 00056 }; 00057 00063 typedef struct RV34VLC{ 00064 VLC cbppattern[2]; 00065 VLC cbp[2][4]; 00066 VLC first_pattern[4]; 00067 VLC second_pattern[2]; 00068 VLC third_pattern[2]; 00069 VLC coefficient; 00070 }RV34VLC; 00071 00073 typedef struct SliceInfo{ 00074 int type; 00075 int quant; 00076 int vlc_set; 00077 int start, end; 00078 int width; 00079 int height; 00080 int pts; 00081 }SliceInfo; 00082 00084 typedef struct RV34DecContext{ 00085 MpegEncContext s; 00086 int8_t *intra_types_hist; 00087 int8_t *intra_types; 00088 int intra_types_stride; 00089 const uint8_t *luma_dc_quant_i; 00090 const uint8_t *luma_dc_quant_p; 00091 00092 RV34VLC *cur_vlcs; 00093 int bits; 00094 H264PredContext h; 00095 SliceInfo si; 00096 00097 int *mb_type; 00098 int block_type; 00099 int luma_vlc; 00100 int chroma_vlc; 00101 int is16; 00102 int dmv[4][2]; 00103 00104 int rv30; 00105 int rpr; 00106 00107 int cur_pts, last_pts, next_pts; 00108 00109 uint16_t *cbp_luma; 00110 uint8_t *cbp_chroma; 00111 int *deblock_coefs; 00112 00114 DECLARE_ALIGNED(8, uint32_t, avail_cache)[3*4]; 00115 00116 int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si); 00117 int (*decode_mb_info)(struct RV34DecContext *r); 00118 int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst); 00119 void (*loop_filter)(struct RV34DecContext *r, int row); 00120 }RV34DecContext; 00121 00125 int ff_rv34_get_start_offset(GetBitContext *gb, int blocks); 00126 int ff_rv34_decode_init(AVCodecContext *avctx); 00127 int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt); 00128 int ff_rv34_decode_end(AVCodecContext *avctx); 00129 00130 #endif /* AVCODEC_RV34_H */