}
}
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;
+ }
// The probs will be updated based on the frame type of its previous
// frame if frame_parallel_decoding_mode is 0. The type may vary for
}
cm->show_frame = 0;
+ cm->intra_only = 0;
cpi->refresh_alt_ref_frame = 1;
cpi->refresh_golden_frame = 0;
cpi->refresh_last_frame = 0;
#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;
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;
#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;
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
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;
}
}
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;
}
}
}