Commit Graph

110240 Commits

Author SHA1 Message Date
Anton Khirnov f2c8dff906 fftools/ffmpeg: drop a useless goto
There is no cleanup in transcode(), can return an error directly.
2023-04-13 15:11:56 +02:00
Anton Khirnov 5d4f467cc9 fftools/ffmpeg_enc: replace abort() with av_assert0(0)
This is consistent with the treatment of other unreachable paths.
2023-04-13 15:11:56 +02:00
Anton Khirnov fd91ac11ed fftools/ffmpeg: move OutputStream.last_filter_pts to OutputFilter
This value is associated with the filtergraph output rather than the
output stream, so this is a more appropriate place for it.
2023-04-13 15:11:56 +02:00
Anton Khirnov 83da6d3f54 fftools/ffmpeg: move OutputStream.last_nb0_frames to Encoder
It is video encoding-only and does not need to be visible outside of
ffmpeg_enc.c

Also, rename the variable to frames_prev_hist to be consistent with
the naming in do_video_out().
2023-04-13 15:11:56 +02:00
Anton Khirnov 87ae84e4af fftools/ffmpeg: move OutputStream.sq_frame to Encoder
It is audio/video encoding-only and does not need to be visible outside
of ffmpeg_enc.c
2023-04-13 15:11:56 +02:00
Anton Khirnov 710da200fc fftools/ffmpeg: move OutputStream.next_pts to Encoder
It is audio/video encoding-only and does not need to be visible outside
of ffmpeg_enc.c
2023-04-13 15:11:56 +02:00
Anton Khirnov 45202556cb fftools/ffmpeg: move OutputStream.vsync_frame_number to Encoder
It is video encoding-only and does not need to be visible outside of
ffmpeg_enc.c
2023-04-13 15:11:56 +02:00
xufuji456 1e91a39502 checkasm: pass context as pointer
Signed-off-by: xufuji456 <839789740@qq.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-04-13 15:17:04 +03:00
xufuji456 30def6365d checkasm/hevc: add transform_luma test
Signed-off-by: xufuji456 <839789740@qq.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-04-13 15:17:04 +03:00
Leo Izen 1179bb703e
avcodec/libjxlenc: use reciprocol gamma for GAMMA22 and GAMMA28
libjxl rejects JxlColorEncoding->gamma 2.2f or 2.8f and expects
1/2.2f or 1/2.8f, respectively.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-04-12 10:13:58 -04:00
xufuji456 00a062b8d5 codec/aarch64/hevc:add idct_32x32_neon
got 73% speed up (run_count=1000, CPU=Cortex A53)
idct_32x32_neon: 4826 idct_32x32_c: 18236
idct_32x32_neon: 4824 idct_32x32_c: 18149
idct_32x32_neon: 4937 idct_32x32_c: 18333

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-04-12 15:58:09 +03:00
Zhao Zhili 4dffa564d1 configure: remove duplicated extralibs of android_camera
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-11 19:57:09 +08:00
Zhao Zhili ef09db1eac configure: add mediacodec_extralibs to avutil
Fix #10299

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-11 19:57:00 +08:00
Zhao Zhili ab177c7469 configure: cleanup mediacodec dependency
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-11 19:56:50 +08:00
James Almer 1a7df525f6 avformat/matroskaenc: fix memory leak in fail codepath
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-10 22:12:13 -03:00
James Almer c558fcf41e avformat/matroskadec: also export non-HDR10+ ITU-T T.35 payloads as BlockAdditional side data
Partially reverts a change from 88de01d878, and
2133cadfcf.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-10 18:52:08 -03:00
Leo Izen b18a9c2971
avcodec/mjpegdec: support weird RGB subsampling with progressive
This allows weird subsampling with progressive JPEGs to be decoded,
such as full-RG and only B subsampled.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-04-10 04:55:41 -04:00
Anton Khirnov f098eaee56 fftools/ffmpeg_enc: factorize calling enc_init()
It is done in the same way for both audio and video, so can be moved to
enc_frame().
2023-04-09 15:47:45 +02:00
Anton Khirnov 2225134e7d fftools/ffmpeg: clean up #includes
Drop unneeded ctype.h and math.h.
Group all system headers together.
Sort unconditional includes alphabetically.
Group local includes by the library, sort alphabetically.
2023-04-09 15:47:45 +02:00
Anton Khirnov a2a09932f2 fftools/ffmpeg: stop including os_support.h
It was added for usleep(), which
- is not used in ffmpeg
- is not handled in os_support.h anymore
2023-04-09 15:47:45 +02:00
Anton Khirnov f30b620e98 fftools/ffmpeg: add encoder private data
Start by moving OutputStream.last_frame to it. In the future it will
hold other encoder-internal state.
2023-04-09 15:47:45 +02:00
Anton Khirnov 44accfef41 fftools/ffmpeg: move audio/video encoding code to ffmpeg_enc.c 2023-04-09 15:47:45 +02:00
Anton Khirnov 9de5dc74fd fftools/ffmpeg: move subtitle encoding to ffmpeg_enc.c 2023-04-09 15:47:45 +02:00
Anton Khirnov b79448fa38 fftools/ffmpeg: replace ff_dlog() with av_log()
ff_dlog() is a lavu internal macro, and av_log() at trace level is just
as good here.
2023-04-09 15:47:45 +02:00
Anton Khirnov a996478e8c fftools/ffmpeg: simplify output stream initialization call graph
Several places in the code currently call init_output_stream_wrapper(),
which in turn calls init_output_stream(), which then calls either
enc_open() or init_output_stream_streamcopy(), followed by
of_stream_init(), which tells the muxer the stream is ready for muxing.

