Commit Graph

309 Commits

Author SHA1 Message Date
Jim Bankoski
f47544745e Merge "Remove the resetting of qp params for temporal layers." 2012-07-27 21:22:15 -07:00
Marco Paniconi
ef4a9670a8 Remove the resetting of qp params for temporal layers.
The ambient qp and active worse/best qp were reset for every frame
when temporal layers is on. This change removes this reset.

As this affects the target size for forced key frames
(it will actually lower the size somewhat), we increased the
inital boost factor to compensate.

Change-Id: Ie38d95f5c99ab3d447469c49e2177bc3fcc4ad28
2012-07-27 17:27:32 -07:00
Attila Nagy
e66e9ddfb4 Optimizes updates of encoder block ptrs
Precalculated block ptrs do not need updates during encoding.
Set these at init stage.

Moved the allocation of 'mt_current_mb_col' (last encoded MB on each
row) to vp8_alloc_compressor_data(), so that it is correctly
reallocated when frame size is changing.

Change-Id: Idcdaa2d0cf3a7f782b7d888626b7cf22a4ffb5c1
2012-07-27 09:59:09 +03:00
Yunqing Wang
4066c8b205 multi-res: add drop_frame support
Added drop_frame support in multi-resolution encoder.

If one frame is dropped at a lower-resolution level, the next
upper-resolution level encoder needs to encode that frame
independently without any lower-resolution level motion
information.

Another issue is that if one frame is dropped at some but not all
resolution levels, a frame after that one may use different set
of reference frames at different resolution levels. This reference
frame asynchronization could degrade motion search precision in
upper-resolution level encoding, which uses lower-resolution level
motion result. This change compares the lower-resolution and upper-
resolution level's reference frames. If they are not the same, the
upper-resolution level encoder can not use lower-resolution level
motion result.

Change-Id: I61afa4f313630e75b7cbdd5742e230e8724a988a
2012-07-26 08:36:53 -07:00
Yunqing Wang
bb3d510a18 Merge "Remove goldfreq in VP8_COMP" 2012-07-10 09:19:37 -07:00
Yunqing Wang
e2c5e78ad9 Merge "Fix decimation_count in drop_frame" 2012-06-29 10:57:39 -07:00
Paul Wilkins
6fc1d9efc4 Merge "Fix segmentation updates with vp8_set_roimap()" 2012-06-20 10:34:28 -07:00
John Koleszar
6291dd4c2f Fix compilation with -werror
Fix a last few warnings with multithread, arm, 32 bit

Change-Id: Ic7c67616c370d0ff87562a232fb1e5df0702dc86
2012-06-20 09:43:42 -07:00
Paul Wilkins
7c32cb52b5 Fix segmentation updates with vp8_set_roimap()
Changes relating to Issue 411

Removed code that was clearing down the segmentation data each
frame.

Added range/parameter checking in vp8_set_roimap(); Return error
if called when cyclic_refresh is enabled.

Correct setup_features() so that it sets or clears the segment update
flags as appropriate.

Change-Id: Ib31ac53006640ddf1ba7b9ec8f8b952e3eff860a
2012-06-20 12:49:29 +01:00
Yunqing Wang
0ca0c4f6a0 Remove goldfreq in VP8_COMP
goldfreq can be replaced by DEFAULT_GF_INTERVAL.

Change-Id: I3659a9e7b9a6be9cb1952a1838e02c20d656e369
2012-06-12 11:57:26 -04:00
John Koleszar
0164a1cc5b Fix pedantic compiler warnings
Allows building the library with the gcc -pedantic option, for improved
portabilty. In particular, this commit removes usage of C99/C++ style
single-line comments and dynamic struct initializers. This is a
continuation of the work done in commit 97b766a46, which removed most
of these warnings for decode only builds.

Change-Id: Id453d9c1d9f44cc0381b10c3869fabb0184d5966
2012-06-11 15:14:58 -07:00
John Koleszar
71618e542c Merge "Reset Q for key frame when spatial resizing occurs." 2012-06-11 12:02:56 -07:00
Yunqing Wang
53d92e61cc Fix decimation_count in drop_frame
Frame dropping decision is made by evaluating both current frame
and next frame's buffer_level. If both buffer_levels are less
than drop_mark, next frame is dropped. When frame dropping is
over, namely, buffer_level becomes normal again, we need to
reset decimation_count to 0.

Change-Id: Iae182612e61e0da367fbd43afdc90738d975d1a3
2012-06-07 14:47:37 -04:00
Yunqing Wang
9904c28f5b Remove unused code in drop_frame
Removed unused parameters and code related to drop_frame.

