ref: 8f177bb0b64a7ee143dadb2af491c53da46ac89f
parent: 07502f19637bdfc535b569a66738f47ef0bf58cd
author: James Zern <[email protected]>
date: Sat Oct 26 07:57:44 EDT 2013
vp9 decode: defer loop filter allocation wait until do_loopfilter_inline is true before committing the resources Change-Id: I01661bd40599b47362bb3fb534668471f2a9d8d7
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -1118,6 +1118,15 @@
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;
--- a/vp9/decoder/vp9_onyxd_if.c
+++ b/vp9/decoder/vp9_onyxd_if.c
@@ -142,13 +142,6 @@
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;
}