Commit Graph

236 Commits

Author SHA1 Message Date
Paul Wilkins
ccffe318ff Merge "Use 64 bit to accumulate frame sse." 2015-01-09 06:05:11 -08:00
James Zern
44b55dada8 Merge "vp9: fix -Wclobbered (longjmp + local variables)" 2015-01-08 15:53:02 -08:00
Jingning Han
ce08006951 Always check and free denoiser buffer memory space
The vp9_denoiser_free() function will internally check if the
buffer pointers are NULL. This commit makes the encoder always
call vp9_denoiser_free() after finishing encoding. It protects the
case where noise_sensitivity_level is changed during encoding
process and happen to be turned off towards the end of sequence,
which could result memory space allocated to denoiser not being
released.

Change-Id: Ie20dc2f2e6e5fb6333fbab3356bc153978a6a0f8
2015-01-07 08:50:13 -08:00
Jingning Han
27582e573b Skip duplicate denoiser frame buffer allocation
Allocate the frame buffer allocation for denoiser once during the
encoder initialization. This avoids allocating frame buffer
multiple times and overwriting the buffer pointer without proper
releasing.

Change-Id: I9b3baa6283449d86fd164534d344c036bb035700
2015-01-07 08:49:04 -08:00
Paul Wilkins
a3c1a9b419 Use 64 bit to accumulate frame sse.
When testing frame sse to choose a loop filter value and
when checking ambient error in kf Q selection, use 64 bit
values for accumulating the sse, to avoid risk of overflow
for large image formats.

Change-Id: I03765d16c843d0ade61a45b0cd46312472697e57
2015-01-07 14:13:16 +00:00
Jingning Han
21c0306187 Fix denoised video output function
This commit fixes the buffer alignment control in denoised video
output function. The encoder is now able to properly store the
denoised input video into provided file when enabled.

Change-Id: I258e272c8d4a9b52592e16d6d09976c6f5c21728
2015-01-03 21:39:32 -08:00
Jim Bankoski
b3c66f8a2f WIP: Remove giant value cost table
Change-Id: Iabe8a8868a747626c24bb13f1796f4c7827af367
2014-12-23 15:06:17 -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
4e04fa6dea Merge "make vp9_coef_encodings const" 2014-12-22 15:05:25 -08:00
Jim Bankoski
fc954c7c03 Merge "remove static initializers for partition tree" 2014-12-22 13:49:57 -08:00
Jim Bankoski
a5f7d78a06 make vp9_coef_encodings const
Change-Id: I28a3d342a4a4b23e02a0f47bb8037c4403f71d61
2014-12-22 13:35:56 -08:00
Jim Bankoski
dd4275e498 resolve visual studio warnings around initializers
Change-Id: Id2ad4fb24242f7ca8fa7a152f0889fded4113613
2014-12-19 12:38:25 -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
Paul Wilkins
60e9b731cf Remove mode dependent zbin boost.
Initial patch to remove get_zbin_mode_boost() and
cpi->zbin_mode_boost.

For now sets a dummy value of 0 for zbin extra pending
a further clean up patch.

Change-Id: I64a1e1eca2d39baa8ffb0871b515a0be05c9a6af
2014-12-18 16:45:52 +00:00
Jim Bankoski
fd96deb06c remove static initializers for partition tree
Could have problem with 2 encoders.

Change-Id: I92d326933c00fee688f77b54acf467ca5a8516bc
see: https://code.google.com/p/webm/issues/detail?id=900&thanks=900&ts=1418843841
2014-12-17 11:41:06 -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
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
Paul Wilkins
e68c8dcfd2 Substantial restructuring of AQ mode 2.
The restructure moves the decision into the rd pick
modes loop and makes a decision based at the 16x16
block level instead of only the 64x64 level.

This gives finer granularity and better visual results
on the clips I have tested. Metrics results are worse
than the old AQ2 especially for PSNR and this mode
now falls between AQ0 and AQ1 in terms of visual
impact and metrics results.

Further tuning of this to follow.

It should be noted that if there are multiple iterations
of the recode loop the segment for a MB could change
in each loop if the previous loop causes a change in the
complexity / variance bin of the block. Also where a block
gets a delta Q this will alter the rd multiplier for this block
in subsequent recode iterations and frames where the
segmentation is applied.