All except one of these callers are in the encoding code, which will be
moved to ffmpeg_enc.c. Keeping this structure would then necessitate
ffmpeg_enc.c calling back into the common code in ffmpeg.c, which would
then just call ffmpeg_mux, thus making the already convoluted call chain
even more so.

Simplify the situation by using separate paths for filter-fed output
streams (audio and video encoders) and others (subtitles, streamcopy,
data, attachments).
2023-04-09 15:47:45 +02:00
Anton Khirnov d96f2fbf76 fftools/ffmpeg: move initializing encoders to a new file
This file will contain more encoding-related code in the future.
2023-04-09 15:47:45 +02:00
Anton Khirnov 1dabd48519 fftools/ffmpeg: reindent after previous commit 2023-04-09 15:47:45 +02:00
Anton Khirnov 39291f19e2 fftools/ffmpeg: move encoder initialization to init_output_stream_encode
Encoder initialization is currently split rather arbitrarily between
init_output_stream_encode() and init_output_stream(). Move all of it to
init_output_stream_encode().
2023-04-09 15:47:45 +02:00
Anton Khirnov e1fe6c5577 fftools/ffmpeg: use stack variables to shorten code 2023-04-09 15:47:45 +02:00
Anton Khirnov e1e0c2c7f2 fftools/ffmpeg: drop unnecessary indirection
init_output_stream() can print log messages directly, there is no need
to ship them to the caller.
2023-04-09 15:47:45 +02:00
Anton Khirnov 237f9b9682 fftools/ffmpeg: stop handling AVMEDIA_TYPE_DATA in init_output_stream_encode()
We do not support data encoders, so this should never be reached.
2023-04-09 15:47:45 +02:00
Anton Khirnov 923c6ab170 fftools/ffmpeg: use sync queues for enforcing audio frame size
The code currently uses lavfi for this, which creates a sort of
configuration dependency loop - the encoder should be ideally
initialized with information from the first audio frame, but to get this
frame one needs to first open the encoder to know the frame size. This
necessitates an awkward workaround, which causes audio handling to be
different from video.

With this change, audio encoder initialization is congruent with video.
2023-04-09 15:47:45 +02:00
Anton Khirnov f9d3c06533 fftools/sync_queue: allow requesting a specific number of audio samples
This will be made useful in following commits.
2023-04-09 15:47:45 +02:00
Anton Khirnov 81cca3dae3 fftools/sync_queue: make sure audio duration matches sample count
For audio AVFrames, nb_samples is typically more trustworthy than
duration. Since sync queues look at durations, make sure they match the
sample count.

