Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
c4390e8c
Commit
c4390e8c
authored
May 13, 2013
by
Dmitry Kovalev
Committed by
Gerrit Code Review
May 13, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Adding encode_quantization function." into experimental
parents
ce70ad59
3f31b297
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
31 deletions
+33
-31
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_bitstream.c
+33
-31
No files found.
vp9/encoder/vp9_bitstream.c
View file @
c4390e8c
...
...
@@ -1242,16 +1242,6 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) {
FILE
*
vpxlogc
=
0
;
#endif
static
void
put_delta_q
(
vp9_writer
*
bc
,
int
delta_q
)
{
if
(
delta_q
!=
0
)
{
vp9_write_bit
(
bc
,
1
);
vp9_write_literal
(
bc
,
abs
(
delta_q
),
4
);
vp9_write_bit
(
bc
,
delta_q
<
0
);
}
else
{
vp9_write_bit
(
bc
,
0
);
}
}
static
void
decide_kf_ymode_entropy
(
VP9_COMP
*
cpi
)
{
int
mode_cost
[
MB_MODE_COUNT
];
int
bestcost
=
INT_MAX
;
...
...
@@ -1298,9 +1288,21 @@ static void segment_reference_frames(VP9_COMP *cpi) {
}
}
static
void
encode_loopfilter
(
MACROBLOCKD
*
xd
,
vp9_writer
*
w
)
{
static
void
encode_loopfilter
(
VP9_COMMON
*
pc
,
MACROBLOCKD
*
xd
,
vp9_writer
*
w
)
{
int
i
;
// Encode the loop filter level and type
vp9_write_literal
(
w
,
pc
->
filter_level
,
6
);
vp9_write_literal
(
w
,
pc
->
sharpness_level
,
3
);
#if CONFIG_LOOP_DERING
if
(
pc
->
dering_enabled
)
{
vp9_write_bit
(
w
,
1
);
vp9_write_literal
(
w
,
pc
->
dering_enabled
-
1
,
4
);
}
else
{
vp9_write_bit
(
w
,
0
);
}
#endif
// Write out loop filter deltas applied at the MB level based on mode or
// ref frame (if they are enabled).
vp9_write_bit
(
w
,
xd
->
mode_ref_lf_delta_enabled
);
...
...
@@ -1354,6 +1356,24 @@ static void encode_loopfilter(MACROBLOCKD *xd, vp9_writer *w) {
}
}
static
void
put_delta_q
(
vp9_writer
*
bc
,
int
delta_q
)
{
if
(
delta_q
!=
0
)
{
vp9_write_bit
(
bc
,
1
);
vp9_write_literal
(
bc
,
abs
(
delta_q
),
4
);
vp9_write_bit
(
bc
,
delta_q
<
0
);
}
else
{
vp9_write_bit
(
bc
,
0
);
}
}
static
void
encode_quantization
(
VP9_COMMON
*
pc
,
vp9_writer
*
w
)
{
vp9_write_literal
(
w
,
pc
->
base_qindex
,
QINDEX_BITS
);
put_delta_q
(
w
,
pc
->
y_dc_delta_q
);
put_delta_q
(
w
,
pc
->
uv_dc_delta_q
);
put_delta_q
(
w
,
pc
->
uv_ac_delta_q
);
}
static
void
encode_segmentation
(
VP9_COMP
*
cpi
,
vp9_writer
*
w
)
{
int
i
,
j
;
VP9_COMMON
*
const
pc
=
&
cpi
->
common
;
...
...
@@ -1495,27 +1515,9 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {
// lossless mode: note this needs to be before loopfilter
vp9_write_bit
(
&
header_bc
,
cpi
->
mb
.
e_mbd
.
lossless
);
// Encode the loop filter level and type
vp9_write_literal
(
&
header_bc
,
pc
->
filter_level
,
6
);
vp9_write_literal
(
&
header_bc
,
pc
->
sharpness_level
,
3
);
#if CONFIG_LOOP_DERING
if
(
pc
->
dering_enabled
)
{
vp9_write_bit
(
&
header_bc
,
1
);
vp9_write_literal
(
&
header_bc
,
pc
->
dering_enabled
-
1
,
4
);
}
else
{
vp9_write_bit
(
&
header_bc
,
0
);
}
#endif
encode_loopfilter
(
xd
,
&
header_bc
);
// Frame Q baseline quantizer index
vp9_write_literal
(
&
header_bc
,
pc
->
base_qindex
,
QINDEX_BITS
);
encode_loopfilter
(
pc
,
xd
,
&
header_bc
);
// Transmit Dc, Second order and Uv quantizer delta information
put_delta_q
(
&
header_bc
,
pc
->
y_dc_delta_q
);
put_delta_q
(
&
header_bc
,
pc
->
uv_dc_delta_q
);
put_delta_q
(
&
header_bc
,
pc
->
uv_ac_delta_q
);
encode_quantization
(
pc
,
&
header_bc
);
// When there is a key frame all reference buffers are updated using the new key frame
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