h264: remove obsolete comment.
[FFMpeg-mirror/mplayer-patches.git] / libavcodec / rv34.h
blobf40e2828ab3f293a4237f055cccd4f0c301e48b0
1 /*
2 * RV30/40 decoder common data declarations
3 * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
5 * This file is part of Libav.
7 * Libav is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * Libav is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 /**
23 * @file
24 * RV30 and RV40 decoder common data declarations
27 #ifndef AVCODEC_RV34_H
28 #define AVCODEC_RV34_H
30 #include "avcodec.h"
31 #include "dsputil.h"
32 #include "mpegvideo.h"
34 #include "h264pred.h"
35 #include "rv34dsp.h"
37 #define MB_TYPE_SEPARATE_DC 0x01000000
38 #define IS_SEPARATE_DC(a) ((a) & MB_TYPE_SEPARATE_DC)
40 /**
41 * RV30 and RV40 Macroblock types
43 enum RV40BlockTypes{
44 RV34_MB_TYPE_INTRA, ///< Intra macroblock
45 RV34_MB_TYPE_INTRA16x16, ///< Intra macroblock with DCs in a separate 4x4 block
46 RV34_MB_P_16x16, ///< P-frame macroblock, one motion frame
47 RV34_MB_P_8x8, ///< P-frame macroblock, 8x8 motion compensation partitions
48 RV34_MB_B_FORWARD, ///< B-frame macroblock, forward prediction
49 RV34_MB_B_BACKWARD, ///< B-frame macroblock, backward prediction
50 RV34_MB_SKIP, ///< Skipped block
51 RV34_MB_B_DIRECT, ///< Bidirectionally predicted B-frame macroblock, no motion vectors
52 RV34_MB_P_16x8, ///< P-frame macroblock, 16x8 motion compensation partitions
53 RV34_MB_P_8x16, ///< P-frame macroblock, 8x16 motion compensation partitions
54 RV34_MB_B_BIDIR, ///< Bidirectionally predicted B-frame macroblock, two motion vectors
55 RV34_MB_P_MIX16x16, ///< P-frame macroblock with DCs in a separate 4x4 block, one motion vector
56 RV34_MB_TYPES
59 /**
60 * VLC tables used by the decoder
62 * Intra frame VLC sets do not contain some of those tables.
64 typedef struct RV34VLC{
65 VLC cbppattern[2]; ///< VLCs used for pattern of coded block patterns decoding
66 VLC cbp[2][4]; ///< VLCs used for coded block patterns decoding
67 VLC first_pattern[4]; ///< VLCs used for decoding coefficients in the first subblock
68 VLC second_pattern[2]; ///< VLCs used for decoding coefficients in the subblocks 2 and 3
69 VLC third_pattern[2]; ///< VLCs used for decoding coefficients in the last subblock
70 VLC coefficient; ///< VLCs used for decoding big coefficients
71 }RV34VLC;
73 /** essential slice information */
74 typedef struct SliceInfo{
75 int type; ///< slice type (intra, inter)
76 int quant; ///< quantizer used for this slice
77 int vlc_set; ///< VLCs used for this slice
78 int start, end; ///< start and end macroblocks of the slice
79 int width; ///< coded width
80 int height; ///< coded height
81 int pts; ///< frame timestamp
82 }SliceInfo;
84 /** decoder context */
85 typedef struct RV34DecContext{
86 MpegEncContext s;
87 RV34DSPContext rdsp;
88 int8_t *intra_types_hist;///< old block types, used for prediction
89 int8_t *intra_types; ///< block types
90 int intra_types_stride;///< block types array stride
91 const uint8_t *luma_dc_quant_i;///< luma subblock DC quantizer for intraframes
92 const uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes
94 RV34VLC *cur_vlcs; ///< VLC set used for current frame decoding
95 H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction
96 SliceInfo si; ///< current slice information
98 int *mb_type; ///< internal macroblock types
99 int block_type; ///< current block type
100 int luma_vlc; ///< which VLC set will be used for decoding of luma blocks
101 int chroma_vlc; ///< which VLC set will be used for decoding of chroma blocks
102 int is16; ///< current block has additional 16x16 specific features or not
103 int dmv[4][2]; ///< differential motion vectors for the current macroblock
105 int rv30; ///< indicates which RV variasnt is currently decoded
106 int rpr; ///< one field size in RV30 slice header
108 int cur_pts, last_pts, next_pts;
109 int scaled_weight;
110 int weight1, weight2; ///< B frame distance fractions (0.14) used in motion compensation
111 int mv_weight1, mv_weight2;
113 uint16_t *cbp_luma; ///< CBP values for luma subblocks
114 uint8_t *cbp_chroma; ///< CBP values for chroma subblocks
115 uint16_t *deblock_coefs; ///< deblock coefficients for each macroblock
117 /** 8x8 block available flags (for MV prediction) */
118 DECLARE_ALIGNED(8, uint32_t, avail_cache)[3*4];
120 /** temporary blocks for RV4 weighted MC */
121 uint8_t *tmp_b_block_y[2];
122 uint8_t *tmp_b_block_uv[4];
123 uint8_t *tmp_b_block_base;
125 int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si);
126 int (*decode_mb_info)(struct RV34DecContext *r);
127 int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst);
128 void (*loop_filter)(struct RV34DecContext *r, int row);
129 }RV34DecContext;
132 * common decoding functions
134 int ff_rv34_get_start_offset(GetBitContext *gb, int blocks);
135 int ff_rv34_decode_init(AVCodecContext *avctx);
136 int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt);
137 int ff_rv34_decode_end(AVCodecContext *avctx);
138 int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx);
139 int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
141 #endif /* AVCODEC_RV34_H */