Commit baedcedc authored by Marco Paniconi's avatar Marco Paniconi Committed by John Koleszar
Browse files

Reset Q for key frame when spatial resizing occurs.

The logic for spatial resizing is done after the Q is selected for the
frame. This causes a problem that the Q we select for the (resized)
key frame may be based on a different resolution than the frame we
will encode.

This fix is to ensure that, when resize is on, the selected Q is still
based on the resolution of the frame to be encoded.

Change-Id: Ia49a9eac5f64e48d1c00dfc7ed4ce26fe84d3fa1
parent cab6ac16
......@@ -2612,7 +2612,7 @@ static void scale_and_extend_source(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
}
static void resize_key_frame(VP8_COMP *cpi)
static int resize_key_frame(VP8_COMP *cpi)
{
#if CONFIG_SPATIAL_RESAMPLING
VP8_COMMON *cm = &cpi->common;
......@@ -2653,10 +2653,12 @@ static void resize_key_frame(VP8_COMP *cpi)
cm->Height = new_height;
vp8_alloc_compressor_data(cpi);
scale_and_extend_source(cpi->un_scaled_source, cpi);
return 1;
}
}
#endif
return 0;
}
......@@ -3801,7 +3803,17 @@ static void encode_frame_to_data_rate
if (cm->frame_type == KEY_FRAME)
{
resize_key_frame(cpi);
if(resize_key_frame(cpi))
{
/* If the frame size has changed, need to reset Q, quantizer,
* and background refresh.
*/
Q = vp8_regulate_q(cpi, cpi->this_frame_target);
if (cpi->cyclic_refresh_mode_enabled && (cpi->current_layer==0))
cyclic_background_refresh(cpi, Q, 0);
vp8_set_quantizer(cpi, Q);
}
vp8_setup_key_frame(cpi);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment