Граф коммитов

1540 Коммитов

Автор SHA1 Сообщение Дата
James Zern 519b9141ad Merge "vp9: fix segfault w/corrupt data post frame-parallel merge" 2015-02-06 00:28:10 -08:00
hkuang 1c396f3f8e Merge "Fix a thread lost bug in frame parallel decode." 2015-02-05 14:07:35 -08:00
James Zern 0261fb4c4f vp9: fix segfault w/corrupt data post frame-parallel merge
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-02-05 12:11:40 -08:00
hkuang 41e376e494 Mute the harmless tsan error in frame parallel decode.
Change-Id: I52565fd90461221f89134997a0782cb1b681df01
2015-02-04 12:39:35 -08:00
hkuang b104b84058 Fix a thread lost bug in frame parallel decode.
After syncing the frame worker thread, avaiable thread count should
increase by 1 even the worker thread does not have displayable frame
to output.

Change-Id: I9eeb87720fed82dfe38555286833ff88e8a8e746
2015-02-04 11:07:02 -08:00
Yunqing Wang b3b7645a2f vp9_dthread: remove frame_parallel_decoding_mode requirement
This patch continues the work to remove frame_parallel_decoding_mode
requirement in VP9 multi-threaded tile decoder. In order to do that,
the frame counts associated to each thread need to be accumulated
together after the frame is decoded.

Change-Id: Idba1a756cedfed3c154aef52ed82c8da3bbf9e0c
2015-02-04 09:16:41 -08:00
Yunqing Wang 85a9bc04d4 vp9_dthread: pass frame counts to decoder functions
The current multi-threaded tile decoder requires that the videoes
are encoded with frame_parallel_decoding_mode = 1. This requirement
is not necessary, and is better to be removed. This patch includes
the first part of the work.

Change-Id: Ic7695fb3cfe13f9022582c9f0edd2aa6e2e36d28
2015-02-03 09:39:15 -08:00
hkuang 94a459522e Fix a bug from merging frame parallel branch into master.
The merge did not merge the fix for issue #850.

Change-Id: I0dc1377dbfcb9497fb01a13d4f78ac65bff5eb33
2015-02-02 16:01:17 -08:00
hkuang be6aeadaf4 Try again to merge branch 'frame-parallel' into master branch.
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 a18da9760a.

Change-Id: I361442ffec1586d036ea2e0ee97ce4f077585f02
2015-01-30 21:00:13 -08:00
Johann a18da9760a Revert "Merge branch 'frame-parallel' to enable frame parallel decode in master branch."
This reverts commit bde04ce503

Change-Id: I053dae04c761b04a36dc239558503905a14d2470
2015-01-23 08:42:02 -08:00
hkuang bde04ce503 Merge branch 'frame-parallel' to enable frame parallel decode in master branch.
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-22 18:18:53 -08:00
Yunqing Wang e76eaf05b1 vp9_ethread: add parallel loopfilter
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-16 17:19:27 -08:00
Yaowu Xu e94b415c34 Add encoder control for setting color space
This commit adds encoder side control for vp9 to set color space info
in the output compressed bitstream.

It also amends the "vp9_encoder_params_get_to_decoder" test to verify
the correct color space information is passed from the encoder end to
decoder end.

Change-Id: Ibf5fba2edcb2a8dc37557f6fae5c7816efa52650
2015-01-14 10:17:14 -08:00
Yaowu Xu 6b223fcb58 Enable decoder to pass through color space info
This commit added a field to vpx_image_t for indicating color space,
the field is also added to YUV_BUFFER_CONFIG. This allows the color
space information pass through the decoder from input stream to the
output buffer.

The commit also updated compare_img() function with added verification
of matching color space to ensure the color space information to be
correctly passed from encode to decoder in compressed vp9 streams.

Change-Id: I412776ec83defd8a09d76759aeb057b8fa690371
2015-01-13 15:13:19 -08:00
Yaowu Xu ecbca31a1d Fix comments and color format
Replaced "color space" with "color format" in comments where color
sampling format is concerned, so to differentiate from the concept
defined in COLOR_SPACE.

Change-Id: I8c935034c166b24307a99352dab1686531276bb8
2015-01-09 10:36:43 -08:00
James Zern 4d6838627d Merge "vp9: add per-tile longjmp error handling" 2015-01-08 15:53:37 -08:00
James Zern 44b55dada8 Merge "vp9: fix -Wclobbered (longjmp + local variables)" 2015-01-08 15:53:02 -08:00
hkuang 9130e7ad2e Merge "Remove unnecessary init_macroblockd." 2015-01-08 09:15:32 -08:00
Yaowu Xu 7ba6a676f5 Merge "Use -1 consistently as invalid buffer idx" 2015-01-06 17:31:13 -08:00
Yaowu Xu 61c5e94e22 Use -1 consistently as invalid buffer idx
Instead of mixed use of both -1 and INT_MAX.

This also fixes a vp9 fuzzing test failure.

Change-Id: I950ea94b44ec7cdb5232773bee30b104e342f52a
2015-01-06 15:59:03 -08:00
Deb Mukherjee 0ce2a27e9b Enable coefficient range checking for 10-/12-bit
Also fixes a broken build with --enable-coefficient-range-checking
configuration option.

Change-Id: Icc536f53088e8cec59dfb8f635668555fdb9125e
2015-01-06 02:40:51 -08:00
hkuang aa5563cd41 Remove unnecessary init_macroblockd.
macroblockd are init again inside decode_tiles and decode_tiles_mt.

Change-Id: I1f42837864f095c319cdb24cec7d6aa6a3a4da50
2014-12-30 15:23:52 -08:00
James Zern 59d63e610a vp9: fix -Wclobbered (longjmp + local variables)
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-23 11:44:11 -05:00
Jim Bankoski dd4275e498 resolve visual studio warnings around initializers
Change-Id: Id2ad4fb24242f7ca8fa7a152f0889fded4113613
2014-12-19 12:38:25 -08:00
James Zern 953dd1894d vp9: add per-tile longjmp error handling
this avoids longjmp'ing from another thread on error which will cause
undesired behavior

