summaryrefslogtreecommitdiff
path: root/vp9/common/vp9_alloccommon.c
AgeCommit message (Collapse)Author
2016-08-19vp9_alloc_context_buffers: clear cm->mi* on failureJames Zern
this fixes a crash in vp9_dec_setup_mi() via vp9_init_context_buffers() should decoding continue and the decoder resyncs on a smaller frame BUG=b/30593752 Change-Id: I9ce8d94abe89bcd058697e8bd8599690e61bd380
2016-08-02vp9/common: apply clang-formatclang-format
Change-Id: Ie0f150fdcfcbf7c4db52d3a08bc8238ed1c72e3b
2016-07-15addnoise : clear out static size for generated noiseJim Bankoski
Change-Id: I5d4343f2da9cd4b01dd37be7a048d159fec109d1
2016-07-12deblock filter : moved from vp8 code branchJim Bankoski
The deblocking filters used in vp8 have been moved to vpx_dsp for use by both vp8 and vp9. Change-Id: I5209d76edafc894b550f751fc76d3aa6799b392d
2016-02-12vp9-resize: Fix an issue with external dynamic resize.Marco
External dynamic resize with swapping width and height was not handled properly. Fix is to re-init loop-filter under certain condtions. Modify unittest to test this case. Without this change test will fail. Relates to: https://bugs.chromium.org/p/webm/issues/detail?id=1140 Change-Id: I7d81ca7fe0783b3bc103a52a7b7cf073a96be26e
2015-09-29VP9: move loopfilter build masks to decode loopScott LaVarnway
The loopfilter masks are now built in the decode loop. This is done so we can eventually reduce the number of MODE_INFO structs required by the decoder. The encoder builds the masks for the entire frame prior to calling the loopfilter. Change-Id: Ia2146b07e0acb8c50203e586dfae0c4c5b316f11
2015-08-14Change vp9_ prefix function names in vpx_scale to vpx_Jingning Han
Change-Id: Iac85902cbbb3e752801dc85de9a3c778e47304aa
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-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-15vp9: add some missing includesJames Zern
mostly: <file>.c should include <file>.h silences missing prototype warnings Change-Id: Ic05ec32c6f7b2224b78825904d96d73aacad6000
2015-04-28vpx_mem: remove vpx_memsetJames Zern
vestigial. replace instances with memset() which they already were being defined to. Change-Id: Ie030cfaaa3e890dd92cf1a995fcb1927ba175201
2015-03-19Safely free all the frame buffers after all the workers finish the work.hkuang
Issue: 978 Change-Id: Ia7aa809095008f6819a44d7ecb0329def79b1117
2015-03-04Make encoder buffer allocation dynamicAdrian Grange
Frame buffers are now allocated dynamically on-demand. Entries in the reference frame map, cm->ref_frame_map, may now be set to -1 (INVALID_IDX) to indicate that there is not a valid reference buffer in that "slot". All slots in the reference frame map are now initialized to the empty state (-1) and each buffer is initialized to have a reference count of 0. Change-Id: Id1afe98de98db4ae8b2dfefed7889c3b28c68582
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
2014-12-15Revert "Revert "Add support for setting byte alignment.""Frank Galligan
This reverts commit 91471d6aad285ff10e7582e485d8adadd1986fe2. Fixes the compile issues if post_proc is enabled. Change-Id: Ib40a15ce2c194f9b5adfa65a17ab01ddf60f5a59
2014-12-15Revert "Add support for setting byte alignment."Paul Wilkins
Fails to compile. Bad calls to vp9_alloc_frame_buffer and vp9_realloc_frame_buffer in postproc.c This reverts commit 399823b6f50fb7465f62822d1395e2192e7b07fc. Change-Id: I29f0e173f8e185d3a303cfdb17813e1eccb51e3a
2014-12-12Merge "Add support for setting byte alignment."Frank Galligan
2014-12-12Add support for setting byte alignment.Frank Galligan
Add support for setting byte alignment on the Y, U, and V plane of the reference buffers. The byte alignment must be a power of 2, from 32 to 1024. A value of 0 sets legacy alignment. Change-Id: I7c1399622f7aa68e123646369216b32047dda73d
2014-12-12vp9: make postproc members depend on CONFIG_VP9_POSTPROCJames Zern
Change-Id: Id64218386968cee3132269e4a0572650f20fd980
2014-12-12vp9_postproc: remove redundant CONFIG_* checksJames Zern
the entire module is wrapped in CONFIG_VP9_POSTPROC which is forcibly enabled with CONFIG_INTERNAL_STATS + a similar change in vp9_alloccommon.c Change-Id: I374993297a9fba5bef2f0b71f984eba42f0995a3
2014-12-11Multiframe Quality Enhancement(MFQE) in VP9.JackyChen
It is the first version of MFQE in VP9. There are a few TODOs included in this version. Usage: Add flag --enable-vp9-postproc to config the project. In decoder, use flag --mfqe in the command line to enable MFQE in postproc. Note: Need to have key frame with low quality to see the effect of this new patch. In my experiment, I fixed the qindex to 200 in key frame. Change-Id: I021f9ce4616ed3574c81e48d968662994b56a396
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-05Merge "Totally remove prev_mi in VP9 decoder."hkuang
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-11-04Fix the memory leak due to missing free frame_mvs.hkuang
Change-Id: I2ceee7341d906259002c0ea31ea009ae32c04bfd
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-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-09-19Remove mi_grid_* structures.hkuang
mi_grid_* are arrays of pointer to pointer. They save the pointers that point to the MIs in cm->mi. But they are unnecessary and complicated. The original goal was to remove MODE_INFO_t copy. But with an extra MODE_INFO_t pointer inside MODE_INFO_t, same goal could be achieved. This commit totally removes the mi_grid_* structures. But there are still many dummy MODE_INFO_t inside cm->mi which are a waste of memory. Next commit will do on-demand MODE_INFO_t allocation in order to save these memories. Change-Id: I3a05cf1610679fed26e0b2eadd315a9ae91afdd6
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-14Fix bug 837: realloc mode info buffers on resizeAdrian Grange
The test to determine if the mode info buffers need to be resized when the frame size changes was incorrect, as per bug 837. By storing the size of the allocated data structure, a simple test determines whether to allocate more memory when the frame size changes. Change-Id: I1544698f2882cf958fc672485614f2f46e9719bd
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-17Modified frame buffer handlingAdrian Grange
This patch is the first step toward simplifying the frame buffer handling. The final goal is to have a common frame buffer handling framework for both encoder and decoder that incorporates the existing ability to use externally allocated memory. Change-Id: I2c378a4f54a39908915f46c4260e17a080db7ff1
2014-07-02Seperate the frame buffers from VP9 encoder/decoder structure.hkuang
Prepare for frame parallel decoding, the frame buffers must be separated from the encoder and decoder structure, while the encoder and decoder will hold the pointer of the BufferPool. Change-Id: I172c78f876e41fb5aea11be5f632adadf2a6f466
2014-06-27vp9: disable postproc buffer alloc when unnecessaryJames Zern
the buffer is only used in encoding and only when CONFIG_INTERNAL_STATS or CONFIG_VP9_POSTPROC is enabled. a future change should decouple this from the frame buffer allocation and make it conditional based on runtime flags when the above config options are enabled. reduces decode heap usage by at least 12% Change-Id: Id0b97620d4936afefa538d3aadf32106743d9caf
2014-06-23Allocate buffers based on correct chroma formatAdrian Grange
The encoder currently allocates frame buffers before it establishes what the chroma sub-sampling factor is, always allocating based on the 4:4:4 format. This patch detects the chroma format as early as possible allowing the encoder to allocate buffers of the correct size. Future patches will change the encoder to allocate frame buffers on demand to further reduce the memory profile of the encoder and rationalize the buffer management in the encoder and decoder. Change-Id: Ifd41dd96e67d0011719ba40fada0bae74f3a0d57
2014-06-10Add mode info arrays and mode info index.hkuang
In non frame-parallel decoding, this works the same way as current decoding scheme. Every time after decoder finish decoding a frame, it will swap the current mode info pointer and previous mode info pointer if the decoded frame needs to be shown. Both mode info pointer and previous mode info pointer are from mode info arrays. In frame-parallel decoding, this will become more complicated as current frame's mode info pointer will be shared with next frame as previous mode info pointer. But when one decoder thread finishes decoding one frame and starts to work on next available frame, it needs to retain the decoded frame's mode info pointers until next frame finishes decoding. The mode info index will serve this purpose. The decoder will use different buffer in the mode info arrays and use the other buffer to save previous decoded frame’s mode info. Change-Id: If11d57d8eb0ee38c8876158e5482177fcb229428
2014-04-01Renaming two members in MACROBLOCKD struct.Dmitry Kovalev
Renames: mi_8x8 -> mi mode_info_stride -> mi_stride Change-Id: I66f3e5fd1e7b7f46f108af5bb711c5fd9493c1be
2014-03-25Moving above_context to VP9_COMMON.Dmitry Kovalev
Change-Id: I713af99d1e17e05a20eab20df51d74ebfd1a68d2
2014-03-24Initialization code cleanup.Dmitry Kovalev
Change-Id: I47a8b4bf9a6cc0063d1a6785eaaad641d0659e24
2014-03-21Renaming and making vp9_update_mode_info_border() static.Dmitry Kovalev
Change-Id: Ibb72a29cae9ca9443aae56fc4c5458d190eae279
2014-03-20Reusing {above, left}_seg_context vars in both encoder and decoder.Dmitry Kovalev
Change-Id: Id1fa36c92cb007b73a450cc8552e810cedad38b9
2014-03-19Adding alloc_mi() function.Dmitry Kovalev
Change-Id: I3b944884c048f589c86e0169aeb3c3855bc8b729
2014-03-13Adding vp9_swap_mi_and_prev_mi() function.Dmitry Kovalev
Change-Id: I18b3939f0b51085cdd25c9182c3a9c7536ca7e3e
2014-03-10Adding type casts to remove C++ compiler errors.Dmitry Kovalev
Change-Id: I224e49955ad6c833d204feb8efc4056e37d206be
2014-03-01Remove vp9_create_common()Yaowu Xu
The function has evolved over time, now only calls vp9_rtcd(), so this commit removes the function and changes to call vp9_rtcd() directly. Change-Id: I8cfa6190daa4b28f6f3d1e11bb3a07f9c95322bf
2014-02-26Removing vp9_systemdependent.c.Dmitry Kovalev
Change-Id: I7b9738a7113c0c4687e5d320581ff69d98a8b271
2014-02-10Add get release decoder frame buffer functions.Frank Galligan
This CL changes libvpx to call a function when a frame buffer is needed for decode. Libvpx will call a release callback when no other frames reference the frame buffer. This CL adds a default implementation of the frame buffer callbacks. Currently only VP9 is supported. A future CL will add support for applications to supply their own frame buffer callbacks. Change-Id: I1405a320118f1cdd95f80c670d52b085a62cb10d
2014-01-29Combining fb_idx_ref_cnt[] and yv12_fb[] arrays.Dmitry Kovalev
Adding new RefCntBuffer struct which contains reference counter and image buffer. Change-Id: I71c1f532faa13442c32c43fc03ec45b6f88fb844