summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_entropy.c9
-rw-r--r--vp9/common/vp9_entropy.h2
-rw-r--r--vp9/decoder/vp9_dsubexp.c2
-rw-r--r--vp9/encoder/vp9_encoder.c7
-rw-r--r--vp9/encoder/vp9_ratectrl.c5
-rw-r--r--vp9/encoder/vp9_subexp.c4
-rw-r--r--vp9/encoder/vp9_svc_layercontext.c4
-rw-r--r--vp9/encoder/vp9_svc_layercontext.h1
8 files changed, 21 insertions, 13 deletions
diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c
index 719e542ce..579857bc9 100644
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -403,6 +403,7 @@ const vpx_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
{255, 241, 243, 255, 236, 255, 252, 254},
{255, 243, 245, 255, 237, 255, 252, 254},
{255, 246, 247, 255, 239, 255, 253, 255},
+ {255, 246, 247, 255, 239, 255, 253, 255},
};
static const vp9_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
@@ -742,16 +743,14 @@ static const vp9_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
};
static void extend_to_full_distribution(vpx_prob *probs, vpx_prob p) {
- memcpy(probs, vp9_pareto8_full[p - 1], MODEL_NODES * sizeof(vpx_prob));
+ memcpy(probs, vp9_pareto8_full[p = 0 ? 0 : p - 1],
+ MODEL_NODES * sizeof(vpx_prob));
}
void vp9_model_to_full_probs(const vpx_prob *model, vpx_prob *full) {
if (full != model)
memcpy(full, model, sizeof(vpx_prob) * UNCONSTRAINED_NODES);
- // TODO(aconverse): model[PIVOT_NODE] should never be zero.
- // https://code.google.com/p/webm/issues/detail?id=1089
- if (model[PIVOT_NODE] != 0)
- extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
+ extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
}
void vp9_default_coef_probs(VP9_COMMON *cm) {
diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h
index 63b3bff5d..21611ed6d 100644
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -138,7 +138,7 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
// 1, 3, 5, 7, ..., 253, 255
// In between probabilities are interpolated linearly
-#define COEFF_PROB_MODELS 255
+#define COEFF_PROB_MODELS 256
#define UNCONSTRAINED_NODES 3
diff --git a/vp9/decoder/vp9_dsubexp.c b/vp9/decoder/vp9_dsubexp.c
index 4fbc6db47..05b38538a 100644
--- a/vp9/decoder/vp9_dsubexp.c
+++ b/vp9/decoder/vp9_dsubexp.c
@@ -29,7 +29,7 @@ static int decode_uniform(vpx_reader *r) {
}
static int inv_remap_prob(int v, int m) {
- static int inv_map_table[MAX_PROB] = {
+ static uint8_t inv_map_table[MAX_PROB] = {
7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 137, 150, 163, 176, 189,
202, 215, 228, 241, 254, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27,
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 72eafec40..8cc99cd74 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3797,14 +3797,17 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
}
// For 1 pass CBR, check if we are dropping this frame.
- // Never drop on key frame.
+ // For spatial layers, for now only check for frame-dropping on first spatial
+ // layer, and if decision is to drop, we drop whole super-frame.
if (oxcf->pass == 0 &&
oxcf->rc_mode == VPX_CBR &&
cm->frame_type != KEY_FRAME) {
- if (vp9_rc_drop_frame(cpi)) {
+ if (vp9_rc_drop_frame(cpi) ||
+ (is_one_pass_cbr_svc(cpi) && cpi->svc.rc_drop_superframe == 1)) {
vp9_rc_postencode_update_drop_frame(cpi);
++cm->current_video_frame;
cpi->ext_refresh_frame_flags_pending = 0;
+ cpi->svc.rc_drop_superframe = 1;
return;
}
}
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 9905d9e78..c6fe76cff 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -370,8 +370,9 @@ void vp9_rc_init(const VP9EncoderConfig *oxcf, int pass, RATE_CONTROL *rc) {
int vp9_rc_drop_frame(VP9_COMP *cpi) {
const VP9EncoderConfig *oxcf = &cpi->oxcf;
RATE_CONTROL *const rc = &cpi->rc;
-
- if (!oxcf->drop_frames_water_mark) {
+ if (!oxcf->drop_frames_water_mark ||
+ (is_one_pass_cbr_svc(cpi) &&
+ cpi->svc.spatial_layer_id > cpi->svc.first_spatial_layer_to_encode)) {
return 0;
} else {
if (rc->buffer_level < 0) {
diff --git a/vp9/encoder/vp9_subexp.c b/vp9/encoder/vp9_subexp.c
index 799f179d9..7aa8fc3f6 100644
--- a/vp9/encoder/vp9_subexp.c
+++ b/vp9/encoder/vp9_subexp.c
@@ -16,7 +16,7 @@
#define vp9_cost_upd256 ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)))
-static const int update_bits[255] = {
+static const uint8_t update_bits[255] = {
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
@@ -46,7 +46,7 @@ static int recenter_nonneg(int v, int m) {
static int remap_prob(int v, int m) {
int i;
- static const int map_table[MAX_PROB - 1] = {
+ static const uint8_t map_table[MAX_PROB - 1] = {
// generated by:
// map_table[j] = split_index(j, MAX_PROB - 1, MODULUS_PARAM);
20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 30, 31, 32, 33,
diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c
index 8a6818c86..1dfc45cf6 100644
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -31,6 +31,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
svc->spatial_layer_id = 0;
svc->temporal_layer_id = 0;
svc->first_spatial_layer_to_encode = 0;
+ svc->rc_drop_superframe = 0;
if (cpi->oxcf.error_resilient_mode == 0 && cpi->oxcf.pass == 2) {
if (vpx_realloc_frame_buffer(&cpi->svc.empty_frame.img,
@@ -568,6 +569,9 @@ int vp9_one_pass_cbr_svc_start_layer(VP9_COMP *const cpi) {
}
}
+ if (cpi->svc.spatial_layer_id == cpi->svc.first_spatial_layer_to_encode)
+ cpi->svc.rc_drop_superframe = 0;
+
lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id *
cpi->svc.number_temporal_layers +
cpi->svc.temporal_layer_id];
diff --git a/vp9/encoder/vp9_svc_layercontext.h b/vp9/encoder/vp9_svc_layercontext.h
index 694b5abdc..5dbf9b418 100644
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -56,6 +56,7 @@ typedef struct {
int spatial_layer_to_encode;
int first_spatial_layer_to_encode;
+ int rc_drop_superframe;
// Workaround for multiple frame contexts
enum {