Mercurial > libavcodec.hg
annotate rv34.h @ 7462:5cbf11f56c02 libavcodec
Picture.ref_count/ref_poc have to be stored per field (actually also per
slice but thats a seperate bug)
Fixes at least:
CABREF3_Sand_D.264
camp_mot_fld0_full.26l
CVFI2_Sony_H.jsv
CVNLFI2_Sony_H.jsv
author | michael |
---|---|
date | Sat, 02 Aug 2008 23:13:27 +0000 |
parents | 05c3a4b419e9 |
children | c4a4495715dd |
rev | line source |
---|---|
6026 | 1 /* |
2 * RV30/40 decoder common data declarations | |
3 * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov | |
4 * | |
5 * This file is part of FFmpeg. | |
6 * | |
7 * FFmpeg 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. | |
11 * | |
12 * FFmpeg 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. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with FFmpeg; if not, write to the Free Software | |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
20 */ | |
21 | |
22 /** | |
23 * @file rv34.h | |
24 * RV30 and RV40 decoder common data declarations | |
25 */ | |
26 | |
27 #ifndef FFMPEG_RV34_H | |
28 #define FFMPEG_RV34_H | |
29 | |
30 #include "avcodec.h" | |
31 #include "dsputil.h" | |
32 #include "mpegvideo.h" | |
33 | |
34 #include "h264pred.h" | |
35 | |
36 /** | |
37 * RV30 and RV40 Macroblock types | |
38 */ | |
39 enum RV40BlockTypes{ | |
40 RV34_MB_TYPE_INTRA, ///< Intra macroblock | |
41 RV34_MB_TYPE_INTRA16x16, ///< Intra macroblock with DCs in a separate 4x4 block | |
42 RV34_MB_P_16x16, ///< P-frame macroblock, one motion frame | |
43 RV34_MB_P_8x8, ///< P-frame macroblock, 8x8 motion compensation partitions | |
44 RV34_MB_B_FORWARD, ///< B-frame macroblock, forward prediction | |
45 RV34_MB_B_BACKWARD, ///< B-frame macroblock, backward prediction | |
46 RV34_MB_SKIP, ///< Skipped block | |
47 RV34_MB_B_DIRECT, ///< Bidirectionally predicted B-frame macroblock, no motion vectors | |
48 RV34_MB_P_16x8, ///< P-frame macroblock, 16x8 motion compensation partitions | |
49 RV34_MB_P_8x16, ///< P-frame macroblock, 8x16 motion compensation partitions | |
50 RV34_MB_B_BIDIR, ///< Bidirectionally predicted B-frame macroblock, two motion vectors | |
51 RV34_MB_P_MIX16x16, ///< P-frame macroblock with DCs in a separate 4x4 block, one motion vector | |
52 RV34_MB_TYPES | |
53 }; | |
54 | |
55 /** | |
56 * VLC tables used by the decoder | |
57 * | |
58 * Intra frame VLC sets do not contain some of those tables. | |
59 */ | |
60 typedef struct RV34VLC{ | |
61 VLC cbppattern[2]; ///< VLCs used for pattern of coded block patterns decoding | |
62 VLC cbp[2][4]; ///< VLCs used for coded block patterns decoding | |
63 VLC first_pattern[4]; ///< VLCs used for decoding coefficients in the first subblock | |
64 VLC second_pattern[2]; ///< VLCs used for decoding coefficients in the subblocks 2 and 3 | |
65 VLC third_pattern[2]; ///< VLCs used for decoding coefficients in the last subblock | |
66 VLC coefficient; ///< VLCs used for decoding big coefficients | |
67 }RV34VLC; | |
68 | |
69 /** essential slice information */ | |
70 typedef struct SliceInfo{ | |
71 int type; ///< slice type (intra, inter) | |
72 int quant; ///< quantizer used for this slice | |
73 int vlc_set; ///< VLCs used for this slice | |
74 int start, end; ///< start and end macroblocks of the slice | |
75 int width; ///< coded width | |
76 int height; ///< coded height | |
6714
05c3a4b419e9
Calculate motion vector information based on PTS provided in slice header
kostya
parents:
6326
diff
changeset
|
77 int pts; ///< frame timestamp |
6026 | 78 }SliceInfo; |
79 | |
80 /** decoder context */ | |
81 typedef struct RV34DecContext{ | |
82 MpegEncContext s; | |
83 int8_t *intra_types_hist;///< old block types, used for prediction | |
84 int8_t *intra_types; ///< block types | |
6326
0e5d68320488
Make luma_dc_quant_i and luma_dc_quant_p const, fixes a couple of
diego
parents:
6155
diff
changeset
|
85 const uint8_t *luma_dc_quant_i;///< luma subblock DC quantizer for intraframes |
0e5d68320488
Make luma_dc_quant_i and luma_dc_quant_p const, fixes a couple of
diego
parents:
6155
diff
changeset
|
86 const uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes |
6026 | 87 |
88 RV34VLC *cur_vlcs; ///< VLC set used for current frame decoding | |
89 int bits; ///< slice size in bits | |
90 H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction | |
91 SliceInfo si; ///< current slice information | |
92 | |
93 int *mb_type; ///< internal macroblock types | |
94 int block_type; ///< current block type | |
95 int luma_vlc; ///< which VLC set will be used for decoding of luma blocks | |
96 int chroma_vlc; ///< which VLC set will be used for decoding of chroma blocks | |
97 int is16; ///< current block has additional 16x16 specific features or not | |
98 int dmv[4][2]; ///< differential motion vectors for the current macroblock | |
99 | |
100 int rv30; ///< indicates which RV variasnt is currently decoded | |
101 int rpr; ///< one field size in RV30 slice header | |
102 | |
6714
05c3a4b419e9
Calculate motion vector information based on PTS provided in slice header
kostya
parents:
6326
diff
changeset
|
103 int cur_pts, last_pts, next_pts; |
05c3a4b419e9
Calculate motion vector information based on PTS provided in slice header
kostya
parents:
6326
diff
changeset
|
104 |
6155
a425bdc70ac5
Save coded block patterns for future loop filtering.
kostya
parents:
6026
diff
changeset
|
105 uint16_t *cbp_luma; ///< CBP values for luma subblocks |
a425bdc70ac5
Save coded block patterns for future loop filtering.
kostya
parents:
6026
diff
changeset
|
106 uint8_t *cbp_chroma; ///< CBP values for chroma subblocks |
a425bdc70ac5
Save coded block patterns for future loop filtering.
kostya
parents:
6026
diff
changeset
|
107 |
6026 | 108 /** 8x8 block available flags (for MV prediction) */ |
109 DECLARE_ALIGNED_8(uint32_t, avail_cache[3*4]); | |
110 | |
111 int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si); | |
112 int (*decode_mb_info)(struct RV34DecContext *r); | |
113 int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst); | |
114 void (*loop_filter)(struct RV34DecContext *r); | |
115 }RV34DecContext; | |
116 | |
117 /** | |
118 * common decoding functions | |
119 */ | |
120 int ff_rv34_get_start_offset(GetBitContext *gb, int blocks); | |
121 int ff_rv34_decode_init(AVCodecContext *avctx); | |
122 int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size); | |
123 int ff_rv34_decode_end(AVCodecContext *avctx); | |
124 | |
125 #endif /* FFMPEG_RV34_H */ |