Commit Graph

881 Commits

Author SHA1 Message Date
Yunqing Wang
b1b6fd85db Merge "Skip the partition search for still frames" 2014-09-30 11:59:05 -07:00
Yunqing Wang
c8d01b1eaf Merge "Refactor encode_rd_sb_row function" 2014-09-30 11:58:39 -07:00
Yunqing Wang
1fcbf6ed56 Skip the partition search for still frames
This patch re-enabled the feature in Pengchong's patch
(commit 1286126073). Originally, it
was turned on while use_lastframe_partitioning > 0(not used anymore).
Now it was added as a feature, and turned on while speed >= 2.
As described in the original patch, this feature helps speed up the
slideshows in YouTube.

Change-Id: I1b0f18d65da1ee1c8d1e117dabba910c5207c471
2014-09-26 09:03:52 -07:00
Deb Mukherjee
993d10a217 Adds various high bit-depth encode functions
Change-Id: I6f67b171022bbc8199c6d674190b57f6bab1b62f
2014-09-25 01:50:36 -07:00
Yunqing Wang
14ee2805a3 Refactor encode_rd_sb_row function
Simplified the code and removed some code that was not used anymore.
This patch didn't change encoding result.

Change-Id: I7e54a74c8f35a6726dfc8a1c55b337448b7ea124
2014-09-24 10:24:18 -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
Yunqing Wang
1bf0beb5fc Refactor encode_superblock function
The code covers both x->skip=0 & x->skip=1 cases.

Change-Id: I09745c10e5994dc700ae4c01b4b62979cdaf3306
2014-09-12 15:58:17 -07:00
Yunqing Wang
f10d7eeda2 Remove the use of use_lastframe_partitioning at speed 4
The use of use_lastframe_partitioning is totally removed in good-
quality encoding. Its usage in real-time encoding needs to be
evaluated to see if it can be removed too.

The Borg tests at speed 4 showed:
stdhd set: 0.220% psnr gain, 0.166% ssim gain;
derf set:  0.329% psnr gain, 0.476% ssim gain.

Speed test on selected clips showed 1.54% speedup.(Worst case:
pedestrian_area_1080p25.y4m, speed loss: 1.5%)

Change-Id: I1c844d329b0b5678558439b887297c1be7ddab00
2014-09-09 10:54:07 -07:00
Yaowu Xu
c1058e5bbe select_tx_mode(): remove special case for key frame
This commit removes the special case for key frame, as transform size
decision is controlled by the appropriate speed feature for all lossy
coding modes: tx_size_search_method.

Change-Id: I9677171e3f2432ec23705f7c5ea8170dd4562fae
2014-09-03 09:34:10 -07:00
Yunqing Wang
4d2c376923 Early termination in encoding partition search
In the partition search, the encoder checks all possible
partitionings in the superblock's partition search tree.
This patch proposed a set of criteria for partition search
early termination, which effectively decided whether or
not to terminate the search in current branch based on the
"skippable" result of the quantized transform coefficients.
The "skippable" information was gathered during the
partition mode search, and no overhead calculations were
introduced.

This patch gives significant encoding speed gains without
sacrificing the quality.

Borg test results:
1. At speed 1,
   stdhd set: psnr: +0.074%, ssim: +0.093%;
   derf set:  psnr: -0.024%, ssim: +0.011%;
2. At speed 2,
   stdhd set: psnr: +0.033%, ssim: +0.100%;
   derf set:  psnr: -0.062%, ssim: +0.003%;
3. At speed 3,
   stdhd set: psnr: +0.060%, ssim: +0.190%;
   derf set:  psnr: -0.064%, ssim: -0.002%;
4. At speed 4,
   stdhd set: psnr: +0.070%, ssim: +0.143%;
   derf set:  psnr: -0.104%, ssim: +0.039%;

The speedup ranges from several percent to 60+%.
                 speed1    speed2    speed3    speed4
(1080p, 100f):
old_town_cross:  48.2%     23.9%     20.8%     16.5%
park_joy:        11.4%     17.8%     29.4%     18.2%
pedestrian_area: 10.7%      4.0%      4.2%      2.4%
(720p, 200f):
mobcal:          68.1%     36.3%     34.4%     17.7%
parkrun:         15.8%     24.2%     37.1%     16.8%
shields:         45.1%     32.8%     30.1%      9.6%
(cif, 300f)
bus:              3.7%     10.4%     14.0%      7.9%
deadline:        13.6%     14.8%     12.6%     10.9%
mobile:           5.3%     11.5%     14.7%     10.7%

