Skip to content
GitLab
Menu
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
3422ac17
Commit
3422ac17
authored
Oct 25, 2017
by
Jingning Han
Browse files
Merge eob-first into lv-map
Change-Id: Ib36a8df1a3ebddbf4320fb7b9b5537041bddc3a3
parent
36773c7a
Changes
9
Hide whitespace changes
Inline
Side-by-side
av1/common/entropy.c
View file @
3422ac17
...
...
@@ -2196,9 +2196,7 @@ void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
AVERAGE_TILE_CDFS
(
txb_skip_cdf
)
AVERAGE_TILE_CDFS
(
nz_map_cdf
)
AVERAGE_TILE_CDFS
(
eob_flag_cdf
)
#if CONFIG_EOB_FIRST
AVERAGE_TILE_CDFS
(
eob_extra_cdf
)
#endif
AVERAGE_TILE_CDFS
(
dc_sign_cdf
)
AVERAGE_TILE_CDFS
(
coeff_base_cdf
)
AVERAGE_TILE_CDFS
(
coeff_lps_cdf
)
...
...
av1/common/entropymode.c
View file @
3422ac17
...
...
@@ -144,9 +144,7 @@ const aom_prob default_coeff_base
};
const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] =
{
#if CONFIG_EOB_FIRST
{ { 42, 58, 129, 82, 37, 16, 117, 117, 66, 31, 17, 63,
{ { { 42, 58, 129, 82, 37, 16, 117, 117, 66, 31, 17, 63,
98, 40, 128, 128, 136, 130, 95, 43, 128, 154, 143, 98,
41, 128, 103, 141, 69, 128, 128, 128, 130, 131, 95, 39,
128, 147, 146, 94, 38, 128, 102, 143, 63, 128, 128, 128 },
...
...
@@ -177,123 +175,7 @@ const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] =
{ 72, 215, 186, 137, 72, 43, 239, 209, 164, 136, 64, 251,
215, 173, 130, 17, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }
#else
#if CONFIG_EXT_TX
{ { 56, 137, 82, 136, 83, 187, 124, 65,
215, 118, 155, 97, 160, 111, 71, 55,
142, 156, 91, 226, 107, 231, 146, 65,
105, 91, 232, 97, 185, 121, 90, 74,
153, 195, 123, 154, 106, 196, 143, 67,
232, 125, 121, 105, 159, 113, 88, 66 },
{ 50, 124, 89, 135, 116, 189, 150, 81,
202, 126, 130, 107, 149, 110, 85, 67,
139, 174, 112, 200, 94, 206, 146, 71,
163, 164, 212, 99, 177, 143, 125, 85,
151, 181, 126, 168, 135, 186, 143, 94,
207, 129, 142, 135, 145, 112, 98, 81 } },
{ { 57, 156, 91, 162, 99, 212, 149, 81,
223, 128, 182, 121, 216, 163, 119, 94,
139, 183, 100, 206, 98, 242, 163, 79,
200, 127, 234, 112, 230, 169, 115, 90,
156, 190, 130, 172, 117, 209, 163, 80,
217, 145, 182, 135, 204, 163, 120, 88 },
{ 48, 133, 102, 143, 119, 190, 170, 109,
197, 127, 176, 137, 214, 168, 130, 119,
139, 185, 129, 210, 84, 237, 177, 75,
182, 165, 216, 121, 206, 177, 147, 102,
159, 192, 153, 182, 139, 203, 160, 125,
193, 161, 176, 142, 173, 145, 131, 114 } },
{ { 33, 148, 81, 149, 84, 219, 152, 76,
229, 127, 205, 120, 234, 170, 123, 88,
134, 197, 101, 213, 91, 244, 169, 85,
220, 141, 234, 123, 242, 183, 130, 94,
141, 184, 121, 173, 98, 213, 156, 85,
204, 156, 197, 119, 212, 174, 127, 92 },
{ 14, 75, 45, 98, 83, 197, 150, 90,
235, 124, 242, 155, 246, 187, 143, 103,
78, 185, 111, 255, 116, 255, 224, 171,
185, 157, 255, 85, 219, 122, 128, 128,
117, 187, 102, 181, 132, 233, 197, 93,
207, 135, 191, 107, 222, 175, 130, 47 } },
{
{ 14, 79, 44, 86, 59, 178, 124, 63,
244, 106, 233, 117, 252, 185, 132, 92,
85, 225, 47, 236, 103, 255, 190, 116,
235, 114, 247, 123, 250, 174, 122, 110,
109, 197, 78, 177, 76, 242, 148, 68,
236, 123, 231, 103, 247, 171, 122, 91 },
{ 11, 40, 27, 92, 78, 183, 171, 70,
216, 74, 251, 146, 252, 213, 171, 148,
85, 225, 47, 236, 103, 255, 190, 116,
235, 114, 247, 123, 250, 174, 122, 110,
109, 197, 78, 177, 76, 242, 148, 68,
236, 123, 231, 103, 247, 171, 122, 91 },
},
#else // CONFIG_EXT_TX
{
{
34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 157, 92, 157, 129,
94, 65,
},
{
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 153, 140, 152, 134,
109, 81,
},
},
{
{
34, 127, 74, 124, 74, 204, 153, 76, 226, 162, 207, 126, 227, 192,
149, 108,
},
{
43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 202, 164, 236,
204, 168, 139,
},
},
{
{
25, 117, 70, 120, 77, 215, 171, 102, 234, 156, 235, 155, 247, 220,
176, 127,
},
{
24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 233, 168, 244, 198,
162, 127,
},
},
{
{
11, 54, 17, 69, 26, 128, 125, 56, 232, 130, 237, 121, 250, 168,
134, 114,
},
{
21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 252, 177, 252, 221,
192, 143,
},
},
#endif // CONFIG_EXT_TX
#endif // CONFIG_EOB_FIRST
};
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } } };
#if CONFIG_CTX1D
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
...
...
@@ -366,8 +248,7 @@ const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } },
};
#else // CONFIG_CTX1D
#if CONFIG_EOB_FIRST
#else // CONFIG_CTX1D
static const aom_prob
default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
{ { 221, 233, 232, 221, 231, 233, 216, 196, 233, 226, 200, 133, 227,
...
...
@@ -387,7 +268,7 @@ static const aom_prob
{ 92, 181, 200, 233, 232, 235, 249, 253, 253, 255, 254, 238, 228,
255, 251, 240, 128, 242, 233, 211, 171, 214, 179, 46, 128 } }
};
#if CONFIG_EOB_FIRST
static const aom_prob
default_eob_extra[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
{ {
...
...
@@ -423,35 +304,6 @@ static const aom_prob
145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
} }
};
#endif
#else
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
{
{ 229, 236, 231, 222, 239, 236, 214, 201, 236, 226, 195, 134, 228,
210, 150, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 182, 186, 172, 176, 207, 213, 152, 122, 187, 171, 131, 65, 170,
134, 101, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
},
{
{ 225, 234, 244, 236, 205, 242, 246, 247, 246, 234, 191, 242, 237,
215, 142, 224, 206, 142, 73, 128, 128, 128, 128, 128, 128 },
{ 154, 171, 187, 175, 62, 199, 202, 206, 215, 200, 111, 197, 199,
174, 100, 135, 105, 104, 45, 128, 128, 128, 128, 128, 128 },
},
{
{ 180, 213, 216, 229, 233, 232, 240, 235, 220, 178, 239, 238, 225,
187, 229, 214, 226, 200, 183, 141, 158, 179, 128, 128, 128 },
{ 190, 225, 234, 248, 249, 248, 253, 251, 232, 110, 254, 252, 236,
57, 253, 248, 232, 85, 244, 189, 112, 64, 128, 128, 128 },
},
{
{ 248, 224, 246, 244, 239, 245, 251, 246, 251, 255, 255, 255, 249,
255, 255, 255, 229, 255, 255, 255, 228, 255, 255, 247, 137 },
{ 204, 207, 233, 215, 193, 228, 239, 221, 227, 250, 236, 207, 135,
236, 186, 182, 57, 209, 140, 128, 85, 184, 110, 128, 128 },
},
};
#endif
#endif // CONFIG_CTX1D
const aom_prob default_coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] = {
...
...
@@ -6336,7 +6188,7 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->txb_skip, default_txb_skip);
av1_copy(fc->nz_map, default_nz_map);
av1_copy(fc->eob_flag, default_eob_flag);
#if CONFIG_
EOB_FIRST
#if
!
CONFIG_
CTX1D
av1_copy(fc->eob_extra, default_eob_extra);
#endif
av1_copy(fc->dc_sign, default_dc_sign);
...
...
av1/common/entropymode.h
View file @
3422ac17
...
...
@@ -149,9 +149,7 @@ typedef struct frame_contexts {
aom_prob
txb_skip
[
TX_SIZES
][
TXB_SKIP_CONTEXTS
];
aom_prob
nz_map
[
TX_SIZES
][
PLANE_TYPES
][
SIG_COEF_CONTEXTS
];
aom_prob
eob_flag
[
TX_SIZES
][
PLANE_TYPES
][
EOB_COEF_CONTEXTS
];
#if CONFIG_EOB_FIRST
aom_prob
eob_extra
[
TX_SIZES
][
PLANE_TYPES
][
EOB_COEF_CONTEXTS
];
#endif
aom_prob
dc_sign
[
PLANE_TYPES
][
DC_SIGN_CONTEXTS
];
aom_prob
coeff_base
[
TX_SIZES
][
PLANE_TYPES
][
NUM_BASE_LEVELS
]
[
COEFF_BASE_CONTEXTS
];
...
...
@@ -168,10 +166,8 @@ typedef struct frame_contexts {
[
CDF_SIZE
(
2
)];
aom_cdf_prob
eob_flag_cdf
[
TX_SIZES
][
PLANE_TYPES
][
EOB_COEF_CONTEXTS
]
[
CDF_SIZE
(
2
)];
#if CONFIG_EOB_FIRST
aom_cdf_prob
eob_extra_cdf
[
TX_SIZES
][
PLANE_TYPES
][
EOB_COEF_CONTEXTS
]
[
CDF_SIZE
(
2
)];
#endif
aom_cdf_prob
dc_sign_cdf
[
PLANE_TYPES
][
DC_SIGN_CONTEXTS
][
CDF_SIZE
(
2
)];
aom_cdf_prob
coeff_base_cdf
[
TX_SIZES
][
PLANE_TYPES
][
NUM_BASE_LEVELS
]
[
COEFF_BASE_CONTEXTS
][
CDF_SIZE
(
2
)];
...
...
@@ -414,9 +410,7 @@ typedef struct FRAME_COUNTS {
unsigned
int
txb_skip
[
TX_SIZES
][
TXB_SKIP_CONTEXTS
][
2
];
unsigned
int
nz_map
[
TX_SIZES
][
PLANE_TYPES
][
SIG_COEF_CONTEXTS
][
2
];
unsigned
int
eob_flag
[
TX_SIZES
][
PLANE_TYPES
][
EOB_COEF_CONTEXTS
][
2
];
#if CONFIG_EOB_FIRST
unsigned
int
eob_extra
[
TX_SIZES
][
PLANE_TYPES
][
EOB_COEF_CONTEXTS
][
2
];
#endif
unsigned
int
dc_sign
[
PLANE_TYPES
][
DC_SIGN_CONTEXTS
][
2
];
unsigned
int
coeff_base
[
TX_SIZES
][
PLANE_TYPES
][
NUM_BASE_LEVELS
]
[
COEFF_BASE_CONTEXTS
][
2
];
...
...
av1/common/txb_common.c
View file @
3422ac17
...
...
@@ -149,14 +149,12 @@ void av1_init_txb_probs(FRAME_CONTEXT *fc) {
fc
->
eob_flag_cdf
[
tx_size
][
plane
][
ctx
][
2
]
=
0
;
}
#if CONFIG_EOB_FIRST
for
(
ctx
=
0
;
ctx
<
EOB_COEF_CONTEXTS
;
++
ctx
)
{
fc
->
eob_extra_cdf
[
tx_size
][
plane
][
ctx
][
0
]
=
AOM_ICDF
(
128
*
(
aom_cdf_prob
)
fc
->
eob_extra
[
tx_size
][
plane
][
ctx
]);
fc
->
eob_extra_cdf
[
tx_size
][
plane
][
ctx
][
1
]
=
AOM_ICDF
(
32768
);
fc
->
eob_extra_cdf
[
tx_size
][
plane
][
ctx
][
2
]
=
0
;
}
#endif
}
}
...
...
@@ -233,7 +231,6 @@ void av1_init_lv_map(AV1_COMMON *cm) {
}
}
#if CONFIG_EOB_FIRST
const
int16_t
k_eob_group_start
[
12
]
=
{
0
,
1
,
2
,
3
,
5
,
9
,
17
,
33
,
65
,
129
,
257
,
513
};
const
int16_t
k_eob_offset_bits
[
12
]
=
{
0
,
0
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
...
...
@@ -276,5 +273,3 @@ int16_t get_eob_pos_token(int eob, int16_t *extra) {
return
t
;
}
#endif
av1/common/txb_common.h
View file @
3422ac17
...
...
@@ -15,12 +15,10 @@
#define REDUCE_CONTEXT_DEPENDENCY 0
#define MIN_SCAN_IDX_REDUCE_CONTEXT_DEPENDENCY 0
#if CONFIG_EOB_FIRST
extern
const
int16_t
k_eob_group_start
[
12
];
extern
const
int16_t
k_eob_offset_bits
[
12
];
int16_t
get_eob_pos_token
(
int
eob
,
int16_t
*
extra
);
int
get_eob_pos_ctx
(
int
eob_token
);
#endif
extern
const
int16_t
av1_coeff_band_4x4
[
16
];
...
...
@@ -159,21 +157,12 @@ static INLINE int get_base_ctx(const uint8_t *const levels,
}
#define BR_CONTEXT_POSITION_NUM 8 // Base range coefficient context
#if CONFIG_EOB_FIRST
static
const
int
br_ref_offset
[
BR_CONTEXT_POSITION_NUM
][
2
]
=
{
/* clang-format off*/
{
-
1
,
-
1
},
{
-
1
,
0
},
{
-
1
,
1
},
{
0
,
-
1
},
{
0
,
1
},
{
1
,
-
1
},
{
1
,
0
},
{
1
,
1
},
/* clang-format on*/
};
#else
static
const
int
br_ref_offset
[
BR_CONTEXT_POSITION_NUM
][
2
]
=
{
/* clang-format off*/
{
-
1
,
-
1
},
{
-
1
,
0
},
{
-
1
,
1
},
{
0
,
-
1
},
{
0
,
1
},
{
1
,
-
1
},
{
1
,
0
},
{
1
,
1
},
/* clang-format on*/
};
#endif
static
const
int
br_level_map
[
9
]
=
{
0
,
0
,
1
,
1
,
2
,
2
,
3
,
3
,
3
,
...
...
@@ -278,7 +267,7 @@ static INLINE int get_br_ctx_coeff(const tran_low_t *const tcoeffs,
}
#define SIG_REF_OFFSET_NUM 7
#if CONFIG_EOB_FIRST
static
const
int
sig_ref_offset
[
SIG_REF_OFFSET_NUM
][
2
]
=
{
{
2
,
1
},
{
2
,
0
},
{
1
,
2
},
{
1
,
1
},
{
1
,
0
},
{
0
,
2
},
{
0
,
1
},
};
...
...
@@ -316,52 +305,6 @@ static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height,
}
return
count
;
}
#else
static
const
int
sig_ref_offset
[
SIG_REF_OFFSET_NUM
][
2
]
=
{
{
-
2
,
-
1
},
{
-
2
,
0
},
{
-
1
,
-
2
},
{
-
1
,
-
1
},
{
-
1
,
0
},
{
0
,
-
2
},
{
0
,
-
1
},
};
#if REDUCE_CONTEXT_DEPENDENCY
static
INLINE
int
get_nz_count
(
const
void
*
const
tcoeffs
,
const
int
bwl
,
const
int
height
,
const
int
row
,
const
int
col
,
const
int
coeff_is_byte_flag
,
const
int
prev_row
,
const
int
prev_col
)
{
int
count
=
0
;
for
(
int
idx
=
0
;
idx
<
SIG_REF_OFFSET_NUM
;
++
idx
)
{
const
int
ref_row
=
row
+
sig_ref_offset
[
idx
][
0
];
const
int
ref_col
=
col
+
sig_ref_offset
[
idx
][
1
];
if
(
ref_row
<
0
||
ref_col
<
0
||
ref_row
>=
height
||
ref_col
>=
(
1
<<
bwl
)
||
(
prev_row
==
ref_row
&&
prev_col
==
ref_col
))
continue
;
const
int
nb_pos
=
(
ref_row
<<
bwl
)
+
ref_col
;
count
+=
((
coeff_is_byte_flag
?
((
const
uint8_t
*
)
tcoeffs
)[
nb_pos
]
:
((
const
tran_low_t
*
)
tcoeffs
)[
nb_pos
])
!=
0
);
}
return
count
;
}
#else
static
INLINE
int
get_nz_count
(
const
void
*
const
tcoeffs
,
const
int
bwl
,
const
int
height
,
const
int
row
,
const
int
col
,
const
int
coeff_is_byte_flag
)
{
int
count
=
0
;
for
(
int
idx
=
0
;
idx
<
SIG_REF_OFFSET_NUM
;
++
idx
)
{
const
int
ref_row
=
row
+
sig_ref_offset
[
idx
][
0
];
const
int
ref_col
=
col
+
sig_ref_offset
[
idx
][
1
];
if
(
ref_row
<
0
||
ref_col
<
0
||
ref_row
>=
height
||
ref_col
>=
(
1
<<
bwl
))
continue
;
const
int
nb_pos
=
(
ref_row
<<
bwl
)
+
ref_col
;
count
+=
((
coeff_is_byte_flag
?
((
const
uint8_t
*
)
tcoeffs
)[
nb_pos
]
:
((
const
tran_low_t
*
)
tcoeffs
)[
nb_pos
])
!=
0
);
}
return
count
;
}
#endif
#endif
static
INLINE
TX_CLASS
get_tx_class
(
TX_TYPE
tx_type
)
{
switch
(
tx_type
)
{
...
...
@@ -381,10 +324,7 @@ static INLINE TX_CLASS get_tx_class(TX_TYPE tx_type) {
// count to ctx
static
INLINE
int
get_nz_map_ctx_from_count
(
int
count
,
int
coeff_idx
,
// raster order
int
bwl
,
#if CONFIG_EOB_FIRST
int
height
,
#endif
int
bwl
,
int
height
,
TX_TYPE
tx_type
)
{
(
void
)
tx_type
;
const
int
row
=
coeff_idx
>>
bwl
;
...
...
@@ -403,7 +343,6 @@ static INLINE int get_nz_map_ctx_from_count(int count,
int
offset
=
0
;
#endif
#if CONFIG_EOB_FIRST
(
void
)
height
;
ctx
=
(
count
+
1
)
>>
1
;
...
...
@@ -428,41 +367,6 @@ static INLINE int get_nz_map_ctx_from_count(int count,
return
offset
+
10
+
ctx
;
}
}
#else
if
(
row
==
0
&&
col
==
0
)
return
offset
+
0
;
if
(
row
==
0
&&
col
==
1
)
return
offset
+
1
+
count
;
if
(
row
==
1
&&
col
==
0
)
return
offset
+
3
+
count
;
if
(
row
==
1
&&
col
==
1
)
{
ctx
=
(
count
+
1
)
>>
1
;
assert
(
5
+
ctx
<=
7
);
return
offset
+
5
+
ctx
;
}
if
(
row
==
0
)
{
ctx
=
(
count
+
1
)
>>
1
;
assert
(
ctx
<
2
);
return
offset
+
8
+
ctx
;
}
if
(
col
==
0
)
{
ctx
=
(
count
+
1
)
>>
1
;
assert
(
ctx
<
2
);
return
offset
+
10
+
ctx
;
}
ctx
=
count
>>
1
;
assert
(
12
+
ctx
<
16
);
return
offset
+
12
+
ctx
;
#endif
}
static
INLINE
int
get_nz_map_ctx
(
const
void
*
const
tcoeffs
,
const
int
scan_idx
,
...
...
@@ -472,35 +376,11 @@ static INLINE int get_nz_map_ctx(const void *const tcoeffs, const int scan_idx,
const
int
coeff_idx
=
scan
[
scan_idx
];
const
int
row
=
coeff_idx
>>
bwl
;
const
int
col
=
coeff_idx
-
(
row
<<
bwl
);
#if REDUCE_CONTEXT_DEPENDENCY
int
prev_coeff_idx
;
int
prev_row
;
int
prev_col
;
if
(
scan_idx
>
MIN_SCAN_IDX_REDUCE_CONTEXT_DEPENDENCY
)
{
prev_coeff_idx
=
scan
[
scan_idx
-
1
];
// raster order
prev_row
=
prev_coeff_idx
>>
bwl
;
prev_col
=
prev_coeff_idx
-
(
prev_row
<<
bwl
);
}
else
{
prev_coeff_idx
=
-
1
;
prev_row
=
-
1
;
prev_col
=
-
1
;
}
const
int
count
=
get_nz_count
(
tcoeffs
,
bwl
,
height
,
row
,
col
,
coeff_is_byte_flag
,
prev_row
,
prev_col
);
#else
#if CONFIG_EOB_FIRST
int
tx_class
=
get_tx_class
(
tx_type
);
int
count
=
get_nz_count
(
tcoeffs
,
bwl
,
height
,
row
,
col
,
tx_class
,
coeff_is_byte_flag
);
#else
int
count
=
get_nz_count
(
tcoeffs
,
bwl
,
height
,
row
,
col
,
coeff_is_byte_flag
);
#endif
#endif
return
get_nz_map_ctx_from_count
(
count
,
coeff_idx
,
bwl
,
#if CONFIG_EOB_FIRST
height
,
#endif
tx_type
);
return
get_nz_map_ctx_from_count
(
count
,
coeff_idx
,
bwl
,
height
,
tx_type
);
}
static
INLINE
int
get_eob_ctx
(
const
int
coeff_idx
,
// raster order
...
...
av1/decoder/decodetxb.c
View file @
3422ac17
...
...
@@ -255,7 +255,6 @@ static INLINE int read_nz_map_horiz(aom_reader *r, uint8_t *levels, int plane,
}
#endif
#if CONFIG_EOB_FIRST
static
INLINE
int
rec_eob_pos
(
int16_t
eob_token
,
int16_t
extra
)
{
int
eob
=
k_eob_group_start
[
eob_token
];
if
(
eob
>
2
)
{
...
...
@@ -263,7 +262,6 @@ static INLINE int rec_eob_pos(int16_t eob_token, int16_t extra) {
}
return
eob
;
}
#endif
uint8_t
av1_read_coeffs_txb
(
const
AV1_COMMON
*
const
cm
,
MACROBLOCKD
*
xd
,
aom_reader
*
r
,
int
blk_row
,
int
blk_col
,
int
block
,
...
...
@@ -316,8 +314,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
const
SCAN_ORDER
*
const
scan_order
=
get_scan
(
cm
,
tx_size
,
tx_type
,
mbmi
);
const
int16_t
*
scan
=
scan_order
->
scan
;
#if CONFIG_EOB_FIRST
unsigned
int
(
*
nz_map_count
)[
SIG_COEF_CONTEXTS
][
2
]
=
(
counts
)
?
&
counts
->
nz_map
[
txs_ctx
][
plane_type
]
:
NULL
;
int16_t
dummy
;
...
...
@@ -389,42 +385,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if
(
counts
)
++
(
*
nz_map_count
)[
coeff_ctx
][
is_nz
];
}
#else
#if CONFIG_CTX1D
const
int16_t
*
iscan
=
scan_order
->
iscan
;
TX_CLASS
tx_class
=
get_tx_class
(
tx_type
);
if
(
tx_class
==
TX_CLASS_2D
)
{
*
eob
=
read_nz_map
(
r
,
levels
,
plane
,
scan
,
tx_size
,
tx_type
,
ec_ctx
,
counts
);
}
else
{
#if LV_MAP_PROB
const
int
eob_mode
=
av1_read_record_bin
(
counts
,
r
,
ec_ctx
->
eob_mode_cdf
[
txs_ctx
][
plane_type
][
tx_class
],
2
,
ACCT_STR
);
#else
const
int
eob_mode
=
aom_read
(
r
,
ec_ctx
->
eob_mode
[
txs_ctx
][
plane_type
][
tx_class
],
ACCT_STR
);
#endif
if
(
counts
)
++
counts
->
eob_mode
[
txs_ctx
][
plane_type
][
tx_class
][
eob_mode
];
if
(
eob_mode
==
0
)
{
*
eob
=
read_nz_map
(
r
,
levels
,
plane
,
scan
,
tx_size
,
tx_type
,
ec_ctx
,
counts
);
}
else
{
assert
(
tx_class
==
TX_CLASS_VERT
||
tx_class
==
TX_CLASS_HORIZ
);
if
(
tx_class
==
TX_CLASS_VERT
)
*
eob
=
read_nz_map_vert
(
r
,
levels
,
plane
,
scan
,
iscan
,
tx_size
,
tx_type
,
ec_ctx
,
counts
);
else
*
eob
=
read_nz_map_horiz
(
r
,
levels
,
plane
,
scan
,
iscan
,
tx_size
,
tx_type
,
ec_ctx
,
counts
);
}
}
#else
*
eob
=
read_nz_map
(
r
,
levels
,
plane
,
scan
,
tx_size
,
tx_type
,
ec_ctx
,
counts
);
#endif
#endif
*
max_scan_line
=
*
eob
;
int
i
;
...
...
av1/encoder/block.h
View file @
3422ac17
...
...
@@ -60,9 +60,7 @@ typedef struct {
int
txb_skip_cost
[
TXB_SKIP_CONTEXTS
][
2
];
int
nz_map_cost
[
SIG_COEF_CONTEXTS
][
2
];
int
eob_cost
[
EOB_COEF_CONTEXTS
][
2
];
#if CONFIG_EOB_FIRST
int
eob_extra_cost
[
EOB_COEF_CONTEXTS
][
2
];
#endif
int
dc_sign_cost
[
DC_SIGN_CONTEXTS
][
2
];
int
base_cost
[
NUM_BASE_LEVELS
][
COEFF_BASE_CONTEXTS
][
2
];
int
lps_cost
[
LEVEL_CONTEXTS
][
COEFF_BASE_RANGE
+
1
];
...
...
av1/encoder/encodetxb.c
View file @
3422ac17
...
...
@@ -27,7 +27,6 @@ typedef struct LevelDownStats {
int
update
;
tran_low_t
low_qc
;
tran_low_t
low_dqc
;
#if CONFIG_EOB_FIRST
int64_t
dist0
;
int
rate
;
int
rate_low
;
...
...
@@ -36,7 +35,6 @@ typedef struct LevelDownStats {
int64_t
rd
;
int64_t
rd_low
;
int
nz_rate
;
// for eob
#endif
int64_t
rd_diff
;
int
cost_diff
;
int64_t
dist_diff
;
...
...
@@ -132,7 +130,6 @@ static INLINE int64_t get_coeff_dist(tran_low_t tcoeff, tran_low_t dqcoeff,
return
error
;
}
#if CONFIG_EOB_FIRST
void
av1_update_eob_context
(
int
eob
,
int
seg_eob
,
TX_SIZE
txsize
,
PLANE_TYPE
plane
,
FRAME_CONTEXT
*
ec_ctx
,
FRAME_COUNTS
*
counts
)
{
...
...
@@ -246,43 +243,6 @@ static void update_coeff(int coeff_idx, tran_low_t qc, TxbInfo *txb_info) {
txb_info
->
dqcoeff
[
coeff_idx
]
=
qcoeff_to_dqcoeff
(
qc
,
dqv
,
txb_info
->
shift
);
}
#endif
static
INLINE
void
write_nz_map
(
aom_writer
*
w
,
const
tran_low_t
*
tcoeff
,
uint16_t
eob
,
int
plane
,
const
int16_t
*
scan
,
TX_SIZE
tx_size
,
TX_TYPE
tx_type
,
FRAME_CONTEXT
*
fc
)
{
const
PLANE_TYPE
plane_type
=
get_plane_type
(
plane
);
const
TX_SIZE
txs_ctx
=
get_txsize_context
(
tx_size
);
const
int
bwl
=
b_width_log2_lookup
[
txsize_to_bsize
[
tx_size
]]
+
2
;
const
int
height
=
tx_size_high
[
tx_size
];
#if CONFIG_CTX1D
const
int
width
=
tx_size_wide
[
tx_size
];
const
int
eob_offset
=
width
+
height
;
const
TX_CLASS
tx_class
=
get_tx_class
(
tx_type
);
const
int
seg_eob
=
(
tx_class
==
TX_CLASS_2D
)
?
tx_size_2d
[
tx_size
]
:
eob_offset
;
#else
const
int
seg_eob
=
tx_size_2d
[
tx_size
];
#endif
for
(
int
c
=
0
;
c
<
eob
;
++
c
)
{
int
coeff_ctx
=
get_nz_map_ctx
(
tcoeff
,
c
,
scan
,
bwl
,
height
,
tx_type
,
0
);
int
eob_ctx
=
get_eob_ctx
(
scan
[
c
],
txs_ctx
,
tx_type
);
tran_low_t
v
=
tcoeff
[
scan
[
c
]];
int
is_nz
=
(
v
!=
0
);
if
(
c
==
seg_eob
-
1
)
break
;
aom_write_bin
(
w
,
is_nz
,
fc
->
nz_map_cdf
[
txs_ctx
][
plane_type
][
coeff_ctx
],
2
);
if
(
is_nz
)
aom_write_bin
(
w
,
c
==
(
eob
-
1
),
fc
->
eob_flag_cdf
[
txs_ctx
][
plane_type
][
eob_ctx
],
2
);
}
}
#if CONFIG_CTX1D
static
INLINE
void
write_nz_map_vert
(
aom_writer
*
w
,
const
tran_low_t
*
tcoeff
,
uint16_t
eob
,
int
plane
,
...
...
@@ -441,7 +401,6 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
get_min_tx_size
(
tx_size
),
w
);
#endif
#if CONFIG_EOB_FIRST
int16_t
eob_extra
;
int16_t
eob_pt
=
get_eob_pos_token
(
eob
,
&
eob_extra
);
int16_t
dummy
;
...
...
@@ -484,41 +443,6 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
2
);
}
#else // CONFIG_EOB_FIRST
#if CONFIG_CTX1D
TX_CLASS
tx_class
=
get_tx_class
(
tx_type
);
if
(
tx_class
==
TX_CLASS_2D
)
{
write_nz_map
(
w
,
tcoeff
,
eob
,
plane
,
scan
,
tx_size
,
tx_type
,
ec_ctx
);
}
else
{