Commit Graph

102589 Commits

Author SHA1 Message Date
Andreas Rheinhardt 3280c6f938 avcodec/libvpxenc: Avoid copying data, allow user-supplied buffers
Here the packet size is known before allocating the packet because
the encoder provides said information (and works with internal buffers
itself), so one can use this information to avoid the implicit use of
another intermediate buffer for the packet data; and by switching to
ff_get_encode_buffer() one can also allow user-supplied buffers.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:50:46 +02:00
Andreas Rheinhardt d8e66ec1d7 avcodec/libvorbisenc: Avoid copying data, allow user-supplied buffers
Here the packet size is known before allocating the packet because
the encoder provides said information (and works with internal buffers
itself), so one can use this information to avoid the implicit use of
another intermediate buffer for the packet data; and by switching to
ff_get_encode_buffer() one can also allow user-supplied buffers.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:49:45 +02:00
Andreas Rheinhardt 6ba55e9652 avcodec/libtheoraenc: Avoid copying data, allow user-supplied buffers
Here the packet size is known before allocating the packet because
the encoder provides said information (and works with internal buffers
itself), so one can use this information to avoid the implicit use of
another intermediate buffer for the packet data; and by switching to
ff_get_encode_buffer() one can also allow user-supplied buffers.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:47:49 +02:00
Andreas Rheinhardt 6564ab0e01 avcodec/libshine: Avoid copying data, allow user-supplied buffer
The libshine encoder already uses an internal buffer, so that the
packet size is already known before allocating the packet; therefore
one can avoid another (implicit) intermediate buffer by switching
to ff_get_encode_buffer(), thereby also supporting user-supplied
buffers.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:44:13 +02:00
Andreas Rheinhardt 0812a60fee avcodec/libopenh264enc: Allow user-supplied buffers
Here the packet size is known before allocating the packet,
so that supporting user-supplied buffers is trivial.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:43:32 +02:00
Andreas Rheinhardt c59398970b avcodec/libmp3lame: Avoid copying data, allow user-supplied buffer
The libmp3lame encoder already uses an internal buffer, so that the
packet size is already known before allocating the packet; therefore
one can avoid another (implicit) intermediate buffer by switching
to ff_get_encode_buffer(), thereby also supporting user-supplied
buffers.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:42:54 +02:00
Andreas Rheinhardt 95c8a859d9 avcodec/libkvazaar: Allow user-supplied buffers
Here the packet size is known before allocating the packet,
so that supporting user-supplied buffers is trivial.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:42:22 +02:00
Andreas Rheinhardt 91567c28fc avcodec/libgsmenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:42:02 +02:00
Andreas Rheinhardt 398822a70e avcodec/libcodec2: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:41:28 +02:00
Andreas Rheinhardt 044daa7c45 avcodec/libaomenc: Avoid copying data, allow user-supplied buffers
Here the packet size is known before allocating the packet because
the encoder provides said information (and works with internal buffers
itself), so one can use this information to avoid the implicit use of
another intermediate buffer for the packet data; and by switching to
ff_get_encode_buffer() one can also allow user-supplied buffers.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:39:51 +02:00
Andreas Rheinhardt c685249ff8 avcodec/audiotoolboxenc: Remove AV_CODEC_CAP_DR1
It has been added in 2016 when this flag made no sense for encoders at
all; now that it makes sense, audiotoolboxenc doesn't support it,
despite claiming to do so.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 14:38:15 +02:00
Andreas Rheinhardt a0ab83bf93 avfilter/vf_guided: Don't needlessly copy properties, fix potential NPD
ref_frame is owned by the framesync structure and should therefore not
be modified; furthermore, these properties that are copied don't seem to
be used at all, so copying is unnecessary. Finally copying when the
destination frame is NULL gives a guaranteed segfault.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 13:42:16 +02:00
Andreas Rheinhardt 376e80ad74 avfilter/vf_guided: Fix leak of frames
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 13:42:16 +02:00
Andreas Rheinhardt 618d186b8c avfilter/vf_guided: Don't free frame we don't own
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 13:42:04 +02:00
Gyan Doshi 4c0d6c91f6 doc/encoders: update default coder for aac
Changed in 660d1d8e3b.
2021-05-23 13:30:44 +05:30
Anton Khirnov 9d4c018497 avio: do not export avpriv_io_{move,delete}
They are private and not used by anything outside of lavf. There is no
reason for them to be exported.
2021-05-22 15:27:55 +02:00
Martin Storsjö f27e3ccf06 aarch64: hevc_idct: Fix overflows in idct_dc
This is marginally slower, but correct for all input values.
The previous implementation failed with certain input seeds, e.g.
"checkasm --test=hevc_idct 98".

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-05-22 00:08:03 +03:00
Lynne 0fd7f14c75
fate-aac: use the fast coder for tests
The twoloop coder is highly loaded with (pseudo-)perceptual metrics,
and the aim of the tests is to piece-wise test each function of the
encoder, for which the 'fast' coder is perfect, since it only decides
on which scalefactors to use, rather than enable or disable encoder
features.
2021-05-21 19:28:50 +02:00
Lynne 660d1d8e3b
aacenc: make the twoloop coder the default
This used to be the default, but was reverted as it was slower than
the 'fast' coder by around 25%.
Since our encoder is still not very good, change back to the twoloop
coder by default. It has much better rate control management as well,
making it closer to CBR, and it sounds much better.
2021-05-21 17:43:13 +02:00
Ubaldo Porcheddu 36b16a30db avformat/mpegtsenc: add NIT support
With some minor changes by Marton Balint:
 - removed trailing whitespace
 - fixed network_descriptors_length
 - fixed reserved_future_use flag in the start of the section
 - removed unused program variable
 - emit first NIT after PAT
 - some other cosmetics

