Commit Graph

123 Commits

Author SHA1 Message Date
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Ronald S. Bultje 774b681b80 rv34: remove inline keyword from rv34_decode_block().
Force-inlining increases object size by 8kB and causes a 2% slowdown.
2012-04-28 11:10:57 -07:00
Christophe Gisquet 0195ab5f5f rv40: change a logical test into a bitwise one.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-04-28 11:09:32 -07:00
Christophe Gisquet 8802799991 rv34: remove constant parameter
is_block2 was always 0, so just remove it, and change accordingly the code.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-04-28 11:07:50 -07:00
Christophe GISQUET 272b252c01 rv40dsp: implement prescaled versions for biweight.
Quite often, the original weights are multiple of 512. By prescaling them
by 1/512 when they are computed (once per frame), no intermediate shifting
is needed, and no prescaling on each call either.

The x86 code already used that trick.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-04-10 10:06:48 -07:00
Diego Biurrun a92be9b856 Replace memset(0) by zero initializations.
Also remove one pointless zero initialization in rangecoder.c.
2012-03-28 09:38:33 +02:00
Ronald S. Bultje 5484170ac7 rv34: set mb_num_left to 0 after finishing a frame
Prevents running error resilience on a previous frame which will write
to the pic->mb_type[] array of the previous image. The array might
already be re-used for a new image in a subsequent thread, thus cause
two threads to write to the same pic->mb_type[] array, causing a race
condition which can crash in rv34_decode_cbp(), called by
rv34_decode_inter_mb_header() (which accesses mb_type[] twice,
assuming values are maintained, which the race condition breaks).

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-26 16:39:01 -07:00
Janne Grunau cb7190cd2c rv34: error out on size changes with frame threading 2012-03-23 23:11:55 +01:00
Janne Grunau 73ad4471a4 rv34: Handle only complete frames in frame-mt.
Correct handling of errors to prevent hags or crashes is very complex
otherwise.

The frame initializing is also moved from decode_slice() to
decode_frame() for clarity.
2012-03-23 17:50:46 +01:00
Christophe GISQUET 294c05ce8a rv34: remove dead code in intra availability check
This was an incorrect copy-and-paste to a code not needing the original code.
Spotted by Jason in a previous review but forgotten in the commit.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-03-07 10:29:52 -08:00
Christophe GISQUET 7104c23bd1 rv34: clean a bit availability checks.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-03-07 10:29:52 -08:00
Diego Biurrun 324deaa268 Replace AVFrame pointer type punning by proper struct member assignments. 2012-03-01 23:11:13 +01:00
Martin Storsjö efd29844eb mpegvideo: Add ff_ prefix to nonstatic functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:07:23 +02:00
Martin Storsjö e96b4a53df vlc/rl: Add ff_ prefix to the nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:26 +02:00
Janne Grunau 2bd730010d rv34: handle size changes during frame multithreading
Factors all context dynamic memory handling to its own functions.
Fixes bug 220.
2012-02-14 14:46:11 +01:00
Janne Grunau 29330721b0 rv34: use AVERROR return values in ff_rv34_decode_frame()
Also adds an error message.
2012-02-14 14:42:55 +01:00
Christophe GISQUET 9ba9c34024 rv34: 1-pass inter MB reconstruction
Implement 1-pass inverse transform and reconstruction for inter blocks.
2012-01-16 19:26:41 +01:00
Christophe GISQUET d78062386e rv34: Intra 16x16 handling
Extract processing of intra 16x16 blocks from intra macroblock
processing.
Also implement a function performing inverse transform and block
reconstruction for DC-only blocks in 1 pass instead of 2.
2012-01-16 00:41:51 +01:00
Christophe GISQUET 3eeb755763 rv34: Inter/intra MB code split
Split inter/intra macroblock handling code. This will allow further
optimizations such as performing inverse transform and block reconstruction
in a single pass as well as specialize code.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2012-01-16 00:41:51 +01:00
Janne Grunau 3547f8e8f8 rv34: fix and optimise frame dependency checking
The sporadic threading errors during fate-rv30 were caused by calling
ff_thread_await_progress with mb row -1 as argument. That returns
immediately since progress is initialized to -1. Not yet computed
motion vectors from the reference could be used for the first
macroblocks.
2012-01-12 18:38:08 +01:00
Christophe GISQUET 3faa303a47 rv34: DC-only inverse transform
When decoding coefficients, detect whether the block is DC-only, and take
advantage of this knowledge to perform DC-only inverse transform.

This is achieved by:
- first, changing the 108x4 element modulo_three_table into a 108 element
  table (kind of base4), and accessing each value using mask and shifts.
- then, checking low bits for 0 (as they represent the presence of higher
  frequency coefficients)

Also provide x86 SIMD code for the DC-only inverse transform.

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
2012-01-12 09:52:33 +01:00
Janne Grunau 9472d37d8e rv34: frame-level multi-threading
Statistics for bourne.rmvb -an -f null

1 thread:  37.12s user 0.03s system  99% cpu 37.174 total
2 threads: 47.63s user 0.24s system 185% cpu 25.807 total
4 threads: 41.21s user 0.30s system 327% cpu 12.674 total
2012-01-10 22:51:56 +01:00
Janne Grunau e652cc9606 rv34: use get_bits_left()
It is not necessary to store the bit stream length in a RV34DecContext
field.
2012-01-10 16:58:53 +01:00
John Brooks aacf6b3a2f rv34: fix invalid memory access for small video dimensions
For small video dimensions calculations of the upper bound for pixel
access may result in negative value. Using an unsigned comparison
works only if the greater operand is non-negative. This is fixed by
doing edge emulation explicitly for such conditions.

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
2012-01-04 10:32:23 +01:00
Christophe GISQUET 98f24ecd6c rv34: joint coefficient decoding and dequantization
Perform dequantization while decoding coefficients instead of performing it
on the entire coefficients buffer.

