vp9 decode: defer loop filter allocation
wait until do_loopfilter_inline is true before committing the resources Change-Id: I01661bd40599b47362bb3fb534668471f2a9d8d7
This commit is contained in:
parent
07502f1963
commit
8f177bb0b6
@ -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,
|
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||||
"Truncated packet or corrupt header length");
|
"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);
|
setup_plane_dequants(cm, &pbi->mb, cm->base_qindex);
|
||||||
|
|
||||||
xd->mi_8x8 = cm->mi_grid_visible;
|
xd->mi_8x8 = cm->mi_grid_visible;
|
||||||
|
@ -142,13 +142,6 @@ VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) {
|
|||||||
pbi->decoded_key_frame = 0;
|
pbi->decoded_key_frame = 0;
|
||||||
|
|
||||||
vp9_worker_init(&pbi->lf_worker);
|
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;
|
return pbi;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user