Commit Graph

899 Commits

Author SHA1 Message Date
Dmitry Kovalev
bbb25e6a39 Merge "Adding RefBuffer struct." 2014-01-06 14:19:44 -08:00
Jingning Han
393a8ccef9 Remove avoid_frame_with_high_error from RD loop
The feature undergoes prior assumption that the recursive partition
size search from 4x4 to 64x64, hence utilizing information from small
blocks to determine early termination in large block rate-distortion
optimization search. The current codebase is now going from top down.
The previous function might go with not properly initialized values,
hence removed.

Tested on pedestrian_area_1080p at 4000 kbps running under speed 2.
No visible difference in runtime observed.

Change-Id: I553df415c6191413762db7ae34e8790c71d8118e
2014-01-06 13:34:07 -08:00
Dmitry Kovalev
6b150c2884 Combining ref_frame and second_ref_frame into ref_frames[2].
Change-Id: I007d66a1cb1b44751dcceafbaa64649ed9a34562
2014-01-06 12:24:37 -08:00
Dmitry Kovalev
6e8c103620 Merge "Replacing int_mv with MV." 2014-01-03 17:38:28 -08:00
Dmitry Kovalev
ba41e9d459 Adding RefBuffer struct.
Adding RefBuffer to simplify reference buffer management. The struct has a
pointer to image data and scale factors relative to the current frame.

Change-Id: If38eb1491ff687cc11428aee339f3e052e2c5d9e
2014-01-03 15:21:55 -08:00
Dmitry Kovalev
672c355a26 Replacing int_mv with MV.
Change-Id: Ifd432fa3741ba47102d298e0b348eb00f5a9ce53
2014-01-03 11:48:07 -08:00
Dmitry Kovalev
5b04962cf4 Merging best_ref_mv and second_best_ref_mv into best_ref_mv[2].
Change-Id: If04b57828847cee09a79c94e1098d1aa4990ea0d
2014-01-03 11:31:00 -08:00
Jingning Han
cdc933ca00 Merge "Adaptive motion control on ref and search range" 2013-12-27 15:04:16 -08:00
Jingning Han
a4ce53f14d Adaptive motion control on ref and search range
This commit takes a preliminary attempt to refine the motion search
control. It detects the SAD associated with mv predictor per reference
frame, and based on which to determine whether the encoder wants to
reduce the motion search range (if the predicted mv provides fairly
small SAD), or to skip the current reference frame (if there exists
another ref frame that gives much smaller SAD cost).

This feature is turned on in the settings of speed 1 and above.

In speed 1, compression performance changed
derf  -0.018%
yt    -0.043%
hd    -0.045%
stdhd -0.281%

speed-up
pedestrian_area_1080p at 4000 kbps 100 frames
199651ms -> 188846ms (5.5% speed-up)
blue_sky_1080p at 6000 kbps
443531ms -> 415239ms (6.3% speed-up)

In speed 2, compression performance changed
derf  -0.026%
yt    -0.090%
hd    -0.055%
stdhd -0.210%

speed-up
pedstrian 113949ms -> 108855ms (4.5% speed-up)
blue_sky  271057ms -> 257322ms (5% speed-up)

Change-Id: I1b74ea28278c94fea329d971d706d573983d810d
2013-12-27 12:43:06 -08:00
Dmitry Kovalev
1e8b5bf4ac Merge "Removing vp9_findnearmv.{h, c} files." 2013-12-26 13:38:38 -08:00
Dmitry Kovalev
b3b9f4a4d0 Merge "Using single struct to represent scale factors." 2013-12-20 11:22:02 -08:00
Jingning Han
243327f43c Store the SSE of prediction residuals
Buffer the SSE of prediction residuals in the rate-distortion
optimization loop of a given block. This information would be used
for later encoding control.

Change-Id: If4e63f3462490513c48be9407d3327c8dd438367
2013-12-19 18:45:28 -08:00
Dmitry Kovalev
987810ad95 Removing vp9_findnearmv.{h, c} files.
Moving all code from that files to vp9_mvref_common.{h, c}.

Change-Id: Ibc4afcb8cea6847166ff411130e93611ebe63b20
2013-12-19 17:39:57 -08:00
Dmitry Kovalev
a3fbcc88bb Using single struct to represent scale factors.
Moving back to scale_factors struct. We don't need anymore x_offset_q4 and
y_offset_q4 because both values are calculated locally inside vp9_scale_mv
function.

Change-Id: I78a2122ba253c428a14558bda0e78ece738d2b5b
2013-12-19 16:06:33 -08:00
Dmitry Kovalev
c872d2be65 Call set_scaled_offsets() just before scale_mv() call.
Before mv scaling it is required to calculate x_offset_q4/y_offset_q4
by calling set_scaled_offsets(). Now offset configuration can not be
missed because it happens just before scale_mv().

Change-Id: I7dd1a85b85811a6cc67c46c9b01e6ccbbb06ce3a
2013-12-19 14:55:13 -08:00
Jingning Han
d8557a052c Make rd_pred_filter update consistent in all bsizes
This commit reworks the prediction filter rate-distortion cost update
process consistent for all block sizes.

Change-Id: I5874349ab38df380240f96c2d4ef924072bab68d
2013-12-18 11:54:31 -08:00
Jingning Han
07a28c77e3 Merge "Fix rd_filter_cache update in sub8x8 RD loop" 2013-12-16 17:57:02 -08:00
Jingning Han
ef838c349c Merge "Remove redefinition in handle_inter_mode" 2013-12-16 17:56:41 -08:00
Deb Mukherjee
1e59cbf23b Rate control changes on active_worst_quality
Various cleanups and refactoring.
Removes feedback of active worst qaulity and uses last_q
instead to make the interface cleaner. Active worst quality
is now decided only once for a frame being coded in the
beginning based on last_q and other stats. Also, adds other
cleaups on last_q to store also the last_q for altref frames,
and reduces the altref interval a little.

