Commit Graph

2448 Commits

Author SHA1 Message Date
Anton Khirnov 2644a5d418 lavc: remove tests/options
It tests deprecated avcodec_copy_context().
2021-03-08 09:29:50 +01:00
Jan Ekström 18713d22a2 avcodec: add TTML encoder
Enables encoding of other subtitle formats into TTML paragraphs.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-03-05 19:45:00 +02:00
Paul B Mahol 6b43e1a86c avcodec: add SGA Video decoder 2021-03-01 17:36:42 +01:00
Paul B Mahol 5111707df6 avcodec: add SGA PCM decoder 2021-03-01 17:36:16 +01:00
Anton Khirnov 3a5b857d4c lavc: split LSCR decoder out of PNG decoder
It shares very little code with pngdec, so keeping them together only
makes the code harder to read.
2021-02-24 17:16:46 +01:00
Paul B Mahol d69f4be1c6 avcodec/cfhdenc: refactor DSP code for CFHD encoder
This is needed to implement x86 SIMD.
2021-02-24 17:14:03 +01:00
Andreas Rheinhardt ad58113afe avcodec/tiff_data: Move data to its only user
tiff.c is the only user of the data from tiff_data.c (the dependency of
the tiff encoder of it is spurious). Therefore this commit moves all the
data from tiff_data.c to tiff_data.h (which is only included by tiff.c)
and makes the objects declared therein static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 11:30:57 +01:00
Andreas Rheinhardt bb9167dbde avformat/isom: Split movaudio/movvideo tags off into a separate file
The NUT and avi demuxers only need ff_codec_movvideo_tags and so this
removes a dependency on the rest of isom.c as well as on mpeg4audio.c
(which isom depends on); it is similar for the Matroska demuxer and
muxers, except that the mpeg4audio.c dependency can't be avoided.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 10:14:26 +01:00
Andreas Rheinhardt b5207b7afd avcodec/Makefile: Remove outdated dependency of FLV demuxer on mpeg4audio
Unneeded since f96a653184 and
b2bb09bcc3.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 10:14:26 +01:00
Andreas Rheinhardt bb0be840c5 avcodec/Makefile: Don't build mjpegenc_huffman unconditionally
Only the mjpeg and amv encoders as well as its testprogram actually need
it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 10:14:25 +01:00
Andreas Rheinhardt d26198ada3 avcodec/g2meet, mjpegdec: Factor out common VLC initialization code
While just at it, remove the nb_codes parameter: It is redundant
(the number of codes is implicitly contained in the array containing how
many entries of a specific size there are) and for this reason it might
even be wrong, so it is better to check what is actually used instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 10:14:25 +01:00
Andreas Rheinhardt f180f515de avcodec/Makefile: Remove redundant mjpegdec dependency from tiff decoder
The MJPEG decoder is already activated by configure whenever the tiff
decoder is selected; ergo it is unnecessary to add a dependency in the
Makefile.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 10:14:25 +01:00
Andreas Rheinhardt 7bf2b76b41 configure, libavcodec/Makefile: Fix avrn dependencies
The avrn decoder actually only needs one thing: The MJPEG decoder.
Instead the Makefile made it compile mjpegdec and configure required
some of the prerequisites of the MJPEG decoder (exif and jpegtables).
Even if all the prerequisites of the MJPEG decoder were required, it
would still not make the MJPEG decoder usable, because for that
the MJPEG decoder needs to be in the list of codecs in codec_list.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 10:14:25 +01:00
Andreas Rheinhardt f26b8385ee avcodec/Makefile: Remove spurios dcaenc dependency
It does not need dca.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 10:14:25 +01:00
Andreas Rheinhardt 3b26d030b5 configure, libavcodec/Makefile: Remove spurious CAF demuxer dependencies
Forgotten in 604fbb3132.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-23 10:14:25 +01:00
Paul B Mahol 8651bf8a2e avcodec: add Simbiosis IMX video decoder 2021-02-20 17:42:00 +01:00
Paul B Mahol 67c8c863c7 avcodec: add initial exr image encoder 2021-02-18 13:00:40 +01:00
Paul B Mahol 48a0eb21aa avcodec: add setts bitstream filter 2021-02-12 19:50:07 +01:00
Paul B Mahol b6327612ab avcodec: add cri parser 2021-02-09 15:01:34 +01:00
Andreas Rheinhardt bdd55e1dd8 avcodec/Makefile: Remove dependency for nonexistent files
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-07 10:29:19 +01:00
Andreas Rheinhardt 698a4b22d0 avcodec/aacdec_fixed: Move fixed-point sinewin tables to its only user
The fixed-point AAC decoder is the only user of the fixed-point sinewin
tables from sinewin; and it only uses a few of them (about 10% when
counting by size). This means that guarding initializing these tables by
an AVOnce (as done in 3719122065) is
unnecessary for them. Furthermore the array of pointers to the
individual arrays is also unneeded.

