Commit Graph

47903 Commits

Author SHA1 Message Date
Marton Balint 2296078397 avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number
Their usefulness is questionable, very few decoders set them, and their type
should have been int64_t. A replacement field can be added later if a valid use
case is found.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-13 00:37:50 +01:00
Marton Balint 8e2c124904 avcodec/mpegvideo_enc: do not use AVFrame.*_picture_number for encoding
Move these fields to MPEGPicture instead and use that.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-13 00:36:49 +01:00
Marton Balint 817141c562 avcodec/diracdec: do not use AVFrame.display_picture_number for decoding
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-13 00:36:49 +01:00
Marton Balint 6b6f7db819 avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number
Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we use 64 bit
values for them.

Also deprecate the old 32 bit frame_number attribute.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-13 00:36:46 +01:00
Paul B Mahol 2b4273072d avcodec/roqaudioenc: unbreak mono encoding 2023-02-11 22:59:57 +01:00
Paul B Mahol b8c0802156 avcodec: add RKA decoder 2023-02-11 21:26:37 +01:00
Paul B Mahol 27315dc345 avcodec/tta: fix regression with new channel layout switch 2023-02-11 16:49:31 +01:00
James Almer 5bad485603 Bump major versions of all libraries
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer 1135ad0f26 avcodec/version: postpone the remaining API deprecations
They are either too recent, or still need work like FF_API_INIT_PACKET.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
Leo Izen 719a93f4e4 avutil/{color_utils, csp}: merge color_utils into csp and expose API
libavutil/color_utils contains some avpriv_ symbols that map
enum AVTransferCharacteristic values to gamma-curve approximations and
to the actual transfer functions to invert them (i.e. -> linear).

There's two issues with this:
(1) avpriv is evil and should be avoided whenever possible
(2) libavutil/csp.h exposes a public API for handling color that
    already handles primaries and matricies

I don't see any reason this API has to be private, so this commit takes
the functionality from avutil/color_utils and merges it into avutil/csp
with an exposed av_ API rather than the previous avpriv_ API.

Every reference to the previous API has been updated to point to the
new one. color_utils.h has been deleted as well. This should not break
any applications as it only contained avpriv_ symbols in the first
place, so nothing in that header could be referenced by other
applications.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:35:14 +01:00
James Almer 21814a70db avutil: remove FF_API_DECLARE_ALIGNED
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer 1ba8b6d9dc avcodec: remove FF_API_SUB_TEXT_FORMAT
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer 3ceffe7839 avcodec: remove FF_API_FLAG_TRUNCATED
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer 5f9e848e68 avcodec: remove FF_API_AVCTX_TIMEBASE
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:08 +01:00
James Almer 10c9a0874c avcodec: remove FF_API_AUTO_THREADS
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:24:16 +01:00
James Almer 63258b6f7c avcodec: remove FF_API_GET_FRAME_CLASS
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:24:16 +01:00
James Almer 0b3152779d avcodec: remove FF_API_DEBUG_MV
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:24:16 +01:00
James Almer e0786a8eeb avcodec: remove FF_API_THREAD_SAFE_CALLBACKS
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:24:16 +01:00
James Almer 2f9cd88617 avcodec: remove FF_API_UNUSED_CODEC_CAPS
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:24:16 +01:00
James Almer 86806347d8 avcodec: remove FF_API_OPENH264_CABAC
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:24:15 +01:00
James Almer cb7de65589 avcodec: remove FF_API_OPENH264_SLICE_MODE
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:24:15 +01:00
Andreas Rheinhardt f843460eb7 avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE
It has been deprecated in 94d68a41fa
and can't be set via AVOptions. The only codecs that use it
(the MPEG-1/2 encoders) have private options for this.
So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:24:15 +01:00
Andreas Rheinhardt 868a31b42d avcodec: Make avcodec_decode_subtitle2 accept a const AVPacket*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:24:15 +01:00
Gyan Doshi 159b028df5 avcodec/h264_metadata_bsf: remove AUDs at any position
Some files, likely due to faulty packetization or muxing, can have AUDs
at other positions besides the head unit of a packet. Remove these too.
2023-02-09 14:38:28 +05:30
Leo Izen 5cf0bc4236
avcodec/pngenc: avoid writing cICP when inappropriate
We parse the fallback cHRM on decode and correctly determine that we
have BT.709 primaries, but unknown TRC. This causes us to write cICP
where we shouldn't. Primaries without transfer can be handled entirely
by cHRM, so we should only write cICP if we actually know the transfer
function.

