Commit Graph

111473 Commits

Author SHA1 Message Date
Anton Khirnov 75d0af388f fftools/ffmpeg_filter: make OutputFilter.filter private
It should not be accessed from outside of filtering code.
2023-07-15 11:02:11 +02:00
Anton Khirnov 9a97f9cf3a fftools/ffmpeg_enc: initialize audio/video encoders from frame parameters
This is possible now that enc_open() is always called with a non-NULL
frame for audio/video.

Previously the code would directly reach into the buffersink, which is a
layering violation.
2023-07-15 11:02:11 +02:00
Anton Khirnov b295ec31f3 fftools/ffmpeg_filter: only flush vsync code if encoding actually started
Otherwise this has no effect.

Will be useful in following commits.
2023-07-15 11:02:11 +02:00
Anton Khirnov 0a6751a78a fftools/ffmpeg: rework initializing encoders with no frames
When no frames were passed from a filtergraph to an encoder, but the
filtergraph is configured (i.e. has output parameters), encoder flush
code will use those parameters to initialize the encoder in a last-ditch
effort to produce some useful output.

Rework this process so that it is triggered by the filtergraph, which
now sends a dummy frame with parameters, but no data, to the encoder,
rather than the encoder reaching backwards into the filter.

This approach is more in line with the natural data flow from filters to
encoders and will allow to reduce encoder-filter interactions in
following commits.

This code is tested by fate-adpcm-ima-cunning-trunc-t2-track1, which (as
confirmed by Zane) is supposed to produce empty output.
2023-07-15 11:02:11 +02:00
Anton Khirnov 20c42213ea fftools/ffmpeg_mux_init: drop an obsolete assignment
This line was added in c30a4489b4 along with
AVStream.sample_aspect_ratio. However, configuring SAR for video
encoding is now done after this code (specifically in enc_open(), which
is called when the first video frame to be encoded is obtained), so this
line cannot have any meaningful effect.
2023-07-15 11:02:11 +02:00
Anton Khirnov c328bff4da fftools/ffmpeg_enc: return errors from enc_subtitle() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 2e742a2c3c fftools/ffmpeg_mux: return errors from of_streamcopy() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 464a5e8e76 fftools/ffmpeg: handle error codes from process_input_packet()
None are returned for now, but that will change in future commits.
2023-07-15 11:02:11 +02:00
Anton Khirnov 5fe3914c39 fftools/ffmpeg: return an error instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 858b635613 fftools/ffmpeg_mux_init: replace all remaining aborts with returning error codes
Mainly concerns new_stream_*() and their callees.
2023-07-15 11:02:11 +02:00
Anton Khirnov 45473258ff fftools/ffmpeg_mux_init: return error codes from metadata processing instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov dd44871eb9 fftools/ffmpeg_mux_init: improve of_add_programs()
Replace duplicated(!) and broken* custom string parsing with
av_dict_parse_string(). Return error codes instead of aborting.

* e.g. it treats NULL returned from av_get_token() as "separator not
  found", when in fact av_get_token() only returns NULL on memory
  allocation failure