Change-Id: I20256c125daa14734c16f7cc9aefab656ab808f7
2014-12-09 15:10:52 +00:00
James Zern
3db785facc Merge "vp9: fix frame-parallel encoding" 2014-12-05 19:00:48 -08:00
James Zern
6db81fd629 vp9: fix frame-parallel encoding
the flag in the header wasn't being set based on the encoder
configuration in non-intra only mode

broken since:
fbc2fbf Adding oxcf temp variable.

Change-Id: Ib4cff9901889824bc4e68d7f0f6deb1e41df2f53
2014-12-05 17:44:46 -08:00
Deb Mukherjee
37448d3e1f Some internal-stats, vp9-highbitdepth bug fixes
Change-Id: I0363d98f6f6558a43276aec48f27dca37c93f5ad
2014-12-05 13:40:50 -08:00
Yunqing Wang
a3a4a34c60 Merge "vp9_ethread: the tile-based multi-threaded encoder" 2014-12-05 08:23:49 -08:00
Yunqing Wang
eba9c762a1 vp9_ethread: the tile-based multi-threaded encoder
Currently, VP9 supports column-tile encoding, which allows a frame
to be encoded in multiple column tiles independently. The number of
column tiles are set by encoder option "--tile-columns". This
provides a way to encode a frame in parallel.

Based on previous set of patches, this patch implemented the tile-
based multi-threaded encoder. Each thread processes one or more
tiles.

Usage:
For HD clips:
--tile-columns=2 --threads=1/2/3/4

While using 4 threads, tests showed that the encoder achieved
2.3X - 2.5X speedup at good-quality speed 3, and 2X speedup at
realtime speed 5.

Change-Id: Ied987f8f2618b1283a8643ad255e88341733c9d4
2014-12-04 11:21:34 -08:00
Adrian Grange
9065da983f Merge "Free motion vector array before re-allocating" 2014-12-04 07:08:37 -08:00
Adrian Grange
b56451f488 Merge "Use memset for initialization to 0" 2014-12-03 16:50:39 -08:00
Adrian Grange
979ee6e4c9 Free motion vector array before re-allocating
Change-Id: I0c39136d67e1e83020d61f86b062a04182ec9b00
2014-12-03 16:07:32 -08:00
Adrian Grange
73caef0500 Use memset for initialization to 0
Change-Id: I714ca22b5d51016bf8b035cf457616c707257641
2014-12-03 15:22:02 -08:00
Deb Mukherjee
02941b0df2 Fix a warning related to VPX_EFLAG_FORCE_KF check
Fixes a warning in chrome build.

Change-Id: I8fa0fd3e7ba1aecf89e5f79ce94cd64ed6a9567c
2014-12-02 11:35:52 -08:00
Yunqing Wang
0993bef7e9 vp9_ethread: calculate and save the tok starting address for tiles
Each tile's tok starting address is calculated before the encoding
process. These addresses are stored so that the same calculation
won't be done again in packing bit stream.

Change-Id: I0a3be0301f002260c19a850303f2f73ebc47aa50
2014-11-25 17:19:35 -08:00
Yunqing Wang
edbd61e136 vp9_ethread: modify VP9_COMP structure
This patch modified struct VP9_COMP. Created a struct ThreadData
to include data that need to be copied for each thread. In
multiple thread case, one thread processes one tile. all threads
share one copy of VP9_COMP,
(refer to VP9_COMP *cpi in the code)
but each thread has its own copy of ThreadData,
(refer to ThreadData *td in the code).
Therefore, within the scope of encode_tiles(), both cpi and td
need to be passed as function parameters.

In single thread case, the FRAME_COUNTS pointer in ThreadData
points to "counts" in VP9_COMMON.

Change-Id: Ib37908b2d8e2c0f4f9c18f38017df5ce60e8b13e
2014-11-24 17:57:38 -08:00
Paul Wilkins
3d1e8c9a85 Further AQ1 clean up.
Further patch to restructure AQ mode 1.

Change-Id: I566452a033d047a49a40441a7be24690ea69412d
2014-11-20 16:00:51 -08:00
Yunqing Wang
70c9d2983b Revert "vp9_ethread: include a pointer to mb in VP9_COMP"
This reverts commit 6906d218dd.

