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
ef4d9a48
Commit
ef4d9a48
authored
Apr 16, 2013
by
Dmitry Kovalev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding vp9_write_prob function (macro for now).
Change-Id: Ic795cf6fc202bf32c9b5b0b3cef9ac422af53cd0
parent
07cde4fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_bitstream.c
+17
-17
vp9/encoder/vp9_treewriter.h
vp9/encoder/vp9_treewriter.h
+2
-1
No files found.
vp9/encoder/vp9_bitstream.c
View file @
ef4d9a48
...
...
@@ -191,7 +191,7 @@ static void update_switchable_interp_probs(VP9_COMP *cpi,
for
(
i
=
0
;
i
<
VP9_SWITCHABLE_FILTERS
-
1
;
++
i
)
{
if
(
pc
->
fc
.
switchable_interp_prob
[
j
][
i
]
<
1
)
pc
->
fc
.
switchable_interp_prob
[
j
][
i
]
=
1
;
vp9_write_
literal
(
bc
,
pc
->
fc
.
switchable_interp_prob
[
j
][
i
]
,
8
);
vp9_write_
prob
(
bc
,
pc
->
fc
.
switchable_interp_prob
[
j
][
i
]);
}
}
}
...
...
@@ -444,7 +444,7 @@ static void vp9_cond_prob_update(vp9_writer *bc, vp9_prob *oldp, vp9_prob upd,
savings
=
prob_update_savings
(
ct
,
*
oldp
,
newp
,
upd
);
if
(
savings
>
0
)
{
vp9_write
(
bc
,
1
,
upd
);
vp9_write_
literal
(
bc
,
newp
,
8
);
vp9_write_
prob
(
bc
,
newp
);
*
oldp
=
newp
;
}
else
{
vp9_write
(
bc
,
0
,
upd
);
...
...
@@ -2407,7 +2407,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
const
int
prob
=
xd
->
mb_segment_tree_probs
[
i
];
if
(
prob
!=
255
)
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_
literal
(
&
header_bc
,
prob
,
8
);
vp9_write_
prob
(
&
header_bc
,
prob
);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
...
...
@@ -2420,7 +2420,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
const
int
prob
=
pc
->
segment_pred_probs
[
i
];
if
(
prob
!=
255
)
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_
literal
(
&
header_bc
,
prob
,
8
);
vp9_write_
prob
(
&
header_bc
,
prob
);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
...
...
@@ -2475,7 +2475,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
for
(
i
=
0
;
i
<
PREDICTION_PROBS
;
i
++
)
{
if
(
cpi
->
ref_pred_probs_update
[
i
])
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_
literal
(
&
header_bc
,
pc
->
ref_pred_probs
[
i
]
,
8
);
vp9_write_
prob
(
&
header_bc
,
pc
->
ref_pred_probs
[
i
]);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
...
...
@@ -2483,9 +2483,9 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
}
pc
->
prob_sb64_coded
=
get_binary_prob
(
cpi
->
sb64_count
[
0
],
cpi
->
sb64_count
[
1
]);
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_sb64_coded
,
8
);
vp9_write_
prob
(
&
header_bc
,
pc
->
prob_sb64_coded
);
pc
->
prob_sb32_coded
=
get_binary_prob
(
cpi
->
sb32_count
[
0
],
cpi
->
sb32_count
[
1
]);
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_sb32_coded
,
8
);
vp9_write_
prob
(
&
header_bc
,
pc
->
prob_sb32_coded
);
vp9_write_bit
(
&
header_bc
,
cpi
->
mb
.
e_mbd
.
lossless
);
if
(
cpi
->
mb
.
e_mbd
.
lossless
)
{
...
...
@@ -2524,9 +2524,9 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
vp9_write_bit
(
&
header_bc
,
pc
->
txfm_mode
==
TX_MODE_SELECT
);
}
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_tx
[
0
]
,
8
);
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_tx
[
1
]
,
8
);
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_tx
[
2
]
,
8
);
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
]);
}
}
...
...
@@ -2723,7 +2723,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
for
(
j
=
0
;
j
<
4
;
j
++
)
{
if
(
new_context
[
i
][
j
]
!=
pc
->
fc
.
vp9_mode_contexts
[
i
][
j
])
{
vp9_write
(
&
header_bc
,
1
,
252
);
vp9_write_
literal
(
&
header_bc
,
new_context
[
i
][
j
]
,
8
);
vp9_write_
prob
(
&
header_bc
,
new_context
[
i
][
j
]);
// Only update the persistent copy if this is the "real pack"
if
(
!
cpi
->
dummy_packing
)
{
...
...
@@ -2753,7 +2753,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
for
(
j
=
0
;
j
<
MAX_MV_REF_CANDIDATES
-
1
;
++
j
)
{
if
(
new_mvref_probs
[
i
][
j
]
!=
xd
->
mb_mv_ref_probs
[
i
][
j
])
{
vp9_write
(
&
header_bc
,
1
,
VP9_MVREF_UPDATE_PROB
);
vp9_write_
literal
(
&
header_bc
,
new_mvref_probs
[
i
][
j
]
,
8
);
vp9_write_
prob
(
&
header_bc
,
new_mvref_probs
[
i
][
j
]);
// Only update the persistent copy if this is the "real pack"
if
(
!
cpi
->
dummy_packing
)
{
...
...
@@ -2827,7 +2827,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
vp9_update_skip_probs
(
cpi
);
for
(
i
=
0
;
i
<
MBSKIP_CONTEXTS
;
++
i
)
{
vp9_write_
literal
(
&
header_bc
,
pc
->
mbskip_pred_probs
[
i
]
,
8
);
vp9_write_
prob
(
&
header_bc
,
pc
->
mbskip_pred_probs
[
i
]);
}
if
(
pc
->
frame_type
==
KEY_FRAME
)
{
...
...
@@ -2854,9 +2854,9 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
}
#endif
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_intra_coded
,
8
);
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_last_coded
,
8
);
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_gf_coded
,
8
);
vp9_write_
prob
(
&
header_bc
,
pc
->
prob_intra_coded
);
vp9_write_
prob
(
&
header_bc
,
pc
->
prob_last_coded
);
vp9_write_
prob
(
&
header_bc
,
pc
->
prob_gf_coded
);
{
const
int
comp_pred_mode
=
cpi
->
common
.
comp_pred_mode
;
...
...
@@ -2870,7 +2870,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
for
(
i
=
0
;
i
<
COMP_PRED_CONTEXTS
;
i
++
)
{
pc
->
prob_comppred
[
i
]
=
get_binary_prob
(
cpi
->
single_pred_count
[
i
],
cpi
->
comp_pred_count
[
i
]);
vp9_write_
literal
(
&
header_bc
,
pc
->
prob_comppred
[
i
]
,
8
);
vp9_write_
prob
(
&
header_bc
,
pc
->
prob_comppred
[
i
]);
}
}
}
...
...
vp9/encoder/vp9_treewriter.h
View file @
ef4d9a48
...
...
@@ -23,7 +23,8 @@ typedef BOOL_CODER vp9_writer;
#define vp9_write encode_bool
#define vp9_write_literal vp9_encode_value
#define vp9_write_bit(W, V) vp9_write(W, V, vp9_prob_half)
#define vp9_write_bit(w, v) vp9_write((w), (v), vp9_prob_half)
#define vp9_write_prob(w, v) vp9_write_literal((w), (v), 8)
/* Approximate length of an encoded bool in 256ths of a bit at given prob */
...
...
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