[FFmpeg-devel] [PATCH V5 4/4] libavcodec/qsvenc: Add transform skip to hevc_qsv

2022-01-16 Thread Wenbin Chen
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 --- doc/encoders.texi| 4 libavcodec/qsvenc.c | 13

[FFmpeg-devel] [PATCH V5 3/4] libavcodec/qsvenc: Add low latency P-pyramid support to qsv

2022-01-16 Thread Wenbin Chen
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/ma

[FFmpeg-devel] [PATCH V5 2/4] libavcodec/qsvenc: Add DisableDeblockingIdc support to qsv

2022-01-16 Thread Wenbin Chen
Add dblk_idc option to 264_qsv and hevc_qsv. Turining on this opion can disable deblocking. Signed-off-by: Wenbin Chen --- doc/encoders.texi | 6 ++ libavcodec/qsvenc.c | 7 +++ libavcodec/qsvenc.h | 3 +++ 3 files changed, 16 insertions(+) diff --git a/doc/encoders.texi b/doc/encoder

[FFmpeg-devel] [PATCH V5 1/4] libavcodec/qsvenc: Add max_frame_size support to hevc_qsv

2022-01-16 Thread Wenbin Chen
Add max_frame_size support to hevc_qsv as well. Signed-off-by: Wenbin Chen --- doc/encoders.texi | 3 +++ libavcodec/qsvenc.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 7cc8be1209..68921fbd40 100644 --- a/doc/encoders.te

[FFmpeg-devel] [PATCH 25/25] avformat/matroskaenc: Write data directly into dynamic buffers

2022-01-16 Thread Andreas Rheinhardt
This avoids copying the data in small chunks (1024B) into the dynamic buffer's small buffer before finally writing them into the "big" buffer. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/matroskaenc.c b/libavform

[FFmpeg-devel] [PATCH 24/25] avformat/matroskaenc: Avoid repeated avio_tell()

2022-01-16 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 28c7dee9b5..230bbf4a2c 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -

[FFmpeg-devel] [PATCH 23/25] avformat/matroskaenc: Reindentation

2022-01-16 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index e2f2dd7dae..28c7dee9b5 100644 --- a/libavformat/matroskaenc.c +++ b/libavf

[FFmpeg-devel] [PATCH 22/25] avformat/matroskaenc: Remove duplicated code for writing WebVTT subs

2022-01-16 Thread Andreas Rheinhardt
Up until now, the WebM variant of WebVTT subtitles has been handled specially: It had its own function to write it, because the data had to be reformatted before writing. But given that other codecs also need reformatting, this is no good reason to also duplicate the generic stuff for writing Block

[FFmpeg-devel] [PATCH 21/25] avformat/matroskaenc: Don't waste bytes on BlockGroup length fields

2022-01-16 Thread Andreas Rheinhardt
This commit uses the new EbmlWriter API to write the length fields of the BlockGroup and its descendants that are themselves Master elements (namely BlockAdditions and BlockMore) on the least amount of bytes. This fixes regressions introduced when the special code for writing general subtitles was

[FFmpeg-devel] [PATCH 20/25] avformat/matroskaenc: Redo applying ProRes offset

2022-01-16 Thread Andreas Rheinhardt
Add a field to mkv_track that is set to the offset instead of checking for whether the track is ProRes when writing the Block. This makes writing the Block independent of the AVCodecParameters. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 15 +-- 1 file changed,

[FFmpeg-devel] [PATCH 19/25] avformat/matroskaenc: Pass more parameters explicitly to mkv_write_block

2022-01-16 Thread Andreas Rheinhardt
This e.g. stops recalculating ts again. Also pass the AVFormatContext as pointer to void as it is only used for logging. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/libavformat/matroskaen

[FFmpeg-devel] [PATCH 18/25] avformat/matroskaenc: Remove special code for writing subtitles

2022-01-16 Thread Andreas Rheinhardt
Once upon a time, mkv_write_block() only wrote a (Simple)Block, not a BlockGroup which is needed for subtitles to convey the duration. But with the introduction of support for writing BlockAdditions and DiscardPadding (both of which require a BlockGroup), mkv_write_block() can also open and close a

[FFmpeg-devel] [PATCH 17/25] avformat/matroskaenc: Avoid temporary buffers when reformatting H.2645

2022-01-16 Thread Andreas Rheinhardt
Do this by using the new NALUList API. This avoids an allocation of a dynamic buffer per packet as well as the (re)allocation of the actual buffer as well as copying the data around. This improves performance: The time for one call to write_packet decreased from 703501 to 357900 decicyles when rem