Change-Id: I246c38fb952ad762ce5e365711235b605f470a66
2014-08-28 11:27:28 -07:00
Dmitry Kovalev
4478553efc Removing tx_stepdown_count from VP9_COMP.
The variable is never read.

Change-Id: I94141c1667fa5d10604cd6f83c5f64df107dee94
2014-08-25 14:42:05 -07:00
Dmitry Kovalev
e576c42f1b Cleaning up is_background().
Change-Id: I2b9609dd22bacbf26e669f70bf155613b0316eb3
2014-08-25 11:55:30 -07:00
Pengchong Jin
997db6fc3f Merge "Add a speed feature to give the tighter search range" 2014-08-15 19:51:04 -07:00
Pengchong Jin
eca93642e2 Add a speed feature to give the tighter search range
Add a speed feature to give the tighter partition search
range. Before partition search, calculate the histogram
of the partition sizes of the left, above and previous
co-located blocks of the current block. If the variance of
observed partition sizes is small enough, adjust the search
range around the mean partition size, which will be tigher.

The feature is currently turned on at speed 2. Experiments on
sample youtube clips show on average the runtime is reduced
by 3-7%.

For hard stdhd clips:
park_joy_1080p @ 15000kbps:       509251 ms -> 491953 ms (3.3%)
pedestrian_area_1080p @ 2000kbps: 223941 ms -> 214226 ms (4.3%)

The PSNR performance is changed:
derf: -0.112%
yt:   -0.099%
hd:   -0.090%
stdhd:-0.102%

Change-Id: Ie205ec5325bf92ec5676c243e30ba9d0adca10f2
2014-08-15 16:14:20 -07:00
Yunqing Wang
28b1437d77 Remove a unused speed feature
Removed disable_split_var_thresh, which is not used anymore.

Change-Id: I50119b150442e1571157433b5effc6aae0dbe0fd
2014-08-15 14:10:27 -07:00
Jingning Han
80e5550723 Merge "Remove redundant vp9_init_plane_quantizers call" 2014-08-14 18:50:16 -07:00
Jingning Han
d67b608c5d Remove redundant vp9_init_plane_quantizers call
When aq mode is on, the quantizer will be reset later in the same
function (line 571).

Change-Id: I20635db31261d136d04d5deeb881ad3957078bf1
2014-08-14 14:21:08 -07:00
Yaowu Xu
741a23cd97 Replace current_video_frame with better alternatives
In the encoder, current_video_frame is used in a couple of places to
decide encoding strategy, this commit replaces with more appropriate
variables.

Change-Id: I3d3d8d8e2ea02c489e4639b9d4c446a63e357d29
2014-08-13 17:19:34 -07:00
Yaowu Xu
b6a41802c4 Simplify select_tx_mode()
The function is called only once, right after all stats counters are
reset to 0. Therefore all the computations have zero effect on return
values. This commmit to removed those effectless code.

Change-Id: I50d27c0802547921fa36c60aa4bd92d76247f595
2014-08-13 11:48:29 -07:00
Jingning Han
5b63c2797a Merge "Integrate fast txfm and quant path into skip_recode system" 2014-08-11 08:53:34 -07:00
Jingning Han
9da4cd94f5 Merge "Extend skip_txfm flag into array to cover YUV planes" 2014-08-11 08:53:25 -07:00
Dmitry Kovalev
91c2f1e45a Moving pass from VP9_COMP to VP9EncoderConfig.
We had a very complicated way to initialize cpi->pass from
cfg->g_pass:
switch (cfg->g_pass) {
  case VPX_RC_ONE_PASS:
    oxcf->mode = ONE_PASS_GOOD;
    break;
  case VPX_RC_FIRST_PASS:
    oxcf->mode = TWO_PASS_FIRST;
    break;
  case VPX_RC_LAST_PASS:
    oxcf->mode = TWO_PASS_SECOND_BEST;
    break;
}

cpi->pass = get_pass(oxcf->mode).

Now pass is moved to VP9EncoderConfig and initialization is simple:
switch (cfg->g_pass) {
  case VPX_RC_ONE_PASS:
    oxcf->pass = 0;
    break;
  case VPX_RC_FIRST_PASS:
    oxcf->pass = 1;
    break;
  case VPX_RC_LAST_PASS:
    oxcf->pass = 2;
    break;
}

