Commit Graph

111012 Commits

Author SHA1 Message Date
Anton Khirnov 8b23644408
lavc/pthread_frame: add support for thread-safe hwaccels 2023-05-29 00:41:27 +02:00
Anton Khirnov 3d2e1aa324
lavc/decode: stop duplicating code from hwaccel_uninit() 2023-05-29 00:41:27 +02:00
Anton Khirnov a4611e3170
lavc/decode: pass AVHWAccel instead of AVCodecHWConfigInternal to hwaccel_init()
The only thing besides the hwaccel that this function uses from
AVCodecHWConfigInternal is the pixel format, which should always match
the hwaccel one.

Will be useful in following commits.
2023-05-29 00:41:25 +02:00
Paul B Mahol 62d4110a64 avfilter/af_silenceremove: add timestamp option 2023-05-28 12:23:14 +02:00
Paul B Mahol b95d123097 avfilter/silenceremove_template: revert wrong change 2023-05-28 12:23:13 +02:00
Paul B Mahol e53260c1f4 avfilter/af_silenceremove: add ptp detector 2023-05-28 12:23:11 +02:00
Anton Khirnov 163e3a299e fftools/sync_queue: make sure non-limiting streams are not used as queue head
A non-limiting stream could mistakenly end up being the queue head,
which would then produce incorrect synchronization, seen e.g. in
fate-matroska-flac-extradata-update for certain number of frame threads
(e.g. 5).

Found-By: James Almer
2023-05-28 10:47:59 +02:00
Anton Khirnov e9a868e9ee fftools/sync_queue: add debug logging 2023-05-28 10:47:59 +02:00
Anton Khirnov 4e96a71626 fftools/ffmpeg_demux: log discontinuity warnings to stream context
Allows simplifying the log message.
2023-05-28 10:47:59 +02:00
Anton Khirnov 6abb4a28ef fftools/ffmpeg: add InputStream.index
This allows to avoid access to the underlying AVStream in many places.
2023-05-28 10:47:59 +02:00
Anton Khirnov cad59cccaf fftools/ffmpeg_dec: move timestamp estimation state to Decoder
It is purely internal to decoding.
2023-05-28 10:47:59 +02:00
Anton Khirnov 5b05e9e32a fftools/ffmpeg_dec: move InputStream.pkt to Decoder
It is purely internal to decoding.
2023-05-28 10:47:59 +02:00
Anton Khirnov dadeb28e25 fftools/ffmpeg_dec: add decoder private data
Move InputStream.decoded_frame to it.

Analogous to what has been previously done for all the other major
components.
2023-05-28 10:47:59 +02:00
Anton Khirnov 335688a3d3 fftools/ffmpeg_demux: skip unused/attachment streams in final stats
No useful information can be printed for them.
2023-05-28 10:47:59 +02:00
Anton Khirnov d43ae45de0 fftools/ffmpeg_demux: initialize nb_streams_warn
Fixes spurious new-stream warnings for unused streams after
9429624a76
2023-05-28 10:47:59 +02:00
Anton Khirnov 6ee57fd2b6 fftools/ffmpeg_demux: only print demuxing stats if demuxing actually started
If the transcoding process never got to reading any packets from this
input then printing stats is just pointless noise.
2023-05-28 10:47:59 +02:00
Anton Khirnov d9bcbf9200 fftools/ffmpeg: drop outdated comments 2023-05-28 10:47:59 +02:00
Anton Khirnov ec75b79fe1 fftools/ffmpeg: fail earlier on text/bitmap subtitles mismatch
Checking whether the user requested an unsupported conversion between
text and bitmap subtitles can be done immediately when creating the
output stream.
2023-05-28 10:47:59 +02:00
Anton Khirnov 2b3905254e fftools/ffmpeg_enc: use AVFrame.hw_frames_ctx for encoder hw setup
It should be the same as the one that can be extracted from the filter
and does not require access to outside data.
2023-05-28 10:47:59 +02:00
Anton Khirnov f15b206286 fftools/ffmpeg_hw: move hw_device_setup_for_encode() to ffmpeg_enc
This function is entangled with encoder setup, so it is more encoding
code rather than ffmpeg_hw code. This will allow making more encoder
state private in the future.
2023-05-28 10:47:59 +02:00
Anton Khirnov 760a9bd306 fftools/ffmpeg_hw: move hw_device_setup_for_decode() to ffmpeg_dec
This function is entangled with decoder setup, so it is more decoding
code rather than ffmpeg_hw code. This will allow making more decoder
state private in the future.
2023-05-28 10:47:59 +02:00
Paul B Mahol e8e4863325 avfilter/af_silenceremove: fix the any/all confusion and change default
'any' stop mode is now correctly implemented for end trimming and is of limited usage.
Extend examples and other documentation of this filter.
2023-05-27 16:04:00 +02:00
Paul B Mahol 8d662adcc9 avfilter/af_silenceremove: speed-up filtering once start-trim is over
No point to call filter_start on samples that will pass them unchanged
once initial trimming stopped.
2023-05-27 11:18:02 +02:00
Paul B Mahol 965f99f904 avfilter/af_silenceremove: add timeline support 2023-05-27 11:18:00 +02:00
Paul B Mahol 7927a96e2b avfilter/af_silenceremove: add commands support 2023-05-27 11:17:58 +02:00
James Almer e86e2d5921 fftools/ffmpeg_dec: abort if avcodec_send_packet() returns EAGAIN
As the comment in the code mentions, EAGAIN is not an expected value here
because we call avcodec_receive_frame() until all frames have been returned.
avcodec_send_packet() returning EAGAIN means a packet is still buffered, which
hints that the underlying decoder is buggy and not fetching packets as it
should.