Additionally, we should avoid writing cICP if there's an ICC profile
because the spec says decoders must prioritize cICP over the ICC
profile.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-02-08 08:50:34 -05:00
Paul B Mahol c56f5be678 avcodec/wavarc: fix 16bit 0CPY mode 2023-02-07 20:58:59 +01:00
Paul B Mahol df4ab69cfa avcodec/wavarc: add support for 0CPY 2023-02-07 17:13:11 +01:00
Paul B Mahol 0c7af7b954 avcodec/bonk: properly handle some other errors 2023-02-07 17:13:11 +01:00
Paul B Mahol 5dba4b217c avcodec/wavarc: properly handle invalid data 2023-02-07 17:13:10 +01:00
Paul B Mahol 3b3a321fed avcodec/wavarc: remove invalid shifts 2023-02-06 20:29:44 +01:00
Leo Izen 0009348306
avcodec/libjxl: add #ifdef guards for libjxl >= 0.8.0 features
Since many distributions ship libjxl 0.7.0 still, we'd still prefer to
compile against that, but don't want to lose the features that require
libjxl 0.8.0 or greater. For this reason I've added preprocessor #ifdef
guards around the features that aren't necessarily in libjxl 0.7.0.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-02-06 13:05:39 -05:00
Paul B Mahol c5aeb8f4db avcodec/wavarc: really fix bits per sample detection 2023-02-06 18:27:45 +01:00
Paul B Mahol 64b242d030 avcodec/wavarc: fix 8bit decoding 2023-02-06 18:09:11 +01:00
Paul B Mahol d7c2da1f8d avcodec/wavarc: check that nb_samples is valid 2023-02-06 16:37:20 +01:00
Anton Khirnov bdc76f467f lavu/frame: deprecate reordered_opaque
It is only used in libavcodec, where it's been superseded by
AV_CODEC_CAP_COPY_OPAQUE.
2023-02-04 13:40:20 +01:00
Anton Khirnov d02340b9e3 lavc/decode: allow using AV_CODEC_FLAG_COPY_OPAQUE for decoding
Use it to propagate AVPacket.opaque[_ref] to corresponding AVFrame
fields. This is a more convenient alternative to reordered_opaque.
2023-02-04 13:14:20 +01:00
Anton Khirnov 82da22066c lavc: deprecate CrystalHD decoders
The hardware is old and not relevant today. The decoders also have many
special quirks and are effectively unmaintained.
2023-02-04 13:12:28 +01:00
Paul B Mahol 651da91915 avcodec: add WavArc decoder 2023-02-04 09:36:01 +01:00
Anton Khirnov 7d49fef8b4 lavc/vaapi_encode: fix propagating durations and opaques
input_image is freed by the time the output packet is constructed, so we
need to store copies in VAAPIEncodePicture.
2023-02-02 10:42:39 +08:00
Lynne bbe95f7353
x86: replace explicit REP_RETs with RETs
From x86inc:
> On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
> a branch or a branch target. So switch to a 2-byte form of ret in that case.
> We can automatically detect "follows a branch", but not a branch target.
> (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)

x86inc can automatically determine whether to use REP_RET rather than
REP in most of these cases, so impact is minimal. Additionally, a few
REP_RETs were used unnecessary, despite the return being nowhere near a
branch.

The only CPUs affected were AMD K10s, made between 2007 and 2011, 16
years ago and 12 years ago, respectively.

