}
+static void dealloc_raw_frame_buffers(VP8_COMP *cpi);
+
+
static void dealloc_compressor_data(VP8_COMP *cpi)
{
vpx_free(cpi->tplist);
vp8_yv12_de_alloc_frame_buffer(&cpi->pick_lf_lvl_frame);
vp8_yv12_de_alloc_frame_buffer(&cpi->scaled_source);
-#if VP8_TEMPORAL_ALT_REF
- vp8_yv12_de_alloc_frame_buffer(&cpi->alt_ref_buffer);
-#endif
- vp8_lookahead_destroy(cpi->lookahead);
+ dealloc_raw_frame_buffers(cpi);
vpx_free(cpi->tok);
cpi->tok = 0;
#endif
}
+
+static void dealloc_raw_frame_buffers(VP8_COMP *cpi)
+{
+#if VP8_TEMPORAL_ALT_REF
+ vp8_yv12_de_alloc_frame_buffer(&cpi->alt_ref_buffer);
+#endif
+ vp8_lookahead_destroy(cpi->lookahead);
+}
+
+
static int vp8_alloc_partition_data(VP8_COMP *cpi)
{
vpx_free(cpi->mb.pip);
void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
{
VP8_COMMON *cm = &cpi->common;
+ int last_w, last_h;
if (!cpi)
return;
cpi->target_bandwidth = cpi->oxcf.target_bandwidth;
+
+ last_w = cm->Width;
+ last_h = cm->Height;
+
cm->Width = cpi->oxcf.Width;
cm->Height = cpi->oxcf.Height;
cm->Height = (vs - 1 + cpi->oxcf.Height * vr) / vs;
}
+ if (last_w != cm->Width || last_h != cm->Height)
+ cpi->force_next_frame_intra = 1;
+
if (((cm->Width + 15) & 0xfffffff0) !=
cm->yv12_fb[cm->lst_fb_idx].y_width ||
((cm->Height + 15) & 0xfffffff0) !=
// Test code for segmentation of gf/arf (0,0)
//segmentation_test_function( cpi);
- if (cpi->compressor_speed == 2)
+ if(cpi->force_next_frame_intra)
{
- if(cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
- {
- if(cpi->force_next_frame_intra)
- {
- cm->frame_type = KEY_FRAME; /* delayed intra frame */
- }
- }
+ cm->frame_type = KEY_FRAME; /* delayed intra frame */
cpi->force_next_frame_intra = 0;
}
#endif
vpx_usec_timer_start(&timer);
+
+ /* Reinit the lookahead buffer if the frame size changes */
+ if (sd->y_width != cpi->common.Width || sd->y_height != cpi->common.Height)
+ {
+ assert(cpi->oxcf.lag_in_frames < 2);
+ dealloc_raw_frame_buffers(cpi);
+ alloc_raw_frame_buffers(cpi);
+ }
+
if(vp8_lookahead_push(cpi->lookahead, sd, time_stamp, end_time,
frame_flags, cpi->active_map_enabled ? cpi->active_map : NULL))
res = -1;