1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-12 19:18:44 +02:00
Commit Graph

110335 Commits

Author SHA1 Message Date
Paul B Mahol
40bae5be5e avcodec: add PDV decoder 2023-04-20 15:44:38 +02:00
James Almer
0760528af2 avcodec/hevc_ps: use get_ue_golomb() for some PPS multilayer extension fields
Also remove the _plus* and _minus* parts of some of these to be in line with
other similar fields in the decoder.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-20 09:53:30 -03:00
James Almer
ab0f3f7fbf avcodec/hevc_ps: fix storage type for some PPS multilayer extension fields
The spec states that the range of values for them is −2^14 to 2^14 − 1, inclusive.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-20 09:53:30 -03:00
James Almer
7fece7676b avcodec/hevc_ps: further constrain allowed num_ref_loc_offsets values
The spec says: "The value of num_ref_loc_offsets shall be in the range of 0 to
vps_max_layers_minus1, inclusive".

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-20 09:53:30 -03:00
Anton Khirnov
c17e33c058 fftools/ffmpeg: propagate frame durations to packets when encoding
Remove now-obsolete code setting packet durations pre-muxing for CFR
encoded video.

Changes output in the following FATE tests:
* numerous adpcm tests
* ffmpeg-filter_complex_audio
* lavf-asf
* lavf-mkv
* lavf-mkv_attachment
* matroska-encoding-delay
  All of these change due to the fact that the output duration is now
  the actual input data duration and does not include padding added by
  the encoder.

* apng-osample: less wrong packet durations are now passed to the muxer.
  They are not entirely correct, because the first frame duration should
  be 3 rather than 2. This is caused by the vsync code and should be
  addressed later, but this change is a step in the right direction.
* tscc2-mov: last output frame has a duration of 11 rather than 1 - this
  corresponds to the duration actually returned by the demuxer.
* film-cvid: video frame durations are now 2 rather than 1 - this
  corresponds to durations actually returned by the demuxer and matches
  the timestamps.
* mpeg2-ticket6677: durations of some video frames are now 2 rather than
  1 - this matches the timestamps.
2023-04-19 21:12:03 +02:00
Anton Khirnov
af286f17a1 fftools/ffmpeg_enc: set audio frame duration when encoding 2023-04-19 21:12:03 +02:00
Anton Khirnov
9a44e0335c fftools/sync_queue: update audio frame duration when re-chunking 2023-04-19 21:12:03 +02:00
Anton Khirnov
b088d59347 lavc/mjpegdec: properly set pts and duration for smvjpeg
A single smvjpeg packet decodes into one large mjpeg frame, slices of
which are then returned as output frames. Packet duration covers all of
these slices.
2023-04-19 21:12:03 +02:00
Anton Khirnov
7ec4881f3e lavc/mjpegdec: simplify smvjpeg_receive_frame()
Unify the code for returning the first and every subsequent frame in a
packet.
2023-04-19 21:12:03 +02:00
Anton Khirnov
6118be25e1 lavc/encode: do not use pkt_duration for encoding
Current code prefers deprecated AVFrame.pkt_duration over its
replacement AVFrame.duration whenever the former is set and not equal to
the latter. However, duration will only be actually used when the
caller sets the AV_CODEC_FLAG_FRAME_DURATION flag, which was added
_after_ AVFrame.duration.

