John Koleszar [Mon, 22 Oct 2012 21:21:59 +0000 (14:21 -0700)]
postproc: allocate enough memory for limits buffer
The vp8_post_proc_down_and_across_mb_row_sse2() needs space for an
even number of macroblocks, as they are read two at a time for the
chroma planes. Round up the width during the allocation of
pp_limits_buffer to support this.
Yunqing Wang [Thu, 4 Oct 2012 19:59:36 +0000 (12:59 -0700)]
Add unit test for decoder test_vector_test
Got 61 test vectors from vp8-test-vectors.git
(http://git.chromium.org/gitweb/?p=webm/vp8-test-vectors.git)
Added decoder test vectors downloading in unit tests. Uploaded
the test vectors and their md5 files to WebM website.
$ gsutil cp *.* gs://downloads.webmproject.org/test_data/libvpx
Added their sha1sum to the test/test-data.sha1 file.
In unit tests, download the test vectors to LIBVPX_TEST_DATA_PATH.
Test_vector_test goes through the test vectors, decodes them, and
compute the md5 checksums. The checksums are compared with the
expected md5 checksums to tell if the decoder decodes correctly.
John Koleszar [Mon, 8 Oct 2012 22:58:04 +0000 (15:58 -0700)]
multi-res: disable intra on forced ref frames
If a reference frame is forced because of low dissimilarity, then
shut off the search of intra modes. This change has mixed results. On
one clip (QVGA), it hurt quality by ~1.5% with negligible speed impact.
On another (VGA) it had negligible affect on quality, but a ~0.2% speed
impact.
John Koleszar [Mon, 8 Oct 2012 22:54:24 +0000 (15:54 -0700)]
multi-res: add parent_ref_valid flag
Rather than overloading the parent_ref_frame value to shut off the
search in some cases, add a new validity flag. This cleans up some
of the duplicated mr_encoder_id && mr_low_res_mv_avail checks as
well, for readability.
Yunqing Wang [Fri, 28 Sep 2012 17:13:07 +0000 (10:13 -0700)]
post-proc: deblock filter optimization
1. Algorithm modification:
Instead of having same filter threshold for a whole frame, now we
allow the thresholds to be adjusted for each macroblock. In current
implementation, to avoid excessive blur on background as reported
in issue480(http://code.google.com/p/webm/issues/detail?id=480), we
reduce the thresholds for skipped macroblocks.
2. SSE2 optimization:
As started in issue479(http://code.google.com/p/webm/issues/detail?id=479),
the filter calculation was adjusted for better performance. The c
code was also modified accordingly. This made the deblock filter
2x faster, and the decoder was 1.2x faster overall.
Next, the demacroblock filter will be modified similarly.
John Koleszar [Mon, 8 Oct 2012 15:39:47 +0000 (08:39 -0700)]
multi-res: work around reference mismatch
In some situations, believed to be an interaction between temporal
scalability and dropped frames, the references available to an
encoder may not be the same references available to its parent.
Previously, the code tried to force the reference frame chosen by
the parent to be used on this frame, even if it was disabled. This
was preventing the pick mode loop from running even once, which led
to a crash.
Attempts to reproduce this bug locally were unsuccessful, so it is
still undetermined what the underlying cause of this issue is. In
the specific case that was failing, the application did not set
any flags which influenced the reference selection on that frame.
ref_frame_flags indicated that the golden frame was disabled,
believed to be because the last frame updated the last and golden
frames, so golden was shut off by default. It's not clear why this
wouldn't have also been true in the lower res encoder, ie, why the
lower res encoder decided to use and/or was allowed to use the
golden frame. We weren't able to debug into the non-crashing
lower res encoder as the crash couldn't be reproduced locally.
John Koleszar [Wed, 3 Oct 2012 21:52:56 +0000 (14:52 -0700)]
fix uninitialized value in multi-res encoding
If a parent mb is available but is intra coded, then parent_ref_mv is
invalid. Check that the parent is inter coded before trying to access
the parent_ref_mv. Previously the parent_ref_mv was being read from
an uninitialized stack allocation, causing potential OOB reads and
other undefined behavior.
Adrian Grange [Tue, 2 Oct 2012 16:36:41 +0000 (09:36 -0700)]
Added Reset method to TwopassStatsStore
The stats buffer needs to be reset between runs of the
encoder. I added a Reset() function to TwopassStatsStore
and called it at the beginning of each encode.
This enables us to run multiple encodes which was
previously not possible since there was no way to reset
the stats between runs.
John Koleszar [Mon, 24 Sep 2012 21:52:18 +0000 (14:52 -0700)]
rtcd/win32: use InitializeCriticalSection explicitly
Protect the call to {Initialize,Delete}CriticalSection() with an
Interlocked{Inc,Dec}rement() pair, rather than the previous static
initialization. This should play better with AppVerifier, and fix issue
Scott LaVarnway [Wed, 26 Sep 2012 20:45:53 +0000 (13:45 -0700)]
Added unit test for subtract functions
Patch Set 1: gain familiarity with unit tests... added simple
4x4 subtract test
Patch Set 2: fixed mistakes, parameterized as suggested
Patch Set 3: randomized the source/predictor data
Change-Id: I33432bdf7c9f2a9b8c2533a37106382c2a8209ee Signed-off-by: Scott LaVarnway <slavarnway@google.com>
Marco Paniconi [Sat, 22 Sep 2012 01:54:11 +0000 (18:54 -0700)]
Update to cyclic refresh.
-Increase the amount of mbs to be refreshed.
-Replace the delta qp with a fixed and reduced delta.
-Change to the mb update loop to try to always update same amount of mbs.
Scott LaVarnway [Wed, 19 Sep 2012 19:30:44 +0000 (12:30 -0700)]
Moved vp8dx_get_raw_frame() call to vp8_get_frame()
This change is necessary for the frame-based multithreading
implementation.
Since the postproc occurs in this call, vpxdec was modified to time around
vpx_codec_get_frame()
Jim Bankoski [Fri, 7 Sep 2012 23:38:15 +0000 (16:38 -0700)]
valgrind caught uninitialized cond
If the decoder crashes and returned an error before it set up
block offsets but after it set up frame buffers. We had a
problem decoding the next keyframe because the block offsets
were never set.
Deb Mukherjee [Tue, 4 Sep 2012 19:09:05 +0000 (12:09 -0700)]
Adjusting thresholds in mfqe post-processing
Adjusts some of the qualification thresholds in mfqe to eliminate
artifacts due to wrong decisions. Besides, a new qualification
criteria is used to disable mfqe if the quality of the previous
frame is itself not too good.
Yunqing Wang [Fri, 10 Aug 2012 19:35:55 +0000 (12:35 -0700)]
Encoder denoiser performance improvement
The denoiser function was modified to reduce the computational
complexity.
1. The denoiser c function modification:
The original implementation calculated pixel's filter_coefficient
based on the pixel value difference between current raw frame and last
denoised raw frame, and stored them in lookup tables. For each pixel c,
find its coefficient using
filter_coefficient[c] = LUT[abs_diff[c]];
and then apply filtering operation for the pixel.
The denoising filter costed about 12% of encoding time when it was
turned on, and half of the time was spent on finding coefficients in
lookup tables. In order to simplify the process, a short cut was taken.
The pixel adjustments vs. pixel diff value were calculated ahead of time.
adjustment = filtered_value - current_raw
= (filter_coefficient * diff + 128) >> 8
The adjustment vs. diff curve becomes flat very quick when diff increases.
This allowed us to use only several levels to get a close approximation
of the curve. Following the denoiser algorithm, the adjustments are
further modified according to how big the motion magnitude is.
2. The sse2 function was rewritten.
This change made denoiser filter function 3x faster, and improved the
encoder performance by 7% ~ 10% with the denoiser on.
James Zern [Tue, 28 Aug 2012 00:13:09 +0000 (17:13 -0700)]
msvs/tests: fix data alignment for asm tests
Replace DECLARE_ALIGNED_ with vpx_memalign()
DECLARE_ALIGNED (__declspec(align())) does not work as intended when
used on class data members:
Data in classes or structures is aligned within the class or structure
at the minimum of its natural alignment and the current packing setting
(from #pragma pack or the /Zp compiler option)
Yunqing Wang [Tue, 21 Aug 2012 17:52:35 +0000 (10:52 -0700)]
Add biasing to ZEROMV for videos with static background
For videos with big static background(such as video conferencing
clips), the mode decision was biased to ZEROMV in order to
obtain a stable background. The percentage of ZEROMV on last
frame was used to predict if there is static area in current frame,
and checking already-encoded neighboring macroblocks' motion
vectors to make sure the local area has low motion.