An example of this behavior was in the libdav1d wrapper before f209614290,
where feeding it split frames (or individual OBUs) would result in the CLI
eventually printing the confusing "Error submitting packet to decoder: Resource
temporarily unavailable" error message, and just keep going until EOF without
returning new frames.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-26 19:47:54 -03:00
Paul B Mahol 5a13b133f8 avfilter/af_silenceremove: add median silence detector 2023-05-27 00:34:37 +02:00
Paul B Mahol 68d0b881de avfilter/silenceremove_template: fix peak detector
The implementation was not working correctly.
2023-05-27 00:34:35 +02:00
Paul B Mahol 29710dd7f2 avfilter/af_silenceremove: speed-up start-only trimming once trim is over 2023-05-26 10:13:37 +02:00
Paul B Mahol f59d9514da avfilter/silenceremove_template: skip silence start detection after start-only trimming is over 2023-05-26 10:13:37 +02:00
Paul B Mahol 2b5166addf avfilter/af_silenceremove: add real peak detector
Rename old peak detector to more correct name one.
2023-05-26 10:13:37 +02:00
Paul B Mahol 3235de4883 avfilter/af_silenceremove: switch to activate
Do full rewrite, new code is much faster for typical filter usages.
Also previous code was hard to follow and basically very-hard to maintain.
2023-05-26 10:13:37 +02:00
yuanhecai 82278e8749
avutil/la: Add function performance testing
This patch supports the use of the "checkasm --bench" testing feature
on loongarch platform.

Change-Id: I42790388d057c9ade0dfa38a19d9c1fd44ca0bc3
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:05:21 +02:00
Jin Bo cb4ae8baee
swscale/la: Add following builtin optimized functions
yuv420_rgb24_lsx
yuv420_bgr24_lsx
yuv420_rgba32_lsx
yuv420_argb32_lsx
yuv420_bgra32_lsx
yuv420_abgr32_lsx
./configure --disable-lasx
ffmpeg -i ~/media/1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo
-pix_fmt rgb24 -y /dev/null -an
before: 184fps
after:  207fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:05:15 +02:00
Lu Wang 4501b1dfd7
swscale/la: Optimize the functions of the swscale series with lsx.
./configure --disable-lasx
ffmpeg -i ~/media/1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -s 640x480
-pix_fmt bgra -y /dev/null -an
before: 91fps
after:  160fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:05:08 +02:00
yuanhecai f6077cc666
avcodec/la: Add LSX optimization for h264 qpel.
./configure --disable-lasx
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before: 214fps
after:  274fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:05:01 +02:00
Lu Wang 8815a7719e
avcodec/la: Add LSX optimization for h264 chroma and intrapred.
./configure --disable-lasx
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before: 199fps
after:  214fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:04:56 +02:00
Hao Chen 7845b5ecd6
avcodec/la: Add LSX optimization for loop filter.
Replaced function(LSX is sufficient for these functions):
ff_h264_v_lpf_chroma_8_lasx
ff_h264_h_lpf_chroma_8_lasx
ff_h264_v_lpf_chroma_intra_8_lasx
ff_h264_h_lpf_chroma_intra_8_lasx
ff_weight_h264_pixels4_8_lasx
ff_biweight_h264_pixels4_8_lasx