Signed-off-by: Ubaldo Porcheddu <ubaldo@eja.it>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-05-20 23:07:46 +02:00
Marton Balint f597041d57 avformat/flvdec: use milisecond precision for parsing timestamps
Also use helper function to set the timestamp. Maybe we could also use
nanosecond precision, but there were some float rounding concerns.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-05-20 20:39:14 +02:00
Fei Wang 9b131e8500 avcodec/vaapi_av1: pass full buffer size for each tile
Previously, only the size of a given tile was passed, making the
offset and size marked in VASliceParameterBufferAV1 invalid with
multiple tiles.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2021-05-20 17:09:48 +03:00
Valerii Zapodovnikov ab658db4d0 libavformat/hlsenc: fix typos in comments 2021-05-20 09:25:15 +05:30
Michael Niedermayer 1642d8188d avfilter/avfiltergraph: Remove NULL checks after dereferences
Fixes: CID1398579 Dereference before null check
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-19 16:58:25 +02:00
Gyan Doshi 2261cc6d8a doc/filters: note order of inputs for libvmaf 2021-05-19 14:50:00 +05:30
Zane van Iperen f9eb440e78
avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by the SDK
Fixes build failure on older SDKs without it.

Fixes #9242

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-19 10:37:51 +10:00
Michael Niedermayer 3e44bd068f avformat/fifo: check for flushed packets and timeshift
Fixes: CID1464151 Dereference after null check

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-18 19:11:50 +02:00
James Almer a42d249c91 avformat/framecrcenc: print basic side data information again
This partially reverts c6ae560a18.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-18 10:18:49 -03:00
Guo, Yejun 4718d74c58 lavfi/vf_dnn_processing.c: fix CID 1460603
CID 1460603 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS)
2021-05-18 09:20:08 +08:00
Guo, Yejun 3fb1d2e71c lavfi/dnn/dnn_io_proc.c: fix Improper use of negative value (NEGATIVE_RETURNS)
fix coverity CID 1473511 and 1473566
2021-05-18 09:20:08 +08:00
Guo, Yejun bd6ea9ed1d lavfi/dnn/dnn_io_proc.c: Fix Out-of-bounds access (ARRAY_VS_SINGLETON)
fix coverity CID 1473571, 1473577 and 1482089
2021-05-18 09:20:08 +08:00
Shubhanshu Saxena 11b489d592 lavfi/dnn_backend_native_layer_mathunary.h: Documentation
Add documentation for Unary Math Layer

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-05-17 09:33:40 +08:00
Shubhanshu Saxena 57fe5c1412 lavfi/dnn_backend_native_layer_depth2space.h: Documentation
Add documentation for Depth to Space Layer

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-05-17 09:33:40 +08:00
Shubhanshu Saxena 58de2b9eb3 lavfi/dnn_backend_native_layer_dense.h: Documentation
Add documentation for Dense Layer

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-05-17 09:33:40 +08:00
Shubhanshu Saxena a61b7654a2 lavfi/dnn_backend_native_layer_conv2d.h: Documentation
Add documentation for 2D Convolution Layer

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-05-17 09:33:40 +08:00
Gyan Doshi f53414a038 avfilter/metadata: add intuitive labels for metadata values 2021-05-16 10:24:27 +05:30
Andreas Rheinhardt bc40cd6214 avcodec/exrenc: Allow user-supplied buffers
Trivial for an encoder that has a good estimate of the size of
the output packet in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-15 13:00:12 +02:00
Andreas Rheinhardt ed8a7c25cd avcodec/vc2enc: Allow user-supplied buffers
Trivial for an encoder that has a very good estimate of the size
of the output packet in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-15 12:14:41 +02:00
Andreas Rheinhardt 911806ec75 avcodec/jpeglsenc: Remove unnecessary header
Unnecessary since 130d89d786.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-15 12:07:36 +02:00
Andreas Rheinhardt 83cb9be1d2 avcodec/jpeglsenc: Remove redundant implicit checks
Now that the proper buffer size is calculated (and checked) before
allocating the buffer, it is known that the buffer always suffices.
So use the unchecked PutBit-API; and also use an unchecked bitstream
reader as we check ourselves.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-15 12:06:32 +02:00
Andreas Rheinhardt f249c32eff avcodec/jpeglsenc: Avoid intermediate buffer, allow user-supplied buffers
Up until now, the JPEG-LS encoder allocated a worst-case-sized packet
at the beginning of each encode2 call; then it wrote the packet header
into its destination buffer and encoded the actual packet data;
said data is written into another worst-case-sized buffer, because it
needs to be escaped before being written into the packet buffer.
Finally, because the packet buffer is worst-case-sized, the generic
code copies the actually used part into a fresh buffer.

This commit changes this: Allocating the packet and writing the header
into it is deferred until the actual data has been encoded and its size
is known. This gives a good upper bound for the needed size of the packet
buffer (the upper bound might be 1/15 too large) and so one can avoid the
implicit intermediate buffer and support user-supplied buffers by using
ff_get_encode_buffer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-15 11:56:35 +02:00
Andreas Rheinhardt 634a187b9b avcodec/jpeglsenc: Allocate buffer with fixed size only once
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-15 11:45:23 +02:00
Andreas Rheinhardt 79402e2c36 avcodec/jpeglsenc: Check for invalid dimensions
The dimensions are written on two bytes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-15 11:32:15 +02:00
Steven Liu 59032494e8 Revert "avformat/hlsenc: compute video_keyframe_size after write keyframe"
This reverts commit b5ca8f2c66.

This commit will make new problem about tickets: 9193,9205
It flush data into file with init file context together,
and it can get keyframe size, maybe need more method to get keyframe
size.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2021-05-15 15:27:58 +08:00
Andreas Rheinhardt c9a79532e5 avcodec/libx264: Fix redundant setting of caps_internal
Exists since 8a129077cc.
Fixes a -Winitializer-overrides warning when building with Clang.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-14 13:58:02 +02:00
Gyan Doshi 37099f2132 doc/filters: Unhedge note for sub option in guided filter 2021-05-14 15:39:47 +05:30
Gyan Doshi 234e719194 avfilter/guided: reindent after 93ddb9b617 2021-05-14 15:37:45 +05:30
Gyan Doshi 93ddb9b617 avfilter/guided: simplify subsampling assignment.
Reduce option ranges to effective values.

Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
2021-05-14 15:33:30 +05:30
Anton Khirnov ef58f48d59 fate: add a more extensive test for APNG_DISPOSE_OP_BACKGROUND
Uses the sample from #9184.
2021-05-14 11:15:13 +02:00
Anton Khirnov aa726eaed9 lavc/pngdec: fix updating reference frames for APNG_DISPOSE_OP_BACKGROUND
They should be treated the same as APNG_DISPOSE_OP_NONE.

Broken in 5663301560.

Fixes #9184.
2021-05-14 11:15:13 +02:00