Therefore this commit moves these tables directly into aacdec_fixed.c;
this is done by ridding the original sinewin.h and sinewin_tablegen.h
headers completely of any fixed-point code at the cost of a bit of
duplicated code (the alternative is an ugly ifdef-mess).

This saves about 58KB from the binary when using hardcoded tables (as
these tables are hardcoded in this scenario); when not using hardcoded
tables, most of these savings only affect the .bss segment, but the rest
(< 1KB) contains relocations (i.e. savings in .data.rel.ro).

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-07 10:28:29 +01:00
Paul B Mahol 7dfa98665c avcodec: add xbm parser 2021-02-05 15:35:29 +01:00
Paul B Mahol 85bdf18917 avcodec: add PFM image encoder 2021-02-02 14:29:33 +01:00
James Almer 81d070dd09 avcodec/dolby_e: split decoder and parser more thoroughly
Neither module should depend on the other.

Move shared functions to its own file for this purpose, and ensure
source files are compiled only when the required modules are enabled.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-01-25 16:45:20 -03:00
Nicolas Gaullier c7016e35a6 avcodec/dolby_e: Split decoder/parser files 2021-01-25 13:19:48 +01:00
Xu Guangxin d78ecf10bd avcodec/qsvdec: refact, move qsvdec_other.c to qsvdec.c
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2021-01-23 16:07:27 +00:00
Xu Guangxin 399c1f9235 avcodec/qsvdec: refact, move qsvdec_h2645.c to qsvdec.c
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2021-01-23 16:06:37 +00:00
Andreas Rheinhardt aff923c0b5 avcodec/Makefile: Make H.263 encoder compilable without MPEG4 encoder
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-21 19:02:18 +01:00
Andreas Rheinhardt ab905f1dbc avcodec/Makefile: Make H.263 decoder compilable without H.263I
The only call to ff_intel_h263_decode_picture_header() is already behind
"if (CONFIG_H263I_DECODER)".

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-21 19:02:18 +01:00
Andreas Rheinhardt d64828c8af avcodec/Makefile: Remove FLAC dependencies on vorbis_data
2ef2496cd1 used ff_vorbis_channel_layouts
in flac.c, but added a dependency to the FLAC decoder only; lateron
aba0278e9f added the dependency of the
FLAC parser and encoder on vorbis_data.o. Yet when the original commit
was reverted in aba0278e9f, the two other
dependencies were not removed. This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-21 19:02:18 +01:00
Andreas Rheinhardt 21b4b90475 avcodec/Makefile: Remove dependency of H.263 on FLV codecs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-21 19:02:18 +01:00
Andreas Rheinhardt 9e74f324d8 avcodec/Makefile: Remove unnecessary cbrt_data dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-21 19:02:18 +01:00
Mark Thompson 01a68c12a7 cbs: Implement common parts of cbs-based bitstream filters separately
This allows removal of a lot of duplicated code between BSFs.
2021-01-21 17:13:54 +00:00
Mark Thompson 8843607f49 cbs_h2645: Merge SEI message handling in common between codecs 2021-01-21 17:13:54 +00:00
Lynne 151b41c8cc
fft: remove 16-bit FFT and MDCT code
No longer used by anything.
Unfortunately the old FFT_FLOAT/FFT_FIXED_32 is left as-is. It's
simply too much work for code meant to be all removed anyway.
2021-01-14 01:44:21 +01:00
Lynne 2d85e6e723
ac3enc_fixed: convert to 32-bit sample format
The AC3 encoder used to be a separate library called "Aften", which
got merged into libavcodec (literally, SVN commits and all).
The merge preserved as much features from the library as possible.

The code had two versions - a fixed point version and a floating
point version. FFmpeg had floating point DSP code used by other
codecs, the AC3 decoder including, so the floating-point DSP was
simply replaced with FFmpeg's own functions.
However, FFmpeg had no fixed-point audio code at that point. So
the encoder brought along its own fixed-point DSP functions,
including a fixed-point MDCT.

The fixed-point MDCT itself is trivially just a float MDCT with a
different type and each multiply being a fixed-point multiply.
So over time, it got refactored, and the FFT used for all other codecs
was templated.

Due to design decisions at the time, the fixed-point version of the
encoder operates at 16-bits of precision. Although convenient, this,
even at the time, was inadequate and inefficient. The encoder is noisy,
does not produce output comparable to the float encoder, and even
rings at higher frequencies due to the badly approximated winow function.

Enter MIPS (owned by Imagination Technologies at the time). They wanted
quick fixed-point decoding on their FPUless cores. So they contributed
patches to template the AC3 decoder so it had both a fixed-point
and a floating-point version. They also did the same for the AAC decoder.
They however, used 32-bit samples. Not 16-bits. And we did not have
32-bit fixed-point DSP functions, including an MDCT. But instead of
templating our MDCT to output 3 versions (float, 32-bit fixed and 16-bit fixed),
they simply copy-pasted their own MDCT into ours, and completely
ifdeffed our own MDCT code out if a 32-bit fixed point MDCT was selected.

This is also the status quo nowadays - 2 separate MDCTs, one which
produces floating point and 16-bit fixed point versions, and one
sort-of integrated which produces 32-bit MDCT.

MIPS weren't all that interested in encoding, so they left the encoder
as-is, and they didn't care much about the ifdeffery, mess or quality - it's
not their problem.

So the MDCT/FFT code has always been a thorn in anyone looking to clean up
code's eye.

Backstory over. Internally AC3 operates on 25-bit fixed-point coefficients.
So for the floating point version, the encoder simply runs the float MDCT,
and converts the resulting coefficients to 25-bit fixed-point, as AC3 is inherently
a fixed-point codec. For the fixed-point version, the input is 16-bit samples,
so to maximize precision the frame samples are analyzed and the highest set
bit is detected via ac3_max_msb_abs_int16(), and the coefficients are then
scaled up via ac3_lshift_int16(), so the input for the FFT is always at least 14 bits,
computed in normalize_samples(). After FFT, the coefficients are scaled up to 25 bits.

This patch simply changes the encoder to accept 32-bit samples, reusing
the already well-optimized 32-bit MDCT code, allowing us to clean up and drop
a large part of a very messy code of ours, as well as prepare for the future lavu/tx
conversion. The coefficients are simply scaled down to 25 bits during windowing,
skipping 2 separate scalings, as the hacks to extend precision are simply no longer
necessary. There's no point in running the MDCT always at 32 bits when you're
going to drop 6 bits off anyway, the headroom is plenty, and the MDCT rounds
properly.

This also makes the encoder even slightly more accurate over the float version,
as there's no coefficient conversion step necessary.

SIZE SAVINGS:
ARM32:
HARDCODED TABLES:
BASE           - 10709590
DROP  DSP      - 10702872 - diff:   -6.56KiB
DROP  MDCT     - 10667932 - diff:  -34.12KiB - both:   -40.68KiB
DROP  FFT      - 10336652 - diff: -323.52KiB - all:   -364.20KiB
SOFTCODED TABLES:
BASE           -  9685096
DROP  DSP      -  9678378 - diff:   -6.56KiB
DROP  MDCT     -  9643466 - diff:  -34.09KiB - both:   -40.65KiB
DROP  FFT      -  9573918 - diff:  -67.92KiB - all:   -108.57KiB

ARM64:
HARDCODED TABLES:
BASE           - 14641112
DROP  DSP      - 14633806 - diff:   -7.13KiB
DROP  MDCT     - 14604812 - diff:  -28.31KiB - both:   -35.45KiB
DROP  FFT      - 14286826 - diff: -310.53KiB - all:   -345.98KiB
SOFTCODED TABLES:
BASE           - 13636238
DROP  DSP      - 13628932 - diff:   -7.13KiB
DROP  MDCT     - 13599866 - diff:  -28.38KiB - both:   -35.52KiB
DROP  FFT      - 13542080 - diff:  -56.43KiB - all:    -91.95KiB

x86:
HARDCODED TABLES:
BASE           - 12367336
DROP  DSP      - 12354698 - diff:  -12.34KiB
DROP  MDCT     - 12331024 - diff:  -23.12KiB - both:   -35.46KiB
DROP  FFT      - 12029788 - diff: -294.18KiB - all:   -329.64KiB
SOFTCODED TABLES:
BASE           - 11358094
DROP  DSP      - 11345456 - diff:  -12.34KiB
DROP  MDCT     - 11321742 - diff:  -23.16KiB - both:   -35.50KiB
DROP  FFT      - 11276946 - diff:  -43.75KiB - all:    -79.25KiB

PERFORMANCE (10min random s32le):
ARM32 - before -  39.9x - 0m15.046s
ARM32 - after  -  28.2x - 0m21.525s
                       Speed:  -30%

ARM64 - before -  36.1x - 0m16.637s
ARM64 - after  -  36.0x - 0m16.727s
                       Speed: -0.5%

x86   - before - 184x -    0m3.277s
x86   - after  - 190x -    0m3.187s
                       Speed:   +3%
2021-01-14 01:44:12 +01:00
Andreas Rheinhardt 5e11dcf52f avcodec/wavpack: Deduplicate exp and log tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:11 +01:00
Andreas Rheinhardt 0a493ac0ca avcodec/twinvq, metasound_data: Deduplicate lsp tables
Saves about 24KB.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:05:10 +01:00
Andreas Rheinhardt 3693e2fcee avcodec/aacps: Factor out code shared by float and fixed point decoder
Saves about 7KiB.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-31 22:12:39 +01:00
Andreas Rheinhardt 628d02a611 avcodec/speedhqenc: Call correct function
Up until now, the SpeedHQ encoder called a wrong function for init:
void ff_init_uni_ac_vlc(const uint8_t huff_size_ac[256],
                        uint8_t *uni_ac_vlc_len);
Yet the first argument actually used is of type RLTable; the size of
said struct is less than 256 if the size of a pointer is four, leading
to an access beyond the end of the RLTable.

This commit fixes this by calling the actually intended function:
init_uni_ac_vlc() from mpeg12enc.c. It was intended to use this
function [1], yet doing so was forgotten when the patch was actually
applied.

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/266187.html

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-11 02:20:05 +01:00
Anton Khirnov 19ce064239 smvjpegdec: merge into mjpegdec
SMVJPEG stores frames as slices of a big JPEG image. The decoder is
implemented as a wrapper that instantiates a full internal MJPEG
decoder, then forwards the decoded frames with offset data pointers.
This is unnecessarily complex and fragile, not supporting useful decoder
capabilities like direct rendering.

Re-implement the decoder inside the MJPEG decoder, which is accomplished
by returning each decoded frame multiple times, setting cropping
information appropriately on each instance.

One peculiar aspect of the previous design is that since
- the smvjpeg decoder returns one frame per input packet
- there are multiple frames in each packets (the aformentioned slices)
the demuxer needs to return each packet multiple times.
This is now also eliminated - the demuxer now returns each packet
exactly once, with the duration set to the number of frames it decodes
to.

This also removes one of the last remaining internal uses of the old
video decoding API.
2020-12-10 10:07:09 +01:00
Andreas Rheinhardt d5d1c697bd avcodec/mpegaudio_tablegen: Make exponential LUT shared
Both the fixed as well as the floating point mpegaudio decoders use
LUTs of type int8_t and uint32_t with 32K entries each; these tables
are completely the same, yet they are not shared. This commit makes
them shared. When both fixed as well as floating point decoders are
enabled, this saves 160KiB from the bss segment for a normal build
(translating into 160KiB less memory usage if both a shared as well as
a floating point decoder have actually been used) and 160KiB from the
binary for a build with hardcoded tables.

It also means that the code to create said LUTs is no longer duplicated
(for a normal build).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:47 +01:00
Andreas Rheinhardt 73bc26acb8 avcodec/mpegaudiodec: Share fixed and floating point data and init code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:47 +01:00
Peter Ross 85b442e231 avcodec/msp2dec: Microsoft Paint (MSP) version 2 decoder
Signed-off-by: Peter Ross <pross@xvid.org>
2020-12-06 19:51:45 +11:00
Mohammad Izadi afbc6852b4 avcodec/hevc_sei: add support for HDR10+ metadata
Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-05 19:19:54 -03:00
Jean-Baptiste Kempf 052a5993ad avcodec: add SpeedHQ encoder 2020-11-24 09:38:35 +01:00
Hendrik Leppkes 8f4aec719e avcodec/dxva2: add AV1 decode support
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2020-11-12 15:55:16 +01:00
Timo Rothenpieler ac5b45abab avcodec/nvdec: add av1 hwaccel
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Co-authored-by: James Almer <jamrial@gmail.com>
2020-11-11 18:36:09 +01:00
Fei Wang 3308bbf776 avcodec: add av1 VAAPI decoder
Example cmdline:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -v verbose \
-c:v av1 -i input.ivf -pix_fmt yuv420p -vsync passthrough -f md5     \
-y out.md5

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2020-11-02 22:57:23 +00:00
Zane van Iperen 40a8d43885
avcodec: add adpcm_ima_alp encoder 2020-10-25 23:44:26 +10:00