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
fbe9098c
Commit
fbe9098c
authored
Apr 22, 2013
by
Sami Pietilä
Committed by
Gerrit Code Review
Apr 22, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Reordering frame header probs." into experimental
parents
c7a38f77
04ebca53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
148 deletions
+148
-148
vp9/decoder/vp9_decodframe.c
vp9/decoder/vp9_decodframe.c
+12
-12
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_bitstream.c
+136
-136
No files found.
vp9/decoder/vp9_decodframe.c
View file @
fbe9098c
...
...
@@ -1554,18 +1554,6 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
pc
->
clamp_type
=
(
CLAMP_TYPE
)
vp9_read_bit
(
&
header_bc
);
pc
->
error_resilient_mode
=
vp9_read_bit
(
&
header_bc
);
setup_segmentation
(
pc
,
xd
,
&
header_bc
);
setup_pred_probs
(
pc
,
&
header_bc
);
xd
->
lossless
=
vp9_read_bit
(
&
header_bc
);
pc
->
txfm_mode
=
xd
->
lossless
?
ONLY_4X4
:
read_txfm_mode
(
&
header_bc
);
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
pc
->
prob_tx
[
0
]
=
vp9_read_prob
(
&
header_bc
);
pc
->
prob_tx
[
1
]
=
vp9_read_prob
(
&
header_bc
);
pc
->
prob_tx
[
2
]
=
vp9_read_prob
(
&
header_bc
);
}
setup_loopfilter
(
pc
,
xd
,
&
header_bc
);
// Dummy read for now
...
...
@@ -1630,6 +1618,18 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
vpx_memcpy
(
&
pc
->
fc
,
&
pc
->
frame_contexts
[
pc
->
frame_context_idx
],
sizeof
(
pc
->
fc
));
setup_segmentation
(
pc
,
xd
,
&
header_bc
);
setup_pred_probs
(
pc
,
&
header_bc
);
xd
->
lossless
=
vp9_read_bit
(
&
header_bc
);
pc
->
txfm_mode
=
xd
->
lossless
?
ONLY_4X4
:
read_txfm_mode
(
&
header_bc
);
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
pc
->
prob_tx
[
0
]
=
vp9_read_prob
(
&
header_bc
);
pc
->
prob_tx
[
1
]
=
vp9_read_prob
(
&
header_bc
);
pc
->
prob_tx
[
2
]
=
vp9_read_prob
(
&
header_bc
);
}
// Read inter mode probability context updates
if
(
pc
->
frame_type
!=
KEY_FRAME
)
{
int
i
,
j
;
...
...
vp9/encoder/vp9_bitstream.c
View file @
fbe9098c
...
...
@@ -2318,142 +2318,6 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
// error resilient mode
vp9_write_bit
(
&
header_bc
,
pc
->
error_resilient_mode
);
// Signal whether or not Segmentation is enabled
vp9_write_bit
(
&
header_bc
,
(
xd
->
segmentation_enabled
)
?
1
:
0
);
// Indicate which features are enabled
if
(
xd
->
segmentation_enabled
)
{
// Indicate whether or not the segmentation map is being updated.
vp9_write_bit
(
&
header_bc
,
(
xd
->
update_mb_segmentation_map
)
?
1
:
0
);
// If it is, then indicate the method that will be used.
if
(
xd
->
update_mb_segmentation_map
)
{
// Select the coding strategy (temporal or spatial)
vp9_choose_segmap_coding_method
(
cpi
);
// Send the tree probabilities used to decode unpredicted
// macro-block segments
for
(
i
=
0
;
i
<
MB_FEATURE_TREE_PROBS
;
i
++
)
{
const
int
prob
=
xd
->
mb_segment_tree_probs
[
i
];
if
(
prob
!=
255
)
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_prob
(
&
header_bc
,
prob
);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
}
// Write out the chosen coding method.
vp9_write_bit
(
&
header_bc
,
pc
->
temporal_update
);
if
(
pc
->
temporal_update
)
{
for
(
i
=
0
;
i
<
PREDICTION_PROBS
;
i
++
)
{
const
int
prob
=
pc
->
segment_pred_probs
[
i
];
if
(
prob
!=
255
)
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_prob
(
&
header_bc
,
prob
);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
}
}
}
vp9_write_bit
(
&
header_bc
,
(
xd
->
update_mb_segmentation_data
)
?
1
:
0
);
// segment_reference_frames(cpi);
if
(
xd
->
update_mb_segmentation_data
)
{
vp9_write_bit
(
&
header_bc
,
(
xd
->
mb_segment_abs_delta
)
?
1
:
0
);
// For each segments id...
for
(
i
=
0
;
i
<
MAX_MB_SEGMENTS
;
i
++
)
{
// For each segmentation codable feature...
for
(
j
=
0
;
j
<
SEG_LVL_MAX
;
j
++
)
{
const
int8_t
data
=
vp9_get_segdata
(
xd
,
i
,
j
);
const
int
data_max
=
vp9_seg_feature_data_max
(
j
);
// If the feature is enabled...
if
(
vp9_segfeature_active
(
xd
,
i
,
j
))
{
vp9_write_bit
(
&
header_bc
,
1
);
// Is the segment data signed..
if
(
vp9_is_segfeature_signed
(
j
))
{
// Encode the relevant feature data
if
(
data
<
0
)
{
vp9_encode_unsigned_max
(
&
header_bc
,
-
data
,
data_max
);
vp9_write_bit
(
&
header_bc
,
1
);
}
else
{
vp9_encode_unsigned_max
(
&
header_bc
,
data
,
data_max
);
vp9_write_bit
(
&
header_bc
,
0
);
}
}
else
{
// Unsigned data element so no sign bit needed
vp9_encode_unsigned_max
(
&
header_bc
,
data
,
data_max
);
}
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
}
}
}
}
// Encode the common prediction model status flag probability updates for
// the reference frame
update_refpred_stats
(
cpi
);
if
(
pc
->
frame_type
!=
KEY_FRAME
)
{
for
(
i
=
0
;
i
<
PREDICTION_PROBS
;
i
++
)
{
if
(
cpi
->
ref_pred_probs_update
[
i
])
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_prob
(
&
header_bc
,
pc
->
ref_pred_probs
[
i
]);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
}
}
vp9_write_bit
(
&
header_bc
,
cpi
->
mb
.
e_mbd
.
lossless
);
if
(
cpi
->
mb
.
e_mbd
.
lossless
)
{
pc
->
txfm_mode
=
ONLY_4X4
;
}
else
{
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
pc
->
prob_tx
[
0
]
=
get_prob
(
cpi
->
txfm_count_32x32p
[
TX_4X4
]
+
cpi
->
txfm_count_16x16p
[
TX_4X4
]
+
cpi
->
txfm_count_8x8p
[
TX_4X4
],
cpi
->
txfm_count_32x32p
[
TX_4X4
]
+
cpi
->
txfm_count_32x32p
[
TX_8X8
]
+
cpi
->
txfm_count_32x32p
[
TX_16X16
]
+
cpi
->
txfm_count_32x32p
[
TX_32X32
]
+
cpi
->
txfm_count_16x16p
[
TX_4X4
]
+
cpi
->
txfm_count_16x16p
[
TX_8X8
]
+
cpi
->
txfm_count_16x16p
[
TX_16X16
]
+
cpi
->
txfm_count_8x8p
[
TX_4X4
]
+
cpi
->
txfm_count_8x8p
[
TX_8X8
]);
pc
->
prob_tx
[
1
]
=
get_prob
(
cpi
->
txfm_count_32x32p
[
TX_8X8
]
+
cpi
->
txfm_count_16x16p
[
TX_8X8
],
cpi
->
txfm_count_32x32p
[
TX_8X8
]
+
cpi
->
txfm_count_32x32p
[
TX_16X16
]
+
cpi
->
txfm_count_32x32p
[
TX_32X32
]
+
cpi
->
txfm_count_16x16p
[
TX_8X8
]
+
cpi
->
txfm_count_16x16p
[
TX_16X16
]);
pc
->
prob_tx
[
2
]
=
get_prob
(
cpi
->
txfm_count_32x32p
[
TX_16X16
],
cpi
->
txfm_count_32x32p
[
TX_16X16
]
+
cpi
->
txfm_count_32x32p
[
TX_32X32
]);
}
else
{
pc
->
prob_tx
[
0
]
=
128
;
pc
->
prob_tx
[
1
]
=
128
;
pc
->
prob_tx
[
2
]
=
128
;
}
vp9_write_literal
(
&
header_bc
,
pc
->
txfm_mode
<=
3
?
pc
->
txfm_mode
:
3
,
2
);
if
(
pc
->
txfm_mode
>
ALLOW_16X16
)
{
vp9_write_bit
(
&
header_bc
,
pc
->
txfm_mode
==
TX_MODE_SELECT
);
}
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
vp9_write_prob
(
&
header_bc
,
pc
->
prob_tx
[
0
]);
vp9_write_prob
(
&
header_bc
,
pc
->
prob_tx
[
1
]);
vp9_write_prob
(
&
header_bc
,
pc
->
prob_tx
[
2
]);
}
}
// Encode the loop filter level and type
vp9_write_bit
(
&
header_bc
,
pc
->
filter_type
);
vp9_write_literal
(
&
header_bc
,
pc
->
filter_level
,
6
);
...
...
@@ -2630,6 +2494,142 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
active_section
=
7
;
#endif
// Signal whether or not Segmentation is enabled
vp9_write_bit
(
&
header_bc
,
(
xd
->
segmentation_enabled
)
?
1
:
0
);
// Indicate which features are enabled
if
(
xd
->
segmentation_enabled
)
{
// Indicate whether or not the segmentation map is being updated.
vp9_write_bit
(
&
header_bc
,
(
xd
->
update_mb_segmentation_map
)
?
1
:
0
);
// If it is, then indicate the method that will be used.
if
(
xd
->
update_mb_segmentation_map
)
{
// Select the coding strategy (temporal or spatial)
vp9_choose_segmap_coding_method
(
cpi
);
// Send the tree probabilities used to decode unpredicted
// macro-block segments
for
(
i
=
0
;
i
<
MB_FEATURE_TREE_PROBS
;
i
++
)
{
const
int
prob
=
xd
->
mb_segment_tree_probs
[
i
];
if
(
prob
!=
255
)
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_prob
(
&
header_bc
,
prob
);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
}
// Write out the chosen coding method.
vp9_write_bit
(
&
header_bc
,
(
pc
->
temporal_update
)
?
1
:
0
);
if
(
pc
->
temporal_update
)
{
for
(
i
=
0
;
i
<
PREDICTION_PROBS
;
i
++
)
{
const
int
prob
=
pc
->
segment_pred_probs
[
i
];
if
(
prob
!=
255
)
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_prob
(
&
header_bc
,
prob
);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
}
}
}
vp9_write_bit
(
&
header_bc
,
(
xd
->
update_mb_segmentation_data
)
?
1
:
0
);
// segment_reference_frames(cpi);
if
(
xd
->
update_mb_segmentation_data
)
{
vp9_write_bit
(
&
header_bc
,
(
xd
->
mb_segment_abs_delta
)
?
1
:
0
);
// For each segments id...
for
(
i
=
0
;
i
<
MAX_MB_SEGMENTS
;
i
++
)
{
// For each segmentation codable feature...
for
(
j
=
0
;
j
<
SEG_LVL_MAX
;
j
++
)
{
const
int8_t
data
=
vp9_get_segdata
(
xd
,
i
,
j
);
const
int
data_max
=
vp9_seg_feature_data_max
(
j
);
// If the feature is enabled...
if
(
vp9_segfeature_active
(
xd
,
i
,
j
))
{
vp9_write_bit
(
&
header_bc
,
1
);
// Is the segment data signed..
if
(
vp9_is_segfeature_signed
(
j
))
{
// Encode the relevant feature data
if
(
data
<
0
)
{
vp9_encode_unsigned_max
(
&
header_bc
,
-
data
,
data_max
);
vp9_write_bit
(
&
header_bc
,
1
);
}
else
{
vp9_encode_unsigned_max
(
&
header_bc
,
data
,
data_max
);
vp9_write_bit
(
&
header_bc
,
0
);
}
}
else
{
// Unsigned data element so no sign bit needed
vp9_encode_unsigned_max
(
&
header_bc
,
data
,
data_max
);
}
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
}
}
}
}
// Encode the common prediction model status flag probability updates for
// the reference frame
update_refpred_stats
(
cpi
);
if
(
pc
->
frame_type
!=
KEY_FRAME
)
{
for
(
i
=
0
;
i
<
PREDICTION_PROBS
;
i
++
)
{
if
(
cpi
->
ref_pred_probs_update
[
i
])
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_prob
(
&
header_bc
,
pc
->
ref_pred_probs
[
i
]);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
}
}
vp9_write_bit
(
&
header_bc
,
cpi
->
mb
.
e_mbd
.
lossless
);
if
(
cpi
->
mb
.
e_mbd
.
lossless
)
{
pc
->
txfm_mode
=
ONLY_4X4
;
}
else
{
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
pc
->
prob_tx
[
0
]
=
get_prob
(
cpi
->
txfm_count_32x32p
[
TX_4X4
]
+
cpi
->
txfm_count_16x16p
[
TX_4X4
]
+
cpi
->
txfm_count_8x8p
[
TX_4X4
],
cpi
->
txfm_count_32x32p
[
TX_4X4
]
+
cpi
->
txfm_count_32x32p
[
TX_8X8
]
+
cpi
->
txfm_count_32x32p
[
TX_16X16
]
+
cpi
->
txfm_count_32x32p
[
TX_32X32
]
+
cpi
->
txfm_count_16x16p
[
TX_4X4
]
+
cpi
->
txfm_count_16x16p
[
TX_8X8
]
+
cpi
->
txfm_count_16x16p
[
TX_16X16
]
+
cpi
->
txfm_count_8x8p
[
TX_4X4
]
+
cpi
->
txfm_count_8x8p
[
TX_8X8
]);
pc
->
prob_tx
[
1
]
=
get_prob
(
cpi
->
txfm_count_32x32p
[
TX_8X8
]
+
cpi
->
txfm_count_16x16p
[
TX_8X8
],
cpi
->
txfm_count_32x32p
[
TX_8X8
]
+
cpi
->
txfm_count_32x32p
[
TX_16X16
]
+
cpi
->
txfm_count_32x32p
[
TX_32X32
]
+
cpi
->
txfm_count_16x16p
[
TX_8X8
]
+
cpi
->
txfm_count_16x16p
[
TX_16X16
]);
pc
->
prob_tx
[
2
]
=
get_prob
(
cpi
->
txfm_count_32x32p
[
TX_16X16
],
cpi
->
txfm_count_32x32p
[
TX_16X16
]
+
cpi
->
txfm_count_32x32p
[
TX_32X32
]);
}
else
{
pc
->
prob_tx
[
0
]
=
128
;
pc
->
prob_tx
[
1
]
=
128
;
pc
->
prob_tx
[
2
]
=
128
;
}
vp9_write_literal
(
&
header_bc
,
pc
->
txfm_mode
<=
3
?
pc
->
txfm_mode
:
3
,
2
);
if
(
pc
->
txfm_mode
>
ALLOW_16X16
)
{
vp9_write_bit
(
&
header_bc
,
pc
->
txfm_mode
==
TX_MODE_SELECT
);
}
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
vp9_write_prob
(
&
header_bc
,
pc
->
prob_tx
[
0
]);
vp9_write_prob
(
&
header_bc
,
pc
->
prob_tx
[
1
]);
vp9_write_prob
(
&
header_bc
,
pc
->
prob_tx
[
2
]);
}
}
// If appropriate update the inter mode probability context and code the
// changes in the bitstream.
if
(
pc
->
frame_type
!=
KEY_FRAME
)
{
...
...
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