2023-07-15 11:02:11 +02:00
Anton Khirnov fd40197170 fftools/ffmpeg_mux_init: return error codes from validate_enc_avopt() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 4e3557aadb fftools/ffmpeg_mux_init: return error codes from parse_forced_key_frames() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 6691d131d8 fftools/ffmpeg_mux_init: return error codes from copy_meta() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 54cbe6f57d fftools/ffmpeg_mux_init: return error codes from ost_add() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 38a2fc2c29 fftools/ffmpeg_mux_init: move allocation out of prologue
ost_add() has a very large variable declaration prologue, performing
"active" actions that can fail in there is confusing.
2023-07-15 11:02:11 +02:00
Anton Khirnov 4e366100e9 fftools/ffmpeg_mux_init: return error codes from map_*() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov eee09cdf39 fftools/ffmpeg_mux_init: improve error handling in of_add_attachments()
* return error codes instead of aborting
* avoid leaking the AVIOContext on failure
* check the return code of avio_read()
2023-07-15 11:02:11 +02:00
Anton Khirnov b3eedca5e5 fftools/ffmpeg_mux_init: return errors from create_streams() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov c23cff5a8a fftools/ffmpeg_demux: return errors from ist_add() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov cce294638b fftools/ffmpeg: return errors from assert_file_overwrite() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 2d59873fc1 fftools/ffmpeg_demux: add logging for -dump_attachment
Makes it more clear what was written where.
2023-07-15 11:02:11 +02:00
Anton Khirnov 63e4e8e4f4 fftools/ffmpeg_demux: forward errors from dump_attachment() instead of aborting
Also, check the return code of avio_close().
2023-07-15 11:02:11 +02:00
Anton Khirnov ff0160cb37 fftools/ffmpeg_demux: drop a redundant avio_flush()
It is immediately followed by avio_close(), which is documented to flush
the buffers.
2023-07-15 11:02:11 +02:00
Anton Khirnov ad80857a97 fftools/ffmpeg_demux: return errors from ifile_open() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov c313cdd70c fftools/ffmpeg_mux_init: return errors from of_open() instead of aborting 2023-07-15 11:02:11 +02:00
Paul B Mahol ef3b5789ec avfilter/af_atempo: improve RE_MALLOC_OR_FAIL macro
Make use of third parameter of av_calloc() call.
2023-07-15 10:52:15 +02:00
Anton Khirnov f264204de9 lavc: deprecate AV_CODEC_FLAG_DROPCHANGED
This decoding flag makes decoders drop all frames after a parameter
change, but what exactly constitutes a parameter change is not well
defined and will typically depend on the exact use case.
This functionality then does not belong in libavcodec, but rather in
user code
2023-07-15 10:19:33 +02:00
Logan Lyu 9557bf26b3 lavc/aarch64: new optimization for 8-bit hevc_epel_uni_w_hv
put_hevc_epel_uni_w_hv4_8_c: 254.6
put_hevc_epel_uni_w_hv4_8_i8mm: 102.9
put_hevc_epel_uni_w_hv6_8_c: 411.6
put_hevc_epel_uni_w_hv6_8_i8mm: 221.6
put_hevc_epel_uni_w_hv8_8_c: 669.4
put_hevc_epel_uni_w_hv8_8_i8mm: 214.9
put_hevc_epel_uni_w_hv12_8_c: 1412.6
put_hevc_epel_uni_w_hv12_8_i8mm: 481.4
put_hevc_epel_uni_w_hv16_8_c: 2425.4
put_hevc_epel_uni_w_hv16_8_i8mm: 647.4
put_hevc_epel_uni_w_hv24_8_c: 5384.1
put_hevc_epel_uni_w_hv24_8_i8mm: 1450.6
put_hevc_epel_uni_w_hv32_8_c: 9470.9
put_hevc_epel_uni_w_hv32_8_i8mm: 2497.1
put_hevc_epel_uni_w_hv48_8_c: 20930.1
put_hevc_epel_uni_w_hv48_8_i8mm: 5635.9
put_hevc_epel_uni_w_hv64_8_c: 36682.9
put_hevc_epel_uni_w_hv64_8_i8mm: 9712.6

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-07-14 21:19:12 +03:00
Logan Lyu d48c89701c lavc/aarch64: new optimization for 8-bit hevc_epel_h
put_hevc_epel_h4_8_c: 67.1
put_hevc_epel_h4_8_i8mm: 21.1
put_hevc_epel_h6_8_c: 147.1
put_hevc_epel_h6_8_i8mm: 45.1
put_hevc_epel_h8_8_c: 237.4
put_hevc_epel_h8_8_i8mm: 72.1
put_hevc_epel_h12_8_c: 527.4
put_hevc_epel_h12_8_i8mm: 115.4
put_hevc_epel_h16_8_c: 943.6
put_hevc_epel_h16_8_i8mm: 153.9
put_hevc_epel_h24_8_c: 2105.4
put_hevc_epel_h24_8_i8mm: 384.4
put_hevc_epel_h32_8_c: 3631.4
put_hevc_epel_h32_8_i8mm: 519.9
put_hevc_epel_h48_8_c: 8082.1
put_hevc_epel_h48_8_i8mm: 1110.4
put_hevc_epel_h64_8_c: 14400.6
put_hevc_epel_h64_8_i8mm: 2057.1