The output does change a little.
derfraw300: +0.224% (global psnr)
stdhdraw250: +0.442% (global psnr)

Change-Id: Ie634cdc032697044c472dd0fe79c109b3e7f9767
2013-12-16 17:08:16 -08:00
Dmitry Kovalev
3755be94ed Merge "Using MV struct instead of int_mv union in encoder (2)." 2013-12-16 16:56:07 -08:00
Jingning Han
75cfadbd1f Fix rd_filter_cache update in sub8x8 RD loop
Properly handle the rd_filter_cache update, when early termination
or skip prediction filter type check is triggered.

Change-Id: Ie7b9a75fed3358f45ffd15817f2b36670c14eb2d
2013-12-16 14:52:20 -08:00
hkuang
fb53409d2a Merge "Remove border extension in intra frame prediction." 2013-12-16 14:48:54 -08:00
hkuang
25e5552630 Remove border extension in intra frame prediction.
Change-Id: Id677df4d3dbbed6fdf7319ca6464f19cf32c8176
2013-12-16 14:05:58 -08:00
Dmitry Kovalev
095b03231c Using MV struct instead of int_mv union in encoder (2).
Change-Id: I068345f722a7116e3119927295ad23a28d3066a0
2013-12-13 17:20:40 -08:00
Dmitry Kovalev
64cf398713 Merge "Using MV struct instead of int_mv union in encoder." 2013-12-13 16:42:54 -08:00
Dmitry Kovalev
f54b515797 Merge "Cleaning up vp9_append_sub8x8_mvs_for_idx()." 2013-12-13 15:38:53 -08:00
Dmitry Kovalev
25da21b14e Using MV struct instead of int_mv union in encoder.
Change-Id: I8b81a3e4b4fa530a654c28d9c136afa0c1d379fd
2013-12-13 15:24:48 -08:00
Jingning Han
84acc988eb Remove redefinition in handle_inter_mode
Change-Id: I44513b9db6d42e2c52723e1a429f06a93d300c8b
2013-12-13 13:38:05 -08:00
James Zern
3aa75bcef6 Merge "vp9 asserts: fix compile warning" 2013-12-13 12:41:31 -08:00
Jingning Han
2f9d118f21 Merge "Remove some dead code" 2013-12-13 11:10:39 -08:00
James Zern
178db94cd6 vp9 asserts: fix compile warning
string literal to int within an assert

Change-Id: I0c889256b67a078e6e2a79577f0b7ae084243258
2013-12-12 19:49:19 -08:00
Jingning Han
3b5a90bd86 Enable adaptive pred filter type for sub8x8
This commit enables an adaptive prediction filter type selection
for sub8x8 block sizes. In speed 1, it re-uses the filter type of
collocated 8x8 block if it is tested in the rate-distortion optimization
loop, for the sub8x8 blocks. Otherwise, it runs the normal test
over all the three filter types. In speed 2, it re-uses the 8x8
block's prediction filter type, if available. Otherwise, force it
to be EIGHTTAP.

Compression and speed performance wise:
speed 1
derf -0.266%
yt   -0.138%

bus at 2000 kbps: 33766ms -> 30451ms (10% speed-up)
football at 600 kbps: 48173ms -> 43786ms (9% speed-up)

speed 2
derf -0.026%
yt   +0.134%

bus at 2000 kbps: 18973ms -> 17698ms (6% speed-up)
football at 600 kbps: 26748ms -> 25096ms (6% speed-up)

Change-Id: I77e097533b969fd3472147225fa79fc98095d342
2013-12-12 17:54:34 -08:00
Jingning Han
9d6e7ce12d Rename clamp_mv_min_max to set_mv_search_range
This function sets the motion search range limit. Rename it to be
more informative.

Change-Id: I2e8e01073dcb99c9bea9c9acd0a61d672d615444
2013-12-11 14:00:08 -08:00
Jingning Han
cf83dfb283 Merge "Enforce motion search range clamp for sub8x8" 2013-12-11 13:51:32 -08:00
Jingning Han
a67e654b6c Enforce motion search range clamp for sub8x8
This commit constrains the maximal motion search range for sub8x8
blocks to be [-1023, 1023], in the unit of full pixel.

Change-Id: I955b60649364ab410f2453cafd46a496f2fcb43e
2013-12-11 10:59:27 -08:00
Dmitry Kovalev
098d13ba10 Cleaning up vp9_append_sub8x8_mvs_for_idx().
Replacing if-else with switch statement, reordering function arguments.

Change-Id: I4825d2ef311ba8999b6d4ceb0eef003587a13434
2013-12-10 17:56:53 -08:00
Dmitry Kovalev
2dd20e468a Cleaning up skip context calculation.
Renames:
  vp9_get_pred_context_mbskip => vp9_get_skip_context
  vp9_get_pred_prob_mbskip    => vp9_get_skip_prob

