Mercurial > libavcodec.hg
annotate vc1dec.c @ 12104:2a6873ee2fc9 libavcodec
ARM: hide a .size directive on non-ELF targets
author | mru |
---|---|
date | Wed, 07 Jul 2010 20:09:37 +0000 |
parents | 669bf7f6c986 |
children | 9ba7d2a5b20a |
rev | line source |
---|---|
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1 /* |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2 * VC-1 and WMV3 decoder |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3 * Copyright (c) 2006-2007 Konstantin Shishkov |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
4 * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
5 * |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
6 * This file is part of FFmpeg. |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
7 * |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
12 * |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
17 * |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
21 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
22 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
23 /** |
11644
7dd2a45249a9
Remove explicit filename from Doxygen @file commands.
diego
parents:
11560
diff
changeset
|
24 * @file |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
25 * VC-1 and WMV3 decoder |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
26 * |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
27 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
28 #include "internal.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
29 #include "dsputil.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
30 #include "avcodec.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
31 #include "mpegvideo.h" |
11230 | 32 #include "h263.h" |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
33 #include "vc1.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
34 #include "vc1data.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
35 #include "vc1acdata.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
36 #include "msmpeg4data.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
37 #include "unary.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
38 #include "simple_idct.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
39 #include "mathops.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
40 #include "vdpau_internal.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
41 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
42 #undef NDEBUG |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
43 #include <assert.h> |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
44 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
45 #define MB_INTRA_VLC_BITS 9 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
46 #define DC_VLC_BITS 9 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
47 #define AC_VLC_BITS 9 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
48 static const uint16_t table_mb_intra[64][2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
49 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
50 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
51 static const uint16_t vlc_offs[] = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
52 0, 520, 552, 616, 1128, 1160, 1224, 1740, 1772, 1836, 1900, 2436, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
53 2986, 3050, 3610, 4154, 4218, 4746, 5326, 5390, 5902, 6554, 7658, 8620, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
54 9262, 10202, 10756, 11310, 12228, 15078 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
55 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
56 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
57 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
58 * Init VC-1 specific tables and VC1Context members |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
59 * @param v The VC1Context to initialize |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
60 * @return Status |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
61 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
62 static int vc1_init_common(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
63 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
64 static int done = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
65 int i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
66 static VLC_TYPE vlc_table[15078][2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
67 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
68 v->hrd_rate = v->hrd_buffer = NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
69 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
70 /* VLC tables */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
71 if(!done) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
72 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
73 INIT_VLC_STATIC(&ff_vc1_bfraction_vlc, VC1_BFRACTION_VLC_BITS, 23, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
74 ff_vc1_bfraction_bits, 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
75 ff_vc1_bfraction_codes, 1, 1, 1 << VC1_BFRACTION_VLC_BITS); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
76 INIT_VLC_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
77 ff_vc1_norm2_bits, 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
78 ff_vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
79 INIT_VLC_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
80 ff_vc1_norm6_bits, 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
81 ff_vc1_norm6_codes, 2, 2, 556); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
82 INIT_VLC_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
83 ff_vc1_imode_bits, 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
84 ff_vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
85 for (i=0; i<3; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
86 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
87 ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i*3+0]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
88 ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i*3+1] - vlc_offs[i*3+0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
89 init_vlc(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
90 ff_vc1_ttmb_bits[i], 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
91 ff_vc1_ttmb_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
92 ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i*3+1]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
93 ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i*3+2] - vlc_offs[i*3+1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
94 init_vlc(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
95 ff_vc1_ttblk_bits[i], 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
96 ff_vc1_ttblk_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
97 ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i*3+2]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
98 ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i*3+3] - vlc_offs[i*3+2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
99 init_vlc(&ff_vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
100 ff_vc1_subblkpat_bits[i], 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
101 ff_vc1_subblkpat_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
102 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
103 for(i=0; i<4; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
104 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
105 ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i*3+9]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
106 ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i*3+10] - vlc_offs[i*3+9]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
107 init_vlc(&ff_vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
108 ff_vc1_4mv_block_pattern_bits[i], 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
109 ff_vc1_4mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
110 ff_vc1_cbpcy_p_vlc[i].table = &vlc_table[vlc_offs[i*3+10]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
111 ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i*3+11] - vlc_offs[i*3+10]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
112 init_vlc(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
113 ff_vc1_cbpcy_p_bits[i], 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
114 ff_vc1_cbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
115 ff_vc1_mv_diff_vlc[i].table = &vlc_table[vlc_offs[i*3+11]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
116 ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i*3+12] - vlc_offs[i*3+11]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
117 init_vlc(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
118 ff_vc1_mv_diff_bits[i], 1, 1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
119 ff_vc1_mv_diff_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
120 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
121 for(i=0; i<8; i++){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
122 ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i+21]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
123 ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i+22] - vlc_offs[i+21]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
124 init_vlc(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, vc1_ac_sizes[i], |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
125 &vc1_ac_tables[i][0][1], 8, 4, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
126 &vc1_ac_tables[i][0][0], 8, 4, INIT_VLC_USE_NEW_STATIC); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
127 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
128 done = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
129 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
130 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
131 /* Other defaults */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
132 v->pq = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
133 v->mvrange = 0; /* 7.1.1.18, p80 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
134 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
135 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
136 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
137 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
138 /***********************************************************************/ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
139 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
140 * @defgroup vc1bitplane VC-1 Bitplane decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
141 * @see 8.7, p56 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
142 * @{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
143 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
144 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
145 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
146 * Imode types |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
147 * @{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
148 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
149 enum Imode { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
150 IMODE_RAW, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
151 IMODE_NORM2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
152 IMODE_DIFF2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
153 IMODE_NORM6, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
154 IMODE_DIFF6, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
155 IMODE_ROWSKIP, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
156 IMODE_COLSKIP |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
157 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
158 /** @} */ //imode defines |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
159 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
160 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
161 /** @} */ //Bitplane group |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
162 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
163 static void vc1_loop_filter_iblk(MpegEncContext *s, int pq) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
164 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
165 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
166 if(!s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
167 s->dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
168 s->dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
169 for(i = !s->mb_x*8; i < 16; i += 8) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
170 s->dsp.vc1_h_loop_filter16(s->dest[0] + i, s->linesize, pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
171 for(j = 0; j < 2; j++){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
172 if(!s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
173 s->dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
174 if(s->mb_x) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
175 s->dsp.vc1_h_loop_filter8(s->dest[j+1], s->uvlinesize, pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
176 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
177 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
178 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
179 /** Put block onto picture |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
180 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
181 static void vc1_put_block(VC1Context *v, DCTELEM block[6][64]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
182 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
183 uint8_t *Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
184 int ys, us, vs; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
185 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
186 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
187 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
188 int i, j, k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
189 for(k = 0; k < 6; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
190 for(j = 0; j < 8; j++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
191 for(i = 0; i < 8; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
192 block[k][i + j*8] = ((block[k][i + j*8] - 128) << 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
193 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
194 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
195 ys = v->s.current_picture.linesize[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
196 us = v->s.current_picture.linesize[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
197 vs = v->s.current_picture.linesize[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
198 Y = v->s.dest[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
199 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
200 dsp->put_pixels_clamped(block[0], Y, ys); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
201 dsp->put_pixels_clamped(block[1], Y + 8, ys); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
202 Y += ys * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
203 dsp->put_pixels_clamped(block[2], Y, ys); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
204 dsp->put_pixels_clamped(block[3], Y + 8, ys); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
205 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
206 if(!(v->s.flags & CODEC_FLAG_GRAY)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
207 dsp->put_pixels_clamped(block[4], v->s.dest[1], us); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
208 dsp->put_pixels_clamped(block[5], v->s.dest[2], vs); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
209 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
210 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
211 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
212 /** Do motion compensation over 1 macroblock |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
213 * Mostly adapted hpel_motion and qpel_motion from mpegvideo.c |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
214 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
215 static void vc1_mc_1mv(VC1Context *v, int dir) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
216 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
217 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
218 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
219 uint8_t *srcY, *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
220 int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
221 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
222 if(!v->s.last_picture.data[0])return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
223 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
224 mx = s->mv[dir][0][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
225 my = s->mv[dir][0][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
226 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
227 // store motion vectors for further use in B frames |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
228 if(s->pict_type == FF_P_TYPE) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
229 s->current_picture.motion_val[1][s->block_index[0]][0] = mx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
230 s->current_picture.motion_val[1][s->block_index[0]][1] = my; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
231 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
232 uvmx = (mx + ((mx & 3) == 3)) >> 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
233 uvmy = (my + ((my & 3) == 3)) >> 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
234 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
235 uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
236 uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
237 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
238 if(!dir) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
239 srcY = s->last_picture.data[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
240 srcU = s->last_picture.data[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
241 srcV = s->last_picture.data[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
242 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
243 srcY = s->next_picture.data[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
244 srcU = s->next_picture.data[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
245 srcV = s->next_picture.data[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
246 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
247 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
248 src_x = s->mb_x * 16 + (mx >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
249 src_y = s->mb_y * 16 + (my >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
250 uvsrc_x = s->mb_x * 8 + (uvmx >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
251 uvsrc_y = s->mb_y * 8 + (uvmy >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
252 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
253 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
254 src_x = av_clip( src_x, -16, s->mb_width * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
255 src_y = av_clip( src_y, -16, s->mb_height * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
256 uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
257 uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
258 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
259 src_x = av_clip( src_x, -17, s->avctx->coded_width); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
260 src_y = av_clip( src_y, -18, s->avctx->coded_height + 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
261 uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
262 uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
263 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
264 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
265 srcY += src_y * s->linesize + src_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
266 srcU += uvsrc_y * s->uvlinesize + uvsrc_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
267 srcV += uvsrc_y * s->uvlinesize + uvsrc_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
268 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
269 /* for grayscale we should not try to read from unknown area */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
270 if(s->flags & CODEC_FLAG_GRAY) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
271 srcU = s->edge_emu_buffer + 18 * s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
272 srcV = s->edge_emu_buffer + 18 * s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
273 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
274 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
275 if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
276 || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel*3 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
277 || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 16 - s->mspel*3){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
278 uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
279 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
280 srcY -= s->mspel * (1 + s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
281 ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
282 src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
283 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
284 ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
285 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
286 ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
287 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
288 srcU = uvbuf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
289 srcV = uvbuf + 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
290 /* if we deal with range reduction we need to scale source blocks */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
291 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
292 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
293 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
294 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
295 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
296 for(j = 0; j < 17 + s->mspel*2; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
297 for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
298 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
299 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
300 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
301 for(j = 0; j < 9; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
302 for(i = 0; i < 9; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
303 src[i] = ((src[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
304 src2[i] = ((src2[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
305 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
306 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
307 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
308 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
309 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
310 /* if we deal with intensity compensation we need to scale source blocks */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
311 if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
312 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
313 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
314 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
315 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
316 for(j = 0; j < 17 + s->mspel*2; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
317 for(i = 0; i < 17 + s->mspel*2; i++) src[i] = v->luty[src[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
318 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
319 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
320 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
321 for(j = 0; j < 9; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
322 for(i = 0; i < 9; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
323 src[i] = v->lutuv[src[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
324 src2[i] = v->lutuv[src2[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
325 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
326 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
327 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
328 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
329 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
330 srcY += s->mspel * (1 + s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
331 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
332 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
333 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
334 dxy = ((my & 3) << 2) | (mx & 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
335 dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
336 dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
337 srcY += s->linesize * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
338 dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
339 dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
340 } else { // hpel mc - always used for luma |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
341 dxy = (my & 2) | ((mx & 2) >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
342 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
343 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
344 dsp->put_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
345 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
346 dsp->put_no_rnd_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
347 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
348 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
349 if(s->flags & CODEC_FLAG_GRAY) return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
350 /* Chroma MC always uses qpel bilinear */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
351 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
352 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
353 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
354 dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
355 dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
356 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
357 dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
358 dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
359 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
360 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
361 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
362 /** Do motion compensation for 4-MV macroblock - luminance block |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
363 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
364 static void vc1_mc_4mv_luma(VC1Context *v, int n) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
365 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
366 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
367 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
368 uint8_t *srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
369 int dxy, mx, my, src_x, src_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
370 int off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
371 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
372 if(!v->s.last_picture.data[0])return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
373 mx = s->mv[0][n][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
374 my = s->mv[0][n][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
375 srcY = s->last_picture.data[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
376 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
377 off = s->linesize * 4 * (n&2) + (n&1) * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
378 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
379 src_x = s->mb_x * 16 + (n&1) * 8 + (mx >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
380 src_y = s->mb_y * 16 + (n&2) * 4 + (my >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
381 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
382 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
383 src_x = av_clip( src_x, -16, s->mb_width * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
384 src_y = av_clip( src_y, -16, s->mb_height * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
385 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
386 src_x = av_clip( src_x, -17, s->avctx->coded_width); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
387 src_y = av_clip( src_y, -18, s->avctx->coded_height + 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
388 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
389 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
390 srcY += src_y * s->linesize + src_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
391 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
392 if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
393 || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel*2 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
394 || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel*2){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
395 srcY -= s->mspel * (1 + s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
396 ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
397 src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
398 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
399 /* if we deal with range reduction we need to scale source blocks */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
400 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
401 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
402 uint8_t *src; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
403 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
404 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
405 for(j = 0; j < 9 + s->mspel*2; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
406 for(i = 0; i < 9 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
407 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
408 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
409 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
410 /* if we deal with intensity compensation we need to scale source blocks */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
411 if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
412 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
413 uint8_t *src; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
414 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
415 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
416 for(j = 0; j < 9 + s->mspel*2; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
417 for(i = 0; i < 9 + s->mspel*2; i++) src[i] = v->luty[src[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
418 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
419 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
420 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
421 srcY += s->mspel * (1 + s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
422 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
423 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
424 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
425 dxy = ((my & 3) << 2) | (mx & 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
426 dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
427 } else { // hpel mc - always used for luma |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
428 dxy = (my & 2) | ((mx & 2) >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
429 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
430 dsp->put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
431 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
432 dsp->put_no_rnd_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
433 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
434 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
435 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
436 static inline int median4(int a, int b, int c, int d) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
437 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
438 if(a < b) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
439 if(c < d) return (FFMIN(b, d) + FFMAX(a, c)) / 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
440 else return (FFMIN(b, c) + FFMAX(a, d)) / 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
441 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
442 if(c < d) return (FFMIN(a, d) + FFMAX(b, c)) / 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
443 else return (FFMIN(a, c) + FFMAX(b, d)) / 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
444 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
445 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
446 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
447 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
448 /** Do motion compensation for 4-MV macroblock - both chroma blocks |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
449 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
450 static void vc1_mc_4mv_chroma(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
451 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
452 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
453 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
454 uint8_t *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
455 int uvmx, uvmy, uvsrc_x, uvsrc_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
456 int i, idx, tx = 0, ty = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
457 int mvx[4], mvy[4], intra[4]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
458 static const int count[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
459 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
460 if(!v->s.last_picture.data[0])return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
461 if(s->flags & CODEC_FLAG_GRAY) return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
462 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
463 for(i = 0; i < 4; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
464 mvx[i] = s->mv[0][i][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
465 mvy[i] = s->mv[0][i][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
466 intra[i] = v->mb_type[0][s->block_index[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
467 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
468 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
469 /* calculate chroma MV vector from four luma MVs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
470 idx = (intra[3] << 3) | (intra[2] << 2) | (intra[1] << 1) | intra[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
471 if(!idx) { // all blocks are inter |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
472 tx = median4(mvx[0], mvx[1], mvx[2], mvx[3]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
473 ty = median4(mvy[0], mvy[1], mvy[2], mvy[3]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
474 } else if(count[idx] == 1) { // 3 inter blocks |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
475 switch(idx) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
476 case 0x1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
477 tx = mid_pred(mvx[1], mvx[2], mvx[3]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
478 ty = mid_pred(mvy[1], mvy[2], mvy[3]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
479 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
480 case 0x2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
481 tx = mid_pred(mvx[0], mvx[2], mvx[3]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
482 ty = mid_pred(mvy[0], mvy[2], mvy[3]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
483 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
484 case 0x4: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
485 tx = mid_pred(mvx[0], mvx[1], mvx[3]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
486 ty = mid_pred(mvy[0], mvy[1], mvy[3]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
487 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
488 case 0x8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
489 tx = mid_pred(mvx[0], mvx[1], mvx[2]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
490 ty = mid_pred(mvy[0], mvy[1], mvy[2]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
491 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
492 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
493 } else if(count[idx] == 2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
494 int t1 = 0, t2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
495 for(i=0; i<3;i++) if(!intra[i]) {t1 = i; break;} |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
496 for(i= t1+1; i<4; i++)if(!intra[i]) {t2 = i; break;} |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
497 tx = (mvx[t1] + mvx[t2]) / 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
498 ty = (mvy[t1] + mvy[t2]) / 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
499 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
500 s->current_picture.motion_val[1][s->block_index[0]][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
501 s->current_picture.motion_val[1][s->block_index[0]][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
502 return; //no need to do MC for inter blocks |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
503 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
504 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
505 s->current_picture.motion_val[1][s->block_index[0]][0] = tx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
506 s->current_picture.motion_val[1][s->block_index[0]][1] = ty; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
507 uvmx = (tx + ((tx&3) == 3)) >> 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
508 uvmy = (ty + ((ty&3) == 3)) >> 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
509 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
510 uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
511 uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
512 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
513 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
514 uvsrc_x = s->mb_x * 8 + (uvmx >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
515 uvsrc_y = s->mb_y * 8 + (uvmy >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
516 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
517 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
518 uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
519 uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
520 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
521 uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
522 uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
523 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
524 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
525 srcU = s->last_picture.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
526 srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
527 if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
528 || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
529 || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
530 ff_emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
531 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
532 ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
533 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
534 srcU = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
535 srcV = s->edge_emu_buffer + 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
536 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
537 /* if we deal with range reduction we need to scale source blocks */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
538 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
539 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
540 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
541 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
542 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
543 for(j = 0; j < 9; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
544 for(i = 0; i < 9; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
545 src[i] = ((src[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
546 src2[i] = ((src2[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
547 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
548 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
549 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
550 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
551 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
552 /* if we deal with intensity compensation we need to scale source blocks */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
553 if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
554 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
555 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
556 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
557 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
558 for(j = 0; j < 9; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
559 for(i = 0; i < 9; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
560 src[i] = v->lutuv[src[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
561 src2[i] = v->lutuv[src2[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
562 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
563 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
564 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
565 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
566 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
567 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
568 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
569 /* Chroma MC always uses qpel bilinear */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
570 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
571 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
572 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
573 dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
574 dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
575 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
576 dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
577 dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
578 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
579 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
580 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
581 /***********************************************************************/ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
582 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
583 * @defgroup vc1block VC-1 Block-level functions |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
584 * @see 7.1.4, p91 and 8.1.1.7, p(1)04 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
585 * @{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
586 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
587 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
588 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
589 * @def GET_MQUANT |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
590 * @brief Get macroblock-level quantizer scale |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
591 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
592 #define GET_MQUANT() \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
593 if (v->dquantfrm) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
594 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
595 int edges = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
596 if (v->dqprofile == DQPROFILE_ALL_MBS) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
597 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
598 if (v->dqbilevel) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
599 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
600 mquant = (get_bits1(gb)) ? v->altpq : v->pq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
601 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
602 else \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
603 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
604 mqdiff = get_bits(gb, 3); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
605 if (mqdiff != 7) mquant = v->pq + mqdiff; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
606 else mquant = get_bits(gb, 5); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
607 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
608 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
609 if(v->dqprofile == DQPROFILE_SINGLE_EDGE) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
610 edges = 1 << v->dqsbedge; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
611 else if(v->dqprofile == DQPROFILE_DOUBLE_EDGES) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
612 edges = (3 << v->dqsbedge) % 15; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
613 else if(v->dqprofile == DQPROFILE_FOUR_EDGES) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
614 edges = 15; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
615 if((edges&1) && !s->mb_x) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
616 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
617 if((edges&2) && s->first_slice_line) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
618 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
619 if((edges&4) && s->mb_x == (s->mb_width - 1)) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
620 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
621 if((edges&8) && s->mb_y == (s->mb_height - 1)) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
622 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
623 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
624 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
625 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
626 * @def GET_MVDATA(_dmv_x, _dmv_y) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
627 * @brief Get MV differentials |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
628 * @see MVDATA decoding from 8.3.5.2, p(1)20 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
629 * @param _dmv_x Horizontal differential for decoded MV |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
630 * @param _dmv_y Vertical differential for decoded MV |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
631 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
632 #define GET_MVDATA(_dmv_x, _dmv_y) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
633 index = 1 + get_vlc2(gb, ff_vc1_mv_diff_vlc[s->mv_table_index].table,\ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
634 VC1_MV_DIFF_VLC_BITS, 2); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
635 if (index > 36) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
636 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
637 mb_has_coeffs = 1; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
638 index -= 37; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
639 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
640 else mb_has_coeffs = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
641 s->mb_intra = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
642 if (!index) { _dmv_x = _dmv_y = 0; } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
643 else if (index == 35) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
644 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
645 _dmv_x = get_bits(gb, v->k_x - 1 + s->quarter_sample); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
646 _dmv_y = get_bits(gb, v->k_y - 1 + s->quarter_sample); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
647 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
648 else if (index == 36) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
649 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
650 _dmv_x = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
651 _dmv_y = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
652 s->mb_intra = 1; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
653 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
654 else \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
655 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
656 index1 = index%6; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
657 if (!s->quarter_sample && index1 == 5) val = 1; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
658 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
659 if(size_table[index1] - val > 0) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
660 val = get_bits(gb, size_table[index1] - val); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
661 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
662 sign = 0 - (val&1); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
663 _dmv_x = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
664 \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
665 index1 = index/6; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
666 if (!s->quarter_sample && index1 == 5) val = 1; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
667 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
668 if(size_table[index1] - val > 0) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
669 val = get_bits(gb, size_table[index1] - val); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
670 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
671 sign = 0 - (val&1); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
672 _dmv_y = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
673 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
674 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
675 /** Predict and set motion vector |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
676 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
677 static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t* is_intra) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
678 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
679 int xy, wrap, off = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
680 int16_t *A, *B, *C; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
681 int px, py; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
682 int sum; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
683 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
684 /* scale MV difference to be quad-pel */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
685 dmv_x <<= 1 - s->quarter_sample; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
686 dmv_y <<= 1 - s->quarter_sample; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
687 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
688 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
689 xy = s->block_index[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
690 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
691 if(s->mb_intra){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
692 s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
693 s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
694 s->current_picture.motion_val[1][xy][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
695 s->current_picture.motion_val[1][xy][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
696 if(mv1) { /* duplicate motion data for 1-MV block */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
697 s->current_picture.motion_val[0][xy + 1][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
698 s->current_picture.motion_val[0][xy + 1][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
699 s->current_picture.motion_val[0][xy + wrap][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
700 s->current_picture.motion_val[0][xy + wrap][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
701 s->current_picture.motion_val[0][xy + wrap + 1][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
702 s->current_picture.motion_val[0][xy + wrap + 1][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
703 s->current_picture.motion_val[1][xy + 1][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
704 s->current_picture.motion_val[1][xy + 1][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
705 s->current_picture.motion_val[1][xy + wrap][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
706 s->current_picture.motion_val[1][xy + wrap][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
707 s->current_picture.motion_val[1][xy + wrap + 1][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
708 s->current_picture.motion_val[1][xy + wrap + 1][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
709 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
710 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
711 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
712 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
713 C = s->current_picture.motion_val[0][xy - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
714 A = s->current_picture.motion_val[0][xy - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
715 if(mv1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
716 off = (s->mb_x == (s->mb_width - 1)) ? -1 : 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
717 else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
718 //in 4-MV mode different blocks have different B predictor position |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
719 switch(n){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
720 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
721 off = (s->mb_x > 0) ? -1 : 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
722 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
723 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
724 off = (s->mb_x == (s->mb_width - 1)) ? -1 : 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
725 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
726 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
727 off = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
728 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
729 case 3: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
730 off = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
731 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
732 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
733 B = s->current_picture.motion_val[0][xy - wrap + off]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
734 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
735 if(!s->first_slice_line || (n==2 || n==3)) { // predictor A is not out of bounds |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
736 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
737 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
738 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
739 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
740 px = mid_pred(A[0], B[0], C[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
741 py = mid_pred(A[1], B[1], C[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
742 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
743 } else if(s->mb_x || (n==1 || n==3)) { // predictor C is not out of bounds |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
744 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
745 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
746 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
747 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
748 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
749 /* Pullback MV as specified in 8.3.5.3.4 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
750 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
751 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
752 qx = (s->mb_x << 6) + ((n==1 || n==3) ? 32 : 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
753 qy = (s->mb_y << 6) + ((n==2 || n==3) ? 32 : 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
754 X = (s->mb_width << 6) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
755 Y = (s->mb_height << 6) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
756 if(mv1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
757 if(qx + px < -60) px = -60 - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
758 if(qy + py < -60) py = -60 - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
759 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
760 if(qx + px < -28) px = -28 - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
761 if(qy + py < -28) py = -28 - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
762 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
763 if(qx + px > X) px = X - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
764 if(qy + py > Y) py = Y - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
765 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
766 /* Calculate hybrid prediction as specified in 8.3.5.3.5 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
767 if((!s->first_slice_line || (n==2 || n==3)) && (s->mb_x || (n==1 || n==3))) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
768 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
769 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
770 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
771 sum = FFABS(px - A[0]) + FFABS(py - A[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
772 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
773 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
774 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
775 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
776 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
777 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
778 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
779 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
780 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
781 if(is_intra[xy - 1]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
782 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
783 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
784 sum = FFABS(px - C[0]) + FFABS(py - C[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
785 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
786 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
787 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
788 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
789 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
790 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
791 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
792 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
793 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
794 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
795 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
796 /* store MV using signed modulus of MV range defined in 4.11 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
797 s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
798 s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
799 if(mv1) { /* duplicate motion data for 1-MV block */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
800 s->current_picture.motion_val[0][xy + 1][0] = s->current_picture.motion_val[0][xy][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
801 s->current_picture.motion_val[0][xy + 1][1] = s->current_picture.motion_val[0][xy][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
802 s->current_picture.motion_val[0][xy + wrap][0] = s->current_picture.motion_val[0][xy][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
803 s->current_picture.motion_val[0][xy + wrap][1] = s->current_picture.motion_val[0][xy][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
804 s->current_picture.motion_val[0][xy + wrap + 1][0] = s->current_picture.motion_val[0][xy][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
805 s->current_picture.motion_val[0][xy + wrap + 1][1] = s->current_picture.motion_val[0][xy][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
806 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
807 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
808 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
809 /** Motion compensation for direct or interpolated blocks in B-frames |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
810 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
811 static void vc1_interp_mc(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
812 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
813 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
814 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
815 uint8_t *srcY, *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
816 int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
817 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
818 if(!v->s.next_picture.data[0])return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
819 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
820 mx = s->mv[1][0][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
821 my = s->mv[1][0][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
822 uvmx = (mx + ((mx & 3) == 3)) >> 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
823 uvmy = (my + ((my & 3) == 3)) >> 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
824 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
825 uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
826 uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
827 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
828 srcY = s->next_picture.data[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
829 srcU = s->next_picture.data[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
830 srcV = s->next_picture.data[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
831 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
832 src_x = s->mb_x * 16 + (mx >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
833 src_y = s->mb_y * 16 + (my >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
834 uvsrc_x = s->mb_x * 8 + (uvmx >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
835 uvsrc_y = s->mb_y * 8 + (uvmy >> 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
836 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
837 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
838 src_x = av_clip( src_x, -16, s->mb_width * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
839 src_y = av_clip( src_y, -16, s->mb_height * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
840 uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
841 uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
842 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
843 src_x = av_clip( src_x, -17, s->avctx->coded_width); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
844 src_y = av_clip( src_y, -18, s->avctx->coded_height + 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
845 uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
846 uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
847 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
848 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
849 srcY += src_y * s->linesize + src_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
850 srcU += uvsrc_y * s->uvlinesize + uvsrc_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
851 srcV += uvsrc_y * s->uvlinesize + uvsrc_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
852 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
853 /* for grayscale we should not try to read from unknown area */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
854 if(s->flags & CODEC_FLAG_GRAY) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
855 srcU = s->edge_emu_buffer + 18 * s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
856 srcV = s->edge_emu_buffer + 18 * s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
857 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
858 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
859 if(v->rangeredfrm |
9881
c69559e9f6c3
Edge emulation should be used in B-frame MC in mspel mode with
kostya
parents:
9863
diff
changeset
|
860 || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel*3 |
c69559e9f6c3
Edge emulation should be used in B-frame MC in mspel mode with
kostya
parents:
9863
diff
changeset
|
861 || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 16 - s->mspel*3){ |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
862 uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
863 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
864 srcY -= s->mspel * (1 + s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
865 ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
866 src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
867 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
868 ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
869 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
870 ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
871 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
872 srcU = uvbuf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
873 srcV = uvbuf + 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
874 /* if we deal with range reduction we need to scale source blocks */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
875 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
876 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
877 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
878 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
879 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
880 for(j = 0; j < 17 + s->mspel*2; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
881 for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
882 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
883 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
884 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
885 for(j = 0; j < 9; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
886 for(i = 0; i < 9; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
887 src[i] = ((src[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
888 src2[i] = ((src2[i] - 128) >> 1) + 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
889 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
890 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
891 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
892 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
893 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
894 srcY += s->mspel * (1 + s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
895 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
896 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
897 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
898 dxy = ((my & 3) << 2) | (mx & 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
899 dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
900 dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
901 srcY += s->linesize * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
902 dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
903 dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
904 } else { // hpel mc |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
905 dxy = (my & 2) | ((mx & 2) >> 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
906 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
907 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
908 dsp->avg_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
909 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
910 dsp->avg_no_rnd_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
911 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
912 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
913 if(s->flags & CODEC_FLAG_GRAY) return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
914 /* Chroma MC always uses qpel blilinear */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
915 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
916 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
917 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
918 dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
919 dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
920 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
921 dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
922 dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
923 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
924 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
925 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
926 static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
927 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
928 int n = bfrac; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
929 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
930 #if B_FRACTION_DEN==256 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
931 if(inv) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
932 n -= 256; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
933 if(!qs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
934 return 2 * ((value * n + 255) >> 9); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
935 return (value * n + 128) >> 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
936 #else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
937 if(inv) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
938 n -= B_FRACTION_DEN; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
939 if(!qs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
940 return 2 * ((value * n + B_FRACTION_DEN - 1) / (2 * B_FRACTION_DEN)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
941 return (value * n + B_FRACTION_DEN/2) / B_FRACTION_DEN; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
942 #endif |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
943 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
944 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
945 /** Reconstruct motion vector for B-frame and do motion compensation |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
946 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
947 static inline void vc1_b_mc(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mode) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
948 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
949 if(v->use_ic) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
950 v->mv_mode2 = v->mv_mode; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
951 v->mv_mode = MV_PMODE_INTENSITY_COMP; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
952 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
953 if(direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
954 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
955 vc1_interp_mc(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
956 if(v->use_ic) v->mv_mode = v->mv_mode2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
957 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
958 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
959 if(mode == BMV_TYPE_INTERPOLATED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
960 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
961 vc1_interp_mc(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
962 if(v->use_ic) v->mv_mode = v->mv_mode2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
963 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
964 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
965 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
966 if(v->use_ic && (mode == BMV_TYPE_BACKWARD)) v->mv_mode = v->mv_mode2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
967 vc1_mc_1mv(v, (mode == BMV_TYPE_BACKWARD)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
968 if(v->use_ic) v->mv_mode = v->mv_mode2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
969 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
970 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
971 static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mvtype) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
972 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
973 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
974 int xy, wrap, off = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
975 int16_t *A, *B, *C; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
976 int px, py; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
977 int sum; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
978 int r_x, r_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
979 const uint8_t *is_intra = v->mb_type[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
980 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
981 r_x = v->range_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
982 r_y = v->range_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
983 /* scale MV difference to be quad-pel */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
984 dmv_x[0] <<= 1 - s->quarter_sample; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
985 dmv_y[0] <<= 1 - s->quarter_sample; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
986 dmv_x[1] <<= 1 - s->quarter_sample; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
987 dmv_y[1] <<= 1 - s->quarter_sample; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
988 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
989 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
990 xy = s->block_index[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
991 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
992 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
993 s->current_picture.motion_val[0][xy][0] = |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
994 s->current_picture.motion_val[0][xy][1] = |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
995 s->current_picture.motion_val[1][xy][0] = |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
996 s->current_picture.motion_val[1][xy][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
997 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
998 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
999 s->mv[0][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1000 s->mv[0][0][1] = scale_mv(s->next_picture.motion_val[1][xy][1], v->bfraction, 0, s->quarter_sample); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1001 s->mv[1][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 1, s->quarter_sample); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1002 s->mv[1][0][1] = scale_mv(s->next_picture.motion_val[1][xy][1], v->bfraction, 1, s->quarter_sample); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1003 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1004 /* Pullback predicted motion vectors as specified in 8.4.5.4 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1005 s->mv[0][0][0] = av_clip(s->mv[0][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1006 s->mv[0][0][1] = av_clip(s->mv[0][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1007 s->mv[1][0][0] = av_clip(s->mv[1][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1008 s->mv[1][0][1] = av_clip(s->mv[1][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1009 if(direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1010 s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1011 s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1012 s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1013 s->current_picture.motion_val[1][xy][1] = s->mv[1][0][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1014 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1015 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1016 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1017 if((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1018 C = s->current_picture.motion_val[0][xy - 2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1019 A = s->current_picture.motion_val[0][xy - wrap*2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1020 off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1021 B = s->current_picture.motion_val[0][xy - wrap*2 + off]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1022 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1023 if(!s->mb_x) C[0] = C[1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1024 if(!s->first_slice_line) { // predictor A is not out of bounds |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1025 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1026 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1027 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1028 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1029 px = mid_pred(A[0], B[0], C[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1030 py = mid_pred(A[1], B[1], C[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1031 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1032 } else if(s->mb_x) { // predictor C is not out of bounds |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1033 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1034 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1035 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1036 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1037 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1038 /* Pullback MV as specified in 8.3.5.3.4 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1039 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1040 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1041 if(v->profile < PROFILE_ADVANCED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1042 qx = (s->mb_x << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1043 qy = (s->mb_y << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1044 X = (s->mb_width << 5) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1045 Y = (s->mb_height << 5) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1046 if(qx + px < -28) px = -28 - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1047 if(qy + py < -28) py = -28 - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1048 if(qx + px > X) px = X - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1049 if(qy + py > Y) py = Y - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1050 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1051 qx = (s->mb_x << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1052 qy = (s->mb_y << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1053 X = (s->mb_width << 6) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1054 Y = (s->mb_height << 6) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1055 if(qx + px < -60) px = -60 - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1056 if(qy + py < -60) py = -60 - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1057 if(qx + px > X) px = X - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1058 if(qy + py > Y) py = Y - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1059 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1060 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1061 /* Calculate hybrid prediction as specified in 8.3.5.3.5 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1062 if(0 && !s->first_slice_line && s->mb_x) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1063 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1064 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1065 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1066 sum = FFABS(px - A[0]) + FFABS(py - A[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1067 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1068 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1069 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1070 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1071 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1072 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1073 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1074 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1075 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1076 if(is_intra[xy - 2]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1077 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1078 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1079 sum = FFABS(px - C[0]) + FFABS(py - C[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1080 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1081 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1082 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1083 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1084 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1085 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1086 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1087 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1088 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1089 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1090 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1091 /* store MV using signed modulus of MV range defined in 4.11 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1092 s->mv[0][0][0] = ((px + dmv_x[0] + r_x) & ((r_x << 1) - 1)) - r_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1093 s->mv[0][0][1] = ((py + dmv_y[0] + r_y) & ((r_y << 1) - 1)) - r_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1094 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1095 if((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1096 C = s->current_picture.motion_val[1][xy - 2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1097 A = s->current_picture.motion_val[1][xy - wrap*2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1098 off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1099 B = s->current_picture.motion_val[1][xy - wrap*2 + off]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1100 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1101 if(!s->mb_x) C[0] = C[1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1102 if(!s->first_slice_line) { // predictor A is not out of bounds |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1103 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1104 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1105 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1106 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1107 px = mid_pred(A[0], B[0], C[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1108 py = mid_pred(A[1], B[1], C[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1109 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1110 } else if(s->mb_x) { // predictor C is not out of bounds |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1111 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1112 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1113 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1114 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1115 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1116 /* Pullback MV as specified in 8.3.5.3.4 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1117 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1118 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1119 if(v->profile < PROFILE_ADVANCED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1120 qx = (s->mb_x << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1121 qy = (s->mb_y << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1122 X = (s->mb_width << 5) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1123 Y = (s->mb_height << 5) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1124 if(qx + px < -28) px = -28 - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1125 if(qy + py < -28) py = -28 - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1126 if(qx + px > X) px = X - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1127 if(qy + py > Y) py = Y - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1128 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1129 qx = (s->mb_x << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1130 qy = (s->mb_y << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1131 X = (s->mb_width << 6) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1132 Y = (s->mb_height << 6) - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1133 if(qx + px < -60) px = -60 - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1134 if(qy + py < -60) py = -60 - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1135 if(qx + px > X) px = X - qx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1136 if(qy + py > Y) py = Y - qy; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1137 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1138 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1139 /* Calculate hybrid prediction as specified in 8.3.5.3.5 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1140 if(0 && !s->first_slice_line && s->mb_x) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1141 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1142 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1143 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1144 sum = FFABS(px - A[0]) + FFABS(py - A[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1145 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1146 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1147 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1148 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1149 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1150 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1151 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1152 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1153 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1154 if(is_intra[xy - 2]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1155 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1156 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1157 sum = FFABS(px - C[0]) + FFABS(py - C[1]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1158 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1159 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1160 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1161 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1162 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1163 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1164 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1165 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1166 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1167 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1168 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1169 /* store MV using signed modulus of MV range defined in 4.11 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1170 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1171 s->mv[1][0][0] = ((px + dmv_x[1] + r_x) & ((r_x << 1) - 1)) - r_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1172 s->mv[1][0][1] = ((py + dmv_y[1] + r_y) & ((r_y << 1) - 1)) - r_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1173 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1174 s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1175 s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1176 s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1177 s->current_picture.motion_val[1][xy][1] = s->mv[1][0][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1178 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1179 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1180 /** Get predicted DC value for I-frames only |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1181 * prediction dir: left=0, top=1 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1182 * @param s MpegEncContext |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1183 * @param overlap flag indicating that overlap filtering is used |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1184 * @param pq integer part of picture quantizer |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1185 * @param[in] n block index in the current MB |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1186 * @param dc_val_ptr Pointer to DC predictor |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1187 * @param dir_ptr Prediction direction for use in AC prediction |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1188 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1189 static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1190 int16_t **dc_val_ptr, int *dir_ptr) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1191 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1192 int a, b, c, wrap, pred, scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1193 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1194 static const uint16_t dcpred[32] = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1195 -1, 1024, 512, 341, 256, 205, 171, 146, 128, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1196 114, 102, 93, 85, 79, 73, 68, 64, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1197 60, 57, 54, 51, 49, 47, 45, 43, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1198 41, 39, 38, 37, 35, 34, 33 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1199 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1200 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1201 /* find prediction - wmv3_dc_scale always used here in fact */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1202 if (n < 4) scale = s->y_dc_scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1203 else scale = s->c_dc_scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1204 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1205 wrap = s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1206 dc_val= s->dc_val[0] + s->block_index[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1207 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1208 /* B A |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1209 * C X |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1210 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1211 c = dc_val[ - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1212 b = dc_val[ - 1 - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1213 a = dc_val[ - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1214 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1215 if (pq < 9 || !overlap) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1216 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1217 /* Set outer values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1218 if (s->first_slice_line && (n!=2 && n!=3)) b=a=dcpred[scale]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1219 if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=dcpred[scale]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1220 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1221 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1222 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1223 /* Set outer values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1224 if (s->first_slice_line && (n!=2 && n!=3)) b=a=0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1225 if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1226 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1227 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1228 if (abs(a - b) <= abs(b - c)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1229 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1230 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1231 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1232 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1233 *dir_ptr = 0;//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1234 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1235 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1236 /* update predictor */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1237 *dc_val_ptr = &dc_val[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1238 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1239 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1240 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1241 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1242 /** Get predicted DC value |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1243 * prediction dir: left=0, top=1 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1244 * @param s MpegEncContext |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1245 * @param overlap flag indicating that overlap filtering is used |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1246 * @param pq integer part of picture quantizer |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1247 * @param[in] n block index in the current MB |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1248 * @param a_avail flag indicating top block availability |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1249 * @param c_avail flag indicating left block availability |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1250 * @param dc_val_ptr Pointer to DC predictor |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1251 * @param dir_ptr Prediction direction for use in AC prediction |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1252 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1253 static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1254 int a_avail, int c_avail, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1255 int16_t **dc_val_ptr, int *dir_ptr) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1256 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1257 int a, b, c, wrap, pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1258 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1259 int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1260 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1261 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1262 wrap = s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1263 dc_val= s->dc_val[0] + s->block_index[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1264 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1265 /* B A |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1266 * C X |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1267 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1268 c = dc_val[ - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1269 b = dc_val[ - 1 - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1270 a = dc_val[ - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1271 /* scale predictors if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1272 q1 = s->current_picture.qscale_table[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1273 if(c_avail && (n!= 1 && n!=3)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1274 q2 = s->current_picture.qscale_table[mb_pos - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1275 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1276 c = (c * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1277 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1278 if(a_avail && (n!= 2 && n!=3)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1279 q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1280 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1281 a = (a * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1282 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1283 if(a_avail && c_avail && (n!=3)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1284 int off = mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1285 if(n != 1) off--; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1286 if(n != 2) off -= s->mb_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1287 q2 = s->current_picture.qscale_table[off]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1288 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1289 b = (b * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1290 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1291 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1292 if(a_avail && c_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1293 if(abs(a - b) <= abs(b - c)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1294 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1295 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1296 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1297 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1298 *dir_ptr = 0;//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1299 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1300 } else if(a_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1301 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1302 *dir_ptr = 0;//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1303 } else if(c_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1304 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1305 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1306 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1307 pred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1308 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1309 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1310 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1311 /* update predictor */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1312 *dc_val_ptr = &dc_val[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1313 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1314 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1315 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1316 /** @} */ // Block group |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1317 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1318 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1319 * @defgroup vc1_std_mb VC1 Macroblock-level functions in Simple/Main Profiles |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1320 * @see 7.1.4, p91 and 8.1.1.7, p(1)04 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1321 * @{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1322 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1323 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1324 static inline int vc1_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1325 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1326 int xy, wrap, pred, a, b, c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1327 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1328 xy = s->block_index[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1329 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1330 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1331 /* B C |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1332 * A X |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1333 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1334 a = s->coded_block[xy - 1 ]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1335 b = s->coded_block[xy - 1 - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1336 c = s->coded_block[xy - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1337 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1338 if (b == c) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1339 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1340 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1341 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1342 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1343 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1344 /* store value */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1345 *coded_block_ptr = &s->coded_block[xy]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1346 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1347 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1348 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1349 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1350 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1351 * Decode one AC coefficient |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1352 * @param v The VC1 context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1353 * @param last Last coefficient |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1354 * @param skip How much zero coefficients to skip |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1355 * @param value Decoded AC coefficient value |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1356 * @param codingset set of VLC to decode data |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1357 * @see 8.1.3.4 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1358 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1359 static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value, int codingset) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1360 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1361 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1362 int index, escape, run = 0, level = 0, lst = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1363 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1364 index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1365 if (index != vc1_ac_sizes[codingset] - 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1366 run = vc1_index_decode_table[codingset][index][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1367 level = vc1_index_decode_table[codingset][index][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1368 lst = index >= vc1_last_decode_table[codingset]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1369 if(get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1370 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1371 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1372 escape = decode210(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1373 if (escape != 2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1374 index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1375 run = vc1_index_decode_table[codingset][index][0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1376 level = vc1_index_decode_table[codingset][index][1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1377 lst = index >= vc1_last_decode_table[codingset]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1378 if(escape == 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1379 if(lst) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1380 level += vc1_last_delta_level_table[codingset][run]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1381 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1382 level += vc1_delta_level_table[codingset][run]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1383 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1384 if(lst) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1385 run += vc1_last_delta_run_table[codingset][level] + 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1386 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1387 run += vc1_delta_run_table[codingset][level] + 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1388 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1389 if(get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1390 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1391 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1392 int sign; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1393 lst = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1394 if(v->s.esc3_level_length == 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1395 if(v->pq < 8 || v->dquantfrm) { // table 59 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1396 v->s.esc3_level_length = get_bits(gb, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1397 if(!v->s.esc3_level_length) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1398 v->s.esc3_level_length = get_bits(gb, 2) + 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1399 } else { //table 60 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1400 v->s.esc3_level_length = get_unary(gb, 1, 6) + 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1401 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1402 v->s.esc3_run_length = 3 + get_bits(gb, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1403 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1404 run = get_bits(gb, v->s.esc3_run_length); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1405 sign = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1406 level = get_bits(gb, v->s.esc3_level_length); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1407 if(sign) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1408 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1409 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1410 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1411 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1412 *last = lst; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1413 *skip = run; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1414 *value = level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1415 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1416 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1417 /** Decode intra block in intra frames - should be faster than decode_intra_block |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1418 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1419 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1420 * @param[in] n subblock index |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1421 * @param coded are AC coeffs present or not |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1422 * @param codingset set of VLC to decode data |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1423 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1424 static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1425 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1426 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1427 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1428 int dc_pred_dir = 0; /* Direction of the DC prediction used */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1429 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1430 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1431 int16_t *ac_val, *ac_val2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1432 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1433 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1434 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1435 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1436 dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1437 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1438 dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1439 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1440 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1441 av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1442 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1443 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1444 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1445 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1446 if (dcdiff == 119 /* ESC index value */) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1447 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1448 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1449 if (v->pq == 1) dcdiff = get_bits(gb, 10); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1450 else if (v->pq == 2) dcdiff = get_bits(gb, 9); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1451 else dcdiff = get_bits(gb, 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1452 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1453 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1454 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1455 if (v->pq == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1456 dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1457 else if (v->pq == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1458 dcdiff = (dcdiff<<1) + get_bits1(gb) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1459 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1460 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1461 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1462 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1463 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1464 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1465 dcdiff += vc1_i_pred_dc(&v->s, v->overlap, v->pq, n, &dc_val, &dc_pred_dir); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1466 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1467 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1468 /* Store the quantized DC coeff, used for prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1469 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1470 block[0] = dcdiff * s->y_dc_scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1471 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1472 block[0] = dcdiff * s->c_dc_scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1473 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1474 /* Skip ? */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1475 if (!coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1476 goto not_coded; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1477 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1478 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1479 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1480 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1481 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1482 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1483 int last = 0, skip, value; |
11982
669bf7f6c986
Change type of zz_table to uint8_t to match the scantables it points to.
reimar
parents:
11796
diff
changeset
|
1484 const uint8_t *zz_table; |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1485 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1486 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1487 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1488 scale = v->pq * 2 + v->halfpq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1489 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1490 if(v->s.ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1491 if(!dc_pred_dir) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1492 zz_table = wmv1_scantable[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1493 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1494 zz_table = wmv1_scantable[3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1495 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1496 zz_table = wmv1_scantable[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1497 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1498 ac_val = s->ac_val[0][0] + s->block_index[n] * 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1499 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1500 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1501 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1502 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1503 ac_val -= 16 * s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1504 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1505 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1506 vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1507 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1508 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1509 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1510 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1511 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1512 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1513 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1514 if(s->ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1515 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1516 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1517 block[k << 3] += ac_val[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1518 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1519 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1520 block[k] += ac_val[k + 8]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1521 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1522 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1523 /* save AC coeffs for further prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1524 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1525 ac_val2[k] = block[k << 3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1526 ac_val2[k + 8] = block[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1527 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1528 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1529 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1530 for(k = 1; k < 64; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1531 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1532 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1533 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1534 block[k] += (block[k] < 0) ? -v->pq : v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1535 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1536 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1537 if(s->ac_pred) i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1538 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1539 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1540 not_coded: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1541 if(!coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1542 int k, scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1543 ac_val = s->ac_val[0][0] + s->block_index[n] * 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1544 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1545 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1546 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1547 scale = v->pq * 2 + v->halfpq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1548 memset(ac_val2, 0, 16 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1549 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1550 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1551 if(s->ac_pred) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1552 memcpy(ac_val2, ac_val, 8 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1553 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1554 ac_val -= 16 * s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1555 if(s->ac_pred) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1556 memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1557 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1558 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1559 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1560 if(s->ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1561 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1562 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1563 block[k << 3] = ac_val[k] * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1564 if(!v->pquantizer && block[k << 3]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1565 block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1566 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1567 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1568 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1569 block[k] = ac_val[k + 8] * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1570 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1571 block[k] += (block[k] < 0) ? -v->pq : v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1572 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1573 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1574 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1575 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1576 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1577 s->block_last_index[n] = i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1578 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1579 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1580 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1581 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1582 /** Decode intra block in intra frames - should be faster than decode_intra_block |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1583 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1584 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1585 * @param[in] n subblock number |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1586 * @param coded are AC coeffs present or not |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1587 * @param codingset set of VLC to decode data |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1588 * @param mquant quantizer value for this macroblock |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1589 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1590 static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset, int mquant) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1591 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1592 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1593 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1594 int dc_pred_dir = 0; /* Direction of the DC prediction used */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1595 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1596 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1597 int16_t *ac_val, *ac_val2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1598 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1599 int a_avail = v->a_avail, c_avail = v->c_avail; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1600 int use_pred = s->ac_pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1601 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1602 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1603 int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1604 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1605 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1606 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1607 dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1608 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1609 dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1610 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1611 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1612 av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1613 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1614 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1615 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1616 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1617 if (dcdiff == 119 /* ESC index value */) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1618 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1619 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1620 if (mquant == 1) dcdiff = get_bits(gb, 10); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1621 else if (mquant == 2) dcdiff = get_bits(gb, 9); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1622 else dcdiff = get_bits(gb, 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1623 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1624 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1625 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1626 if (mquant == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1627 dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1628 else if (mquant == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1629 dcdiff = (dcdiff<<1) + get_bits1(gb) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1630 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1631 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1632 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1633 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1634 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1635 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1636 dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1637 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1638 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1639 /* Store the quantized DC coeff, used for prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1640 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1641 block[0] = dcdiff * s->y_dc_scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1642 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1643 block[0] = dcdiff * s->c_dc_scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1644 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1645 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1646 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1647 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1648 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1649 /* check if AC is needed at all */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1650 if(!a_avail && !c_avail) use_pred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1651 ac_val = s->ac_val[0][0] + s->block_index[n] * 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1652 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1653 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1654 scale = mquant * 2 + ((mquant == v->pq) ? v->halfpq : 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1655 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1656 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1657 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1658 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1659 ac_val -= 16 * s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1660 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1661 q1 = s->current_picture.qscale_table[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1662 if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1663 if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1664 if(dc_pred_dir && n==1) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1665 if(!dc_pred_dir && n==2) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1666 if(n==3) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1667 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1668 if(coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1669 int last = 0, skip, value; |
11982
669bf7f6c986
Change type of zz_table to uint8_t to match the scantables it points to.
reimar
parents:
11796
diff
changeset
|
1670 const uint8_t *zz_table; |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1671 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1672 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1673 if(v->s.ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1674 if(!dc_pred_dir) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1675 zz_table = wmv1_scantable[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1676 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1677 zz_table = wmv1_scantable[3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1678 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1679 zz_table = wmv1_scantable[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1680 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1681 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1682 vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1683 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1684 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1685 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1686 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1687 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1688 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1689 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1690 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1691 /* scale predictors if needed*/ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1692 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1693 q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1694 q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1695 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1696 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1697 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1698 block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1699 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1700 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1701 block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1702 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1703 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1704 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1705 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1706 block[k << 3] += ac_val[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1707 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1708 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1709 block[k] += ac_val[k + 8]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1710 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1711 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1712 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1713 /* save AC coeffs for further prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1714 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1715 ac_val2[k] = block[k << 3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1716 ac_val2[k + 8] = block[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1717 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1718 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1719 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1720 for(k = 1; k < 64; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1721 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1722 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1723 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1724 block[k] += (block[k] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1725 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1726 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1727 if(use_pred) i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1728 } else { // no AC coeffs |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1729 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1730 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1731 memset(ac_val2, 0, 16 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1732 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1733 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1734 memcpy(ac_val2, ac_val, 8 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1735 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1736 q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1737 q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1738 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1739 ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1740 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1741 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1742 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1743 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1744 memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1745 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1746 q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1747 q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1748 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1749 ac_val2[k + 8] = (ac_val2[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1750 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1751 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1752 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1753 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1754 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1755 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1756 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1757 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1758 block[k << 3] = ac_val2[k] * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1759 if(!v->pquantizer && block[k << 3]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1760 block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1761 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1762 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1763 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1764 block[k] = ac_val2[k + 8] * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1765 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1766 block[k] += (block[k] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1767 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1768 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1769 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1770 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1771 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1772 s->block_last_index[n] = i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1773 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1774 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1775 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1776 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1777 /** Decode intra block in inter frames - more generic version than vc1_decode_i_block |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1778 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1779 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1780 * @param[in] n subblock index |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1781 * @param coded are AC coeffs present or not |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1782 * @param mquant block quantizer |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1783 * @param codingset set of VLC to decode data |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1784 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1785 static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int coded, int mquant, int codingset) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1786 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1787 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1788 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1789 int dc_pred_dir = 0; /* Direction of the DC prediction used */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1790 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1791 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1792 int16_t *ac_val, *ac_val2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1793 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1794 int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1795 int a_avail = v->a_avail, c_avail = v->c_avail; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1796 int use_pred = s->ac_pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1797 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1798 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1799 |
9860
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1800 s->dsp.clear_block(block); |
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1801 |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1802 /* XXX: Guard against dumb values of mquant */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1803 mquant = (mquant < 1) ? 0 : ( (mquant>31) ? 31 : mquant ); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1804 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1805 /* Set DC scale - y and c use the same */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1806 s->y_dc_scale = s->y_dc_scale_table[mquant]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1807 s->c_dc_scale = s->c_dc_scale_table[mquant]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1808 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1809 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1810 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1811 dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1812 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1813 dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1814 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1815 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1816 av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1817 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1818 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1819 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1820 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1821 if (dcdiff == 119 /* ESC index value */) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1822 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1823 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1824 if (mquant == 1) dcdiff = get_bits(gb, 10); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1825 else if (mquant == 2) dcdiff = get_bits(gb, 9); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1826 else dcdiff = get_bits(gb, 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1827 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1828 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1829 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1830 if (mquant == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1831 dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1832 else if (mquant == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1833 dcdiff = (dcdiff<<1) + get_bits1(gb) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1834 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1835 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1836 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1837 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1838 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1839 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1840 dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, a_avail, c_avail, &dc_val, &dc_pred_dir); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1841 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1842 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1843 /* Store the quantized DC coeff, used for prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1844 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1845 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1846 block[0] = dcdiff * s->y_dc_scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1847 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1848 block[0] = dcdiff * s->c_dc_scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1849 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1850 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1851 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1852 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1853 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1854 /* check if AC is needed at all and adjust direction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1855 if(!a_avail) dc_pred_dir = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1856 if(!c_avail) dc_pred_dir = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1857 if(!a_avail && !c_avail) use_pred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1858 ac_val = s->ac_val[0][0] + s->block_index[n] * 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1859 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1860 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1861 scale = mquant * 2 + v->halfpq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1862 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1863 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1864 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1865 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1866 ac_val -= 16 * s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1867 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1868 q1 = s->current_picture.qscale_table[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1869 if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1870 if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1871 if(dc_pred_dir && n==1) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1872 if(!dc_pred_dir && n==2) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1873 if(n==3) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1874 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1875 if(coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1876 int last = 0, skip, value; |
11982
669bf7f6c986
Change type of zz_table to uint8_t to match the scantables it points to.
reimar
parents:
11796
diff
changeset
|
1877 const uint8_t *zz_table; |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1878 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1879 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1880 zz_table = wmv1_scantable[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1881 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1882 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1883 vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1884 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1885 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1886 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1887 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1888 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1889 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1890 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1891 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1892 /* scale predictors if needed*/ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1893 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1894 q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1895 q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1896 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1897 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1898 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1899 block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1900 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1901 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1902 block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1903 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1904 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1905 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1906 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1907 block[k << 3] += ac_val[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1908 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1909 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1910 block[k] += ac_val[k + 8]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1911 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1912 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1913 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1914 /* save AC coeffs for further prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1915 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1916 ac_val2[k] = block[k << 3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1917 ac_val2[k + 8] = block[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1918 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1919 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1920 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1921 for(k = 1; k < 64; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1922 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1923 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1924 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1925 block[k] += (block[k] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1926 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1927 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1928 if(use_pred) i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1929 } else { // no AC coeffs |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1930 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1931 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1932 memset(ac_val2, 0, 16 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1933 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1934 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1935 memcpy(ac_val2, ac_val, 8 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1936 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1937 q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1938 q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1939 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1940 ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1941 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1942 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1943 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1944 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1945 memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1946 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1947 q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1948 q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1949 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1950 ac_val2[k + 8] = (ac_val2[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1951 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1952 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1953 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1954 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1955 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1956 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1957 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1958 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1959 block[k << 3] = ac_val2[k] * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1960 if(!v->pquantizer && block[k << 3]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1961 block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1962 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1963 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1964 for(k = 1; k < 8; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1965 block[k] = ac_val2[k + 8] * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1966 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1967 block[k] += (block[k] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1968 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1969 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1970 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1971 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1972 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1973 s->block_last_index[n] = i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1974 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1975 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1976 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1977 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1978 /** Decode P block |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1979 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1980 static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquant, int ttmb, int first_block, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1981 uint8_t *dst, int linesize, int skip_block, int apply_filter, int cbp_top, int cbp_left) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1982 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1983 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1984 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1985 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1986 int subblkpat = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1987 int scale, off, idx, last, skip, value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1988 int ttblk = ttmb & 7; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1989 int pat = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1990 |
9860
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1991 s->dsp.clear_block(block); |
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1992 |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1993 if(ttmb == -1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1994 ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1995 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1996 if(ttblk == TT_4X4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1997 subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1998 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1999 if((ttblk != TT_8X8 && ttblk != TT_4X4) && (v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block))) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2000 subblkpat = decode012(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2001 if(subblkpat) subblkpat ^= 3; //swap decoded pattern bits |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2002 if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) ttblk = TT_8X4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2003 if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) ttblk = TT_4X8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2004 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2005 scale = 2 * mquant + ((v->pq == mquant) ? v->halfpq : 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2006 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2007 // convert transforms like 8X4_TOP to generic TT and SUBBLKPAT |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2008 if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2009 subblkpat = 2 - (ttblk == TT_8X4_TOP); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2010 ttblk = TT_8X4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2011 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2012 if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2013 subblkpat = 2 - (ttblk == TT_4X8_LEFT); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2014 ttblk = TT_4X8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2015 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2016 switch(ttblk) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2017 case TT_8X8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2018 pat = 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2019 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2020 last = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2021 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2022 vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2023 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2024 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2025 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2026 idx = wmv1_scantable[0][i++]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2027 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2028 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2029 block[idx] += (block[idx] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2030 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2031 if(!skip_block){ |
9859
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2032 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2033 s->dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2034 else{ |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2035 s->dsp.vc1_inv_trans_8x8(block); |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2036 s->dsp.add_pixels_clamped(block, dst, linesize); |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2037 } |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2038 if(apply_filter && cbp_top & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2039 s->dsp.vc1_v_loop_filter8(dst, linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2040 if(apply_filter && cbp_left & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2041 s->dsp.vc1_h_loop_filter8(dst, linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2042 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2043 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2044 case TT_4X4: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2045 pat = ~subblkpat & 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2046 for(j = 0; j < 4; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2047 last = subblkpat & (1 << (3 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2048 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2049 off = (j & 1) * 4 + (j & 2) * 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2050 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2051 vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2052 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2053 if(i > 15) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2054 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2055 idx = ff_vc1_simple_progressive_4x4_zz[i++]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2056 block[idx + off] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2057 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2058 block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2059 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2060 if(!(subblkpat & (1 << (3 - j))) && !skip_block){ |
9859
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2061 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2062 s->dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2063 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2064 s->dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2065 if(apply_filter && (j&2 ? pat & (1<<(j-2)) : (cbp_top & (1 << (j + 2))))) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2066 s->dsp.vc1_v_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2067 if(apply_filter && (j&1 ? pat & (1<<(j-1)) : (cbp_left & (1 << (j + 1))))) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2068 s->dsp.vc1_h_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2069 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2070 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2071 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2072 case TT_8X4: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2073 pat = ~((subblkpat & 2)*6 + (subblkpat & 1)*3) & 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2074 for(j = 0; j < 2; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2075 last = subblkpat & (1 << (1 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2076 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2077 off = j * 32; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2078 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2079 vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2080 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2081 if(i > 31) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2082 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2083 idx = v->zz_8x4[i++]+off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2084 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2085 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2086 block[idx] += (block[idx] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2087 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2088 if(!(subblkpat & (1 << (1 - j))) && !skip_block){ |
9859
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2089 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2090 s->dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off); |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2091 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2092 s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2093 if(apply_filter && j ? pat & 0x3 : (cbp_top & 0xC)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2094 s->dsp.vc1_v_loop_filter8(dst + j*4*linesize, linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2095 if(apply_filter && cbp_left & (2 << j)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2096 s->dsp.vc1_h_loop_filter4(dst + j*4*linesize, linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2097 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2098 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2099 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2100 case TT_4X8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2101 pat = ~(subblkpat*5) & 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2102 for(j = 0; j < 2; j++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2103 last = subblkpat & (1 << (1 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2104 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2105 off = j * 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2106 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2107 vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2108 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2109 if(i > 31) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2110 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2111 idx = v->zz_4x8[i++]+off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2112 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2113 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2114 block[idx] += (block[idx] < 0) ? -mquant : mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2115 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2116 if(!(subblkpat & (1 << (1 - j))) && !skip_block){ |
9859
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2117 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2118 s->dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off); |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2119 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2120 s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2121 if(apply_filter && cbp_top & (2 << j)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2122 s->dsp.vc1_v_loop_filter4(dst + j*4, linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2123 if(apply_filter && j ? pat & 0x5 : (cbp_left & 0xA)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2124 s->dsp.vc1_h_loop_filter8(dst + j*4, linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2125 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2126 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2127 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2128 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2129 return pat; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2130 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2131 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2132 /** @} */ // Macroblock group |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2133 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2134 static const int size_table [6] = { 0, 2, 3, 4, 5, 8 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2135 static const int offset_table[6] = { 0, 1, 3, 7, 15, 31 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2136 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2137 /** Decode one P-frame MB (in Simple/Main profile) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2138 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2139 static int vc1_decode_p_mb(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2140 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2141 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2142 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2143 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2144 int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2145 int cbp; /* cbp decoding stuff */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2146 int mqdiff, mquant; /* MB quantization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2147 int ttmb = v->ttfrm; /* MB Transform type */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2148 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2149 int mb_has_coeffs = 1; /* last_flag */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2150 int dmv_x, dmv_y; /* Differential MV components */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2151 int index, index1; /* LUT indexes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2152 int val, sign; /* temp values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2153 int first_block = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2154 int dst_idx, off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2155 int skipped, fourmv; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2156 int block_cbp = 0, pat; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2157 int apply_loop_filter; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2158 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2159 mquant = v->pq; /* Loosy initialization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2160 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2161 if (v->mv_type_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2162 fourmv = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2163 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2164 fourmv = v->mv_type_mb_plane[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2165 if (v->skip_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2166 skipped = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2167 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2168 skipped = v->s.mbskip_table[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2169 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2170 apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2171 if (!fourmv) /* 1MV mode */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2172 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2173 if (!skipped) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2174 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2175 GET_MVDATA(dmv_x, dmv_y); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2176 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2177 if (s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2178 s->current_picture.motion_val[1][s->block_index[0]][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2179 s->current_picture.motion_val[1][s->block_index[0]][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2180 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2181 s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2182 vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2183 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2184 /* FIXME Set DC val for inter block ? */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2185 if (s->mb_intra && !mb_has_coeffs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2186 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2187 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2188 s->ac_pred = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2189 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2190 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2191 else if (mb_has_coeffs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2192 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2193 if (s->mb_intra) s->ac_pred = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2194 cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2195 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2196 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2197 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2198 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2199 mquant = v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2200 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2201 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2202 s->current_picture.qscale_table[mb_pos] = mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2203 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2204 if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2205 ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2206 VC1_TTMB_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2207 if(!s->mb_intra) vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2208 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2209 for (i=0; i<6; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2210 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2211 s->dc_val[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2212 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2213 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2214 off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2215 v->mb_type[0][s->block_index[i]] = s->mb_intra; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2216 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2217 /* check if prediction blocks A and C are available */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2218 v->a_avail = v->c_avail = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2219 if(i == 2 || i == 3 || !s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2220 v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2221 if(i == 1 || i == 3 || s->mb_x) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2222 v->c_avail = v->mb_type[0][s->block_index[i] - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2223 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2224 vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2225 if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2226 s->dsp.vc1_inv_trans_8x8(s->block[i]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2227 if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; |
11796
f917cd286e41
321l: do not use shifted s->linesize instead of correct s->uvlinesize.
kostya
parents:
11644
diff
changeset
|
2228 s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2229 if(v->pq >= 9 && v->overlap) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2230 if(v->c_avail) |
11796
f917cd286e41
321l: do not use shifted s->linesize instead of correct s->uvlinesize.
kostya
parents:
11644
diff
changeset
|
2231 s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2232 if(v->a_avail) |
11796
f917cd286e41
321l: do not use shifted s->linesize instead of correct s->uvlinesize.
kostya
parents:
11644
diff
changeset
|
2233 s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2234 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2235 if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2236 int left_cbp, top_cbp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2237 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2238 left_cbp = v->cbp[s->mb_x - 1] >> (i * 4); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2239 top_cbp = v->cbp[s->mb_x - s->mb_stride] >> (i * 4); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2240 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2241 left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1] >> ((i+1)*4)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2242 top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2243 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2244 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2245 s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2246 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2247 s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2248 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2249 block_cbp |= 0xF << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2250 } else if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2251 int left_cbp = 0, top_cbp = 0, filter = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2252 if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2253 filter = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2254 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2255 left_cbp = v->cbp[s->mb_x - 1] >> (i * 4); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2256 top_cbp = v->cbp[s->mb_x - s->mb_stride] >> (i * 4); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2257 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2258 left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1] >> ((i+1)*4)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2259 top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2260 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2261 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2262 s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2263 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2264 s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2265 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2266 pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2267 block_cbp |= pat << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2268 if(!v->ttmbf && ttmb < 8) ttmb = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2269 first_block = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2270 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2271 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2272 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2273 else //Skipped |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2274 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2275 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2276 for(i = 0; i < 6; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2277 v->mb_type[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2278 s->dc_val[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2279 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2280 s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2281 s->current_picture.qscale_table[mb_pos] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2282 vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2283 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2284 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2285 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2286 } //1MV mode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2287 else //4MV mode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2288 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2289 if (!skipped /* unskipped MB */) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2290 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2291 int intra_count = 0, coded_inter = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2292 int is_intra[6], is_coded[6]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2293 /* Get CBPCY */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2294 cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2295 for (i=0; i<6; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2296 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2297 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2298 s->dc_val[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2299 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2300 if(i < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2301 dmv_x = dmv_y = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2302 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2303 mb_has_coeffs = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2304 if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2305 GET_MVDATA(dmv_x, dmv_y); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2306 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2307 vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2308 if(!s->mb_intra) vc1_mc_4mv_luma(v, i); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2309 intra_count += s->mb_intra; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2310 is_intra[i] = s->mb_intra; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2311 is_coded[i] = mb_has_coeffs; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2312 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2313 if(i&4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2314 is_intra[i] = (intra_count >= 3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2315 is_coded[i] = val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2316 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2317 if(i == 4) vc1_mc_4mv_chroma(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2318 v->mb_type[0][s->block_index[i]] = is_intra[i]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2319 if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2320 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2321 // if there are no coded blocks then don't do anything more |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2322 if(!intra_count && !coded_inter) return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2323 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2324 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2325 s->current_picture.qscale_table[mb_pos] = mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2326 /* test if block is intra and has pred */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2327 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2328 int intrapred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2329 for(i=0; i<6; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2330 if(is_intra[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2331 if(((!s->first_slice_line || (i==2 || i==3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2332 || ((s->mb_x || (i==1 || i==3)) && v->mb_type[0][s->block_index[i] - 1])) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2333 intrapred = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2334 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2335 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2336 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2337 if(intrapred)s->ac_pred = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2338 else s->ac_pred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2339 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2340 if (!v->ttmbf && coded_inter) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2341 ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2342 for (i=0; i<6; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2343 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2344 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2345 off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2346 s->mb_intra = is_intra[i]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2347 if (is_intra[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2348 /* check if prediction blocks A and C are available */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2349 v->a_avail = v->c_avail = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2350 if(i == 2 || i == 3 || !s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2351 v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2352 if(i == 1 || i == 3 || s->mb_x) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2353 v->c_avail = v->mb_type[0][s->block_index[i] - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2354 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2355 vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2356 if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2357 s->dsp.vc1_inv_trans_8x8(s->block[i]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2358 if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2359 s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2360 if(v->pq >= 9 && v->overlap) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2361 if(v->c_avail) |
11796
f917cd286e41
321l: do not use shifted s->linesize instead of correct s->uvlinesize.
kostya
parents:
11644
diff
changeset
|
2362 s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2363 if(v->a_avail) |
11796
f917cd286e41
321l: do not use shifted s->linesize instead of correct s->uvlinesize.
kostya
parents:
11644
diff
changeset
|
2364 s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2365 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2366 if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2367 int left_cbp, top_cbp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2368 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2369 left_cbp = v->cbp[s->mb_x - 1] >> (i * 4); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2370 top_cbp = v->cbp[s->mb_x - s->mb_stride] >> (i * 4); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2371 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2372 left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1] >> ((i+1)*4)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2373 top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2374 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2375 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2376 s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2377 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2378 s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2379 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2380 block_cbp |= 0xF << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2381 } else if(is_coded[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2382 int left_cbp = 0, top_cbp = 0, filter = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2383 if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2384 filter = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2385 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2386 left_cbp = v->cbp[s->mb_x - 1] >> (i * 4); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2387 top_cbp = v->cbp[s->mb_x - s->mb_stride] >> (i * 4); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2388 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2389 left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1] >> ((i+1)*4)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2390 top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2391 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2392 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2393 s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2394 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2395 s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2396 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2397 pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2398 block_cbp |= pat << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2399 if(!v->ttmbf && ttmb < 8) ttmb = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2400 first_block = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2401 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2402 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2403 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2404 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2405 else //Skipped MB |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2406 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2407 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2408 s->current_picture.qscale_table[mb_pos] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2409 for (i=0; i<6; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2410 v->mb_type[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2411 s->dc_val[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2412 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2413 for (i=0; i<4; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2414 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2415 vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2416 vc1_mc_4mv_luma(v, i); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2417 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2418 vc1_mc_4mv_chroma(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2419 s->current_picture.qscale_table[mb_pos] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2420 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2421 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2422 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2423 v->cbp[s->mb_x] = block_cbp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2424 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2425 /* Should never happen */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2426 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2427 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2428 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2429 /** Decode one B-frame MB (in Main profile) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2430 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2431 static void vc1_decode_b_mb(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2432 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2433 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2434 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2435 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2436 int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2437 int cbp = 0; /* cbp decoding stuff */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2438 int mqdiff, mquant; /* MB quantization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2439 int ttmb = v->ttfrm; /* MB Transform type */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2440 int mb_has_coeffs = 0; /* last_flag */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2441 int index, index1; /* LUT indexes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2442 int val, sign; /* temp values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2443 int first_block = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2444 int dst_idx, off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2445 int skipped, direct; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2446 int dmv_x[2], dmv_y[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2447 int bmvtype = BMV_TYPE_BACKWARD; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2448 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2449 mquant = v->pq; /* Loosy initialization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2450 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2451 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2452 if (v->dmb_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2453 direct = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2454 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2455 direct = v->direct_mb_plane[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2456 if (v->skip_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2457 skipped = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2458 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2459 skipped = v->s.mbskip_table[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2460 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2461 dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2462 for(i = 0; i < 6; i++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2463 v->mb_type[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2464 s->dc_val[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2465 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2466 s->current_picture.qscale_table[mb_pos] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2467 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2468 if (!direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2469 if (!skipped) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2470 GET_MVDATA(dmv_x[0], dmv_y[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2471 dmv_x[1] = dmv_x[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2472 dmv_y[1] = dmv_y[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2473 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2474 if(skipped || !s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2475 bmvtype = decode012(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2476 switch(bmvtype) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2477 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2478 bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2479 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2480 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2481 bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2482 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2483 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2484 bmvtype = BMV_TYPE_INTERPOLATED; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2485 dmv_x[0] = dmv_y[0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2486 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2487 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2488 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2489 for(i = 0; i < 6; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2490 v->mb_type[0][s->block_index[i]] = s->mb_intra; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2491 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2492 if (skipped) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2493 if(direct) bmvtype = BMV_TYPE_INTERPOLATED; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2494 vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2495 vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2496 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2497 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2498 if (direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2499 cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2500 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2501 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2502 s->current_picture.qscale_table[mb_pos] = mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2503 if(!v->ttmbf) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2504 ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2505 dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2506 vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2507 vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2508 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2509 if(!mb_has_coeffs && !s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2510 /* no coded blocks - effectively skipped */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2511 vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2512 vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2513 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2514 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2515 if(s->mb_intra && !mb_has_coeffs) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2516 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2517 s->current_picture.qscale_table[mb_pos] = mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2518 s->ac_pred = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2519 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2520 vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2521 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2522 if(bmvtype == BMV_TYPE_INTERPOLATED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2523 GET_MVDATA(dmv_x[0], dmv_y[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2524 if(!mb_has_coeffs) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2525 /* interpolated skipped block */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2526 vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2527 vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2528 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2529 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2530 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2531 vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2532 if(!s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2533 vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2534 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2535 if(s->mb_intra) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2536 s->ac_pred = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2537 cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2538 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2539 s->current_picture.qscale_table[mb_pos] = mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2540 if(!v->ttmbf && !s->mb_intra && mb_has_coeffs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2541 ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2542 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2543 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2544 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2545 for (i=0; i<6; i++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2546 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2547 s->dc_val[0][s->block_index[i]] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2548 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2549 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2550 off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2551 v->mb_type[0][s->block_index[i]] = s->mb_intra; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2552 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2553 /* check if prediction blocks A and C are available */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2554 v->a_avail = v->c_avail = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2555 if(i == 2 || i == 3 || !s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2556 v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2557 if(i == 1 || i == 3 || s->mb_x) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2558 v->c_avail = v->mb_type[0][s->block_index[i] - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2559 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2560 vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2561 if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2562 s->dsp.vc1_inv_trans_8x8(s->block[i]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2563 if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; |
11796
f917cd286e41
321l: do not use shifted s->linesize instead of correct s->uvlinesize.
kostya
parents:
11644
diff
changeset
|
2564 s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2565 } else if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2566 vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), 0, 0, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2567 if(!v->ttmbf && ttmb < 8) ttmb = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2568 first_block = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2569 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2570 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2571 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2572 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2573 /** Decode blocks of I-frame |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2574 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2575 static void vc1_decode_i_blocks(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2576 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2577 int k, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2578 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2579 int cbp, val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2580 uint8_t *coded_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2581 int mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2582 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2583 /* select codingmode used for VLC tables selection */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2584 switch(v->y_ac_table_index){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2585 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2586 v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2587 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2588 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2589 v->codingset = CS_HIGH_MOT_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2590 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2591 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2592 v->codingset = CS_MID_RATE_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2593 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2594 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2595 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2596 switch(v->c_ac_table_index){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2597 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2598 v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2599 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2600 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2601 v->codingset2 = CS_HIGH_MOT_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2602 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2603 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2604 v->codingset2 = CS_MID_RATE_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2605 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2606 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2607 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2608 /* Set DC scale - y and c use the same */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2609 s->y_dc_scale = s->y_dc_scale_table[v->pq]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2610 s->c_dc_scale = s->c_dc_scale_table[v->pq]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2611 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2612 //do frame decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2613 s->mb_x = s->mb_y = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2614 s->mb_intra = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2615 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2616 for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { |
9863
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2617 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2618 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2619 for(; s->mb_x < s->mb_width; s->mb_x++) { |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2620 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2621 s->dsp.clear_blocks(s->block[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2622 mb_pos = s->mb_x + s->mb_y * s->mb_width; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2623 s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2624 s->current_picture.qscale_table[mb_pos] = v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2625 s->current_picture.motion_val[1][s->block_index[0]][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2626 s->current_picture.motion_val[1][s->block_index[0]][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2627 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2628 // do actual MB decoding and displaying |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2629 cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2630 v->s.ac_pred = get_bits1(&v->s.gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2631 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2632 for(k = 0; k < 6; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2633 val = ((cbp >> (5 - k)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2634 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2635 if (k < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2636 int pred = vc1_coded_block_pred(&v->s, k, &coded_val); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2637 val = val ^ pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2638 *coded_val = val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2639 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2640 cbp |= val << (5 - k); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2641 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2642 vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2643 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2644 s->dsp.vc1_inv_trans_8x8(s->block[k]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2645 if(v->pq >= 9 && v->overlap) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2646 for(j = 0; j < 64; j++) s->block[k][j] += 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2647 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2648 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2649 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2650 vc1_put_block(v, s->block); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2651 if(v->pq >= 9 && v->overlap) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2652 if(s->mb_x) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2653 s->dsp.vc1_h_overlap(s->dest[0], s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2654 s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2655 if(!(s->flags & CODEC_FLAG_GRAY)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2656 s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2657 s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2658 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2659 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2660 s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2661 s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2662 if(!s->first_slice_line) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2663 s->dsp.vc1_v_overlap(s->dest[0], s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2664 s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2665 if(!(s->flags & CODEC_FLAG_GRAY)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2666 s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2667 s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2668 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2669 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2670 s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2671 s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2672 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2673 if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2674 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2675 if(get_bits_count(&s->gb) > v->bits) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2676 ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2677 av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2678 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2679 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2680 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2681 ff_draw_horiz_band(s, s->mb_y * 16, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2682 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2683 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2684 ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2685 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2686 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2687 /** Decode blocks of I-frame for advanced profile |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2688 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2689 static void vc1_decode_i_blocks_adv(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2690 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2691 int k, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2692 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2693 int cbp, val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2694 uint8_t *coded_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2695 int mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2696 int mquant = v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2697 int mqdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2698 int overlap; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2699 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2700 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2701 /* select codingmode used for VLC tables selection */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2702 switch(v->y_ac_table_index){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2703 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2704 v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2705 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2706 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2707 v->codingset = CS_HIGH_MOT_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2708 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2709 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2710 v->codingset = CS_MID_RATE_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2711 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2712 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2713 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2714 switch(v->c_ac_table_index){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2715 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2716 v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2717 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2718 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2719 v->codingset2 = CS_HIGH_MOT_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2720 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2721 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2722 v->codingset2 = CS_MID_RATE_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2723 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2724 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2725 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2726 //do frame decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2727 s->mb_x = s->mb_y = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2728 s->mb_intra = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2729 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2730 for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { |
9863
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2731 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2732 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2733 for(;s->mb_x < s->mb_width; s->mb_x++) { |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2734 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2735 s->dsp.clear_blocks(s->block[0]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2736 mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2737 s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2738 s->current_picture.motion_val[1][s->block_index[0]][0] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2739 s->current_picture.motion_val[1][s->block_index[0]][1] = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2740 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2741 // do actual MB decoding and displaying |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2742 cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2743 if(v->acpred_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2744 v->s.ac_pred = get_bits1(&v->s.gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2745 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2746 v->s.ac_pred = v->acpred_plane[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2747 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2748 if(v->condover == CONDOVER_SELECT) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2749 if(v->overflg_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2750 overlap = get_bits1(&v->s.gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2751 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2752 overlap = v->over_flags_plane[mb_pos]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2753 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2754 overlap = (v->condover == CONDOVER_ALL); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2755 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2756 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2757 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2758 s->current_picture.qscale_table[mb_pos] = mquant; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2759 /* Set DC scale - y and c use the same */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2760 s->y_dc_scale = s->y_dc_scale_table[mquant]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2761 s->c_dc_scale = s->c_dc_scale_table[mquant]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2762 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2763 for(k = 0; k < 6; k++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2764 val = ((cbp >> (5 - k)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2765 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2766 if (k < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2767 int pred = vc1_coded_block_pred(&v->s, k, &coded_val); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2768 val = val ^ pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2769 *coded_val = val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2770 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2771 cbp |= val << (5 - k); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2772 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2773 v->a_avail = !s->first_slice_line || (k==2 || k==3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2774 v->c_avail = !!s->mb_x || (k==1 || k==3); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2775 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2776 vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2777 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2778 s->dsp.vc1_inv_trans_8x8(s->block[k]); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2779 for(j = 0; j < 64; j++) s->block[k][j] += 128; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2780 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2781 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2782 vc1_put_block(v, s->block); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2783 if(overlap) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2784 if(s->mb_x) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2785 s->dsp.vc1_h_overlap(s->dest[0], s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2786 s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2787 if(!(s->flags & CODEC_FLAG_GRAY)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2788 s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2789 s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2790 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2791 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2792 s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2793 s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2794 if(!s->first_slice_line) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2795 s->dsp.vc1_v_overlap(s->dest[0], s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2796 s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2797 if(!(s->flags & CODEC_FLAG_GRAY)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2798 s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2799 s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2800 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2801 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2802 s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2803 s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2804 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2805 if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2806 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2807 if(get_bits_count(&s->gb) > v->bits) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2808 ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2809 av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2810 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2811 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2812 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2813 ff_draw_horiz_band(s, s->mb_y * 16, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2814 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2815 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2816 ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2817 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2818 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2819 static void vc1_decode_p_blocks(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2820 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2821 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2822 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2823 /* select codingmode used for VLC tables selection */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2824 switch(v->c_ac_table_index){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2825 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2826 v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2827 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2828 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2829 v->codingset = CS_HIGH_MOT_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2830 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2831 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2832 v->codingset = CS_MID_RATE_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2833 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2834 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2835 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2836 switch(v->c_ac_table_index){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2837 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2838 v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2839 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2840 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2841 v->codingset2 = CS_HIGH_MOT_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2842 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2843 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2844 v->codingset2 = CS_MID_RATE_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2845 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2846 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2847 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2848 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2849 memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2850 for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { |
9863
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2851 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2852 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2853 for(; s->mb_x < s->mb_width; s->mb_x++) { |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2854 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2855 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2856 vc1_decode_p_mb(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2857 if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2858 ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2859 av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2860 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2861 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2862 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2863 memmove(v->cbp_base, v->cbp, sizeof(v->cbp_base[0])*s->mb_stride); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2864 ff_draw_horiz_band(s, s->mb_y * 16, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2865 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2866 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2867 ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2868 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2869 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2870 static void vc1_decode_b_blocks(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2871 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2872 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2873 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2874 /* select codingmode used for VLC tables selection */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2875 switch(v->c_ac_table_index){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2876 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2877 v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2878 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2879 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2880 v->codingset = CS_HIGH_MOT_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2881 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2882 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2883 v->codingset = CS_MID_RATE_INTRA; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2884 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2885 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2886 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2887 switch(v->c_ac_table_index){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2888 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2889 v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2890 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2891 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2892 v->codingset2 = CS_HIGH_MOT_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2893 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2894 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2895 v->codingset2 = CS_MID_RATE_INTER; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2896 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2897 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2898 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2899 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2900 for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { |
9863
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2901 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2902 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2903 for(; s->mb_x < s->mb_width; s->mb_x++) { |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2904 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2905 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2906 vc1_decode_b_mb(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2907 if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2908 ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2909 av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2910 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2911 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2912 if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2913 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2914 ff_draw_horiz_band(s, s->mb_y * 16, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2915 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2916 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2917 ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2918 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2919 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2920 static void vc1_decode_skip_blocks(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2921 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2922 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2923 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2924 ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2925 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2926 for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2927 s->mb_x = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2928 ff_init_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2929 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2930 memcpy(s->dest[0], s->last_picture.data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2931 memcpy(s->dest[1], s->last_picture.data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2932 memcpy(s->dest[2], s->last_picture.data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2933 ff_draw_horiz_band(s, s->mb_y * 16, 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2934 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2935 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2936 s->pict_type = FF_P_TYPE; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2937 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2938 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2939 static void vc1_decode_blocks(VC1Context *v) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2940 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2941 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2942 v->s.esc3_level_length = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2943 if(v->x8_type){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2944 ff_intrax8_decode_picture(&v->x8, 2*v->pq+v->halfpq, v->pq*(!v->pquantizer) ); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2945 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2946 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2947 switch(v->s.pict_type) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2948 case FF_I_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2949 if(v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2950 vc1_decode_i_blocks_adv(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2951 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2952 vc1_decode_i_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2953 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2954 case FF_P_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2955 if(v->p_frame_skipped) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2956 vc1_decode_skip_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2957 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2958 vc1_decode_p_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2959 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2960 case FF_B_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2961 if(v->bi_type){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2962 if(v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2963 vc1_decode_i_blocks_adv(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2964 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2965 vc1_decode_i_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2966 }else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2967 vc1_decode_b_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2968 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2969 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2970 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2971 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2972 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2973 /** Initialize a VC1/WMV3 decoder |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2974 * @todo TODO: Handle VC-1 IDUs (Transport level?) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2975 * @todo TODO: Decypher remaining bits in extra_data |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2976 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2977 static av_cold int vc1_decode_init(AVCodecContext *avctx) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2978 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2979 VC1Context *v = avctx->priv_data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2980 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2981 GetBitContext gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2982 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2983 if (!avctx->extradata_size || !avctx->extradata) return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2984 if (!(avctx->flags & CODEC_FLAG_GRAY)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2985 avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2986 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2987 avctx->pix_fmt = PIX_FMT_GRAY8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2988 avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2989 v->s.avctx = avctx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2990 avctx->flags |= CODEC_FLAG_EMU_EDGE; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2991 v->s.flags |= CODEC_FLAG_EMU_EDGE; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2992 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2993 if(avctx->idct_algo==FF_IDCT_AUTO){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2994 avctx->idct_algo=FF_IDCT_WMV2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2995 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2996 |
11270
f64dd8297105
ff_msmpeg4_decode_init() calls ff_h263_decode_init() which calls
kostya
parents:
11230
diff
changeset
|
2997 if(ff_msmpeg4_decode_init(avctx) < 0) |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2998 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2999 if (vc1_init_common(v) < 0) return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3000 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3001 avctx->coded_width = avctx->width; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3002 avctx->coded_height = avctx->height; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3003 if (avctx->codec_id == CODEC_ID_WMV3) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3004 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3005 int count = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3006 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3007 // looks like WMV3 has a sequence header stored in the extradata |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3008 // advanced sequence header may be before the first frame |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3009 // the last byte of the extradata is a version number, 1 for the |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3010 // samples we can decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3011 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3012 init_get_bits(&gb, avctx->extradata, avctx->extradata_size*8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3013 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3014 if (vc1_decode_sequence_header(avctx, v, &gb) < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3015 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3016 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3017 count = avctx->extradata_size*8 - get_bits_count(&gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3018 if (count>0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3019 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3020 av_log(avctx, AV_LOG_INFO, "Extra data: %i bits left, value: %X\n", |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3021 count, get_bits(&gb, count)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3022 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3023 else if (count < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3024 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3025 av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3026 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3027 } else { // VC1/WVC1 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3028 const uint8_t *start = avctx->extradata; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3029 uint8_t *end = avctx->extradata + avctx->extradata_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3030 const uint8_t *next; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3031 int size, buf2_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3032 uint8_t *buf2 = NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3033 int seq_initialized = 0, ep_initialized = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3034 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3035 if(avctx->extradata_size < 16) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3036 av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3037 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3038 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3039 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3040 buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); |
10369
71a38fce15bc
Since some junk may be or may be not present before actual VC-1 extradata,
kostya
parents:
10260
diff
changeset
|
3041 start = find_next_marker(start, end); // in WVC1 extradata first byte is its size, but can be 0 in mkv |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3042 next = start; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3043 for(; next < end; start = next){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3044 next = find_next_marker(start + 4, end); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3045 size = next - start - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3046 if(size <= 0) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3047 buf2_size = vc1_unescape_buffer(start + 4, size, buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3048 init_get_bits(&gb, buf2, buf2_size * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3049 switch(AV_RB32(start)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3050 case VC1_CODE_SEQHDR: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3051 if(vc1_decode_sequence_header(avctx, v, &gb) < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3052 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3053 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3054 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3055 seq_initialized = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3056 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3057 case VC1_CODE_ENTRYPOINT: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3058 if(vc1_decode_entry_point(avctx, v, &gb) < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3059 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3060 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3061 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3062 ep_initialized = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3063 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3064 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3065 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3066 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3067 if(!seq_initialized || !ep_initialized){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3068 av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n"); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3069 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3070 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3071 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3072 avctx->has_b_frames= !!(avctx->max_b_frames); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3073 s->low_delay = !avctx->has_b_frames; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3074 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3075 s->mb_width = (avctx->coded_width+15)>>4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3076 s->mb_height = (avctx->coded_height+15)>>4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3077 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3078 /* Allocate mb bitplanes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3079 v->mv_type_mb_plane = av_malloc(s->mb_stride * s->mb_height); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3080 v->direct_mb_plane = av_malloc(s->mb_stride * s->mb_height); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3081 v->acpred_plane = av_malloc(s->mb_stride * s->mb_height); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3082 v->over_flags_plane = av_malloc(s->mb_stride * s->mb_height); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3083 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3084 v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3085 v->cbp = v->cbp_base + s->mb_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3086 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3087 /* allocate block type info in that way so it could be used with s->block_index[] */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3088 v->mb_type_base = av_malloc(s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3089 v->mb_type[0] = v->mb_type_base + s->b8_stride + 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3090 v->mb_type[1] = v->mb_type_base + s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride + 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3091 v->mb_type[2] = v->mb_type[1] + s->mb_stride * (s->mb_height + 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3092 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3093 /* Init coded blocks info */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3094 if (v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3095 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3096 // if (alloc_bitplane(&v->over_flags_plane, s->mb_width, s->mb_height) < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3097 // return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3098 // if (alloc_bitplane(&v->ac_pred_plane, s->mb_width, s->mb_height) < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3099 // return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3100 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3101 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3102 ff_intrax8_common_init(&v->x8,s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3103 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3104 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3105 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3106 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3107 /** Decode a VC1/WMV3 frame |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3108 * @todo TODO: Handle VC-1 IDUs (Transport level?) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3109 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3110 static int vc1_decode_frame(AVCodecContext *avctx, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3111 void *data, int *data_size, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3112 AVPacket *avpkt) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3113 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3114 const uint8_t *buf = avpkt->data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3115 int buf_size = avpkt->size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3116 VC1Context *v = avctx->priv_data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3117 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3118 AVFrame *pict = data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3119 uint8_t *buf2 = NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3120 const uint8_t *buf_start = buf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3121 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3122 /* no supplementary picture */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3123 if (buf_size == 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3124 /* special case for last picture */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3125 if (s->low_delay==0 && s->next_picture_ptr) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3126 *pict= *(AVFrame*)s->next_picture_ptr; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3127 s->next_picture_ptr= NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3128 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3129 *data_size = sizeof(AVFrame); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3130 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3131 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3132 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3133 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3134 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3135 /* We need to set current_picture_ptr before reading the header, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3136 * otherwise we cannot store anything in there. */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3137 if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3138 int i= ff_find_unused_picture(s, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3139 s->current_picture_ptr= &s->picture[i]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3140 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3141 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3142 if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3143 if (v->profile < PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3144 avctx->pix_fmt = PIX_FMT_VDPAU_WMV3; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3145 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3146 avctx->pix_fmt = PIX_FMT_VDPAU_VC1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3147 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3148 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3149 //for advanced profile we may need to parse and unescape data |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3150 if (avctx->codec_id == CODEC_ID_VC1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3151 int buf_size2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3152 buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3153 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3154 if(IS_MARKER(AV_RB32(buf))){ /* frame starts with marker and needs to be parsed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3155 const uint8_t *start, *end, *next; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3156 int size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3157 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3158 next = buf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3159 for(start = buf, end = buf + buf_size; next < end; start = next){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3160 next = find_next_marker(start + 4, end); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3161 size = next - start - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3162 if(size <= 0) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3163 switch(AV_RB32(start)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3164 case VC1_CODE_FRAME: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3165 if (avctx->hwaccel || |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3166 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3167 buf_start = start; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3168 buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3169 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3170 case VC1_CODE_ENTRYPOINT: /* it should be before frame data */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3171 buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3172 init_get_bits(&s->gb, buf2, buf_size2*8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3173 vc1_decode_entry_point(avctx, v, &s->gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3174 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3175 case VC1_CODE_SLICE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3176 av_log(avctx, AV_LOG_ERROR, "Sliced decoding is not implemented (yet)\n"); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3177 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3178 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3179 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3180 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3181 }else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)){ /* WVC1 interlaced stores both fields divided by marker */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3182 const uint8_t *divider; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3183 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3184 divider = find_next_marker(buf, buf + buf_size); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3185 if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3186 av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3187 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3188 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3189 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3190 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3191 buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3192 // TODO |
10382 | 3193 if(!v->warn_interlaced++) |
3194 av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced WVC1 support is not implemented\n"); | |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3195 av_free(buf2);return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3196 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3197 buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3198 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3199 init_get_bits(&s->gb, buf2, buf_size2*8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3200 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3201 init_get_bits(&s->gb, buf, buf_size*8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3202 // do parse frame header |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3203 if(v->profile < PROFILE_ADVANCED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3204 if(vc1_parse_frame_header(v, &s->gb) == -1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3205 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3206 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3207 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3208 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3209 if(vc1_parse_frame_header_adv(v, &s->gb) == -1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3210 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3211 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3212 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3213 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3214 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3215 if(s->pict_type != FF_I_TYPE && !v->res_rtm_flag){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3216 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3217 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3218 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3219 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3220 // for hurry_up==5 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3221 s->current_picture.pict_type= s->pict_type; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3222 s->current_picture.key_frame= s->pict_type == FF_I_TYPE; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3223 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3224 /* skip B-frames if we don't have reference frames */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3225 if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3226 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3227 return -1;//buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3228 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3229 /* skip b frames if we are in a hurry */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3230 if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3231 if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3232 || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3233 || avctx->skip_frame >= AVDISCARD_ALL) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3234 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3235 return buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3236 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3237 /* skip everything if we are in a hurry>=5 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3238 if(avctx->hurry_up>=5) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3239 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3240 return -1;//buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3241 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3242 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3243 if(s->next_p_frame_damaged){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3244 if(s->pict_type==FF_B_TYPE) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3245 return buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3246 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3247 s->next_p_frame_damaged=0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3248 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3249 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3250 if(MPV_frame_start(s, avctx) < 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3251 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3252 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3253 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3254 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3255 s->me.qpel_put= s->dsp.put_qpel_pixels_tab; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3256 s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3257 |
9994
cd2b3ecdb1c9
Do not check for both CONFIG_VC1_VDPAU_DECODER and CONFIG_WMV3_VDPAU_DECODER,
diego
parents:
9881
diff
changeset
|
3258 if ((CONFIG_VC1_VDPAU_DECODER) |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3259 &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3260 ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3261 else if (avctx->hwaccel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3262 if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3263 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3264 if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3265 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3266 if (avctx->hwaccel->end_frame(avctx) < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3267 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3268 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3269 ff_er_frame_start(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3270 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3271 v->bits = buf_size * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3272 vc1_decode_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3273 //av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), buf_size*8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3274 // if(get_bits_count(&s->gb) > buf_size * 8) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3275 // return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3276 ff_er_frame_end(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3277 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3278 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3279 MPV_frame_end(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3280 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3281 assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3282 assert(s->current_picture.pict_type == s->pict_type); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3283 if (s->pict_type == FF_B_TYPE || s->low_delay) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3284 *pict= *(AVFrame*)s->current_picture_ptr; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3285 } else if (s->last_picture_ptr != NULL) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3286 *pict= *(AVFrame*)s->last_picture_ptr; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3287 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3288 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3289 if(s->last_picture_ptr || s->low_delay){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3290 *data_size = sizeof(AVFrame); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3291 ff_print_debug_info(s, pict); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3292 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3293 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3294 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3295 return buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3296 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3297 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3298 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3299 /** Close a VC1/WMV3 decoder |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3300 * @warning Initial try at using MpegEncContext stuff |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3301 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3302 static av_cold int vc1_decode_end(AVCodecContext *avctx) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3303 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3304 VC1Context *v = avctx->priv_data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3305 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3306 av_freep(&v->hrd_rate); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3307 av_freep(&v->hrd_buffer); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3308 MPV_common_end(&v->s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3309 av_freep(&v->mv_type_mb_plane); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3310 av_freep(&v->direct_mb_plane); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3311 av_freep(&v->acpred_plane); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3312 av_freep(&v->over_flags_plane); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3313 av_freep(&v->mb_type_base); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3314 av_freep(&v->cbp_base); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3315 ff_intrax8_common_end(&v->x8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3316 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3317 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3318 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3319 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3320 AVCodec vc1_decoder = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3321 "vc1", |
11560
8a4984c5cacc
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
11270
diff
changeset
|
3322 AVMEDIA_TYPE_VIDEO, |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3323 CODEC_ID_VC1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3324 sizeof(VC1Context), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3325 vc1_decode_init, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3326 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3327 vc1_decode_end, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3328 vc1_decode_frame, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3329 CODEC_CAP_DR1 | CODEC_CAP_DELAY, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3330 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3331 .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3332 .pix_fmts = ff_hwaccel_pixfmt_list_420 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3333 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3334 |
9996
38a57d201569
Only enable WMV3 decoder when it has been turned on in the build system.
diego
parents:
9994
diff
changeset
|
3335 #if CONFIG_WMV3_DECODER |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3336 AVCodec wmv3_decoder = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3337 "wmv3", |
11560
8a4984c5cacc
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
11270
diff
changeset
|
3338 AVMEDIA_TYPE_VIDEO, |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3339 CODEC_ID_WMV3, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3340 sizeof(VC1Context), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3341 vc1_decode_init, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3342 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3343 vc1_decode_end, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3344 vc1_decode_frame, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3345 CODEC_CAP_DR1 | CODEC_CAP_DELAY, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3346 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3347 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3348 .pix_fmts = ff_hwaccel_pixfmt_list_420 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3349 }; |
9996
38a57d201569
Only enable WMV3 decoder when it has been turned on in the build system.
diego
parents:
9994
diff
changeset
|
3350 #endif |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3351 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3352 #if CONFIG_WMV3_VDPAU_DECODER |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3353 AVCodec wmv3_vdpau_decoder = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3354 "wmv3_vdpau", |
11560
8a4984c5cacc
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
11270
diff
changeset
|
3355 AVMEDIA_TYPE_VIDEO, |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3356 CODEC_ID_WMV3, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3357 sizeof(VC1Context), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3358 vc1_decode_init, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3359 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3360 vc1_decode_end, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3361 vc1_decode_frame, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3362 CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3363 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3364 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"), |
10146
38cfe222e1a4
Mark all pix_fmts and supported_framerates compound literals as const.
reimar
parents:
9996
diff
changeset
|
3365 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE} |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3366 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3367 #endif |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3368 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3369 #if CONFIG_VC1_VDPAU_DECODER |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3370 AVCodec vc1_vdpau_decoder = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3371 "vc1_vdpau", |
11560
8a4984c5cacc
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
11270
diff
changeset
|
3372 AVMEDIA_TYPE_VIDEO, |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3373 CODEC_ID_VC1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3374 sizeof(VC1Context), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3375 vc1_decode_init, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3376 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3377 vc1_decode_end, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3378 vc1_decode_frame, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3379 CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3380 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3381 .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"), |
10146
38cfe222e1a4
Mark all pix_fmts and supported_framerates compound literals as const.
reimar
parents:
9996
diff
changeset
|
3382 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE} |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3383 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3384 #endif |