./configure --disable-lasx
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before: 161fps
after:  199fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:04:43 +02:00
Shiyou Yin e1b6ecd20a
avcodec/la: add LSX optimization for h264 idct.
loongson_asm.S is LoongArch asm optimization helper.
Add functions:
  ff_h264_idct_add_8_lsx
  ff_h264_idct8_add_8_lsx
  ff_h264_idct_dc_add_8_lsx
  ff_h264_idct8_dc_add_8_lsx
  ff_h264_idct_add16_8_lsx
  ff_h264_idct8_add4_8_lsx
  ff_h264_idct_add8_8_lsx
  ff_h264_idct_add8_422_8_lsx
  ff_h264_idct_add16_intra_8_lsx
  ff_h264_luma_dc_dequant_idct_8_lsx
Replaced function(LSX is sufficient for these functions):
  ff_h264_idct_add_lasx
  ff_h264_idct4x4_addblk_dc_lasx
  ff_h264_idct_add16_lasx
  ff_h264_idct8_add4_lasx
  ff_h264_idct_add8_lasx
  ff_h264_idct_add8_422_lasx
  ff_h264_idct_add16_intra_lasx
  ff_h264_deq_idct_luma_dc_lasx
Renamed functions:
  ff_h264_idct8_addblk_lasx ==> ff_h264_idct8_add_8_lasx
  ff_h264_idct8_dc_addblk_lasx ==> ff_h264_idct8_dc_add_8_lasx

./configure --disable-lasx
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before: 155fps
after:  161fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:04:25 +02:00
Paul B Mahol 90fba27743 avfilter/trim: switch to activate
This also signals EOF to filter inlink so that unnecessary
extra processing that is immediately dropped by this filter
is not done any more.
2023-05-25 19:52:04 +02:00
Paul B Mahol c6b6356635 avformat/gifdec: switch to using gif parser
Update fate test, more correct as last packet is not truncated.
2023-05-25 19:51:56 +02:00
Paul B Mahol e7cadd0ee5 avformat/demux: add support to derive timestamps from packet durations for video 2023-05-25 19:51:47 +02:00
Paul B Mahol a1838c59bb avfilter/af_astats: add abs_peak_count stat 2023-05-25 19:51:39 +02:00
James Almer 97f4263457 avcodec/av1dec: convert to receive_frame()
This removes the overhead of inserting the av1_frame_split bsf as part of the
decoding process.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-25 11:21:35 -03:00
Gyan Doshi 944243477b doc/filters: clarify requirements for subtitles wrap_unicode option 2023-05-25 12:40:08 +05:30
Zhao Zhili 43ace8f2bc avfilter/vf_subtitles: add wrap_unicode option
So CJK can be wrapped automatically.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-25 11:31:54 +08:00
Haihao Xiang 8e2547ebb2 lavc/qsvenc: the height is aligned to 32 for AV1
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00
Haihao Xiang 943a42fc54 lavc/qsvenc: make sure continuous allocation
Intel MediaSDK and oneVPL expect continuous allocation for data[i],
however there are mandatory padding bytes between data[i] and data[i+1].
when calling av_frame_get_buffer. This patch removes all extra padding
bytes.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00
Haihao Xiang cf79dab8df lavc/qsvenc: avoid data copy if possible
The data copy is unnecessary for packed formats when frame width and
height are aligned

For example:
$ ffmpeg -f lavfi -i testsrc=size=1920x1088 -vf "format=yuyv422" -c:v hevc_qsv -f null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00
Haihao Xiang cfdfd6aa72 lavc/qsvenc: use the right alignment instead of hard coded value
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00