Change-Id: I2af499848ef73f3f5cd8cdb27852d0bcdfe31d09
2013-12-10 14:11:26 -08:00
Dmitry Kovalev
e18eb7721e Merge "Renaming comp_pred_mode to reference_mode." 2013-12-10 10:52:34 -08:00
Dmitry Kovalev
08c48ddc01 Renaming comp_pred_mode to reference_mode.
Change-Id: I83ffed2b1878a35ac35f07f9ee74309adc9c7b11
2013-12-09 15:13:34 -08:00
Dmitry Kovalev
2c3120274a Removing max_uv_txsize_lookup lookup table.
Adding get_uv_tx_size_impl() with tx size selection logic, rewriting
get_uv_tx_size().

Change-Id: I3ecb108059a41be227a8c89a0710bd174f508951
2013-12-09 14:03:23 -08:00
Dmitry Kovalev
a19d694f09 Merge "Removing BLOCK_TYPES and adding PLANE_TYPES constant instead." 2013-12-07 02:20:41 -08:00
Alex Converse
1c3e04bb94 Remove some dead code
Change-Id: I0953a3b28758811f9d6a85787850e77592bd7670
2013-12-06 21:21:04 -08:00
Dmitry Kovalev
b6e5bb27c9 Merge "Renaming reference mode context calculation function." 2013-12-06 14:22:47 -08:00
Dmitry Kovalev
52618d28e1 Replacing b_width_log2 with num_4x4_blocks_wide_lookup.
Change-Id: I8ab9bbe2595ed1743f35223b6a6ce6d023b9a20e
2013-12-06 12:04:06 -08:00
Dmitry Kovalev
63963f51ef Renaming reference mode context calculation function.
Renames:
  vp9_get_pred_context_comp_inter_inter => vp9_get_reference_mode_context
  vp9_get_pred_prob_comp_inter_inter    => vp9_get_reference_mode_prob

Change-Id: I3bbb69481e6b0c848028667c9269f567f293d3bd
2013-12-06 11:23:01 -08:00
Dmitry Kovalev
d6b159d4a6 Removing BLOCK_TYPES and adding PLANE_TYPES constant instead.
Change-Id: Ic3bb862e93aedf6a489a33ea6f7e5097d96855ee
2013-12-06 10:54:00 -08:00
Dmitry Kovalev
5be34ba80f Merge "vp9_get_pred_context_intra_inter() clean up." 2013-12-06 09:14:36 -08:00
Jingning Han
ee02f3fbed Merge "Remove redundant bsize mapping in motion search" 2013-12-06 08:57:58 -08:00
Dmitry Kovalev
377fa8aff8 Renaming PREV_COEF_CONTEXTS to COEFF_CONTEXTS.
Also adding BAND_COEFF_CONTEXTS macro to simplify for loop logic.

Change-Id: I12a78a49cf1addf81e6b3fe2a3736ec2b79bd79e
2013-12-05 17:08:06 -08:00
Dmitry Kovalev
6fd71e1b09 vp9_get_pred_context_intra_inter() clean up.
Renaming:
 vp9_get_pred_context_intra_inter => vp9_get_intra_inter_context
 vp9_get_pred_prob_intra_inter    => vp9_get_intra_inter_prob

Change-Id: I2c1affea2e84f4e616137c6df82adb11c7845781
2013-12-05 17:01:03 -08:00
Jingning Han
45aa6f15b0 Remove redundant bsize mapping in motion search
Both single frame and compound inter motion search run with luma
component only. Hence removing the block size mapping therein.

Change-Id: I217488e702432ae9fa0e95bf6f516ebb36b5c79b
2013-12-04 17:25:06 -08:00
Dmitry Kovalev
3712b58c2f Merge "Cleaning up vp9_entropy.h file." 2013-12-04 16:46:41 -08:00
Dmitry Kovalev
f00d157c12 Moving eob array to the encoder.
In the decoder we don't need to save eobs, we can pass eob as an argument.
That's why removing eob arrays from VP9Decompressor and TileWorkerData,
and moving eob pointer from macroblockd_plane to macroblock_plane.

Change-Id: I8eb919acc837acfb3abdd8319af63d1bbca8217a
2013-12-03 17:59:32 -08:00
Dmitry Kovalev
8e89e2f2e0 Cleaning up vp9_entropy.h file.
Renaming constants for consistency:
  DCT_VAL_CATEGORY1 => CATEGORY1_TOKEN
  DCT_VAL_CATEGORY2 => CATEGORY2_TOKEN
  DCT_VAL_CATEGORY3 => CATEGORY3_TOKEN
  DCT_VAL_CATEGORY4 => CATEGORY4_TOKEN
  DCT_VAL_CATEGORY5 => CATEGORY5_TOKEN
  DCT_VAL_CATEGORY6 => CATEGORY6_TOKEN
  DCT_EOB_TOKEN     => EOB_TOKEN
  DCT_EOB_MODEL_TOKEN => EOB_MODEL_TOKEN
  MAX_ENTROPY_TOKENS => ENTROPY_TOKENS

Moving constants:
  INTER_MODE_CONTEXTS from vp9_entropy.h to vp9_blockd.h.
  EOSB_TOKEN from vp9_entropy.h to vp9_tokenize.h

Change-Id: I5fcbf081318e1d365792b6d290a930c6cb0f3fc2
2013-12-03 17:23:03 -08:00
Alex Converse
f63c75de84 Merge "Remove plane_block_idx." 2013-12-03 10:51:13 -08:00
Paul Wilkins
8a4310b160 Merge "Fix use_uv_intra_estimate in rd loop" 2013-12-03 04:30:50 -08:00
Alex Converse
2360a5f093 Remove plane_block_idx.
Its last remaining caller can be passed its results directly without any
additional work. Also, it's not non-4:2:0 safe.