Re: [FFmpeg-devel] [PATCH 01/25] avformat/matroskaenc: Fix potential overflow

2022-01-16 Thread Andreas Rheinhardt
James Almer: > > > On 1/16/2022 7:49 PM, Andreas Rheinhardt wrote: >> Signed-off-by: Andreas Rheinhardt >> --- >>   libavformat/matroskaenc.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c >> index 41b2df7dbf..1d

[FFmpeg-devel] [PATCH 16/25] avformat/avc: Add functions to split access unit into list of NALUs

2022-01-16 Thread Andreas Rheinhardt
This will allow to avoid the temporary buffer and memcpys when repacketing annex B to mp4-style H.264/H.265 without searching twice for start codes. Signed-off-by: Andreas Rheinhardt --- libavformat/avc.c | 40 +--- libavformat/avc.h | 29 +

[FFmpeg-devel] [PATCH 15/25] avformat/matroskaenc: Use common function for H.2645 annex B->mp4

2022-01-16 Thread Andreas Rheinhardt
Matroska does not have different profiles that allow or disallow in-band extradata, so one can just use the ordinary H.264 function for H.265, too. (Both use ff_avc_parse_nal_units() internally anyway.) Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 7 ++- 1 file changed,

[FFmpeg-devel] [PATCH 14/25] avformat/matroskaenc: Redo reformatting AV1

2022-01-16 Thread Andreas Rheinhardt
This avoids allocations+copies in all cases, not only those in which the desired OBUs are contiguous in the input buffer. Signed-off-by: Andreas Rheinhardt --- ff_av1_filter_obus_buf() now has only one user left: movenc.c Maybe movenc.c should be modified accordingly to remove it? libavformat/m

[FFmpeg-devel] [PATCH 13/25] avformat/av1: Document actual behaviour of ff_av1_filter_obus()

2022-01-16 Thread Andreas Rheinhardt
Document that it can be used with a NULL AVIOContext to get the output size in a first pass. Signed-off-by: Andreas Rheinhardt --- libavformat/av1.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/av1.h b/libavformat/av1.h index dd5b47dc25..f57dabe986 100644

[FFmpeg-devel] [PATCH 12/25] avformat/matroskaenc: Speed up reformatting WavPack

2022-01-16 Thread Andreas Rheinhardt
WavPack's blocks use a length field, so that parsing them is fast. Therefore it makes sense to parse the block twice, once to get the length of the output packet and once to write the actual data instead of writing the data into a temporary buffer in a single pass. This speeds up muxing from 15970

[FFmpeg-devel] [PATCH 11/25] avformat/matroskaenc: Allow to use custom reformatting functions

2022-01-16 Thread Andreas Rheinhardt
Matroska uses variable-length elements and in order not to waste bytes on length fields, the length of the data to write needs to be known before writing the length field. Annex B H.264/5 and WavPack need to be reformatted to know this length and this currently involves writing the data into tempor

[FFmpeg-devel] [PATCH 10/25] avformat/matroskaenc: Factor writing Info out

2022-01-16 Thread Andreas Rheinhardt
Avoids the surprise of using pb for the main AVIOContext at the beginning and end of mkv_write_header() and for for the dynamic buffer opened for the Info element in the middle of mkv_write_header(). Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 64 +--

[FFmpeg-devel] [PATCH 09/25] avformat/matroskaenc: Don't waste bytes on ChapterAtoms length fields

2022-01-16 Thread Andreas Rheinhardt
Also check the (user-provided) metadata tags for being too long. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 22 -- tests/ref/fate/webm-dash-chapters | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/libavformat/matroska

[FFmpeg-devel] [PATCH 08/25] avformat/matroskaenc: Don't waste bytes on Video element length fields

2022-01-16 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 233 ++ tests/fate/matroska.mak | 2 +- tests/ref/fate/matroska-dovi-write-config7| 4 +- tests/ref/fate/matroska-h264-remux| 4 +- .../fate/matroska-m

[FFmpeg-devel] [PATCH 07/25] avformat/matroskaenc: Factor writing TrackVideo out

2022-01-16 Thread Andreas Rheinhardt
It is already quite big. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 130 +- 1 file changed, 72 insertions(+), 58 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 4d4d270db1..2f5f1cc56d 100644 --- a/l

[FFmpeg-devel] [PATCH 06/25] avformat/matroskaenc: Avoid seeks when writing EBML header

2022-01-16 Thread Andreas Rheinhardt
Using start/end_ebml_master() to write an EBML Master element uses seeks under the hood. This does not work if the output is unseekable with the AVIOContext's buffer being very small (the size of the currently written Matroska EBML header is 40) or with the AVIOContext being in direct mode, because

