Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
520aa705
Commit
520aa705
authored
Nov 22, 2013
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Nov 22, 2013
Browse files
Merge "Organizing all scan tables into lookup table."
parents
28e44bbb
350731e8
Changes
8
Hide whitespace changes
Inline
Side-by-side
vp9/common/vp9_entropy.h
View file @
520aa705
...
...
@@ -185,22 +185,18 @@ static int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
return
combine_entropy_contexts
(
above_ec
,
left_ec
);
}
static
void
get_scan
(
const
MACROBLOCKD
*
xd
,
TX_SIZE
tx_size
,
PLANE_TYPE
type
,
int
block_idx
,
const
int16_t
**
scan
,
const
int16_t
**
scan_nb
)
{
static
const
scan_order
*
get_scan
(
const
MACROBLOCKD
*
xd
,
TX_SIZE
tx_size
,
PLANE_TYPE
type
,
int
block_idx
)
{
const
MODE_INFO
*
const
mi
=
xd
->
mi_8x8
[
0
];
const
MB_MODE_INFO
*
const
mbmi
=
&
mi
->
mbmi
;
const
scan_order
*
so
;
if
(
is_inter_block
(
mbmi
)
||
type
!=
PLANE_TYPE_Y_WITH_DC
||
xd
->
lossless
)
{
so
=
&
inter
_scan_orders
[
tx_size
];
return
&
vp9_default
_scan_orders
[
tx_size
];
}
else
{
const
MB_PREDICTION_MODE
mode
=
mbmi
->
sb_type
<
BLOCK_8X8
?
mi
->
bmi
[
block_idx
].
as_mode
:
mbmi
->
mode
;
so
=
&
intra
_scan_orders
[
tx_size
][
mode
];
return
&
vp9
_scan_orders
[
tx_size
][
mode
2txfm_map
[
mode
]
];
}
*
scan
=
so
->
scan
;
*
scan_nb
=
so
->
neighbors
;
}
#endif // VP9_COMMON_VP9_ENTROPY_H_
vp9/common/vp9_enums.h
View file @
520aa705
...
...
@@ -73,7 +73,8 @@ typedef enum {
DCT_DCT
=
0
,
// DCT in both horizontal and vertical
ADST_DCT
=
1
,
// ADST in vertical, DCT in horizontal
DCT_ADST
=
2
,
// DCT in vertical, ADST in horizontal
ADST_ADST
=
3
// ADST in both directions
ADST_ADST
=
3
,
// ADST in both directions
TX_TYPES
=
4
}
TX_TYPE
;
typedef
enum
{
...
...
vp9/common/vp9_scan.c
View file @
520aa705
...
...
@@ -12,28 +12,28 @@
#include
"vp9/common/vp9_scan.h"
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
default_scan_4x4
[
16
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
default_scan_4x4
[
16
])
=
{
0
,
4
,
1
,
5
,
8
,
2
,
12
,
9
,
3
,
6
,
13
,
10
,
7
,
14
,
11
,
15
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
col_scan_4x4
[
16
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
col_scan_4x4
[
16
])
=
{
0
,
4
,
8
,
1
,
12
,
5
,
9
,
2
,
13
,
6
,
10
,
3
,
7
,
14
,
11
,
15
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
row_scan_4x4
[
16
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
row_scan_4x4
[
16
])
=
{
0
,
1
,
4
,
2
,
5
,
3
,
6
,
8
,
9
,
7
,
12
,
10
,
13
,
11
,
14
,
15
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
default_scan_8x8
[
64
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
default_scan_8x8
[
64
])
=
{
0
,
8
,
1
,
16
,
9
,
2
,
17
,
24
,
10
,
3
,
18
,
25
,
32
,
11
,
4
,
26
,
33
,
19
,
40
,
12
,
34
,
27
,
5
,
41
,
...
...
@@ -44,7 +44,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_8x8[64]) = {
46
,
39
,
61
,
54
,
47
,
62
,
55
,
63
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
col_scan_8x8
[
64
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
col_scan_8x8
[
64
])
=
{
0
,
8
,
16
,
1
,
24
,
9
,
32
,
17
,
2
,
40
,
25
,
10
,
33
,
18
,
48
,
3
,
26
,
41
,
11
,
56
,
19
,
34
,
4
,
49
,
...
...
@@ -55,7 +55,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_8x8[64]) = {
31
,
61
,
39
,
54
,
47
,
62
,
55
,
63
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
row_scan_8x8
[
64
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
row_scan_8x8
[
64
])
=
{
0
,
1
,
2
,
8
,
9
,
3
,
16
,
10
,
4
,
17
,
11
,
24
,
5
,
18
,
25
,
12
,
19
,
26
,
32
,
6
,
13
,
20
,
33
,
27
,
...
...
@@ -66,7 +66,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_8x8[64]) = {
60
,
39
,
61
,
47
,
54
,
55
,
62
,
63
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
default_scan_16x16
[
256
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
default_scan_16x16
[
256
])
=
{
0
,
16
,
1
,
32
,
17
,
2
,
48
,
33
,
18
,
3
,
64
,
34
,
49
,
19
,
65
,
80
,
50
,
4
,
35
,
66
,
20
,
81
,
96
,
51
,
5
,
36
,
82
,
97
,
67
,
112
,
21
,
52
,
98
,
37
,
83
,
113
,
6
,
68
,
128
,
53
,
22
,
99
,
114
,
84
,
7
,
129
,
38
,
69
,
...
...
@@ -87,7 +87,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_16x16[256]) = {
255
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
col_scan_16x16
[
256
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
col_scan_16x16
[
256
])
=
{
0
,
16
,
32
,
48
,
1
,
64
,
17
,
80
,
33
,
96
,
49
,
2
,
65
,
112
,
18
,
81
,
34
,
128
,
50
,
97
,
3
,
66
,
144
,
19
,
113
,
35
,
82
,
160
,
98
,
51
,
129
,
4
,
67
,
176
,
20
,
114
,
145
,
83
,
36
,
99
,
130
,
52
,
192
,
5
,
161
,
68
,
115
,
21
,
...
...
@@ -108,7 +108,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_16x16[256]) = {
255
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
row_scan_16x16
[
256
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
row_scan_16x16
[
256
])
=
{
0
,
1
,
2
,
16
,
3
,
17
,
4
,
18
,
32
,
5
,
33
,
19
,
6
,
34
,
48
,
20
,
49
,
7
,
35
,
21
,
50
,
64
,
8
,
36
,
65
,
22
,
51
,
37
,
80
,
9
,
66
,
52
,
23
,
38
,
81
,
67
,
10
,
53
,
24
,
82
,
68
,
96
,
39
,
11
,
54
,
83
,
97
,
69
,
...
...
@@ -130,7 +130,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_16x16[256]) = {
255
,
};
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_
default_scan_32x32
[
1024
])
=
{
DECLARE_ALIGNED
(
16
,
static
const
int16_t
,
default_scan_32x32
[
1024
])
=
{
0
,
32
,
1
,
64
,
33
,
2
,
96
,
65
,
34
,
128
,
3
,
97
,
66
,
160
,
129
,
35
,
98
,
4
,
67
,
130
,
161
,
192
,
36
,
99
,
224
,
5
,
162
,
193
,
68
,
131
,
37
,
100
,
...
...
@@ -233,95 +233,69 @@ DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_32x32[1024]) = {
// in {top, left, topleft, topright, bottomleft} order
// for each position in raster scan order.
// -1 indicates the neighbor does not exist.
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
default_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
col_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
row_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
col_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
row_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
default_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
col_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
row_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
default_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_
default_scan_32x32_neighbors
[
1025
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
default_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
col_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
row_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
col_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
row_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
default_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
col_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
row_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
default_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
default_scan_32x32_neighbors
[
1025
*
MAX_NEIGHBORS
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_default_iscan_4x4
[
16
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_col_iscan_4x4
[
16
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_row_iscan_4x4
[
16
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_col_iscan_8x8
[
64
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_row_iscan_8x8
[
64
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_default_iscan_8x8
[
64
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_col_iscan_16x16
[
256
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_row_iscan_16x16
[
256
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_default_iscan_16x16
[
256
]);
DECLARE_ALIGNED
(
16
,
static
int16_t
,
vp9_default_iscan_32x32
[
1024
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_iscan_4x4
[
16
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_iscan_4x4
[
16
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_iscan_4x4
[
16
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_iscan_8x8
[
64
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_iscan_8x8
[
64
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_iscan_8x8
[
64
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_iscan_16x16
[
256
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_iscan_16x16
[
256
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_iscan_16x16
[
256
]);
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_iscan_32x32
[
1024
]);
const
scan_order
inter_scan_orders
[
TX_SIZES
]
=
{
{
vp9_default_scan_4x4
,
vp9_default_scan_4x4_neighbors
},
// NEWMV
{
vp9_default_scan_8x8
,
vp9_default_scan_8x8_neighbors
},
// NEWMV
{
vp9_default_scan_16x16
,
vp9_default_scan_16x16_neighbors
},
// NEWMV
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// NEWMV
const
scan_order
vp9_default_scan_orders
[
TX_SIZES
]
=
{
{
default_scan_4x4
,
vp9_default_iscan_4x4
,
default_scan_4x4_neighbors
},
{
default_scan_8x8
,
vp9_default_iscan_8x8
,
default_scan_8x8_neighbors
},
{
default_scan_16x16
,
vp9_default_iscan_16x16
,
default_scan_16x16_neighbors
},
{
default_scan_32x32
,
vp9_default_iscan_32x32
,
default_scan_32x32_neighbors
},
};
const
scan_order
intra_scan_orders
[
TX_SIZES
][
INTRA_MODES
]
=
{
{
// 4X4
{
vp9_default_scan_4x4
,
vp9_default_scan_4x4_neighbors
},
// DC
{
vp9_row_scan_4x4
,
vp9_row_scan_4x4_neighbors
},
// V
{
vp9_col_scan_4x4
,
vp9_col_scan_4x4_neighbors
},
// H
{
vp9_default_scan_4x4
,
vp9_default_scan_4x4_neighbors
},
// D45
{
vp9_default_scan_4x4
,
vp9_default_scan_4x4_neighbors
},
// D135
{
vp9_row_scan_4x4
,
vp9_row_scan_4x4_neighbors
},
// D117
{
vp9_col_scan_4x4
,
vp9_col_scan_4x4_neighbors
},
// D153
{
vp9_col_scan_4x4
,
vp9_col_scan_4x4_neighbors
},
// D207
{
vp9_row_scan_4x4
,
vp9_row_scan_4x4_neighbors
},
// D63
{
vp9_default_scan_4x4
,
vp9_default_scan_4x4_neighbors
},
// TM
},
{
// 8x8
{
vp9_default_scan_8x8
,
vp9_default_scan_8x8_neighbors
},
// DC
{
vp9_row_scan_8x8
,
vp9_row_scan_8x8_neighbors
},
// V
{
vp9_col_scan_8x8
,
vp9_col_scan_8x8_neighbors
},
// H
{
vp9_default_scan_8x8
,
vp9_default_scan_8x8_neighbors
},
// D45
{
vp9_default_scan_8x8
,
vp9_default_scan_8x8_neighbors
},
// D135
{
vp9_row_scan_8x8
,
vp9_row_scan_8x8_neighbors
},
// D117
{
vp9_col_scan_8x8
,
vp9_col_scan_8x8_neighbors
},
// D153
{
vp9_col_scan_8x8
,
vp9_col_scan_8x8_neighbors
},
// D207
{
vp9_row_scan_8x8
,
vp9_row_scan_8x8_neighbors
},
// D63
{
vp9_default_scan_8x8
,
vp9_default_scan_8x8_neighbors
},
// TM
},
{
// 16x16
{
vp9_default_scan_16x16
,
vp9_default_scan_16x16_neighbors
},
// DC
{
vp9_row_scan_16x16
,
vp9_row_scan_16x16_neighbors
},
// V
{
vp9_col_scan_16x16
,
vp9_col_scan_16x16_neighbors
},
// H
{
vp9_default_scan_16x16
,
vp9_default_scan_16x16_neighbors
},
// D45
{
vp9_default_scan_16x16
,
vp9_default_scan_16x16_neighbors
},
// D135
{
vp9_row_scan_16x16
,
vp9_row_scan_16x16_neighbors
},
// D117
{
vp9_col_scan_16x16
,
vp9_col_scan_16x16_neighbors
},
// D153
{
vp9_col_scan_16x16
,
vp9_col_scan_16x16_neighbors
},
// D207
{
vp9_row_scan_16x16
,
vp9_row_scan_16x16_neighbors
},
// D63
{
vp9_default_scan_16x16
,
vp9_default_scan_16x16_neighbors
},
// TM
},
{
// 32x32
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// DC
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// V
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// H
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// D45
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// D135
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// D117
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// D153
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// D207
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// D63
{
vp9_default_scan_32x32
,
vp9_default_scan_32x32_neighbors
},
// TM
const
scan_order
vp9_scan_orders
[
TX_SIZES
][
TX_TYPES
]
=
{
{
// TX_4X4
{
default_scan_4x4
,
vp9_default_iscan_4x4
,
default_scan_4x4_neighbors
},
{
row_scan_4x4
,
vp9_row_iscan_4x4
,
row_scan_4x4_neighbors
},
{
col_scan_4x4
,
vp9_col_iscan_4x4
,
col_scan_4x4_neighbors
},
{
default_scan_4x4
,
vp9_default_iscan_4x4
,
default_scan_4x4_neighbors
}
},
{
// TX_8X8
{
default_scan_8x8
,
vp9_default_iscan_8x8
,
default_scan_8x8_neighbors
},
{
row_scan_8x8
,
vp9_row_iscan_8x8
,
row_scan_8x8_neighbors
},
{
col_scan_8x8
,
vp9_col_iscan_8x8
,
col_scan_8x8_neighbors
},
{
default_scan_8x8
,
vp9_default_iscan_8x8
,
default_scan_8x8_neighbors
}
},
{
// TX_16X16
{
default_scan_16x16
,
vp9_default_iscan_16x16
,
default_scan_16x16_neighbors
},
{
row_scan_16x16
,
vp9_row_iscan_16x16
,
row_scan_16x16_neighbors
},
{
col_scan_16x16
,
vp9_col_iscan_16x16
,
col_scan_16x16_neighbors
},
{
default_scan_16x16
,
vp9_default_iscan_16x16
,
default_scan_16x16_neighbors
}
},
{
// TX_32X32
{
default_scan_32x32
,
vp9_default_iscan_32x32
,
default_scan_32x32_neighbors
},
{
default_scan_32x32
,
vp9_default_iscan_32x32
,
default_scan_32x32_neighbors
},
{
default_scan_32x32
,
vp9_default_iscan_32x32
,
default_scan_32x32_neighbors
},
{
default_scan_32x32
,
vp9_default_iscan_32x32
,
default_scan_32x32_neighbors
},
}
};
static
int
find_in_scan
(
const
int16_t
*
scan
,
int
l
,
int
idx
)
{
int
n
,
l2
=
l
*
l
;
for
(
n
=
0
;
n
<
l2
;
n
++
)
{
...
...
@@ -332,9 +306,9 @@ static int find_in_scan(const int16_t *scan, int l, int idx) {
assert
(
0
);
return
-
1
;
}
static
void
init_scan_neighbors
(
const
int16_t
*
scan
,
int16_t
*
iscan
,
int
l
,
int16_t
*
neighbors
)
{
static
void
init_scan_neighbors
(
const
int16_t
*
scan
,
int16_t
*
iscan
,
int
l
,
int16_t
*
neighbors
)
{
int
l2
=
l
*
l
;
int
n
,
i
,
j
;
...
...
@@ -358,15 +332,15 @@ static void init_scan_neighbors(const int16_t *scan,
// use the combination of the two as a context.
int
a
=
(
i
-
1
)
*
l
+
j
;
int
b
=
i
*
l
+
j
-
1
;
if
(
scan
==
vp9_
col_scan_4x4
||
scan
==
vp9_
col_scan_8x8
||
scan
==
vp9_
col_scan_16x16
)
{
if
(
scan
==
col_scan_4x4
||
scan
==
col_scan_8x8
||
scan
==
col_scan_16x16
)
{
// in the col/row scan cases (as well as left/top edge cases), we set
// both contexts to the same value, so we can branchlessly do a+b+1>>1
// which automatically becomes a if a == b
neighbors
[
MAX_NEIGHBORS
*
n
+
0
]
=
neighbors
[
MAX_NEIGHBORS
*
n
+
1
]
=
a
;
}
else
if
(
scan
==
vp9_
row_scan_4x4
||
scan
==
vp9_
row_scan_8x8
||
scan
==
vp9_
row_scan_16x16
)
{
}
else
if
(
scan
==
row_scan_4x4
||
scan
==
row_scan_8x8
||
scan
==
row_scan_16x16
)
{
neighbors
[
MAX_NEIGHBORS
*
n
+
0
]
=
neighbors
[
MAX_NEIGHBORS
*
n
+
1
]
=
b
;
}
else
{
...
...
@@ -390,24 +364,24 @@ static void init_scan_neighbors(const int16_t *scan,
}
void
vp9_init_neighbors
()
{
init_scan_neighbors
(
vp9_
default_scan_4x4
,
vp9_default_iscan_4x4
,
4
,
vp9_
default_scan_4x4_neighbors
);
init_scan_neighbors
(
vp9_
row_scan_4x4
,
vp9_row_iscan_4x4
,
4
,
vp9_
row_scan_4x4_neighbors
);
init_scan_neighbors
(
vp9_
col_scan_4x4
,
vp9_col_iscan_4x4
,
4
,
vp9_
col_scan_4x4_neighbors
);
init_scan_neighbors
(
vp9_
default_scan_8x8
,
vp9_default_iscan_8x8
,
8
,
vp9_
default_scan_8x8_neighbors
);
init_scan_neighbors
(
vp9_
row_scan_8x8
,
vp9_row_iscan_8x8
,
8
,
vp9_
row_scan_8x8_neighbors
);
init_scan_neighbors
(
vp9_
col_scan_8x8
,
vp9_col_iscan_8x8
,
8
,
vp9_
col_scan_8x8_neighbors
);
init_scan_neighbors
(
vp9_
default_scan_16x16
,
vp9_default_iscan_16x16
,
16
,
vp9_
default_scan_16x16_neighbors
);
init_scan_neighbors
(
vp9_
row_scan_16x16
,
vp9_row_iscan_16x16
,
16
,
vp9_
row_scan_16x16_neighbors
);
init_scan_neighbors
(
vp9_
col_scan_16x16
,
vp9_col_iscan_16x16
,
16
,
vp9_
col_scan_16x16_neighbors
);
init_scan_neighbors
(
vp9_
default_scan_32x32
,
vp9_default_iscan_32x32
,
32
,
vp9_
default_scan_32x32_neighbors
);
init_scan_neighbors
(
default_scan_4x4
,
vp9_default_iscan_4x4
,
4
,
default_scan_4x4_neighbors
);
init_scan_neighbors
(
row_scan_4x4
,
vp9_row_iscan_4x4
,
4
,
row_scan_4x4_neighbors
);
init_scan_neighbors
(
col_scan_4x4
,
vp9_col_iscan_4x4
,
4
,
col_scan_4x4_neighbors
);
init_scan_neighbors
(
default_scan_8x8
,
vp9_default_iscan_8x8
,
8
,
default_scan_8x8_neighbors
);
init_scan_neighbors
(
row_scan_8x8
,
vp9_row_iscan_8x8
,
8
,
row_scan_8x8_neighbors
);
init_scan_neighbors
(
col_scan_8x8
,
vp9_col_iscan_8x8
,
8
,
col_scan_8x8_neighbors
);
init_scan_neighbors
(
default_scan_16x16
,
vp9_default_iscan_16x16
,
16
,
default_scan_16x16_neighbors
);
init_scan_neighbors
(
row_scan_16x16
,
vp9_row_iscan_16x16
,
16
,
row_scan_16x16_neighbors
);
init_scan_neighbors
(
col_scan_16x16
,
vp9_col_iscan_16x16
,
16
,
col_scan_16x16_neighbors
);
init_scan_neighbors
(
default_scan_32x32
,
vp9_default_iscan_32x32
,
32
,
default_scan_32x32_neighbors
);
}
vp9/common/vp9_scan.h
View file @
520aa705
...
...
@@ -19,184 +19,16 @@
#define MAX_NEIGHBORS 2
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_default_scan_4x4
[
16
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_col_scan_4x4
[
16
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_row_scan_4x4
[
16
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_default_scan_8x8
[
64
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_col_scan_8x8
[
64
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_row_scan_8x8
[
64
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_default_scan_16x16
[
256
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_col_scan_16x16
[
256
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_row_scan_16x16
[
256
]);
extern
DECLARE_ALIGNED
(
16
,
const
int16_t
,
vp9_default_scan_32x32
[
1024
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_iscan_4x4
[
16
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_iscan_4x4
[
16
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_iscan_4x4
[
16
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_iscan_8x8
[
64
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_iscan_8x8
[
64
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_iscan_8x8
[
64
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_iscan_16x16
[
256
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_iscan_16x16
[
256
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_iscan_16x16
[
256
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_iscan_32x32
[
1024
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_scan_4x4_neighbors
[
17
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_scan_8x8_neighbors
[
65
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_col_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_row_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_scan_16x16_neighbors
[
257
*
MAX_NEIGHBORS
]);
extern
DECLARE_ALIGNED
(
16
,
int16_t
,
vp9_default_scan_32x32_neighbors
[
1025
*
MAX_NEIGHBORS
]);
void
vp9_init_neighbors
();
typedef
struct
{
const
int16_t
*
scan
;
const
int16_t
*
iscan
;
const
int16_t
*
neighbors
;
}
scan_order
;
extern
const
scan_order
intra_scan_orders
[
TX_SIZES
][
INTRA_MODES
];
extern
const
scan_order
inter_scan_orders
[
TX_SIZES
];
static
INLINE
const
int16_t
*
get_scan_4x4
(
TX_TYPE
tx_type
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
return
vp9_row_scan_4x4
;
case
DCT_ADST
:
return
vp9_col_scan_4x4
;
default:
return
vp9_default_scan_4x4
;
}
}
static
INLINE
void
get_scan_nb_4x4
(
TX_TYPE
tx_type
,
const
int16_t
**
scan
,
const
int16_t
**
nb
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
*
scan
=
vp9_row_scan_4x4
;
*
nb
=
vp9_row_scan_4x4_neighbors
;
break
;
case
DCT_ADST
:
*
scan
=
vp9_col_scan_4x4
;
*
nb
=
vp9_col_scan_4x4_neighbors
;
break
;
default:
*
scan
=
vp9_default_scan_4x4
;
*
nb
=
vp9_default_scan_4x4_neighbors
;
break
;
}
}
static
INLINE
const
int16_t
*
get_iscan_4x4
(
TX_TYPE
tx_type
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
return
vp9_row_iscan_4x4
;
case
DCT_ADST
:
return
vp9_col_iscan_4x4
;
default:
return
vp9_default_iscan_4x4
;
}
}
static
INLINE
const
int16_t
*
get_scan_8x8
(
TX_TYPE
tx_type
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
return
vp9_row_scan_8x8
;
case
DCT_ADST
:
return
vp9_col_scan_8x8
;
default:
return
vp9_default_scan_8x8
;
}
}
static
INLINE
void
get_scan_nb_8x8
(
TX_TYPE
tx_type
,
const
int16_t
**
scan
,
const
int16_t
**
nb
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
*
scan
=
vp9_row_scan_8x8
;
*
nb
=
vp9_row_scan_8x8_neighbors
;
break
;
case
DCT_ADST
:
*
scan
=
vp9_col_scan_8x8
;
*
nb
=
vp9_col_scan_8x8_neighbors
;
break
;
default:
*
scan
=
vp9_default_scan_8x8
;
*
nb
=
vp9_default_scan_8x8_neighbors
;
break
;
}
}
static
INLINE
const
int16_t
*
get_iscan_8x8
(
TX_TYPE
tx_type
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
return
vp9_row_iscan_8x8
;
case
DCT_ADST
:
return
vp9_col_iscan_8x8
;
default:
return
vp9_default_iscan_8x8
;
}
}
static
INLINE
const
int16_t
*
get_scan_16x16
(
TX_TYPE
tx_type
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
return
vp9_row_scan_16x16
;
case
DCT_ADST
:
return
vp9_col_scan_16x16
;
default:
return
vp9_default_scan_16x16
;
}
}
static
INLINE
void
get_scan_nb_16x16
(
TX_TYPE
tx_type
,
const
int16_t
**
scan
,
const
int16_t
**
nb
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
*
scan
=
vp9_row_scan_16x16
;
*
nb
=
vp9_row_scan_16x16_neighbors
;
break
;
case
DCT_ADST
:
*
scan
=
vp9_col_scan_16x16
;
*
nb
=
vp9_col_scan_16x16_neighbors
;
break
;
default:
*
scan
=
vp9_default_scan_16x16
;
*
nb
=
vp9_default_scan_16x16_neighbors
;
break
;
}
}
static
INLINE
const
int16_t
*
get_iscan_16x16
(
TX_TYPE
tx_type
)
{
switch
(
tx_type
)
{
case
ADST_DCT
:
return
vp9_row_iscan_16x16
;
case
DCT_ADST
:
return
vp9_col_iscan_16x16
;
default:
return
vp9_default_iscan_16x16
;
}
}
extern
const
scan_order
vp9_default_scan_orders
[
TX_SIZES
];
extern
const
scan_order
vp9_scan_orders
[
TX_SIZES
][
TX_TYPES
];
static
INLINE
int
get_coef_context
(
const
int16_t
*
neighbors
,
const
uint8_t
*
token_cache
,
int
c
)
{
...
...
vp9/decoder/vp9_detokenize.c
View file @
520aa705
...
...
@@ -108,14 +108,16 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
counts
->
coef
[
tx_size
][
type
][
ref
];
unsigned
int
(
*
eob_branch_count
)[
PREV_COEF_CONTEXTS
]
=
counts
->
eob_branch
[
tx_size
][
type
][
ref
];
const
int16_t
*
scan
,
*
nb
;
const
uint8_t
*
cat6
;
const
uint8_t
*
band_translate
=
get_band_translate
(
tx_size
);
const
int
dq_shift
=
(
tx_size
==
TX_32X32
);
const
scan_order
*
so
=
get_scan
(
xd
,
tx_size
,
type
,
block_idx
);
const
int16_t
*
scan
=
so
->
scan
;
const
int16_t
*
nb
=
so
->
neighbors
;
int
v
;
int16_t
dqv
=
dq
[
0
];
get_scan
(
xd
,
tx_size
,
type
,
block_idx
,
&
scan
,
&
nb
);
while
(
c
<
seg_eob
)
{
int
val
;
...
...
vp9/encoder/vp9_encodemb.c
View file @
520aa705
...
...
@@ -152,16 +152,18 @@ static void optimize_b(MACROBLOCK *mb,
PLANE_TYPE
type
=
pd
->
plane_type
;
int
err_mult
=
plane_rd_mult
[
type
];
const
int
default_eob
=
16
<<
(
tx_size
<<
1
);
const
int16_t
*
scan
,
*
nb
;
const
int
mul
=
1
+
(
tx_size
==
TX_32X32
);
uint8_t
token_cache
[
1024
];
const
int16_t
*
dequant_ptr
=
pd
->
dequant
;
const
uint8_t
*
const
band_translate
=
get_band_translate
(
tx_size
);
const
scan_order
*
so
=
get_scan
(
xd
,
tx_size
,
type
,
block
);
const
int16_t
*
scan
=
so
->
scan
;
const
int16_t
*
nb
=
so
->
neighbors
;
assert
((
!
type
&&
!
plane
)
||
(
type
&&
plane
));
dqcoeff_ptr
=
BLOCK_OFFSET
(
pd
->
dqcoeff
,
block
);
qcoeff_ptr
=
BLOCK_OFFSET
(
pd
->
qcoeff
,
block
);
get_scan
(
xd
,
tx_size
,
type
,
block
,
&
scan
,
&
nb
);
assert
(
eob
<=
default_eob
);
/* Now set up a Viterbi trellis to evaluate alternative roundings. */
...
...
@@ -368,7 +370,7 @@ void vp9_xform_quant(int plane, int block, BLOCK_SIZE plane_bsize,
int16_t
*
coeff
=
BLOCK_OFFSET
(
p
->
coeff
,
block
);
int16_t
*
qcoeff
=
BLOCK_OFFSET
(
pd
->
qcoeff
,
block
);
int16_t
*
dqcoeff
=
BLOCK_OFFSET
(
pd
->
dqcoeff
,
block
);
const
int16_t
*
scan
,
*
iscan
;
const
scan_order
*
so
;
uint16_t
*
eob
=
&
pd
->
eobs
[
block
];
const
int
bwl
=
b_width_log2
(
plane_bsize
),
bw
=
1
<<
bwl
;
const
int
twl
=
bwl
-
tx_size
,
twmask
=
(
1
<<
twl
)
-
1
;
...
...
@@ -377,8 +379,7 @@ void vp9_xform_quant(int plane, int block, BLOCK_SIZE plane_bsize,
switch
(
tx_size
)
{
case
TX_32X32
:
scan
=
vp9_default_scan_32x32
;