diff options
author | hkuang <hkuang@google.com> | 2014-05-14 11:48:58 -0700 |
---|---|---|
committer | hkuang <hkuang@google.com> | 2014-05-15 10:21:18 -0700 |
commit | bf8c58be5a11b4c1c822a01d494bf63391d42833 (patch) | |
tree | 2894914392e5984ab73d80b38f4235c46224a207 /vp9 | |
parent | f017b0d21cc6d59b8c1264718eed8268f71b4d76 (diff) | |
download | libvpx-bf8c58be5a11b4c1c822a01d494bf63391d42833.tar libvpx-bf8c58be5a11b4c1c822a01d494bf63391d42833.tar.gz libvpx-bf8c58be5a11b4c1c822a01d494bf63391d42833.tar.bz2 libvpx-bf8c58be5a11b4c1c822a01d494bf63391d42833.zip |
Refactor calling loopfilter code.
This change is mainly for a follow CL that will refactor the
decode_tiles.
Change-Id: I52de6f8dbada75a64d9a94ebb5975136ed0960b4
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/decoder/vp9_decodeframe.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 9dc0cf1a3..d6fc1e1f7 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -1325,16 +1325,6 @@ int vp9_decode_frame(VP9Decoder *pbi, vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, "Truncated packet or corrupt header length"); - if (do_loopfilter_inline && pbi->lf_worker.data1 == NULL) { - CHECK_MEM_ERROR(cm, pbi->lf_worker.data1, - vpx_memalign(32, sizeof(LFWorkerData))); - pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker; - if (pbi->max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) { - vpx_internal_error(&cm->error, VPX_CODEC_ERROR, - "Loop filter thread creation failed"); - } - } - init_macroblockd(cm, &pbi->mb); if (cm->coding_use_prev_mi) @@ -1357,9 +1347,23 @@ int vp9_decode_frame(VP9Decoder *pbi, if (pbi->max_threads > 1 && tile_rows == 1 && tile_cols > 1 && cm->frame_parallel_decoding_mode) { *p_data_end = decode_tiles_mt(pbi, data + first_partition_size, data_end); + // If multiple threads are used to decode tiles, then we use those threads + // to do parallel loopfiltering. + vp9_loop_filter_frame_mt(new_fb, pbi, cm, cm->lf.filter_level, 0, 0); } else { + if (do_loopfilter_inline && pbi->lf_worker.data1 == NULL) { + CHECK_MEM_ERROR(cm, pbi->lf_worker.data1, + vpx_memalign(32, sizeof(LFWorkerData))); + pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker; + if (pbi->max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) { + vpx_internal_error(&cm->error, VPX_CODEC_ERROR, + "Loop filter thread creation failed"); + } + } *p_data_end = decode_tiles(pbi, data + first_partition_size, data_end, do_loopfilter_inline); + if (!do_loopfilter_inline) + vp9_loop_filter_frame(new_fb, cm, &pbi->mb, cm->lf.filter_level, 0, 0); } new_fb->corrupted |= xd->corrupted; @@ -1388,16 +1392,5 @@ int vp9_decode_frame(VP9Decoder *pbi, if (cm->refresh_frame_context) cm->frame_contexts[cm->frame_context_idx] = cm->fc; - // Loopfilter - if (!do_loopfilter_inline) { - // If multiple threads are used to decode tiles, then we use those threads - // to do parallel loopfiltering. - if (pbi->num_tile_workers) { - vp9_loop_filter_frame_mt(new_fb, pbi, cm, cm->lf.filter_level, 0, 0); - } else { - vp9_loop_filter_frame(new_fb, cm, &pbi->mb, cm->lf.filter_level, 0, 0); - } - } - return 0; } |