This implies that any caller aware of AV_CODEC_FLAG_FRAME_DURATION is
also aware of AVFrame.duration. pkt_duration should then never be used.
2023-04-19 21:12:03 +02:00
Anton Khirnov
e392674399 lavfi: ensure audio frame durations match the sample count 2023-04-19 21:12:03 +02:00
Ronald S. Bultje
989ff02472 yuv4mpegenc: add bitdepth multiplier after rounding width.
Fixes output of HBD odd-width chroma.
2023-04-19 09:49:09 -04:00
James Almer
13450b6722 avcodec/mpegvideo_enc: ensure lmin is smaller than lmax
Fixes ticket #10234

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-18 22:14:06 -03:00
Michael Niedermayer
1440bf15e2
avcodec/pcm_rechunk_bsf: unref packet before putting a new one in
Fixes: memleak
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_BSF_PCM_RECHUNK_fuzzer-5562089618407424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-18 01:31:38 +02:00
Michael Niedermayer
e2c3aa8e2b
avcodec/lcldec: More space for rgb24
Fixes: Ticket 10239
Fixes: zlib_306_306_rgb24.av

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-18 01:31:38 +02:00
Michael Niedermayer
4ea28554db
avcodec/lcldec: 420 seems missing 2 bytes, ignore that
Fixes: Ticket 10238
Fixes: mszh_306_306_yuv420.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-18 01:31:38 +02:00
Michael Niedermayer
0cf1ac905d
avcodec/lcldec: Support 4:1:1 and 4:2:2 with odd width
Fixes: Ticket10240
Fixes: zlib_306_306_yuv422.avi
Fixes: zlib_306_306_yuv411.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-18 01:31:37 +02:00
Michael Niedermayer
3eb4e28c26
libavcodec/lcldec: width and height should not be unsigned
Computations like col < width - 3 will not work with unsigned width=1

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-18 01:31:37 +02:00
Leo Izen
c3625ccfcd
avcodec/mjpegdec: fix regression with baseline RGB JPEGs
Commit b18a9c2971 introduced a regression
that broke some baseline RGB jpegs. (See Trac issue #4045). This fixes
that.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-04-17 10:44:31 -04:00
Anton Khirnov
0b0fa5c2a8 fftools/ffmpeg_enc: make data_size_enc private to encoding code
It is no longer used outside of ffmpeg_enc.c
2023-04-17 12:01:40 +02:00
Anton Khirnov
30699c103f fftools/ffmpeg_mux: make copy_initial_nonkeyframes private to muxing code
It is no longer used outside of ffmpeg_mux*
2023-04-17 12:01:40 +02:00
Anton Khirnov
7f8827f28e fftools/ffmpeg_mux: make copy_prior_start private to muxing code
It is no longer used outside of ffmpeg_mux*
2023-04-17 12:01:40 +02:00
Anton Khirnov
8763b9cc36 fftools/ffmpeg_mux: make streamcopy_started private to muxing code
It is no longer used outside of ffmpeg_mux*
2023-04-17 12:01:40 +02:00
Anton Khirnov
83646146fe fftools/ffmpeg_mux: make ts_copy_start private to muxing code
It is no longer used outside of ffmpeg_mux*
2023-04-17 12:01:40 +02:00
Anton Khirnov
3f11582ca3 fftools/ffmpeg_mux: stop using filter_in_rescale_delta_last for streamcopy
That field was added to store timestamp conversion state for audio
decoding code. Later it started being used by streamcopy as well, but
that use is wrong because, for a given input stream, both decoding and
an arbitrary number of streamcopies may be performed simultaneously.
They would then all overwrite the same state variable.

Store this state in MuxStream instead.

This is the last use of InputStream in of_streamcopy(), so the ist
parameter can now be removed.
2023-04-17 12:01:40 +02:00
Anton Khirnov
150c992490 fftools/ffmpeg_mux: use output stream parameters in of_streamcopy()
They should always be the same as the input stream parameters, but this
reduces the need to access InputStream in muxing code.
2023-04-17 12:01:40 +02:00
Anton Khirnov
2178ff2162 fftools/ffmpeg: move do_streamcopy() to ffmpeg_mux
do_streamcopy() is muxing code, so this is a more appropriate place for
this. The last uses of InputStream in it will be removed in following
commits.
2023-04-17 12:01:40 +02:00
Anton Khirnov
a34f483291 fftools/ffmpeg: add muxer-input codec parameters to OutputStream
It stores codec parameters of the stream submitted to the muxer, which
may be different from the codec parameters in AVStream due to bitstream
filtering.

This avoids the confusing back and forth synchronisation between the
encoder, bitstream filters, and the muxer, now information flows only in
one direction. It also reduces the need for non-muxing code to access
AVStream.
2023-04-17 12:01:40 +02:00
Anton Khirnov
a064aed4c3 fftools/ffmpeg: store stream media type in OutputStream
Reduces access to a deeply nested muxer property
OutputStream.st->codecpar->codec_type for this fundamental and immutable
stream property.

Besides making the code shorter, this will allow making the AVStream
(OutputStream.st) private to the muxer in the future.
2023-04-17 12:01:40 +02:00
Anton Khirnov
de38e17583 fftools/ffmpeg: initialize no-filter streams earlier
There is no reason to postpone it until transcode_init() anymore, it can
be done right at the end of of_open().
2023-04-17 12:01:40 +02:00
Anton Khirnov
2058402e00 fftools/ffmpeg: open decoders right after we know they are needed
Will allow initializing subtitle encoding earlier.
2023-04-17 12:01:40 +02:00
Anton Khirnov
c8fa58430e fftools/ffmpeg_dec: drop useless abort_codec_experimental()
It does nothing beyond exit_program().
2023-04-17 12:01:40 +02:00
Anton Khirnov
503c705634 fftools/ffmpeg_dec: reindent after previous commit 2023-04-17 12:01:40 +02:00
Anton Khirnov
9ce1a041d8 fftools/ffmpeg: move opening decoders to a new file
All decoding code will be moved to this file in the future.
2023-04-17 12:01:40 +02:00
Anton Khirnov
ff92ecad2f fftools/ffmpeg: stop setting InputStream fields from muxing/filtering code
Set InputStream.decoding_needed/discard/etc. only from
ist_{filter,output},add() functions. Reduces the knowledge of
InputStream internals in muxing/filtering code.
2023-04-17 12:01:40 +02:00
Anton Khirnov
ae071c9e39 fftools/ffmpeg: add a function adding a destination filter for InputStream
This way filtering code does not directly mess with InputStream
internals. Will become more useful in following commits.
2023-04-17 12:01:40 +02:00
Anton Khirnov
c7438e8737 fftools/ffmpeg_mux_init: consolidate input stream flagging code
Makes it easier to see where the input stream is modified from muxer
code.
2023-04-17 12:01:40 +02:00
Anton Khirnov
0c44db4646 fftools/ffmpeg: drop unnecessary indirection
init_input_stream() can print log messages directly, there is no need to
ship them to the caller.

Also, log errors to the InputStream and avoid duplicate information in
the message.
2023-04-17 12:01:40 +02:00
Anton Khirnov
4358d4d8e7 fftools/ffmpeg: move a check to a more appropriate place
reap_filters() no longer needs to access the encoding context.
2023-04-17 12:01:40 +02:00
Anton Khirnov
4fc513b5e3 fftools/ffmpeg: move a misplaced assignment
Changing AVCodecContext.sample_aspect_ratio after the encoder was opened
is by itself questionable, but if anywhere it belongs in encoding rather
than filtering code.
2023-04-17 12:01:36 +02:00
Anton Khirnov
a0452ee837 fftools/ffmpeg_mux_init: remove a redundant check 2023-04-17 12:00:06 +02:00
Anton Khirnov
12f3f41bbf fftools/ffmpeg: move init_output_stream_streamcopy() to ffmpeg_mux_init
Everything in it can be done immediately when creating the output
stream, there is no reason to postpone it.
2023-04-17 12:00:06 +02:00
Anton Khirnov
9bae55165d fftools/ffmpeg_mux_init: restructure output stream creation
Creating a new output stream of a given type is currently done by
calling new_<type>_stream(), which all start by calling
new_output_stream() to allocate the stream and do common init, followed
by type-specific init.

Reverse this structure - the caller now calls the common function
ost_add() with the type as a parameter, which then calls the
type-specific function internally. This will allow adding common code
that runs after type-specific code in future commits.
2023-04-17 12:00:06 +02:00
Anton Khirnov
a7f26b1c63 fftools/ffmpeg_mux_init: move new_output_stream() lower in the file
Reduces the diff in the following commit.

Temporarily add a forward declaration for new_output_stream(), it will
be removed in the next commit.
2023-04-17 12:00:06 +02:00
Anton Khirnov
89c9a3ac35 fftools/ffmpeg: avoid possible invalid reads with short -tag values
Fixes #10319 and #10309.
2023-04-17 11:49:34 +02:00
jianfeng.zheng
65e537b833 vaapi: support VAProfileH264High10 encoding
see https://github.com/intel/libva/pull/664

Signed-off-by: jianfeng.zheng <jianfeng.zheng@mthreads.com>
2023-04-17 15:11:22 +08:00
jianfeng.zheng
1cd5a383d4 vaapi: support VAProfileH264High10 decoding
see https://github.com/intel/libva/pull/664

Signed-off-by: jianfeng.zheng <jianfeng.zheng@mthreads.com>
2023-04-17 15:11:22 +08:00
Jiasheng Jiang
b9ba036680 avcodec/msvideo1enc: Add check for av_malloc
Add the check for the return value of the av_malloc in order to avoid
NULL pointer deference.

Fixes: e4be3485af ("MS Video 1 encoder")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
2023-04-16 23:36:03 -03:00
Jiasheng Jiang
f8d0b13de5 avcodec/rv34: Add check for av_malloc
Add the check for the return value of the av_malloc in order to avoid
NULL pointer deference.

Fixes: b86ab38137 ("Add weighted motion compensation for RV40 B-frames")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
2023-04-16 23:36:03 -03:00
Michael Niedermayer
a3f49168dc
avcodec/j2kenc: Add YA8 and YA16 support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-14 18:59:48 +02:00