put_hevc_qpel_h4_8_c: 124.9
put_hevc_qpel_h4_8_neon: 43.1
put_hevc_qpel_h4_8_i8mm: 33.1
put_hevc_qpel_h6_8_c: 269.4
put_hevc_qpel_h6_8_neon: 90.6
put_hevc_qpel_h6_8_i8mm: 61.4
put_hevc_qpel_h8_8_c: 477.6
put_hevc_qpel_h8_8_neon: 82.1
put_hevc_qpel_h8_8_i8mm: 99.9
put_hevc_qpel_h12_8_c: 1062.4
put_hevc_qpel_h12_8_neon: 226.9
put_hevc_qpel_h12_8_i8mm: 170.9
put_hevc_qpel_h16_8_c: 1880.6
put_hevc_qpel_h16_8_neon: 302.9
put_hevc_qpel_h16_8_i8mm: 251.4
put_hevc_qpel_h24_8_c: 4221.9
put_hevc_qpel_h24_8_neon: 893.9
put_hevc_qpel_h24_8_i8mm: 626.1
put_hevc_qpel_h32_8_c: 7437.6
put_hevc_qpel_h32_8_neon: 1189.9
put_hevc_qpel_h32_8_i8mm: 959.1
put_hevc_qpel_h48_8_c: 16838.4
put_hevc_qpel_h48_8_neon: 2727.9
put_hevc_qpel_h48_8_i8mm: 2163.9
put_hevc_qpel_h64_8_c: 29982.1
put_hevc_qpel_h64_8_neon: 4777.6

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-07-14 21:19:12 +03:00
Logan Lyu 668eb4c00e lavc/aarch64: new optimization for 8-bit hevc_epel_uni_w_v
put_hevc_epel_uni_w_v4_8_c: 116.1
put_hevc_epel_uni_w_v4_8_neon: 48.6
put_hevc_epel_uni_w_v6_8_c: 248.9
put_hevc_epel_uni_w_v6_8_neon: 80.6
put_hevc_epel_uni_w_v8_8_c: 383.9
put_hevc_epel_uni_w_v8_8_neon: 91.9
put_hevc_epel_uni_w_v12_8_c: 806.1
put_hevc_epel_uni_w_v12_8_neon: 202.9
put_hevc_epel_uni_w_v16_8_c: 1411.1
put_hevc_epel_uni_w_v16_8_neon: 289.9
put_hevc_epel_uni_w_v24_8_c: 3168.9
put_hevc_epel_uni_w_v24_8_neon: 619.4
put_hevc_epel_uni_w_v32_8_c: 5632.9
put_hevc_epel_uni_w_v32_8_neon: 1161.1
put_hevc_epel_uni_w_v48_8_c: 12406.1
put_hevc_epel_uni_w_v48_8_neon: 2476.4
put_hevc_epel_uni_w_v64_8_c: 22001.4
put_hevc_epel_uni_w_v64_8_neon: 4343.9

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-07-14 21:19:12 +03:00
Logan Lyu 0c604b1913 lavc/aarch64: new optimization for 8-bit hevc_epel_uni_w_h
put_hevc_epel_uni_w_h4_8_c: 126.1
put_hevc_epel_uni_w_h4_8_i8mm: 41.6
put_hevc_epel_uni_w_h6_8_c: 222.9
put_hevc_epel_uni_w_h6_8_i8mm: 91.4
put_hevc_epel_uni_w_h8_8_c: 374.4
put_hevc_epel_uni_w_h8_8_i8mm: 102.1
put_hevc_epel_uni_w_h12_8_c: 806.1
put_hevc_epel_uni_w_h12_8_i8mm: 225.6
put_hevc_epel_uni_w_h16_8_c: 1414.4
put_hevc_epel_uni_w_h16_8_i8mm: 333.4
put_hevc_epel_uni_w_h24_8_c: 3128.6
put_hevc_epel_uni_w_h24_8_i8mm: 713.1
put_hevc_epel_uni_w_h32_8_c: 5519.1
put_hevc_epel_uni_w_h32_8_i8mm: 1118.1
put_hevc_epel_uni_w_h48_8_c: 12364.4
put_hevc_epel_uni_w_h48_8_i8mm: 2541.1
put_hevc_epel_uni_w_h64_8_c: 21925.9
put_hevc_epel_uni_w_h64_8_i8mm: 4383.6

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-07-14 21:19:12 +03:00
Logan Lyu e652e7dcda lavc/aarch64: new optimization for 8-bit hevc_pel_uni_pixels
put_hevc_pel_uni_pixels4_8_c: 35.9
put_hevc_pel_uni_pixels4_8_neon: 7.6
put_hevc_pel_uni_pixels6_8_c: 46.1
put_hevc_pel_uni_pixels6_8_neon: 20.6
put_hevc_pel_uni_pixels8_8_c: 53.4
put_hevc_pel_uni_pixels8_8_neon: 11.6
put_hevc_pel_uni_pixels12_8_c: 89.1
put_hevc_pel_uni_pixels12_8_neon: 25.9
put_hevc_pel_uni_pixels16_8_c: 106.4
put_hevc_pel_uni_pixels16_8_neon: 20.4
put_hevc_pel_uni_pixels24_8_c: 137.6
put_hevc_pel_uni_pixels24_8_neon: 47.1
put_hevc_pel_uni_pixels32_8_c: 173.6
put_hevc_pel_uni_pixels32_8_neon: 54.1
put_hevc_pel_uni_pixels48_8_c: 268.1
put_hevc_pel_uni_pixels48_8_neon: 117.1
put_hevc_pel_uni_pixels64_8_c: 346.1
put_hevc_pel_uni_pixels64_8_neon: 205.9

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-07-14 21:19:12 +03:00
James Almer 74611cdb5c avcodec/decode: use the correct function name
Fixes compilation erros.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-14 13:59:40 -03:00
James Almer dd7bdb40c4 avcodec/decode: fill missing frame fields for all decoders
And not just those with the old decode() API.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-14 13:58:10 -03:00
James Almer 94ac647559 avcodec/decode: check the output frame for discard samples with all decoders
And not just those with the old decode() API.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-14 13:58:10 -03:00
James Almer 7db4c3eaa6 avcodec/decode: simplify applying or exporting skip samples
Copy packet side data to the output frame in ff_decode_frame_props_from_pkt()
instead of in discard_samples(), having the latter only applying the skip if
required.
This will be useful for the following commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-14 13:58:10 -03:00
James Almer 78c52a8ca4 avcodec/decode: move processing discard samples to its own function
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-14 13:58:10 -03:00
David Lemler 357a863299 lavc/libvpxenc: prevent fifo from filling up
Prevent the fifo used in encoding VPx videos from filling up and
stopping encode when it reaches 21845 items, which happens when the
video has more than that number of frames.

