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
Toggle navigation
Open sidebar
BC
public
external
libvpx
Commits
7af34402
Commit
7af34402
authored
May 20, 2014
by
Minghai Shang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[spatial svc] Remove some restrictions that are needed to improve the quality
Change-Id: I76a48b03388a8c5cc74b871deb836cd92263b306
parent
e9ed051c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
24 deletions
+19
-24
vp9/encoder/vp9_firstpass.c
vp9/encoder/vp9_firstpass.c
+18
-12
vpx/src/svc_encodeframe.c
vpx/src/svc_encodeframe.c
+1
-12
No files found.
vp9/encoder/vp9_firstpass.c
View file @
7af34402
...
...
@@ -46,6 +46,9 @@
#define GF_RMAX 96.0
#define ERR_DIVISOR 150.0
#define MIN_DECAY_FACTOR 0.1
#define SVC_FACTOR_PT_LOW 0.45
#define FACTOR_PT_LOW 0.5
#define FACTOR_PT_HIGH 0.9
#define KF_MB_INTRA_MIN 150
#define GF_MB_INTRA_MIN 100
...
...
@@ -938,8 +941,8 @@ static int get_twopass_worst_quality(const VP9_COMP *cpi,
for
(
q
=
rc
->
best_quality
;
q
<
rc
->
worst_quality
;
++
q
)
{
const
double
factor
=
calc_correction_factor
(
err_per_mb
,
ERR_DIVISOR
,
is_svc_upper_layer
?
0
.
8
:
0
.
5
,
is_svc_upper_layer
?
1
.
0
:
0
.
90
,
q
);
is_svc_upper_layer
?
SVC_FACTOR_PT_LOW
:
FACTOR_PT_LOW
,
FACTOR_PT_HIGH
,
q
);
const
int
bits_per_mb
=
vp9_rc_bits_per_mb
(
INTER_FRAME
,
q
,
factor
*
speed_term
);
if
(
bits_per_mb
<=
target_norm_bits_per_mb
)
...
...
@@ -2189,20 +2192,23 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
// Define next KF group and assign bits to it.
this_frame_copy
=
this_frame
;
find_next_key_frame
(
cpi
,
&
this_frame_copy
);
// Don't place key frame in any enhancement layers in spatial svc
if
(
is_spatial_svc
)
{
lc
->
is_key_frame
=
1
;
if
(
cpi
->
svc
.
spatial_layer_id
>
0
)
{
cm
->
frame_type
=
INTER_FRAME
;
}
}
}
else
{
if
(
is_spatial_svc
)
{
lc
->
is_key_frame
=
0
;
}
cm
->
frame_type
=
INTER_FRAME
;
}
if
(
is_spatial_svc
)
{
if
(
cpi
->
svc
.
spatial_layer_id
==
0
)
{
lc
->
is_key_frame
=
(
cm
->
frame_type
==
KEY_FRAME
);
}
else
{
cm
->
frame_type
=
INTER_FRAME
;
lc
->
is_key_frame
=
cpi
->
svc
.
layer_context
[
0
].
is_key_frame
;
if
(
lc
->
is_key_frame
)
{
cpi
->
ref_frame_flags
&=
(
~
VP9_LAST_FLAG
);
}
}
}
// Is this frame a GF / ARF? (Note: a key frame is always also a GF).
if
(
rc
->
frames_till_gf_update_due
==
0
)
{
// Define next gf group and assign bits to it.
...
...
vpx/src/svc_encodeframe.c
View file @
7af34402
...
...
@@ -496,7 +496,6 @@ vpx_codec_err_t vpx_svc_set_scale_factors(SvcContext *svc_ctx,
vpx_codec_err_t
vpx_svc_init
(
SvcContext
*
svc_ctx
,
vpx_codec_ctx_t
*
codec_ctx
,
vpx_codec_iface_t
*
iface
,
vpx_codec_enc_cfg_t
*
enc_cfg
)
{
int
max_intra_size_pct
;
vpx_codec_err_t
res
;
SvcInternal
*
const
si
=
get_svc_internal
(
svc_ctx
);
if
(
svc_ctx
==
NULL
||
codec_ctx
==
NULL
||
iface
==
NULL
||
...
...
@@ -575,7 +574,6 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
// modify encoder configuration
enc_cfg
->
ss_number_layers
=
si
->
layers
;
enc_cfg
->
ts_number_layers
=
1
;
// Temporal layers not used in this encoder.
enc_cfg
->
kf_mode
=
VPX_KF_DISABLED
;
// Lag in frames not currently supported
enc_cfg
->
g_lag_in_frames
=
0
;
...
...
@@ -605,16 +603,8 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
}
vpx_codec_control
(
codec_ctx
,
VP9E_SET_SVC
,
1
);
vpx_codec_control
(
codec_ctx
,
VP8E_SET_CPUUSED
,
1
);
vpx_codec_control
(
codec_ctx
,
VP8E_SET_STATIC_THRESHOLD
,
1
);
vpx_codec_control
(
codec_ctx
,
VP8E_SET_NOISE_SENSITIVITY
,
1
);
vpx_codec_control
(
codec_ctx
,
VP8E_SET_TOKEN_PARTITIONS
,
1
);
max_intra_size_pct
=
(
int
)(((
double
)
enc_cfg
->
rc_buf_optimal_sz
*
0
.
5
)
*
((
double
)
enc_cfg
->
g_timebase
.
den
/
enc_cfg
->
g_timebase
.
num
)
/
10
.
0
);
vpx_codec_control
(
codec_ctx
,
VP8E_SET_MAX_INTRA_BITRATE_PCT
,
max_intra_size_pct
);
return
VPX_CODEC_OK
;
}
...
...
@@ -869,8 +859,7 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
si
->
rc_stats_buf_used
=
0
;
si
->
layers
=
svc_ctx
->
spatial_layers
;
if
(
si
->
frame_within_gop
>=
si
->
kf_dist
||
si
->
encode_frame_count
==
0
)
{
if
(
si
->
encode_frame_count
==
0
)
{
si
->
frame_within_gop
=
0
;
}
si
->
is_keyframe
=
(
si
->
frame_within_gop
==
0
);
...
...
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