Change-Id: Ic9074ed8cc4243944bf2539d6e482f213f4e8c86
2014-12-19 11:50:04 -08:00
James Zern b32ba09d35 Merge "make vp9 encoder static initializers thread safe" 2014-12-18 18:48:30 -08:00
Jim Bankoski cd60930814 make vp9 encoder static initializers thread safe
Change-Id: If2d0888d13ebe52bc7c3b16f16319408a86ab6de
2014-12-18 15:50:46 -08:00
Frank Galligan 5fdd0f1fe0 Merge "Revert "Revert "Add support for setting byte alignment.""" 2014-12-16 15:14:17 -08:00
Yaowu Xu b60ae45f36 Merge "Prevent decoder from using uninitialized entropy context." 2014-12-16 09:30:24 -08:00
Frank Galligan c4f7079ad4 Revert "Revert "Add support for setting byte alignment.""
This reverts commit 91471d6aad.

Fixes the compile issues if post_proc is enabled.

Change-Id: Ib40a15ce2c194f9b5adfa65a17ab01ddf60f5a59
2014-12-15 12:20:37 -08:00
Paul Wilkins 91471d6aad Revert "Add support for setting byte alignment."
Fails to compile. Bad calls to vp9_alloc_frame_buffer
and vp9_realloc_frame_buffer in postproc.c

This reverts commit 399823b6f5.

Change-Id: I29f0e173f8e185d3a303cfdb17813e1eccb51e3a
2014-12-15 11:54:13 +00:00
James Zern 089086bc25 Merge "Optimize bit_read_buffer." 2014-12-12 16:29:42 -08:00
hkuang 3cecce916b Optimize bit_read_buffer.
Change-Id: Iee43c34909deec9787b29c1c33672213b9f049df
2014-12-12 14:38:12 -08:00
Frank Galligan 399823b6f5 Add support for setting byte alignment.
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-12 13:34:36 -08:00
hkuang 3c7a06c3cc Remove unnecessary dqcoeff memset.
dqcoeff is set to be 0 on initialization. And set back to 0 after being
used everytime.

Change-Id: I32b8e149bba40a8d707849f737a8e49a691f319c
2014-12-11 12:27:25 -08:00
Alexander Voronov 6c6a97814f Prevent decoder from using uninitialized entropy context.
If decoding starts with intra-only frame, there is a possibility
of using uninitialized entropy context, what leads to undefined
behavior.

Change-Id: Icbb64b5b1bd1e5de2a4bfa2884e56bc0a20840af
2014-12-11 20:44:19 +03:00
hkuang 3dfdfd5c86 Merge "Clean up the logic of handling corrupted frame." 2014-12-09 10:23:18 -08:00
hkuang d05cf10fe7 Add error handling for frame parallel decode and unit test for that.
Change-Id: I6e309e11f1641618d2424b7a2c0fe744b8974dec
2014-12-08 12:30:19 -08:00
James Zern b43c27ab6e Merge "vp9_reader: reorder struct members" 2014-12-04 16:08:08 -08:00
hkuang dde819599b Clean up the logic of handling corrupted frame.
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-04 15:07:59 -08:00
James Zern 6f7ab01451 vp9: sync threads after a longjmp
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-12-02 16:51:27 -08:00
James Zern e1f55e0441 vp9_reader: reorder struct members
improves locality of reference

Change-Id: Ia4d55bb8c98e479528d88303fa35e8c74fbf939d
2014-11-24 22:10:39 -08:00
hkuang a9a20a1040 Fix a bug in frame parallel decode and add a unit test for that.
A flush bug is discovered during putting frame parallel decoder
into Android. This test will expose that bug.

Change-Id: Ia047f27972f4da0471649f79f1f91e7695297473
2014-11-14 10:16:34 -08:00
Yunqing Wang 1228433430 Modify the frame context memory deallocation
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-06 11:34:19 -08:00
hkuang e8860693ea Merge "Totally remove prev_mi in VP9 decoder." 2014-11-05 17:48:47 -08:00
hkuang 4cc7c5a17f Totally remove prev_mi in VP9 decoder.
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-05 16:14:30 -08:00
Hui Su 2c95a3f374 Merge "Simplify interface of write_selected_tx_size and read_tx_size" 2014-11-05 13:33:09 -08:00
Hui Su 709c634b84 Simplify interface of write_selected_tx_size and read_tx_size
Change-Id: Ia2b2a895deefaaf7b34bf26df86add56dbab082c
2014-11-04 16:11:50 -08:00
hkuang 55577431ae Bind motion vectors with frame buffer structure.
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-31 17:01:08 -07:00
James Zern 01900edc40 Merge changes I8a9c9019,Ic7b2faa3,I44d42a50,I3f3a3924,I10747b32,I31b49c9e
* 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-24 11:43:51 -07:00
James Zern 01483677e5 add vp9_loop_filter_data_reset
Change-Id: I8a9c9019242ec10fa499a78db322221bf96a0275
2014-10-23 19:43:48 +02:00
Yunqing Wang 330a6b2756 Merge "vp9_ethread: allocate frame contexts outside VP9_COMMON struct" 2014-10-22 17:10:39 -07:00
Yunqing Wang 7c7e4d4eb8 vp9_ethread: allocate frame contexts outside VP9_COMMON struct
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-22 15:03:12 -07:00
Hangyu Kuang 9ce3a7d76c Implement frame parallel decode for VP9.
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-22 10:50:58 -07:00
hkuang e3bf55dedb Correct the logic of ready_for_new_data.
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-17 10:09:56 -07:00
James Zern e9b8810b4d move LFWorkerData allocation to VP9LfSync
this removes an assumption that worker->data1 would be pointing to a
TileWorkerData allocation.
additionally, within the multi-threaded loopfilter pass VP9LfSync as a
parameter to the worker hook, removing the need for a shadow pointer in
LFWorkerData.

Change-Id: Ic7b2faa34e3eb59dbcb8a7c67f333448fa047c88
2014-10-16 18:55:46 +02:00
James Zern 175c870efa vp9_loop_filter_frame_mt: remove pbi dependency
Change-Id: I44d42a5098305a2d050ce8ff3c76baf7798c48af
2014-10-16 18:55:44 +02:00
James Zern 69f11d2b9d vp9_loop_filter_frame_mt: pass planes directly
one less dependency on pbi

Change-Id: I3f3a392416d3523f4aea6682c3965885baf85197
2014-10-16 18:54:10 +02:00
James Zern eb3fdfba09 vp9_loop_filter_frame_mt: pass VP9LfSync directly
a step towards removing the pbi dependency