Change-Id: Ia5089ba5f7f66c7617270483c619c9271aefd868
2013-12-02 18:33:50 -08:00
Jingning Han
9f81a50c85 Fix use_uv_intra_estimate in rd loop
This commit fixes the use of uv_intra_estimate by properly restoring
the mode_info struct required by rd_pick_intra_sbuv_mode.

Change-Id: I6a156d79533c4e2e60dfd3b8c5bb0a42a8eca280
2013-12-02 17:30:41 -08:00
Dmitry Kovalev
526a774adb Merge "Moving reaster_block_offset{,_int16} from vp9_blockd.h to vp9_rdopt.h." 2013-12-02 10:31:31 -08:00
Yaowu Xu
e237b7dea3 Merge "Simplify super_block_yrd()" 2013-12-02 09:39:42 -08:00
Yaowu Xu
56d9a4fcd5 Merge "Merge tx selection into RD calculation" 2013-12-02 09:39:10 -08:00
Dmitry Kovalev
d83d61d942 Moving reaster_block_offset{,_int16} from vp9_blockd.h to vp9_rdopt.h.
Change-Id: I5a5888d4639cc6b7eb266be47581dd15ba08c91e
2013-11-27 12:57:21 -08:00
Dmitry Kovalev
e2f1d02eb3 Merge "Moving mode encodings from common to encoder + cleanup." 2013-11-27 11:00:54 -08:00
Dmitry Kovalev
d3a2e55af4 Removing qcoeff buffers from the decoder.
We only need qcoeff buffers in the encoder. Reducing TileWorkerData struct
and VP9Decompressor struct sizes by 24K.

Change-Id: Id148868461f7ffa3d3dd634b371503ae9c57e207
2013-11-26 18:52:10 -08:00
Yaowu Xu
971112f965 Simplify super_block_yrd()
Change-Id: Iae16644faeed920e69cd5d1db71e2e1e4bda241c
2013-11-26 17:05:56 -08:00
Dmitry Kovalev
f4bf712fbb Moving mode encodings from common to encoder + cleanup.
Change-Id: I248ccb1532e2cd95314d0b95108f2c2e71cf084f
2013-11-26 14:53:17 -08:00
Yaowu Xu
08d6fa6de4 Merge tx selection into RD calculation
Change-Id: I406021e34b31b899202a99b39d3da4fa06ebee69
2013-11-26 12:37:25 -08:00
Dmitry Kovalev
204ff1c868 Removing vp9_modecosts.{c, h} files.
Renaming vp9_init_mode_costs() to fill_mode_costs() and moving it to
vp9_rdopt.c.

Change-Id: Ib2542d216458f6dced9f4b7ccbdd2cd98176aa5a
2013-11-25 12:44:05 -08:00
Dmitry Kovalev
3e72277272 Merge "Adding select_tx_size() function." 2013-11-25 10:59:56 -08:00
Dmitry Kovalev
e8af3db88a Merge "Renaming COMPPREDMODE_TYPE enum and its members." 2013-11-25 10:59:08 -08:00
Guillaume Martres
87375e257b Rename block_yrd_txfm to block_rd_txfm
This function is also used with the U and V planes.

Change-Id: Ib6beae0438790bfb690b3a2bda9c5c8b0e89a9b8
2013-11-25 01:18:51 +01:00
Dmitry Kovalev
fb9c19c62d Renaming COMPPREDMODE_TYPE enum and its members.
List of renames:
  COMPPREDMODE_TYPE      => REFERENCE_MODE
  SINGLE_PREDICTION_ONLY => SINGLE_REFERENCE
  COMP_PREDICTION_ONLY   => COMPOUND_REFERENCE
  HYBRID_PREDICTION      => REFERENCE_MODE_SELECT (like TX_MODE_SELECT)
  NB_PREDICTION_TYPES    => REFERENCE_MODES

Change-Id: If723dabe9435325d0165dcd028142a2c78b417b4
2013-11-22 16:35:37 -08:00
Dmitry Kovalev
350731e8f9 Organizing all scan tables into lookup table.
Change-Id: Ie829ee58a55157e6972c63cebe69a5d0a3221349
2013-11-22 16:20:45 -08:00
Dmitry Kovalev
ad3333e2cd Merge "Removing plane_block_{width, height} functions." 2013-11-21 16:37:27 -08:00
Dmitry Kovalev
485682c30a Adding select_tx_size() function.
Change-Id: I9d18b31661a2ccdcd4e25956882c7fc2d4b7002e
2013-11-21 15:55:40 -08:00
Dmitry Kovalev
79b5a2b142 Removing plane_block_{width, height} functions.
Change-Id: I29c0dfcf41a1253d5e2a0d2ff740c0c38ebaa5a2
2013-11-20 12:39:29 -08:00
Dmitry Kovalev
1a69eed2c4 Using is_inter_block() and has_second_ref() functions.
Change-Id: Iadd771a33c8874f3b774923bca4da3c8fe5429ee
2013-11-20 12:08:10 -08:00
Jingning Han
82c32fe1b5 Use restore_dst_buf in handle_inter_mode
There are many places in handle_inter_mode that need to restore the
dst buffer pointers, due to buffer pointer swap and early rd search
breakout. This commit wraps these operations into an inline function
for clean-up.

Change-Id: I0462e8c41c8bc3cd8db07395489cac03d8e5be54
2013-11-19 15:33:16 -08:00
Dmitry Kovalev
953b1e9683 Removing raster_block_offset_uint8() function.
There is no need to use that function, it is much clear to pass offset
directly to the buffer.

