Mercurial > libavcodec.hg
annotate vc1dec.c @ 11147:9673c7b54598 libavcodec
Skip some more code that isnt needed for direct MBs.
author | michael |
---|---|
date | Sat, 13 Feb 2010 18:23:46 +0000 |
parents | 9ccc13d1144d |
children | 9f25ae41c807 |
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 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
24 * @file libavcodec/vc1dec.c |
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" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
32 #include "vc1.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
33 #include "vc1data.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
34 #include "vc1acdata.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
35 #include "msmpeg4data.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
36 #include "unary.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
37 #include "simple_idct.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
38 #include "mathops.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
39 #include "vdpau_internal.h" |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
40 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
41 #undef NDEBUG |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
42 #include <assert.h> |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
43 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
44 #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
|
45 #define DC_VLC_BITS 9 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
46 #define AC_VLC_BITS 9 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
47 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
|
48 |
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 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
|
51 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
|
52 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
|
53 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
|
54 }; |
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 * 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
|
58 * @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
|
59 * @return Status |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
60 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
61 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
|
62 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
63 static int done = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
64 int i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
65 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
|
66 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
67 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
|
68 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
69 /* VLC tables */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
70 if(!done) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
71 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
102 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
|
103 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
120 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
|
121 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
|
122 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
|
123 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
|
124 &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
|
125 &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
|
126 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
127 done = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
128 } |
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 /* Other defaults */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
131 v->pq = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
132 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
|
133 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
134 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
135 } |
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 * @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
|
140 * @see 8.7, p56 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
141 * @{ |
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 * Imode types |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
146 * @{ |
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 enum Imode { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
149 IMODE_RAW, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
150 IMODE_NORM2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
151 IMODE_DIFF2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
152 IMODE_NORM6, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
153 IMODE_DIFF6, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
154 IMODE_ROWSKIP, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
155 IMODE_COLSKIP |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
156 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
157 /** @} */ //imode defines |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
158 |
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 /** @} */ //Bitplane group |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
161 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
162 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
|
163 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
164 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
165 if(!s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
166 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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 if(!s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
172 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
|
173 if(s->mb_x) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
174 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
|
175 } |
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 /** Put block onto picture |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
179 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
180 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
|
181 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
182 uint8_t *Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
183 int ys, us, vs; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
184 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
185 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
186 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
187 int i, j, k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
188 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
|
189 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
|
190 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
|
191 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
|
192 |
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 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
|
195 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
|
196 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
|
197 Y = v->s.dest[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
198 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
199 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
|
200 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
|
201 Y += ys * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
202 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
|
203 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
|
204 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
205 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
|
206 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
|
207 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
|
208 } |
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 /** 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
|
212 * 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
|
213 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
214 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
|
215 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
216 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
217 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
218 uint8_t *srcY, *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
219 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
|
220 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
221 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
|
222 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
223 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
|
224 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
|
225 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
226 // 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
|
227 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
|
228 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
|
229 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
|
230 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
231 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
|
232 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
|
233 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
234 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
|
235 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
|
236 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
237 if(!dir) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
238 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
|
239 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
|
240 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
|
241 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 } |
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 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
|
248 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
|
249 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
|
250 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
|
251 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
252 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
253 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
|
254 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
|
255 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
|
256 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
|
257 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
258 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
|
259 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
|
260 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
|
261 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
|
262 } |
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 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
|
265 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
|
266 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
|
267 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
268 /* 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
|
269 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
|
270 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
|
271 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
|
272 } |
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 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
|
275 || (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
|
276 || (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
|
277 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
|
278 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
283 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
|
284 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
|
285 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
|
286 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
|
287 srcU = uvbuf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
288 srcV = uvbuf + 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
289 /* 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
|
290 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
291 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
292 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
293 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
294 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
295 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
|
296 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
|
297 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
298 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
299 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
300 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
|
301 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
|
302 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
|
303 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
|
304 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
305 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
306 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
307 } |
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 /* 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
|
310 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
|
311 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
312 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
313 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
314 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
315 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
|
316 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
|
317 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
318 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
319 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 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
|
324 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
325 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
326 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
327 } |
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 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
|
330 } |
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 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
333 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
|
334 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
|
335 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
|
336 srcY += s->linesize * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
337 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
|
338 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
|
339 } 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
|
340 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
|
341 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
342 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
343 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
|
344 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
345 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
|
346 } |
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 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
|
349 /* 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
|
350 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
351 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
352 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
353 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
|
354 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
|
355 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
356 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
|
357 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
|
358 } |
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 /** 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
|
362 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
363 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
|
364 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
365 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
366 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
367 uint8_t *srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
368 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
|
369 int off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
370 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
371 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
|
372 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
|
373 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
|
374 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
|
375 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
376 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
|
377 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
378 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
|
379 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
|
380 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
381 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
382 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
|
383 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
|
384 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
385 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
|
386 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
|
387 } |
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 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
|
390 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
391 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
|
392 || (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
|
393 || (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
|
394 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
|
395 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
|
396 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
|
397 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
398 /* 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
|
399 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
400 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
401 uint8_t *src; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
402 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
403 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
404 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
|
405 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
|
406 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
407 } |
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 /* 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
|
410 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
|
411 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
412 uint8_t *src; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
413 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
414 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
415 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
|
416 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
|
417 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
418 } |
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 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
|
421 } |
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 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
424 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
|
425 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
|
426 } 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
|
427 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
|
428 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
429 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
|
430 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
431 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
|
432 } |
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 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
|
436 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
437 if(a < b) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
438 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
|
439 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
|
440 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
441 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
|
442 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
|
443 } |
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 /** 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
|
448 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
449 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
|
450 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
451 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
452 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
453 uint8_t *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
454 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
|
455 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
|
456 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
|
457 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
|
458 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
459 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
|
460 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
|
461 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
462 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
|
463 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
|
464 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
|
465 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
|
466 } |
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 /* 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
|
469 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
|
470 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
|
471 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
|
472 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
|
473 } 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
|
474 switch(idx) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
475 case 0x1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
476 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
|
477 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
|
478 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
479 case 0x2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
480 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
|
481 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
|
482 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
483 case 0x4: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
484 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
|
485 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
|
486 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
487 case 0x8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
488 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
|
489 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
|
490 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
491 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
492 } else if(count[idx] == 2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
493 int t1 = 0, t2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
494 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
|
495 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
|
496 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
|
497 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
|
498 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
499 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
|
500 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
|
501 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
|
502 } |
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 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
|
505 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
|
506 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
|
507 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
|
508 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
509 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
|
510 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
|
511 } |
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 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
|
514 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
|
515 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
516 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
517 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
|
518 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
|
519 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
520 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
|
521 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
|
522 } |
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 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
|
525 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
|
526 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
|
527 || (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
|
528 || (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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 srcU = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
534 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
|
535 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
536 /* 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
|
537 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
538 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
539 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
540 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
541 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
542 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
|
543 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
|
544 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
|
545 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
|
546 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
547 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
548 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
549 } |
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 /* 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
|
552 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
|
553 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
554 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
555 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
556 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
557 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
|
558 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
|
559 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
|
560 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
|
561 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
562 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
563 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
564 } |
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 /* 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
|
569 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
570 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
571 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
572 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
|
573 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
|
574 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
575 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
|
576 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
|
577 } |
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 * @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
|
583 * @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
|
584 * @{ |
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 * @def GET_MQUANT |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
589 * @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
|
590 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
591 #define GET_MQUANT() \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
592 if (v->dquantfrm) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
593 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
594 int edges = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
595 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
|
596 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
597 if (v->dqbilevel) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
598 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
599 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
|
600 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
601 else \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
602 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
603 mqdiff = get_bits(gb, 3); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
604 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
|
605 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
|
606 } \ |
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 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
|
609 edges = 1 << v->dqsbedge; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
610 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
|
611 edges = (3 << v->dqsbedge) % 15; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
612 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
|
613 edges = 15; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
614 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
|
615 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
616 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
|
617 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
618 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
|
619 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
620 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
|
621 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
622 } |
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 * @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
|
626 * @brief Get MV differentials |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
627 * @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
|
628 * @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
|
629 * @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
|
630 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
631 #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
|
632 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
|
633 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
|
634 if (index > 36) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
635 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
636 mb_has_coeffs = 1; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
637 index -= 37; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
638 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
639 else mb_has_coeffs = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
640 s->mb_intra = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
641 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
|
642 else if (index == 35) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
643 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
644 _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
|
645 _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
|
646 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
647 else if (index == 36) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
648 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
649 _dmv_x = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
650 _dmv_y = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
651 s->mb_intra = 1; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
652 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
653 else \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
654 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
655 index1 = index%6; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
656 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
|
657 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
658 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
|
659 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
|
660 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
661 sign = 0 - (val&1); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
662 _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
|
663 \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
664 index1 = index/6; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
665 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
|
666 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
667 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
|
668 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
|
669 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
670 sign = 0 - (val&1); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
671 _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
|
672 } |
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 /** Predict and set motion vector |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
675 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
676 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
|
677 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
678 int xy, wrap, off = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
679 int16_t *A, *B, *C; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
680 int px, py; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
681 int sum; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
682 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
683 /* 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
|
684 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
|
685 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
|
686 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
687 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
688 xy = s->block_index[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
689 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
690 if(s->mb_intra){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
691 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
|
692 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
|
693 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
|
694 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
|
695 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
|
696 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
|
697 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 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
|
705 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
|
706 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
|
707 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
|
708 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
709 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
710 } |
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 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
|
713 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
|
714 if(mv1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
715 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
|
716 else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
717 //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
|
718 switch(n){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
719 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
720 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
|
721 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
722 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
723 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
|
724 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
725 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
726 off = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
727 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
728 case 3: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
729 off = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
730 } |
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 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
|
733 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
734 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
|
735 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
736 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
737 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
738 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
739 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
|
740 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
|
741 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
742 } 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
|
743 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
744 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
745 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
746 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
747 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
748 /* 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
|
749 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
750 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
751 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
|
752 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
|
753 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
|
754 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
|
755 if(mv1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
756 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
|
757 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
|
758 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
759 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
|
760 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
|
761 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
762 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
|
763 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
|
764 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
765 /* 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
|
766 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
|
767 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
768 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
769 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
770 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
|
771 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
772 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
773 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
774 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
775 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
776 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
777 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
778 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
779 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
780 if(is_intra[xy - 1]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
781 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
782 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
783 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
|
784 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
785 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
786 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
787 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
788 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
789 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
790 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
791 } |
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 /* 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
|
796 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
|
797 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
|
798 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
|
799 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
|
800 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
|
801 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
|
802 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
|
803 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
|
804 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
|
805 } |
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 /** 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
|
809 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
810 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
|
811 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
812 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
813 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
814 uint8_t *srcY, *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
815 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
|
816 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
817 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
|
818 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
819 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
|
820 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
|
821 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
|
822 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
|
823 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
824 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
|
825 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
|
826 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
827 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
|
828 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
|
829 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
|
830 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
831 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
|
832 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
|
833 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
|
834 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
|
835 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
836 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
837 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
|
838 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
|
839 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
|
840 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
|
841 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
842 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
|
843 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
|
844 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
|
845 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
|
846 } |
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 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
|
849 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
|
850 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
|
851 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
852 /* 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
|
853 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
|
854 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
|
855 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
|
856 } |
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 if(v->rangeredfrm |
9881
c69559e9f6c3
Edge emulation should be used in B-frame MC in mspel mode with
kostya
parents:
9863
diff
changeset
|
859 || (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
|
860 || (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
|
861 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
|
862 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
863 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
|
864 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
|
865 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
|
866 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
867 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
|
868 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
|
869 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
|
870 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
|
871 srcU = uvbuf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
872 srcV = uvbuf + 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
873 /* 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
|
874 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
875 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
876 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
877 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
878 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
879 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
|
880 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
|
881 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
882 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
883 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
884 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
|
885 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
|
886 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
|
887 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
|
888 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
889 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
890 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
891 } |
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 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
|
894 } |
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 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
897 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
|
898 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
|
899 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
|
900 srcY += s->linesize * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
901 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
|
902 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
|
903 } else { // hpel mc |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
904 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
|
905 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
906 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
907 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
|
908 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
909 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
|
910 } |
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 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
|
913 /* 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
|
914 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
915 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
916 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
917 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
|
918 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
|
919 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
920 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
|
921 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
|
922 } |
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 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
|
926 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
927 int n = bfrac; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
928 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
929 #if B_FRACTION_DEN==256 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
930 if(inv) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
931 n -= 256; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
932 if(!qs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
933 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
|
934 return (value * n + 128) >> 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
935 #else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
936 if(inv) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
937 n -= B_FRACTION_DEN; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
938 if(!qs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
939 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
|
940 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
|
941 #endif |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
942 } |
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 /** 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
|
945 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
946 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
|
947 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
948 if(v->use_ic) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
949 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
|
950 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
|
951 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
952 if(direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
953 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
954 vc1_interp_mc(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
955 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
|
956 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
957 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
958 if(mode == BMV_TYPE_INTERPOLATED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
959 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
960 vc1_interp_mc(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
961 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
|
962 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
963 } |
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 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
|
966 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
|
967 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
|
968 } |
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 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
|
971 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
972 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
973 int xy, wrap, off = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
974 int16_t *A, *B, *C; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
975 int px, py; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
976 int sum; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
977 int r_x, r_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
978 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
|
979 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
980 r_x = v->range_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
981 r_y = v->range_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
982 /* 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
|
983 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
|
984 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
|
985 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
|
986 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
|
987 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
988 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
989 xy = s->block_index[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
990 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
991 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
992 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
|
993 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
|
994 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
|
995 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
|
996 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
997 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
998 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
|
999 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
|
1000 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
|
1001 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
|
1002 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1003 /* 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
|
1004 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
|
1005 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
|
1006 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
|
1007 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
|
1008 if(direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1009 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
|
1010 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
|
1011 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
|
1012 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
|
1013 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1014 } |
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 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
|
1017 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
|
1018 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
|
1019 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
|
1020 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
|
1021 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1022 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
|
1023 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
|
1024 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1025 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1026 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1027 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1028 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
|
1029 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
|
1030 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1031 } 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
|
1032 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1033 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1034 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1035 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1036 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1037 /* 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
|
1038 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1039 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1040 if(v->profile < PROFILE_ADVANCED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1041 qx = (s->mb_x << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1042 qy = (s->mb_y << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1043 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
|
1044 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
|
1045 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
|
1046 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
|
1047 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
|
1048 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
|
1049 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1050 qx = (s->mb_x << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1051 qy = (s->mb_y << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1052 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
|
1053 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
|
1054 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
|
1055 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
|
1056 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
|
1057 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
|
1058 } |
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 /* 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
|
1061 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
|
1062 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1063 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1064 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1065 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
|
1066 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1067 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1068 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1069 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1070 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1071 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1072 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1073 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1074 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1075 if(is_intra[xy - 2]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1076 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1077 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1078 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
|
1079 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1080 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1081 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1082 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1083 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1084 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1085 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1086 } |
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 /* 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
|
1091 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
|
1092 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
|
1093 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1094 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
|
1095 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
|
1096 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
|
1097 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
|
1098 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
|
1099 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1100 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
|
1101 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
|
1102 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1103 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1104 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1105 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1106 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
|
1107 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
|
1108 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1109 } 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
|
1110 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1111 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1112 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1113 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1114 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1115 /* 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
|
1116 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1117 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1118 if(v->profile < PROFILE_ADVANCED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1119 qx = (s->mb_x << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1120 qy = (s->mb_y << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1121 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
|
1122 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
|
1123 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
|
1124 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
|
1125 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
|
1126 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
|
1127 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1128 qx = (s->mb_x << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1129 qy = (s->mb_y << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1130 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
|
1131 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
|
1132 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
|
1133 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
|
1134 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
|
1135 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
|
1136 } |
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 /* 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
|
1139 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
|
1140 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1141 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1142 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1143 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
|
1144 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1145 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1146 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1147 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1148 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1149 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1150 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1151 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1152 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1153 if(is_intra[xy - 2]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1154 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1155 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1156 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
|
1157 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1158 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1159 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1160 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1161 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1162 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1163 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1164 } |
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 /* 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
|
1169 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1170 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
|
1171 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
|
1172 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1173 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
|
1174 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
|
1175 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
|
1176 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
|
1177 } |
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 /** 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
|
1180 * 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
|
1181 * @param s MpegEncContext |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1182 * @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
|
1183 * @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
|
1184 * @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
|
1185 * @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
|
1186 * @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
|
1187 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1188 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
|
1189 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
|
1190 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1191 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
|
1192 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1193 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
|
1194 -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
|
1195 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
|
1196 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
|
1197 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
|
1198 }; |
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 /* 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
|
1201 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
|
1202 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
|
1203 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1204 wrap = s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1205 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
|
1206 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1207 /* B A |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1208 * C X |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1209 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1210 c = dc_val[ - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1211 b = dc_val[ - 1 - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1212 a = dc_val[ - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1213 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1214 if (pq < 9 || !overlap) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1215 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1216 /* Set outer values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1217 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
|
1218 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
|
1219 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1220 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1221 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1222 /* Set outer values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1223 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
|
1224 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
|
1225 } |
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 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
|
1228 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1229 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1230 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1231 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1232 *dir_ptr = 0;//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1233 } |
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 /* update predictor */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1236 *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
|
1237 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1238 } |
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 /** Get predicted DC value |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1242 * 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
|
1243 * @param s MpegEncContext |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1244 * @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
|
1245 * @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
|
1246 * @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
|
1247 * @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
|
1248 * @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
|
1249 * @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
|
1250 * @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
|
1251 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1252 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
|
1253 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
|
1254 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
|
1255 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1256 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
|
1257 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1258 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
|
1259 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1260 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1261 wrap = s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1262 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
|
1263 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1264 /* B A |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1265 * C X |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1266 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1267 c = dc_val[ - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1268 b = dc_val[ - 1 - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1269 a = dc_val[ - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1270 /* scale predictors if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1271 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
|
1272 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
|
1273 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
|
1274 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1275 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
|
1276 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1277 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
|
1278 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
|
1279 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1280 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
|
1281 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1282 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
|
1283 int off = mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1284 if(n != 1) off--; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1285 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
|
1286 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
|
1287 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1288 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
|
1289 } |
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 if(a_avail && c_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1292 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
|
1293 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1294 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1295 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1296 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1297 *dir_ptr = 0;//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1298 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1299 } else if(a_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1300 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1301 *dir_ptr = 0;//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1302 } else if(c_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1303 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1304 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1305 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1306 pred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1307 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1308 } |
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 /* update predictor */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1311 *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
|
1312 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1313 } |
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 /** @} */ // Block group |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1316 |
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 * @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
|
1319 * @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
|
1320 * @{ |
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 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
|
1324 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1325 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
|
1326 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1327 xy = s->block_index[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1328 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1329 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1330 /* B C |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1331 * A X |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1332 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1333 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
|
1334 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
|
1335 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
|
1336 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1337 if (b == c) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1338 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1339 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1340 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1341 } |
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 /* store value */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1344 *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
|
1345 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1346 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1347 } |
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 * Decode one AC coefficient |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1351 * @param v The VC1 context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1352 * @param last Last coefficient |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1353 * @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
|
1354 * @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
|
1355 * @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
|
1356 * @see 8.1.3.4 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1357 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1358 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
|
1359 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1360 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1361 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
|
1362 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1363 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
|
1364 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
|
1365 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
|
1366 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
|
1367 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
|
1368 if(get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1369 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1370 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1371 escape = decode210(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1372 if (escape != 2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1373 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
|
1374 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
|
1375 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
|
1376 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
|
1377 if(escape == 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1378 if(lst) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1379 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
|
1380 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1381 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
|
1382 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1383 if(lst) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1384 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
|
1385 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1386 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
|
1387 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1388 if(get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1389 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1390 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1391 int sign; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1392 lst = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1393 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
|
1394 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
|
1395 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
|
1396 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
|
1397 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
|
1398 } else { //table 60 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1399 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
|
1400 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1401 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
|
1402 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1403 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
|
1404 sign = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1405 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
|
1406 if(sign) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1407 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1408 } |
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 *last = lst; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1412 *skip = run; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1413 *value = level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1414 } |
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 /** 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
|
1417 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1418 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1419 * @param[in] n subblock index |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1420 * @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
|
1421 * @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
|
1422 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1423 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
|
1424 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1425 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1426 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1427 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
|
1428 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1429 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1430 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
|
1431 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1432 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1433 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1434 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1435 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
|
1436 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1437 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
|
1438 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1439 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1440 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
|
1441 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1442 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1443 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1444 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1445 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
|
1446 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1447 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1448 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
|
1449 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
|
1450 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
|
1451 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1452 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1453 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1454 if (v->pq == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1455 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
|
1456 else if (v->pq == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1457 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
|
1458 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1459 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1460 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1461 } |
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 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1464 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
|
1465 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1466 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1467 /* 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
|
1468 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1469 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
|
1470 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1471 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
|
1472 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1473 /* Skip ? */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1474 if (!coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1475 goto not_coded; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1476 } |
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 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1479 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1480 |
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 int last = 0, skip, value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1483 const int8_t *zz_table; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1484 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1485 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1486 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1487 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
|
1488 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1489 if(v->s.ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1490 if(!dc_pred_dir) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1491 zz_table = wmv1_scantable[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1492 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1493 zz_table = wmv1_scantable[3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1494 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1495 zz_table = wmv1_scantable[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1496 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1497 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
|
1498 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1499 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1500 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1501 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1502 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
|
1503 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1504 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1505 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
|
1506 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1507 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1508 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1509 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1510 } |
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 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1513 if(s->ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1514 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1515 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
|
1516 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
|
1517 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1518 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
|
1519 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
|
1520 } |
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 /* 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
|
1523 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
|
1524 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
|
1525 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
|
1526 } |
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 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1529 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
|
1530 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1531 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1532 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1533 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
|
1534 } |
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 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
|
1537 } |
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 not_coded: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1540 if(!coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1541 int k, scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1542 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
|
1543 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1544 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1545 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1546 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
|
1547 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
|
1548 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1549 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1550 if(s->ac_pred) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1551 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
|
1552 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1553 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
|
1554 if(s->ac_pred) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1555 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
|
1556 } |
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 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1559 if(s->ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1560 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1561 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
|
1562 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
|
1563 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
|
1564 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
|
1565 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1566 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1567 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
|
1568 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
|
1569 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1570 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
|
1571 } |
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 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1574 } |
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 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
|
1577 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1578 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1579 } |
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 /** 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
|
1582 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1583 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1584 * @param[in] n subblock number |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1585 * @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
|
1586 * @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
|
1587 * @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
|
1588 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1589 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
|
1590 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1591 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1592 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1593 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
|
1594 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1595 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1596 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
|
1597 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1598 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
|
1599 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
|
1600 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1601 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1602 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
|
1603 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1604 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1605 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1606 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
|
1607 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1608 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
|
1609 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1610 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1611 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
|
1612 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1613 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1614 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1615 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1616 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
|
1617 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1618 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1619 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
|
1620 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
|
1621 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
|
1622 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1623 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1624 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1625 if (mquant == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1626 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
|
1627 else if (mquant == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1628 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
|
1629 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1630 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1631 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1632 } |
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 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1635 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
|
1636 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1637 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1638 /* 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
|
1639 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1640 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
|
1641 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1642 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
|
1643 } |
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 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1646 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1647 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1648 /* 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
|
1649 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
|
1650 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
|
1651 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1652 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1653 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
|
1654 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1655 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1656 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1657 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1658 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
|
1659 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1660 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
|
1661 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
|
1662 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
|
1663 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
|
1664 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
|
1665 if(n==3) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1666 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1667 if(coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1668 int last = 0, skip, value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1669 const int8_t *zz_table; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1670 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1671 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1672 if(v->s.ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1673 if(!dc_pred_dir) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1674 zz_table = wmv1_scantable[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1675 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1676 zz_table = wmv1_scantable[3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1677 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1678 zz_table = wmv1_scantable[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1679 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1680 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1681 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
|
1682 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1683 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1684 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1685 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1686 } |
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 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1689 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1690 /* scale predictors if needed*/ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1691 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1692 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
|
1693 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
|
1694 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1695 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1696 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
|
1697 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
|
1698 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1699 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
|
1700 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
|
1701 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1702 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1703 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1704 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
|
1705 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
|
1706 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1707 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
|
1708 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
|
1709 } |
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 /* 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
|
1713 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
|
1714 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
|
1715 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
|
1716 } |
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 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1719 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
|
1720 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1721 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1722 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1723 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
|
1724 } |
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 if(use_pred) i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1727 } else { // no AC coeffs |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1728 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1729 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1730 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
|
1731 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1732 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1733 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
|
1734 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1735 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
|
1736 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
|
1737 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
|
1738 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
|
1739 } |
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 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1742 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1743 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
|
1744 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1745 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
|
1746 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
|
1747 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
|
1748 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
|
1749 } |
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 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1754 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1755 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1756 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
|
1757 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
|
1758 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
|
1759 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
|
1760 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1761 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1762 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
|
1763 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
|
1764 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1765 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
|
1766 } |
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 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1769 } |
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 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
|
1772 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1773 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1774 } |
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 /** 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
|
1777 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1778 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1779 * @param[in] n subblock index |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1780 * @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
|
1781 * @param mquant block quantizer |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1782 * @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
|
1783 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1784 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
|
1785 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1786 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1787 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1788 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
|
1789 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1790 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1791 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
|
1792 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1793 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
|
1794 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
|
1795 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
|
1796 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1797 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1798 |
9860
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1799 s->dsp.clear_block(block); |
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1800 |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1801 /* 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
|
1802 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
|
1803 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1804 /* 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
|
1805 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
|
1806 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
|
1807 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1808 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1809 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1810 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
|
1811 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1812 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
|
1813 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1814 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1815 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
|
1816 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1817 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1818 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1819 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1820 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
|
1821 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1822 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1823 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
|
1824 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
|
1825 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
|
1826 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1827 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1828 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1829 if (mquant == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1830 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
|
1831 else if (mquant == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1832 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
|
1833 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1834 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1835 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1836 } |
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 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1839 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
|
1840 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1841 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1842 /* 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
|
1843 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1844 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1845 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
|
1846 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1847 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
|
1848 } |
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 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1851 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1852 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1853 /* 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
|
1854 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
|
1855 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
|
1856 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
|
1857 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
|
1858 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1859 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1860 scale = mquant * 2 + v->halfpq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1861 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1862 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1863 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1864 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1865 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
|
1866 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1867 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
|
1868 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
|
1869 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
|
1870 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
|
1871 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
|
1872 if(n==3) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1873 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1874 if(coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1875 int last = 0, skip, value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1876 const int8_t *zz_table; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1877 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1878 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1879 zz_table = wmv1_scantable[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1880 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1881 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1882 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
|
1883 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1884 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1885 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1886 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1887 } |
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 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1890 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1891 /* scale predictors if needed*/ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1892 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1893 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
|
1894 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
|
1895 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1896 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1897 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
|
1898 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
|
1899 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1900 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
|
1901 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
|
1902 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1903 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1904 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1905 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
|
1906 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
|
1907 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1908 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
|
1909 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
|
1910 } |
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 /* 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
|
1914 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
|
1915 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
|
1916 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
|
1917 } |
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 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1920 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
|
1921 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1922 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1923 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1924 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
|
1925 } |
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 if(use_pred) i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1928 } else { // no AC coeffs |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1929 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1930 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1931 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
|
1932 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1933 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1934 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
|
1935 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1936 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
|
1937 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
|
1938 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
|
1939 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
|
1940 } |
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 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1943 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1944 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
|
1945 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1946 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
|
1947 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
|
1948 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
|
1949 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
|
1950 } |
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 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1955 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1956 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1957 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
|
1958 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
|
1959 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
|
1960 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
|
1961 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1962 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1963 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
|
1964 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
|
1965 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1966 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
|
1967 } |
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 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1970 } |
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 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
|
1973 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1974 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1975 } |
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 /** Decode P block |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1978 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1979 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
|
1980 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
|
1981 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1982 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1983 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1984 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1985 int subblkpat = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1986 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
|
1987 int ttblk = ttmb & 7; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1988 int pat = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1989 |
9860
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1990 s->dsp.clear_block(block); |
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1991 |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1992 if(ttmb == -1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1993 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
|
1994 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1995 if(ttblk == TT_4X4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1996 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
|
1997 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1998 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
|
1999 subblkpat = decode012(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2000 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
|
2001 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
|
2002 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
|
2003 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2004 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
|
2005 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2006 // 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
|
2007 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
|
2008 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
|
2009 ttblk = TT_8X4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2010 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2011 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
|
2012 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
|
2013 ttblk = TT_4X8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2014 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2015 switch(ttblk) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2016 case TT_8X8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2017 pat = 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2018 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2019 last = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2020 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2021 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
|
2022 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2023 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2024 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2025 idx = wmv1_scantable[0][i++]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2026 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2027 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2028 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
|
2029 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2030 if(!skip_block){ |
9859
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2031 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2032 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
|
2033 else{ |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2034 s->dsp.vc1_inv_trans_8x8(block); |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2035 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
|
2036 } |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2037 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
|
2038 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
|
2039 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
|
2040 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
|
2041 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2042 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2043 case TT_4X4: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2044 pat = ~subblkpat & 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2045 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
|
2046 last = subblkpat & (1 << (3 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2047 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2048 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
|
2049 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2050 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
|
2051 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2052 if(i > 15) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2053 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2054 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
|
2055 block[idx + off] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2056 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2057 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
|
2058 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2059 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
|
2060 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2061 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
|
2062 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2063 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
|
2064 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
|
2065 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
|
2066 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
|
2067 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
|
2068 } |
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 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2071 case TT_8X4: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2072 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
|
2073 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
|
2074 last = subblkpat & (1 << (1 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2075 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2076 off = j * 32; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2077 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2078 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
|
2079 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2080 if(i > 31) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2081 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2082 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
|
2083 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2084 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2085 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
|
2086 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2087 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
|
2088 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2089 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
|
2090 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2091 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
|
2092 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
|
2093 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
|
2094 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
|
2095 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
|
2096 } |
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 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2099 case TT_4X8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2100 pat = ~(subblkpat*5) & 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2101 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
|
2102 last = subblkpat & (1 << (1 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2103 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2104 off = j * 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2105 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2106 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
|
2107 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2108 if(i > 31) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2109 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2110 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
|
2111 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2112 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2113 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
|
2114 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2115 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
|
2116 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2117 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
|
2118 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2119 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
|
2120 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
|
2121 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
|
2122 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
|
2123 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
|
2124 } |
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 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2127 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2128 return pat; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2129 } |
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 /** @} */ // Macroblock group |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2132 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2133 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
|
2134 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
|
2135 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2136 /** 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
|
2137 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2138 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
|
2139 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2140 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2141 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2142 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2143 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
|
2144 int cbp; /* cbp decoding stuff */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2145 int mqdiff, mquant; /* MB quantization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2146 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
|
2147 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2148 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
|
2149 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
|
2150 int index, index1; /* LUT indexes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2151 int val, sign; /* temp values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2152 int first_block = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2153 int dst_idx, off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2154 int skipped, fourmv; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2155 int block_cbp = 0, pat; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2156 int apply_loop_filter; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2157 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2158 mquant = v->pq; /* Loosy initialization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2159 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2160 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
|
2161 fourmv = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2162 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2163 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
|
2164 if (v->skip_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2165 skipped = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2166 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2167 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
|
2168 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2169 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
|
2170 if (!fourmv) /* 1MV mode */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2171 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2172 if (!skipped) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2173 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2174 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
|
2175 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2176 if (s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2177 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
|
2178 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
|
2179 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2180 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
|
2181 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
|
2182 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2183 /* 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
|
2184 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
|
2185 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2186 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2187 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
|
2188 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2189 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2190 else if (mb_has_coeffs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2191 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2192 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
|
2193 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
|
2194 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2195 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2196 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2197 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2198 mquant = v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2199 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2200 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2201 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
|
2202 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2203 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
|
2204 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
|
2205 VC1_TTMB_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2206 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
|
2207 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2208 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
|
2209 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2210 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
|
2211 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2212 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2213 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
|
2214 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
|
2215 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2216 /* 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
|
2217 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
|
2218 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
|
2219 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
|
2220 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
|
2221 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
|
2222 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2223 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
|
2224 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
|
2225 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
|
2226 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
|
2227 s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2228 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
|
2229 if(v->c_avail) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2230 s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2231 if(v->a_avail) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2232 s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2233 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2234 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
|
2235 int left_cbp, top_cbp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2236 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2237 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
|
2238 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
|
2239 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2240 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
|
2241 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
|
2242 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2243 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2244 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
|
2245 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2246 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
|
2247 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2248 block_cbp |= 0xF << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2249 } else if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2250 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
|
2251 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
|
2252 filter = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2253 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2254 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
|
2255 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
|
2256 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2257 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
|
2258 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
|
2259 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2260 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2261 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
|
2262 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2263 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
|
2264 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2265 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
|
2266 block_cbp |= pat << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2267 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
|
2268 first_block = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2269 } |
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 else //Skipped |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2273 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2274 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2275 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
|
2276 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
|
2277 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
|
2278 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2279 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
|
2280 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
|
2281 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
|
2282 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2283 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2284 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2285 } //1MV mode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2286 else //4MV mode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2287 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2288 if (!skipped /* unskipped MB */) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2289 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2290 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
|
2291 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
|
2292 /* Get CBPCY */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2293 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
|
2294 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
|
2295 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2296 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2297 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
|
2298 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2299 if(i < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2300 dmv_x = dmv_y = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2301 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2302 mb_has_coeffs = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2303 if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2304 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
|
2305 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2306 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
|
2307 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
|
2308 intra_count += s->mb_intra; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2309 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
|
2310 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
|
2311 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2312 if(i&4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2313 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
|
2314 is_coded[i] = val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2315 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2316 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
|
2317 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
|
2318 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
|
2319 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2320 // 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
|
2321 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
|
2322 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2323 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2324 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
|
2325 /* 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
|
2326 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2327 int intrapred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2328 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
|
2329 if(is_intra[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2330 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
|
2331 || ((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
|
2332 intrapred = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2333 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2334 } |
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 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
|
2337 else s->ac_pred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2338 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2339 if (!v->ttmbf && coded_inter) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2340 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
|
2341 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
|
2342 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2343 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2344 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
|
2345 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
|
2346 if (is_intra[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2347 /* 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
|
2348 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
|
2349 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
|
2350 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
|
2351 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
|
2352 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
|
2353 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2354 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
|
2355 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
|
2356 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
|
2357 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
|
2358 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
|
2359 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
|
2360 if(v->c_avail) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2361 s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2362 if(v->a_avail) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2363 s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2364 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2365 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
|
2366 int left_cbp, top_cbp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2367 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2368 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
|
2369 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
|
2370 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2371 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
|
2372 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
|
2373 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2374 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2375 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
|
2376 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2377 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
|
2378 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2379 block_cbp |= 0xF << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2380 } else if(is_coded[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2381 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
|
2382 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
|
2383 filter = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2384 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2385 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
|
2386 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
|
2387 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2388 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
|
2389 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
|
2390 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2391 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2392 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
|
2393 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2394 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
|
2395 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2396 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
|
2397 block_cbp |= pat << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2398 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
|
2399 first_block = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2400 } |
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 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2403 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2404 else //Skipped MB |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2405 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2406 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2407 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
|
2408 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
|
2409 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
|
2410 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
|
2411 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2412 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
|
2413 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2414 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
|
2415 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
|
2416 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2417 vc1_mc_4mv_chroma(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2418 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
|
2419 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2420 } |
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 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
|
2423 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2424 /* Should never happen */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2425 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2426 } |
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 /** 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
|
2429 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2430 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
|
2431 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2432 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2433 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2434 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2435 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
|
2436 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
|
2437 int mqdiff, mquant; /* MB quantization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2438 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
|
2439 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
|
2440 int index, index1; /* LUT indexes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2441 int val, sign; /* temp values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2442 int first_block = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2443 int dst_idx, off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2444 int skipped, direct; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2445 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
|
2446 int bmvtype = BMV_TYPE_BACKWARD; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2447 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2448 mquant = v->pq; /* Loosy initialization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2449 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2450 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2451 if (v->dmb_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2452 direct = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2453 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2454 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
|
2455 if (v->skip_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2456 skipped = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2457 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2458 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
|
2459 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2460 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
|
2461 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
|
2462 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
|
2463 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
|
2464 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2465 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
|
2466 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2467 if (!direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2468 if (!skipped) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2469 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
|
2470 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
|
2471 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
|
2472 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2473 if(skipped || !s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2474 bmvtype = decode012(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2475 switch(bmvtype) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2476 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2477 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
|
2478 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2479 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2480 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
|
2481 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2482 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2483 bmvtype = BMV_TYPE_INTERPOLATED; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2484 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
|
2485 } |
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 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
|
2489 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
|
2490 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2491 if (skipped) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2492 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
|
2493 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
|
2494 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
|
2495 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2496 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2497 if (direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2498 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
|
2499 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2500 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2501 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
|
2502 if(!v->ttmbf) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2503 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
|
2504 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
|
2505 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
|
2506 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
|
2507 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2508 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
|
2509 /* no coded blocks - effectively skipped */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2510 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
|
2511 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
|
2512 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2513 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2514 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
|
2515 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2516 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
|
2517 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
|
2518 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2519 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
|
2520 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2521 if(bmvtype == BMV_TYPE_INTERPOLATED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2522 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
|
2523 if(!mb_has_coeffs) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2524 /* interpolated skipped block */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2525 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
|
2526 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
|
2527 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2528 } |
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 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
|
2531 if(!s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2532 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
|
2533 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2534 if(s->mb_intra) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2535 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
|
2536 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
|
2537 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2538 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
|
2539 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
|
2540 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
|
2541 } |
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 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2544 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
|
2545 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2546 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
|
2547 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2548 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2549 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
|
2550 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
|
2551 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2552 /* 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
|
2553 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
|
2554 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
|
2555 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
|
2556 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
|
2557 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
|
2558 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2559 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
|
2560 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
|
2561 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
|
2562 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
|
2563 s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2564 } else if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2565 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
|
2566 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
|
2567 first_block = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2568 } |
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 /** Decode blocks of I-frame |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2573 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2574 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
|
2575 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2576 int k, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2577 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2578 int cbp, val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2579 uint8_t *coded_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2580 int mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2581 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2582 /* 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
|
2583 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
|
2584 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2585 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
|
2586 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2587 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2588 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
|
2589 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2590 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2591 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
|
2592 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2593 } |
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 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
|
2596 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2597 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
|
2598 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2599 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2600 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
|
2601 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2602 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2603 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
|
2604 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2605 } |
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 /* 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
|
2608 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
|
2609 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
|
2610 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2611 //do frame decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2612 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
|
2613 s->mb_intra = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2614 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2615 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
|
2616 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2617 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2618 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
|
2619 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2620 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
|
2621 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
|
2622 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
|
2623 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
|
2624 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
|
2625 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
|
2626 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2627 // 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
|
2628 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
|
2629 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
|
2630 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2631 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
|
2632 val = ((cbp >> (5 - k)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2633 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2634 if (k < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2635 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
|
2636 val = val ^ pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2637 *coded_val = val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2638 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2639 cbp |= val << (5 - k); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2640 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2641 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
|
2642 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2643 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
|
2644 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
|
2645 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
|
2646 } |
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 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
|
2650 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
|
2651 if(s->mb_x) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2652 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
|
2653 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
|
2654 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
|
2655 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
|
2656 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
|
2657 } |
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 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
|
2660 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
|
2661 if(!s->first_slice_line) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2662 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
|
2663 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
|
2664 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
|
2665 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
|
2666 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
|
2667 } |
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 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
|
2670 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
|
2671 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2672 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
|
2673 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2674 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
|
2675 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
|
2676 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
|
2677 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2678 } |
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 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
|
2681 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2682 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2683 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
|
2684 } |
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 /** 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
|
2687 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2688 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
|
2689 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2690 int k, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2691 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2692 int cbp, val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2693 uint8_t *coded_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2694 int mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2695 int mquant = v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2696 int mqdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2697 int overlap; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2698 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2699 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2700 /* 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
|
2701 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
|
2702 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2703 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
|
2704 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2705 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2706 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
|
2707 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2708 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2709 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
|
2710 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2711 } |
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 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
|
2714 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2715 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
|
2716 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2717 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2718 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
|
2719 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2720 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2721 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
|
2722 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2723 } |
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 //do frame decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2726 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
|
2727 s->mb_intra = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2728 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2729 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
|
2730 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2731 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2732 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
|
2733 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2734 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
|
2735 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
|
2736 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
|
2737 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
|
2738 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
|
2739 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2740 // 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
|
2741 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
|
2742 if(v->acpred_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2743 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
|
2744 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2745 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
|
2746 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2747 if(v->condover == CONDOVER_SELECT) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2748 if(v->overflg_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2749 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
|
2750 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2751 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
|
2752 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2753 overlap = (v->condover == CONDOVER_ALL); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2754 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2755 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2756 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2757 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
|
2758 /* 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
|
2759 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
|
2760 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
|
2761 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2762 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
|
2763 val = ((cbp >> (5 - k)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2764 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2765 if (k < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2766 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
|
2767 val = val ^ pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2768 *coded_val = val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2769 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2770 cbp |= val << (5 - k); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2771 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2772 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
|
2773 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
|
2774 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2775 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
|
2776 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2777 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
|
2778 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
|
2779 } |
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 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
|
2782 if(overlap) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2783 if(s->mb_x) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2784 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
|
2785 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
|
2786 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
|
2787 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
|
2788 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
|
2789 } |
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 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
|
2792 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
|
2793 if(!s->first_slice_line) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2794 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
|
2795 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
|
2796 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
|
2797 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
|
2798 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
|
2799 } |
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 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
|
2802 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
|
2803 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2804 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
|
2805 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2806 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
|
2807 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
|
2808 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
|
2809 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2810 } |
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 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
|
2813 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2814 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2815 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
|
2816 } |
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 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
|
2819 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2820 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2821 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2822 /* 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
|
2823 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
|
2824 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2825 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
|
2826 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2827 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2828 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
|
2829 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2830 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2831 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
|
2832 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2833 } |
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 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
|
2836 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2837 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
|
2838 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2839 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2840 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
|
2841 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2842 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2843 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
|
2844 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2845 } |
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 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2848 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
|
2849 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
|
2850 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2851 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2852 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
|
2853 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2854 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2855 vc1_decode_p_mb(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2856 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
|
2857 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
|
2858 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
|
2859 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2860 } |
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 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
|
2863 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
|
2864 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2865 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2866 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
|
2867 } |
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 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
|
2870 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2871 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2872 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2873 /* 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
|
2874 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
|
2875 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2876 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
|
2877 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2878 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2879 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
|
2880 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2881 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2882 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
|
2883 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2884 } |
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 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
|
2887 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2888 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
|
2889 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2890 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2891 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
|
2892 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2893 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2894 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
|
2895 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2896 } |
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 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2899 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
|
2900 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2901 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2902 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
|
2903 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2904 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2905 vc1_decode_b_mb(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2906 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
|
2907 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
|
2908 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
|
2909 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2910 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2911 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
|
2912 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2913 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
|
2914 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2915 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2916 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
|
2917 } |
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 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
|
2920 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2921 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2922 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2923 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
|
2924 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2925 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
|
2926 s->mb_x = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2927 ff_init_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2928 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2929 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
|
2930 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
|
2931 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
|
2932 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
|
2933 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2934 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2935 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
|
2936 } |
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 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
|
2939 { |
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 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
|
2942 if(v->x8_type){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2943 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
|
2944 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2945 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2946 switch(v->s.pict_type) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2947 case FF_I_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2948 if(v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2949 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
|
2950 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2951 vc1_decode_i_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2952 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2953 case FF_P_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2954 if(v->p_frame_skipped) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2955 vc1_decode_skip_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2956 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2957 vc1_decode_p_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2958 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2959 case FF_B_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2960 if(v->bi_type){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2961 if(v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2962 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
|
2963 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2964 vc1_decode_i_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2965 }else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2966 vc1_decode_b_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2967 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2968 } |
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 /** Initialize a VC1/WMV3 decoder |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2973 * @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
|
2974 * @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
|
2975 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2976 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
|
2977 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2978 VC1Context *v = avctx->priv_data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2979 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2980 GetBitContext gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2981 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2982 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
|
2983 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
|
2984 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
|
2985 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2986 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
|
2987 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
|
2988 v->s.avctx = avctx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2989 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
|
2990 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
|
2991 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2992 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
|
2993 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
|
2994 } |
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 if(ff_h263_decode_init(avctx) < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2997 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2998 if (vc1_init_common(v) < 0) return -1; |
10260
48aebab3bac1
Use ff_msmpeg4_decode_init to initialize ff_msmp4_mb_i_vlc since static
reimar
parents:
10146
diff
changeset
|
2999 // only for ff_msmp4_mb_i_table |
10822
9ccc13d1144d
Move AVCodecs from h263dec.c to msmpeg4.c and disentangle init decode init.
michael
parents:
10382
diff
changeset
|
3000 if (ff_msmpeg4_decode_init(avctx) < 0) return -1; |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3001 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3002 avctx->coded_width = avctx->width; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3003 avctx->coded_height = avctx->height; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3004 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
|
3005 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3006 int count = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3007 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3008 // 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
|
3009 // 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
|
3010 // 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
|
3011 // samples we can decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3012 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3013 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
|
3014 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3015 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
|
3016 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3017 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3018 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
|
3019 if (count>0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3020 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3021 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
|
3022 count, get_bits(&gb, count)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3023 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3024 else if (count < 0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3025 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3026 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
|
3027 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3028 } else { // VC1/WVC1 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3029 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
|
3030 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
|
3031 const uint8_t *next; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3032 int size, buf2_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3033 uint8_t *buf2 = NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3034 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
|
3035 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3036 if(avctx->extradata_size < 16) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3037 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
|
3038 return -1; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3041 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
|
3042 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
|
3043 next = start; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3044 for(; next < end; start = next){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3045 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
|
3046 size = next - start - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3047 if(size <= 0) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3048 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
|
3049 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
|
3050 switch(AV_RB32(start)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3051 case VC1_CODE_SEQHDR: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3052 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
|
3053 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3054 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3055 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3056 seq_initialized = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3057 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3058 case VC1_CODE_ENTRYPOINT: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3059 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
|
3060 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3061 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3062 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3063 ep_initialized = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3064 break; |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3067 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3068 if(!seq_initialized || !ep_initialized){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3069 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
|
3070 return -1; |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3073 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
|
3074 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
|
3075 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3076 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
|
3077 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
|
3078 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3079 /* Allocate mb bitplanes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3080 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
|
3081 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
|
3082 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
|
3083 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
|
3084 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3085 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
|
3086 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
|
3087 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3088 /* 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
|
3089 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
|
3090 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
|
3091 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
|
3092 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
|
3093 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3094 /* Init coded blocks info */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3095 if (v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3096 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3097 // 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
|
3098 // return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3099 // 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
|
3100 // return -1; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3103 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
|
3104 return 0; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3108 /** Decode a VC1/WMV3 frame |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3109 * @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
|
3110 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3111 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
|
3112 void *data, int *data_size, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3113 AVPacket *avpkt) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3114 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3115 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
|
3116 int buf_size = avpkt->size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3117 VC1Context *v = avctx->priv_data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3118 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3119 AVFrame *pict = data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3120 uint8_t *buf2 = NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3121 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
|
3122 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3123 /* no supplementary picture */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3124 if (buf_size == 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3125 /* special case for last picture */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3126 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
|
3127 *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
|
3128 s->next_picture_ptr= NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3129 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3130 *data_size = sizeof(AVFrame); |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3133 return 0; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3136 /* 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
|
3137 * 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
|
3138 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
|
3139 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
|
3140 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
|
3141 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3142 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3143 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
|
3144 if (v->profile < PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3145 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
|
3146 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3147 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
|
3148 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3149 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3150 //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
|
3151 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
|
3152 int buf_size2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3153 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
|
3154 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3155 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
|
3156 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
|
3157 int size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3158 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3159 next = buf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3160 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
|
3161 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
|
3162 size = next - start - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3163 if(size <= 0) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3164 switch(AV_RB32(start)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3165 case VC1_CODE_FRAME: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3166 if (avctx->hwaccel || |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3167 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
|
3168 buf_start = start; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3169 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
|
3170 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3171 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
|
3172 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
|
3173 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
|
3174 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
|
3175 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3176 case VC1_CODE_SLICE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3177 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
|
3178 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3179 return -1; |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3182 }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
|
3183 const uint8_t *divider; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3184 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3185 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
|
3186 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
|
3187 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
|
3188 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3189 return -1; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3192 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
|
3193 // TODO |
10382 | 3194 if(!v->warn_interlaced++) |
3195 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
|
3196 av_free(buf2);return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3197 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3198 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
|
3199 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3200 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
|
3201 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3202 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
|
3203 // do parse frame header |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3204 if(v->profile < PROFILE_ADVANCED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3205 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
|
3206 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3207 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3208 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3209 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3210 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
|
3211 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3212 return -1; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3216 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
|
3217 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3218 return -1; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3221 // for hurry_up==5 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3222 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
|
3223 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
|
3224 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3225 /* 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
|
3226 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
|
3227 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3228 return -1;//buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3229 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3230 /* 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
|
3231 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
|
3232 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
|
3233 || (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
|
3234 || avctx->skip_frame >= AVDISCARD_ALL) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3235 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3236 return buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3237 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3238 /* 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
|
3239 if(avctx->hurry_up>=5) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3240 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3241 return -1;//buf_size; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3244 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
|
3245 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
|
3246 return buf_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3247 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3248 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
|
3249 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3250 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3251 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
|
3252 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3253 return -1; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3256 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
|
3257 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
|
3258 |
9994
cd2b3ecdb1c9
Do not check for both CONFIG_VC1_VDPAU_DECODER and CONFIG_WMV3_VDPAU_DECODER,
diego
parents:
9881
diff
changeset
|
3259 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
|
3260 &&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
|
3261 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
|
3262 else if (avctx->hwaccel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3263 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
|
3264 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3265 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
|
3266 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3267 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
|
3268 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3269 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3270 ff_er_frame_start(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3271 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3272 v->bits = buf_size * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3273 vc1_decode_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3274 //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
|
3275 // 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
|
3276 // return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3277 ff_er_frame_end(s); |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3280 MPV_frame_end(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3281 |
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->current_picture_ptr->pict_type); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3283 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
|
3284 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
|
3285 *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
|
3286 } 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
|
3287 *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
|
3288 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3289 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3290 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
|
3291 *data_size = sizeof(AVFrame); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3292 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
|
3293 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3294 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3295 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3296 return buf_size; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3300 /** Close a VC1/WMV3 decoder |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3301 * @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
|
3302 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3303 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
|
3304 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3305 VC1Context *v = avctx->priv_data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3306 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3307 av_freep(&v->hrd_rate); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3308 av_freep(&v->hrd_buffer); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3309 MPV_common_end(&v->s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3310 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
|
3311 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
|
3312 av_freep(&v->acpred_plane); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3313 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
|
3314 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
|
3315 av_freep(&v->cbp_base); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3316 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
|
3317 return 0; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3321 AVCodec vc1_decoder = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3322 "vc1", |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3323 CODEC_TYPE_VIDEO, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3324 CODEC_ID_VC1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3325 sizeof(VC1Context), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3326 vc1_decode_init, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3327 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3328 vc1_decode_end, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3329 vc1_decode_frame, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3330 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
|
3331 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3332 .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
|
3333 .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
|
3334 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3335 |
9996
38a57d201569
Only enable WMV3 decoder when it has been turned on in the build system.
diego
parents:
9994
diff
changeset
|
3336 #if CONFIG_WMV3_DECODER |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3337 AVCodec wmv3_decoder = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3338 "wmv3", |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3339 CODEC_TYPE_VIDEO, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3340 CODEC_ID_WMV3, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3341 sizeof(VC1Context), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3342 vc1_decode_init, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3343 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3344 vc1_decode_end, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3345 vc1_decode_frame, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3346 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
|
3347 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3348 .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
|
3349 .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
|
3350 }; |
9996
38a57d201569
Only enable WMV3 decoder when it has been turned on in the build system.
diego
parents:
9994
diff
changeset
|
3351 #endif |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3352 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3353 #if CONFIG_WMV3_VDPAU_DECODER |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3354 AVCodec wmv3_vdpau_decoder = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3355 "wmv3_vdpau", |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3356 CODEC_TYPE_VIDEO, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3357 CODEC_ID_WMV3, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3358 sizeof(VC1Context), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3359 vc1_decode_init, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3360 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3361 vc1_decode_end, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3362 vc1_decode_frame, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3363 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
|
3364 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3365 .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
|
3366 .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
|
3367 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3368 #endif |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3369 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3370 #if CONFIG_VC1_VDPAU_DECODER |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3371 AVCodec vc1_vdpau_decoder = { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3372 "vc1_vdpau", |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3373 CODEC_TYPE_VIDEO, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3374 CODEC_ID_VC1, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3375 sizeof(VC1Context), |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3376 vc1_decode_init, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3377 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3378 vc1_decode_end, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3379 vc1_decode_frame, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3380 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
|
3381 NULL, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3382 .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
|
3383 .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
|
3384 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3385 #endif |