Change-Id: I594e050d49b1805c6f72abf06005ef624256bb57
2012-06-07 11:26:47 -04:00
Marco Paniconi
baedcedcbe Reset Q for key frame when spatial resizing occurs.
The logic for spatial resizing is done after the Q is selected for the
frame. This causes a problem that the Q we select for the (resized)
key frame may be based on a different resolution than the frame we
will encode.

This fix is to ensure that, when resize is on, the selected Q is still
based on the resolution of the frame to be encoded.

Change-Id: Ia49a9eac5f64e48d1c00dfc7ed4ce26fe84d3fa1
2012-06-06 15:18:18 -07:00
Johann
965d8686bb Remove extra enum
VP8_REFFRAME is the same as vpx_ref_frame_type

Change-Id: I63c2ddfb39f6ec87d1e5eb6a8852846464552b1b
2012-06-04 16:56:55 -07:00
Jim Bankoski
f78e5a04e6 fix denoiser for temporal patterns and rd
This extends the denoiser to work for temporally scalable
coding.

I believe this also fixes a very rare but really bad bug in the original
implementation.

Change-Id: I8b3593a8c54b86eb76f785af1970935f7d56262a
2012-05-30 14:32:04 -07:00
Jim Bankoski
ffe79d61d4 Merge "fix denoiser for temporal patterns and rd" 2012-05-25 09:56:08 -07:00
John Koleszar
d708e7fbbe Merge "Fix another multithreaded encoder loopfilter race condition" 2012-05-24 09:40:48 -07:00
Jim Bankoski
57faddb7c5 fix denoiser for temporal patterns and rd
This extends the denoiser to work for temporally scalable
coding.

I believe this also fixes a very rare but really bad bug in the original
implementation.


Change-Id: I8b3593a8c54b86eb76f785af1970935f7d56262a
2012-05-24 07:44:03 -07:00
Attila Nagy
4890853010 Fix another multithreaded encoder loopfilter race condition
After a key frame encoding, the frame type could change while
filtering is still going on. Pass the frame type as parameter to the
loopfilter function and don't read it from common storage.

vp8cx_set_alt_lf_level has to be done before packing the stream.
Currently alt_lf_level is not used so there hasn't been any visible
problem here.

Change-Id: Ia114162158cd833c2b16e3b89303cc9c91f19165
2012-05-23 13:50:59 -07:00
John Koleszar
cf0970157d Fix memory leak in vpx_codec_enc_config_set()
Resolution changes in calls to vpx_codec_enc_config_set() would cause
a memory leak due to failing to release the lookahead and alt ref
buffers.

Change-Id: I48392ea25e71fe2760d60cfde3fb3874598cc85f
2012-05-23 12:59:40 -07:00
Attila Nagy
ea392d4714 Fix another multithreaded encoder loopfilter race condition
After a key frame encoding, the frame type could change while
filtering is still going on. Pass the frame type as parameter to the
loopfilter function and don't read it from common storage.

vp8cx_set_alt_lf_level has to be done before packing the stream.
Currently alt_lf_level is not used so there hasn't been any visible
problem here.

Change-Id: Ia114162158cd833c2b16e3b89303cc9c91f19165
2012-05-23 15:19:48 +03:00
Yunqing Wang
eb5b965b44 Merge "multi-res: force Key frame sychronization" 2012-05-22 08:00:12 -07:00
Yunqing Wang
65dd157c3c multi-res: force Key frame sychronization
In multi-resolution encoding, frame_type decision for each frame
is made by the lowest-resolution encoder. For all other higher-
resolution encoders, kf_mode is always set to VPX_KF_DISABLED,
and they are forced to use the same frame_type picked by the
lowest-resolution encoder.

Change-Id: Ic4d52ec65bbc012ca9c2d236210e28a295591eaf
2012-05-16 15:06:42 -04:00
Scott Graham
92963df086 fix warnings for building on win32
Change-Id: If6e11ba3d681e831d7d98662c0abdd2ac16b3811
2012-05-11 12:36:50 -07:00
John Koleszar
44d35f7b25 Merge branch 'origin/eider' into master
Conflicts:
	vp8/common/entropymode.c
	vp8/common/entropymode.h
	vp8/encoder/encodeframe.c
	vp8/vp8_cx_iface.c

Change-Id: I708b0f30449b9502b382e47b745d56f5ed2ce265
2012-05-11 10:51:05 -07:00
John Koleszar
14d827f44e fix vp8_ namespace issues
Make functions only referenced from one translation unit static. Other
symbols with extern linkage get a vp8/vpx prefix.

Change-Id: I928c7e0d0d36e89ac78cb54ff8bb28748727834f
2012-05-04 12:24:04 -07:00
John Koleszar
22f56b93e5 Formalize encodeframe.c forward delclarations
Change If4321cc5 fixed a bug caused by forward declarations not being
kept in sync across C files, resulting in a function call with the
wrong arguments. The commit moves the affected function declarations
into a header file, along with the other symbols from encodeframe.c
that were being sloppily shared.