Change-Id: I9026cb0c5094c46f97df5d7f7daeb952f2843b24
2013-11-18 19:00:49 -08:00
Yaowu Xu
e63aaf9ad1 Fixed a bug in commit a4a5a210
Commit a4a5a210 enabled lossless coding, but the commit incorrectly
disabled the usage of skip in encoder even when skip should be used.
This commit make sure that skip is enabled even in lossless mode.

Change-Id: I276954f952c6ac68f17a316ebc72f09001228a08
2013-11-18 14:51:04 -08:00
Dmitry Kovalev
5380739a87 Removing vp9_encodeintra.{h, c} files.
There was only one function in *.c file, so moving it to vp9_encodemb.c.

Change-Id: I728859d08b3d6c05c33c1c5b21f0ea1d0e0f83af
2013-11-15 12:17:16 -08:00
Jingning Han
b6b9143218 Dual buffer encoding for intra modes
Overall change (using dual buffer scheme for superblocks of both inter
and intra modes) reduces speed 2 runtime:
bluesky_1080p at 6000kbps:   263553ms -> 257441ms
riverbed_1080p at 8000kbps:  233230ms -> 225308ms.

Change-Id: Idf8d70f768a4b0d97b2a8506372c57b7b4022119
2013-11-13 12:57:03 -08:00
Dmitry Kovalev
3f3d14e1d3 Moving q_index from MACROBLOCKD to MACROBLOCK.
Moving because q_index is used only by encoder.

Change-Id: I0b96175614ed4fd3d76ee56a0ba36258e1e896f6
2013-11-12 18:13:19 -08:00
Jingning Han
e69461593d Merge "Enable dual buffer rd search and encoding scheme" 2013-11-12 18:11:41 -08:00
Dmitry Kovalev
73a5cbeba4 Merge "Using max_tx_size instead of bsize when possible." 2013-11-12 16:54:30 -08:00
Dmitry Kovalev
3a2ea76469 Merge "Moving {sb, mb, b, ab}_index from MACROBLOCKD to MACROBLOCK." 2013-11-12 15:59:28 -08:00
Jingning Han
34b6abefa2 Enable dual buffer rd search and encoding scheme
This commit enables the dual buffer rate-distortion optimization
and encoding scheme. It stacks the original transform coefficients,
quantized levels, and reconstructed coefficients, in the rate-
distortion optimization search process, hence eliminates the need
to re-run residual generation, forward transform, and quantization
in the encoding stage.

Change-Id: I011bfad3a59a380a869ee552e91dae0394ec492e
2013-11-11 18:32:55 -08:00
Jingning Han
e5741c56d1 Merge "Allocate dual buffer sets for encoding" 2013-11-11 18:00:57 -08:00
Dmitry Kovalev
4e39d530f0 Merge "Cleaning up joint_motion_search function." 2013-11-11 16:34:39 -08:00
Jingning Han
3b3aea6834 Allocate dual buffer sets for encoding
Allocate memory space of dual buffer sets that store the coeff, qcoeff,
dqcoeff, and eobs. Connect the pointers of macroblock_plane and
macroblockd_plane to the actual buffer in use accordingly.

Change-Id: I2f0b5f482ca879fae39095013eaf8901db20a5a4
2013-11-11 16:24:39 -08:00
Dmitry Kovalev
14f2cf1757 Cleaning up joint_motion_search function.
Change-Id: I70a0878b23bda0ac3ff8733b4c96d5c636bc551c
2013-11-11 16:04:02 -08:00
Dmitry Kovalev
3551e25099 Moving {sb, mb, b, ab}_index from MACROBLOCKD to MACROBLOCK.
We use {sb, mb, b, ab}_index only inside encoder, so moving them into
appropriate data structure.

Change-Id: Ib5c1036716354d9d321e11a60c1634c1cb8f9716
2013-11-11 15:58:57 -08:00
Dmitry Kovalev
c53a9c70fb Merge "Localizing NEARESTMV special cases in the code." 2013-11-11 11:12:06 -08:00
Yaowu Xu
a4a5a210cb Disable zeroblock forcing for lossless coding mode
This to make sure that prediction residue always get coded in lossless
mode.

This commit also fixed lossless unit test

Change-Id: I537726ee55328d4e4cf0a0196393a67e12bfcde1
2013-11-08 10:32:44 -08:00
Dmitry Kovalev
4a96e64dc2 Using max_tx_size instead of bsize when possible.
Change-Id: I246364bc4270ca13aefb4bc3445bcf102b3170dc
2013-11-05 17:36:43 -08:00
Dmitry Kovalev
815189613b Localizing NEARESTMV special cases in the code.
Removing special case handling from vp9_tree_probs_from_distribution(),
tree_merge_probs(), and vp9_tokens_from_tree_offset() functions. Replacing
inter_mode_offset() function with macro INTER_OFFSET which is used now for
vp9_inter_mode_tree definition.

Change-Id: Iff75a1499d460beb949ece543389c8754deaf178
2013-11-05 11:58:57 -08:00
Jingning Han
f3efb9903c Merge "Fix the use case of plane_block_idx in sub8x8 RD" 2013-11-05 09:27:05 -08:00
Jingning Han
4fc8320f4c Merge "Avoid mv cost check for invalid mv values" 2013-11-05 09:01:05 -08:00
Jingning Han
c2217f2238 Avoid mv cost check for invalid mv values
The compound inter prediction could potentially run with initial
motion vectors of invalid value and check the mv_cost, which triggers
overheap read. This commit resolves this issue by forcing a motion
vector value check for compound inter modes of both superblock and
sub8x8 block sizes.

