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
315f5784
Commit
315f5784
authored
Jun 14, 2017
by
Thomas Davies
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NEW_MULTISYMBOL: adapt single_ref flags.
Change-Id: I4092f9ca0f5497bffee31ec4a1e9804e90def42e
parent
860def60
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
118 additions
and
27 deletions
+118
-27
av1/common/entropy.c
av1/common/entropy.c
+2
-2
av1/common/entropymode.c
av1/common/entropymode.c
+46
-0
av1/common/entropymode.h
av1/common/entropymode.h
+1
-0
av1/common/pred_common.h
av1/common/pred_common.h
+28
-0
av1/decoder/decodeframe.c
av1/decoder/decodeframe.c
+1
-1
av1/decoder/decodemv.c
av1/decoder/decodemv.c
+24
-16
av1/encoder/bitstream.c
av1/encoder/bitstream.c
+16
-8
No files found.
av1/common/entropy.c
View file @
315f5784
...
...
@@ -5696,9 +5696,9 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
// FIXME: comp_ref_cdf and comp_bwd_ref not defined
// FIXME: single_ref_cdf not defined
#if CONFIG_NEW_MULTISYMBOL
AVERAGE_TILE_CDFS
(
single_ref_cdf
)
AVERAGE_TILE_CDFS
(
newmv_cdf
)
AVERAGE_TILE_CDFS
(
zeromv_cdf
)
AVERAGE_TILE_CDFS
(
refmv_cdf
)
...
...
av1/common/entropymode.c
View file @
315f5784
...
...
@@ -1421,6 +1421,49 @@ static const aom_prob default_single_ref_p[REF_CONTEXTS][SINGLE_REFS - 1] = {
{
33
,
16
},
{
77
,
74
},
{
142
,
142
},
{
172
,
170
},
{
238
,
247
}
#endif // CONFIG_EXT_REFS
};
#if CONFIG_NEW_MULTISYMBOL
static
const
aom_cdf_prob
default_single_ref_cdf
[
REF_CONTEXTS
][
SINGLE_REFS
-
1
][
CDF_SIZE
(
2
)]
=
{
#if CONFIG_EXT_REFS
{
{
AOM_ICDF
(
33
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
16
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
16
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
16
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
16
*
128
),
AOM_ICDF
(
32768
),
0
}
},
{
{
AOM_ICDF
(
77
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
74
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
74
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
74
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
74
*
128
),
AOM_ICDF
(
32768
),
0
}
},
{
{
AOM_ICDF
(
142
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
142
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
142
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
142
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
142
*
128
),
AOM_ICDF
(
32768
),
0
}
},
{
{
AOM_ICDF
(
172
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
170
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
170
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
170
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
170
*
128
),
AOM_ICDF
(
32768
),
0
}
},
{
{
AOM_ICDF
(
238
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
247
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
247
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
247
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
247
*
128
),
AOM_ICDF
(
32768
),
0
}
}
#else
{
{
AOM_ICDF
(
33
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
16
*
128
),
AOM_ICDF
(
32768
),
0
}
},
{
{
AOM_ICDF
(
77
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
74
*
128
),
AOM_ICDF
(
32768
),
0
}
},
{
{
AOM_ICDF
(
142
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
142
*
128
),
AOM_ICDF
(
32768
),
0
}
},
{
{
AOM_ICDF
(
172
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
170
*
128
),
AOM_ICDF
(
32768
),
0
}
},
{
{
AOM_ICDF
(
238
*
128
),
AOM_ICDF
(
32768
),
0
},
{
AOM_ICDF
(
247
*
128
),
AOM_ICDF
(
32768
),
0
}
}
#endif // CONFIG_EXT_REFS
};
#endif
#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
// TODO(zoeliu): Default values to be further adjusted based on the collected
...
...
@@ -4547,6 +4590,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy
(
fc
->
comp_bwdref_prob
,
default_comp_bwdref_p
);
#endif // CONFIG_EXT_REFS
av1_copy
(
fc
->
single_ref_prob
,
default_single_ref_p
);
#if CONFIG_NEW_MULTISYMBOL
av1_copy
(
fc
->
single_ref_cdf
,
default_single_ref_cdf
);
#endif
#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
av1_copy
(
fc
->
comp_inter_mode_prob
,
default_comp_inter_mode_p
);
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
...
...
av1/common/entropymode.h
View file @
315f5784
...
...
@@ -216,6 +216,7 @@ typedef struct frame_contexts {
aom_prob
comp_inter_prob
[
COMP_INTER_CONTEXTS
];
#if CONFIG_NEW_MULTISYMBOL
aom_cdf_prob
comp_inter_cdf
[
COMP_INTER_CONTEXTS
][
CDF_SIZE
(
2
)];
aom_cdf_prob
single_ref_cdf
[
REF_CONTEXTS
][
SINGLE_REFS
-
1
][
CDF_SIZE
(
2
)];
#endif
aom_prob
single_ref_prob
[
REF_CONTEXTS
][
SINGLE_REFS
-
1
];
#if CONFIG_EXT_REFS
...
...
av1/common/pred_common.h
View file @
315f5784
...
...
@@ -183,6 +183,34 @@ static INLINE aom_prob av1_get_pred_prob_single_ref_p5(const AV1_COMMON *cm,
}
#endif // CONFIG_EXT_REFS
#if CONFIG_NEW_MULTISYMBOL
static
INLINE
aom_cdf_prob
*
av1_get_pred_cdf_single_ref_p1
(
const
MACROBLOCKD
*
xd
)
{
return
xd
->
tile_ctx
->
single_ref_cdf
[
av1_get_pred_context_single_ref_p1
(
xd
)][
0
];
}
static
INLINE
aom_cdf_prob
*
av1_get_pred_cdf_single_ref_p2
(
const
MACROBLOCKD
*
xd
)
{
return
xd
->
tile_ctx
->
single_ref_cdf
[
av1_get_pred_context_single_ref_p2
(
xd
)][
1
];
}
static
INLINE
aom_cdf_prob
*
av1_get_pred_cdf_single_ref_p3
(
const
MACROBLOCKD
*
xd
)
{
return
xd
->
tile_ctx
->
single_ref_cdf
[
av1_get_pred_context_single_ref_p3
(
xd
)][
2
];
}
static
INLINE
aom_cdf_prob
*
av1_get_pred_cdf_single_ref_p4
(
const
MACROBLOCKD
*
xd
)
{
return
xd
->
tile_ctx
->
single_ref_cdf
[
av1_get_pred_context_single_ref_p4
(
xd
)][
3
];
}
static
INLINE
aom_cdf_prob
*
av1_get_pred_cdf_single_ref_p5
(
const
MACROBLOCKD
*
xd
)
{
return
xd
->
tile_ctx
->
single_ref_cdf
[
av1_get_pred_context_single_ref_p5
(
xd
)][
4
];
}
#endif
#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
int
av1_get_inter_mode_context
(
const
MACROBLOCKD
*
xd
);
...
...
av1/decoder/decodeframe.c
View file @
315f5784
...
...
@@ -279,7 +279,6 @@ static void read_frame_reference_mode_probs(AV1_COMMON *cm, aom_reader *r) {
if
(
cm
->
reference_mode
==
REFERENCE_MODE_SELECT
)
for
(
i
=
0
;
i
<
COMP_INTER_CONTEXTS
;
++
i
)
av1_diff_update_prob
(
r
,
&
fc
->
comp_inter_prob
[
i
],
ACCT_STR
);
#endif
if
(
cm
->
reference_mode
!=
COMPOUND_REFERENCE
)
{
for
(
i
=
0
;
i
<
REF_CONTEXTS
;
++
i
)
{
...
...
@@ -288,6 +287,7 @@ static void read_frame_reference_mode_probs(AV1_COMMON *cm, aom_reader *r) {
}
}
}
#endif
if
(
cm
->
reference_mode
!=
SINGLE_REFERENCE
)
{
for
(
i
=
0
;
i
<
REF_CONTEXTS
;
++
i
)
{
...
...
av1/decoder/decodemv.c
View file @
315f5784
...
...
@@ -1280,6 +1280,14 @@ static REFERENCE_MODE read_block_reference_mode(AV1_COMMON *cm,
}
}
#if CONFIG_NEW_MULTISYMBOL
#define READ_REF_BIT(pname) \
aom_read_symbol(r, av1_get_pred_cdf_##pname(xd), 2, ACCT_STR)
#else
#define READ_REF_BIT(pname) \
aom_read(r, av1_get_pred_prob_##pname(cm, xd), ACCT_STR)
#endif
// Read the referncence frame
static
void
read_ref_frames
(
AV1_COMMON
*
const
cm
,
MACROBLOCKD
*
const
xd
,
aom_reader
*
r
,
int
segment_id
,
...
...
@@ -1377,11 +1385,11 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
// Test need to explicitly code (L,L2,L3,G) vs (BWD,ALT) branch node in
// tree
if
((
L_OR_L2
(
cm
)
||
L3_OR_G
(
cm
))
&&
BWD_OR_ALT
(
cm
))
bit0
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx0
][
0
],
ACCT_STR
);
bit0
=
READ_REF_BIT
(
single_ref_p1
);
else
bit0
=
BWD_OR_ALT
(
cm
);
#else // !CONFIG_VAR_REFS
const
int
bit0
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx0
][
0
],
ACCT_STR
);
const
int
bit0
=
READ_REF_BIT
(
single_ref_p1
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx0
][
0
][
bit0
];
...
...
@@ -1391,11 +1399,11 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
int
bit1
;
// Test need to explicitly code (BWD) vs (ALT) branch node in tree
if
(
BWD_AND_ALT
(
cm
))
bit1
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx1
][
1
],
ACCT_STR
);
bit1
=
READ_REF_BIT
(
single_ref_p2
);
else
bit1
=
ALTREF_IS_VALID
(
cm
);
#else
// !CONFIG_VAR_REFS
const
int
bit1
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx1
][
1
],
ACCT_STR
);
#else // !CONFIG_VAR_REFS
const
int
bit1
=
READ_REF_BIT
(
single_ref_p2
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx1
][
1
][
bit1
];
ref_frame
[
0
]
=
bit1
?
ALTREF_FRAME
:
BWDREF_FRAME
;
...
...
@@ -1405,11 +1413,11 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
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
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx2
][
2
],
ACCT_STR
);
bit2
=
READ_REF_BIT
(
single_ref_p3
);
else
bit2
=
L3_OR_G
(
cm
);
#else
// !CONFIG_VAR_REFS
const
int
bit2
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx2
][
2
],
ACCT_STR
);
#else // !CONFIG_VAR_REFS
const
int
bit2
=
READ_REF_BIT
(
single_ref_p3
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx2
][
2
][
bit2
];
if
(
bit2
)
{
...
...
@@ -1418,11 +1426,11 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
int
bit4
;
// Test need to explicitly code (L3) vs (G) branch node in tree
if
(
L3_AND_G
(
cm
))
bit4
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx4
][
4
],
ACCT_STR
);
bit4
=
READ_REF_BIT
(
single_ref_p5
);
else
bit4
=
GOLDEN_IS_VALID
(
cm
);
#else
// !CONFIG_VAR_REFS
const
int
bit4
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx4
][
4
],
ACCT_STR
);
#else // !CONFIG_VAR_REFS
const
int
bit4
=
READ_REF_BIT
(
single_ref_p5
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx4
][
4
][
bit4
];
ref_frame
[
0
]
=
bit4
?
GOLDEN_FRAME
:
LAST3_FRAME
;
...
...
@@ -1432,11 +1440,11 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
int
bit3
;
// Test need to explicitly code (L) vs (L2) branch node in tree
if
(
L_AND_L2
(
cm
))
bit3
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx3
][
3
],
ACCT_STR
);
bit3
=
READ_REF_BIT
(
single_ref_p4
);
else
bit3
=
LAST2_IS_VALID
(
cm
);
#else
// !CONFIG_VAR_REFS
const
int
bit3
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx3
][
3
],
ACCT_STR
);
#else // !CONFIG_VAR_REFS
const
int
bit3
=
READ_REF_BIT
(
single_ref_p4
);
#endif // CONFIG_VAR_REFS
if
(
counts
)
++
counts
->
single_ref
[
ctx3
][
3
][
bit3
];
ref_frame
[
0
]
=
bit3
?
LAST2_FRAME
:
LAST_FRAME
;
...
...
@@ -1444,12 +1452,12 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
#else // !CONFIG_EXT_REFS
const
int
ctx0
=
av1_get_pred_context_single_ref_p1
(
xd
);
const
int
bit0
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx0
][
0
],
ACCT_STR
);
const
int
bit0
=
READ_REF_BIT
(
single_ref_p1
);
if
(
counts
)
++
counts
->
single_ref
[
ctx0
][
0
][
bit0
];
if
(
bit0
)
{
const
int
ctx1
=
av1_get_pred_context_single_ref_p2
(
xd
);
const
int
bit1
=
aom_read
(
r
,
fc
->
single_ref_prob
[
ctx1
][
1
],
ACCT_STR
);
const
int
bit1
=
READ_REF_BIT
(
single_ref_p2
);
if
(
counts
)
++
counts
->
single_ref
[
ctx1
][
1
][
bit1
];
ref_frame
[
0
]
=
bit1
?
ALTREF_FRAME
:
GOLDEN_FRAME
;
}
else
{
...
...
av1/encoder/bitstream.c
View file @
315f5784
...
...
@@ -1221,6 +1221,14 @@ static void write_segment_id(aom_writer *w, const struct segmentation *seg,
}
}
#if CONFIG_NEW_MULTISYMBOL
#define WRITE_REF_BIT(bname, pname) \
aom_write_symbol(w, bname, av1_get_pred_cdf_##pname(xd), 2)
#else
#define WRITE_REF_BIT(bname, pname) \
aom_write(w, bname, av1_get_pred_prob_##pname(cm, xd))
#endif
// This function encodes the reference frame
static
void
write_ref_frames
(
const
AV1_COMMON
*
cm
,
const
MACROBLOCKD
*
xd
,
aom_writer
*
w
)
{
...
...
@@ -1305,7 +1313,7 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
// tree
if
((
L_OR_L2
(
cm
)
||
L3_OR_G
(
cm
))
&&
BWD_OR_ALT
(
cm
))
#endif // CONFIG_VAR_REFS
aom_write
(
w
,
bit0
,
av1_get_pred_prob_single_ref_p1
(
cm
,
xd
)
);
WRITE_REF_BIT
(
bit0
,
single_ref_p1
);
if
(
bit0
)
{
#if CONFIG_VAR_REFS
...
...
@@ -1313,7 +1321,7 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
if
(
BWD_AND_ALT
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit1
=
mbmi
->
ref_frame
[
0
]
==
ALTREF_FRAME
;
aom_write
(
w
,
bit1
,
av1_get_pred_prob_single_ref_p2
(
cm
,
xd
)
);
WRITE_REF_BIT
(
bit1
,
single_ref_p2
);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
...
...
@@ -1324,7 +1332,7 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
// 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
aom_write
(
w
,
bit2
,
av1_get_pred_prob_single_ref_p3
(
cm
,
xd
)
);
WRITE_REF_BIT
(
bit2
,
single_ref_p3
);
if
(
!
bit2
)
{
#if CONFIG_VAR_REFS
...
...
@@ -1332,7 +1340,7 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
if
(
L_AND_L2
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit3
=
mbmi
->
ref_frame
[
0
]
!=
LAST_FRAME
;
aom_write
(
w
,
bit3
,
av1_get_pred_prob_single_ref_p4
(
cm
,
xd
)
);
WRITE_REF_BIT
(
bit3
,
single_ref_p4
);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
...
...
@@ -1342,7 +1350,7 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
if
(
L3_AND_G
(
cm
))
{
#endif // CONFIG_VAR_REFS
const
int
bit4
=
mbmi
->
ref_frame
[
0
]
!=
LAST3_FRAME
;
aom_write
(
w
,
bit4
,
av1_get_pred_prob_single_ref_p5
(
cm
,
xd
)
);
WRITE_REF_BIT
(
bit4
,
single_ref_p5
);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
...
...
@@ -1350,11 +1358,11 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
}
#else // !CONFIG_EXT_REFS
const
int
bit0
=
mbmi
->
ref_frame
[
0
]
!=
LAST_FRAME
;
aom_write
(
w
,
bit0
,
av1_get_pred_prob_single_ref_p1
(
cm
,
xd
)
);
WRITE_REF_BIT
(
bit0
,
single_ref_p1
);
if
(
bit0
)
{
const
int
bit1
=
mbmi
->
ref_frame
[
0
]
!=
GOLDEN_FRAME
;
aom_write
(
w
,
bit1
,
av1_get_pred_prob_single_ref_p2
(
cm
,
xd
)
);
WRITE_REF_BIT
(
bit1
,
single_ref_p2
);
}
#endif // CONFIG_EXT_REFS
}
...
...
@@ -5029,7 +5037,6 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
av1_cond_prob_diff_update
(
header_bc
,
&
fc
->
comp_inter_prob
[
i
],
counts
->
comp_inter
[
i
],
probwt
);
}
#endif
if
(
cm
->
reference_mode
!=
COMPOUND_REFERENCE
)
{
for
(
i
=
0
;
i
<
REF_CONTEXTS
;
i
++
)
{
...
...
@@ -5039,6 +5046,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
}
}
}
#endif
if
(
cm
->
reference_mode
!=
SINGLE_REFERENCE
)
{
for
(
i
=
0
;
i
<
REF_CONTEXTS
;
i
++
)
{
#if CONFIG_EXT_REFS
...
...
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