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
530bee20
Commit
530bee20
authored
Nov 28, 2017
by
Linfeng Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update av1_read_coeffs_txb(), keep update position
Change-Id: I3acd24acbd121c93e89817f865a54327d5e8e92e
parent
684b7bd1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
av1/decoder/decodetxb.c
av1/decoder/decodetxb.c
+18
-12
No files found.
av1/decoder/decodetxb.c
View file @
530bee20
...
...
@@ -71,7 +71,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
MB_MODE_INFO
*
const
mbmi
=
&
xd
->
mi
[
0
]
->
mbmi
;
const
int
seg_eob
=
av1_get_max_eob
(
tx_size
);
int
c
=
0
;
int
update
_eob
=
-
1
;
int
num_
update
s
=
0
;
const
int16_t
*
const
dequant
=
xd
->
plane
[
plane
].
seg_dequant_QTX
[
mbmi
->
segment_id
];
const
int
shift
=
av1_get_tx_scale
(
tx_size
);
...
...
@@ -83,6 +83,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
uint8_t
*
const
levels
=
set_levels
(
levels_buf
,
width
);
DECLARE_ALIGNED
(
16
,
uint8_t
,
level_counts
[
MAX_TX_SQUARE
]);
int8_t
signs
[
MAX_TX_SQUARE
];
uint16_t
update_pos
[
MAX_TX_SQUARE
];
const
int
all_zero
=
av1_read_record_bin
(
counts
,
r
,
ec_ctx
->
txb_skip_cdf
[
txs_ctx
][
txb_ctx
->
txb_skip_ctx
],
2
,
...
...
@@ -201,8 +202,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
if
(
level
<
3
)
{
cul_level
+=
level
;
tcoeffs
[
pos
]
=
(
level
*
dequant
[
!!
c
])
>>
shift
;
}
else
if
(
update_eob
<
0
)
{
update_
eob
=
c
;
}
else
{
update_
pos
[
num_updates
++
]
=
pos
;
}
}
#else
...
...
@@ -236,7 +237,9 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
levels
[
get_paded_idx
(
pos
,
bwl
)]
=
k
+
1
;
*
max_scan_line
=
AOMMAX
(
*
max_scan_line
,
pos
);
if
(
update_eob
<
0
&&
k
==
NUM_BASE_LEVELS
)
update_eob
=
c
;
if
(
k
==
NUM_BASE_LEVELS
)
{
update_pos
[
num_updates
++
]
=
pos
;
}
}
#else
// set non-zero coefficient map.
...
...
@@ -274,8 +277,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
*
level
=
i
+
2
;
if
(
counts
)
++
counts
->
coeff_base
[
txs_ctx
][
plane_type
][
i
][
ctx
][
0
];
// update the eob flag for coefficients with magnitude above 1.
update_eob
=
AOMMAX
(
update_eob
,
c
);
update_pos
[
num_updates
++
]
=
pos
;
}
}
#endif
...
...
@@ -302,15 +304,19 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
if
(
*
sign
)
tcoeffs
[
pos
]
=
-
tcoeffs
[
pos
];
}
if
(
update
_eob
>=
0
)
{
if
(
num_
update
s
)
{
av1_get_br_level_counts
(
levels
,
width
,
height
,
level_counts
);
for
(
c
=
update_eob
;
c
>=
0
;
--
c
)
{
const
int
pos
=
scan
[
c
];
for
(
c
=
0
;
c
<
num_updates
;
++
c
)
{
const
int
pos
=
update_pos
[
c
];
uint8_t
*
const
level
=
&
levels
[
get_paded_idx
(
pos
,
bwl
)];
int
idx
;
int
ctx
;
#if USE_CAUSAL_BASE_CTX
assert
(
*
level
>
NUM_BASE_LEVELS
);
#else
if
(
*
level
<=
NUM_BASE_LEVELS
)
continue
;
#endif
ctx
=
get_br_ctx
(
levels
,
pos
,
bwl
,
level_counts
[
pos
]);
...
...
@@ -324,7 +330,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
if
(
*
level
<=
NUM_BASE_LEVELS
+
COEFF_BASE_RANGE
)
{
cul_level
+=
*
level
;
tran_low_t
t
=
(
*
level
*
dequant
[
!!
c
])
>>
shift
;
tran_low_t
t
=
(
*
level
*
dequant
[
!!
pos
])
>>
shift
;
if
(
signs
[
pos
])
t
=
-
t
;
tcoeffs
[
pos
]
=
t
;
continue
;
...
...
@@ -356,7 +362,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
*
level
=
NUM_BASE_LEVELS
+
1
+
br_base
+
br_offset
;
cul_level
+=
*
level
;
tran_low_t
t
=
(
*
level
*
dequant
[
!!
c
])
>>
shift
;
tran_low_t
t
=
(
*
level
*
dequant
[
!!
pos
])
>>
shift
;
if
(
signs
[
pos
])
t
=
-
t
;
tcoeffs
[
pos
]
=
t
;
break
;
...
...
@@ -371,7 +377,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
// Save golomb in tcoeffs because adding it to level may incur overflow
tran_low_t
t
=
*
level
+
read_golomb
(
xd
,
r
,
counts
);
cul_level
+=
t
;
t
=
(
t
*
dequant
[
!!
c
])
>>
shift
;
t
=
(
t
*
dequant
[
!!
pos
])
>>
shift
;
if
(
signs
[
pos
])
t
=
-
t
;
tcoeffs
[
pos
]
=
t
;
}
...
...
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