The System V ABI on x86-64 specifies that the al register contains an upper
bound of the number of arguments passed in vector registers when calling
variadic functions, so we aren't allowed to clobber it.
checkasm_fail_func() is a variadic function so also zero al before calling it.
Tested functions are internally kept in a binary search tree for efficient
lookups. The downside of the current implementation is that the tree quickly
becomes unbalanced which causes an unneccessary amount of comparisons between
nodes. Improve this by changing the tree into a self-balancing left-leaning
red-black tree with a worst case lookup/insertion time complexity of O(log n).
Significantly reduces the recursion depth and makes the tests run around 10%
faster overall. The relative performance improvement compared to the existing
non-balanced tree will also most likely increase as more tests are added.
This patch tweaks search_for_pns to be both more
aggressive and more careful when applying PNS. On
the one side, it will again try to use PNS on zero
(or effectively zero) bands. For this, both zeroes
and band_type have to be checked (some ZERO bands
aren't marked in zeroes). On the other side, a more
accurate rate-distortion measure avoids using PNS
where it would cause audible distortion.
Also fixed a small bug in the computation of freq
that caused PNS usage on low-frequency bands during
8-short windows. This allows re-enabling PNS during
8-short.
The sample position is made weird and non-nominal to force catching
such issues as default values or specialized operations hiding
issues in corner cases.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This patch modifies the encode frame function to
retry encoding the frame when the resulting bit count
is too far off target, but only adjusting lambda
in small, incremental step. It also makes the logic
more conservative - otherwise it will contend with
bit reservoir-related variations in bit allocation,
and result in artifacts when frame have to be truncated
(usually at high bit rates transitioning from low
complexity to high complexity).
The randomize_buffer() implementation assures that "most of the time",
we'll do a good mix of wide16/wide8/hev/regular/no filters for complete
code coverage. However, this is not mathematically assured because that
would make the code either much more complex, or much less random.
This patch refactors the AAC coders to reuse code
between the MIPS port and the regular, portable C code.
There were two main functions that had to use
hand-optimized versions of quantization code:
- search_for_quantizers_twoloop
- codebook_trellis_rate
Those two were split into their own template header
files so they can be inlined inside both the MIPS port
and the generic code. In each context, they'll link
to their specialized implementations, and thus be
optimized by the compiler.
This approach I believe is better than maintaining
several copies of each function. As past experience has
proven, having to keep those in sync was error prone.
In this way, they will remain in sync by default.
Also, an implementation of the dequantized output
argument for the optimized quantize_and_encode
functions is included in the patch. While the current
implementation of search_for_pred still isn't using
it, future iterations of main prediction probably will.
It should not imply any measurable performance hit while
not being used.
This introduces a slight timebase computation difference in zmbv-8bit
fate test. This is expected since the new options are double instead
of ints, and the additional precision skews the results in a non
meaningful way.
The recent commits change the value slightly. Even though it's
within the threshold it's better to risk as little as possible
especially when different systems, processors, FPUs and compilers
are involved.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit changes a few things about the noise substitution
logic:
- Brings back the quantization factor (reduced to 3) during
scalefactor index calculations.
- Rejects any zeroed bands. They should be inaudiable and it's
a waste transmitting the scalefactor indices for these.
- Uses swb_offsets instead of incrementing a 'start' with every
window group size.
- Rejects all PNS during short windows.
Overall improves quality. There was a plan to use the lfg system
to create the random numbers instead of using whatever the decoder
uses but for now this works fine. Entropy is far from important here.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit once again improves the PNS implementation by scaling the
thresholds with frequency. The thresholds get looser as the frequency
increases since higher frequencies are basically noise to human ears.
Also, this introduces quantization error correction for PNS. Should
the error be too much, no PNS will be used. The energy_ratio is used
to regulate the actual encoded PNS energy: if the generated PNS
energy is higher than the energy from the psy system, energy_ratio
is used to correct it so that hopefully once requantized and
transmitted the value in the decoder will be closer to what the
encoder has.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This was an oversight when the IS system was being first implemented.
The ener01 part was largely a result of trial and error and the fact
that the sum of coef0 and coef1 could result in a zero was
overlooked. Once ener01 turns to zero it's used to divide the left
channel energy which doesn't turn out so well as it fills IS[]
with -nan's and inf's which in turn confused the quantize_band_cost.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
FATE refs changed to accomodate for the new default behavior of the function.
Numbers are now interpreted as a channel layout, instead of a number of channels.
TNS had both IS and PNS switched on when it makes more sense
to have them both off.
Prediction had a redundant argument.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
IS and PNS increase quality a ton so as a result the PSNR changed.
Disable the extensions and keep the tests separate such that there
will be no red herrings if one test fails.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Without this fate-filter-join failes with
FF_API_GET_CHANNEL_LAYOUT_COMPAT disabled.
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This fixes fate with FF_API_LAVF_BITEXACT disabled.
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tests fails on some ARM builds but it's close enough so it's okay.
NEON, half-precision floats, rounding errors, who knows.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit introduces a test for AAC-Main prediction
which was just reworked in this series of commits.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Works only for flv, h263 and huffyuv decoders.
Makes only one pass through the file (this should be changed to two passes)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This fixes fate with FF_API_REQUEST_CHANNELS disabled.
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Works only with video stream.
First pass without seeking -- counts crcs of a frames and store it in an array.
After that it seeks a lot in different places and checks if crcs of these frames and crcs of frames in array are the same.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Now we no longer have to rely on function pointers intentionally
declared without specified argument types.
This makes it easier to support functions with floating point parameters
or return values as well as functions returning 64-bit values on 32-bit
architectures. It also avoids having to explicitly cast strides to
ptrdiff_t for example.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
If the return value doesn't fit in a single register rdx/edx can in some
cases be used in addition to rax/eax.
Doesn't affect any of the existing checkasm tests but might be useful later.
Also comment the relevant code a bit better.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
If the return value doesn't fit in a single register rdx/edx can in some
cases be used in addition to rax/eax.
Doesn't affect any of the existing checkasm tests but might be useful later.
Also comment the relevant code a bit better.
Now we no longer have to rely on function pointers intentionally
declared without specified argument types.
This makes it easier to support functions with floating point parameters
or return values as well as functions returning 64-bit values on 32-bit
architectures. It also avoids having to explicitly cast strides to
ptrdiff_t for example.
* commit '58c3720a3cc71142b5d48d8ccdc9213f9a66cd33':
fate: Make sure a corner-case for ASF is covered
Adjusted fate ref to match the different timebase of the ffasf demuxer
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
As suggested, posting the combined patch with the fate changes.
The patch sets the default style in ASS from the default style
information present in the movtext header.
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
FATE is non-interactive; it should not listen to user commands
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
This should fix leaving the terminal in a messed up state with
zsh in case of crashes during fate
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Compute individual stream durations in matroska muxer.
Write them as string tags in the same format as mkvmerge tool does.
Signed-off-by: Sasi Inguva <isasi@google.com>
* commit 'a0797950527120c85263c910eb6ba08fddcfdcb3':
fate/mp3: specify the number of output samples instead of filesize
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
* commit 'bf0cef5c3a114df452e5476167634dd8f51eb448':
checkasm: Include io.h for isatty, if available
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
configure does check for isatty, and checkasm properly checks
HAVE_ISATTY, but on some platforms (e.g. WinRT), io.h needs to be
included for isatty to be available.
Signed-off-by: Martin Storsjö <martin@martin.st>
Also replace custom tests for MD5 with those published in RFC 2202
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
Avoid clipping due to quantization noise to produce audible
artifacts, by detecting near-clipping signals and both attenuating
them a little and encoding escape-encoded bands (usually the
loudest) rounding towards zero instead of nearest, which tends to
decrease overall energy and thus clipping.
Currently fate tests measure numerical error so this change makes
tests using asynth (which are near clipping) report higher error
not less, because of window attenuation. Yet, they sound better,
not worse (albeit subtle, other samples aren't subtle at all).
Only measuring psychoacoustically weighted error would make for
a representative test, so that will be left for a future patch.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
The test file they use needs avdevice to be created
Probably fixes Ticket 4455
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* commit 'e605bf3b590d295f215fcc9fd58eb11be55b68cb':
checkasm: remove empty array initializer list in h264pred test
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
Fixes Ticket4664
The changed fate tests lack red/blue shades and thus look correct
either way
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* commit '82e6ac85ff9aa7631b8c01521b3d6b5ca0bc8014':
checkasm: test all architectures with optimisations
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
* commit '6cc4d3e9a982e926494f4b919d9733fe29774acf':
checkasm: exit with status 0 instead of 1 if there are no tests to perform
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
It provides the following features:
* verify correctness by comparing output to the C version.
* detect failure to save and restore clobbered callee-saved registers.
* detect 32-bit parameters being used as if they were 64-bit in x86-64
(the upper halves are not guaranteed to be zero - but in practice
they very often are, which makes those bugs hard to spot otherwise).
* easy benchmarking.
Compile by running 'make checkasm'.
Execute by running 'tests/checkasm/checkasm'.
Optional arguments are '--bench' to run benchmarks for all functions,
'--bench=<pattern>' to run benchmarks for all functions that starts with
<pattern>, and '<integer>' to seed the PRNG for reproducible results.
Contains unit tests for most h264pred functions to get started, more tests
can be added afterwards using those as a reference.
Loosely based on code from x264. Currently only supports x86 and x86-64,
but additional architectures shouldn't be too much of an obstacle to add.
Note that functions with floating point parameters or floating point
return values are not supported. Some compiler-specific features or
preprocessor hacks would likely be required to add support for that.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
* commit '02b7c630875c0bc63cee5ec597aa33baf9bf4e20':
h261: Signal freeze picture release for intra frames
Conflicts:
tests/ref/vsynth/vsynth1-h261
tests/ref/vsynth/vsynth2-h261
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Freeze picture release should be set to 1 when we're responding to a
fast update request. For simplicity we set it for all intra frames,
including those that starts a GOP.
Fixes issue where Tandberg MXP1700 does not recover from packet loss
state since it's waiting for the freeze picture relase indication.
Bug-Id: 873
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Ref H.261 recommendation section 4.2.1.3, setting the still image flag
to 1 disables still image mode. Some decoders require this in order to
decode the bitstream as normal video.
Fixes H.261 calls to Cisco E20.
Also, reserved (aka spare) bits should be set to 1 unless specified
otherwise.
Bug-Id: 872
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This change fixes a bug where a test that required a sample was being included
in the suite when SAMPLES was not set. It also improves the consistency of
variable names relating to the API tests.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'f91fe24e9bd6912c29bbb03d8afe878e045f9721':
g2meet: force simple idct for identical results over all fate configs
Conflicts:
tests/ref/fate/g2m3
tests/ref/fate/g2m4
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '4d1229dabf7a7e3b6a7b326afd79102256c3b008':
g2meet: Add FATE tests for all three G2M variants
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Most of the fate-dds-* and fate-txd-* tests already
output into the same pixel format regardless of
platform endianness, so there's no need to force
conversion to another format.
This fixes the tests fate-txd-16bpp, fate-txd-odd,
fate-dds-rgb16, fate-dds-rgb24 and fate-dds-xrgb on
big endian, where the tests seem to fail due to issues
with certain conversion codepaths in swscale.
Those conversion codepaths should of course be fixed, but
the individual decoder tests should use as little extra
conversion steps as possible.
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit '3ad678a85b96fc5fecd60e3d3a31ca5ffc89d67f':
fate: Update ac3 test to the new request_channel_layout option
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '441e8ae5efd681055e5af6f4317fb60110de9dd0':
FATE: drop the last truncated frame from the wmapro tests
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'd3ea79e8a65ddad4da11813bb43c46701295f68c':
FATE: drop the last truncated frame from the wma lossless test
Conflicts:
tests/fate/lossless-audio.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
The old one is the result of the reverse engineering and guesswork.
The new one has been written following the now-available specification.
This work is part of Outreach Program for Women Summer 2014 activities
for the Libav project.
The fate references had to be changed because the old demuxer truncates
the last frame in some cases, the new one handles it properly.
The seek-test reference is changed because seeking works differently
in the new demuxer. When seeking, the packet is not read from the stream
directly, but it is rather constructed by the demuxer. That is why
position is -1 now in the reference.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
The intention of this change is to allow separation of API tests from the
existing tests, and also to have a place for the API test source/executable
files so they're not mixed in with the actual library code.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Result differs in pkt_duration and time_base.den for some reason.
Right now it tests only one example (adjusted to match the output).
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Ideally this should be discarded by the demuxer but this is not
possible without fully parsing which would be then very similar
to this. The current ID3v1 discard code in the demuxer does not work
and will be removed in a subsequent commit
The discard code could be adjusted if needed to also discard tags at
other locations than the end or to limit this possibly to input
from the mp3 demuxer or even to move the discarding to the
decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'c0b105756f61d253bdabcc2bb49453a2557e7c3b':
txd: Use the TextureDSP module for decoding
Conflicts:
configure
libavcodec/s3tc.c
libavcodec/s3tc.h
libavcodec/txd.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Using the internal DXTC routines brings support for non multiple of 4
textures. A new test is added to cover this feature. Hashes differ
since the decoding algorithm is different, though no visual changes
have been spotted.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
thats how the specification defines it, this also improves numerical
accuracy of the integer wavelet implementation. It otherwise should
be equivalent, in case of overflows this can be reverted.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'c060d046aa2f89c0e601a2dcfbce53f0e36cf498':
af_resample: Set the number of samples in the last frame
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '6ec688e1bc76dd93151cbca1c340162ae4b10d77':
mp3: enable packed main_data decoding in MP4
Conflicts:
libavcodec/mpegaudiodec_template.c
Only the parts needed to support the available sample are merged
the remaining error checks are left in place
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Even if the jpeg2000 spec uses a wrong value this does not
make mathematics work this way, also this has been corrected in the 2004
version AFAIK
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
or if no rematrix and no resampling is performed and the input is 16bit
note reampling and rematrix itself always use more than 16bit internally
the "internal" sampling format is the format between these steps
Its unlikely the difference from this commit is audible in any case
unless there is some bug either before or after the change.
but multiple people prefer this and it slightly improves the precission
of computations.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This is almost certainly closer to how the actual Nintendo players work,
and fixes some output pops in files with blank ADPC/SEEK tables (like
those from brawlcustommusic).
14496-3 suggests packing main_data of MP3 that is usually scattered
into multiple frames due to bit reservoir.
However, after packing main_data into a access unit, bitrate index
in the MPEG audio frame header doesn't match with actual frame size.
In order to accept this, this patch removes unnecessary frame size
checking on mp3 decoder.
Also, mov demuxer was changed to use MP3 parser only on special cases
(QT MOV with specific sample description) to avoid re-packetizing.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* commit '063f7467e4d14ab7fe01b2845dab60cc75df8b53':
rtmpdh: Add fate test for the DH handshake routine
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Previous version Reviewed-by: tim nicholson <nichot20@yahoo.com>
Previous version Reviewed-by: Tomas Härdin <tomas.hardin@codemill.se>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The positioning was completely wrong. First, the coordinates are
expressed in ASS playback resolution (which is by default 384x288).
Secondly, the coordinates define a drawing rectangle, not a moving area.
The previous code was making subtitles move from a random position to
another random position.
Here we rescale assuming the video resolution is a DVD one (720x480). We
can't really do anything better so far, but since this positioning
information is often from a DVD rip we can consider them relatively
safe.
No real difference in quality, its a bit slower for the same dia_size as more
vectors are searched for the same dia_size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
AV_PIX_FMT_GRAY8/16 are considered YUV formats, and the color_range is
not set - so the API user will have to assume limitted range. (Unless
the API user adds a special-case for the PNG decoder.)
Just export the correct range - full range.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>