Incorporated suggestion from James Zern to prevent calling
frame_data_submit() at all when performing the first pass of a 2-pass
encode so the fifo is not filled at all; replaces original patch which
drained the fifo after filling to prevent it from becoming full.

Fixes the regression originally introduced in
5bda4ec6c3

Co-authored-by: James Zern <jzern@google.com>
Signed-off-by: David Lemler <david@lemler.family>
Signed-off-by: James Zern <jzern@google.com>
2023-07-14 09:55:58 -07:00
Paul B Mahol 374184a4dc avfilter/split: fix EOF passing to inlink 2023-07-14 00:46:45 +02:00
Vignesh Venkatasubramanian 7bcc1b4eb8 libsvtav1: Add workaround for gop_size == 1
In some versions of libsvtav1, setting intra_period_length to 0
does not produce the intended result (i.e.) all frames produced
are not keyframes.

Instead handle the gop_size == 1 as a special case by setting
the pic_type to EB_AV1_KEY_PICTURE when encoding each frame so
that all the output frames are keyframes.

SVT-AV1 Bug: https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2076

Example command: ffmpeg -f lavfi -i testsrc=duration=1:size=64x64:rate=30 -c:v libsvtav1 -g 1 -y test.webm

Before: Only first frame is keyframe, rest are intraonly.
After: All frames are keyframes.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-07-13 17:25:02 -04:00
Khem Raj a7b3c0203f libswscale/riscv: fix syntax of vsetvli
Add missing operand which clang complains about but GCC assumes it to be
'm1' if not specified.

Works around build failure with Clang:
| src/libswscale/riscv/rgb2rgb_rvv.S:88:25: error: operand must be e[8|16|32|64|128|256|512|1024],m[1|2|4|8|f2|f4|f8],[ta|tu],[ma|mu]
|         vsetvli t4, t3, e8, ta, ma
|                         ^

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-07-13 22:01:24 +03:00
Anton Khirnov 9a2335444b fftools/ffmpeg_mux: forward EOF from the sync queue
EOF from sq_receive() means no packets will ever be output by the sync
queue. Since the muxing sync queue is always used by all interleaved
(i.e. non-attachment) streams, this means no further packets can make
it to the muxer and we can terminate muxing now.
2023-07-13 13:08:56 +02:00
Paul B Mahol 7430ee2b8b avfilter/avf_showcwt: add rotation option 2023-07-13 00:11:36 +02:00
Paul B Mahol 422bfdc4ae avfilter/avf_showcwt: add bar display support 2023-07-13 00:11:34 +02:00
Nicolas George ca9ec4e7ed lavu/avassert: include config.h
Fix setting the assert level.
2023-07-12 15:35:37 +02:00
Nicolas George cf7ed01938 lavc/intrax8: fix an assert 2023-07-12 15:35:37 +02:00
James Almer e6954fd087 avcodec/decode: don't reject flush packets when buffer_pkt is not empty
Restores the behavior before commit a92dbeb9ae.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-12 10:34:42 -03:00
Nicolas George 02aeacbb5e lavd/opengl: select the GL context before drawing
Since “2d924b3a63 fftools/ffmpeg: move each muxer to a separate thread”,
opengl_write_packet() is called from a different thread than
opengl_write_header() and would nothing for lack of a selected context.
2023-07-12 15:06:15 +02:00