Change-Id: I8f582203a4575f5e39b071598484a8ad2b72e0d9
2014-08-08 14:27:54 -07:00
Dmitry Kovalev
2fe6fa72fc Merge "Cleaning up vp9_encodeframe.c." 2014-08-08 13:55:34 -07:00
Alex Converse
2a5c46d8f5 Fix active_map speed 6.
Fix the interaction between active map and reuse_inter_pred_sby. The
reuse_inter_pred_sby feature expects inter predictors to already be
built, but blocks with active map on skip this step.

Change-Id: Ibb2bf0d228f678935d82a0ede9cb0919ab7c8878
2014-08-07 15:57:58 -07:00
Alex Converse
e874aea74c Cleanup SEG_LVL_SKIP handling in encode_superblock.
Change-Id: Ib7497ba08696765cbc1b2cc4218d37f4298f278c
2014-08-07 15:57:58 -07:00
Dmitry Kovalev
b539705916 Cleaning up vp9_encodeframe.c.
Change-Id: Ia3001ae5c44faee3978fc3eb7a027cd9712a0373
2014-08-07 14:55:54 -07:00
Jingning Han
8684c23260 Integrate fast txfm and quant path into skip_recode system
This commit integrates the fast transform and quantization process
into skip_recode scheme in the rate-distortion optimization loop.
Previously the fast transform and quantization process was only
enabled for non-RD coding flow.

Change-Id: Ib7db4d39b7033f1495c75897271f769799198ba8
2014-08-06 16:11:22 -07:00
Pengchong Jin
74593c1eae Directly split the block in partition search
This patch allows the encoder to directly split the block
in partition search, therefore skip searching NONE. It
computes a score which measures whether 16x16 motion vectors
from the first pass in the current block are consistent with
each others. If they are inconsistent and we have enough Q
to encode, split the block directly, and skip searching NONE.

This feature is under flag CONFIG_FP_MB_STATS. In speed 2,
it further gives a speedup of 3-8% on sample yt clips as
compared to the previous version under the same flag. Overall,
the features under the flag will give 7-15% on typical yt
clips at up to 6000kbps data rate. The speedup at very high
data rate is not significant.

For hard stdhd clips:
park_joy_1080p @ 15000kbps:       504541ms -> 506293ms (-0.35%)
pedestrian_area_1080p @ 2000kbps: 326610ms -> 290090ms (+11.2%)

The compression performance using the features under the flag:
derf: -0.068%
yt:   -0.189%
hd:   -0.318%
stdhd:-0.183%

To use the feature, set CONFIG_FP_MB_STATS and turn on
cpi->use_fp_mb_stats.

Change-Id: Iad58a2966515c8861aa9eb211565b1864048d47f
2014-08-05 16:13:40 -07:00
Jingning Han
1a8d45f309 Extend skip_txfm flag into array to cover YUV planes
Change-Id: Ieae182d72d625d0d3fd4ed7c7d24cb521a0f21b0
2014-08-05 15:42:12 -07:00
Pengchong Jin
5971e8985b Merge "Store first pass motion vector directions" 2014-08-04 17:35:42 -07:00
Pengchong Jin
233e0ccc73 Store first pass motion vector directions
Re-organize the one-byte structure for 16x16 first pass
block. Add bits to indicate motion vector directions.

Change-Id: Id10754ba343dfc712c7fed5bcc85c67fa0bbcb89
2014-08-04 16:17:47 -07:00
Jim Bankoski
7f63dabfe9 break at the end of clauses with assert(0) to avoid gcc warning
Change-Id: I1b3c5337f018dde27dc819ab18bd081d169a91e8
2014-08-04 08:52:53 -07:00
Jingning Han
1c3a80b9a1 Skip calling vp9_block_energy when aq-mode is off
The mb_energy value is used by aq-mode. Turn off computing its
value when aq-mode is off.

Change-Id: I26c239f124eca45a5ee58b90d19eae00d9a7cda5
2014-07-31 11:51:59 -07:00
Jingning Han
a6a348b85e Merge "Refactor rd_pick_parition interface" 2014-07-31 09:25:34 -07:00
Jingning Han
a3b062c56f Merge "Chessboard pattern partition search" 2014-07-30 14:34:42 -07:00
Pengchong Jin
7f29d22e51 Merge "Early termination after partition NONE is done in RD." 2014-07-30 13:35:02 -07:00
Pengchong Jin
49866baae6 Early termination after partition NONE is done in RD.
This patch allows the encoder to skip the search for partition
SPLIT, HORZ, VERT after the search for partition NONE is done
in RD optimization. It uses the first pass block-wise statistics
to make the decision. If all 16x16 blocks in the current partition
have zero motions and small residues from the frist pass statistics,
and it has small difference variance, further partition search is
skipped.

