Mercurial > libavcodec.hg
annotate ivi_common.h @ 11819:9bdc0fe882fa libavcodec
aacdec: Work around illegal files with all elem_id tags set to the same value.
Fixes issue 1882.
author | alexc |
---|---|
date | Thu, 03 Jun 2010 02:17:49 +0000 |
parents | 46a7546ad744 |
children | 1547c744b8d4 |
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 /** | |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
79 * run-value (RLE) table descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
80 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
81 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
82 uint8_t eob_sym; ///< end of block symbol |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
83 uint8_t esc_sym; ///< escape symbol |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
84 uint8_t runtab[256]; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
85 int8_t valtab[256]; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
86 } RVMapDesc; |
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 extern const RVMapDesc ff_ivi_rvmap_tabs[9]; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
89 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
90 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
91 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
92 * information for Indeo macroblock (16x16, 8x8 or 4x4) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
93 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
94 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
95 int16_t xpos; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
96 int16_t ypos; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
97 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
|
98 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
|
99 uint8_t cbp; ///< coded block pattern |
11743 | 100 int8_t q_delta; ///< quant delta |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
101 int8_t mv_x; ///< motion vector (x component) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
102 int8_t mv_y; ///< motion vector (y component) |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
103 } IVIMbInfo; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
104 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
105 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
106 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
107 * information for Indeo tile |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
108 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
109 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
110 int xpos; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
111 int ypos; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
112 int width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
113 int height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
114 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
|
115 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
|
116 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
|
117 IVIMbInfo *mbs; ///< array of macroblock descriptors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
118 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
|
119 } IVITile; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
120 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
121 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
122 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
123 * information for Indeo wavelet band |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
124 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
125 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
126 int plane; ///< plane number this band belongs to |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
127 int band_num; ///< band number |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
128 int width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
129 int height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
130 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
|
131 int data_size; ///< size of the band data |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 int pitch; ///< pitch associated with the buffers above |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
136 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
|
137 int mb_size; ///< macroblock size |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
138 int blk_size; ///< block size |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
139 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
|
140 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
|
141 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
|
142 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
|
143 int quant_mat; ///< dequant matrix index |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
144 int glob_quant; ///< quant base for this band |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
145 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
|
146 |
11309
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
147 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
|
148 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
149 int num_corr; ///< number of correction entries |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
150 uint8_t corr[61*2]; ///< rvmap correction pairs |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
151 int rvmap_sel; ///< rvmap table selector |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
152 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
|
153 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
|
154 IVITile *tiles; ///< array of tile descriptors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
155 void (*inv_transform)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags); ///< inverse transform function pointer |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
156 void (*dc_transform) (const int32_t *in, int16_t *out, uint32_t pitch, int blk_size); ///< dc transform function pointer, it may be NULL |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
157 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
|
158 int32_t checksum; ///< for debug purposes |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
159 int checksum_present; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
160 int bufsize; ///< band buffer size in bytes |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
161 const uint8_t *intra_base; ///< quantization matrix for intra blocks |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
162 const uint8_t *inter_base; ///< quantization matrix for inter blocks |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
163 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
|
164 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
|
165 } IVIBandDesc; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
166 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
167 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
168 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
169 * color plane (luma or chroma) information |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
170 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
171 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
172 uint16_t width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
173 uint16_t height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
174 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
|
175 IVIBandDesc *bands; ///< array of band descriptors |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
176 } IVIPlaneDesc; |
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 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
179 typedef struct { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
180 uint16_t pic_width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
181 uint16_t pic_height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
182 uint16_t chroma_width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
183 uint16_t chroma_height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
184 uint16_t tile_width; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
185 uint16_t tile_height; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
186 uint8_t luma_bands; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
187 uint8_t chroma_bands; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
188 } IVIPicConfig; |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
189 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
190 /** compares some properties of two pictures */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
191 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
|
192 { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 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
|
197 } |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
198 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
199 /** calculate number of tiles in a stride */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
200 #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
|
201 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
202 /** calculate number of macroblocks in a tile */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
203 #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
|
204 ((((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
|
205 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
206 /** 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
|
207 #define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1))) |
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 /** scales motion vector */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
210 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
|
211 { |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
212 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
|
213 } |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
214 |
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 * Generates a huffman codebook from the given descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
217 * and converts it into the FFmpeg VLC table. |
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 * @param cb [in] pointer to codebook descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
220 * @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
|
221 * @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
|
222 * @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
|
223 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
224 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
|
225 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
226 /** |
11246
b75449aaea3e
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
kostya
parents:
11180
diff
changeset
|
227 * 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
|
228 */ |
11308
06e2ff1295bd
Make it clear that ff_ivi_init_static_vlc() does not need arguments
kostya
parents:
11246
diff
changeset
|
229 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
|
230 |
b75449aaea3e
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
kostya
parents:
11180
diff
changeset
|
231 /** |
11309
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
232 * Decodes a huffman codebook descriptor from the bitstream |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
233 * and selects specified huffman table. |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
234 * |
11309
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
235 * @param gb [in,out] the GetBit context |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
236 * @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
|
237 * @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
|
238 * @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
|
239 * @param avctx [in] AVCodecContext pointer |
d617766bf19b
Encapsulate VLC information needed for decoding blocks and macroblocks in
kostya
parents:
11308
diff
changeset
|
240 * @return zero on success, negative value otherwise |
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 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
|
243 IVIHuffTab *huff_tab, AVCodecContext *avctx); |
11054
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
244 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
245 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
246 * Compares two huffman codebook descriptors. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
247 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
248 * @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
|
249 * @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
|
250 * @return comparison result: 0 - equal, 1 - not equal |
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 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
|
253 |
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 * Copies huffman codebook descriptors. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
256 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
257 * @param dst [out] ptr to the destination descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
258 * @param src [in] ptr to the source descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
259 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
260 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
|
261 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
262 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
263 * Initializes planes (prepares descriptors, allocates buffers etc). |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
264 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
265 * @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
|
266 * @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
|
267 * @return result code: 0 - OK |
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 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
|
270 |
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 * Frees planes, bands and macroblocks buffers. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
273 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
274 * @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
|
275 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
276 void ff_ivi_free_buffers(IVIPlaneDesc *planes); |
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 * Initializes tile and macroblock descriptors. |
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,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
|
282 * @param tile_width [in] tile width |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
283 * @param tile_height [in] tile height |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
284 * @return result code: 0 - OK |
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 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
|
287 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
288 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
289 * Decodes size of the tile data. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
290 * 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
|
291 * 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
|
292 * 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
|
293 * 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
|
294 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
295 * @param gb [in,out] the GetBit context |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
296 * @return size of the tile data in bytes |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
297 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
298 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
|
299 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
300 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
301 * Decodes block data: |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
302 * extracts huffman-coded transform coefficients from the bitstream, |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
303 * dequantizes them, applies inverse transform and motion compensation |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
304 * in order to reconstruct the picture. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
305 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
306 * @param gb [in,out] the GetBit context |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
307 * @param band [in] pointer to the band descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
308 * @param tile [in] pointer to the tile descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
309 * @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
|
310 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
311 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
|
312 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
313 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
314 * 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
|
315 * compensation respectively. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
316 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
317 * @param avctx [in] ptr to the AVCodecContext |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
318 * @param band [in] pointer to the band descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
319 * @param tile [in] pointer to the tile descriptor |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
320 * @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
|
321 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
322 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
|
323 IVITile *tile, int32_t mv_scale); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
324 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
325 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
326 * Converts and outputs the current plane. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
327 * 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
|
328 * (subtracted in the encoder) and clipping the result. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
329 * |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
330 * @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
|
331 * @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
|
332 * @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
|
333 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
334 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
|
335 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
336 #if IVI_DEBUG |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
337 /** |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
338 * Calculates band checksum from band data. |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
339 */ |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
340 uint16_t ivi_calc_band_checksum (IVIBandDesc *band); |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
341 |
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 * Verifies that band data lies in range. |
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 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
|
346 #endif |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
347 |
3b79a8709f43
Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff
changeset
|
348 #endif /* AVCODEC_IVI_COMMON_H */ |