Change-Id: I76a7b4c66d4fe175f9cbef7e52148655e4bb9ba1
2012-05-04 10:44:47 -07:00
Attila Nagy
f039a85fd8 Make global data const
Removes all runtime initialization of global data. This commit is a
squashed version of the following series cherry-picked from master.
This is necessary because of a change that was merged to the tester
that depends on the scaler being moved to the RTCD framework, which
is a worthwhile thing to include in Eider anyway.

  - a91b42f02 Makes all global data in entropy.c const
  - b35a0db0e Makes all global data in tokenize.c const
  - 441cac8ea Makes all mode token tables const
  - 5948a0210 Ports vpx_xcaler to new RTCD method
  - 317d4244c Makes all mode token tables const part 2

Change-Id: Ifeaea24df2b731e7c509fa6c6ef6891a374afc26
2012-05-04 10:42:21 -07:00
Attila Nagy
14c9fce8e4 Fix compiler warnings
Fix code for following warnings:
-Wimplicit-function-declaration
-Wuninitialized
-Wunused-but-set-variable
-Wunused-variable

Change-Id: I2be434f22fdecb903198e8b0711255b4c1a2947a
2012-05-02 10:57:57 +03:00
Attila Nagy
3939e85b26 Fix loopfilter race condition in multithreaded encoder
Race was introduced by https://gerrit.chromium.org/gerrit/15563.

If loopfilter related config params were changed between frames, or
after a KEY frame, there could be a mismatch between encoder's and
decoder's recontructed image. In worst case, when frame buffers are
reallocated because of a size change, the loopfilter could
do an invalid data access (segmentation fault).

Fixes:
Sync with the loopfilter before applying any encoder changes in
vp8_change_config().
Moved the loopfilter synching to the top of
encode_frame_to_data_rate() so that it's done before any alteration of
the encoder.

Change-Id: Ide5245d2a2aeed78752de750c0110bc4b46f5b7b
2012-04-25 14:26:02 +03:00
Attila Nagy
b41c17d625 Shares one set of RD costs tables between all encoding threads
RD costs were local to MACROBLOCK data and had to be copied all the
time to each thread's MACROBLOCK data. Tables moved to a common place
and only pointers are setup for each encoding thread.

vp8_cost_tokens() generates 'int' costs so changed all types to be
int (i.e. removed unsigned).

NOTE: Could do some more cleaning in vp8cx_init_mbrthread_data().

Change-Id: Ifa4de4c6286dffaca7ed3082041fe5af1345ddc0
2012-04-23 14:15:23 -04:00
Scott LaVarnway
11876faa11 Removed mcomp_filter_type
and replaced with use_bilinear_mc_filter.

Change-Id: Ie9e9f0bccca4ab7d3e23ae045aefed33536103ff
2012-04-23 13:23:21 -04:00
John Koleszar
8e858f90f3 vp8_change_config: don't force kf with spatial resampling
Look for changes in the codec's configured w/h instead of its active
w/h when forcing keyframes. Otherwise calls to vp8_change_config()
will force a keyframe when spatial resampling is active.

Change-Id: Ie0d20e70507004e714ad40b640aa5b434251eb32
2012-04-20 11:09:12 -07:00
Attila Nagy
5948a02106 Ports vpx_xcaler to new RTCD method
We can get rid of all remaining global initializers now:
 vp8_scale_machine_specific_config()
 vp8_initialize()
 vp8dx_initialize()

Change-Id: I2825cea5d1c01ad9f6c45df49a0f86d803bfeb69
2012-04-19 17:40:56 +03:00
Attila Nagy
441cac8ea6 Makes all mode token tables const
Mode token tabels precalculated in entropymode.c.
Removes vp8_initialize_common()as all common global data
is precalculated const now.

Change-Id: I9b2ccc883e4f618069e1bc180dad3a823394eb73
2012-04-19 15:46:02 +03:00
Attila Nagy
b35a0db0e7 Makes all global data in tokenize.c const
Removes all runtime initialization of global data in tokenize.c.
DCT token and cost tabels are pre-generated.

Second patch in a series to make sure code is reentrant.

Change-Id: Iab48b5fe290129823947b669413101f22a1bcac0
2012-04-17 15:38:05 +03:00
John Koleszar
21173e1999 correct alt-ref contribution to frame rate
When producing an invisible ARF, the time stamp counters aren't
updated since the last time stamp is seen by the codec twice. The
prior code was trapping this case with refresh_alt_ref, but this isn't
correct for other uses of the ARF. Instead, use the show_frame flag.