Another way will be used to handle mb struct.

Change-Id: Ic1111a46b2b1ee00f8f9e3fcd4cf3eb6030b2dc4
2014-11-20 08:31:12 -08:00
Yunqing Wang
87ae6d73d4 Code cleanup: remove unused members in RD_OPT
These 2 members in RD_OPT were moved to TileDataEnc struct
already, and therefore were removed here.

Change-Id: I22fee3b67f96e473a58e194a7edc76dbd48bfa04
2014-11-14 16:33:25 -08:00
Yunqing Wang
d0b547c676 vp9_ethread: combine encoder counts in separate struct
Several frame counters in encoder are updated at SB level. Combine
those counters and put them in a separate struct, which allows us
to allocate one copy for each thread.

Change-Id: I00366296a13c0ada4d8fa12f5e07728388b6cab7
2014-11-14 16:09:22 -08:00
Yunqing Wang
6906d218dd vp9_ethread: include a pointer to mb in VP9_COMP
Modified VP9_COMP struct to include MACROBLOCK *mb. This change
makes it feasible in multi-thread case to allocate a mb for each
thread.

Change-Id: I624d6d1aa9c132362200753e5d90b581b1738d6e
2014-11-14 12:31:06 -08:00
Adrian Grange
35de9db312 Merge "Prepare for dynamic frame resizing in the recode loop" 2014-11-13 15:01:49 -08:00
Adrian Grange
0d085ebc0a Prepare for dynamic frame resizing in the recode loop
Prepare for the introduction of frame-size change
logic into the recode loop.

Separated the speed dependent features into
separate static and dynamic parts, the latter being
those features that are dependent on the frame size.

Change-Id: Ia693e28c5cf069a1a7bf12e49ecf83e440e1d313
2014-11-13 11:41:20 -08:00
Deb Mukherjee
48a7627316 Vidyo: Turn off keyframes in higher spatial layers
Change-Id: Icdd5e71cd6a2b59bc4b3b972af9e4d4a36821792
2014-11-11 16:09:07 -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
Minghai Shang
9f9e30d7bf Merge "[spatial svc] Make spatial svc working for one pass rate control" 2014-11-04 15:57:16 -08:00
Minghai Shang
86c36a504d [spatial svc] Make spatial svc working for one pass rate control
Change-Id: Ibd9114485c3d747f9d148f64f706bf873ea473ac
2014-11-04 11:46:48 -08:00
Marco
d6b688375f Allow disable of refresh golden for more than 1 layer encoding.
The current logic was allowing for disabling golden refresh only
for two pass svc encoding. This change disables it as long as
more than 1 layer encoding is used (for example temporal layers under 1pass CBR).

Change-Id: I4dc5204a7ad365c821ec7963e93b59da82e1826b
2014-11-02 22:24:00 -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
Jingning Han
ac53c41e64 Merge "Tile based adaptive mode search in RD loop" 2014-10-24 18:44:52 -07:00
Jingning Han
eee201c221 Tile based adaptive mode search in RD loop
Make the spatially adaptive mode search in rate-distortion
optimization loop inter tile independent. Experiments suggest that
this does not significantly change the coding staticstics.

Single tile, speed 3:
pedestrian_area 1080p 1500 kbps
59192 b/f, 40.611 dB, 101689 ms

blue_sky 1080p 1500 kbps
58505 b/f, 36.347 dB, 62458 ms

mobile_cal 720p 1000 kbps
13335 b/f, 35.646 dB, 45655 ms

as compared to 4 column tiles, speed 3:
pedestrian_area 1080p 1500 kbps
59329 b/f, 40.597 dB, 101917 ms

blue_sky 1080p 1500 kbps
58712 b/f, 36.320 dB, 62693 ms

mobile_cal 720p 1000 kbps
13191 b/f, 35.485 dB, 45319 ms

Change-Id: I35c6e1e0a859fece8f4145dec28623cbc6a12325
2014-10-24 10:00:27 -07:00
Paul Wilkins
60d192db04 Merge "Enable dual arf with constant q." 2014-10-24 05:51:25 -07:00