summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/encoder/vp9_encoder.c16
-rw-r--r--vp9/encoder/vp9_firstpass.c5
-rw-r--r--vp9/encoder/vp9_svc_layercontext.c23
-rw-r--r--vp9/encoder/vp9_svc_layercontext.h3
4 files changed, 23 insertions, 24 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 2390db54d..1f4288387 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3476,11 +3476,18 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
}
}
if (is_two_pass_svc(cpi) && cm->error_resilient_mode == 0) {
- // Use the last frame context for the empty frame.
+ // Use context 0 for intra only empty frame, but the last frame context
+ // for other empty frames.
+ if (cpi->svc.encode_empty_frame_state == ENCODING) {
+ if (cpi->svc.encode_intra_empty_frame != 0)
+ cm->frame_context_idx = 0;
+ else
+ cm->frame_context_idx = FRAME_CONTEXTS - 1;
+ } else {
cm->frame_context_idx =
- (cpi->svc.encode_empty_frame_state == ENCODING) ? FRAME_CONTEXTS - 1 :
cpi->svc.spatial_layer_id * cpi->svc.number_temporal_layers +
cpi->svc.temporal_layer_id;
+ }
cm->frame_parallel_decoding_mode = oxcf->frame_parallel_decoding_mode;
@@ -3968,6 +3975,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
}
cm->show_frame = 0;
+ cm->intra_only = 0;
cpi->refresh_alt_ref_frame = 1;
cpi->refresh_golden_frame = 0;
cpi->refresh_last_frame = 0;
@@ -4310,8 +4318,10 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
#endif
if (is_two_pass_svc(cpi)) {
- if (cpi->svc.encode_empty_frame_state == ENCODING)
+ if (cpi->svc.encode_empty_frame_state == ENCODING) {
cpi->svc.encode_empty_frame_state = ENCODED;
+ cpi->svc.encode_intra_empty_frame = 0;
+ }
if (cm->show_frame) {
++cpi->svc.spatial_layer_to_encode;
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 4a1abdc2e..942eac911 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2582,9 +2582,8 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
cpi->ref_frame_flags &=
(~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG);
lc->frames_from_key_frame = 0;
- // Reset the empty frame resolution since we have a key frame.
- cpi->svc.empty_frame_width = cm->width;
- cpi->svc.empty_frame_height = cm->height;
+ // Encode an intra only empty frame since we have a key frame.
+ cpi->svc.encode_intra_empty_frame = 1;
}
} else {
cm->frame_type = INTER_FRAME;
diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c
index b3491a27a..2d2e95d9c 100644
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -15,6 +15,8 @@
#include "vp9/encoder/vp9_extend.h"
#define SMALL_FRAME_FB_IDX 7
+#define SMALL_FRAME_WIDTH 16
+#define SMALL_FRAME_HEIGHT 16
void vp9_init_layer_context(VP9_COMP *const cpi) {
SVC *const svc = &cpi->svc;
@@ -33,7 +35,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
if (cpi->oxcf.error_resilient_mode == 0 && cpi->oxcf.pass == 2) {
if (vp9_realloc_frame_buffer(&cpi->svc.empty_frame.img,
- cpi->common.width, cpi->common.height,
+ SMALL_FRAME_WIDTH, SMALL_FRAME_HEIGHT,
cpi->common.subsampling_x,
cpi->common.subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
@@ -48,8 +50,6 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
memset(cpi->svc.empty_frame.img.buffer_alloc, 0x80,
cpi->svc.empty_frame.img.buffer_alloc_sz);
- cpi->svc.empty_frame_width = cpi->common.width;
- cpi->svc.empty_frame_height = cpi->common.height;
}
}
@@ -362,20 +362,11 @@ int vp9_svc_start_frame(VP9_COMP *const cpi) {
cpi->lst_fb_idx =
cpi->gld_fb_idx = cpi->alt_fb_idx = SMALL_FRAME_FB_IDX;
- // Gradually make the empty frame smaller to save bits. Make it half of
- // its previous size because of the scaling factor restriction.
- cpi->svc.empty_frame_width >>= 1;
- cpi->svc.empty_frame_width = (cpi->svc.empty_frame_width + 1) & ~1;
- if (cpi->svc.empty_frame_width < 16)
- cpi->svc.empty_frame_width = 16;
+ if (cpi->svc.encode_intra_empty_frame != 0)
+ cpi->common.intra_only = 1;
- cpi->svc.empty_frame_height >>= 1;
- cpi->svc.empty_frame_height = (cpi->svc.empty_frame_height + 1) & ~1;
- if (cpi->svc.empty_frame_height < 16)
- cpi->svc.empty_frame_height = 16;
-
- width = cpi->svc.empty_frame_width;
- height = cpi->svc.empty_frame_height;
+ width = SMALL_FRAME_WIDTH;
+ height = SMALL_FRAME_HEIGHT;
}
}
}
diff --git a/vp9/encoder/vp9_svc_layercontext.h b/vp9/encoder/vp9_svc_layercontext.h
index e9645ce9f..5063d521f 100644
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -57,8 +57,7 @@ typedef struct {
NEED_TO_ENCODE
}encode_empty_frame_state;
struct lookahead_entry empty_frame;
- int empty_frame_width;
- int empty_frame_height;
+ int encode_intra_empty_frame;
// Store scaled source frames to be used for temporal filter to generate
// a alt ref frame.