Change-Id: If67fff7c6c66a3606698e34e2fb5731f56b4a223
2012-04-16 12:23:33 -07:00
Deb Mukherjee
66ba79f5fb Miscellaneous changes in mfqe and postproc modules
Adds logic to disable mfqe for the first frame after a configuration
change such as change in resolution. Also adds some missing
if CONFIG_POSTPROC macro checks.

Change-Id: If29053dad50b676bd29189ab7f9fe250eb5d30b3
2012-03-22 09:55:07 -07:00
Yunqing Wang
bcee56bed5 Minor fix: add back a vpx_free call
Added back a vpx_free call that was mistakenly removed.

Change-Id: Ib662933a8697a4efb8534b5b9b762ee6c2777459
2012-03-21 14:09:33 -04:00
Yunqing Wang
9ed1b2f09e Merge "Add motion search skipping in first pass" 2012-03-16 14:02:51 -07:00
Yunqing Wang
6a819ce4fe Add motion search skipping in first pass
This change added a motion search skipping mechanism similar
to what we did in second pass. For a macroblock that is very
similar to the macroblock at same location on last frame,
we can set its mv to be zero, and skip motion search. This
improves first-pass performance for slide shows and video
conferencing clips with a slight PSNR loss.

Change-Id: Ic73f9ef5604270ddd6d433170091d20361dfe229
2012-03-16 15:59:00 -04:00
Scott LaVarnway
9aa2bd8a03 Merge "x_motion_minq table reduction" 2012-03-16 09:03:47 -07:00
Stefan Holmer
9c41143d66 Adds a motion compensated temporal denoiser to the encoder.
Some refactoring in rdopt.c and pickinter.c.

Change-Id: I4f50020eb3313c37f4d441d708fedcaf219d3038
2012-03-13 15:33:50 -07:00
Attila Nagy
52cf4dcaea Packing bitstream on-the-fly with delayed context updates
Produce the token partitions on-the-fly, while processing each MB.
Context is updated at the beginning of each frame based on the
previoud frame's counters. Optimally encoder outputs partitions in
separate buffers. For frame based output, partitions are concatenated
internally.

Limitations:
    - enabled just in combination with realtime-only mode
    - number of encoding threads has to be equal or less than the
    number of token partitions. For this reason, by default the encoder
    will do 8 token partitions.
    - vpxenc supports partition output (-P) just in combination with
    IVF output format (--ivf)

Performance:
    - Realtime encoder can be up to 13% faster (ARM) depending on the number
    of threads and bitrate settings. Constant gain over the 5-16 speed
    range.
    - Token buffer reduced from one frame to 8 MBs

Quality:
    - quality is affected by the delayed context updates. This again
    dependents on input material, speed and bitrate settings. For VC
    style input the loss seen is up to 0.2dB. If error-resilient=2
    mode is used than the effect of this change is negligible.

Example:
./configure --enable-realtime-only --enable-onthefly-bitpacking
./vpxenc --rt --end-usage=1 --fps=30000/1000 -w 640 -h 480
--target-bitrate=1000 --token-parts=3 --static-thresh=2000
--ivf -P -t 4 -o strm.ivf tanya_640x480.yuv

Change-Id: I127295cb85b835fc287e1c0201a67e378d025d76
2012-02-29 12:13:37 -05:00
James Berry
e2c6b05f9a bugfix: use oxcf width/height for reinit check
use oxcf instead of common in check to Reinit the
lookahead buffer if the frame size changes
prior behavior would cause assertion fail/crash

first observed in:
support changing resolution with vpx_codec_enc_config_set

Change-Id: Ib669916ca9b4f206d4cc3caab5107e49d39a36aa
2012-02-27 16:10:45 -05:00
Attila Nagy
78071b3b97 Multithreaded encoder, late sync loopfilter
Second shot at this...

Sync with loopfilter thread as late as possible, usually just at the
beginning of next frame encoding. This returns control to application
faster and allows a better multicore scaling.

When PSNR packets are generated the final filtered frame is needed
imediatly so we cannot delay the sync. Same has to be done when
internal frame is previewed.

Change-Id: I64e110c8b224dd967faefffd9c93dd8dbad4a5b5
2012-02-16 12:26:39 +02:00
Scott LaVarnway
768ae275dc x_motion_minq table reduction
Reduced by 4080 bytes.

Change-Id: I037b55bc9684bf4a54bce238be00e8c4db3f643e
2012-02-09 16:49:34 -05:00
John Koleszar
51acb01167 support changing resolution with vpx_codec_enc_config_set
Allow the application to change the frame size during encoding. This
is only supported when not using lagged compress.

Change-Id: I89b585d703d5fd728a9e3dedf997f1b595d0db0f
2012-02-07 17:09:40 -08:00