annotate rv34.h @ 9697:99c39bb5c525 libavcodec

indent
author michael
date Sat, 23 May 2009 23:02:33 +0000
parents 54bc8a2727b0
children 305536ce781f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
1 /*
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
2 * RV30/40 decoder common data declarations
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
3 * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
4 *
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
5 * This file is part of FFmpeg.
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
6 *
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
11 *
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
15 * Lesser General Public License for more details.
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
16 *
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
20 */
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
21
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
22 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8242
diff changeset
23 * @file libavcodec/rv34.h
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
24 * RV30 and RV40 decoder common data declarations
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
25 */
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
26
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6714
diff changeset
27 #ifndef AVCODEC_RV34_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6714
diff changeset
28 #define AVCODEC_RV34_H
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
29
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
30 #include "avcodec.h"
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
31 #include "dsputil.h"
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
32 #include "mpegvideo.h"
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
33
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
34 #include "h264pred.h"
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
35
7999
582e4aae5d16 Register RV-[34] block specific feature for long future loop filter
kostya
parents: 7760
diff changeset
36 #define MB_TYPE_SEPARATE_DC 0x01000000
582e4aae5d16 Register RV-[34] block specific feature for long future loop filter
kostya
parents: 7760
diff changeset
37 #define IS_SEPARATE_DC(a) ((a) & MB_TYPE_SEPARATE_DC)
582e4aae5d16 Register RV-[34] block specific feature for long future loop filter
kostya
parents: 7760
diff changeset
38
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
39 /**
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
40 * RV30 and RV40 Macroblock types
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
41 */
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
42 enum RV40BlockTypes{
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
43 RV34_MB_TYPE_INTRA, ///< Intra macroblock
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
44 RV34_MB_TYPE_INTRA16x16, ///< Intra macroblock with DCs in a separate 4x4 block
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
45 RV34_MB_P_16x16, ///< P-frame macroblock, one motion frame
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
46 RV34_MB_P_8x8, ///< P-frame macroblock, 8x8 motion compensation partitions
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
47 RV34_MB_B_FORWARD, ///< B-frame macroblock, forward prediction
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
48 RV34_MB_B_BACKWARD, ///< B-frame macroblock, backward prediction
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
49 RV34_MB_SKIP, ///< Skipped block
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
50 RV34_MB_B_DIRECT, ///< Bidirectionally predicted B-frame macroblock, no motion vectors
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
51 RV34_MB_P_16x8, ///< P-frame macroblock, 16x8 motion compensation partitions
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
52 RV34_MB_P_8x16, ///< P-frame macroblock, 8x16 motion compensation partitions
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
53 RV34_MB_B_BIDIR, ///< Bidirectionally predicted B-frame macroblock, two motion vectors
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
54 RV34_MB_P_MIX16x16, ///< P-frame macroblock with DCs in a separate 4x4 block, one motion vector
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
55 RV34_MB_TYPES
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
56 };
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
57
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
58 /**
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
59 * VLC tables used by the decoder
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
60 *
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
61 * Intra frame VLC sets do not contain some of those tables.
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
62 */
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
63 typedef struct RV34VLC{
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
64 VLC cbppattern[2]; ///< VLCs used for pattern of coded block patterns decoding
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
65 VLC cbp[2][4]; ///< VLCs used for coded block patterns decoding
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
66 VLC first_pattern[4]; ///< VLCs used for decoding coefficients in the first subblock
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
67 VLC second_pattern[2]; ///< VLCs used for decoding coefficients in the subblocks 2 and 3
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
68 VLC third_pattern[2]; ///< VLCs used for decoding coefficients in the last subblock
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
69 VLC coefficient; ///< VLCs used for decoding big coefficients
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
70 }RV34VLC;
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
71
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
72 /** essential slice information */
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
73 typedef struct SliceInfo{
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
74 int type; ///< slice type (intra, inter)
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
75 int quant; ///< quantizer used for this slice
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
76 int vlc_set; ///< VLCs used for this slice
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
77 int start, end; ///< start and end macroblocks of the slice
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
78 int width; ///< coded width
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
79 int height; ///< coded height
6714
05c3a4b419e9 Calculate motion vector information based on PTS provided in slice header
kostya
parents: 6326
diff changeset
80 int pts; ///< frame timestamp
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
81 }SliceInfo;
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
82
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
83 /** decoder context */
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
84 typedef struct RV34DecContext{
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
85 MpegEncContext s;
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
86 int8_t *intra_types_hist;///< old block types, used for prediction
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
87 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
88 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
89 const uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
90
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
91 RV34VLC *cur_vlcs; ///< VLC set used for current frame decoding
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
92 int bits; ///< slice size in bits
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
93 H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
94 SliceInfo si; ///< current slice information
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
95
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
96 int *mb_type; ///< internal macroblock types
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
97 int block_type; ///< current block type
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
98 int luma_vlc; ///< which VLC set will be used for decoding of luma blocks
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
99 int chroma_vlc; ///< which VLC set will be used for decoding of chroma blocks
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
100 int is16; ///< current block has additional 16x16 specific features or not
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
101 int dmv[4][2]; ///< differential motion vectors for the current macroblock
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
102
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
103 int rv30; ///< indicates which RV variasnt is currently decoded
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
104 int rpr; ///< one field size in RV30 slice header
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
105
6714
05c3a4b419e9 Calculate motion vector information based on PTS provided in slice header
kostya
parents: 6326
diff changeset
106 int cur_pts, last_pts, next_pts;
05c3a4b419e9 Calculate motion vector information based on PTS provided in slice header
kostya
parents: 6326
diff changeset
107
6155
a425bdc70ac5 Save coded block patterns for future loop filtering.
kostya
parents: 6026
diff changeset
108 uint16_t *cbp_luma; ///< CBP values for luma subblocks
a425bdc70ac5 Save coded block patterns for future loop filtering.
kostya
parents: 6026
diff changeset
109 uint8_t *cbp_chroma; ///< CBP values for chroma subblocks
8037
b6d93bef844a RV3 and RV4 decoders set some deblocking coefs for each macroblock,
kostya
parents: 7999
diff changeset
110 int *deblock_coefs; ///< deblock coefficients for each macroblock
6155
a425bdc70ac5 Save coded block patterns for future loop filtering.
kostya
parents: 6026
diff changeset
111
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
112 /** 8x8 block available flags (for MV prediction) */
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
113 DECLARE_ALIGNED_8(uint32_t, avail_cache[3*4]);
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
114
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
115 int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si);
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
116 int (*decode_mb_info)(struct RV34DecContext *r);
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
117 int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst);
8224
6771b3544991 Invoke future RV30/40 loop filter for already decoded rows instead of
kostya
parents: 8116
diff changeset
118 void (*loop_filter)(struct RV34DecContext *r, int row);
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
119 }RV34DecContext;
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
120
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
121 /**
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
122 * common decoding functions
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
123 */
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
124 int ff_rv34_get_start_offset(GetBitContext *gb, int blocks);
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
125 int ff_rv34_decode_init(AVCodecContext *avctx);
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8718
diff changeset
126 int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt);
6026
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
127 int ff_rv34_decode_end(AVCodecContext *avctx);
49c086b24908 RV30/40 decoding core
kostya
parents:
diff changeset
128
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6714
diff changeset
129 #endif /* AVCODEC_RV34_H */