The last audio frame in the fate-shortest test is now gone. This is more
correct, since it outlasts the last video frame.
2023-04-09 15:47:45 +02:00
Anton Khirnov 9a85245adf fftools/sync_queue: support operation with no limiting streams
ffmpeg CLI will not create such queues currently, but this will become
useful in following commits.
2023-04-09 15:47:45 +02:00
Anton Khirnov 98b41d0bd2 fftools/sync_queue: document overall design 2023-04-09 15:47:45 +02:00
Anton Khirnov 090950f832 fftools/sync_queue: use timebase from input frames/packets
They are always properly set now. Avoid a separate timebase-setting
call, which duplicates the knowledge of the timebase being used.
2023-04-09 15:47:45 +02:00
Anton Khirnov 87e9f5ad3c fftools/ffmpeg: move initializing next_[pd]ts to add_input_streams()
They are initialized to constants, so it makes most sense to do it as
soon as possible.
2023-04-09 15:47:45 +02:00
Anton Khirnov 8e23a62eff fftools/ffmpeg: drop InputStream.processing_needed
It is equivalent to !InputStream.discard.
2023-04-09 15:47:45 +02:00
Anton Khirnov e1d12aaa45 fftools/ffmpeg: do not return finished streams from choose_output() 2023-04-09 15:47:45 +02:00
Anton Khirnov 416e2661ea fftools/ffmpeg: make sure non-lavfi streams are closed on input EOF 2023-04-09 15:47:45 +02:00
Zhao Zhili 862a626c9d avcodec/mediacodecenc: warning when global header is requested.
Add suggests to use extract_extradata bsf.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-09 21:44:29 +08:00
Zhao Zhili 34b8af7963 avformat/flvenc: use extract_extradata bsf when necessary
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-09 21:44:29 +08:00
Jun Zhao 639ded10e3 lavc/videotoolbox: fix warnings
fix mixing declarations and code warnings

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-04-09 18:12:26 +08:00
Jun Zhao aa8ff2240c lavc/videotoolboxenc: fix warnings
fix mixing declarations and code and function
declaration without a prototype warnings

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-04-09 18:11:58 +08:00
James Almer 82a14f3602 avformat/matroskadec: also validate the mapping when BlockAddIDType is 0
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 15:24:44 -03:00
Jerome Martinez 05e34523bc avcodec/dpx: fix check of minimal data size for unpadded content
stride value is not relevant with unpadded content and the total count
of pixels (width x height) must be used instead of the rounding based on
width only then multiplied by height

unpadded_10bit value computing is moved sooner in the code in order to
be able to use it during computing of minimal content size. Also make sure to
only set it for 10bit.

Fix 'Overread buffer' error when the content is not lucky enough to have
(enough) padding bytes at the end for not being rejected by the formula
based on the stride value

Fixes ticket #10259.

Signed-off-by: Jerome Martinez <jerome@mediaarea.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-08 20:08:18 +02:00
Devin Heitmueller 12d1f7c4b7 avdevice/decklink_enc: Add support for compressed AC-3 output over SDI
Extend the decklink output to include support for compressed AC-3,
encapsulated using the SMPTE ST 377:2015 standard.

This functionality can be exercised by using the "copy" codec when
the input audio stream is AC-3.  For example:

./ffmpeg -i ~/foo.ts -codec:a copy -f decklink 'UltraStudio Mini Monitor'

Note that the default behavior continues to be to do PCM output,
which means without specifying the copy codec a stream containing
AC-3 will be decoded and downmixed to stereo audio before output.

Thanks to Marton Balint for providing feedback.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-08 20:08:18 +02:00
James Almer 30f1f89572 fate/matroska: add HDR10+ muxing tests
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 10:28:41 -03:00
James Almer bda44f0f39 avformat/matroskaenc: support writing Dynamic HDR10+ packet side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 10:28:41 -03:00