Change-Id: I10747b325e81c172f5e67031ea5159159fc26e91
2014-10-16 17:27:57 +02:00
James Zern ff3ae42d8c vp9: store TileWorkerData allocations separately
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-16 17:27:57 +02:00
hkuang cf608110fc Merge "Correct the format." 2014-10-14 13:45:11 -07:00
hkuang c1b0d0da0b Correct the format.
Change-Id: I59a53b419adda3a609d50b2a82f5a4a54849752e
2014-10-14 11:35:26 -07:00
hkuang 8fff2db51e Merge "Remove unnecessary local variable." 2014-10-14 11:05:51 -07:00
hkuang c38a8edf16 Merge "Remove extra line." 2014-10-14 11:05:01 -07:00
hkuang c7f9c717de Remove unnecessary local variable.
Change-Id: I7b19b6061cec369825a0a0b7a485ca490dbc12ee
2014-10-13 14:05:42 -07:00
hkuang dbe91de6d4 Remove extra line.
Change-Id: I5e79c276d8953ae17cd35b2846e6e40660c037c3
2014-10-10 14:59:04 -07:00
hkuang 3304d4e6ca Optimize the code to set the refernce frame right after reading the header.
Change-Id: I495cf4a366e06e3220ed132500b1ba1c8448f708
2014-10-09 16:32:36 -07:00
hkuang ca27459c1a Merge "Remove unnecessary code." 2014-10-09 15:44:08 -07:00
hkuang 336e255236 Merge "Remove unnecessary scale check in set_ref." 2014-10-09 15:43:31 -07:00
hkuang 0e06c8ff36 Remove unnecessary code.
Function will jump to error handler when ref buffer is corrupted.
So "xd->corrupted |= ref_buffer->buf->corrupted;" is useless.

Change-Id: I35353a0637ad0dbb682454e040ef69fa68280bfa
2014-10-09 15:12:12 -07:00
Deb Mukherjee 1929c9b391 Rename highbitdepth functions to use highbd prefix
Uses highbd_ prefix convention consistently.

Change-Id: I58f7f799a7ff8e32701bcd71c955bcf1cdd4581e
2014-10-09 14:40:40 -07:00
hkuang 15a3e5f742 Remove unnecessary scale check in set_ref.
Scale check has been done in read_inter_block_mode_info.

Change-Id: I6c86f93bd579109ed30ff13a04a30e35f5ae6fc5
2014-10-09 12:19:55 -07:00
Jingning Han 27c9577f8e Merge "Take out repeated block width/height lookup functions" 2014-10-07 15:33:45 -07:00
Yaowu Xu 29062db37f Merge "Add range checking for decoded coefficients." 2014-10-07 12:36:56 -07:00
Jingning Han b66f7016c1 Take out repeated block width/height lookup functions
The functions b_width_log2 and b_height_log2 only do direct
table fetch. This commit unifies such use cases by using the
table directly and removes these functions.

Change-Id: I3103fc6ba959c1182886a2799d21b8b77c8a7b6b
2014-10-07 12:33:07 -07:00
Yaowu Xu 9751aa1264 Add range checking for decoded coefficients.
The coefficient range checking is enabled when configured with
--enable-debug --enable-coefficient-range-checking
for vpxdec to detect ill-formed input stream. This addresses the
problem raised by issue #792.

Change-Id: I3f9ea541de4dc742dd64389d6c5f543fb1c4f052
2014-10-07 11:30:13 -07:00
Deb Mukherjee fced63ed30 Resolves some static analysis / undefined warnings
Also fixes a case of distortion becoming negative and messing
up the RDCOST computation.

Change-Id: Id345af9e8dfff31ade622be5756e51f2cdface53
2014-10-07 11:20:56 -07:00
Yaowu Xu f809475c73 Merge "Make iscan and scan neighbor arrays static const." 2014-10-02 15:15:58 -07:00
Yaowu Xu 9712bc691d Make iscan and scan neighbor arrays static const.
This commit changes the tables to be read only, which fixes
issue #866

Change-Id: I85bbe03f9d344f50570f8c1c61699bdc5cee248f
2014-10-02 14:08:14 -07:00
Alex Converse a0befb93e7 Fix subsampling check for images 1 pixel wide/tall
Change-Id: I0e262ede7eb4a4ae0c86181922d744e542e93350
2014-10-02 11:02:57 -07:00
Deb Mukherjee 9ed23de13f Miscellaneous decoder changes for high bitdepth
Also includes yv12 config changes.

Change-Id: Iacf40d8bf486815b54c32a127ce3cd4516b7e44f
2014-09-29 11:27:45 -07:00
Deb Mukherjee 993d10a217 Adds various high bit-depth encode functions
Change-Id: I6f67b171022bbc8199c6d674190b57f6bab1b62f
2014-09-25 01:50:36 -07:00
hkuang c70cea97ac Remove mi_grid_* structures.
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-19 21:27:11 -07:00
Deb Mukherjee 822b51609b High bit-depth coefficient coding functions
Tokenization and Detokenization enhancements for 10/12 bit

Change-Id: I3c269ec30f8eb160ee024905638a193975237559
2014-09-19 15:21:24 -07:00
Deb Mukherjee 0d3c3d3ce7 Adds high bitdepth convolve, interpred & scaling
Change-Id: Ie51c352a6b250547207cbc1ebba833a01ed053e3
2014-09-18 07:26:17 -07:00
Dmitry Kovalev 4f506358c4 Merge "Speeding up decode_coeffs()." 2014-09-16 15:13:14 -07:00
Deb Mukherjee 5cd0aab81a Adds high bitdepth quantization functions
Adds various high bitdepth quantization functions.

Change-Id: I36fc0bf75a1bd15128ed271df8723de0ac134b0c
2014-09-16 14:55:37 -07:00
Dmitry Kovalev adaec4d0fb Speeding up decode_coeffs().
1080p decoding speedup -- 1.25%, 4K decoding speedup -- 2.5%.

Change-Id: I5f02f521cbf7758d4d1886a93bc5b074abdff03d
2014-09-16 12:04:09 -07:00
Deb Mukherjee 10783d4f3a Adds high bitdepth transform functions and tests
Adds various high bitdepth transform functions and tests.
Much of the changes are related to using typedefs tran_low_t
and tran_high_t for the final transform cofficients and intermediate
stages of the transform computation respectively rather than fixed
types int16_t/int. When vp9_highbitdepth configure flag is off,
these map tp int16_t/int32_t, but when the flag is on, they map
to int32_t/int64_t to make space for needed extra precision.

