Commit Graph

65 Commits

Author SHA1 Message Date
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
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
Johann
c8a88a7642 Explicitly discard fwrite/fread return values
Using if(); triggers an empty body warning with clang

Change-Id: I0fa2ee676400a974b40f8eaafca9ae668107eebb
2012-06-04 15:50:44 -07:00
James Zern
1e1799c9cb examples: use alignment > 1 w/vpx_img_alloc
aligned buffers improve performace. this change brings vpxenc &
vp8_scalable_patterns in line with the other examples.

Change-Id: I4cf9f3e4728b901161905dd7ccb092e774ffb15f
2012-05-18 19:22:26 -07:00
Adrian Grange
faed00d844 Reset output frames counter for second pass
The frame counter was not being reset at the start of
the first pass.

Change-Id: I2ef7c6edf027e43f83f470c52cbcf95bf152e430
2012-04-27 15:14:50 -07:00
Ralph Giles
061a16d96e Have vpxenc use a default kf_max_rate of 5 seconds.
Rather than using the static default maximum keyframe spacing
provided by vpx_codec_enc_config_default() set the default
value to 5 times the frame rate. Five seconds is too long for
live streaming applications, but is a compromise between seek
efficiency and giving the encoder freedom to choose keyframe
locations.

The five second value is from James Zern's suggestion in
http://article.gmane.org/gmane.comp.multimedia.webm.user/2945

Change-Id: Ib7274dc248589c433c06e68ca07232e97f7ce17f
2012-04-25 17:11:05 -07:00
John Koleszar
1b27e93cd1 vpxenc: validate rational arguments
Trap negative values and zero denominators at the point where they're
parsed.

Change-Id: I1ec9da5d4e95d3ef539860883041330ecec2f345
2012-04-25 17:11:05 -07:00
James Berry
85ef83a173 bug fix: fix mem leak error in vpxenc
fixes memory leak bug in vpxenc.

Change-Id: I3933026d16177947576c61ebf58f8c58147e4ba0
2012-03-26 12:55:00 -04:00
Johann
87c40b35eb Fix encoder debug setting
Propagate debug setting to the EBML struct. When writing the application
name, this allows us to strip the version code and keep the output
metadata static.

Change-Id: I8e06c6abd743bedbff5af6242bbdae5d55754538
2012-03-01 16:12:53 -08:00
Scott LaVarnway
c34d91a84e Merge "Packing bitstream on-the-fly with delayed context updates" 2012-03-01 06:20:02 -08:00
Yunqing Wang
aabae97e57 vpxenc: fix time and fps calculation in 2-pass encoding
When we do 2-pass encoding, elapsed time is accumulated through
whole 2-pass process, which gives incorrect time and fps results
for second pass. This change fixed that by resetting the time
accumulator for second pass.

Change-Id: Ie6cbf0d0e66e6874e7071305e253c6267529cf20
2012-02-29 15:44:56 -05: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
John Koleszar
9e50ed7f27 vpxenc: initial implementation of multistream support
Add the ability to specify multiple output streams on the command line.
Streams are delimited by --, and most parameters inherit from previous
streams.

In this implementation, resizing streams is still not supported. It
does not make use of the new multistream support in the encoder either.
Two pass support runs all streams independently, though it's
theoretically possible that we could combine firstpass runs in the
future. The logic required for this is too tricky to do as part of this
initial implementation. This is mostly an effort to get the parameter
passing and independent streams working from the application's
perspective, and a later commit will add the rescaling and
multiresolution support.

Change-Id: Ibf18c2355f54189fc91952c734c899e5c072b3e0
2012-02-16 12:30:01 -08:00
John Koleszar
732cb9a643 vpxenc: factor out input open/close
Simplify some of the file I/O for later commits which will add multistream
support

Change-Id: Idf1a05f3a29c95331d0c4a6ea5960904e4897fd4
2012-02-16 12:30:00 -08:00
John Koleszar
c535025c12 vpxenc: add warning()/fatal() helpers
Cosmetic. Allows exiting with an error message without opening a new
scope.