Change-Id: I4f4fc19ce83c8272782bc382f12c82a3f03212fc
2013-11-04 19:01:42 -08:00
Dmitry Kovalev
dde8069e57 Splitting partition_probs array into two arrays.
We only update partition_probs for inter frames but they are constant
for key frames. It is not necessary to have constants inside frame
context and copy them every time. This change reduces FRAME_CONTEXT size
by at least 48 bytes.


Change-Id: If70a53be51043f37fe7d113853217937710932a7
2013-11-04 14:26:16 -08:00
Jingning Han
4efa6a0176 Fix the use case of plane_block_idx in sub8x8 RD
This commit fixes the use case of plane_block_idx, which determines
the plane (Y/U/V) index based on block index. When block idx >= 4 in
sub8x8 block loop, it should be of chroma components.

Change-Id: I072705aa7b35445524ac607089ca8ce54b7ba478
2013-11-03 11:19:33 -08:00
Jingning Han
2de7cbe980 Add second ref frame check back in rdcost hist
Update best_inter_rd and best_inter_ref_frame only in single ref
frame case.

Change-Id: Id56825b231a62d6852bd83811410c05a7569f715
2013-11-03 09:15:41 -08:00
Dmitry Kovalev
0e1756330b Merge "Removing is_intra_mode() function." 2013-10-31 18:06:53 -07:00
Yunqing Wang
d03b3cbdd7 Merge "Fix x_offset_q4/y_offset_q4 calculation" 2013-10-31 09:47:54 -07:00
Jingning Han
a2a5c6f821 Merge "Enable all-zero coeff block index for sub8x8 blk" 2013-10-30 16:00:57 -07:00
Dmitry Kovalev
6761872e49 Replacing (SWITCHABLE_FILTERS + 1) with SWITCHABLE_FILTER_CONTEXTS.
Change-Id: I9781a62bc1a4cd9176554d1271d87dbcafda9cb0
2013-10-30 14:40:34 -07:00
Jingning Han
8c8381d543 Enable all-zero coeff block index for sub8x8 blk
This commit makes zcoeff_blk cache the case where the entire block
is quantized to be zero (without applying zero-forcing) in the rate-
distortion optimization loop, and skip the forward DCT, quantization,
inverse DCT, and reconstruction process in the encode_block stage.

It now works for all the block sizes, including sub8x8 blocks.

Change-Id: I5ae60a9c436ba3637d11666733554bec4580ef98
2013-10-30 14:01:06 -07:00
Yunqing Wang
9ed2d0a577 Fix x_offset_q4/y_offset_q4 calculation
"<< SUBPEL_BITS" needs to be added in the calculation. Call
set_scaled_offsets() to calculate x_offset_q4 and y_offset_q4.

Change-Id: Ied130ea771510e918f51cd1dc3abe57f4c0962b5
2013-10-29 17:46:55 -07:00
Dmitry Kovalev
e6dcf2aeb6 Fixing wrongly initialized tx_type variable.
Wrong value was used in get_tx_type_4x4() function, so making
initialization before that call.

Change-Id: Ief30bb1e0c03b2f23d993bbf9ae18d7150ba9a83
2013-10-29 12:18:53 -07:00
Dmitry Kovalev
aa76cd1e49 Removing is_intra_mode() function.
It is enough to check just block type: intra or inter. Intra block implies
intra prediction mode, and inter block implies inter mode.

Change-Id: I3cf98731a3935f670a3cd8e2b2443483eb944be4
2013-10-28 20:00:55 -07:00
Dmitry Kovalev
8253532c2d Cleaning up vp9_regular_quantize_b_4x4.
Passing scan & iscan as parameters, adding useful local variables.

Change-Id: Ia2a87906941db9557350d273669ce5c3cdb7235d
2013-10-28 14:28:28 -07:00
James Zern
58a0f6dbdd vp9: add TileInfo
replaces use of cur_tile_mi_(row|col)_(start|end) by VP9_COMMON, making
it less stateful and more reusable for parallel tile decoding

Change-Id: I1df09382b4567a0e5f4434825d47c79afe2399be
2013-10-28 20:54:43 +01:00
Dmitry Kovalev
710ca1fe36 Merge changes I1868fb75,I9ff504c6
* changes:
  Renaming INTERPOLATIONFILTERTYPE to INTERPOLATION_TYPE.
  Adding VP9_FRAME_MARKER constant.
2013-10-24 10:08:19 -07:00
Yunqing Wang
93ec31dff6 Merge "Improve scale_factors struct" 2013-10-24 09:13:41 -07:00
Dmitry Kovalev
ad867fe237 Renaming INTERPOLATIONFILTERTYPE to INTERPOLATION_TYPE.
Change-Id: I1868fb75ed88bfa65c1c2ca24677d65f2894d713
2013-10-23 17:45:52 -07:00
Jingning Han
ae0e747d6a Merge "Use inter mode flag in super_block_yrd" 2013-10-23 13:52:05 -07:00
Jingning Han
f3b31380fa Use inter mode flag in super_block_yrd
Use a flag variable to determine if coded in inter mode, thus avoiding
multiple inter mode checks in super_block_yrd.

Change-Id: I0ef998b2811c38e185a2e0583f0f636cee45d2cf
2013-10-23 11:18:23 -07:00
Yunqing Wang
175c313a12 Improve scale_factors struct
The ref's scale_factors are set at frame level, and then copied for
each partition block. Since the struct members are mostly constant,
this patch separated the constant and non-constant members, and
reduced struct copying. This gave 0.5% ~ 1.4% decoder speed gain.