Change-Id: I3c56de79e15b904d6f655b62ffae170729befdd8
2014-09-11 19:56:33 -07:00
James Zern 7ee073e61d vp9: wait for key/intra-only frame after corruption
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-09 19:36:11 -07:00
James Zern 2215d2f135 Merge changes If8887e1d,I36bfc9c8,I3d1e6c42
* changes:
  vp9_dthread: simplify loop_filter_row_worker signature
  simplify vp9_loop_filter_worker signature
  vp9_decodeframe: simplify tile_work_hook signature
2014-09-09 16:50:28 -07:00
James Zern 6d65cb1552 Merge changes I660c1b7f,Id3cdf6b6
* changes:
  vp9_loop_filter_frame_mt: defer allocations
  vp9_loop_filter_alloc: reorder parameters
2014-09-09 16:48:43 -07:00
James Zern a46ca6ec00 vp9_loop_filter_frame_mt: defer allocations
the code currently checks whether the allocation has been done instead
of allocating on the first frame.
since:
4f27202 vp9: fix crash in mt loopfilter w/corrupt file

this change defers the allocation until the loop filter is used.

Change-Id: I660c1b7f34e713a8dd9884483f01d23b9847366e
2014-09-08 20:13:39 -07:00
James Zern 958a15f006 vp9_loop_filter_alloc: reorder parameters
VP9LfSync lf_sync is being operated on, make it the first parameter as
in dealloc

Change-Id: Id3cdf6b6a48157627780ae0d5d4b7dfa94a78078
2014-09-08 20:13:39 -07:00
James Zern a5da7dea39 vp9_dthread: simplify loop_filter_row_worker signature
use the type names directly in the function declaration rather than
(void *arg1, void *arg2)

Change-Id: If8887e1dbcdf84842783a92f91668bef6223c9e5
2014-09-08 19:53:46 -07:00
James Zern f853117b87 vp9_decodeframe: simplify tile_work_hook signature
use the type names directly in the function declaration rather than
(void *arg1, void *arg2)

Change-Id: I3d1e6c42d384d8e628d7f2075fa561c2c5e20749
2014-09-08 19:53:46 -07:00
Alex Converse b932c6c5dd BITSTREAM CLARIFICATION: Forbid referencing across color spaces.
Check image format of reference frames.

Change-Id: I7d8d7f097ba547839ff9cec3880bd15a4948ee06
2014-09-08 11:12:09 -07:00
Dmitry Kovalev 54bec0971f Merge "Initializing intra modes without vpx_once()." 2014-09-05 12:03:36 -07:00
James Zern 46faaeeffb Merge changes I7b9f40dc,I76e74f2e
* changes:
  vp9: correct context buffer resize check
  vp9: fail decode if block/frame refs are corrupt
2014-09-05 12:01:59 -07:00
James Zern 2886b91790 Merge "vp9: skip loopfilter when the frame is corrupt" 2014-09-05 11:58:09 -07:00
James Zern bb4950dfdf vp9: correct context buffer resize check
allocations within vp9_alloc_context_buffers() rely on mi_rows/mi_cols
individually, use those to determine whether to realloc rather than
stride and stride * rows. this fixes a crash with some fuzzed files for
invalid accesses into last_frame_seg_map and above_context.

Change-Id: I7b9f40dcf170d443890f3bd2acd285507943c7d4
2014-09-04 19:14:21 -07:00
James Zern 440f5097c7 vp9: fail decode if block/frame refs are corrupt
proceeding using a corrupt (incompletely decoded) frame reference may
lead to incorrect assumptions about allocation sizes leading to a crash.

Change-Id: I76e74f2e1be127c2e2c7e1174bb3307497dfd23d
2014-09-04 19:14:00 -07:00
Dmitry Kovalev bf778e7d8e Initializing intra modes without vpx_once().
Change-Id: I0a9d52432f2500f1bd8f43f229e70e38bb9a0343
2014-09-03 11:39:02 -07:00
Deb Mukherjee 5acfafb18e Adds config opt for highbitdepth + misc. vpx
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-09-02 14:37:10 -07:00
James Zern 0e361fb895 Merge "vp9: sync workers at the start of decode_tiles_mt()" 2014-08-29 14:07:37 -07:00
James Zern fec40f9269 vp9: fix m/t loop filter invalid free
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-29 11:04:45 -07:00
James Zern dbdff12b81 vp9: sync workers at the start of decode_tiles_mt()
prevents any problems resuming decode after decoding a corrupt frame

Change-Id: Ib7eb1b5c062aebe71074fef1ece32a32822c16be
2014-08-28 17:50:38 -07:00
James Zern db8b1b7bf1 vp9: skip loopfilter when the frame is corrupt
this change is proactive: the loop filter expects valid input and may
produce undefined results / crash in other cases.

Change-Id: I6cc1e966062a91cbc6db981c87cd03d9129fc8fe
2014-08-27 17:04:48 -07:00
James Zern cde790c36d vp9: fix crash in inline loopfilter w/corrupt file
attempting to decode a frame after the previous frame failed has the
potential of interrupting an earlier loop filter task

Change-Id: I6f2b1ddcdf5b89c3e2ee8caf5289dada2a087d66
2014-08-27 16:55:31 -07:00
James Zern 4f27202df7 vp9: fix crash in mt loopfilter w/corrupt file
if the first frame was corrupt and loop filter not called, the next call
would assume the necessary allocations had been done and segfault when
accessing a NULL pointer

Change-Id: Ib6ef505e5c594e6f0fe65ab0700172bcf06b92a6
2014-08-27 14:21:14 -07:00
Adrian Grange 7b2177ce9c Fix bug 837 (Part 2): Handle increase in frame width
The case where frame width increases but the overall memory
size required to hold the mi arrays does not was not
handled.

Change-Id: I72e70b912a7d1766687ad682979f1c9ee124449b
2014-08-21 08:15:23 -07:00
Minghai Shang 229f2aa5b8 Merge "[spatial svc]Add a few different encode frame tests." 2014-08-19 17:45:01 -07:00
Minghai Shang e1b5d24837 [spatial svc]Add a few different encode frame tests.
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-18 11:18:21 -07:00
James Zern 1043474665 Merge "vp9_copy_reference_dec: check ref frame index before use" 2014-08-14 18:53:39 -07:00
James Zern a07d09ff34 vp9_copy_reference_dec: check ref frame index before use
use get_ref_frame() to ensure a valid frame is retrieved if one exists