In the future, everyone involved with x86inc should consider dropping
REP_RETs altogether.
2023-02-01 04:23:55 +01:00
Paul B Mahol fc9a3b584d avcodec/mlpdec: parse and use substream info bits 2023-01-31 18:45:22 +01:00
Paul B Mahol 00994e8be1 avcodec: add media100_to_mjpegb bitstream filter and use it 2023-01-31 17:06:29 +01:00
Leo Izen fb823161a8
avcodec/libjxl: respect AVCodecContext->bits_per_raw_sample
libjxl only accepts 16-bit buffers with its API, but it can
accept 9-bit to 15-bit input via a 16-bit buffer, provided the flag
is set declaring the buffer to be of the respective significant depth.

Likewise, it can only provide pixel data on decode as a 16-bit buffer
(if higher than 8) but does provide the metadata tagging the actual bit
depth.

This commit causes libjxlenc.c and libjxldec.c to respect this metadata
and tag/read it accordingly from AVCodecContext->bits_per_raw_sample.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-01-31 10:39:48 -05:00
Cameron Gutman 669ff26bc2 avcodec/mfenc: fix double-free on init failure
mfenc sets FF_CODEC_CAP_INIT_CLEANUP, so calling mf_close() on
failure inside mf_init() results in a double-free.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-01-31 14:39:25 +02:00
Anton Khirnov e3a99041b8 lavc: add null codecs
They discard all input without ever returning any output. Useful for
development.
2023-01-31 09:00:56 +01:00
Paul B Mahol 280e6e93fc avcodec: add ADPCM XMD decoder 2023-01-30 20:57:37 +01:00
galinart 5002829416 libavcodec/qsvenc: enable Hyper Encode
Hyper Encode uses Intel integrated and discrete graphics on one system
to accelerate encoding of a single video stream.
Depending on the selected parameters and codecs, performance gain on AlderLake iGPU + ARC Gfx up to 1.6x.

More information: https://www.intel.co.uk/content/www/uk/en/architecture-and-technology/adaptix/deep-link.html
Developer guide: https://github.com/oneapi-src/oneVPL-intel-gpu/blob/main/doc/HyperEncode_FeatureDeveloperGuide.md

Hyper Encode is supported only on Windows and requires D3D11 and oneVPL.

To enable Hyper Encode need to specify:
-Hyper Encode mode (-dual_gfx on or dual_gfx adaptive)
-Encoder: h264_qsv or hevc_qsv
-BRC: VBR, CQP or ICQ
-Lowpower mode (-low_power 1)
-Closed GOP for AVC or strict GOP for HEVC -idr_interval = 0 used by default

Depending on the encoding parameters, the following parameters may need
to be adjusted:
-g recommended >= 30 for better performance
-async_depth recommended >= 30 for better performance
-extra_hw_frames recommended equal to async_depth value
-bf recommended = 0 for better performance

In the cases with fast encoding (-preset veryfast) there may be no
performance gain due to the fact that the decode is slower than the encode.

Command line examples:

ffmpeg.exe -init_hw_device qsv:hw,child_device_type=d3d11va,child_device=0 -v verbose -y -hwaccel qsv -extra_hw_frames 60 -async_depth 60 -c:v h264_qsv -i bbb_sunflower_2160p_60fps_normal.mp4
-async_depth 60 -c:v h264_qsv -preset medium -g 60 -low_power 1 -bf 0 -dual_gfx on output.h265

Signed-off-by: galinart <artem.galin@intel.com>
2023-01-30 08:48:58 +08:00
David Rosca 4e3b6270c6 vaapi_encode_h264: Only set pic_order_cnt_type to 0 with B-frames
v3: pic_order_cnt steps by 2
2023-01-30 08:48:32 +08:00
Paul B Mahol 757218564d avcodec/dvdsubenc: remove duplicated ; 2023-01-29 13:10:20 +01:00
Paul B Mahol 65c0b16961 avcodec/ftr: use more portable return error code 2023-01-29 13:09:17 +01:00