Mercurial > libavcodec.hg
annotate ivi_common.h @ 11986:11a8d4c1ee81 libavcodec
Use lookup table to avoid division in mp2 decoder
author | vitor |
---|---|
date | Mon, 28 Jun 2010 04:55:36 +0000 |
parents | 7d12639b4b05 |
children | fdafbcef52f5 |
rev | line source |
---|---|
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
1 /* |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
2 * common functions for Indeo Video Interactive codecs (Indeo4 and Indeo5) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
3 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
4 * Copyright (c) 2009 Maxim Poliakovski |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
5 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
6 * This file is part of FFmpeg. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
7 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
12 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
17 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
21 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
22 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
23 /** |
11644
7dd2a45249a9
Remove explicit filename from Doxygen @file commands.
diego
parents:
11309
diff
changeset
|
24 * @file |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
25 * This file contains structures and macros shared by both Indeo4 and |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
26 * Indeo5 decoders. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
27 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
28 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
29 #ifndef AVCODEC_IVI_COMMON_H |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
30 #define AVCODEC_IVI_COMMON_H |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
31 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
32 #include "avcodec.h" |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
33 #include "get_bits.h" |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
34 #include <stdint.h> |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
35 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
36 #define IVI_DEBUG 0 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
37 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
38 #define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
39 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
40 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
41 * huffman codebook descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
42 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
43 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
44 int32_t num_rows; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
45 uint8_t xbits[16]; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
46 } IVIHuffDesc; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
47 |
11309
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
48 /** |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
49 * macroblock/block huffman table descriptor |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
50 */ |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
51 typedef struct { |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
52 int32_t tab_sel; /// index of one of the predefined tables |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
53 /// or "7" for custom one |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
54 VLC *tab; /// pointer to the table associated with tab_sel |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
55 |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
56 //! the following are used only when tab_sel == 7 |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
57 IVIHuffDesc cust_desc; /// custom Huffman codebook descriptor |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
58 VLC cust_tab; /// vlc table for custom codebook |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
59 } IVIHuffTab; |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
60 |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
61 enum { |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
62 IVI_MB_HUFF = 0, /// Huffman table is used for coding macroblocks |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
63 IVI_BLK_HUFF = 1 /// Huffman table is used for coding blocks |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
64 }; |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
65 |
11246
b75449aaea3e
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
kostya
parents:
11180
diff
changeset
|
66 extern VLC ff_ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables |
b75449aaea3e
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
kostya
parents:
11180
diff
changeset
|
67 extern VLC ff_ivi_blk_vlc_tabs[8]; ///< static block Huffman tables |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
68 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
69 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
70 /** |
11772 | 71 * Common scan patterns (defined in ivi_common.c) |
72 */ | |
11778
31dae9841fe1
Add the forgotten ff_ prefix to the shareable scan patterns.
maxim
parents:
11772
diff
changeset
|
73 extern const uint8_t ff_ivi_vertical_scan_8x8[64]; |
31dae9841fe1
Add the forgotten ff_ prefix to the shareable scan patterns.
maxim
parents:
11772
diff
changeset
|
74 extern const uint8_t ff_ivi_horizontal_scan_8x8[64]; |
31dae9841fe1
Add the forgotten ff_ prefix to the shareable scan patterns.
maxim
parents:
11772
diff
changeset
|
75 extern const uint8_t ff_ivi_direct_scan_4x4[16]; |
11772 | 76 |
77 | |
78 /** | |
11869
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
79 * Declare inverse transform function types |
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
80 */ |
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
81 typedef void (InvTransformPtr)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags); |
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
82 typedef void (DCTransformPtr) (const int32_t *in, int16_t *out, uint32_t pitch, int blk_size); |
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
83 |
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
84 |
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
85 /** |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
86 * run-value (RLE) table descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
87 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
88 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
89 uint8_t eob_sym; ///< end of block symbol |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
90 uint8_t esc_sym; ///< escape symbol |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
91 uint8_t runtab[256]; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
92 int8_t valtab[256]; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
93 } RVMapDesc; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
94 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
95 extern const RVMapDesc ff_ivi_rvmap_tabs[9]; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
96 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
97 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
98 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
99 * information for Indeo macroblock (16x16, 8x8 or 4x4) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
100 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
101 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
102 int16_t xpos; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
103 int16_t ypos; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
104 uint32_t buf_offs; ///< address in the output buffer for this mb |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
105 uint8_t type; ///< macroblock type: 0 - INTRA, 1 - INTER |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
106 uint8_t cbp; ///< coded block pattern |
11743 | 107 int8_t q_delta; ///< quant delta |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
108 int8_t mv_x; ///< motion vector (x component) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
109 int8_t mv_y; ///< motion vector (y component) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
110 } IVIMbInfo; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
111 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
112 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
113 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
114 * information for Indeo tile |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
115 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
116 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
117 int xpos; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
118 int ypos; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
119 int width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
120 int height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
121 int is_empty; ///< = 1 if this tile doesn't contain any data |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
122 int data_size; ///< size of the data in bytes |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
123 int num_MBs; ///< number of macroblocks in this tile |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
124 IVIMbInfo *mbs; ///< array of macroblock descriptors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
125 IVIMbInfo *ref_mbs; ///< ptr to the macroblock descriptors of the reference tile |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
126 } IVITile; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
127 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
128 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
129 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
130 * information for Indeo wavelet band |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
131 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
132 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
133 int plane; ///< plane number this band belongs to |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
134 int band_num; ///< band number |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
135 int width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
136 int height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
137 const uint8_t *data_ptr; ///< ptr to the first byte of the band data |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
138 int data_size; ///< size of the band data |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
139 int16_t *buf; ///< pointer to the output buffer for this band |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
140 int16_t *ref_buf; ///< pointer to the reference frame buffer (for motion compensation) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
141 int16_t *bufs[3]; ///< array of pointers to the band buffers |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
142 int pitch; ///< pitch associated with the buffers above |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
143 int is_empty; ///< = 1 if this band doesn't contain any data |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
144 int mb_size; ///< macroblock size |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
145 int blk_size; ///< block size |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
146 int is_halfpel; ///< precision of the motion compensation: 0 - fullpel, 1 - halfpel |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
147 int inherit_mv; ///< tells if motion vector is inherited from reference macroblock |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
148 int inherit_qdelta; ///< tells if quantiser delta is inherited from reference macroblock |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
149 int qdelta_present; ///< tells if Qdelta signal is present in the bitstream (Indeo5 only) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
150 int quant_mat; ///< dequant matrix index |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
151 int glob_quant; ///< quant base for this band |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
152 const uint8_t *scan; ///< ptr to the scan pattern |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
153 |
11309
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
154 IVIHuffTab blk_vlc; ///< vlc table for decoding block data |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
155 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
156 int num_corr; ///< number of correction entries |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
157 uint8_t corr[61*2]; ///< rvmap correction pairs |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
158 int rvmap_sel; ///< rvmap table selector |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
159 RVMapDesc *rv_map; ///< ptr to the RLE table for this band |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
160 int num_tiles; ///< number of tiles in this band |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
161 IVITile *tiles; ///< array of tile descriptors |
11869
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
162 InvTransformPtr *inv_transform; |
7d12639b4b05
Move transform declarations out of IVIBandDesc so indeo4 can use them as well.
maxim
parents:
11853
diff
changeset
|
163 DCTransformPtr *dc_transform; |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
164 int is_2d_trans; ///< 1 indicates that the two-dimensional inverse transform is used |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
165 int32_t checksum; ///< for debug purposes |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
166 int checksum_present; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
167 int bufsize; ///< band buffer size in bytes |
11853
1547c744b8d4
Prepare Indeo4 (step 1): upscale indeo5 base tables by 2 and convert those into uint16_t.
maxim
parents:
11798
diff
changeset
|
168 const uint16_t *intra_base; ///< quantization matrix for intra blocks |
1547c744b8d4
Prepare Indeo4 (step 1): upscale indeo5 base tables by 2 and convert those into uint16_t.
maxim
parents:
11798
diff
changeset
|
169 const uint16_t *inter_base; ///< quantization matrix for inter blocks |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
170 const uint8_t *intra_scale; ///< quantization coefficient for intra blocks |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
171 const uint8_t *inter_scale; ///< quantization coefficient for inter blocks |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
172 } IVIBandDesc; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
173 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
174 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
175 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
176 * color plane (luma or chroma) information |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
177 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
178 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
179 uint16_t width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
180 uint16_t height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
181 uint8_t num_bands; ///< number of bands this plane subdivided into |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
182 IVIBandDesc *bands; ///< array of band descriptors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
183 } IVIPlaneDesc; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
184 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
185 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
186 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
187 uint16_t pic_width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
188 uint16_t pic_height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
189 uint16_t chroma_width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
190 uint16_t chroma_height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
191 uint16_t tile_width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
192 uint16_t tile_height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
193 uint8_t luma_bands; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
194 uint8_t chroma_bands; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
195 } IVIPicConfig; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
196 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
197 /** compares some properties of two pictures */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
198 static inline int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
199 { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
200 return (str1->pic_width != str2->pic_width || str1->pic_height != str2->pic_height || |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
201 str1->chroma_width != str2->chroma_width || str1->chroma_height != str2->chroma_height || |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
202 str1->tile_width != str2->tile_width || str1->tile_height != str2->tile_height || |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
203 str1->luma_bands != str2->luma_bands || str1->chroma_bands != str2->chroma_bands); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
204 } |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
205 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
206 /** calculate number of tiles in a stride */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
207 #define IVI_NUM_TILES(stride, tile_size) (((stride) + (tile_size) - 1) / (tile_size)) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
208 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
209 /** calculate number of macroblocks in a tile */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
210 #define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size) \ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
211 ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size))) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
212 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
213 /** convert unsigned values into signed ones (the sign is in the LSB) */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
214 #define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1))) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
215 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
216 /** scales motion vector */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
217 static inline int ivi_scale_mv(int mv, int mv_scale) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
218 { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
219 return (mv + (mv > 0) + (mv_scale - 1)) >> mv_scale; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
220 } |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
221 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
222 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
223 * Generates a huffman codebook from the given descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
224 * and converts it into the FFmpeg VLC table. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
225 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
226 * @param cb [in] pointer to codebook descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
227 * @param vlc [out] where to place the generated VLC table |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
228 * @param flag [in] flag: 1 - for static or 0 for dynamic tables |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
229 * @return result code: 0 - OK, -1 = error (invalid codebook descriptor) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
230 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
231 int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
232 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
233 /** |
11246
b75449aaea3e
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
kostya
parents:
11180
diff
changeset
|
234 * Initializes static codes used for macroblock and block decoding. |
b75449aaea3e
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
kostya
parents:
11180
diff
changeset
|
235 */ |
11308
06e2ff1295bd
Make it clear that ff_ivi_init_static_vlc() does not need arguments
kostya
parents:
11246
diff
changeset
|
236 void ff_ivi_init_static_vlc(void); |
11246
b75449aaea3e
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
kostya
parents:
11180
diff
changeset
|
237 |
b75449aaea3e
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
kostya
parents:
11180
diff
changeset
|
238 /** |
11309
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
239 * Decodes a huffman codebook descriptor from the bitstream |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
240 * and selects specified huffman table. |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
241 * |
11309
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
242 * @param gb [in,out] the GetBit context |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
243 * @param desc_coded [in] flag signalling if table descriptor was coded |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
244 * @param which_tab [in] codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF) |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
245 * @param huff_tab [out] pointer to the descriptor of the selected table |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
246 * @param avctx [in] AVCodecContext pointer |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
247 * @return zero on success, negative value otherwise |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
248 */ |
11309
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
249 int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
250 IVIHuffTab *huff_tab, AVCodecContext *avctx); |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
251 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
252 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
253 * Compares two huffman codebook descriptors. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
254 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
255 * @param desc1 [in] ptr to the 1st descriptor to compare |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
256 * @param desc2 [in] ptr to the 2nd descriptor to compare |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
257 * @return comparison result: 0 - equal, 1 - not equal |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
258 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
259 int ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
260 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
261 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
262 * Copies huffman codebook descriptors. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
263 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
264 * @param dst [out] ptr to the destination descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
265 * @param src [in] ptr to the source descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
266 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
267 void ff_ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
268 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
269 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
270 * Initializes planes (prepares descriptors, allocates buffers etc). |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
271 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
272 * @param planes [in,out] pointer to the array of the plane descriptors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
273 * @param cfg [in] pointer to the ivi_pic_config structure describing picture layout |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
274 * @return result code: 0 - OK |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
275 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
276 int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
277 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
278 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
279 * Frees planes, bands and macroblocks buffers. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
280 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
281 * @param planes [in] pointer to the array of the plane descriptors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
282 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
283 void ff_ivi_free_buffers(IVIPlaneDesc *planes); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
284 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
285 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
286 * Initializes tile and macroblock descriptors. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
287 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
288 * @param planes [in,out] pointer to the array of the plane descriptors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
289 * @param tile_width [in] tile width |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
290 * @param tile_height [in] tile height |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
291 * @return result code: 0 - OK |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
292 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
293 int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
294 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
295 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
296 * Decodes size of the tile data. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
297 * The size is stored as a variable-length field having the following format: |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
298 * if (tile_data_size < 255) than this field is only one byte long |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
299 * if (tile_data_size >= 255) than this field four is byte long: 0xFF X1 X2 X3 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
300 * where X1-X3 is size of the tile data |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
301 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
302 * @param gb [in,out] the GetBit context |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
303 * @return size of the tile data in bytes |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
304 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
305 int ff_ivi_dec_tile_data_size(GetBitContext *gb); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
306 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
307 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
308 * Decodes block data: |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
309 * extracts huffman-coded transform coefficients from the bitstream, |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
310 * dequantizes them, applies inverse transform and motion compensation |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
311 * in order to reconstruct the picture. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
312 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
313 * @param gb [in,out] the GetBit context |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
314 * @param band [in] pointer to the band descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
315 * @param tile [in] pointer to the tile descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
316 * @return result code: 0 - OK, -1 = error (corrupted blocks data) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
317 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
318 int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
319 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
320 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
321 * Handles empty tiles by performing data copying and motion |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
322 * compensation respectively. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
323 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
324 * @param avctx [in] ptr to the AVCodecContext |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
325 * @param band [in] pointer to the band descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
326 * @param tile [in] pointer to the tile descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
327 * @param mv_scale [in] scaling factor for motion vectors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
328 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
329 void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band, |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
330 IVITile *tile, int32_t mv_scale); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
331 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
332 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
333 * Converts and outputs the current plane. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
334 * This conversion is done by adding back the bias value of 128 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
335 * (subtracted in the encoder) and clipping the result. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
336 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
337 * @param plane [in] pointer to the descriptor of the plane being processed |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
338 * @param dst [out] pointer to the buffer receiving converted pixels |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
339 * @param dst_pitch [in] pitch for moving to the next y line |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
340 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
341 void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
342 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
343 #if IVI_DEBUG |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
344 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
345 * Calculates band checksum from band data. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
346 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
347 uint16_t ivi_calc_band_checksum (IVIBandDesc *band); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
348 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
349 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
350 * Verifies that band data lies in range. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
351 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
352 int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
353 #endif |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
354 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
355 #endif /* AVCODEC_IVI_COMMON_H */ |