summaryrefslogtreecommitdiff
path: root/vp9/decoder/vp9_decoder.c
AgeCommit message (Collapse)Author
2015-08-10Move vp9_systemdependent.h to vpx_ports bitops.h and system_state.hAlex Converse
Use system_state.h in vpx_dsp and remove unneeded includes of vp9_systemdependent.h. Change-Id: I92557ec6dd5aa790160b4f31fe7967db0d7ec3c4
2015-07-02Rename vpx_thread to vpx_utilJingning Han
Change the dir name to include more util tools. Change-Id: Id5b16062803ce5eed872fe2edb36d7e56b32eed8
2015-07-02Use vpx prefix for codec independent threading functionsJingning Han
Replace vp9_ prefix with vpx_ for common multi-threading functions. Change-Id: I941a5ead9bfe8213fdad345511d2061b07797b55
2015-07-01Move multi-threading module functions into vpx_thread folderJingning Han
This commit moves the primitive multi-threading files from vp9 folder to vpx_thread, which will be accessible by all vpx codec. Change-Id: Ib51e66e9c69801c10631fab56d35a0c0aaed5883
2015-05-28Merge "Add error handling when running out of free frame buffers."hkuang
2015-05-27Add error handling when running out of free frame buffers.hkuang
Change-Id: If28b59b9521204a6e3aecedcf75932d76a752567
2015-05-20[decoder] Optimize context buffer re-allocationMinghai Shang
1. Check existing buffer sizes when re-allocate context buffers. 2. Don't need to set mi buffers to 0 during setup_mi. Change-Id: I6b48b0e077a4d804312b605ad0dc34aec5795a6d
2015-05-06Move shared SAD code to vpx_dspJohann
Create a new component, vpx_dsp, for code that can be shared between codecs. Move the SAD code into the component. This reduces the size of vpxenc/dec by 36k on x86_64 builds. Change-Id: I73f837ddaecac6b350bf757af0cfe19c4ab9327a
2015-04-28vpx_mem: remove vpx_memsetJames Zern
vestigial. replace instances with memset() which they already were being defined to. Change-Id: Ie030cfaaa3e890dd92cf1a995fcb1927ba175201
2015-04-21Revert "Remove mi_grid_* structures."Scott LaVarnway
(see I3a05cf1610679fed26e0b2eadd315a9ae91afdd6) For the test clip used, the decoder performance improved by ~2%. This is also an intermediate step towards adding back the mode_info streams. Change-Id: Idddc4a3f46e4180fbebddc156c4bbf177d5c2e0d
2015-04-15Reorganize *_rtcd() calling conventionsJohann
Change-Id: Ib1e17d8aae9b713b87f560ab5e49952ee2bfdcc2
2015-02-19Optimize the dequantization process on decoder side.Hangyu Kuang
Change-Id: I00621ff7165bbe86a18794b4a816976c9effaf78
2015-02-05vp9: fix segfault w/corrupt data post frame-parallel mergeJames Zern
cm->frame_bufs[].idx values were made consistent in: 61c5e94 Use -1 consistently as invalid buffer idx update the initialization in swap_frame_buffers() to match. additionally: - remove some shadowed variables in the former and marked them volatile Change-Id: Ie3f9636c405bd822112bb56bd22d28024ae98909
2015-01-30Try again to merge branch 'frame-parallel' into master branch.hkuang
In frame parallel decode, libvpx decoder decodes several frames on all cpus in parallel fashion. If not being flushed, it will only return frame when all the cpus are busy. If getting flushed, it will return all the frames in the decoder. Compare with current serial decode mode in which libvpx decoder is idle between decode calls, libvpx decoder is busy between decode calls. Current frame parallel decode will only speed up the decoding for frame parallel encoded videos. For non frame parallel encoded videos, frame parallel decode is slower than serial decode due to lack of loopfilter worker thread. There are still some known issues that need to be addressed. For example: decode frame parallel videos with segmentation enabled is not right sometimes. * frame-parallel: Add error handling for frame parallel decode and unit test for that. Fix a bug in frame parallel decode and add a unit test for that. Add two test vectors to test frame parallel decode. Add key frame seeking to webmdec and webm_video_source. Implement frame parallel decode for VP9. Increase the thread test range to cover 5, 6, 7, 8 threads. Fix a bug in adding frame parallel unit test. Add VP9 frame-parallel unit test. Manually pick "Make the api behavior conform to api spec." from master branch. Move vp9_dec_build_inter_predictors_* to decoder folder. Add segmentation map array for current and last frame segmentation. Include the right header for VP9 worker thread. Move vp9_thread.* to common. ctrl_get_reference does not need user_priv. Seperate the frame buffers from VP9 encoder/decoder structure. Revert "Revert "Revert "Revert 3 patches from Hangyu to get Chrome to build:""" Conflicts: test/codec_factory.h test/decode_test_driver.cc test/decode_test_driver.h test/invalid_file_test.cc test/test-data.sha1 test/test.mk test/test_vectors.cc vp8/vp8_dx_iface.c vp9/common/vp9_alloccommon.c vp9/common/vp9_entropymode.c vp9/common/vp9_loopfilter_thread.c vp9/common/vp9_loopfilter_thread.h vp9/common/vp9_mvref_common.c vp9/common/vp9_onyxc_int.h vp9/common/vp9_reconinter.c vp9/decoder/vp9_decodeframe.c vp9/decoder/vp9_decodeframe.h vp9/decoder/vp9_decodemv.c vp9/decoder/vp9_decoder.c vp9/decoder/vp9_decoder.h vp9/encoder/vp9_encoder.c vp9/encoder/vp9_pickmode.c vp9/encoder/vp9_rdopt.c vp9/vp9_cx_iface.c vp9/vp9_dx_iface.c This reverts commit a18da9760a74d9ce6fb9f875706dc639c95402f5. Change-Id: I361442ffec1586d036ea2e0ee97ce4f077585f02
2015-01-23Revert "Merge branch 'frame-parallel' to enable frame parallel decode in ↵Johann
master branch." This reverts commit bde04ce5039cbcf86c8b34bdb4127e18d7e1d0c7 Change-Id: I053dae04c761b04a36dc239558503905a14d2470
2015-01-22Merge branch 'frame-parallel' to enable frame parallel decode in master branch.hkuang
In frame parallel decode, libvpx decoder decodes several frames on all cpus in parallel fashion. If not being flushed, it will only return frame when all the cpus are busy. If getting flushed, it will return all the frames in the decoder. Compare with current serial decode mode in which libvpx decoder is idle between decode calls, libvpx decoder is busy between decode calls. VP9 frame parallel decode is >30% faster than serial decode with tile parallel threading which will makes devices play 1080P VP9 videos more easily. * frame-parallel: Add error handling for frame parallel decode and unit test for that. Fix a bug in frame parallel decode and add a unit test for that. Add two test vectors to test frame parallel decode. Add key frame seeking to webmdec and webm_video_source. Implement frame parallel decode for VP9. Increase the thread test range to cover 5, 6, 7, 8 threads. Fix a bug in adding frame parallel unit test. Add VP9 frame-parallel unit test. Manually pick "Make the api behavior conform to api spec." from master branch. Move vp9_dec_build_inter_predictors_* to decoder folder. Add segmentation map array for current and last frame segmentation. Include the right header for VP9 worker thread. Move vp9_thread.* to common. ctrl_get_reference does not need user_priv. Seperate the frame buffers from VP9 encoder/decoder structure. Revert "Revert "Revert "Revert 3 patches from Hangyu to get Chrome to build:""" Conflicts: test/codec_factory.h test/decode_test_driver.cc test/decode_test_driver.h test/invalid_file_test.cc test/test-data.sha1 test/test.mk test/test_vectors.cc vp8/vp8_dx_iface.c vp9/common/vp9_alloccommon.c vp9/common/vp9_entropymode.c vp9/common/vp9_loopfilter_thread.c vp9/common/vp9_loopfilter_thread.h vp9/common/vp9_mvref_common.c vp9/common/vp9_onyxc_int.h vp9/common/vp9_reconinter.c vp9/decoder/vp9_decodeframe.c vp9/decoder/vp9_decodeframe.h vp9/decoder/vp9_decodemv.c vp9/decoder/vp9_decoder.c vp9/decoder/vp9_decoder.h vp9/encoder/vp9_encoder.c vp9/encoder/vp9_pickmode.c vp9/encoder/vp9_rdopt.c vp9/vp9_cx_iface.c vp9/vp9_dx_iface.c Change-Id: Ib92eb35851c172d0624970e312ed515054e5ca64
2015-01-16vp9_ethread: add parallel loopfilterYunqing Wang
1. Added row-based loopfilter in encoder; 2. Moved common multi-threaded loopfilter functions from decoder to common; 3. Merged multi-threaded loopfilter code, and made encoder/ decoder call same function to reduce code duplication. Encoder tests showed that 1% - 2% speedup was seen for good-quality 2-pass mode(at speed 3); 1% - 3% speedup using 2 threads and 4% - 6% speedup using 4 threads were seen for real-time mode(at speed 7). Change-Id: I8a4ac51c2ad9bab9fa7b864e90743931c53ec1c4
2015-01-08Merge "vp9: fix -Wclobbered (longjmp + local variables)"James Zern
2015-01-06Use -1 consistently as invalid buffer idxYaowu Xu
Instead of mixed use of both -1 and INT_MAX. This also fixes a vp9 fuzzing test failure. Change-Id: I950ea94b44ec7cdb5232773bee30b104e342f52a
2014-12-23vp9: fix -Wclobbered (longjmp + local variables)James Zern
Local variables used at the setjmp() site need to be marked volatile. Relevant excerpt from the 'man longjmp': =============== The values of automatic variables are unspecified after a call to longjmp() if they meet all the following criteria: · they are local to the function that made the corresponding setjmp(3) call; · their values are changed between the calls to setjmp(3) and longjmp(); and · they are not declared as volatile. =============== Change-Id: I093e6eeeedbf5f781d202248ca701ba2c29d3064
2014-12-19resolve visual studio warnings around initializersJim Bankoski
Change-Id: Id2ad4fb24242f7ca8fa7a152f0889fded4113613
2014-12-18make vp9 encoder static initializers thread safeJim Bankoski
Change-Id: If2d0888d13ebe52bc7c3b16f16319408a86ab6de
2014-12-08Add error handling for frame parallel decode and unit test for that.hkuang
Change-Id: I6e309e11f1641618d2424b7a2c0fe744b8974dec
2014-12-04Clean up the logic of handling corrupted frame.hkuang
No more checking of corrupted reference frame as we skip decoding any non-intra frame in case of frame corrupted. Change-Id: I77d41bbb02fc5f61972740e2d411441eb6a17073
2014-12-02vp9: sync threads after a longjmpJames Zern
Synchronize all threads immediately as a subsequent decode call may cause a resize invalidating some allocations. fixes one aspect of crbug.com/437655 Change-Id: Ie993b62c2756478543206ddbe43ec6268d90a470
2014-11-14Fix a bug in frame parallel decode and add a unit test for that.hkuang
A flush bug is discovered during putting frame parallel decoder into Android. This test will expose that bug. Change-Id: Ia047f27972f4da0471649f79f1f91e7695297473
2014-11-06Modify the frame context memory deallocationYunqing Wang
This patch was to fix the vpxdec fuzzing3 test failure. When an error occurs, setjmp() is invoked, which calls the decoder removing routine. In multiple thread situation, other threads could try to access the frame context memory that is already deallocated, thus causing a segfault. An invalid unit test was added for this issue. Change-Id: Ida7442154f3d89759483f0f4fe0324041fffb952
2014-11-05Totally remove prev_mi in VP9 decoder.hkuang
This will save the memory and improve the decode speed due to removing unnecessary memset of big prev_mi array for all the key frames. Decoding a all key frames 1080p video shows speed improve around 2%. Change-Id: I6284a445c1291056e3c15135c3c20d502f791c10
2014-10-31Bind motion vectors with frame buffer structure.hkuang
This will save a lot of memory for decoder due to removing of prev_mi, but prev_mi is still needed in encoder. So this will increase a little bit memory for encoder. Change-Id: I24b2f1a423ebffa55a9bd2fcee1077dac995b2ed
2014-10-24Merge changes I8a9c9019,Ic7b2faa3,I44d42a50,I3f3a3924,I10747b32,I31b49c9eJames Zern
* changes: add vp9_loop_filter_data_reset move LFWorkerData allocation to VP9LfSync vp9_loop_filter_frame_mt: remove pbi dependency vp9_loop_filter_frame_mt: pass planes directly vp9_loop_filter_frame_mt: pass VP9LfSync directly vp9: store TileWorkerData allocations separately
2014-10-22Merge "vp9_ethread: allocate frame contexts outside VP9_COMMON struct"Yunqing Wang
2014-10-22vp9_ethread: allocate frame contexts outside VP9_COMMON structYunqing Wang
This patch allocated frame contexts outside VP9_COMMON. This allows multiple threads to share the same copy of frame contexts, and reduces the overhead. It also guarantees the correct update of these contexts during bitstream packing. This patch doesn't change encoding result. Change-Id: Ic181a2460b891d1d587278a6d02d8057b9dbd353
2014-10-22Implement frame parallel decode for VP9.Hangyu Kuang
Using 4 threads, frame parallel decode is ~3x faster than single thread decode and around 30% faster than tile parallel decode for frame parallel encoded video on both Android and desktop with 4 threads. Decode speed is scalable to threads too which means decode could be even faster with more threads. Change-Id: Ia0a549aaa3e83b5a17b31d8299aa496ea4f21e3e
2014-10-17Correct the logic of ready_for_new_data.hkuang
This should be set right after decoder really start to decode frame instead setting at the end. Even decoder does not have a displayable frame to show and return NULL to application, this should be set too. Change-Id: If0313a834bc64e3b0f05a84f4459d444d9eab0d8
2014-10-16vp9: store TileWorkerData allocations separatelyJames Zern
move them from VP9Worker::data[12] to allow the structure to be reused a bit more naturally by the multi-threaded loopfilter. Change-Id: I31b49c9e93ca744fd7f6d6ed8696671188fb2c1d
2014-10-02Merge "Make iscan and scan neighbor arrays static const."Yaowu Xu
2014-10-02Make iscan and scan neighbor arrays static const.Yaowu Xu
This commit changes the tables to be read only, which fixes issue #866 Change-Id: I85bbe03f9d344f50570f8c1c61699bdc5cee248f
2014-09-29Miscellaneous decoder changes for high bitdepthDeb Mukherjee
Also includes yv12 config changes. Change-Id: Iacf40d8bf486815b54c32a127ce3cd4516b7e44f
2014-09-09vp9: wait for key/intra-only frame after corruptionJames Zern
don't bother decoding any further after receiving an earlier decode error until a key/intra-only frame is encountered. Change-Id: I381917b70d7a9e6f8d6de42e3d181bb113a4cec4
2014-09-03Initializing intra modes without vpx_once().Dmitry Kovalev
Change-Id: I0a9d52432f2500f1bd8f43f229e70e38bb9a0343
2014-09-02Adds config opt for highbitdepth + misc. vpxDeb Mukherjee
Adds config parameter vp9_highbitdepth, to support highbitdepth profiles. Also includes most vpx level high bit-depth functions. However encode/decode in the highbitdepth profiles will not work until the rest of the code is in place. Change-Id: I34c53b253c38873611057a6cbc89a1361b8985a6
2014-08-29vp9: fix m/t loop filter invalid freeJames Zern
store the number of allocated rows in VP9LfSync, the calculated values can not be relied on when dealing with corrupt material. Change-Id: I13b8bcec9738c299a71df726772ab7ac05511e5b
2014-08-19Merge "[spatial svc]Add a few different encode frame tests."Minghai Shang
2014-08-18[spatial svc]Add a few different encode frame tests.Minghai Shang
1. Clean the code for encode frame tests 2. Add encode w/ and w/o alt reference frame test 3. Add encode SNR layers test 4. Add encode multiple layers but decode partial layers test Change-Id: Ibd2c9bc02525db584a6f931a98405f2d851b3cd6
2014-08-14vp9_copy_reference_dec: check ref frame index before useJames Zern
use get_ref_frame() to ensure a valid frame is retrieved if one exists Change-Id: I4b116d928e643ee62a991babd4b974037b6b3830
2014-08-08Common encode/decode function to get reference frameAdrian Grange
Replaced encoder and decoder functions to get a pointer to a reference frame with a common function, vp9_get_ref_frame, and simplified it. Change-Id: Icb206fcce8caace3bfd1db3dbfa318dde79043ee
2014-07-28Add segmentation map array for current and last frame segmentation.hkuang
The original implementation only allocates one segmentation map and this works fine for serial decode. But for frame parallel decode, each thread need to have its own segmentation map and the last frame segmentation map should be provided from last frame decoding thread. After finishing decoding a frame, thread need to serve the old segmentation map that associate with the previous decoded frame. The thread also need to use another segmentation map for decoding the current frame. Change-Id: I442ddff36b5de9cb8a7eb59e225744c78f4492d8
2014-07-15Fix show_existing_frame not decreasing frame buffer ref counter.Alexander Voronov
The issue was introduced by commit g7c43fb6. If current frame is repeated from existing-ref pool, frame buffer ref counter is not decreased, so buffer isn't released. Decoder fails being unable to allocate new frame buffer at some point. Added a test vector to verify that the condition will not recur later. Test vector was generated by the code in this patch: https://gerrit.chromium.org/gerrit/#/c/70862/ Change-Id: I8af96eb5b9670176e01a281d2e18bd458712cf78
2014-07-10call vp[89]_clear_system_state after longjmpJames Zern
restore the environment post encode/decode failure Change-Id: I3c72e2260a616432eaf1f9545d4fb4d8e45cc7b0
2014-07-09Merge "vp9_decoder_remove: destroy common after thread shutdown"James Zern