Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
aom-rav1e
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
aom-rav1e
Commits
4be6cb32
Commit
4be6cb32
authored
Nov 02, 2017
by
Sebastien Alaiwan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove VAR_REFS experiment
This experiment has been abandonned. Change-Id: Ieabc6f365651e2d116a4505a3cc202add94d1386
parent
ebdbcb4c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
368 deletions
+36
-368
av1/common/blockd.h
av1/common/blockd.h
+0
-3
av1/common/onyxc_int.h
av1/common/onyxc_int.h
+0
-23
av1/decoder/decodeframe.c
av1/decoder/decodeframe.c
+0
-39
av1/decoder/decodemv.c
av1/decoder/decodemv.c
+6
-140
av1/encoder/bitstream.c
av1/encoder/bitstream.c
+30
-120
av1/encoder/encoder.c
av1/encoder/encoder.c
+0
-41
build/cmake/aom_config_defaults.cmake
build/cmake/aom_config_defaults.cmake
+0
-1
configure
configure
+0
-1
No files found.
av1/common/blockd.h
View file @
4be6cb32
...
@@ -558,9 +558,6 @@ typedef struct RefBuffer {
...
@@ -558,9 +558,6 @@ typedef struct RefBuffer {
int
idx
;
int
idx
;
YV12_BUFFER_CONFIG
*
buf
;
YV12_BUFFER_CONFIG
*
buf
;
struct
scale_factors
sf
;
struct
scale_factors
sf
;
#if CONFIG_VAR_REFS
int
is_valid
;
#endif // CONFIG_VAR_REFS
}
RefBuffer
;
}
RefBuffer
;
#if CONFIG_ADAPT_SCAN
#if CONFIG_ADAPT_SCAN
...
...
av1/common/onyxc_int.h
View file @
4be6cb32
...
@@ -646,29 +646,6 @@ static INLINE void ensure_mv_buffer(RefCntBuffer *buf, AV1_COMMON *cm) {
...
@@ -646,29 +646,6 @@ static INLINE void ensure_mv_buffer(RefCntBuffer *buf, AV1_COMMON *cm) {
#endif
#endif
}
}
#if CONFIG_VAR_REFS
#define LAST_IS_VALID(cm) ((cm)->frame_refs[LAST_FRAME - 1].is_valid)
#define LAST2_IS_VALID(cm) ((cm)->frame_refs[LAST2_FRAME - 1].is_valid)
#define LAST3_IS_VALID(cm) ((cm)->frame_refs[LAST3_FRAME - 1].is_valid)
#define GOLDEN_IS_VALID(cm) ((cm)->frame_refs[GOLDEN_FRAME - 1].is_valid)
#define BWDREF_IS_VALID(cm) ((cm)->frame_refs[BWDREF_FRAME - 1].is_valid)
#define ALTREF2_IS_VALID(cm) ((cm)->frame_refs[ALTREF2_FRAME - 1].is_valid)
#define ALTREF_IS_VALID(cm) ((cm)->frame_refs[ALTREF_FRAME - 1].is_valid)
#define L_OR_L2(cm) (LAST_IS_VALID(cm) || LAST2_IS_VALID(cm))
#define L_AND_L2(cm) (LAST_IS_VALID(cm) && LAST2_IS_VALID(cm))
#define L_AND_L3(cm) (LAST_IS_VALID(cm) && LAST3_IS_VALID(cm))
#define L_AND_G(cm) (LAST_IS_VALID(cm) && GOLDEN_IS_VALID(cm))
#define L3_OR_G(cm) (LAST3_IS_VALID(cm) || GOLDEN_IS_VALID(cm))
#define L3_AND_G(cm) (LAST3_IS_VALID(cm) && GOLDEN_IS_VALID(cm))
#define BWD_OR_ALT2(cm) (BWDREF_IS_VALID(cm) || ALTREF2_IS_VALID(cm))
#define BWD_AND_ALT2(cm) (BWDREF_IS_VALID(cm) && ALTREF2_IS_VALID(cm))
#define BWD_OR_ALT(cm) (BWDREF_IS_VALID(cm) || ALTREF_IS_VALID(cm))
#define BWD_AND_ALT(cm) (BWDREF_IS_VALID(cm) && ALTREF_IS_VALID(cm))
#endif // CONFIG_VAR_REFS
static
INLINE
int
mi_cols_aligned_to_sb
(
const
AV1_COMMON
*
cm
)
{
static
INLINE
int
mi_cols_aligned_to_sb
(
const
AV1_COMMON
*
cm
)
{
return
ALIGN_POWER_OF_TWO
(
cm
->
mi_cols
,
cm
->
mib_size_log2
);
return
ALIGN_POWER_OF_TWO
(
cm
->
mi_cols
,
cm
->
mib_size_log2
);
}
}
...
...
av1/decoder/decodeframe.c
View file @
4be6cb32
...
@@ -2630,38 +2630,6 @@ static void read_compound_tools(AV1_COMMON *cm,
...
@@ -2630,38 +2630,6 @@ static void read_compound_tools(AV1_COMMON *cm,
}
}
}
}
#if CONFIG_VAR_REFS
static
void
check_valid_ref_frames
(
AV1_COMMON
*
cm
)
{
MV_REFERENCE_FRAME
ref_frame
;
// TODO(zoeliu): To handle ALTREF_FRAME the same way as do with other
// reference frames: Current encoder invalid ALTREF when ALTREF
// is the same as LAST, but invalid all the other references
// when they are the same as ALTREF.
for
(
ref_frame
=
LAST_FRAME
;
ref_frame
<=
ALTREF_FRAME
;
++
ref_frame
)
{
RefBuffer
*
const
ref_buf
=
&
cm
->
frame_refs
[
ref_frame
-
LAST_FRAME
];
if
(
ref_buf
->
idx
!=
INVALID_IDX
)
{
ref_buf
->
is_valid
=
1
;
MV_REFERENCE_FRAME
ref
;
for
(
ref
=
LAST_FRAME
;
ref
<
ref_frame
;
++
ref
)
{
RefBuffer
*
const
buf
=
&
cm
->
frame_refs
[
ref
-
LAST_FRAME
];
if
(
buf
->
is_valid
&&
buf
->
idx
==
ref_buf
->
idx
)
{
if
(
ref_frame
!=
ALTREF_FRAME
||
ref
==
LAST_FRAME
)
{
ref_buf
->
is_valid
=
0
;
break
;
}
else
{
buf
->
is_valid
=
0
;
}
}
}
}
else
{
ref_buf
->
is_valid
=
0
;
}
}
}
#endif // CONFIG_VAR_REFS
static
int
read_global_motion_params
(
WarpedMotionParams
*
params
,
static
int
read_global_motion_params
(
WarpedMotionParams
*
params
,
const
WarpedMotionParams
*
ref_params
,
const
WarpedMotionParams
*
ref_params
,
struct
aom_read_bit_buffer
*
rb
,
struct
aom_read_bit_buffer
*
rb
,
...
@@ -2930,9 +2898,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
...
@@ -2930,9 +2898,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
for
(
i
=
0
;
i
<
INTER_REFS_PER_FRAME
;
++
i
)
{
for
(
i
=
0
;
i
<
INTER_REFS_PER_FRAME
;
++
i
)
{
cm
->
frame_refs
[
i
].
idx
=
INVALID_IDX
;
cm
->
frame_refs
[
i
].
idx
=
INVALID_IDX
;
cm
->
frame_refs
[
i
].
buf
=
NULL
;
cm
->
frame_refs
[
i
].
buf
=
NULL
;
#if CONFIG_VAR_REFS
cm
->
frame_refs
[
i
].
is_valid
=
0
;
#endif // CONFIG_VAR_REFS
}
}
#if CONFIG_FRAME_SIZE
#if CONFIG_FRAME_SIZE
...
@@ -3076,10 +3041,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
...
@@ -3076,10 +3041,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#endif // CONFIG_REFERENCE_BUFFER
#endif // CONFIG_REFERENCE_BUFFER
}
}
#if CONFIG_VAR_REFS
check_valid_ref_frames
(
cm
);
#endif // CONFIG_VAR_REFS
#if CONFIG_FRAME_SIZE
#if CONFIG_FRAME_SIZE
if
(
cm
->
error_resilient_mode
==
0
&&
frame_size_override_flag
)
{
if
(
cm
->
error_resilient_mode
==
0
&&
frame_size_override_flag
)
{
setup_frame_size_with_refs
(
cm
,
rb
);
setup_frame_size_with_refs
(
cm
,
rb
);
...
...
av1/decoder/decodemv.c
View file @
4be6cb32
...
@@ -1437,10 +1437,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
...
@@ -1437,10 +1437,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
aom_reader
*
r
)
{
aom_reader
*
r
)
{
const
int
ctx
=
av1_get_comp_reference_type_context
(
xd
);
const
int
ctx
=
av1_get_comp_reference_type_context
(
xd
);
COMP_REFERENCE_TYPE
comp_ref_type
;
COMP_REFERENCE_TYPE
comp_ref_type
;
#if CONFIG_VAR_REFS
if
((
L_OR_L2
(
cm
)
||
L3_OR_G
(
cm
))
&&
BWD_OR_ALT
(
cm
))
{
if
(
L_AND_L2
(
cm
)
||
L_AND_L3
(
cm
)
||
L_AND_G
(
cm
)
||
BWD_AND_ALT
(
cm
))
{
#endif // CONFIG_VAR_REFS
#if CONFIG_NEW_MULTISYMBOL
#if CONFIG_NEW_MULTISYMBOL
(
void
)
cm
;
(
void
)
cm
;
comp_ref_type
=
(
COMP_REFERENCE_TYPE
)
aom_read_symbol
(
comp_ref_type
=
(
COMP_REFERENCE_TYPE
)
aom_read_symbol
(
...
@@ -1449,14 +1445,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
...
@@ -1449,14 +1445,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
comp_ref_type
=
(
COMP_REFERENCE_TYPE
)
aom_read
(
comp_ref_type
=
(
COMP_REFERENCE_TYPE
)
aom_read
(
r
,
cm
->
fc
->
comp_ref_type_prob
[
ctx
],
ACCT_STR
);
r
,
cm
->
fc
->
comp_ref_type_prob
[
ctx
],
ACCT_STR
);
#endif
#endif
#if CONFIG_VAR_REFS
}
else
{
comp_ref_type
=
BIDIR_COMP_REFERENCE
;
}
}
else
{
comp_ref_type
=
UNIDIR_COMP_REFERENCE
;
}
#endif // CONFIG_VAR_REFS
FRAME_COUNTS
*
counts
=
xd
->
counts
;
FRAME_COUNTS
*
counts
=
xd
->
counts
;
if
(
counts
)
++
counts
->
comp_ref_type
[
ctx
][
comp_ref_type
];
if
(
counts
)
++
counts
->
comp_ref_type
[
ctx
][
comp_ref_type
];
return
comp_ref_type
;
// UNIDIR_COMP_REFERENCE or BIDIR_COMP_REFERENCE
return
comp_ref_type
;
// UNIDIR_COMP_REFERENCE or BIDIR_COMP_REFERENCE
...
@@ -1564,14 +1552,7 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
...
@@ -1564,14 +1552,7 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
if
(
comp_ref_type
==
UNIDIR_COMP_REFERENCE
)
{
if
(
comp_ref_type
==
UNIDIR_COMP_REFERENCE
)
{
const
int
ctx
=
av1_get_pred_context_uni_comp_ref_p
(
xd
);
const
int
ctx
=
av1_get_pred_context_uni_comp_ref_p
(
xd
);
int
bit
;
int
bit
;
#if CONFIG_VAR_REFS
if
((
L_AND_L2
(
cm
)
||
L_AND_L3
(
cm
)
||
L_AND_G
(
cm
))
&&
BWD_AND_ALT
(
cm
))
#endif // CONFIG_VAR_REFS
bit
=
READ_REF_BIT2
(
uni_comp_ref_p
);
bit
=
READ_REF_BIT2
(
uni_comp_ref_p
);
#if CONFIG_VAR_REFS
else
bit
=
BWD_AND_ALT
(
cm
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
uni_comp_ref
[
ctx
][
0
][
bit
];
if
(
counts
)
++
counts
->
uni_comp_ref
[
ctx
][
0
][
bit
];
if
(
bit
)
{
if
(
bit
)
{
...
@@ -1580,27 +1561,13 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
...
@@ -1580,27 +1561,13 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
else
{
}
else
{
const
int
ctx1
=
av1_get_pred_context_uni_comp_ref_p1
(
xd
);
const
int
ctx1
=
av1_get_pred_context_uni_comp_ref_p1
(
xd
);
int
bit1
;
int
bit1
;
#if CONFIG_VAR_REFS
if
(
L_AND_L2
(
cm
)
&&
(
L_AND_L3
(
cm
)
||
L_AND_G
(
cm
)))
#endif // CONFIG_VAR_REFS
bit1
=
READ_REF_BIT2
(
uni_comp_ref_p1
);
bit1
=
READ_REF_BIT2
(
uni_comp_ref_p1
);
#if CONFIG_VAR_REFS
else
bit1
=
L_AND_L3
(
cm
)
||
L_AND_G
(
cm
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
uni_comp_ref
[
ctx1
][
1
][
bit1
];
if
(
counts
)
++
counts
->
uni_comp_ref
[
ctx1
][
1
][
bit1
];
if
(
bit1
)
{
if
(
bit1
)
{
const
int
ctx2
=
av1_get_pred_context_uni_comp_ref_p2
(
xd
);
const
int
ctx2
=
av1_get_pred_context_uni_comp_ref_p2
(
xd
);
int
bit2
;
int
bit2
;
#if CONFIG_VAR_REFS
if
(
L_AND_L3
(
cm
)
&&
L_AND_G
(
cm
))
#endif // CONFIG_VAR_REFS
bit2
=
READ_REF_BIT2
(
uni_comp_ref_p2
);
bit2
=
READ_REF_BIT2
(
uni_comp_ref_p2
);
#if CONFIG_VAR_REFS
else
bit2
=
L_AND_G
(
cm
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
uni_comp_ref
[
ctx2
][
2
][
bit2
];
if
(
counts
)
++
counts
->
uni_comp_ref
[
ctx2
][
2
][
bit2
];
if
(
bit2
)
{
if
(
bit2
)
{
...
@@ -1630,74 +1597,29 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
...
@@ -1630,74 +1597,29 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS)
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS)
const
int
ctx
=
av1_get_pred_context_comp_ref_p
(
cm
,
xd
);
const
int
ctx
=
av1_get_pred_context_comp_ref_p
(
cm
,
xd
);
#if CONFIG_VAR_REFS
int
bit
;
// Test need to explicitly code (L,L2) vs (L3,G) branch node in tree
if
(
L_OR_L2
(
cm
)
&&
L3_OR_G
(
cm
))
bit
=
READ_REF_BIT
(
comp_ref_p
);
else
bit
=
L3_OR_G
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit
=
READ_REF_BIT
(
comp_ref_p
);
const
int
bit
=
READ_REF_BIT
(
comp_ref_p
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
comp_ref
[
ctx
][
0
][
bit
];
if
(
counts
)
++
counts
->
comp_ref
[
ctx
][
0
][
bit
];
// Decode forward references.
// Decode forward references.
if
(
!
bit
)
{
if
(
!
bit
)
{
const
int
ctx1
=
av1_get_pred_context_comp_ref_p1
(
cm
,
xd
);
const
int
ctx1
=
av1_get_pred_context_comp_ref_p1
(
cm
,
xd
);
#if CONFIG_VAR_REFS
int
bit1
;
// Test need to explicitly code (L) vs (L2) branch node in tree
if
(
L_AND_L2
(
cm
))
bit1
=
READ_REF_BIT
(
comp_ref_p1
);
else
bit1
=
LAST_IS_VALID
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit1
=
READ_REF_BIT
(
comp_ref_p1
);
const
int
bit1
=
READ_REF_BIT
(
comp_ref_p1
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
comp_ref
[
ctx1
][
1
][
bit1
];
if
(
counts
)
++
counts
->
comp_ref
[
ctx1
][
1
][
bit1
];
ref_frame
[
!
idx
]
=
cm
->
comp_fwd_ref
[
bit1
?
0
:
1
];
ref_frame
[
!
idx
]
=
cm
->
comp_fwd_ref
[
bit1
?
0
:
1
];
}
else
{
}
else
{
const
int
ctx2
=
av1_get_pred_context_comp_ref_p2
(
cm
,
xd
);
const
int
ctx2
=
av1_get_pred_context_comp_ref_p2
(
cm
,
xd
);
#if CONFIG_VAR_REFS
int
bit2
;
// Test need to explicitly code (L3) vs (G) branch node in tree
if
(
L3_AND_G
(
cm
))
bit2
=
READ_REF_BIT
(
comp_ref_p2
);
else
bit2
=
GOLDEN_IS_VALID
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit2
=
READ_REF_BIT
(
comp_ref_p2
);
const
int
bit2
=
READ_REF_BIT
(
comp_ref_p2
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
comp_ref
[
ctx2
][
2
][
bit2
];
if
(
counts
)
++
counts
->
comp_ref
[
ctx2
][
2
][
bit2
];
ref_frame
[
!
idx
]
=
cm
->
comp_fwd_ref
[
bit2
?
3
:
2
];
ref_frame
[
!
idx
]
=
cm
->
comp_fwd_ref
[
bit2
?
3
:
2
];
}
}
// Decode backward references.
// Decode backward references.
const
int
ctx_bwd
=
av1_get_pred_context_comp_bwdref_p
(
cm
,
xd
);
const
int
ctx_bwd
=
av1_get_pred_context_comp_bwdref_p
(
cm
,
xd
);
#if CONFIG_VAR_REFS
int
bit_bwd
;
// Test need to explicitly code (BWD/ALT2) vs (ALT) branch node in tree
const
int
bit_bwd_uncertain
=
BWD_OR_ALT2
(
cm
)
&&
ALTREF_IS_VALID
(
cm
);
if
(
bit_bwd_uncertain
)
bit_bwd
=
READ_REF_BIT
(
comp_bwdref_p
);
else
bit_bwd
=
ALTREF_IS_VALID
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit_bwd
=
READ_REF_BIT
(
comp_bwdref_p
);
const
int
bit_bwd
=
READ_REF_BIT
(
comp_bwdref_p
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
comp_bwdref
[
ctx_bwd
][
0
][
bit_bwd
];
if
(
counts
)
++
counts
->
comp_bwdref
[
ctx_bwd
][
0
][
bit_bwd
];
if
(
!
bit_bwd
)
{
if
(
!
bit_bwd
)
{
const
int
ctx1_bwd
=
av1_get_pred_context_comp_bwdref_p1
(
cm
,
xd
);
const
int
ctx1_bwd
=
av1_get_pred_context_comp_bwdref_p1
(
cm
,
xd
);
#if CONFIG_VAR_REFS
int
bit1_bwd
;
if
(
BWD_AND_ALT2
(
cm
))
bit1_bwd
=
READ_REF_BIT
(
comp_bwdref_p1
);
else
bit1_bwd
=
ALTREF2_IS_VALID
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit1_bwd
=
READ_REF_BIT
(
comp_bwdref_p1
);
const
int
bit1_bwd
=
READ_REF_BIT
(
comp_bwdref_p1
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
comp_bwdref
[
ctx1_bwd
][
1
][
bit1_bwd
];
if
(
counts
)
++
counts
->
comp_bwdref
[
ctx1_bwd
][
1
][
bit1_bwd
];
ref_frame
[
idx
]
=
cm
->
comp_bwd_ref
[
bit1_bwd
];
ref_frame
[
idx
]
=
cm
->
comp_bwd_ref
[
bit1_bwd
];
}
else
{
}
else
{
...
@@ -1705,45 +1627,16 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
...
@@ -1705,45 +1627,16 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
}
}
else
if
(
mode
==
SINGLE_REFERENCE
)
{
}
else
if
(
mode
==
SINGLE_REFERENCE
)
{
const
int
ctx0
=
av1_get_pred_context_single_ref_p1
(
xd
);
const
int
ctx0
=
av1_get_pred_context_single_ref_p1
(
xd
);
#if CONFIG_VAR_REFS
int
bit0
;
// Test need to explicitly code (L,L2,L3,G) vs (BWD,ALT2,ALT) branch node
// in tree
if
((
L_OR_L2
(
cm
)
||
L3_OR_G
(
cm
))
&&
(
BWD_OR_ALT2
(
cm
)
||
ALTREF_IS_VALID
(
cm
)))
bit0
=
READ_REF_BIT
(
single_ref_p1
);
else
bit0
=
(
BWD_OR_ALT2
(
cm
)
||
ALTREF_IS_VALID
(
cm
));
#else // !CONFIG_VAR_REFS
const
int
bit0
=
READ_REF_BIT
(
single_ref_p1
);
const
int
bit0
=
READ_REF_BIT
(
single_ref_p1
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx0
][
0
][
bit0
];
if
(
counts
)
++
counts
->
single_ref
[
ctx0
][
0
][
bit0
];
if
(
bit0
)
{
if
(
bit0
)
{
const
int
ctx1
=
av1_get_pred_context_single_ref_p2
(
xd
);
const
int
ctx1
=
av1_get_pred_context_single_ref_p2
(
xd
);
#if CONFIG_VAR_REFS
int
bit1
;
// Test need to explicitly code (BWD/ALT2) vs (ALT) branch node in tree
const
int
bit1_uncertain
=
BWD_OR_ALT2
(
cm
)
&&
ALTREF_IS_VALID
(
cm
);
if
(
bit1_uncertain
)
bit1
=
READ_REF_BIT
(
single_ref_p2
);
else
bit1
=
ALTREF_IS_VALID
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit1
=
READ_REF_BIT
(
single_ref_p2
);
const
int
bit1
=
READ_REF_BIT
(
single_ref_p2
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx1
][
1
][
bit1
];
if
(
counts
)
++
counts
->
single_ref
[
ctx1
][
1
][
bit1
];
if
(
!
bit1
)
{
if
(
!
bit1
)
{
const
int
ctx5
=
av1_get_pred_context_single_ref_p6
(
xd
);
const
int
ctx5
=
av1_get_pred_context_single_ref_p6
(
xd
);
#if CONFIG_VAR_REFS
int
bit5
;
if
(
BWD_AND_ALT2
(
cm
))
bit5
=
READ_REF_BIT
(
single_ref_p6
);
else
bit5
=
ALTREF2_IS_VALID
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit5
=
READ_REF_BIT
(
single_ref_p6
);
const
int
bit5
=
READ_REF_BIT
(
single_ref_p6
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx5
][
5
][
bit5
];
if
(
counts
)
++
counts
->
single_ref
[
ctx5
][
5
][
bit5
];
ref_frame
[
0
]
=
bit5
?
ALTREF2_FRAME
:
BWDREF_FRAME
;
ref_frame
[
0
]
=
bit5
?
ALTREF2_FRAME
:
BWDREF_FRAME
;
}
else
{
}
else
{
...
@@ -1751,43 +1644,16 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
...
@@ -1751,43 +1644,16 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
}
}
else
{
}
else
{
const
int
ctx2
=
av1_get_pred_context_single_ref_p3
(
xd
);
const
int
ctx2
=
av1_get_pred_context_single_ref_p3
(
xd
);
#if CONFIG_VAR_REFS
int
bit2
;
// Test need to explicitly code (L,L2) vs (L3,G) branch node in tree
if
(
L_OR_L2
(
cm
)
&&
L3_OR_G
(
cm
))
bit2
=
READ_REF_BIT
(
single_ref_p3
);
else
bit2
=
L3_OR_G
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit2
=
READ_REF_BIT
(
single_ref_p3
);
const
int
bit2
=
READ_REF_BIT
(
single_ref_p3
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx2
][
2
][
bit2
];
if
(
counts
)
++
counts
->
single_ref
[
ctx2
][
2
][
bit2
];
if
(
bit2
)
{
if
(
bit2
)
{
const
int
ctx4
=
av1_get_pred_context_single_ref_p5
(
xd
);
const
int
ctx4
=
av1_get_pred_context_single_ref_p5
(
xd
);
#if CONFIG_VAR_REFS
int
bit4
;
// Test need to explicitly code (L3) vs (G) branch node in tree
if
(
L3_AND_G
(
cm
))
bit4
=
READ_REF_BIT
(
single_ref_p5
);
else
bit4
=
GOLDEN_IS_VALID
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit4
=
READ_REF_BIT
(
single_ref_p5
);
const
int
bit4
=
READ_REF_BIT
(
single_ref_p5
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx4
][
4
][
bit4
];
if
(
counts
)
++
counts
->
single_ref
[
ctx4
][
4
][
bit4
];
ref_frame
[
0
]
=
bit4
?
GOLDEN_FRAME
:
LAST3_FRAME
;
ref_frame
[
0
]
=
bit4
?
GOLDEN_FRAME
:
LAST3_FRAME
;
}
else
{
}
else
{
const
int
ctx3
=
av1_get_pred_context_single_ref_p4
(
xd
);
const
int
ctx3
=
av1_get_pred_context_single_ref_p4
(
xd
);
#if CONFIG_VAR_REFS
int
bit3
;
// Test need to explicitly code (L) vs (L2) branch node in tree
if
(
L_AND_L2
(
cm
))
bit3
=
READ_REF_BIT
(
single_ref_p4
);
else
bit3
=
LAST2_IS_VALID
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit3
=
READ_REF_BIT
(
single_ref_p4
);
const
int
bit3
=
READ_REF_BIT
(
single_ref_p4
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx3
][
3
][
bit3
];
if
(
counts
)
++
counts
->
single_ref
[
ctx3
][
3
][
bit3
];
ref_frame
[
0
]
=
bit3
?
LAST2_FRAME
:
LAST_FRAME
;
ref_frame
[
0
]
=
bit3
?
LAST2_FRAME
:
LAST_FRAME
;
}
}
...
...
av1/encoder/bitstream.c
View file @
4be6cb32
...
@@ -828,51 +828,26 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
...
@@ -828,51 +828,26 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const
COMP_REFERENCE_TYPE
comp_ref_type
=
has_uni_comp_refs
(
mbmi
)
const
COMP_REFERENCE_TYPE
comp_ref_type
=
has_uni_comp_refs
(
mbmi
)
?
UNIDIR_COMP_REFERENCE
?
UNIDIR_COMP_REFERENCE
:
BIDIR_COMP_REFERENCE
;
:
BIDIR_COMP_REFERENCE
;
#if CONFIG_VAR_REFS
if
((
L_OR_L2
(
cm
)
||
L3_OR_G
(
cm
))
&&
BWD_OR_ALT
(
cm
))
if
(
L_AND_L2
(
cm
)
||
L_AND_L3
(
cm
)
||
L_AND_G
(
cm
)
||
BWD_AND_ALT
(
cm
))
#endif // CONFIG_VAR_REFS
#if CONFIG_NEW_MULTISYMBOL
#if CONFIG_NEW_MULTISYMBOL
aom_write_symbol
(
w
,
comp_ref_type
,
aom_write_symbol
(
w
,
comp_ref_type
,
av1_get_comp_reference_type_cdf
(
xd
)
,
av1_get_comp_reference_type_cdf
(
xd
),
2
);
2
);
#else
#else
aom_write
(
w
,
comp_ref_type
,
av1_get_comp_reference_type_prob
(
cm
,
xd
));
aom_write
(
w
,
comp_ref_type
,
av1_get_comp_reference_type_prob
(
cm
,
xd
));
#endif
#endif
#if CONFIG_VAR_REFS
else
assert
(
comp_ref_type
==
BIDIR_COMP_REFERENCE
);
else
assert
(
comp_ref_type
==
UNIDIR_COMP_REFERENCE
);
#endif // CONFIG_VAR_REFS
if
(
comp_ref_type
==
UNIDIR_COMP_REFERENCE
)
{
if
(
comp_ref_type
==
UNIDIR_COMP_REFERENCE
)
{
const
int
bit
=
mbmi
->
ref_frame
[
0
]
==
BWDREF_FRAME
;
const
int
bit
=
mbmi
->
ref_frame
[
0
]
==
BWDREF_FRAME
;
#if CONFIG_VAR_REFS
if
((
L_AND_L2
(
cm
)
||
L_AND_L3
(
cm
)
||
L_AND_G
(
cm
))
&&
BWD_AND_ALT
(
cm
))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT2
(
bit
,
uni_comp_ref_p
);
WRITE_REF_BIT2
(
bit
,
uni_comp_ref_p
);
if
(
!
bit
)
{
if
(
!
bit
)
{
assert
(
mbmi
->
ref_frame
[
0
]
==
LAST_FRAME
);
assert
(
mbmi
->
ref_frame
[
0
]
==
LAST_FRAME
);
#if CONFIG_VAR_REFS
if
(
L_AND_L2
(
cm
)
&&
(
L_AND_L3
(
cm
)
||
L_AND_G
(
cm
)))
{
#endif // CONFIG_VAR_REFS
const
int
bit1
=
mbmi
->
ref_frame
[
1
]
==
LAST3_FRAME
||
const
int
bit1
=
mbmi
->
ref_frame
[
1
]
==
LAST3_FRAME
||
mbmi
->
ref_frame
[
1
]
==
GOLDEN_FRAME
;
mbmi
->
ref_frame
[
1
]
==
GOLDEN_FRAME
;
WRITE_REF_BIT2
(
bit1
,
uni_comp_ref_p1
);
WRITE_REF_BIT2
(
bit1
,
uni_comp_ref_p1
);
if
(
bit1
)
{
if
(
bit1
)
{
#if CONFIG_VAR_REFS
if
(
L_AND_L3
(
cm
)
&&
L_AND_G
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit2
=
mbmi
->
ref_frame
[
1
]
==
GOLDEN_FRAME
;
const
int
bit2
=
mbmi
->
ref_frame
[
1
]
==
GOLDEN_FRAME
;
WRITE_REF_BIT2
(
bit2
,
uni_comp_ref_p2
);
WRITE_REF_BIT2
(
bit2
,
uni_comp_ref_p2
);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
}
#if CONFIG_VAR_REFS
}
}
#endif // CONFIG_VAR_REFS
}
else
{
}
else
{
assert
(
mbmi
->
ref_frame
[
1
]
==
ALTREF_FRAME
);
assert
(
mbmi
->
ref_frame
[
1
]
==
ALTREF_FRAME
);
}
}
...
@@ -885,111 +860,46 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
...
@@ -885,111 +860,46 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const
int
bit
=
(
mbmi
->
ref_frame
[
0
]
==
GOLDEN_FRAME
||
const
int
bit
=
(
mbmi
->
ref_frame
[
0
]
==
GOLDEN_FRAME
||
mbmi
->
ref_frame
[
0
]
==
LAST3_FRAME
);
mbmi
->
ref_frame
[
0
]
==
LAST3_FRAME
);
#if CONFIG_VAR_REFS
// Test need to explicitly code (L,L2) vs (L3,G) branch node in tree
if
(
L_OR_L2
(
cm
)
&&
L3_OR_G
(
cm
))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT
(
bit
,
comp_ref_p
);
WRITE_REF_BIT
(
bit
,
comp_ref_p
);
if
(
!
bit
)
{
if
(
!
bit
)
{
#if CONFIG_VAR_REFS
// Test need to explicitly code (L) vs (L2) branch node in tree
if
(
L_AND_L2
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit1
=
mbmi
->
ref_frame
[
0
]
==
LAST_FRAME
;
const
int
bit1
=
mbmi
->
ref_frame
[
0
]
==
LAST_FRAME
;
WRITE_REF_BIT
(
bit1
,
comp_ref_p1
);
WRITE_REF_BIT
(
bit1
,
comp_ref_p1
);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
}
else
{
}
else
{
#if CONFIG_VAR_REFS
// Test need to explicitly code (L3) vs (G) branch node in tree
if
(
L3_AND_G
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit2
=
mbmi
->
ref_frame
[
0
]
==
GOLDEN_FRAME
;
const
int
bit2
=
mbmi
->
ref_frame
[
0
]
==
GOLDEN_FRAME
;
WRITE_REF_BIT
(
bit2
,
comp_ref_p2
);
WRITE_REF_BIT
(
bit2
,
comp_ref_p2
);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
}
}
#if CONFIG_VAR_REFS
// Test need to explicitly code (BWD,ALT2) vs (ALT) branch node in tree
if
(
BWD_OR_ALT2
(
cm
)
&&
ALTREF_IS_VALID
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit_bwd
=
mbmi
->
ref_frame
[
1
]
==
ALTREF_FRAME
;
const
int
bit_bwd
=
mbmi
->
ref_frame
[
1
]
==
ALTREF_FRAME
;
WRITE_REF_BIT
(
bit_bwd
,
comp_bwdref_p
);
WRITE_REF_BIT
(
bit_bwd
,
comp_bwdref_p
);
if
(
!
bit_bwd
)
{
if
(
!
bit_bwd
)
{
#if CONFIG_VAR_REFS
// Test need to explicitly code (BWD,ALT2) vs (ALT) branch node in
// tree
if
(
BWD_AND_ALT2
(
cm
))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT
(
mbmi
->
ref_frame
[
1
]
==
ALTREF2_FRAME
,
comp_bwdref_p1
);
WRITE_REF_BIT
(
mbmi
->
ref_frame
[
1
]
==
ALTREF2_FRAME
,
comp_bwdref_p1
);
}
}
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
}
else
{
}
else
{
const
int
bit0
=
(
mbmi
->
ref_frame
[
0
]
<=
ALTREF_FRAME
&&
const
int
bit0
=
(
mbmi
->
ref_frame
[
0
]
<=
ALTREF_FRAME
&&
mbmi
->
ref_frame
[
0
]
>=
BWDREF_FRAME
);
mbmi
->
ref_frame
[
0
]
>=
BWDREF_FRAME
);
#if CONFIG_VAR_REFS
// Test need to explicitly code (L,L2,L3,G) vs (BWD,ALT2,ALT) branch node
// in tree
if
((
L_OR_L2
(
cm
)
||
L3_OR_G
(
cm
))
&&
(
BWD_OR_ALT2
(
cm
)
||
ALTREF_IS_VALID
(
cm
)))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT
(
bit0
,
single_ref_p1
);
WRITE_REF_BIT
(
bit0
,
single_ref_p1
);
if
(
bit0
)
{
if
(
bit0
)
{
#if CONFIG_VAR_REFS
// Test need to explicitly code (BWD,ALT2) vs (ALT) branch node in tree
if
(
BWD_OR_ALT2
(
cm
)
&&
ALTREF_IS_VALID
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit1
=
mbmi
->
ref_frame
[
0
]
==
ALTREF_FRAME
;
const
int
bit1
=
mbmi
->
ref_frame
[
0
]
==
ALTREF_FRAME
;
WRITE_REF_BIT
(
bit1
,
single_ref_p2
);
WRITE_REF_BIT
(
bit1
,
single_ref_p2
);
if
(
!
bit1
)
{
if
(
!
bit1
)
{
#if CONFIG_VAR_REFS
// Test need to explicitly code (BWD) vs (ALT2) branch node in tree
if
(
BWD_AND_ALT2
(
cm
))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT
(
mbmi
->
ref_frame
[
0
]
==
ALTREF2_FRAME
,
single_ref_p6
);
WRITE_REF_BIT
(
mbmi
->
ref_frame
[
0
]
==
ALTREF2_FRAME
,
single_ref_p6
);
}
}
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
}
else
{
}
else
{
const
int
bit2
=
(
mbmi
->
ref_frame
[
0
]
==
LAST3_FRAME
||
const
int
bit2
=
(
mbmi
->
ref_frame
[
0
]
==
LAST3_FRAME
||
mbmi
->
ref_frame
[
0
]
==
GOLDEN_FRAME
);
mbmi
->
ref_frame
[
0
]
==
GOLDEN_FRAME
);
#if CONFIG_VAR_REFS
// Test need to explicitly code (L,L2) vs (L3,G) branch node in tree
if
(
L_OR_L2
(
cm
)
&&
L3_OR_G
(
cm
))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT
(
bit2
,
single_ref_p3
);
WRITE_REF_BIT
(
bit2
,
single_ref_p3
);
if
(
!
bit2
)
{
if
(
!
bit2
)
{
#if CONFIG_VAR_REFS
// Test need to explicitly code (L) vs (L2) branch node in tree
if
(
L_AND_L2
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit3
=
mbmi
->
ref_frame
[
0
]
!=
LAST_FRAME
;