Merge "[svc] Make size of empty frame to be 16x16 all the time"
This commit is contained in:
commit
30181c46d8
@ -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) {
|
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 =
|
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.spatial_layer_id * cpi->svc.number_temporal_layers +
|
||||||
cpi->svc.temporal_layer_id;
|
cpi->svc.temporal_layer_id;
|
||||||
|
}
|
||||||
|
|
||||||
cm->frame_parallel_decoding_mode = oxcf->frame_parallel_decoding_mode;
|
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->show_frame = 0;
|
||||||
|
cm->intra_only = 0;
|
||||||
cpi->refresh_alt_ref_frame = 1;
|
cpi->refresh_alt_ref_frame = 1;
|
||||||
cpi->refresh_golden_frame = 0;
|
cpi->refresh_golden_frame = 0;
|
||||||
cpi->refresh_last_frame = 0;
|
cpi->refresh_last_frame = 0;
|
||||||
@ -4310,8 +4318,10 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (is_two_pass_svc(cpi)) {
|
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_empty_frame_state = ENCODED;
|
||||||
|
cpi->svc.encode_intra_empty_frame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (cm->show_frame) {
|
if (cm->show_frame) {
|
||||||
++cpi->svc.spatial_layer_to_encode;
|
++cpi->svc.spatial_layer_to_encode;
|
||||||
|
@ -2582,9 +2582,8 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
|
|||||||
cpi->ref_frame_flags &=
|
cpi->ref_frame_flags &=
|
||||||
(~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG);
|
(~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG);
|
||||||
lc->frames_from_key_frame = 0;
|
lc->frames_from_key_frame = 0;
|
||||||
// Reset the empty frame resolution since we have a key frame.
|
// Encode an intra only empty frame since we have a key frame.
|
||||||
cpi->svc.empty_frame_width = cm->width;
|
cpi->svc.encode_intra_empty_frame = 1;
|
||||||
cpi->svc.empty_frame_height = cm->height;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cm->frame_type = INTER_FRAME;
|
cm->frame_type = INTER_FRAME;
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#include "vp9/encoder/vp9_extend.h"
|
#include "vp9/encoder/vp9_extend.h"
|
||||||
|
|
||||||
#define SMALL_FRAME_FB_IDX 7
|
#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) {
|
void vp9_init_layer_context(VP9_COMP *const cpi) {
|
||||||
SVC *const svc = &cpi->svc;
|
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 (cpi->oxcf.error_resilient_mode == 0 && cpi->oxcf.pass == 2) {
|
||||||
if (vp9_realloc_frame_buffer(&cpi->svc.empty_frame.img,
|
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_x,
|
||||||
cpi->common.subsampling_y,
|
cpi->common.subsampling_y,
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#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,
|
memset(cpi->svc.empty_frame.img.buffer_alloc, 0x80,
|
||||||
cpi->svc.empty_frame.img.buffer_alloc_sz);
|
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->lst_fb_idx =
|
||||||
cpi->gld_fb_idx = cpi->alt_fb_idx = SMALL_FRAME_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
|
if (cpi->svc.encode_intra_empty_frame != 0)
|
||||||
// its previous size because of the scaling factor restriction.
|
cpi->common.intra_only = 1;
|
||||||
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;
|
|
||||||
|
|
||||||
cpi->svc.empty_frame_height >>= 1;
|
width = SMALL_FRAME_WIDTH;
|
||||||
cpi->svc.empty_frame_height = (cpi->svc.empty_frame_height + 1) & ~1;
|
height = SMALL_FRAME_HEIGHT;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,7 @@ typedef struct {
|
|||||||
NEED_TO_ENCODE
|
NEED_TO_ENCODE
|
||||||
}encode_empty_frame_state;
|
}encode_empty_frame_state;
|
||||||
struct lookahead_entry empty_frame;
|
struct lookahead_entry empty_frame;
|
||||||
int empty_frame_width;
|
int encode_intra_empty_frame;
|
||||||
int empty_frame_height;
|
|
||||||
|
|
||||||
// Store scaled source frames to be used for temporal filter to generate
|
// Store scaled source frames to be used for temporal filter to generate
|
||||||
// a alt ref frame.
|
// a alt ref frame.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user