Change-Id: I4b116d928e643ee62a991babd4b974037b6b3830
2014-08-14 14:57:54 -07:00
Adrian Grange 54f8cb78c6 Merge "Fix bug 837: realloc mode info buffers on resize" 2014-08-14 14:53:33 -07:00
Adrian Grange 4e30565a9f Fix bug 837: realloc mode info buffers on resize
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-08-14 08:59:15 -07:00
James Zern a6b7bd6a1c Merge "fixes several -Wunused-function warnings" 2014-08-12 20:15:14 -07:00
Jim Bankoski f452961765 fixes several -Wunused-function warnings
Change-Id: I4dc2cb255f4fe30998b6ee61184895dee9f5da8e
2014-08-12 16:51:07 -07:00
Adrian Grange 1ebf52df2c Common encode/decode function to get reference frame
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-08-08 11:37:11 -07:00
Adrian Grange 75b42a4977 Remove coding_use_prev_mi member from VP9_COMMON
This was shadowing the use of error_resilient_mode, but with
the opposite sense.

Change-Id: Ie4d30263a304fe4b3e94f0c7741db6888cc6afd8
2014-08-08 09:40:38 -07:00
Deb Mukherjee 09bf1d61ca Changes hdr for profiles > 1 for intraonly frames
Specifies the bit-depth, color sampling and colorspace
for intra only frames for profiles > 0

Also adds checks to ensure that profile 1 and 3 are
exclusively used for non 420 streams.

Change-Id: Icfb15fa1acccbce8f757c78fa8a2f60591360745
2014-08-07 09:47:14 -07:00
hkuang 44395a21da Move vp9_dec_build_inter_predictors_* to decoder folder.
Change-Id: Ibe9fa28440cc79ba9f3504d78c7dca7bb01a23e1
2014-07-28 11:09:11 -07:00
hkuang 7eca086707 Add segmentation map array for current and last frame segmentation.
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-28 10:44:02 -07:00
Jim Bankoski 899585ebe9 Fix reference frame size restrictions.
The issue was introduced by commit g9f37d14 with adding explicit
restrictions on reference-frame scale factors. The restriction
is checked against aligned-by-8 frame dimensions, not against
original ones. So, for example, frame of 35×35 actually can refer
to frame of 70×70, but the new check won't allow this. It will
compare 35 vs 72 (not 70), so 2x downscale limit will be exceeded.

Change-Id: Ic663693034440f64ac8312cbff9e1e773a921060
2014-07-28 08:37:25 -07:00
Yaowu Xu b43b4fe3a2 Merge "Fix allocation of context buffers on frame resize" 2014-07-25 08:49:39 -07:00
Yaowu Xu 9261e1aa6e Changed validation of reference frame size
A previous change, https://gerrit.chromium.org/gerrit/#/c/70632,
introduced a size validation for reference frames to insuare the
input stream is a valid VP9 stream. However, the logic requiring
all reference frames have valid size turned out to be too strict.

In this commit, we modify the validation to require one of the
reference frame has valid dimension. In addition, the decoder
reports error whenever it detects the use of reference frame
with invalid scalig ratio.

Change-Id: If8efc312244087556cfe00f1fcbdff811268ebad
2014-07-24 14:58:01 -07:00
Adrian Grange 423e8a9727 Fix allocation of context buffers on frame resize
The patch:
https://gerrit.chromium.org/gerrit/#/c/70814/
changed the test that determined whether the context
frame buffers needed to be reallocated or not.

The code checked for a change in total frame area
to signal the need to reallocate context buffers.
However, the above_context buffer needs to be
resized i:xf only the width of the frame has increased.

Change-Id: Ib89d75651af252908144cf662578d84f16cf30e6
2014-07-24 14:07:45 -07:00
Alex Converse 5926e7c0e8 Remove unfinished VP9 alpha channel.
Change-Id: Ic5d3a3a0dac10b49495771886a31e793bb78b5ca
2014-07-21 15:55:50 -07:00
Yunqing Wang 765485cab2 Add -DNDEBUG when config option debug is disabled
For gcc, when libvpx config option debug is disabled, added the
flag -DNDEBUG to disable the assertions in libvpx for some speedup.

Change-Id: Ifcb7b9e8ef5cbe5d07a24407b53b9a2923f596ee
2014-07-21 09:20:03 -07:00
Adrian Grange 18a7f69dae Re-introduce frame size check inadvertantly deleted
This patch adds back in code that checks that the frame
size lies within defined bounds was inadvertantly removed
by a previous patch:
https://gerrit.chromium.org/gerrit/#/c/70814/

Change-Id: If526570ba559260c4b7e98098bc75f7700ae7f97
2014-07-18 15:44:10 -07:00
Deb Mukherjee 727f384085 Merge "Separates profile 2 into 2 profiles 2 and 3" 2014-07-18 03:23:51 -07:00
Deb Mukherjee c447a50aea Separates profile 2 into 2 profiles 2 and 3
Separates HBD profile int two profiles (2 and 3) consistent with the
highbitdepth branch. This patch is ported from the original highbitdepth
branch patch: https://gerrit.chromium.org/gerrit/#/c/70460/

Two of the invalid file tests needed to be updated.

Change-Id: I6a4acd2f7a60b1fb4cbcc8e0dad4eab4248431e3
2014-07-17 20:51:59 -07:00
Adrian Grange f68aaa38d6 Modified frame buffer handling
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-17 11:06:35 -07:00
Jim Bankoski 943e43273b allow config options to limit max size of decode
This is a practical concern to allow us to fail in a decoder instance
if the size of a file is bigger than we can reasonably handle.

Change-Id: I0446b5502b1f8a48408107648ff2a8d187dca393
2014-07-17 07:07:48 -07:00
Adrian Grange 7be99c4a26 Merge "Fix show_existing_frame not decreasing frame buffer ref counter." 2014-07-15 12:01:16 -07:00
Alexander Voronov 0aa2af55b5 Fix show_existing_frame not decreasing frame buffer ref counter.
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-15 11:06:15 -07:00
Deb Mukherjee 1f6aaeddc5 Merge "Some extra bit probability cleanups" 2014-07-14 17:26:54 -07:00
hkuang 3cffa0c74e Move vp9_thread.* to common.
Prepare for frame parallel decoding, the reference count buffers
need to be protected by mutex. Move vp9_thread.* to common
folder so that those buffers could use cross-platform mutex
from vp9_thread.*.

(cherry picked from commit 337e8015c9)

