Commit 8f177bb0 authored by James Zern's avatar James Zern
Browse files

vp9 decode: defer loop filter allocation

wait until do_loopfilter_inline is true before committing the resources

Change-Id: I01661bd40599b47362bb3fb534668471f2a9d8d7
parent 07502f19
......@@ -1118,6 +1118,15 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Truncated packet or corrupt header length");
if (pbi->do_loopfilter_inline && pbi->lf_worker.data1 == NULL) {
CHECK_MEM_ERROR(cm, pbi->lf_worker.data1, vpx_malloc(sizeof(LFWorkerData)));
pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker;
if (pbi->oxcf.max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) {
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
"Loop filter thread creation failed");
}
}
setup_plane_dequants(cm, &pbi->mb, cm->base_qindex);
xd->mi_8x8 = cm->mi_grid_visible;
......
......@@ -142,13 +142,6 @@ VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) {
pbi->decoded_key_frame = 0;
vp9_worker_init(&pbi->lf_worker);
pbi->lf_worker.data1 = vpx_malloc(sizeof(LFWorkerData));
pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker;
if (pbi->lf_worker.data1 == NULL ||
(pbi->oxcf.max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker))) {
vp9_remove_decompressor(pbi);
return NULL;
}
return pbi;
}
......
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