Change-Id: I94043bf5a6995c8042da52e5c661818dfa6f6d4c
2013-10-22 13:10:22 -07:00
Dmitry Kovalev
ec414372e8 Removing quantize_b_4x4 function pointer.
The pointer was asigned only once with vp9_regular_quantize_b_4x4, calling
this function directly now. Also removing unused declarations:
  prototype_quantize_block
  prototype_quantize_block_pair
  prototype_quantize_mb
  vp9_regular_quantize_b_4x4_pair
  vp9_regular_quantize_b_8x8

Change-Id: I14325bc2f082336820671eafbc06126651b79f73
2013-10-22 13:09:36 -07:00
Dmitry Kovalev
9f09618bd4 Merge "Using stride (# of elements) instead of pitch (bytes) in fdct4x4." 2013-10-22 13:05:24 -07:00
Dmitry Kovalev
fa57135b2c Merge "Removing NUM_ prefix from constant names." 2013-10-22 11:34:28 -07:00
Jingning Han
c807949408 Prevent left_block_mode stepping into left tile
This commit uses left_available flag to decide if the left mode_info
struct is available for left_block_mode. As discussed with James
Zern (jzern@), this prevents the codec from fetching mode_info from
blocks in the left tile, which although effectively not used might
present concerns for multi-threaded tile decoding.

This is NOT a bit-stream change.