Change-Id: I0587a08447925f4554d7788686a31483c2ae3f37
2014-07-11 15:24:31 -07:00
hkuang c147cf3d3b Add unit test to test tile decoding error handling.
Also fix bugs related with corrupted frame handling.
Return VPX_CODEC_CORRUPT_FRAME when getting corrupted
block.

Change-Id: I7207ccc7c68c4df2b40b561315d16e49ccf7ff41
2014-07-11 13:50:05 -07:00
Deb Mukherjee 6957e7a077 Some extra bit probability cleanups
Refactoring to remove some duplication of probability
tables between tokenization and detokenization.

Change-Id: I2fc6a6497f9c0410021a9b41f828bc58a864e466
2014-07-11 11:39:18 -07:00
James Zern 61c3338516 call vp[89]_clear_system_state after longjmp
restore the environment post encode/decode failure

Change-Id: I3c72e2260a616432eaf1f9545d4fb4d8e45cc7b0
2014-07-10 12:36:28 -07:00
James Zern 2d8339eeab Merge "vp9_decoder_remove: destroy common after thread shutdown" 2014-07-09 17:46:42 -07:00
James Zern 2e0588bc46 vp9_decoder_remove: destroy common after thread shutdown
in a failure case the threads may still be running and share a reference
to VP9_COMMON

Change-Id: I867034b4b55f133663b8cbf6ca06e72acf952849
2014-07-09 11:08:06 -07:00
hkuang b84ee5a3d0 Merge "Move vp9_thread.* to common." 2014-07-09 10:16:13 -07:00
Adrian Grange 7c43fb67ae Fix decoder handling of intra-only frames
This patch fixes bug 633:
https://code.google.com/p/webm/issues/detail?id=633

The first decoded frame does not have to be a keyframe,
it could be an inter-frame that is coded intra-only.

This patch fixes the handling of intra-only frames.

A test vector has also been added that encodes 3
intra-only frames at the start of the clip. The
test vector was generated using the code in the
following patch:
https://gerrit.chromium.org/gerrit/#/c/70680/

Change-Id: Ib40b1dbf91aae2bc047e23c626eaef09d1860147
2014-07-08 16:24:03 -07:00
hkuang 337e8015c9 Move vp9_thread.* to common.
Prepare for frame parallel decoding, the reference count buffers
need to be protected by mutex. Move vp9_thread.* to common
folder so that those buffers could use cross-platform mutex
from vp9_thread.*.

Change-Id: I541277cf15eefed6641555944f67f4a0bcdc8154
2014-07-07 14:52:19 -07:00
hkuang 28a794f680 Seperate the frame buffers from VP9 encoder/decoder structure.
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-07-02 15:34:20 -07:00
hkuang bf58d1725c Revert "Revert "Revert "Revert 3 patches from Hangyu to get Chrome to build:"""
This reverts commit 749e0c7b28.

Change-Id: I0c63a152baf94d38496dd925a40040366153bf4f
2014-07-02 14:57:39 -07:00
James Zern 8aafd34050 Merge changes I875ac5a7,I2b13369d,I9ceb47a9
* changes:
  update vp9_thread.[hc]
  vp9_thread_test: remove unnecessary c_str()'s
  vp9_thread_test: factorize decode loop
2014-07-01 20:46:53 -07:00
Jim Bankoski abf0df08f1 validate uv block size when reading partition
Change-Id: I74fc5f1a7bab3128cdd49441b83ec3a25aee65ca
2014-07-01 10:26:26 -07:00
James Zern e656f44c24 update vp9_thread.[hc]
pull the latest from WebP, which adds a worker interface abstraction
allowing an application to override init/reset/sync/launch/execute/end

this has the side effect of removing a harmless, but annoying, TSan
warning.

Original source:
 http://git.chromium.org/webm/libwebp.git
  100644 blob 08ad4e1fecba302bf1247645e84a7d2779956bc3 src/utils/thread.c
  100644 blob 7bd451b124ae3b81596abfbcc823e3cb129d3a38 src/utils/thread.h

Local modifications:
 - s/WebP/VP9/g
 - camelcase functions -> lower with _'s
 - associate '*' with the variable, not the type

Change-Id: I875ac5a74ed873cbcb19a3a100b5e0ca6fcd9aed
2014-07-01 00:39:10 -07:00
hkuang 1480ba6f0a Revert "Fix a bug in VP9Worker which leads to unit test hang."
The caller should reset the state instead of letting worker
to reset.

This reverts commit 34b2ce15f9.

Change-Id: Idb546ea6386cffc44e98dee772900d21ab79710f
2014-06-30 17:02:26 -07:00
hkuang 34b2ce15f9 Fix a bug in VP9Worker which leads to unit test hang.
This fixes the hang in VP9/InvalidFileTest.ReturnCode/3
due to worker->had_error has not been reset after getting
error.

Change-Id: Ia3608225094758a2bd88f6ae4dd9dfd93bbaad27
2014-06-30 10:45:50 -07:00
Jim Bankoski 7a8829f61a initialize bit buffer structure to avoid warning error
Change-Id: I38bb2801ad3f059d5e2eb6513eec92397c67abcd
2014-06-30 08:05:15 -07:00
Jim Bankoski 9aa4fad73c silence unused parm warning for worker thread in loop filter
Change-Id: Id51468f99f8970b8795ce2d254344f4b8d7817d0
2014-06-29 09:30:59 -07:00
James Zern 749e0c7b28 Revert "Revert "Revert 3 patches from Hangyu to get Chrome to build:""
This reverts commit b336356198.

This causes a hang in:
VP9/InvalidFileTest.ReturnCode/3

the change to test/user_priv_test.cc remains with a minor update

Change-Id: I4a8a272ca37ea329b0f413f0b1cd827a238bd9fd
2014-06-27 19:46:27 -07:00
Jim Bankoski 52b63c238e Merge "Better validation of invalid files" 2014-06-27 11:05:21 -07:00
Jim Bankoski 9f37d149c1 Better validation of invalid files
This patch checks that a decoder never tries to reference frame that's
outside the range of 2x to 1/16th the size of this frame.  Any attempt
to do so causes a failure.