Since quantized coefficients are very sparse, this usually causes a small
speedup. Speedup of around 1% on Panda board compared to the removed here
neon code. Global speedup is probably around 3%.

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
2012-01-04 10:30:01 +01:00
Luca Barbato 63ccd46687 lavc: introduce ER_MB_END and ER_MB_ERROR
Simplify a little error resilience calls

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-12-13 16:20:58 +01:00
Luca Barbato 5bf2ac2b37 error_resilience: use the ER_ namespace
Add the namespace to {AC_,DC_,MV_}{END,ERROR} macros

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-12-13 16:20:58 +01:00
Mans Rullgard 40901fc14e rv34: move 4x4 dequant to RV34DSPContext
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-13 12:05:34 +00:00
Mans Rullgard 37fed0e635 rv34: align temporary block of "dct" coefs
This is needed for optimised transforms.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-01 14:29:29 +00:00
Mans Rullgard 171ec81223 rv34: fix signed multiplication overflow
Multiply by unsigned 0x01010101 to replicate bytes into 32-bit
word.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-11-26 18:49:51 +00:00
Baptiste Coudurier 76741b0e56 h264: 4:2:2 intra decoding support
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-10-21 01:00:41 -07:00
Janne Grunau 1bca8f4bc5 rv34: move inverse transform functions to DSP context 2011-10-12 15:52:22 +02:00
Laurent Aimar fe476e5a9b rv34: Check for invalid slices offsets
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-22 10:35:06 +03:00
Laurent Aimar 4cc7732386 rv34: Check for invalid slice offsets
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-20 10:29:55 +03:00
Laurent Aimar b4ed3d78cb rv34: Fix potential overreads
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-19 15:44:22 +03:00
Laurent Aimar d2213b6493 rv34: Fix buffer size used for MC of B frames after a resolution change
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-19 15:44:22 +03:00
Laurent Aimar d0f6ab0298 rv34: Avoid NULL dereference on corrupted bitstream
rv34_decode_slice() can return without allocating any pictures.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-19 15:44:22 +03:00
Laurent Aimar b59efc9434 Fixed size given to init_get_bits().
init_get_bits() takes a number of bits and not a number of bytes as
its size argument.

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2011-09-15 13:23:04 -07:00
Kostya Shishkov 23a1f0c592 rv34: check that subsequent slices have the same type as first one.
This prevents some crashes when corrupted bitstream reports e.g. P-type
slice in I-frame. Official RealVideo decoder demands all slices to be
of the same type too.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-12 15:51:30 +02:00
Kostya Shishkov 78622ef362 rv34: free+allocate buffer instead of reallocating it to preserve alignment
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-08-12 13:49:25 -07:00
Kostya Shishkov b86ab38137 Add weighted motion compensation for RV40 B-frames
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-08-11 16:07:58 -07:00
Kostya Shishkov e5ec68699e RV3/4: calculate B-frame motion weights once per frame
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-08-11 16:07:23 -07:00
Kostya Shishkov d241f51e0f Move RV3/4-specific DSP functions into their own context
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-08-11 16:07:15 -07:00
Kostya Shishkov 7351eb1415 Pretty-print RV3/4 decoder source
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-08-09 12:06:38 +02:00
Kostya Shishkov 6f7fe4723b Correct chroma vector calculation for RealVideo 3.
Old version divided it wrong, which resulted in chroma drift (visible on FATE
sample too as dirty trails left by clouds).

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-08-02 08:23:47 -07:00
Diego Biurrun 657ccb5ac7 Eliminate FF_COMMON_FRAME macro.
FF_COMMON_FRAME holds the contents of the AVFrame structure and is also copied
to struct Picture.  Replace by an embedded AVFrame structure in struct Picture.
2011-07-11 00:19:00 +02:00
Diego Biurrun e589e4b82d Remove unused static tables and static inline functions. 2011-07-04 14:59:35 +02:00
Reinhard Tartler 21a19b7912 doxygen: Prefer member groups over grouping into modules
Before this, almost all module groups have been used for grouping functions
and fields in structures semantically. This causes them to not appear
properly in the file documentation and needlessly clutters up the "Modules"
index.

Additionally, this commit streamlines some spelling and appearances.
2011-07-02 13:52:29 +02:00
Oskar Arvidsson 19a0729b4c Adds 8-, 9- and 10-bit versions of some of the functions used by the h264 decoder.
This patch lets e.g. dsputil_init chose dsp functions with respect to
the bit depth to decode. The naming scheme of bit depth dependent
functions is <base name>_<bit depth>[_<prefix>] (i.e. the old
clear_blocks_c is now named clear_blocks_8_c).

Note: Some of the functions for high bit depth is not dependent on the
bit depth, but only on the pixel size. This leaves some room for
optimizing binary size.

Preparatory patch for high bit depth h264 decoding support.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-05-10 07:24:36 -04:00
Stefano Sabatini 975a1447f7 Replace deprecated FF_*_TYPE symbols with AV_PICTURE_TYPE_*.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-02 12:18:44 +02:00