Precalculated block ptrs do not need updates during encoding.
Set these at init stage.
Moved the allocation of 'mt_current_mb_col' (last encoded MB on each
row) to vp8_alloc_compressor_data(), so that it is correctly
reallocated when frame size is changing.
Change-Id: Idcdaa2d0cf3a7f782b7d888626b7cf22a4ffb5c1
vp8_build_block_offsets(x);
- vp8_setup_block_dptrs(&x->e_mbd);
-
- vp8_setup_block_ptrs(x);
-
xd->mode_info_context->mbmi.mode = DC_PRED;
xd->mode_info_context->mbmi.uv_mode = DC_PRED;
vp8_build_block_offsets(mb);
- vp8_setup_block_dptrs(mbd);
-
- vp8_setup_block_ptrs(mb);
-
mbd->left_context = &cm->left_context;
mb->mvc = cm->fc.mvc;
vpx_memset(cpi->mb_row_ei, 0, sizeof(MB_ROW_COMP) * th_count);
CHECK_MEM_ERROR(cpi->en_thread_data,
vpx_malloc(sizeof(ENCODETHREAD_DATA) * th_count));
- CHECK_MEM_ERROR(cpi->mt_current_mb_col,
- vpx_malloc(sizeof(*cpi->mt_current_mb_col) * cm->mb_rows));
sem_init(&cpi->h_event_end_encoding, 0, 0);
for (ithread = 0; ithread < th_count; ithread++)
{
- ENCODETHREAD_DATA * ethd = &cpi->en_thread_data[ithread];
+ ENCODETHREAD_DATA *ethd = &cpi->en_thread_data[ithread];
+
+ /* Setup block ptrs and offsets */
+ vp8_setup_block_ptrs(&cpi->mb_row_ei[ithread].mb);
+ vp8_setup_block_dptrs(&cpi->mb_row_ei[ithread].mb.e_mbd);
sem_init(&cpi->h_event_start_encoding[ithread], 0, 0);
+
ethd->ithread = ithread;
ethd->ptr1 = (void *)cpi;
ethd->ptr2 = (void *)&cpi->mb_row_ei[ithread];
vpx_free(cpi->h_encoding_thread);
vpx_free(cpi->mb_row_ei);
vpx_free(cpi->en_thread_data);
- vpx_free(cpi->mt_current_mb_col);
}
}
#endif
vp8_build_block_offsets(x);
- vp8_setup_block_dptrs(&x->e_mbd);
-
- vp8_setup_block_ptrs(x);
-
/* set up frame new frame for intra coded blocks */
vp8_setup_intra_recon(new_yv12);
vp8cx_frame_init_quantizer(cpi);
#include "vpx_config.h"
#include "vp8/common/onyxc_int.h"
+#include "vp8/common/blockd.h"
#include "onyx_int.h"
#include "vp8/common/systemdependent.h"
#include "quantize.h"
vpx_free(cpi->mb.pip);
cpi->mb.pip = 0;
+
+#if CONFIG_MULTITHREAD
+ vpx_free(cpi->mt_current_mb_col);
+ cpi->mt_current_mb_col = NULL;
+#endif
}
static void enable_segmentation(VP8_COMP *cpi)
cpi->mt_sync_range = 8;
else
cpi->mt_sync_range = 16;
+
+ if (cpi->oxcf.multi_threaded > 1)
+ {
+ vpx_free(cpi->mt_current_mb_col);
+ CHECK_MEM_ERROR(cpi->mt_current_mb_col,
+ vpx_malloc(sizeof(*cpi->mt_current_mb_col) * cm->mb_rows));
+ }
+
#endif
vpx_free(cpi->tplist);
-
- CHECK_MEM_ERROR(cpi->tplist, vpx_malloc(sizeof(TOKENLIST) * cpi->common.mb_rows));
+ CHECK_MEM_ERROR(cpi->tplist,
+ vpx_malloc(sizeof(TOKENLIST) * cpi->common.mb_rows));
}
cpi->mb.inter_bmode_costs = cpi->rd_costs.inter_bmode_costs;
cpi->mb.token_costs = cpi->rd_costs.token_costs;
+ /* setup block ptrs & offsets */
+ vp8_setup_block_ptrs(&cpi->mb);
+ vp8_setup_block_dptrs(&cpi->mb.e_mbd);
+
return cpi;
}