Change-Id: I5c98fa7bb95ac4f29146f29dd92b62fe96164e4c
2014-06-27 10:03:15 -07:00
hkuang 36eeb1799d Merge "Revert "Revert 3 patches from Hangyu to get Chrome to build:"" 2014-06-25 11:42:08 -07:00
hkuang b336356198 Revert "Revert 3 patches from Hangyu to get Chrome to build:"
This patch reverts the previous revert from Jim and also add a
variable user_priv in the FrameWorker to save the user_priv
passed from the application. In the decoder_get_frame function,
the user_priv will be binded with the img. This change is needed
or it will fail the unit test added here:
https://gerrit.chromium.org/gerrit/#/c/70610/

This reverts commit 9be46e4565.

Change-Id: I376d9a12ee196faffdf3c792b59e6137c56132c1
2014-06-25 11:21:37 -07:00
James Zern b2b07755e0 vp9: check tile column count
the max is 6. there are assumptions throughout the decode regarding
this; fixes a crash with a fuzzed bitstream

$ zzuf -s 5861 -r 0.01:0.05 -b 6- \
  < vp90-2-00-quantizer-00.webm.ivf \
  | dd of=invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.ivf \
    bs=1 count=81883

Change-Id: I6af41bb34252e88bc156a4c27c80d505d45f5642
2014-06-24 19:26:11 -07:00
Jingning Han 961bafc366 Merge "Remove unused vp9_init_quant_tables function" 2014-06-23 09:37:30 -07:00
Jim Bankoski 9be46e4565 Revert 3 patches from Hangyu to get Chrome to build:
Avoids failures:
MSE_ClearKey/EncryptedMediaTest.Playback_VP9Video_WebM/0
MSE_ClearKey_Prefixed/EncryptedMediaTest.Playback_VP9Video_WebM/0
MSE_ExternalClearKey_Prefixed/EncryptedMediaTest.Playback_VP9Video_WebM/0
MSE_ExternalClearKey/EncryptedMediaTest.Playback_VP9Video_WebM/0
MSE_ExternalClearKeyDecryptOnly/EncryptedMediaTest.Playback_VP9Video_WebM/0
MSE_ExternalClearKeyDecryptOnly_Prefixed/EncryptedMediaTest.Playback_VP9Video_WebM/0
SRC_ExternalClearKey/EncryptedMediaTest.Playback_VP9Video_WebM/0
SRC_ExternalClearKey_Prefixed/EncryptedMediaTest.Playback_VP9Video_WebM/0
SRC_ClearKey_Prefixed/EncryptedMediaTest.Playback_VP9Video_WebM/0

Patches are
This reverts commit 9bc040859b
This reverts commit 6f5aba069a
This reverts commit 9bc040859b

I1f250441	Revert "Refactor the vp9_get_frame code for frame parallel."
Ibfdddce5	Revert "Delay decreasing reference count in frame-parallel decoding."
I00ce6771	Revert "Introduce FrameWorker for decoding."

Need better testing in libvpx for these commits

Change-Id: Ifa1f279b0cabf4b47c051ec26018f9301c1e130e
2014-06-21 11:36:51 -07:00
Jim Bankoski 3431f575ed Merge "Fix bug in error handling that causes segfault" 2014-06-20 16:46:31 -07:00
hkuang 9bc040859b Introduce FrameWorker for decoding.
When decoding in serial mode, there will be only
one FrameWorker doing decoding. When decoding in
parallel mode, there will be several FrameWorkers
doing decoding in parallel.

Change-Id: If53fc5c49c7a0bf5e773f1ce7008b8a62fdae257
2014-06-20 14:46:45 -07:00
Jim Bankoski 88ba08818e Fix bug in error handling that causes segfault
See: https://code.google.com/p/chromium/issues/detail?id=362697

The code properly catches an invalid stream but seg faults instead of
returning an error due to a buffer not having been initialized. This
code fixes that.

Change-Id: I695595e742cb08807e1dfb2f00bc097b3eae3a9b
2014-06-20 14:44:50 -07:00
Jingning Han 3b9c19aaa7 Remove unused vp9_init_quant_tables function
This function is not effectively used, hence removed.

Change-Id: I2e8e48fa07c7518931690f3b04bae920cb360e49
2014-06-18 11:51:41 -07:00
Adrian Grange dbd1184a5a Improve vp9_rb_bytes_read
Change-Id: I69eba120eb3d8ec43b5552451c8a9bd009390795
2014-06-18 08:31:45 -07:00
hkuang e4c5f7e2b6 Delay decreasing reference count in frame-parallel decoding.
The current decoding scheme will decrease the reference count
of the output frame when finish decoding. Then the application
could copy the frame from the decoder buffer to application buffer.
In frame-parallel decoding, a decoded frame will not be outputted
until several frames later which depends on thread numbers. So
the decoded frame's reference count should be decreased only
after application finish copying the frame out. But due to the
limitation of vpx_codec_get_frame, decoder could not know when
application finish decoding. So use a index last_show_frame to
release the last output frame's reference count.

Change-Id: I403ee0d01148ac1182e5a2d87cf7dcc302b51e63
2014-06-13 10:53:33 -07:00
hkuang 537cb06036 Initially add frame_parallel_decode flag.
Stub flag temporarily set to 0 until frame parallel
decoding implementations are finished.

Change-Id: I8ab768138e8f8f8eb809875703b2502ea0fe7cea
2014-06-11 17:29:29 -07:00
Dmitry Kovalev f5628853d7 Fixing failed ARM build.
Change-Id: I3f74418f07c2dfdd7725a5b4a8ef5c5f4aca6289
2014-06-02 11:14:12 -07:00
Dmitry Kovalev e14f900ae3 Merge "Moving itxm_add pointer from MACROBLOCKD to MACROBLOCK." 2014-05-29 11:16:39 -07:00
Dmitry Kovalev e7135a9344 Removing decoded_key_frame flag.
Change-Id: I79576920efb7f3f6f197d386727409759d8bda8d
2014-05-21 15:51:40 -07:00
hkuang 0958bbd185 Merge "Fix the memory alignment issue due to patch: https://gerrit.chromium.org/gerrit/#/c/70162/" 2014-05-21 12:12:21 -07:00
Dmitry Kovalev 35a83677a5 Moving itxm_add pointer from MACROBLOCKD to MACROBLOCK.
The final goal is eventually to get rid of both itxm_add and fwd_txm4x4.
This patch does it in the decoder.

Change-Id: Ibb3db57efbcbb1ac387c6742538a9fcf2c6f24a5
2014-05-21 11:09:44 -07:00
Dmitry Kovalev 66ce10c13d Merge "Deadline is not supported in VP9 decoder, removing it completely." 2014-05-21 10:37:39 -07:00
hkuang b9e1e994e1 Fix the memory alignment issue due to patch:
https://gerrit.chromium.org/gerrit/#/c/70162/

