Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
c4390e8c
Commit
c4390e8c
authored
11 years ago
by
Dmitry Kovalev
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Download
Plain Diff
Merge "Adding encode_quantization function." into experimental
parents
ce70ad59
3f31b297
v1.14.0-linphone
1.4.X
experimental
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
forest
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m29-baseline
m31-baseline
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
mcw
mcw2
nextgen
nextgenv2
pcs-2013
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/debargha/playground
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
stable-vp9-decoder
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
v1.3.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vp9/encoder/vp9_bitstream.c
+33
-31
vp9/encoder/vp9_bitstream.c
with
33 additions
and
31 deletions
vp9/encoder/vp9_bitstream.c
+
33
−
31
View file @
c4390e8c
...
@@ -1242,16 +1242,6 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) {
...
@@ -1242,16 +1242,6 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) {
FILE
*
vpxlogc
=
0
;
FILE
*
vpxlogc
=
0
;
#endif
#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
)
{
static
void
decide_kf_ymode_entropy
(
VP9_COMP
*
cpi
)
{
int
mode_cost
[
MB_MODE_COUNT
];
int
mode_cost
[
MB_MODE_COUNT
];
int
bestcost
=
INT_MAX
;
int
bestcost
=
INT_MAX
;
...
@@ -1298,9 +1288,21 @@ static void segment_reference_frames(VP9_COMP *cpi) {
...
@@ -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
;
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
// Write out loop filter deltas applied at the MB level based on mode or
// ref frame (if they are enabled).
// ref frame (if they are enabled).
vp9_write_bit
(
w
,
xd
->
mode_ref_lf_delta_enabled
);
vp9_write_bit
(
w
,
xd
->
mode_ref_lf_delta_enabled
);
...
@@ -1354,6 +1356,24 @@ static void encode_loopfilter(MACROBLOCKD *xd, vp9_writer *w) {
...
@@ -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
)
{
static
void
encode_segmentation
(
VP9_COMP
*
cpi
,
vp9_writer
*
w
)
{
int
i
,
j
;
int
i
,
j
;
VP9_COMMON
*
const
pc
=
&
cpi
->
common
;
VP9_COMMON
*
const
pc
=
&
cpi
->
common
;
...
@@ -1495,27 +1515,9 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {
...
@@ -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
// lossless mode: note this needs to be before loopfilter
vp9_write_bit
(
&
header_bc
,
cpi
->
mb
.
e_mbd
.
lossless
);
vp9_write_bit
(
&
header_bc
,
cpi
->
mb
.
e_mbd
.
lossless
);
// Encode the loop filter level and type
encode_loopfilter
(
pc
,
xd
,
&
header_bc
);
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
);
// Transmit Dc, Second order and Uv quantizer delta information
encode_quantization
(
pc
,
&
header_bc
);
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
);
// When there is a key frame all reference buffers are updated using the new key frame
// When there is a key frame all reference buffers are updated using the new key frame
if
(
pc
->
frame_type
!=
KEY_FRAME
)
{
if
(
pc
->
frame_type
!=
KEY_FRAME
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets