1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-02 03:06:28 +02:00
Commit Graph

105538 Commits

Author SHA1 Message Date
Limin Wang
d9f05bea5c avformat/rtpdec: Fix negative missed packets in warning message
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-30 13:26:35 +08:00
Andreas Rheinhardt
98cef1ebbe avutil/tests/adler32: Remove unnecessary volatile
And use an ordinary stack variable.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 21:26:26 +01:00
Andreas Rheinhardt
f0a7db12a2 avcodec/h264_ps: Remove ALLOW_INTERLACED cruft
Since e1027aba68,
ALLOW_INTERLACED is no longer defined in h264_ps.c,
leading to a warning when encountering an SPS compatible
with MBAFF. This warning was always nonsense, because
ff_h264_decode_seq_parameter_set() is also used by the parser
and it makes no sense for the parser to warn about missing
decoder features; after all, it is not a parser's job
to warn when a feature is unsupported by a decoder
(and in this case it is even weirder, because even if the H.264
decoder is disabled, the warning will only be shown for MBAFF
sequence parameter sets). So remove the warning in h264_ps.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 20:35:05 +01:00
Andreas Rheinhardt
937bb6bbc1 avformat/matroskadec: Export rectangular projection as displaymatrix
This is the officially supported way to express rotations
and flips in Matroska.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 20:06:04 +01:00
Andreas Rheinhardt
b065a70afa avcodec/libxvid: Don't set AVCodecContext.codec_id
Unnecessary since 2325bdad7b
(and crazy even before then).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
577ba4a1af avcodec/mpeg4videodec: Move use_intra_dc_vlc to stack, fix data race
use_intra_dc_vlc is currently kept in sync between frame threads
in mpeg4_update_thread_context(), yet it is set when decoding
blocks, i.e. after ff_thread_finish_setup(). This is a data race
and therefore undefined behaviour.

This race can be fixed easily by moving the variable from the context
to the stack: use_intra_dc_vlc is only read in
mpeg4_decode_block() and only if one is decoding an intra block.
There are three callsites for this function: One in
mpeg4_decode_partitioned_mb() which always sets use_intra_dc_vlc
before the call and two in mpeg4_decode_mb(). One of these callsites
is for intra blocks and use_intra_dc_vlc is set before it;
the last callsite is for non-intra blocks, where use_intra_dc_vlc
is ignored. So if it is used, it always uses a new value and can
therefore be moved to the stack.

The above also explains why this data race did not lead to
FATE-test failures.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
24a654c6c9 avcodec/mpegvideo: Use offset instead of pointer for vbv_delay
An offset has the advantage of not needing to be updated
when the buffer is reallocated. Furthermore, the way the pointer
is currently updated is undefined behaviour in case the pointer
is not already set (i.e. when not encoding MPEG-1/2), because
it calculates the nonsense NULL - s->pb.buf.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
5a04c6a269 avcodec/mpegpicture: Add function to completely free MPEG-Picture
Also use said function in mpegvideo.c and mpegvideo_enc.c;
and make ff_free_picture_tables() static as it isn't needed anymore
outside of mpegpicture.c.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
d0ceb90f44 avcodec/mpegpicture: Let ff_mpeg_unref_picture() free picture tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
dcdb34be91 avcodec/mpegvideo: Move MPEG-4 Simple Studio Profile fields to mpeg4video
This is possible now that dealing with the Simple Studio Profile
has been moved to mpeg4videodec.c. It also allows to avoid
allocations, because one can simply put the required buffers
on the context (if one made these buffers part of MpegEncContext,
the memory would be wasted for every codec other than MPEG-4).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
85ac29ad1c avcodec/mpegvideo: Move handling Simple Studio Profile to mpeg4videodec
This is its only user.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
b8b1c49bfa fate/mpeg4: Add test for MPEG-4 Simple Studio Profile
The sample mpeg4/mpeg4_sstp_dpcm.m4v existed in the FATE-suite,
but it was surprisingly unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
d4d87f2ac5 avcodec/mpegvideo: Fix crash when using lowres with 10bit MPEG-4
In this case the macroblocks written to are smaller, yet
the MPEG-4 Simple Studio Profile code for 10bit DPCM ignored this;
e.g. in case of lowres = 2 or = 3, the sample mpeg4_sstp_dpcm.m4v
from the FATE-suite reads beyond the end of the buffer.

This commit fixes this by taking lowres into account.
The DPCM macroblocks of the aforementioned sample look
as good as can be expected after this patch; yet the non-DPCM
coded macroblocks are simply corrupt.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
9953fc9a23 avcodec/mpegvideo: Fix off-by-one error when decoding >8 bit MPEG-4
Fixes visual corruptions on two macroblocks from two frames from
https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4447/A003C003_SR_422_23.98p.mxf

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
83c1ac6570 avcodec/mpegvideo_enc: Don't hardcode list of codecs supporting bframes
Check for the encoder's AV_CODEC_CAP_DELAY instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:24 +01:00
Andreas Rheinhardt
0063a06aaa avcodec/mpegvideo_enc: Localize check for invalid number of b-frames
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:24 +01:00
Andreas Rheinhardt
aeb83322aa avcodec/mpegvideo: Move frame_rate_index to (Mpeg1|MPEG12Enc)Context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:24 +01:00
Andreas Rheinhardt
e17ceeba3c avcodec/mpegvideo_enc: Move H.263p? encoders to ituh263enc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
2098d1f4c5 avcodec/mpegvideo_enc: Move msmpeg4/wmv1 encoders to msmpeg4enc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
4bbfe02ca0 avcodec/mpegvideo: Move gop_picture_number to MPEG12EncContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
b90ea35182 avcodec/mpegvideo_enc: Don't sync gop_picture_number among slice threads
It is only used by the main thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
757be51ded avcodec/mpegvideo: Move timecode_frame_start to Mpeg1Context
It is only used there and only by the main thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
01f60973a4 avcodec/mpegvideo: Move aspect_ratio_info to Mpeg1Context
Only used there and only by the main thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
30dfd87da1 avcodec/mpeg4videodec: Use stack variable for aspect_ratio_info
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
9288b6366b avcodec/ituh263dec: Use stack variable for aspect_ratio_info
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
f2da650258 avcodec/ituh263enc: Use stack variable for aspect_ratio_info
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
b326c2dcdc avcodec/mpeg4videoenc: Use stack variable for aspect_ratio_info
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
5256658af5 avcodec/mpeg12enc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
d3a2d06633 avcodec/mpeg12enc: Return early if no Sequence Header is written
Allows to avoid one level of indentation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
f05ba7b169 avcodec/mpeg12enc: Use stack variable for aspect_ratio_info
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
769703613a avcodec/ituh263enc: Use stack variable for custom_pcf
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
426d65e3e3 avcodec/mpeg4?video: Move vo_type to Mpeg4DecContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
eb67659884 avcodec/mpeg4videodec: Keep vo_type in sync between threads
Otherwise one can get outdated values when setting FF_DEBUG_PICT_INFO.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
49627b2f2a avcodec/mpeg4videoenc: Use stack variable for vo_type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
7f6596c8bb avcodec/h263: Move decoding-only stuff to a new header h263dec.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
85bbae8473 avcodec/h263: Remove declaration for inexistent function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Andreas Rheinhardt
218d1f76d4 avcodec/jpeg2000dec: Move preparations to main thread, fix race
jpeg2000_decode_tile() (which is run concurrently by several threads
when using slice threading) currently modifies some joint values
before doing its actual work. This is a data race that happens to work
because all threads set the same values; but it is nevertheless
undefined behaviour.

Fix this by performing said preparatory work in the main thread instead.
This fixes the vsynth(1|2|_lena)-jpeg2000(-97)? FATE-tests when using
TSAN and slice threading.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:30 +01:00
Paul B Mahol
e13f0b9456 avfilter/vf_v360: improve xyz_to_fisheye() 2022-01-29 17:36:37 +01:00
Paul B Mahol
3981dbd192 avfilter/vf_v360: improve xyz_to_dfisheye() even more 2022-01-29 17:36:37 +01:00
Timo Rothenpieler
2f323b1978 avutil/hwcontext_qsv: fix typo 2022-01-29 15:37:38 +01:00
Paul B Mahol
d388dc20b9 avfilter/af_afir: switch to lavu/tx 2022-01-29 11:46:55 +01:00
Haihao Xiang
8ca06a8148 lavc/qsvdec: export AVFilmGrainParams side data
When AV_CODEC_EXPORT_DATA_FILM_GRAIN is present, AV1 decoder should
disable film grain application and export the corresponding side data

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-29 12:02:52 +08:00
Haihao Xiang
7c24a768d3 lavc/qsvdec: track the runtime session version
We may check the runtime version for the given features

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-29 12:02:52 +08:00
Haihao Xiang
8dd507bf0d lavc/qsv: allow to add more parameter buffers to QSV frame
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-29 12:02:52 +08:00
Haihao Xiang
80801e5705 lavc/qsvenc: add tile encoding support for VP9
Add -tile_rows and -tile_cols options to specify the number of tile
rows and columns

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-29 12:02:52 +08:00
nyanmisaka
4cc7239d8b libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl
mfxHDLPair was added to qsv, so modify qsv->opencl map function as well.
Now the following commandline works:

ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \
-init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device ocl \
-hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv \
-i input.264 -vf "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \
hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \
-c:v h264_qsv output.264

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2022-01-29 12:02:52 +08:00
Wenbin Chen
a5b1e632c9 libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface
For vaapi if the init_pool_size is not zero, the pool size is fixed.
This means max surfaces is init_pool_size, but when mapping vaapi
frame to qsv frame, the init_pool_size < nb_surface. The cause is that
vaapi_decode_make_config() config the init_pool_size and it is called
twice. The first time is to init frame_context and the second time is to
init codec. On the second time the init_pool_size is changed to original
value so the init_pool_size is lower than the reall size because
pool_size used to initialize frame_context need to plus thread_count and
3 (guarantee 4 base work surfaces). Now add code to make sure
init_pool_size is only set once. Now the following commandline works:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi -i input.264 \
-vf "hwmap=derive_device=qsv,format=qsv" \
-c:v h264_qsv output.264

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2022-01-29 12:02:52 +08:00
Lynne
35080149ef
x86/tx_float: mark AVX2 functions as AVXSLOW
Makes Bulldozer prefer AVX functions rather than AVX2,
which are 64% slower:

AVX:  117653 decicycles in av_tx (fft), 1048535 runs,     41 skips
AVX2: 193385 decicycles in av_tx (fft), 1048561 runs,     15 skips

The only difference between both is that vgatherdpd is used in
the former. We don't want to mark them with the new SLOW_GATHER
flag however, since gathers are still faster on Haswell/Zen 2/3
than plain loads.
2022-01-29 03:08:16 +01:00
Lynne
7e35e0224c
lavu/tx: do not unconditionally free subcontexts if initialization fails
If a codelet initializes 2 subtransforms, and the second one fails,
the failure would free all subcontexts.
Instead, if there are subcontexts still left, don't free the array.
If all initializations fail, the init() function will return,
and reset_ctx() from the previous step will clean up all contained
subtransforms.
2022-01-29 01:02:37 +01:00
Lynne
265731f201
lavu/tx: reset subcontext pointer if initialization fails
Thanks to mkver for pointing this out.
2022-01-29 00:53:35 +01:00