Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
841a84d6
Commit
841a84d6
authored
Oct 30, 2017
by
Linfeng Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove get_level_count_mag_coeff() and get_br_ctx_coeff()
Change-Id: Ie6d663aacbed1452060cdef60e96d6acf469d430
parent
b6957c29
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
47 deletions
+8
-47
av1/common/txb_common.h
av1/common/txb_common.h
+0
-38
av1/encoder/encodetxb.c
av1/encoder/encodetxb.c
+8
-9
No files found.
av1/common/txb_common.h
View file @
841a84d6
...
...
@@ -96,28 +96,6 @@ static INLINE int get_level_count_mag(
return
count
;
}
static
INLINE
int
get_level_count_mag_coeff
(
int
*
const
mag
,
const
tran_low_t
*
const
tcoeffs
,
const
int
bwl
,
const
int
height
,
const
int
row
,
const
int
col
,
const
int
level
,
const
int
(
*
nb_offset
)[
2
],
const
int
nb_num
)
{
const
int
stride
=
1
<<
bwl
;
int
count
=
0
;
for
(
int
idx
=
0
;
idx
<
nb_num
;
++
idx
)
{
const
int
ref_row
=
row
+
nb_offset
[
idx
][
0
];
const
int
ref_col
=
col
+
nb_offset
[
idx
][
1
];
if
(
ref_row
<
0
||
ref_col
<
0
||
ref_row
>=
height
||
ref_col
>=
stride
)
continue
;
const
int
pos
=
(
ref_row
<<
bwl
)
+
ref_col
;
tran_low_t
abs_coeff
=
abs
(
tcoeffs
[
pos
]);
count
+=
abs_coeff
>
level
;
if
(
nb_offset
[
idx
][
0
]
==
0
&&
nb_offset
[
idx
][
1
]
==
1
)
mag
[
0
]
=
abs_coeff
;
if
(
nb_offset
[
idx
][
0
]
==
1
&&
nb_offset
[
idx
][
1
]
==
0
)
mag
[
1
]
=
abs_coeff
;
if
(
nb_offset
[
idx
][
0
]
==
1
&&
nb_offset
[
idx
][
1
]
==
1
)
mag
[
2
]
=
abs_coeff
;
}
return
count
;
}
static
INLINE
int
get_base_ctx_from_count_mag
(
int
row
,
int
col
,
int
count
,
int
sig_mag
)
{
const
int
ctx
=
base_level_count_to_index
[
count
];
...
...
@@ -299,22 +277,6 @@ static INLINE int get_br_ctx(const uint8_t *const levels,
return
ctx
;
}
static
INLINE
int
get_br_ctx_coeff
(
const
tran_low_t
*
const
tcoeffs
,
const
int
c
,
// raster order
const
int
bwl
,
const
int
height
)
{
const
int
row
=
c
>>
bwl
;
const
int
col
=
c
-
(
row
<<
bwl
);
const
int
level_minus_1
=
NUM_BASE_LEVELS
;
int
mag
=
0
;
int
nb_mag
[
3
]
=
{
0
};
const
int
count
=
get_level_count_mag_coeff
(
nb_mag
,
tcoeffs
,
bwl
,
height
,
row
,
col
,
level_minus_1
,
br_ref_offset
,
BR_CONTEXT_POSITION_NUM
);
for
(
int
idx
=
0
;
idx
<
3
;
++
idx
)
mag
=
AOMMAX
(
mag
,
nb_mag
[
idx
]);
const
int
ctx
=
get_br_ctx_from_count_mag
(
row
,
col
,
count
,
mag
);
return
ctx
;
}
#define SIG_REF_OFFSET_NUM 7
static
const
int
sig_ref_offset
[
SIG_REF_OFFSET_NUM
][
2
]
=
{
...
...
av1/encoder/encodetxb.c
View file @
841a84d6
...
...
@@ -486,8 +486,8 @@ void av1_write_coeffs_mb(const AV1_COMMON *const cm, MACROBLOCK *x,
}
}
static
INLINE
void
get_base_ctx_set
(
const
tran_low
_t
*
t
co
eff
s
,
int
c
,
// raster order
static
INLINE
void
get_base_ctx_set
(
const
uint8
_t
*
co
nst
level
s
,
const
int
c
,
// raster order
const
int
bwl
,
const
int
height
,
int
ctx_set
[
NUM_BASE_LEVELS
])
{
const
int
row
=
c
>>
bwl
;
...
...
@@ -496,7 +496,6 @@ static INLINE void get_base_ctx_set(const tran_low_t *tcoeffs,
int
mag_count
[
NUM_BASE_LEVELS
]
=
{
0
};
int
nb_mag
[
NUM_BASE_LEVELS
][
3
]
=
{
{
0
}
};
int
idx
;
tran_low_t
abs_coeff
;
int
i
;
for
(
idx
=
0
;
idx
<
BASE_CONTEXT_POSITION_NUM
;
++
idx
)
{
...
...
@@ -507,7 +506,7 @@ static INLINE void get_base_ctx_set(const tran_low_t *tcoeffs,
if
(
ref_row
<
0
||
ref_col
<
0
||
ref_row
>=
height
||
ref_col
>=
stride
)
continue
;
abs_coeff
=
abs
(
tcoeff
s
[
pos
]
)
;
const
uint8_t
abs_coeff
=
level
s
[
pos
];
for
(
i
=
0
;
i
<
NUM_BASE_LEVELS
;
++
i
)
{
ctx_set
[
i
]
+=
abs_coeff
>
i
;
...
...
@@ -636,7 +635,7 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
if
(
is_k
==
0
)
break
;
}
#else
get_base_ctx_set
(
qcoeff
,
scan
[
c
],
bwl
,
height
,
ctx_ls
);
get_base_ctx_set
(
levels
,
scan
[
c
],
bwl
,
height
,
ctx_ls
);
int
i
;
for
(
i
=
0
;
i
<
NUM_BASE_LEVELS
;
++
i
)
{
...
...
@@ -652,7 +651,7 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
if
(
level
>
NUM_BASE_LEVELS
)
{
int
ctx
;
ctx
=
get_br_ctx
_coeff
(
qcoeff
,
scan
[
c
],
bwl
,
height
);
ctx
=
get_br_ctx
(
levels
,
scan
[
c
],
bwl
,
height
);
int
base_range
=
level
-
1
-
NUM_BASE_LEVELS
;
if
(
base_range
<
COEFF_BASE_RANGE
)
{
cost
+=
coeff_costs
->
lps_cost
[
ctx
][
base_range
];
...
...
@@ -1435,7 +1434,7 @@ static int get_coeff_cost(const tran_low_t qc, const int scan_idx,
}
#else
int
ctx_ls
[
NUM_BASE_LEVELS
]
=
{
0
};
get_base_ctx_set
(
txb_info
->
qcoeff
,
scan
[
scan_idx
],
txb_info
->
bwl
,
get_base_ctx_set
(
txb_info
->
levels
,
scan
[
scan_idx
],
txb_info
->
bwl
,
txb_info
->
height
,
ctx_ls
);
int
i
;
...
...
@@ -1446,8 +1445,8 @@ static int get_coeff_cost(const tran_low_t qc, const int scan_idx,
#endif
if
(
abs_qc
>
NUM_BASE_LEVELS
)
{
int
ctx
=
get_br_ctx
_coeff
(
txb_info
->
qcoeff
,
scan
[
scan_idx
],
txb_info
->
bwl
,
txb_info
->
height
);
int
ctx
=
get_br_ctx
(
txb_info
->
levels
,
scan
[
scan_idx
],
txb_info
->
bwl
,
txb_info
->
height
);
cost
+=
get_br_cost
(
abs_qc
,
ctx
,
txb_costs
->
lps_cost
[
ctx
]);
cost
+=
get_golomb_cost
(
abs_qc
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment