Commit Graph

234 Commits

Author SHA1 Message Date
Wenbin Chen 342d4fb056 libavcodec/qsvenc: add mbbrc to hevc_qsv
Add mbbrc to hevc_qsv
For detailed description, please see "mbbrc" part in:
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxextcodingoption2

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2022-02-28 12:40:02 +08:00
Wenbin Chen d165ce22a4 libavcodec/vaapi_encode: Add async_depth to vaapi_encoder to increase performance
Fix: #7706. After commit 5fdcf85bbf, vaapi encoder's performance
decrease. The reason is that vaRenderPicture() and vaSyncBuffer() are
called at the same time (vaRenderPicture() always followed by a
vaSyncBuffer()). Now I changed them to be called in a asynchronous way,
which will make better use of hardware.
Async_depth is added to increase encoder's performance. The frames that
are sent to hardware are stored in a fifo. Encoder will sync output
after async fifo is full.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-02-28 12:37:02 +08:00
James Almer 1dddb930aa avcodec/libsvtav1: update some options and defaults
And bump the minimum required version to 0.9.0

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-24 20:36:53 -03:00
James Almer c33b404885 avcodec/libsvtav1: add a svtav1-params option to pass a list of key=value parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-24 14:57:00 -03:00
Haihao Xiang 80801e5705 lavc/qsvenc: add tile encoding support for VP9
Add -tile_rows and -tile_cols options to specify the number of tile
rows and columns

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-29 12:02:52 +08:00
Wenbin Chen e102fd98d6 libavcodec/qsvenc: Add intra refresh to hevc_qsv and add new intra refresh parameter
Add intra refresh support to hevc_qsv as well.
Add an new intra refresh type: "horizontal", and an new param
ref_cycle_dist. This param specify the distance between the
beginnings of the intra-refresh cycles in frames.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-27 10:26:39 +08:00
Wenbin Chen 2ecc4fde5f libavcodec/qsvenc: Add b_strategy option to hevc_qsv
Add b_strategy option to hevc_qsv. By enabling this option, encoder can
use b frames as reference.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-27 10:26:33 +08:00
Wenbin Chen 168c6e23a5 libavcodec/qsvenc: Add max slice size support to hevc_qsv
Add max_slice_size option to hevc_qsv as well.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-27 10:26:26 +08:00
Wenbin Chen 1fe78f8419 libavcodec/qsvenc: Add transform skip to hevc_qsv
Add transform_skip option to hevc_qsv. By enabling this option,
the transform_skip_enabled_flag in PPS will be set to 1.
This option is supported on the platform equal or newer than ICL.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-21 12:56:30 +08:00
Wenbin Chen 9d6cc6a544 libavcodec/qsvenc: Add low latency P-pyramid support to qsv
Add low latency P-pyramid support to qsv. This feature relates to
command line option "-p_strategy". To enable this flag, user also
need to set "-bf" to 0. P-strategy has two modes "1-simple" and
"2-pyramid". The details of the two models refer to
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#preftype

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-21 12:56:30 +08:00
Wenbin Chen 812b6ee6bd libavcodec/qsvenc: Add DisableDeblockingIdc support to qsv
Add dblk_idc option to 264_qsv and hevc_qsv. Turining on this opion can
disable deblocking.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-21 12:56:30 +08:00
Wenbin Chen ec8bc07104 libavcodec/qsvenc: Add max_frame_size support to hevc_qsv
Add max_frame_size support to hevc_qsv as well.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-21 12:56:30 +08:00
Haihao Xiang 641c4346b3 lavc/qsvenc_hevc: add -pic_timing_sei option
The SDK may insert picture timing SEI for hevc and the code to set mfx
parameter has been added in qsvenc, however the corresponding option is
missing in the hevc option array

Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-18 16:25:33 +08:00
Haihao Xiang c4ae6908f2 lavc/qsvenc: add encode support for screen content coding extension
Enables HEVC Screen Content Coding extension support on ICL+ platform

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-18 16:24:57 +08:00
Wenbin Chen 035d2cc463 doc/encoders.texi: Add doc for qsv
Add doc for qsv decoder.
Add more option's introduction to qsv encoder.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-07 14:06:10 +08:00
Limin Wang 7dfc3cc713 avcodec/libx26[45]: add udu_sei option to import user data unregistered SEIs
Most of user data unregistered SEIs are privated data which defined by user/
encoder. currently, the user data unregistered SEIs found in input are forwarded
as side-data to encoders directly, it'll cause the reencoded output including some
useless UDU SEIs.

I prefer to add one option to enable/disable it and default is off after I saw
the patch by Andreas Rheinhardt:

https://patchwork.ffmpeg.org/project/ffmpeg/patch/AM7PR03MB66607C2DB65E1AD49D975CF18F7B9@AM7PR03MB6660.eurprd03.prod.outlook.com/