Change-Id: If227b29b825f0241acea79dd38f19e524552ee18
2012-02-16 12:26:58 -08:00
John Koleszar
efd54f8f41 vpxenc: factor out global config options
This is a first step towards specifying multiple output streams
with one command line.

Change-Id: Iac784d3911bf553694d024bbd0c3d547261e914b
2012-02-15 16:11:35 -08:00
Fritz Koenig
c1c5932260 Remove duplicate line in parameter parsing.
resize_down_thresh was parsed and set twice.

Change-Id: I2685a6c3c825371f79ae94d305bcb50185a12dac
2012-01-17 17:11:32 -08:00
James Zern
b651875e24 squash some signed/unsigned comparison warnings
Change-Id: Ifc64cf990ae04d77934da3324d0afb3993f061e7
2011-12-21 13:49:19 -08:00
James Berry
16e101ba54 bugfix: all vpxenc arguments were not parsed under all conditions
dynamicly assign ARG_CTRL_CNT_MAX and
add check to make sure argument instance
doesnt already exist before creating a duplicate

Change-Id: I4f78a9c5346cda8e812cd89c077afe8996493508
2011-11-28 15:58:50 -05:00
James Zern
87953d115f vpxenc: use off64_t for mingw
fixes fseek errors on large files resulting in corrupt/truncated output
(issue #364).

Change-Id: If0e189a1591d0e95d7d237332e0bea1cf2ec5aa1
2011-11-09 15:38:55 -08:00
James Zern
e88f9e63ee vpxenc: fix crash w/empty input file
Fixes issue #362.

Change-Id: Iba6d7e49ed610b44c8a4c0f3d6330a93feb0373d
2011-11-01 13:44:00 -07:00
James Zern
efa17efced vpxenc: fix rollover in status output
sizeof(unsigned long)=4 in 32-bit builds

Change-Id: I81c9d698c80ffaa332214e5b43e98b4e30cf9e88
2011-10-18 17:34:10 -07:00
John Koleszar
fa3e530bca vpxenc: get version string programatically
To avoid a dependency on vpx_version.h, call the vpx_codec_version_str()
function and build up the string manually.

Change-Id: Ie650e9b8f2aaaffaa31da5e9ef3b566b972321b4
2011-09-22 13:25:34 -04:00
Lou Quillio
edfed938ba Sync vpxenc --timebase usage wording with docs change.
Change-Id: Ia406272a97806c0194435bb7f24e24d353ef5cc6
2011-08-02 09:57:50 -04:00
John Koleszar
1654ae9a2a Convert rc_max_intra_bitrate_pct to control
Since this is the only ABI incompatible change since the last release,
convert it to use the control interface instead. The member of the
configuration struct is replaced with the VP8E_SET_MAX_INTRA_BITRATE_PCT
control.

More significant API changes were expected to be forthcoming when this
control was first introduced, and while they continue to be expected,
it's not worth breaking compatibility for only this change.

Change-Id: I799d8dbe24c8bc9c241e0b7743b2b64f81327d59
2011-07-28 09:17:35 -04:00
James Zern
3a975d9489 vpxenc: cosmetics: timebase help update / spelling
The timebase update fixes Issue #61.

Change-Id: I425158da7ea639464f61e6dd604ac9e6c72b7266
2011-07-26 17:27:01 -07:00
James Zern
b45065d38b cosmetics: consistently use [u]int64_t
Removes mixed usage of (unsigned) long long and INT64.
Fixes Issue #208.

Change-Id: I220d3ed5ce4bb1280cd38bb3715f208ce23cf83a
2011-07-26 11:34:36 -07:00
John Koleszar
da39e505dd Merge "Fixed rate histogram calculation" 2011-07-18 06:07:51 -07:00
Tero Rintaluoma
fd41cb8491 Fixed rate histogram calculation
Using small values for --buf-sz= in command line causes
floating point exception due to division by zero.

Change-Id: Ibfe2d44db922993a78ebc9a4a1087d9625de48ae
2011-07-18 10:35:05 +03:00
Yunqing Wang
c156a68d06 Fix vpxenc encoding incorrect webm file header on big endian machines(Issue 331)
As reported in issue 331, vpxenc encoded incorrect webm file header
on big endian machines. This change fixed that.

Change-Id: I31924ebd476a87f3e88b9b5424540bf781d2b86f
2011-07-12 14:49:57 -04:00
John Koleszar
034cea5e72 Merge "guard against space/time distortion" 2011-06-29 11:36:51 -07:00
Johann
bb0ca87a0d guard against space/time distortion
and divide by 0 errors

Change-Id: I8af5ca3d0913cb6f278fff754f8772bcb62e674a
2011-06-29 14:34:25 -04:00
John Koleszar
05239f0c41 vpxenc: prevent wraparound in the --rate-hist ringbuffer
For clips that are near 60fps and have a lot of alt refs, it's possible
that the ring buffer holding the previous frames sizes/pts could wrap
around, leading to a division by zero.

In addition to checking for this condition in the ring buffer loop,
the buffer size is made dependent on the actual frame rate in use,
rather than defaulting to 60, which should improve accuracy at frame
rates >= ~60.

Change-Id: If5a04d6e847316dc5f7504f25c01164cf9332be8
2011-06-29 10:30:19 -04:00
James Zern
db6ee54353 vpxenc: free resources
Free buffers allocated for y4m input and webm cue list.

Change-Id: I02051baae3b45f692cf5c7f520ea9a2d80c7b470
2011-06-28 12:10:24 -07:00
John Koleszar
c96f8e238d vpxenc: add rate histogram display
Add the --rate-hist=n option, which displays a histogram with n
buckets for the rate over the --buf-sz window.

Change-Id: I2807b5a1525c7972e9ba40839b37e92b23ceffaf
2011-06-23 10:22:44 -04:00
John Koleszar
3fde9964ce vpxenc: add quantizer histogram display
Add the --q-hist=n option, which displays a histogram with n buckets for
the quantizer selected on each frame.

Change-Id: I59b020c26b0acae0b938685081d9932bd98df5c9
2011-06-23 10:22:43 -04:00
Fritz Koenig
00fdb135a7 vpxenc: remove duplicate --fps from vpxenc usage message
Fixes issue #323

Change-Id: I41c297df37afe186a8425ed2e2a95032069dcb9a
2011-04-27 11:27:59 -07:00
John Koleszar
ef86bad0d1 Merge "Stereo 3D format support for vpxenc" 2011-04-25 10:48:44 -07:00
John Koleszar
aa926fbd27 Add rc_max_intra_bitrate_pct control
Adds a control to limit the maximum size of a keyframe, as a function of
the per-frame bitrate. See this thread[1] for more detailed discussion:

[1]: http://groups.google.com/a/webmproject.org/group/codec-devel/browse_thread/thread/271b944a5e47ca38

Change-Id: I7337707642eb8041d1e593efc2edfdf66db02a94
2011-04-25 13:47:14 -04:00
Alok Ahuja
72c76ca256 Stereo 3D format support for vpxenc
Create a new input parameter to allow specifying
the packed frame stereo 3d format. A default value
of mono will be written in the absence of user
specified input

Change-Id: I576d9952ab5d7e2076fbf1b282016a9a1baaa103
2011-04-25 07:21:51 -07:00
Johann
f64f425a50 remove executable bit
source files are not executable

Change-Id: Id2c7294695a22217468426423979f68f02d82340
2011-04-15 13:43:24 -04:00
John Koleszar
26b6a3b088 vpxenc: die on realloc failures
Identified as a possible cause of issue #308, the code was silently
ignoring realloc failures, which would lead to corruption, memory
leaks, and likely a crash. The best we can do in this case is die
gracefully.

Change-Id: Ie5f6a853d367015be5b9712bd742778f3baeefd9
2011-03-30 06:37:02 -04:00
John Koleszar
500fec2d5f Allow specifying --end-usage by enum name
Map an enum to the --end-usage values, so you can specify
--end-usage=cq instead of --end-usage=2. The numerical values still
work for historical scripts, etc, but this is more user friendly.

Change-Id: I445ecd9638f801f5924a71eabf449bee293cdd34
2011-03-21 07:50:42 -04:00
Ralph Giles
fe9a604b1e Fix format-string warning
Cast size_t to (unsigned long) and print it with the %lu format
string, which is more portable than C99's explict %zu for size_t.

This truncates on Windows x64 but otherwise works on 32 and 64 bit
platforms. In practice the stats file is unlikely to be so large.

Change-Id: I0432b3acf85fc6ba4ad50640942e1ca4614b21cb
2011-03-07 13:21:39 -08:00
Tero Rintaluoma
11a222f5d9 Adds "armvX-none-rvct" targets
Adds following targets to configure script to support RVCT compilation
without operating system support (for Profiler or bare metal images).
 - armv5te-none-rvct
 - armv6-none-rvct
 - armv7-none-rvct

To strip OS specific parts from the code "os_support"-config was added
to script and CONFIG_OS_SUPPORT flag is used in the code to exclude OS
specific parts such as OS specific includes and function calls for
timers and threads etc. This was done to enable RVCT compilation for
profiling purposes or running the image on bare metal target with
Lauterbach.

Removed separate AREA directives for READONLY data in armv6 and neon
assembly files to fix the RVCT compilation. Otherwise
"ldr <reg>, =label" syntax would have been needed to prevent linker
errors. This syntax is not supported by older gnu assemblers.

Change-Id: I14f4c68529e8c27397502fbc3010a54e505ddb43
2011-01-28 12:47:39 +02:00
Paul Wilkins
e0846c9c8c CQ Mode
The merge includes hooks to for CQ mode and other code
changes merged from the test branch.

CQ mode attempts to maintain a more stable quantizer within a clip
whilst also trying to adhere to a guidline maximum bitrate.

The existing target data rate parameter is used to specify the
guideline maximum bitrate.

A new parameter allows the user to specify a target CQ level.

For normal (non kf/gf/arf) frames, the quantizer will not drop BELOW the
user specified value (0-63). However, in some cases the encoder may
choose to impose a target CQ that is above that specified by the user,
if it estimates that consistent use of the target value is not compatible
with guideline maximum bitrate.

Change-Id: I2221f9eecae8cc3c431d36caf83503941b25e4c1
2011-01-07 18:46:29 +00:00
James Berry
74e8446e58 vpxenc stats_close() memleak fix
stats_close() was not freeing memory for
single pass runs.  It now takes in arg_passes
to determine when it should free memory.

Change-Id: I6623b7e30b76f9bf2e16008490f9b20484d03f31
2010-12-23 14:47:56 -05:00
John Koleszar
b0da9b399d Add psnr/ssim tuning option
Add a new encoder control, VP8E_SET_TUNING, to allow the application
to inform the encoder that the material will benefit from certain
tuning. Expose this control as the --tune option to vpxenc. The args
helper is expanded to support enumerated arguments by name or value.

Two tunings are provided by this patch, PSNR (default) and SSIM.
Activity masking is made dependent on setting --tune=ssim, as the
current implementation hurts speed (10%) and PSNR (2.7% avg,
10% peak) too much for it to be a default yet.

Change-Id: I110d969381c4805347ff5a0ffaf1a14ca1965257
2010-12-17 10:01:05 -05:00
James Berry
136bd2455e fixed vpxenc bug where ivf files would be read incorrectly
read_frame would incorrectly insert detect->buf into img
for ivf files.  detect->position now set to 4 if input file is
detected to be ivf in file_is_ivf to keep this from occuring.

Change-Id: I5e235dd3033985bc62707a35c13af5984620208e
2010-12-13 14:40:18 -05:00
Pascal Massimino
fd9f9dc054 allow dimensions as low as 1 pixel
remove warning comment in vpxenc.c: in case of 1x1 picture,
detect_bytes will be equal to '3' and we'll fall back to
RAW_TYPE.
fix read_frame() by tracking the pre-read buffer length
in the struct detect

Change-Id: If1ed86ee5260dcdbc8f9d10da6cbb84a4cc2f151
2010-11-24 16:44:33 -08:00