Change-Id: I1dc8cf1bcbf056688eee27c7bc5706ac4b4e0125
2013-10-22 09:02:41 -07:00
Dmitry Kovalev
190c2b4591 Using stride (# of elements) instead of pitch (bytes) in fdct4x4.
Just making fdct consistent with iht/idct/fht functions which all use
stride (# of elements) as input argument.

Change-Id: I0ba3c52513a5fdd194f1e7e2901092671398985b
2013-10-21 15:27:35 -07:00
Dmitry Kovalev
1e05c9a7e6 Merge "Cleanup: using cm variable instead of cpi->common." 2013-10-21 14:30:01 -07:00
Jingning Han
deb10ac6f9 Merge "Make memory alloc in pick_mode_context bsize aware" 2013-10-21 11:45:59 -07:00
Dmitry Kovalev
a698e52926 Cleanup: using cm variable instead of cpi->common.
Change-Id: Iab334b5fd51dfa7e7f29963f8bdc62fd7355e56d
2013-10-21 11:10:11 -07:00
Dmitry Kovalev
d1b65c6bda Moving allow_high_precision_mv from MACROBLOCKD to VP9_COMMON.
This value is a global frame-level flag, not a macroblock-level.

Change-Id: Ie8c5790a931150741c2167c00c3e3dd2cf26744d
2013-10-21 10:12:14 -07:00
Dmitry Kovalev
6d2a0da7a7 Removing NUM_ prefix from constant names.
Renames for consistency with other constants:
  NUM_FRAME_TYPES -> FRAME_TYPES
  NUM_PARTITION_CONTEXTS -> PARTITION_CONTEXTS

Change-Id: I3db30acb2868eb0a424237c831087b2e264ec47f
2013-10-18 17:44:19 -07:00
Yaowu Xu
db1045f2c0 Merge "Use lookup table to simplify logic" 2013-10-18 12:55:24 -07:00
Jingning Han
72033fcff8 Make memory alloc in pick_mode_context bsize aware
This commit makes the buffer allocation of zcoeff_blk array in
pick_mode_context block size aware. It calculates the number of
4x4 blocks in the partition and assigns the memory space accordingly.
This process (and the uninitialization) is done once for each encoding
pass. It allows memory copy of smaller buffer when possible.

For football at 600kbps, the runtimes improve by about 1%:
speed 1, 45961ms -> 45472ms
speed 2, 23863ms -> 23598ms

Change-Id: Id2ca24906fa89f46fa5fe742ec4b8efc2a61f877
2013-10-18 12:42:44 -07:00
Yaowu Xu
30d1ec38a7 Use lookup table to simplify logic
In deciding the transform size for a given block in a given TX_MODE.

Change-Id: I1467da09853e69cd320695a24c04e19a2f3d04fb
2013-10-17 14:54:16 -07:00
Dmitry Kovalev
2726f383cd Adding allow_hp as an argument to mv search functions.
Making this change in order to move allow_high_precision_mv field
from MACROBLOCKD structure to VP9_COMMON (because it is a frame level
flag).

Change-Id: I1d006ba36d938e0caf4d40fa051e2e38df9c1108
2013-10-17 14:02:04 -07:00
Guillaume Martres
7fd2561d64 Merge changes I6226456d,I97925178,I766c4b74
* changes:
  Use a separate MODE_INFO stream for each tile column
  Get rid of "this_mi", use "mi_8x8[0]" everywhere instead
  Make the static_segmentation feature work again
2013-10-16 17:05:39 -07:00
Guillaume Martres
acf0d56f0b Get rid of "this_mi", use "mi_8x8[0]" everywhere instead
The only case where they were intentionally pointing to different
structures was in mbgraph, and this didn't have the expected behavior
because both of these pointers are used interchangeably through the code

Change-Id: I979251782f90885fe962305bcc845bc05907f80c
2013-10-16 16:24:03 -07:00
Dmitry Kovalev
9deb614a57 Adding get_band_translate() function.
Moving code that gets band_translate array from get_scan_and_band()
function to get_band_translate() function. Renaming get_scan_and_band() to
get_scan().

Change-Id: I43047c205a1ca2a6e24be44db39dc04b7a385008
2013-10-16 15:11:42 -07:00
Guillaume Martres
e55f60240a Implement variance-based adaptive quantization
This should be similar to what x264 does with --aq-mode 1.
It works well with clips like parkjoy and touhou
(http://x264.nl/developers/Dark_Shikari/LosslessTouhou.mkv).
At low bitrates, the segmentation signaling overhead may negate the
benefits of this feature.

(PGW) Default changed to feature OFF to allow provisional merge.
Change-Id: I938abf9bb487e1d4ad3b0264ea03d9826275c70b
2013-10-16 11:55:13 +01:00
Alexander Voronov
d6a59fb12c Updated encoder to handle intra-only frames
Updated the encoder to handle frames that are coded
intra-only. Intra-only frames must be non-showable,
that is, the "show frame" flag must be set to 0 in
the frame header.

Tested by forcing the ARF frames to be coded intra-
only.

Note: The rate control code will need to be modified
to account for intra-only frames better than they
are currently handled.

Change-Id: I6a9dd5337deddcecc599d3a44a7431909ed21079
2013-10-15 16:44:02 -07:00
Jingning Han
3f52cfa130 Merge "Re-design all-zero-coeff block index buffer use" 2013-10-15 16:23:38 -07:00
Jingning Han
8e3ce1a9e3 Re-design all-zero-coeff block index buffer use
Use the zcoeff_blk buffer of PICK_MODE_CONTEXT to store the indexes
of all-zero-coeff block of the current best mode. Remove the temporary
buffer best_zcoeff_blk defined in the rate-distortion optimization
loop. This improves the speed performance by about 0.5% in all speed
settings.

Change-Id: Ie3e15988ddfa581eafa2e19a8228d3fe4a46095c
2013-10-15 10:54:06 -07:00
Jingning Han
a0d8ec7b76 Merge "Move token_cache from cost_coeffs to MACROBLOCK" 2013-10-14 13:05:32 -07:00
Jingning Han
f60a3910c4 Move token_cache from cost_coeffs to MACROBLOCK
This commit moves token_cache buffer into macroblock struct, instead
of defining as a local variable in cost_coeffs. This avoids repeatedly
re-allocating memory space in the rate-distortion optimization loop.

The runtime at speed 0 reduces:
bus 2000kbps, 161692ms to 159951ms
football 600kbps, 229505ms to 225821ms

Change-Id: If7da6b0b6d8c5138a16271a33c4548fba33d8840
2013-10-14 10:45:56 -07:00
Dmitry Kovalev
107897cf05 Merge "Consistent names for inverse hybrid transforms (1 of 2)." 2013-10-11 15:33:00 -07:00
Deb Mukherjee
c222b96bfd Merge "Change in rddiv parameter to make it a power of 2" 2013-10-11 13:53:59 -07:00
Dmitry Kovalev
7ef573914d Consistent names for inverse hybrid transforms (1 of 2).
Renames:
  vp9_short_iht4x4_add     -> vp9_iht4x4_16_add
  vp9_short_iht8x8_add     -> vp9_iht8x8_64_add
  vp9_short_iht16x16_add_c -> vp9_iht16x16_256_add

Change-Id: Ibca7a188fd062b196787ac5efc1ea545e7f166c0
2013-10-11 13:31:32 -07:00
Deb Mukherjee
d9655e42b8 Change in rddiv parameter to make it a power of 2
Converts the constant rddiv parameter to 128 (from 100) and
implements RDCOST with bit-shift rather than multiplication.
Other parameters are also adjusted to roughly keep the same
balance between Rate and Distortion.

There is a slight speed-up of about 0.5-1% (at speed 0) as
testted on football_cif.

There is a slight change in performance due to small change
in the parameters.
derfraw300: +0.033%
stdhdraw250; +0.102%

Change-Id: I70ac69f58fa71c83108f68fe41796cd19d1fc760
2013-10-11 10:43:02 -07:00
Yaowu Xu
8b175679be Masking intra mode choice adaptively
The commit changes to mask available intra prediction modes for test
based on prediction block size.

With this patch, encoding time of CpuUsed 2 reduces from 10% to 20% for
HD clips with a compression drop of 0.2%

Change-Id: I65f320f1237c0f5ae3a355bf7caf447f55625455
2013-10-11 10:29:53 -07:00
Jingning Han
54e702b5d7 Merge "Restore mode skip feature in sub8x8 rd loop" 2013-10-11 09:21:06 -07:00
Yaowu Xu
e2d6e37a54 Merge "change to avoid out-of-range computation" 2013-10-10 13:38:16 -07:00
Jingning Han
09aca3089f Merge "Re-design rate-distortion cost tracking buffers" 2013-10-10 12:57:31 -07:00
Jingning Han
fc19243ced Re-design rate-distortion cost tracking buffers
This commit re-designs the per transformed block rate-distortion
costs tracking buffers. It removes redundant buffer usage, makes
the needed context memory allocation per VP9_COMP instance and
reuses the same buffer sets inside the rate-distortion optimization
search loop, thereby avoiding repeatedly requiring memory space.

It reduces speed 0 runtime:

bus at 2000 kbps from 166763ms to 158967ms,
football at 600 kbps from 246614ms to 234257ms.

Both about 5% speed-up. Local tests suggest about 2% to 5% speed-up
for speed 1 and 2 settings. This does not change compression
performance.

Change-Id: I363514c5276b5cf9a38c7251088ffc6ab7f9a4c3
2013-10-10 11:03:44 -07:00