How to test by cli:
ffmpeg -y -f lavfi -i testsrc -c:v libx264 -frames:v 1 a.ts
ffmpeg -y -i a.ts -c:v libx264 -udu_sei 1 b.ts
ffmpeg -y -i a.ts -c:v libx264 -udu_sei 0 c.ts

# check the user data unregistered SEIs, you'll see two UDU SEIs for b.ts.
# and mediainfo will show with wrong encoding setting info
ffmpeg -i b.ts -vf showinfo -f null -
ffmpeg -i c.ts -vf showinfo -f null -

This fixes tickets #9500 and #9557.

Reviewed-by: "zhilizhao(赵志立)" <quinkblack@foxmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-28 14:19:38 +08:00
Limin Wang ed89be1e02 doc/encoders: add available values for libsvtav1 options
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:01:16 +08:00
Gyan Doshi 1aa9dcd091 avcodec/qsvenc: clip global_quality for ICQ modes.
Allowed range is 1 to 51.

Ref: https://software.intel.com/content/www/us/en/develop/articles/advanced-bitrate-control-methods-in-intel-media-sdk.html
2021-07-12 09:33:22 +05:30
Gyan Doshi 4c0d6c91f6 doc/encoders: update default coder for aac
Changed in 660d1d8e3b.
2021-05-23 13:30:44 +05:30
Gyan Doshi a3f695d54b doc/encoders: add entry for a64 encoders 2021-04-02 15:20:14 +05:30
Tobias Rapp b60fe9508f doc/encoders: Remove text about single bit-depth libx264 support
In the meanwhile libx264 allows to be configured for including both 8/10 bit
support within a single library. The new libx264 interface was enabled in
2f96190732.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2021-03-16 08:40:30 +01:00
Derek Buitenhuis 113a99270d doc/encoders: Add documentation for the GIF encoder
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-02-25 16:41:24 +00:00
Bohan Li 82aab8a4ee avcodec/libaomenc: add support for setting arbitrary libaom options
A new key & value API lets us gain access to newly added parameters
without adding explicit support for them in our wrapper. Add an
option utilizing this functionality in a similar manner to other
encoder libraries' wrappers.

Signed-off-by: Bohan Li <bohanli@google.com>
2021-02-10 11:52:46 +02:00
Wonkap Jang 57dae5723f avcodec/libvpxenc: add a way to set VP9E_SET_SVC_REF_FRAME_CONFIG
In order to fine-control referencing schemes in VP9 encoding, there
is a need to use VP9E_SET_SVC_REF_FRAME_CONFIG method. This commit
provides a way to use the API through frame metadata.
2021-01-14 11:08:33 -08: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
Lynne 45070eec4c
libwavpackenc: remove libwavpackenc wrapper
The manual states "there is virtually no reason to use that encoder.".

It supports less sample formats than the native encoder, is less efficient
than the native encoder and is also slower and pretty much remains untested.
libwavpack also isn't being fuzzed, which given that we plug the parameters
without any sanitizing them looks concerning.
2020-10-02 17:43:15 +02:00
Gyan Doshi 1e5b3f77d9 avcodec/libopusenc: add option to set inband FEC 2020-09-09 11:40:06 +05:30
Gautam Ramakrishnan f0e33119e4 libavcodec/j2kenc: Support for multiple layers
This patch allows setting a compression ratio and to
set multiple layers. The user has to input a compression
ratio for each layer.
The per layer compression ration can be set as follows:
-layer_rates "r1,r2,...rn"
for to create 'n' layers.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-30 16:18:37 +02:00
Gautam Ramakrishnan 642404f28d doc/encoders: Add all options for JPEG2000 encoder
This patch updates the documentation by adding all options
for JPEG2000 encoder.

Revised-by: Gyan Doshi <ffmpeg@gyani.pro>
2020-08-17 15:30:25 +05:30
Limin Wang ad49dd7694 avcodec/mpeg12enc: support mpeg2 encoder const level
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-14 22:48:05 +08:00
Mark Thompson bc58d1f58e vaapi_encode_h265: Fix ordering of tile dimensions
Dimensions are normally specified as width x height, and this will match
the same option to libaom-av1.

Remove the indirection through the private context at the same time.
2020-08-01 17:39:13 +01:00
Mark Thompson e80fe32943 vaapi_encode_h265: Remove confusing and redundant tile options
The tile_rows/cols options currently do a confusingly different thing to
the options of the same name on other encoders like libvpx and libaom.
There is no backward-compatibility reason to implement the log2 behaviour
as there was for libaom, so just get rid of them entirely.
2020-08-01 17:18:30 +01:00
Mark Thompson 11a2d05b3f libsvtav1: Fix the documentation to match the actual options 2020-07-31 22:30:41 +01:00
Daryl Seah 0e20dee5c2 avcodec: Add an SVT-AV1 encoder wrapper
Signed-off-by: Daryl Seah <daryl.seah@intel.com>
Signed-off-by: Jing SUN <jing.a.sun@intel.com>
Signed-off-by: ZhiZhen Tang <zhizhen.tang@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-29 17:11:26 -03:00
Wang Cao 017bf9643f libavcodec/libaomenc.c: Add command-line options for inter-coding tools
Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
2020-07-24 19:10:10 -07:00
Wang Cao 498ad7b37c libavcodec/libaomenc.c: Add command-line options for tx tools.
Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
2020-07-24 19:10:10 -07:00
Linjie Fu 43a08d907b lavc/vaapi_encode_h265: add h265 tile encoding support
Default to enable uniform_spacing_flag. Guess level by the tile
rows/cols. Supported for ICL+ platforms.