For speed 2 setting, experiments on general youtube clips show that
the speedup varies from 1% - 10%, 5% on average. On the performance
side in PSNR, derf 0.004%, yt -0.059%, hd -0.106%, stdhd 0.032%.

For hard stdhd clips:
park_joy_1080p, 502952 ms -> 503307 ms (-0.07%)
pedestrian_area_1080p, 227049 ms -> 220531 ms (+3%)

This feature is under the compilation flag CONFIG_FP_MB_STATS and
it is off in current setting.

Change-Id: I554537e9242178263b65ebe14a04f9c221b58bae
2014-07-30 11:54:49 -07:00
Jingning Han
d82ff94284 Refactor rd_pick_parition interface
Remove the variable that indicates the relative block index. This
is explicitly covered by the use of pc_tree.

Change-Id: Ib13142582fff926c85e375bde656aa050add8350
2014-07-30 10:53:57 -07:00
Jingning Han
ca2dcb7fed Chessboard pattern partition search
This commit enables a chessboard pattern constrained partition
search for 720p and above resolutions. The scheme applies stricter
partition search to alternative blocks based on its above/left
neighboring blocks' partition range, as well as that of the
collocated blocks in the previous frame. It is currently turned
on at 16x16 block size level. The chessboard pattern is flipped
per coding frame.

The speed 3 runtime is reduced:
park_joy_1080p, 652832 ms -> 607738 ms (7% speed-up)
pedestrian_area_1080p, 215998 ms -> 200589 ms (8% speed-up)

The compression performance is changed:
hd     -0.223%
stdhd  -0.295%

Change-Id: I2d4d123ae89f7171562f618febb4d81789575b19
2014-07-30 10:32:41 -07:00
Jingning Han
6646ea73e2 Clean up max/min allowed block size in rd_pick_partition
This commit replace the repetitive retrieve of max and min allowed
partition from speed_feature with local variables max_size and
min_size.

Change-Id: Ib06f11f16615e4876e4dd5fb6a968c6bf5f7b216
2014-07-29 11:03:52 -07:00
Jingning Han
c36f78b054 Use frame index directly in get_chessboard_index
The get_chessboard_index() used to call the entire VP9_COMMON
struct pointer to retrieve the chessboard pattern index. This cl
makes it call the frame index directly.

Change-Id: I3cad9d209ea2e77a358085a04fe1ff0ddec5ba03
2014-07-29 10:55:56 -07:00
Jingning Han
ac1f06188d Merge "Fix rd_pick_partition search loop for 4x4 blocks" 2014-07-25 15:57:35 -07:00
Jingning Han
84af0486f9 Fix rd_pick_partition search loop for 4x4 blocks
The partition search for 4x4 blocks takes unnecessary steps to
reconstruct pixels and an extra partition type update. This commit
removes such operations. No visible compression/speed difference.
Thanks to Yue (yuec@) for finding this issue.

Change-Id: I3f83824aa3fd3717d63be0b280fa57258939a70a
2014-07-25 07:17:58 -07:00
Tim Kopp
9d337d34f2 s/CONFIG_DENOISING/CONFIG_VP9_TEMPORAL_DENOISING
This should prevent confusion with the VP8 CONFIG_TEMPORAL_DENOISING and other
flags.

Change-Id: I1fe4e2977895b7966841d861ab74317ad875b6c8
2014-07-24 13:43:52 -07:00
Adrian Grange
1f3c43e602 Merge "Fix get_frame_type function" 2014-07-22 15:17:27 -07:00
Adrian Grange
caad1686d4 Fix get_frame_type function
Fixed the function get_frame_type to return the correct
frame type for golden and last frames.

Change-Id: I8edddd9aa26cbe7a1de8ff211389410b22b1bd14
2014-07-22 12:12:16 -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
Pengchong Jin
ac638125ea Merge "Fixed a bug of setting wrong first pass mb stats pointer" 2014-07-17 14:24:52 -07:00
Pengchong Jin
e358ab5fc9 Fixed a bug of setting wrong first pass mb stats pointer
The bug sets the wrong pointer to the first pass mb stats
if the encoder does the re-coding in the second pass.

Change-Id: I8a11f45dd7dceb38de814adec24cecccae370d00
2014-07-17 12:04:15 -07:00