Fix bug with smaller width bigger size
Bug: webm:1642 Change-Id: I831b7701495eebeeff6bdc0b570f737bb6d536c6
This commit is contained in:
@@ -101,13 +101,10 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||||||
*h = initial_h;
|
*h = initial_h;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (frame < 100) {
|
|
||||||
*w = initial_w * 7 / 10;
|
*w = initial_w * 7 / 10;
|
||||||
*h = initial_h * 16 / 10;
|
*h = initial_h * 16 / 10;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (frame < 10) {
|
if (frame < 10) {
|
||||||
*w = initial_w;
|
*w = initial_w;
|
||||||
*h = initial_h;
|
*h = initial_h;
|
||||||
@@ -578,9 +575,7 @@ TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(https://crbug.com/webm/1642): This causes a segfault in
|
TEST_P(ResizeRealtimeTest, TestExternalResizeSmallerWidthBiggerSize) {
|
||||||
// init_encode_frame_mb_context().
|
|
||||||
TEST_P(ResizeRealtimeTest, DISABLED_TestExternalResizeSmallerWidthBiggerSize) {
|
|
||||||
ResizingVideoSource video;
|
ResizingVideoSource video;
|
||||||
video.flag_codec_ = true;
|
video.flag_codec_ = true;
|
||||||
video.smaller_width_larger_size_ = true;
|
video.smaller_width_larger_size_ = true;
|
||||||
|
|||||||
@@ -132,15 +132,6 @@ int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) {
|
|||||||
if (cm->mi_alloc_size < new_mi_size) {
|
if (cm->mi_alloc_size < new_mi_size) {
|
||||||
cm->free_mi(cm);
|
cm->free_mi(cm);
|
||||||
if (cm->alloc_mi(cm, new_mi_size)) goto fail;
|
if (cm->alloc_mi(cm, new_mi_size)) goto fail;
|
||||||
}
|
|
||||||
|
|
||||||
if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) {
|
|
||||||
// Create the segmentation map structure and set to 0.
|
|
||||||
free_seg_map(cm);
|
|
||||||
if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cm->above_context_alloc_cols < cm->mi_cols) {
|
|
||||||
vpx_free(cm->above_context);
|
vpx_free(cm->above_context);
|
||||||
cm->above_context = (ENTROPY_CONTEXT *)vpx_calloc(
|
cm->above_context = (ENTROPY_CONTEXT *)vpx_calloc(
|
||||||
2 * mi_cols_aligned_to_sb(cm->mi_cols) * MAX_MB_PLANE,
|
2 * mi_cols_aligned_to_sb(cm->mi_cols) * MAX_MB_PLANE,
|
||||||
@@ -154,6 +145,12 @@ int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) {
|
|||||||
cm->above_context_alloc_cols = cm->mi_cols;
|
cm->above_context_alloc_cols = cm->mi_cols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) {
|
||||||
|
// Create the segmentation map structure and set to 0.
|
||||||
|
free_seg_map(cm);
|
||||||
|
if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
if (vp9_alloc_loop_filter(cm)) goto fail;
|
if (vp9_alloc_loop_filter(cm)) goto fail;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1972,6 +1972,17 @@ static void alloc_copy_partition_data(VP9_COMP *cpi) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void free_copy_partition_data(VP9_COMP *cpi) {
|
||||||
|
vpx_free(cpi->prev_partition);
|
||||||
|
cpi->prev_partition = NULL;
|
||||||
|
vpx_free(cpi->prev_segment_id);
|
||||||
|
cpi->prev_segment_id = NULL;
|
||||||
|
vpx_free(cpi->prev_variance_low);
|
||||||
|
cpi->prev_variance_low = NULL;
|
||||||
|
vpx_free(cpi->copied_frame_cnt);
|
||||||
|
cpi->copied_frame_cnt = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||||
VP9_COMMON *const cm = &cpi->common;
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
RATE_CONTROL *const rc = &cpi->rc;
|
RATE_CONTROL *const rc = &cpi->rc;
|
||||||
@@ -2051,6 +2062,8 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
|||||||
new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows);
|
new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows);
|
||||||
if (cm->mi_alloc_size < new_mi_size) {
|
if (cm->mi_alloc_size < new_mi_size) {
|
||||||
vp9_free_context_buffers(cm);
|
vp9_free_context_buffers(cm);
|
||||||
|
vp9_free_pc_tree(&cpi->td);
|
||||||
|
vpx_free(cpi->mbmi_ext_base);
|
||||||
alloc_compressor_data(cpi);
|
alloc_compressor_data(cpi);
|
||||||
realloc_segmentation_maps(cpi);
|
realloc_segmentation_maps(cpi);
|
||||||
cpi->initial_width = cpi->initial_height = 0;
|
cpi->initial_width = cpi->initial_height = 0;
|
||||||
@@ -2069,8 +2082,18 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
|||||||
update_frame_size(cpi);
|
update_frame_size(cpi);
|
||||||
|
|
||||||
if (last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) {
|
if (last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) {
|
||||||
memset(cpi->consec_zero_mv, 0,
|
vpx_free(cpi->consec_zero_mv);
|
||||||
cm->mi_rows * cm->mi_cols * sizeof(*cpi->consec_zero_mv));
|
CHECK_MEM_ERROR(
|
||||||
|
cm, cpi->consec_zero_mv,
|
||||||
|
vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(*cpi->consec_zero_mv)));
|
||||||
|
|
||||||
|
vpx_free(cpi->skin_map);
|
||||||
|
CHECK_MEM_ERROR(
|
||||||
|
cm, cpi->skin_map,
|
||||||
|
vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(cpi->skin_map[0])));
|
||||||
|
|
||||||
|
free_copy_partition_data(cpi);
|
||||||
|
alloc_copy_partition_data(cpi);
|
||||||
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
|
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
|
||||||
vp9_cyclic_refresh_reset_resize(cpi);
|
vp9_cyclic_refresh_reset_resize(cpi);
|
||||||
rc->rc_1_frame = 0;
|
rc->rc_1_frame = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user