Change-Id: I797be6a4b21460de6d791125fc20d2be3a35364f
2014-05-21 10:08:06 -07:00
hkuang 20c1edf612 Refactor decode_tiles and loopfilter code.
The current decode_tiles decodes the frame one tile by one tile
and then loopfilter the whole frame or use another worker thread to
do loopfiltering.

|------|------|------|------|
|Tile1-|Tile2-|Tile3-|Tile4-|
|------|------|------|------|

For example, if a tile video has one row and four cols, decode_tiles
will decode the Tile1, then Tile2, then Tile3, then Tile4.
And during decode each tile, decode_tile will decode row by row in
each tile.

For frame parallel decoding, decode_tiles will decode video in row order
across the tiles. So the order will be:
"Decode 1st row of Tile1" -> "Decode 1st row of Tile2"
-> "Decode 1st row of Tile3" -> "Decode 1st row of Tile4"
-> "Decode 2nd row of Tile1" -> "Decode 2nd row of Tile2"
-> "Decode 2nd row of Tile3" -> "Decode 2nd row of Tile4"-> "loopfilter 1st row"

Change-Id: I2211f9adc6d142fbf411d491031203cb8a6dbf6b
2014-05-20 14:47:45 -07:00
Dmitry Kovalev 5ac6d9778f Merge "Making vp9_initialize_dec() static." 2014-05-19 10:27:07 -07:00
Dmitry Kovalev 79ba41903f Removing MACROBLOCKD dependency from loop filter.
Change-Id: I9ef40f3d95ab8f94f69e92ea25678a40956bc1ce
2014-05-16 09:48:26 -07:00
Yaowu Xu 04c40d3d93 cleanup -wextra warnings:
vp9_decoder.c
  vp9_dthread.c

Change-Id: Iaafe941545db98e9e3559096a955894646084ac2
2014-05-15 15:59:25 -07:00
hkuang 1fe6496b17 Merge "Refactor calling loopfilter code." 2014-05-15 10:51:10 -07:00
hkuang bf8c58be5a Refactor calling loopfilter code.
This change is mainly for a follow CL that will refactor the
decode_tiles.

Change-Id: I52de6f8dbada75a64d9a94ebb5975136ed0960b4
2014-05-15 10:21:18 -07:00
Dmitry Kovalev 39015ea200 Making vp9_initialize_dec() static.
Change-Id: I831fe91dfadf4e89f5bbba6ab7a9917d8dd2ed55
2014-05-14 16:33:00 -07:00
Yaowu Xu ed09580777 vp9_decodeframe.c: cleanup -wextra warnings
Change-Id: I0315cea6a5e58182bc2556e9825ec2ef0b1480c3
2014-05-14 09:46:11 -07:00
Dmitry Kovalev d31b836193 Deadline is not supported in VP9 decoder, removing it completely.
Change-Id: I7675f23150404913f4b457add69fb846f6921997
2014-05-13 17:35:46 -07:00
Dmitry Kovalev eecc750b33 Merge "Moving loopfilter call to vp9_decode_frame()." 2014-05-13 17:20:26 -07:00
Dmitry Kovalev ae7d3ef39f Moving loopfilter call to vp9_decode_frame().
Inline loopfilter has been already handled in vp9_decode_frame().
Collecting all similar code in one place now.

Change-Id: I358a0280fc7c2b27cca520bc1e8c16c4eb6491dd
2014-05-12 16:19:19 -07:00
Dmitry Kovalev ccfb4b920a Adding get_tile_buffers() function.
Change-Id: I910c437b80af90c50831e1fbff75842d4276a027
2014-05-12 12:49:29 -07:00
Adrian Grange 3305909bc2 Merge "Fix check of debug counts for corrupt frame" 2014-05-11 09:13:55 -07:00
Adrian Grange 99892e85d5 Fix check of debug counts for corrupt frame
Fixes the idecoder in the case where:
  cm->error_resilient_mode == 0, and
  cm->frame_parallel_decoding_mode == 0, but
  new_fb->corrupted == 1.

The assert in debug_check_frame_counts fails to
take into account the case of a corrupt frame.

Change-Id: Idf318a68458cc88d65d6f3f408a10d8ffe87e43f
2014-05-09 10:12:23 -07:00
Dmitry Kovalev 0dacecaf20 Removing VP9DecoderConfig.
We only used two members from that struct: max_threads and inv_tile_order.
Moving them directly to VP9Decoder struct.

Change-Id: If696a4e5b5b41868a55f3cc971e1d7c1dd9d5f69
2014-05-08 16:24:36 -07:00
Dmitry Kovalev 25110038f7 Merge "Using crop_{width, height} instead of {width, height}." 2014-04-30 15:01:26 -07:00
Jim Bankoski 29af017fc0 corrupted frames shouldn't affect stats
Don't update the stats if we have a corrupted frame.

Change-Id: I65a13adc50e0389b4201d3b671f0225195dfaff4
TODO: Test case that shows this problem.
2014-04-30 10:13:29 -07:00
Dmitry Kovalev 49d8bdc29b Using crop_{width, height} instead of {width, height}.
Change-Id: I6dc9741cdcd700f5c4a387f58da7feb58dd4bbda
2014-04-29 16:12:44 -07:00
Dmitry Kovalev 571c70e554 Removing WRITE_RECON_BUFFER related code.
That code is not used, we could easily return it back using vpx_img_write()
function.

Change-Id: Id107875c6feab6ad245a518f6b437b6ed4b1246d
2014-04-25 16:43:58 -07:00
Joey Parrish 18c08607e0 Add VPXD_SET_DECRYPTOR support to the VP9 decoder.
Change-Id: I88f86c8ff9af34e0b6531028b691921b54c2fc48
2014-04-23 16:11:54 -07:00
Dmitry Kovalev e608418899 Renaming MB_PREDICTION_MODE to PREDICTION_MODE.
Actually, it would be great to have two separate enums INTRA_MODES and
INTER_MODES in future.

Change-Id: I6c4147cf0002853da9c1e03fe9514eab876f01c8
2014-04-22 17:48:31 -07:00
Yaowu Xu bae205fd6a Remove an unused function
Change-Id: I0f2592ecfc5197dfb94975260cb2f862315e7895
2014-04-20 14:50:35 -07:00