Mercurial > libavcodec.hg
annotate vc1dec.c @ 10217:35f1814a6496 libavcodec
Cosmetics, indentation.
author | banan |
---|---|
date | Mon, 21 Sep 2009 20:53:29 +0000 |
parents | 38cfe222e1a4 |
children | 48aebab3bac1 |
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 //FIXME: switching to INIT_VLC_STATIC() results in incorrect decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
128 init_vlc(&ff_msmp4_mb_i_vlc, MB_INTRA_VLC_BITS, 64, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
129 &ff_msmp4_mb_i_table[0][1], 4, 2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
130 &ff_msmp4_mb_i_table[0][0], 4, 2, INIT_VLC_USE_STATIC); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
131 done = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
132 } |
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 /* Other defaults */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
135 v->pq = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
136 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
|
137 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
138 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
139 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
140 |
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 * @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
|
144 * @see 8.7, p56 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
145 * @{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
146 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
147 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
148 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
149 * Imode types |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
150 * @{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
151 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
152 enum Imode { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
153 IMODE_RAW, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
154 IMODE_NORM2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
155 IMODE_DIFF2, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
156 IMODE_NORM6, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
157 IMODE_DIFF6, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
158 IMODE_ROWSKIP, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
159 IMODE_COLSKIP |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
160 }; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
161 /** @} */ //imode defines |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
162 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
163 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
164 /** @} */ //Bitplane group |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
165 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
166 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
|
167 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
168 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
169 if(!s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 if(!s->first_slice_line) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
176 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
|
177 if(s->mb_x) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
178 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
|
179 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
180 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
181 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
182 /** Put block onto picture |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
183 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
184 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
|
185 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
186 uint8_t *Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
187 int ys, us, vs; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
188 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
189 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
190 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
191 int i, j, k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
192 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
|
193 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
|
194 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
|
195 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
|
196 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
197 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
198 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
|
199 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
|
200 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
|
201 Y = v->s.dest[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
202 |
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[0], Y, ys); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
204 dsp->put_pixels_clamped(block[1], Y + 8, ys); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
205 Y += ys * 8; |
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[2], Y, ys); |
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[3], Y + 8, ys); |
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 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
|
210 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
|
211 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
|
212 } |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
215 /** 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
|
216 * 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
|
217 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
218 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
|
219 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
220 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
221 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
222 uint8_t *srcY, *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
223 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
|
224 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
225 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
|
226 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
227 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
|
228 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
|
229 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
230 // 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
|
231 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
|
232 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
|
233 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
|
234 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
235 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
|
236 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
|
237 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
238 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
|
239 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
|
240 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
241 if(!dir) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
246 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
|
247 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
|
248 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
|
249 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
250 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
251 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
|
252 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
|
253 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
|
254 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
|
255 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
256 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
257 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
|
258 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
|
259 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
|
260 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
|
261 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
262 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
|
263 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
|
264 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
|
265 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
|
266 } |
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 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
|
269 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
|
270 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
|
271 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
272 /* 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
|
273 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
|
274 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
|
275 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
|
276 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
277 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
278 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
|
279 || (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
|
280 || (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
|
281 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
|
282 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
283 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
|
284 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
|
285 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
|
286 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
287 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
|
288 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
|
289 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
|
290 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
|
291 srcU = uvbuf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
292 srcV = uvbuf + 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
293 /* 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
|
294 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
295 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
296 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
297 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
298 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
299 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
|
300 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
|
301 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
302 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
303 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
304 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
|
305 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
|
306 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
|
307 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
|
308 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
309 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
310 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
311 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
312 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
313 /* 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
|
314 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
|
315 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
316 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
317 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
318 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
319 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
|
320 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
|
321 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
322 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
323 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
324 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
|
325 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
|
326 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
|
327 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
|
328 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
329 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
330 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
331 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
332 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
333 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
|
334 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
335 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
336 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
337 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
|
338 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
|
339 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
|
340 srcY += s->linesize * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
341 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
|
342 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
|
343 } 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
|
344 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
|
345 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
346 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
347 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
|
348 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
349 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
|
350 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
351 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
352 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
|
353 /* 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
|
354 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
355 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
356 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
357 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
|
358 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
|
359 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
360 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
|
361 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
|
362 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
363 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
364 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
365 /** 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
|
366 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
367 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
|
368 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
369 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
370 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
371 uint8_t *srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
372 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
|
373 int off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
374 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
375 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
|
376 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
|
377 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
|
378 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
|
379 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
380 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
|
381 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
382 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
|
383 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
|
384 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
385 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
386 src_x = av_clip( src_x, -16, s->mb_width * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
387 src_y = av_clip( src_y, -16, s->mb_height * 16); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
388 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
389 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
|
390 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
|
391 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
392 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
393 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
|
394 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
395 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
|
396 || (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
|
397 || (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
|
398 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
|
399 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
|
400 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
|
401 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
402 /* 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
|
403 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
404 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
405 uint8_t *src; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
406 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
407 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
408 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
|
409 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
|
410 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
411 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
412 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
413 /* 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
|
414 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
|
415 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
416 uint8_t *src; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
417 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
418 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
419 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
|
420 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
|
421 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
422 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
423 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
424 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
|
425 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
426 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
427 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
428 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
|
429 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
|
430 } 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
|
431 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
|
432 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
433 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
|
434 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
435 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
|
436 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
437 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
438 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
439 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
|
440 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
441 if(a < b) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
442 if(c < d) return (FFMIN(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
|
443 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
|
444 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
445 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
|
446 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
|
447 } |
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 |
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 /** 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
|
452 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
453 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
|
454 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
455 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
456 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
457 uint8_t *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
458 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
|
459 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
|
460 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
|
461 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
|
462 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
463 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
|
464 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
|
465 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
466 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
|
467 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
|
468 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
|
469 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
|
470 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
471 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
472 /* 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
|
473 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
|
474 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
|
475 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
|
476 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
|
477 } 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
|
478 switch(idx) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
479 case 0x1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
480 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
|
481 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
|
482 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
483 case 0x2: |
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[2], 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[2], 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 0x4: |
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[3]); |
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[3]); |
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 case 0x8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
492 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
|
493 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
|
494 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
495 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
496 } else if(count[idx] == 2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
497 int t1 = 0, t2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
498 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
|
499 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
|
500 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
|
501 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
|
502 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
503 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
|
504 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
|
505 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
|
506 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
507 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
508 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
|
509 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
|
510 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
|
511 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
|
512 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
513 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
|
514 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
|
515 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
516 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
517 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
|
518 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
|
519 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
520 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
521 uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
522 uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
523 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
524 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
|
525 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
|
526 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
527 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
528 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
|
529 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
|
530 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
|
531 || (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
|
532 || (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
|
533 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
|
534 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
|
535 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
|
536 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
|
537 srcU = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
538 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
|
539 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
540 /* 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
|
541 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
542 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
543 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
544 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
545 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
546 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
|
547 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
|
548 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
|
549 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
|
550 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
551 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
552 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
553 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
554 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
555 /* 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
|
556 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
|
557 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
558 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
559 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
560 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 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
|
565 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
566 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
567 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
568 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
569 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
570 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
571 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
572 /* 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
|
573 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
574 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
575 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
576 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
|
577 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
|
578 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
579 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
|
580 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
|
581 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
582 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
583 |
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 * @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
|
587 * @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
|
588 * @{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
589 */ |
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 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
592 * @def GET_MQUANT |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
593 * @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
|
594 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
595 #define GET_MQUANT() \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
596 if (v->dquantfrm) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
597 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
598 int edges = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
599 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
|
600 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
601 if (v->dqbilevel) \ |
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 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
|
604 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
605 else \ |
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 mqdiff = get_bits(gb, 3); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
608 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
|
609 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
|
610 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
611 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
612 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
|
613 edges = 1 << v->dqsbedge; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
614 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
|
615 edges = (3 << v->dqsbedge) % 15; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
616 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
|
617 edges = 15; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
618 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
|
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&2) && s->first_slice_line) \ |
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 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
|
623 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
624 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
|
625 mquant = v->altpq; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
626 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
627 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
628 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
629 * @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
|
630 * @brief Get MV differentials |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
631 * @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
|
632 * @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
|
633 * @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
|
634 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
635 #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
|
636 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
|
637 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
|
638 if (index > 36) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
639 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
640 mb_has_coeffs = 1; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
641 index -= 37; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
642 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
643 else mb_has_coeffs = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
644 s->mb_intra = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
645 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
|
646 else if (index == 35) \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
647 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
648 _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
|
649 _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
|
650 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
651 else if (index == 36) \ |
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 _dmv_x = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
654 _dmv_y = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
655 s->mb_intra = 1; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
656 } \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
657 else \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
658 { \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
659 index1 = index%6; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
660 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
|
661 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
662 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
|
663 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
|
664 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
665 sign = 0 - (val&1); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
666 _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
|
667 \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
668 index1 = index/6; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
669 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
|
670 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
671 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
|
672 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
|
673 else val = 0; \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
674 sign = 0 - (val&1); \ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
675 _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
|
676 } |
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 /** Predict and set motion vector |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
679 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
680 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
|
681 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
682 int xy, wrap, off = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
683 int16_t *A, *B, *C; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
684 int px, py; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
685 int sum; |
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 /* 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
|
688 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
|
689 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
|
690 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
691 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
692 xy = s->block_index[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
693 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
694 if(s->mb_intra){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
695 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
|
696 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
|
697 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 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
|
705 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
|
706 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
|
707 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
|
708 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
|
709 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
|
710 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
|
711 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
|
712 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
713 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
714 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
715 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
716 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
|
717 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
|
718 if(mv1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
719 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
|
720 else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
721 //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
|
722 switch(n){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
723 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
724 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
|
725 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
726 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
727 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
|
728 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
729 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
730 off = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
731 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
732 case 3: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
733 off = -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
734 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
735 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
736 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
|
737 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
738 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
|
739 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
740 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
741 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
742 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
743 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
|
744 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
|
745 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
746 } 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
|
747 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
748 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
749 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
750 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
751 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
752 /* 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
|
753 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
754 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
755 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
|
756 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
|
757 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
|
758 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
|
759 if(mv1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
760 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
|
761 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
|
762 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
763 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
|
764 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
|
765 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
766 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
|
767 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
|
768 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
769 /* 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
|
770 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
|
771 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
772 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
773 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
774 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
|
775 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
776 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
777 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
778 py = A[1]; |
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 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
781 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
782 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
783 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
784 if(is_intra[xy - 1]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
785 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
786 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
787 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
|
788 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
789 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
790 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
791 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
792 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
793 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
794 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
795 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
796 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
797 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
798 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
799 /* 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
|
800 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
|
801 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
|
802 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
|
803 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
|
804 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
|
805 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
|
806 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
|
807 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
|
808 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
|
809 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
810 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
811 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
812 /** 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
|
813 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
814 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
|
815 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
816 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
817 DSPContext *dsp = &v->s.dsp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
818 uint8_t *srcY, *srcU, *srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
819 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
|
820 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
821 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
|
822 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
823 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
|
824 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
|
825 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
|
826 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
|
827 if(v->fastuvmc) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
828 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
|
829 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
|
830 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
831 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
|
832 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
|
833 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
|
834 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
835 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
|
836 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
|
837 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
|
838 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
|
839 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
840 if(v->profile != PROFILE_ADVANCED){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
841 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
|
842 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
|
843 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
|
844 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
|
845 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
846 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
|
847 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
|
848 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
|
849 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
|
850 } |
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 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
|
853 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
|
854 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
|
855 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
856 /* 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
|
857 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
|
858 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
|
859 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
|
860 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
861 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
862 if(v->rangeredfrm |
9881
c69559e9f6c3
Edge emulation should be used in B-frame MC in mspel mode with
kostya
parents:
9863
diff
changeset
|
863 || (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
|
864 || (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
|
865 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
|
866 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
867 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
|
868 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
|
869 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
|
870 srcY = s->edge_emu_buffer; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
871 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
|
872 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
|
873 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
|
874 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
|
875 srcU = uvbuf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
876 srcV = uvbuf + 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
877 /* 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
|
878 if(v->rangeredfrm) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
879 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
880 uint8_t *src, *src2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
881 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
882 src = srcY; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
883 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
|
884 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
|
885 src += s->linesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
886 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
887 src = srcU; src2 = srcV; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
888 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
|
889 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
|
890 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
|
891 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
|
892 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
893 src += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
894 src2 += s->uvlinesize; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
895 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
896 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
897 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
|
898 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
899 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
900 if(s->mspel) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
901 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
|
902 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
|
903 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
|
904 srcY += s->linesize * 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
905 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
|
906 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
|
907 } else { // hpel mc |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
908 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
|
909 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
910 if(!v->rnd) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
911 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
|
912 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
913 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
|
914 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
915 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
916 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
|
917 /* 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
|
918 uvmx = (uvmx&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
919 uvmy = (uvmy&3)<<1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
920 if(!v->rnd){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
921 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
|
922 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
|
923 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
924 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
|
925 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
|
926 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
927 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
928 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
929 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
|
930 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
931 int n = bfrac; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
932 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
933 #if B_FRACTION_DEN==256 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
934 if(inv) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
935 n -= 256; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
936 if(!qs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
937 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
|
938 return (value * n + 128) >> 8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
939 #else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
940 if(inv) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
941 n -= B_FRACTION_DEN; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
942 if(!qs) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
943 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
|
944 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
|
945 #endif |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
946 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
947 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
948 /** 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
|
949 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
950 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
|
951 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
952 if(v->use_ic) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
953 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
|
954 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
|
955 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
956 if(direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
957 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
958 vc1_interp_mc(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
959 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
|
960 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
961 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
962 if(mode == BMV_TYPE_INTERPOLATED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
963 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
964 vc1_interp_mc(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
965 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
|
966 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
967 } |
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 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
|
970 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
|
971 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
|
972 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
973 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
974 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
|
975 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
976 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
977 int xy, wrap, off = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
978 int16_t *A, *B, *C; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
979 int px, py; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
980 int sum; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
981 int r_x, r_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
982 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
|
983 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
984 r_x = v->range_x; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
985 r_y = v->range_y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
986 /* 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
|
987 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
|
988 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
|
989 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
|
990 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
|
991 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
992 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
993 xy = s->block_index[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
994 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
995 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
996 s->current_picture.motion_val[0][xy][0] = |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
997 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
|
998 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
|
999 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
|
1000 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1001 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1002 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
|
1003 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
|
1004 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
|
1005 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
|
1006 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1007 /* 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
|
1008 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
|
1009 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
|
1010 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
|
1011 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
|
1012 if(direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1013 s->current_picture.motion_val[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
|
1014 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
|
1015 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
|
1016 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
|
1017 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1018 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1019 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1020 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
|
1021 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
|
1022 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
|
1023 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
|
1024 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
|
1025 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1026 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
|
1027 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
|
1028 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1029 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1030 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1031 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1032 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
|
1033 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
|
1034 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1035 } 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
|
1036 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1037 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1038 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1039 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1040 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1041 /* 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
|
1042 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1043 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1044 if(v->profile < PROFILE_ADVANCED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1045 qx = (s->mb_x << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1046 qy = (s->mb_y << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1047 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
|
1048 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
|
1049 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
|
1050 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
|
1051 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
|
1052 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
|
1053 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1054 qx = (s->mb_x << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1055 qy = (s->mb_y << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1056 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
|
1057 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
|
1058 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
|
1059 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
|
1060 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
|
1061 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
|
1062 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1063 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1064 /* 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
|
1065 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
|
1066 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1067 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1068 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1069 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
|
1070 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1071 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1072 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1073 py = A[1]; |
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 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1076 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1077 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1078 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1079 if(is_intra[xy - 2]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1080 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1081 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1082 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
|
1083 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1084 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1085 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1086 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1087 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1088 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1089 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1090 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1091 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1092 } |
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 /* 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
|
1095 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
|
1096 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
|
1097 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1098 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
|
1099 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
|
1100 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
|
1101 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
|
1102 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
|
1103 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1104 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
|
1105 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
|
1106 if(s->mb_width == 1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1107 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1108 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1109 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1110 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
|
1111 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
|
1112 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1113 } 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
|
1114 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1115 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1116 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1117 px = py = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1118 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1119 /* 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
|
1120 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1121 int qx, qy, X, Y; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1122 if(v->profile < PROFILE_ADVANCED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1123 qx = (s->mb_x << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1124 qy = (s->mb_y << 5); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1125 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
|
1126 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
|
1127 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
|
1128 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
|
1129 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
|
1130 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
|
1131 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1132 qx = (s->mb_x << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1133 qy = (s->mb_y << 6); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1134 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
|
1135 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
|
1136 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
|
1137 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
|
1138 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
|
1139 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
|
1140 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1141 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1142 /* 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
|
1143 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
|
1144 if(is_intra[xy - wrap]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1145 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1146 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1147 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
|
1148 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1149 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1150 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1151 py = A[1]; |
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 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1154 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1155 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1156 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1157 if(is_intra[xy - 2]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1158 sum = FFABS(px) + FFABS(py); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1159 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1160 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
|
1161 if(sum > 32) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1162 if(get_bits1(&s->gb)) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1163 px = A[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1164 py = A[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1165 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1166 px = C[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1167 py = C[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1168 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1169 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1170 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1171 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1172 /* 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
|
1173 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1174 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
|
1175 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
|
1176 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1177 s->current_picture.motion_val[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
|
1178 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
|
1179 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
|
1180 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
|
1181 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1182 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1183 /** 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
|
1184 * 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
|
1185 * @param s MpegEncContext |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1186 * @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
|
1187 * @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
|
1188 * @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
|
1189 * @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
|
1190 * @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
|
1191 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1192 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
|
1193 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
|
1194 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1195 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
|
1196 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1197 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
|
1198 -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
|
1199 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
|
1200 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
|
1201 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
|
1202 }; |
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 /* 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
|
1205 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
|
1206 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
|
1207 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1208 wrap = s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1209 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
|
1210 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1211 /* B A |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1212 * C X |
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 c = dc_val[ - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1215 b = dc_val[ - 1 - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1216 a = dc_val[ - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1217 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1218 if (pq < 9 || !overlap) |
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 /* Set outer values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1221 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
|
1222 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
|
1223 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1224 else |
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 /* Set outer values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1227 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
|
1228 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
|
1229 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1230 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1231 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
|
1232 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1233 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1234 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1235 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1236 *dir_ptr = 0;//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1237 } |
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 /* update predictor */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1240 *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
|
1241 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1242 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1243 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1244 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1245 /** Get predicted DC value |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1246 * 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
|
1247 * @param s MpegEncContext |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1248 * @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
|
1249 * @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
|
1250 * @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
|
1251 * @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
|
1252 * @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
|
1253 * @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
|
1254 * @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
|
1255 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1256 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
|
1257 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
|
1258 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
|
1259 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1260 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
|
1261 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1262 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
|
1263 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1264 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1265 wrap = s->block_wrap[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1266 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
|
1267 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1268 /* B A |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1269 * C X |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1270 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1271 c = dc_val[ - 1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1272 b = dc_val[ - 1 - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1273 a = dc_val[ - wrap]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1274 /* scale predictors if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1275 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
|
1276 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
|
1277 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
|
1278 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1279 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
|
1280 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1281 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
|
1282 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
|
1283 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1284 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
|
1285 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1286 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
|
1287 int off = mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1288 if(n != 1) off--; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1289 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
|
1290 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
|
1291 if(q2 && q2 != q1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1292 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
|
1293 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1294 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1295 if(a_avail && c_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1296 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
|
1297 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1298 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1299 } else { |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1303 } else if(a_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1304 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1305 *dir_ptr = 0;//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1306 } else if(c_avail) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1307 pred = c; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1308 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1309 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1310 pred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1311 *dir_ptr = 1;//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1312 } |
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 /* update predictor */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1315 *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
|
1316 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1317 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1318 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1319 /** @} */ // Block group |
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 * @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
|
1323 * @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
|
1324 * @{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1325 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1326 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1327 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
|
1328 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1329 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
|
1330 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1331 xy = s->block_index[n]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1332 wrap = s->b8_stride; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1333 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1334 /* B C |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1335 * A X |
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 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
|
1338 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
|
1339 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
|
1340 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1341 if (b == c) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1342 pred = a; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1343 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1344 pred = c; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1347 /* store value */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1348 *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
|
1349 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1350 return pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1351 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1352 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1353 /** |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1354 * Decode one AC coefficient |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1355 * @param v The VC1 context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1356 * @param last Last coefficient |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1357 * @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
|
1358 * @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
|
1359 * @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
|
1360 * @see 8.1.3.4 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1361 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1362 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
|
1363 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1364 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1365 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
|
1366 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1367 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
|
1368 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
|
1369 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
|
1370 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
|
1371 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
|
1372 if(get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1373 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1374 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1375 escape = decode210(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1376 if (escape != 2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1377 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
|
1378 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
|
1379 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
|
1380 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
|
1381 if(escape == 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1382 if(lst) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1383 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
|
1384 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1385 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
|
1386 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1387 if(lst) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1388 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
|
1389 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1390 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
|
1391 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1392 if(get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1393 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1394 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1395 int sign; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1396 lst = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1397 if(v->s.esc3_level_length == 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1398 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
|
1399 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
|
1400 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
|
1401 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
|
1402 } else { //table 60 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1403 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
|
1404 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1405 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
|
1406 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1407 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
|
1408 sign = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1409 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
|
1410 if(sign) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1411 level = -level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1412 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1413 } |
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 *last = lst; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1416 *skip = run; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1417 *value = level; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1418 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1419 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1420 /** 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
|
1421 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1422 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1423 * @param[in] n subblock index |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1424 * @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
|
1425 * @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
|
1426 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1427 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
|
1428 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1429 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1430 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1431 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
|
1432 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1433 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1434 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
|
1435 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1436 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1437 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1438 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1439 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
|
1440 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1441 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
|
1442 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1443 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1444 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
|
1445 return -1; |
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 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1448 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1449 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
|
1450 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1451 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1452 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
|
1453 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
|
1454 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
|
1455 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1456 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1457 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1458 if (v->pq == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1459 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
|
1460 else if (v->pq == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1461 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
|
1462 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1463 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1464 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1465 } |
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 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1468 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
|
1469 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1470 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1471 /* 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
|
1472 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1473 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
|
1474 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1475 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
|
1476 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1477 /* Skip ? */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1478 if (!coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1479 goto not_coded; |
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 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1483 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1484 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1485 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1486 int last = 0, skip, value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1487 const int8_t *zz_table; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1488 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1489 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1490 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1491 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
|
1492 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1493 if(v->s.ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1494 if(!dc_pred_dir) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1495 zz_table = wmv1_scantable[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1496 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1497 zz_table = wmv1_scantable[3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1498 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1499 zz_table = wmv1_scantable[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1500 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1501 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
|
1502 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1503 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1504 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1505 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1506 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
|
1507 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1508 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1509 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
|
1510 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1511 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1512 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1513 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1514 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1515 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1516 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1517 if(s->ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1518 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1519 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1520 block[k << 3] += ac_val[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1521 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1522 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
|
1523 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
|
1524 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1525 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1526 /* 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
|
1527 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
|
1528 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
|
1529 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
|
1530 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1531 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1532 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1533 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
|
1534 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1535 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1536 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1537 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
|
1538 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1539 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1540 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
|
1541 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1542 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1543 not_coded: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1544 if(!coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1545 int k, scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1546 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
|
1547 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1548 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1549 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1550 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
|
1551 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
|
1552 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1553 ac_val -= 16; |
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, ac_val, 8 * 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1556 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1557 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
|
1558 if(s->ac_pred) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1559 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
|
1560 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1561 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1562 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1563 if(s->ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1564 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1565 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
|
1566 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
|
1567 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
|
1568 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
|
1569 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1570 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1571 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
|
1572 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
|
1573 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1574 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
|
1575 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1576 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1577 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1578 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1579 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1580 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
|
1581 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1582 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1583 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1584 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1585 /** 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
|
1586 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1587 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1588 * @param[in] n subblock number |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1589 * @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
|
1590 * @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
|
1591 * @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
|
1592 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1593 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
|
1594 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1595 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1596 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1597 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
|
1598 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1599 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1600 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
|
1601 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1602 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
|
1603 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
|
1604 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1605 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1606 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
|
1607 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1608 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1609 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1610 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
|
1611 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1612 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
|
1613 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1614 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1615 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
|
1616 return -1; |
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 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1619 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1620 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
|
1621 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1622 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1623 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
|
1624 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
|
1625 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
|
1626 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1627 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1628 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1629 if (mquant == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1630 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
|
1631 else if (mquant == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1632 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
|
1633 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1634 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1635 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1636 } |
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 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1639 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
|
1640 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1641 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1642 /* 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
|
1643 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1644 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
|
1645 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1646 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
|
1647 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1648 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1649 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1650 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1651 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1652 /* 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
|
1653 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
|
1654 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
|
1655 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1656 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1657 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
|
1658 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1659 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1660 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1661 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1662 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
|
1663 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1664 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
|
1665 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
|
1666 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
|
1667 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
|
1668 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
|
1669 if(n==3) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1670 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1671 if(coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1672 int last = 0, skip, value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1673 const int8_t *zz_table; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1674 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1675 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1676 if(v->s.ac_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1677 if(!dc_pred_dir) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1678 zz_table = wmv1_scantable[2]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1679 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1680 zz_table = wmv1_scantable[3]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1681 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1682 zz_table = wmv1_scantable[1]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1683 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1684 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1685 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
|
1686 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1687 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1688 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1689 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1690 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1691 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1692 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1693 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1694 /* scale predictors if needed*/ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1695 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1696 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
|
1697 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
|
1698 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1699 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1700 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1701 block[k << 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
|
1702 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1703 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
|
1704 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
|
1705 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1706 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1707 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1708 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1709 block[k << 3] += ac_val[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1710 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1711 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
|
1712 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
|
1713 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1714 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1715 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1716 /* 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
|
1717 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
|
1718 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
|
1719 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
|
1720 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1721 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1722 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1723 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
|
1724 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1725 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1726 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1727 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
|
1728 } |
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 if(use_pred) i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1731 } else { // no AC coeffs |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1732 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1733 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1734 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
|
1735 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1736 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1737 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
|
1738 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1739 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
|
1740 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
|
1741 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
|
1742 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
|
1743 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1744 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1745 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1746 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1747 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
|
1748 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1749 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
|
1750 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
|
1751 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
|
1752 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
|
1753 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1754 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1755 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1756 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1757 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1758 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1759 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1760 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
|
1761 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
|
1762 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
|
1763 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
|
1764 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1765 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1766 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
|
1767 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
|
1768 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1769 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
|
1770 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1771 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1772 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1773 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1774 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1775 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
|
1776 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1777 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1778 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1779 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1780 /** 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
|
1781 * @param v VC1Context |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1782 * @param block block to decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1783 * @param[in] n subblock index |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1784 * @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
|
1785 * @param mquant block quantizer |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1786 * @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
|
1787 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1788 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
|
1789 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1790 GetBitContext *gb = &v->s.gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1791 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1792 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
|
1793 int i; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1794 int16_t *dc_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1795 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
|
1796 int dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1797 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
|
1798 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
|
1799 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
|
1800 int scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1801 int q1, q2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1802 |
9860
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1803 s->dsp.clear_block(block); |
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1804 |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1805 /* 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
|
1806 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
|
1807 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1808 /* 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
|
1809 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
|
1810 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
|
1811 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1812 /* Get DC differential */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1813 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1814 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
|
1815 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1816 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
|
1817 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1818 if (dcdiff < 0){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1819 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
|
1820 return -1; |
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 if (dcdiff) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1823 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1824 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
|
1825 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1826 /* TODO: Optimize */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1827 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
|
1828 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
|
1829 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
|
1830 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1831 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1832 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1833 if (mquant == 1) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1834 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
|
1835 else if (mquant == 2) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1836 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
|
1837 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1838 if (get_bits1(gb)) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1839 dcdiff = -dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1840 } |
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 /* Prediction */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1843 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
|
1844 *dc_val = dcdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1845 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1846 /* 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
|
1847 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1848 if (n < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1849 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
|
1850 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1851 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
|
1852 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1853 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1854 //AC Decoding |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1855 i = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1856 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1857 /* 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
|
1858 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
|
1859 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
|
1860 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
|
1861 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
|
1862 ac_val2 = ac_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1863 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1864 scale = mquant * 2 + v->halfpq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1865 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1866 if(dc_pred_dir) //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1867 ac_val -= 16; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1868 else //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1869 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
|
1870 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1871 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
|
1872 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
|
1873 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
|
1874 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
|
1875 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
|
1876 if(n==3) q2 = q1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1877 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1878 if(coded) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1879 int last = 0, skip, value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1880 const int8_t *zz_table; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1881 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1882 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1883 zz_table = wmv1_scantable[0]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1884 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1885 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1886 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
|
1887 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1888 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1889 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1890 block[zz_table[i++]] = value; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1891 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1892 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1893 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1894 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1895 /* scale predictors if needed*/ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1896 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1897 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
|
1898 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
|
1899 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1900 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1901 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1902 block[k << 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
|
1903 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1904 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
|
1905 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
|
1906 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1907 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1908 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1909 for(k = 1; k < 8; k++) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1910 block[k << 3] += ac_val[k]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1911 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1912 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
|
1913 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
|
1914 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1915 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1916 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1917 /* 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
|
1918 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
|
1919 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
|
1920 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
|
1921 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1922 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1923 /* scale AC coeffs */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1924 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
|
1925 if(block[k]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1926 block[k] *= scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1927 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1928 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
|
1929 } |
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 if(use_pred) i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1932 } else { // no AC coeffs |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1933 int k; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1934 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1935 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
|
1936 if(dc_pred_dir) {//left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1937 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1938 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
|
1939 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1940 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
|
1941 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
|
1942 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
|
1943 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
|
1944 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1945 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1946 } else {//top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1947 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1948 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
|
1949 if(q2 && q1!=q2) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1950 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
|
1951 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
|
1952 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
|
1953 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
|
1954 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1955 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1956 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1957 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1958 /* apply AC prediction if needed */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1959 if(use_pred) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1960 if(dc_pred_dir) { //left |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1961 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
|
1962 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
|
1963 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
|
1964 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
|
1965 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1966 } else { //top |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1967 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
|
1968 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
|
1969 if(!v->pquantizer && block[k]) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1970 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
|
1971 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1972 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1973 i = 63; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1974 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1975 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1976 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
|
1977 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1978 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1979 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1980 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1981 /** Decode P block |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1982 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1983 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
|
1984 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
|
1985 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1986 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1987 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1988 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1989 int subblkpat = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1990 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
|
1991 int ttblk = ttmb & 7; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1992 int pat = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1993 |
9860
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1994 s->dsp.clear_block(block); |
7e82083caab7
VC-1/WMV3 decoding: don't clear blocks unless they're actually used.
darkshikari
parents:
9859
diff
changeset
|
1995 |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1996 if(ttmb == -1) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1997 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
|
1998 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
1999 if(ttblk == TT_4X4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2000 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
|
2001 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2002 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
|
2003 subblkpat = decode012(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2004 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
|
2005 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
|
2006 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
|
2007 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2008 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
|
2009 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2010 // 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
|
2011 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
|
2012 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
|
2013 ttblk = TT_8X4; |
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 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
|
2016 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
|
2017 ttblk = TT_4X8; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2018 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2019 switch(ttblk) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2020 case TT_8X8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2021 pat = 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2022 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2023 last = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2024 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2025 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
|
2026 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2027 if(i > 63) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2028 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2029 idx = wmv1_scantable[0][i++]; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2030 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2031 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2032 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
|
2033 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2034 if(!skip_block){ |
9859
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2035 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2036 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
|
2037 else{ |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2038 s->dsp.vc1_inv_trans_8x8(block); |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2039 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
|
2040 } |
9836
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2041 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
|
2042 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
|
2043 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
|
2044 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
|
2045 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2046 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2047 case TT_4X4: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2048 pat = ~subblkpat & 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2049 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
|
2050 last = subblkpat & (1 << (3 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2051 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2052 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
|
2053 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2054 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
|
2055 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2056 if(i > 15) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2057 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2058 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
|
2059 block[idx + off] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2060 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2061 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
|
2062 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2063 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
|
2064 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2065 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
|
2066 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2067 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
|
2068 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
|
2069 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
|
2070 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
|
2071 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
|
2072 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2073 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2074 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2075 case TT_8X4: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2076 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
|
2077 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
|
2078 last = subblkpat & (1 << (1 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2079 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2080 off = j * 32; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2081 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2082 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
|
2083 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2084 if(i > 31) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2085 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2086 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
|
2087 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2088 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2089 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
|
2090 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2091 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
|
2092 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2093 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
|
2094 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2095 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
|
2096 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
|
2097 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
|
2098 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
|
2099 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
|
2100 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2101 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2102 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2103 case TT_4X8: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2104 pat = ~(subblkpat*5) & 0xF; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2105 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
|
2106 last = subblkpat & (1 << (1 - j)); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2107 i = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2108 off = j * 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2109 while (!last) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2110 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
|
2111 i += skip; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2112 if(i > 31) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2113 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2114 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
|
2115 block[idx] = value * scale; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2116 if(!v->pquantizer) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2117 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
|
2118 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2119 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
|
2120 if(i==1) |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2121 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
|
2122 else |
7a116de63777
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
darkshikari
parents:
9836
diff
changeset
|
2123 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
|
2124 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
|
2125 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
|
2126 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
|
2127 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
|
2128 } |
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 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2131 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2132 return pat; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2133 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2134 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2135 /** @} */ // Macroblock group |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2136 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2137 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
|
2138 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
|
2139 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2140 /** 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
|
2141 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2142 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
|
2143 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2144 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2145 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2146 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2147 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
|
2148 int cbp; /* cbp decoding stuff */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2149 int mqdiff, mquant; /* MB quantization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2150 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
|
2151 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2152 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
|
2153 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
|
2154 int index, index1; /* LUT indexes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2155 int val, sign; /* temp values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2156 int first_block = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2157 int dst_idx, off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2158 int skipped, fourmv; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2159 int block_cbp = 0, pat; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2160 int apply_loop_filter; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2161 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2162 mquant = v->pq; /* Loosy initialization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2163 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2164 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
|
2165 fourmv = 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 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
|
2168 if (v->skip_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2169 skipped = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2170 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2171 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
|
2172 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2173 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
|
2174 if (!fourmv) /* 1MV mode */ |
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 (!skipped) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2177 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2178 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
|
2179 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2180 if (s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2181 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
|
2182 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
|
2183 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2184 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
|
2185 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
|
2186 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2187 /* 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
|
2188 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
|
2189 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2190 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2191 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
|
2192 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2193 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2194 else if (mb_has_coeffs) |
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 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
|
2197 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
|
2198 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2199 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2200 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2201 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2202 mquant = v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2203 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2204 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2205 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
|
2206 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2207 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
|
2208 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
|
2209 VC1_TTMB_VLC_BITS, 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2210 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
|
2211 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2212 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
|
2213 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2214 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
|
2215 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2216 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2217 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
|
2218 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
|
2219 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2220 /* 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
|
2221 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
|
2222 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
|
2223 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
|
2224 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
|
2225 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
|
2226 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2227 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
|
2228 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
|
2229 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
|
2230 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
|
2231 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
|
2232 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
|
2233 if(v->c_avail) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2234 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
|
2235 if(v->a_avail) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2236 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
|
2237 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2238 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
|
2239 int left_cbp, top_cbp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2240 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2241 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
|
2242 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
|
2243 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2244 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
|
2245 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
|
2246 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2247 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2248 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
|
2249 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2250 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
|
2251 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2252 block_cbp |= 0xF << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2253 } else if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2254 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
|
2255 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
|
2256 filter = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2257 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2258 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
|
2259 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
|
2260 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2261 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
|
2262 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
|
2263 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2264 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2265 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
|
2266 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2267 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
|
2268 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2269 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
|
2270 block_cbp |= pat << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2271 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
|
2272 first_block = 0; |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2275 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2276 else //Skipped |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2277 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2278 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2279 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
|
2280 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
|
2281 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
|
2282 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2283 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
|
2284 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
|
2285 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
|
2286 vc1_mc_1mv(v, 0); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2287 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2288 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2289 } //1MV mode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2290 else //4MV mode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2291 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2292 if (!skipped /* unskipped MB */) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2293 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2294 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
|
2295 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
|
2296 /* Get CBPCY */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2297 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
|
2298 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
|
2299 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2300 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2301 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
|
2302 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2303 if(i < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2304 dmv_x = dmv_y = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2305 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2306 mb_has_coeffs = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2307 if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2308 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
|
2309 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2310 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
|
2311 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
|
2312 intra_count += s->mb_intra; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2313 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
|
2314 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
|
2315 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2316 if(i&4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2317 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
|
2318 is_coded[i] = val; |
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(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
|
2321 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
|
2322 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
|
2323 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2324 // 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
|
2325 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
|
2326 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2327 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2328 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
|
2329 /* 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
|
2330 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2331 int intrapred = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2332 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
|
2333 if(is_intra[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2334 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
|
2335 || ((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
|
2336 intrapred = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2337 break; |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2340 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
|
2341 else s->ac_pred = 0; |
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 if (!v->ttmbf && coded_inter) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2344 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
|
2345 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
|
2346 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2347 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2348 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
|
2349 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
|
2350 if (is_intra[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2351 /* 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
|
2352 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
|
2353 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
|
2354 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
|
2355 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
|
2356 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
|
2357 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2358 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
|
2359 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
|
2360 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
|
2361 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
|
2362 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
|
2363 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
|
2364 if(v->c_avail) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2365 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
|
2366 if(v->a_avail) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2367 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
|
2368 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2369 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
|
2370 int left_cbp, top_cbp; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2371 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2372 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
|
2373 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
|
2374 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2375 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
|
2376 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
|
2377 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2378 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2379 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
|
2380 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2381 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
|
2382 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2383 block_cbp |= 0xF << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2384 } else if(is_coded[i]) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2385 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
|
2386 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
|
2387 filter = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2388 if(i & 4){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2389 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
|
2390 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
|
2391 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2392 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
|
2393 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
|
2394 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2395 if(left_cbp & 0xC) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2396 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
|
2397 if(top_cbp & 0xA) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2398 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
|
2399 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2400 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
|
2401 block_cbp |= pat << (i << 2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2402 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
|
2403 first_block = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2404 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2405 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2406 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2407 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2408 else //Skipped MB |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2409 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2410 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2411 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
|
2412 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
|
2413 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
|
2414 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
|
2415 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2416 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
|
2417 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2418 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
|
2419 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
|
2420 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2421 vc1_mc_4mv_chroma(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2422 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
|
2423 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2424 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2425 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2426 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
|
2427 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2428 /* Should never happen */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2429 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2430 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2431 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2432 /** 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
|
2433 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2434 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
|
2435 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2436 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2437 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2438 int i, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2439 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
|
2440 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
|
2441 int mqdiff, mquant; /* MB quantization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2442 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
|
2443 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
|
2444 int index, index1; /* LUT indexes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2445 int val, sign; /* temp values */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2446 int first_block = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2447 int dst_idx, off; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2448 int skipped, direct; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2449 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
|
2450 int bmvtype = BMV_TYPE_BACKWARD; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2451 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2452 mquant = v->pq; /* Loosy initialization */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2453 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2454 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2455 if (v->dmb_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2456 direct = 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 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
|
2459 if (v->skip_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2460 skipped = get_bits1(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2461 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2462 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
|
2463 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2464 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
|
2465 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
|
2466 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
|
2467 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
|
2468 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2469 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
|
2470 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2471 if (!direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2472 if (!skipped) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2473 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
|
2474 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
|
2475 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
|
2476 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2477 if(skipped || !s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2478 bmvtype = decode012(gb); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2479 switch(bmvtype) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2480 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2481 bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2482 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2483 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2484 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
|
2485 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2486 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2487 bmvtype = BMV_TYPE_INTERPOLATED; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2488 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
|
2489 } |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2492 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
|
2493 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
|
2494 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2495 if (skipped) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2496 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
|
2497 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
|
2498 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
|
2499 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2500 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2501 if (direct) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2502 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
|
2503 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2504 s->mb_intra = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2505 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
|
2506 if(!v->ttmbf) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2507 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
|
2508 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
|
2509 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
|
2510 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
|
2511 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2512 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
|
2513 /* no coded blocks - effectively skipped */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2514 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
|
2515 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
|
2516 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2517 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2518 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
|
2519 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2520 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
|
2521 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
|
2522 cbp = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2523 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
|
2524 } else { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2525 if(bmvtype == BMV_TYPE_INTERPOLATED) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2526 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
|
2527 if(!mb_has_coeffs) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2528 /* interpolated skipped block */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2529 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
|
2530 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
|
2531 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2532 } |
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 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
|
2535 if(!s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2536 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
|
2537 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2538 if(s->mb_intra) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2539 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
|
2540 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
|
2541 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2542 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
|
2543 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
|
2544 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
|
2545 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2546 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2547 dst_idx = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2548 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
|
2549 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2550 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
|
2551 dst_idx += i >> 2; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2552 val = ((cbp >> (5 - i)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2553 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
|
2554 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
|
2555 if(s->mb_intra) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2556 /* 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
|
2557 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
|
2558 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
|
2559 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
|
2560 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
|
2561 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
|
2562 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2563 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
|
2564 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
|
2565 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
|
2566 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
|
2567 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
|
2568 } else if(val) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2569 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
|
2570 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
|
2571 first_block = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2572 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2573 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2574 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2575 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2576 /** Decode blocks of I-frame |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2577 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2578 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
|
2579 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2580 int k, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2581 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2582 int cbp, val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2583 uint8_t *coded_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2584 int mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2585 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2586 /* 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
|
2587 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
|
2588 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2589 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
|
2590 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2591 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2592 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
|
2593 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2594 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2595 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
|
2596 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2597 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2598 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2599 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
|
2600 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2601 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
|
2602 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2603 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2604 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
|
2605 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2606 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2607 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
|
2608 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2609 } |
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 /* 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
|
2612 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
|
2613 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
|
2614 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2615 //do frame decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2616 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
|
2617 s->mb_intra = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2618 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2619 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
|
2620 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2621 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2622 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
|
2623 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2624 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
|
2625 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
|
2626 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
|
2627 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
|
2628 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
|
2629 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
|
2630 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2631 // 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
|
2632 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
|
2633 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
|
2634 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2635 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
|
2636 val = ((cbp >> (5 - k)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2637 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2638 if (k < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2639 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
|
2640 val = val ^ pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2641 *coded_val = val; |
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 cbp |= val << (5 - k); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2644 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2645 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
|
2646 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2647 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
|
2648 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
|
2649 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
|
2650 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2651 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2652 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2653 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
|
2654 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
|
2655 if(s->mb_x) { |
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[0], s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2657 s->dsp.vc1_h_overlap(s->dest[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
|
2658 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
|
2659 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
|
2660 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
|
2661 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2662 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2663 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
|
2664 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
|
2665 if(!s->first_slice_line) { |
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[0], s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2667 s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2668 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
|
2669 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
|
2670 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
|
2671 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2672 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2673 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
|
2674 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
|
2675 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2676 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
|
2677 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2678 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
|
2679 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
|
2680 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
|
2681 return; |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2684 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
|
2685 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2686 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2687 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
|
2688 } |
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 /** 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
|
2691 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2692 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
|
2693 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2694 int k, j; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2695 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2696 int cbp, val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2697 uint8_t *coded_val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2698 int mb_pos; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2699 int mquant = v->pq; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2700 int mqdiff; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2701 int overlap; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2702 GetBitContext *gb = &s->gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2703 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2704 /* 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
|
2705 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
|
2706 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2707 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
|
2708 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2709 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2710 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
|
2711 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2712 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2713 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
|
2714 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2715 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2716 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2717 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
|
2718 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2719 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
|
2720 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2721 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2722 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
|
2723 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2724 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2725 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
|
2726 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2727 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2728 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2729 //do frame decode |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2730 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
|
2731 s->mb_intra = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2732 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2733 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
|
2734 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2735 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2736 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
|
2737 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2738 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
|
2739 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
|
2740 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
|
2741 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
|
2742 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
|
2743 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2744 // 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
|
2745 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
|
2746 if(v->acpred_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2747 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
|
2748 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2749 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
|
2750 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2751 if(v->condover == CONDOVER_SELECT) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2752 if(v->overflg_is_raw) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2753 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
|
2754 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2755 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
|
2756 } else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2757 overlap = (v->condover == CONDOVER_ALL); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2758 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2759 GET_MQUANT(); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2760 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2761 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
|
2762 /* 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
|
2763 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
|
2764 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
|
2765 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2766 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
|
2767 val = ((cbp >> (5 - k)) & 1); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2768 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2769 if (k < 4) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2770 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
|
2771 val = val ^ pred; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2772 *coded_val = val; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2773 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2774 cbp |= val << (5 - k); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2775 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2776 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
|
2777 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
|
2778 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2779 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
|
2780 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2781 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
|
2782 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
|
2783 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2784 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2785 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
|
2786 if(overlap) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2787 if(s->mb_x) { |
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[0], s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2789 s->dsp.vc1_h_overlap(s->dest[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
|
2790 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
|
2791 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
|
2792 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
|
2793 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2794 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2795 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
|
2796 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
|
2797 if(!s->first_slice_line) { |
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[0], s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2799 s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2800 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
|
2801 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
|
2802 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
|
2803 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2804 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2805 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
|
2806 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
|
2807 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2808 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
|
2809 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2810 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
|
2811 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
|
2812 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
|
2813 return; |
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 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2816 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
|
2817 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2818 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2819 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
|
2820 } |
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 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
|
2823 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2824 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2825 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2826 /* 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
|
2827 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
|
2828 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2829 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
|
2830 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2831 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2832 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
|
2833 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2834 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2835 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
|
2836 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2837 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2838 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2839 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
|
2840 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2841 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
|
2842 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2843 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2844 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
|
2845 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2846 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2847 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
|
2848 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2849 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2850 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2851 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2852 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
|
2853 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
|
2854 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2855 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2856 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
|
2857 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2858 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2859 vc1_decode_p_mb(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2860 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
|
2861 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
|
2862 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
|
2863 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2864 } |
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 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
|
2867 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
|
2868 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2869 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2870 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
|
2871 } |
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 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
|
2874 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2875 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2876 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2877 /* 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
|
2878 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
|
2879 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2880 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
|
2881 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2882 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2883 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
|
2884 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2885 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2886 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
|
2887 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2888 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2889 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2890 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
|
2891 case 0: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2892 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
|
2893 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2894 case 1: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2895 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
|
2896 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2897 case 2: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2898 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
|
2899 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2900 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2901 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2902 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2903 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
|
2904 s->mb_x = 0; |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2905 ff_init_block_index(s); |
ff0ea87dd64e
VC-1/WMV: Remove redundant ff_init_block_index() calls.
darkshikari
parents:
9860
diff
changeset
|
2906 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
|
2907 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2908 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2909 vc1_decode_b_mb(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2910 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
|
2911 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
|
2912 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
|
2913 return; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2914 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2915 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
|
2916 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2917 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
|
2918 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2919 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2920 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
|
2921 } |
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 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
|
2924 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2925 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2926 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2927 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
|
2928 s->first_slice_line = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2929 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
|
2930 s->mb_x = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2931 ff_init_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2932 ff_update_block_index(s); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2933 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
|
2934 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
|
2935 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
|
2936 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
|
2937 s->first_slice_line = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2938 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2939 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
|
2940 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2941 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2942 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
|
2943 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2944 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2945 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
|
2946 if(v->x8_type){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2947 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
|
2948 }else{ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2949 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2950 switch(v->s.pict_type) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2951 case FF_I_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2952 if(v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2953 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
|
2954 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2955 vc1_decode_i_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2956 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2957 case FF_P_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2958 if(v->p_frame_skipped) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2959 vc1_decode_skip_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2960 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2961 vc1_decode_p_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2962 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2963 case FF_B_TYPE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2964 if(v->bi_type){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2965 if(v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2966 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
|
2967 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2968 vc1_decode_i_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2969 }else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2970 vc1_decode_b_blocks(v); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2971 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2972 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2973 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2974 } |
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 /** Initialize a VC1/WMV3 decoder |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2977 * @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
|
2978 * @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
|
2979 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2980 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
|
2981 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2982 VC1Context *v = avctx->priv_data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2983 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2984 GetBitContext gb; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2985 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2986 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
|
2987 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
|
2988 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
|
2989 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2990 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
|
2991 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
|
2992 v->s.avctx = avctx; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2993 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
|
2994 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
|
2995 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2996 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
|
2997 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
|
2998 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
2999 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3000 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
|
3001 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3002 if (vc1_init_common(v) < 0) return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3003 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3004 avctx->coded_width = avctx->width; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3005 avctx->coded_height = avctx->height; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3006 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
|
3007 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3008 int count = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3009 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3010 // 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
|
3011 // 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
|
3012 // 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
|
3013 // samples we can decode |
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 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
|
3016 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3017 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
|
3018 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3019 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3020 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
|
3021 if (count>0) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3022 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3023 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
|
3024 count, get_bits(&gb, count)); |
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 else if (count < 0) |
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 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
|
3029 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3030 } else { // VC1/WVC1 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3031 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
|
3032 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
|
3033 const uint8_t *next; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3034 int size, buf2_size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3035 uint8_t *buf2 = NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3036 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
|
3037 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3038 if(avctx->extradata_size < 16) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3039 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
|
3040 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3041 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3042 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3043 buf2 = av_mallocz(avctx->extradata_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
|
3044 if(start[0]) start++; // in WVC1 extradata first byte is its size |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3045 next = start; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3046 for(; next < end; start = next){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3047 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
|
3048 size = next - start - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3049 if(size <= 0) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3050 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
|
3051 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
|
3052 switch(AV_RB32(start)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3053 case VC1_CODE_SEQHDR: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3054 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
|
3055 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3056 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3057 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3058 seq_initialized = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3059 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3060 case VC1_CODE_ENTRYPOINT: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3061 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
|
3062 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3063 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3064 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3065 ep_initialized = 1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3066 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3067 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3068 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3069 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3070 if(!seq_initialized || !ep_initialized){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3071 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
|
3072 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3073 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3074 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3075 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
|
3076 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
|
3077 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3078 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
|
3079 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
|
3080 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3081 /* Allocate mb bitplanes */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3082 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
|
3083 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
|
3084 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
|
3085 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
|
3086 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3087 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
|
3088 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
|
3089 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3090 /* 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
|
3091 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
|
3092 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
|
3093 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
|
3094 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
|
3095 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3096 /* Init coded blocks info */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3097 if (v->profile == PROFILE_ADVANCED) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3098 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3099 // 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
|
3100 // return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3101 // 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
|
3102 // return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3103 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3104 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3105 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
|
3106 return 0; |
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 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3109 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3110 /** Decode a VC1/WMV3 frame |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3111 * @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
|
3112 */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3113 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
|
3114 void *data, int *data_size, |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3115 AVPacket *avpkt) |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3116 { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3117 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
|
3118 int buf_size = avpkt->size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3119 VC1Context *v = avctx->priv_data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3120 MpegEncContext *s = &v->s; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3121 AVFrame *pict = data; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3122 uint8_t *buf2 = NULL; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3123 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
|
3124 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3125 /* no supplementary picture */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3126 if (buf_size == 0) { |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3127 /* special case for last picture */ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3128 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
|
3129 *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
|
3130 s->next_picture_ptr= NULL; |
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 *data_size = sizeof(AVFrame); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3133 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3134 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3135 return 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3136 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3137 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3138 /* 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
|
3139 * 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
|
3140 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
|
3141 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
|
3142 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
|
3143 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3144 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3145 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
|
3146 if (v->profile < PROFILE_ADVANCED) |
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_WMV3; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3148 else |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3149 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
|
3150 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3151 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3152 //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
|
3153 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
|
3154 int buf_size2 = 0; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3155 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
|
3156 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3157 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
|
3158 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
|
3159 int size; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3160 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3161 next = buf; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3162 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
|
3163 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
|
3164 size = next - start - 4; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3165 if(size <= 0) continue; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3166 switch(AV_RB32(start)){ |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3167 case VC1_CODE_FRAME: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3168 if (avctx->hwaccel || |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3169 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
|
3170 buf_start = start; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3171 buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3172 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3173 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
|
3174 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
|
3175 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
|
3176 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
|
3177 break; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3178 case VC1_CODE_SLICE: |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3179 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
|
3180 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3181 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3182 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3183 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3184 }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
|
3185 const uint8_t *divider; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3186 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3187 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
|
3188 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
|
3189 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
|
3190 av_free(buf2); |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3191 return -1; |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3192 } |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3193 |
e678b20368cd
Split decoder-specific code off from vc1.c into vc1dec.c and keep code
diego
parents:
diff
changeset
|
3194 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
|
3195 // TODO |
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 |