[FFmpeg-devel] [PATCH 05/25] avformat/matroskaenc: Don't waste bytes when writing attachments

2022-01-16 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 20 tests/ref/lavf/mkv_attachment | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 154de25f59..0927e0b873 100644 --- a/

[FFmpeg-devel] [PATCH 04/25] avformat/matroskaenc: Don't waste bytes on SimpleTags length fields

2022-01-16 Thread Andreas Rheinhardt
Also check the (user-provided) tags for being overlong; the earlier code had an implicit unchecked size_t->int conversion. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 15 --- tests/ref/fate/matroska-dovi-write-config7| 4 +- tests/ref/fate/matro

[FFmpeg-devel] [PATCH 03/25] avformat/matroskaenc: Add API to write Masters with minimal length field

2022-01-16 Thread Andreas Rheinhardt
This muxer currently uses two ways to ensure that no bytes are wasted by writing unnecessary long EBML length fields for Master elements and the (Simple)Block element (all the other elements are fine as one either already has the right length or getting the actual length is easy and necessary anywa

[FFmpeg-devel] [PATCH 02/25] avformat/matroskaenc: Don't open BlockGroup twice

2022-01-16 Thread Andreas Rheinhardt
This would happen in case non-WebVTT-subtitles had BlockAdditional or DiscardPadding side-data. Given that these are not accounted for in the length of the outer BlockGroup (which is a quite sharp upper bound) it is possible for the outer BlockGroup to use an insufficient number of bytes which lead

Re: [FFmpeg-devel] [PATCH 001/281] Add a new channel layout API

2022-01-16 Thread Marton Balint
On Sun, 16 Jan 2022, Nicolas George wrote: James Almer (12022-01-12): From: Anton Khirnov The new API is more extensible and allows for custom layouts. More accurate information is exported, eg for decoders that do not set a channel layout, lavc will not make one up for them. Deprecate th

Re: [FFmpeg-devel] [PATCH 01/25] avformat/matroskaenc: Fix potential overflow

2022-01-16 Thread James Almer
On 1/16/2022 7:49 PM, Andreas Rheinhardt wrote: Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 41b2df7dbf..1dde12a7d9 100644 --- a/libavformat/ma

[FFmpeg-devel] [PATCH 01/25] avformat/matroskaenc: Fix potential overflow

2022-01-16 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 41b2df7dbf..1dde12a7d9 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -286,7 +

Re: [FFmpeg-devel] [PATCH] vf_paletteuse: fix color cache lookup for Bayer dithering mode.

2022-01-16 Thread Gyan Doshi
On 2022-01-14 10:57 pm, Gyan Doshi wrote: O On 2022-01-14 10:53 pm, Thierry Foucu wrote: On Mon, Jan 10, 2022 at 10:32 AM Paul B Mahol wrote: LGTM Any chance to push this change? On Sunday, if no one else does. Pushed as dcc9454ab914f9532ddb7f06a2f756ed472a1a85 Regards, Gyan __

[FFmpeg-devel] [PATCH 2/2] avcodec/webvttdec: honour bidi marks

2022-01-16 Thread Oneric
WebVTT files are required to be encoded as UTF-8 by its spec, so just insert the bytes for UTF-8 encoded bidi-marks. --- libavcodec/webvttdec.c | 2 +- tests/ref/fate/sub-webvtt2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttde

[FFmpeg-devel] [PATCH 1/2] avcodec/{ass, webvttdec}: fix handling of backslashes

2022-01-16 Thread Oneric
Backslashes cannot be escaped by backslashes in any ASS renderer, but unless followed by a few specific characters it is just printed as a regular character. Insert a word-joiner character after a backslash to break up the active sequences without changing the visual output. Also the existing \{ an

Re: [FFmpeg-devel] [PATCH 001/281] Add a new channel layout API

2022-01-16 Thread Nicolas George
James Almer (12022-01-12): > From: Anton Khirnov > > The new API is more extensible and allows for custom layouts. > More accurate information is exported, eg for decoders that do not > set a channel layout, lavc will not make one up for them. > > Deprecate the old API working with just uint64_t

Re: [FFmpeg-devel] [PATCH v2] lavfi/drawtext: Add localtime_ms for millisecond precision

2022-01-16 Thread Nicolas George
Thilo Borgman (12022-01-14): > v6 does: > > $> ffmpeg ... drawtext="fontfile=...:text='%{localtime \:%a %b %d %Y %S}'" > (seconds) > $> ffmpeg ... drawtext="fontfile=...:text='%{localtime_ms\:%a %b %d %Y %S}'" > (milliseconds) > > I suggest v7 should according to your rema