Also add documentations.

To encode with 4 rows 2 columns:
    ffmpeg ... -c:v hevc_vaapi -tiles 4x2 ...
    ffmpeg ... -c:v hevc_vaapi -tile_rows 4 -tile_cols 2 ...

Suggested-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2020-07-20 15:27:05 +08:00
James Zern d294716c22 avcodec/libaomenc: fix build w/libaom v1.0.0
broken since:
aa5c6f382b avcodec/libaomenc: Add command-line options to control the use of partition tools

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
2020-07-08 10:12:27 -07:00
Wang Cao 297d5a110b avcodec/libaomenc: Add command-line options for intra-coding tools
Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
2020-07-01 11:55:04 -07:00
Wang Cao aa5c6f382b avcodec/libaomenc: Add command-line options to control the use of partition tools
This patch adds the control for enabling rectangular partitions, 1:4/4:1
partitions and AB shape partitions.

Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
2020-07-01 11:54:56 -07:00
Limin Wang 251434cb97 doc/encoders: fix the misleading usage of profile
users are getting mislead by the integer, although profile
can support both const string and integer.
http://ffmpeg.org/pipermail/ffmpeg-user/2020-June/049025.html

Also fix the order of high and main, it's not my intention.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-20 09:03:59 +08:00
Limin Wang dd76226842 avcodec/mpeg12enc: support mpeg2 encoder const profile
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-01 07:05:32 +08:00
wm4 050b72ab5e avcodec: Add MediaFoundation encoder wrapper
This contains encoder wrappers for H264, HEVC, AAC, AC3 and MP3.

This is based on top of an original patch by wm4
<nfxjfg@googlemail.com>. The original patch supported both encoding
and decoding, but this patch only includes encoding.

The patch contains further changes by Paweł Wegner
<pawel.wegner95@gmail.com> (primarily for splitting out the encoding
parts of the original patch) and further cleanup, build compatibility
fixes and tweaks for use with Qualcomm encoders by Martin Storsjö.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-19 21:34:04 +03:00
Lou Logan d163e0ecbc doc/encoders: remove unsubstantiated ffaacenc > fdk-aac claim
After this claim was made in e34e361 kamedo2 did an in-depth ABX
test comparing these encoders:

https://hydrogenaud.io/index.php?topic=111085.0

Result: FFmpeg AAC wasn't as good as libfdk_aac on average.

I know some things have changed since then such as, "use the fast
coder as the default" (fcb681ac) for example, so maybe the situation
is different now.

However, I am unaware of any recent comparison. So without any
substantiation we shouldn't make such a blantant claim.

Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2020-05-08 11:10:01 -08:00
Wang Cao bd3389e9f4 avcodec/libaomenc.c: Add a libaom command-line option 'tune'
Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
2020-04-11 15:12:34 -07:00
Wonkap Jang f3bb59209f avcodec/libvpxenc: add a way to explicitly set temporal layer id
In order for rate control to correctly allocate bitrate to each temporal
layer, correct temporal layer id has to be set to each frame. This
commit provides the ability to set correct temporal layer id for each
frame.

Signed-off-by: James Zern <jzern@google.com>
2020-02-11 11:55:36 -08:00
Michael Kuron d4440c7e91 lavc/dvdsubenc: accept palette from options
Previously, the default palette would always be used.
Now, we can accept a custom palette, just like dvdsubdec does.

Signed-off-by: Michael Kuron <michael.kuron@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-04 23:34:22 +01:00
Wonkap Jang b93098253e avcodec/libvpxenc: add VP9 temporal scalability encoding option
This commit reuses the configuration options for VP8 that enables
temporal scalability for VP9. It also adds a way to enable three
preset temporal structures (refer to the documentation for more
detail) that can be used in offline encoding.

Signed-off-by: James Zern <jzern@google.com>
2020-02-03 12:37:28 -08:00
Wang Cao 8c9d82af6b Add a commandline option to control loop restoration for libaom
Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
2020-01-17 14:46:50 -08:00
James Almer 278a91f8fe avcodec/libx265: add a qp option and apply the relevant global AVCodecContext settings to the encoder context
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-01 13:48:02 -03:00