[FFmpeg-devel] [PATCH] avutils/video_enc_params: remove unnecessary check to fix compile warning
This will fix following compile warning: libavutil/video_enc_params.c: In function ‘av_video_enc_params_alloc’: libavutil/video_enc_params.c:36:19: warning: comparison is always false due to limited range of data type [-Wtype-limits] 36 | if (nb_blocks > SIZE_MAX / sizeof(AVVideoBlockParams) || | ^ Suppose a is "nb_blocks > SIZE_MAX / sizeof(AVVideoBlockParams))" b is "nb_blocks * sizeof(AVVideoBlockParams) > SIZE_MAX - sizw" If a is true, b is true. If a is false, the expression depends on b. No matter a is true or not, it we only need check b. --- libavutil/video_enc_params.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c index c46c0f1dc6..31bce6a277 100644 --- a/libavutil/video_enc_params.c +++ b/libavutil/video_enc_params.c @@ -33,8 +33,7 @@ AVVideoEncParams *av_video_enc_params_alloc(enum AVVideoEncParamsType type, size_t size; size = sizeof(*par); -if (nb_blocks > SIZE_MAX / sizeof(AVVideoBlockParams) || -nb_blocks * sizeof(AVVideoBlockParams) > SIZE_MAX - size) +if (nb_blocks * sizeof(AVVideoBlockParams) > SIZE_MAX - size) return NULL; size += sizeof(AVVideoBlockParams) * nb_blocks; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/movtextenc: fix compile warning for type-limits
CC libavcodec/mpegaudiodec_common.o libavcodec/movtextenc.c: In function ‘mov_text_style_start’: libavcodec/movtextenc.c:358:26: warning: comparison is always false due to limited range of data type [-Wtype-limits] 358 | if (s->count + 1 > SIZE_MAX / sizeof(*s->style_attributes) || --- libavcodec/movtextenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 1bef21e0b9..cd0e43a79b 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -355,7 +355,7 @@ static int mov_text_style_start(MovTextContext *s) StyleBox *tmp; // last style != defaults, end the style entry and start a new one -if (s->count + 1 > SIZE_MAX / sizeof(*s->style_attributes) || +if ((s->count + 1) * sizeof(*s->style_attributes) > SIZE_MAX || !(tmp = av_fast_realloc(s->style_attributes, &s->style_attributes_bytes_allocated, (s->count + 1) * sizeof(*s->style_attributes { -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] avformat/mov: fix timecode with counter mode flag set
On Sun, Jan 31, 2021 at 1:27 AM Mark Reid wrote: > > > On Sat, Jan 16, 2021 at 5:48 PM wrote: > >> From: Mark Reid >> >> The current behaviour ends up squaring the avg_frame_rate if the conter >> mode flag is set. >> This messes up the timecode calculation, and looks to me as a regression >> that >> seems to have been introduced 428b4aac. >> >> Upon further testing is seems that no special case is need for having the >> counter flag set. >> av_timecode_init appears to handles the timecode correctly, at least in >> the sample files >> I have. >> >> Here is a sample mov file with the counter flag set >> https://www.dropbox.com/s/5l4fucb9lhq523s/timecode_counter_mode.mov >> >> before the patch ffmpeg will report the timecode as: >> 00:37:11:97 and warns that the timecode framerate is 57600/1002001 >> >> after patch: >> 14:50:55:02 >> >> --- >> libavformat/mov.c | 13 - >> 1 file changed, 13 deletions(-) >> >> diff --git a/libavformat/mov.c b/libavformat/mov.c >> index 3215b53636..f8856a43dd 100644 >> --- a/libavformat/mov.c >> +++ b/libavformat/mov.c >> @@ -2350,19 +2350,6 @@ FF_DISABLE_DEPRECATION_WARNINGS >> st->codec->time_base = av_inv_q(st->avg_frame_rate); >> FF_ENABLE_DEPRECATION_WARNINGS >> #endif >> -/* adjust for per frame dur in counter mode */ >> -if (tmcd_ctx->tmcd_flags & 0x0008) { >> -int timescale = AV_RB32(st->codecpar->extradata + 8); >> -int framedur = AV_RB32(st->codecpar->extradata + 12); >> -st->avg_frame_rate.num *= timescale; >> -st->avg_frame_rate.den *= framedur; >> -#if FF_API_LAVF_AVCTX >> -FF_DISABLE_DEPRECATION_WARNINGS >> -st->codec->time_base.den *= timescale; >> -st->codec->time_base.num *= framedur; >> -FF_ENABLE_DEPRECATION_WARNINGS >> -#endif >> -} >> if (size > 30) { >> uint32_t len = AV_RB32(st->codecpar->extradata + 18); /* >> name atom length */ >> uint32_t format = AV_RB32(st->codecpar->extradata + 22); >> -- >> 2.21.1 (Apple Git-122.3) >> >> > Ping > ping ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavdevice/avfoundation: add buffer fifo and output packets in order they arrive
From: Mark Reid Hi, This patch fixes audio issues I've had with some capture devices. The audio gets really choppy and stops working. This seems to be because avf_read_packet stops outputting the audio frames because a video frame happens to be available first. It base on the approach used in a patch from #4437 https://trac.ffmpeg.org/ticket/4437 My approach uses an AVFifoBuffer instead of NSMutableArray and also outputs the packets in the same order they arrive from AVFFoundation. should fix ticket #4437 and #4513 --- libavdevice/avfoundation.m | 160 - 1 file changed, 124 insertions(+), 36 deletions(-) diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index 59d5b0af4f..5ac6ec4183 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -31,13 +31,17 @@ #include "libavutil/pixdesc.h" #include "libavutil/opt.h" #include "libavutil/avstring.h" +#include "libavutil/avassert.h" #include "libavformat/internal.h" #include "libavutil/internal.h" #include "libavutil/parseutils.h" #include "libavutil/time.h" #include "libavutil/imgutils.h" +#include "libavutil/fifo.h" #include "avdevice.h" +#define FIFO_SIZE 4 + static const int avf_time_base = 100; static const AVRational avf_time_base_q = { @@ -128,8 +132,8 @@ typedef struct AVCaptureSession *capture_session; AVCaptureVideoDataOutput *video_output; AVCaptureAudioDataOutput *audio_output; -CMSampleBufferRef current_frame; -CMSampleBufferRef current_audio_frame; +AVFifoBuffer *video_fifo; +AVFifoBuffer *audio_fifo; AVCaptureDevice *observed_device; #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -138,6 +142,11 @@ typedef struct int observed_quit; } AVFContext; +typedef struct { +int64_t ts; +CMSampleBufferRef frame; +} BufferRef; + static void lock_frames(AVFContext* ctx) { pthread_mutex_lock(&ctx->frame_lock); @@ -148,6 +157,48 @@ static void unlock_frames(AVFContext* ctx) pthread_mutex_unlock(&ctx->frame_lock); } +static inline void fifo_write(AVFifoBuffer* f, int64_t ts, CMSampleBufferRef frame) +{ +BufferRef buf = { +.ts= ts, +.frame = frame, +}; + +CFRetain(frame); +av_fifo_generic_write(f, &buf, sizeof(BufferRef), NULL); +} + +static inline void fifo_peek(AVFifoBuffer* f, BufferRef *buf) +{ +if (av_fifo_size(f)) { +av_fifo_generic_peek(f, buf, sizeof(BufferRef), NULL); +return; +} +buf->frame = nil; +return; +} + +static inline void fifo_drain(AVFifoBuffer* f, int release) +{ +av_assert2(av_fifo_size(f) >= sizeof(BufferRef)); +if (release) { +BufferRef buf; +fifo_peek(f, &buf); +CFRelease(buf.frame); +} +av_fifo_drain(f, sizeof(BufferRef)); +} + +static inline void fifo_freep(AVFifoBuffer **f) +{ +if (f) { +while (av_fifo_size(*f)) { +fifo_drain(*f, 1); +} +av_fifo_freep(f); +} +} + /** FrameReciever class - delegate for AVCaptureSession */ @interface AVFFrameReceiver : NSObject @@ -225,13 +276,16 @@ static void unlock_frames(AVFContext* ctx) didOutputSampleBuffer:(CMSampleBufferRef)videoFrame fromConnection:(AVCaptureConnection *)connection { +AVFifoBuffer *fifo = _context->video_fifo; +int64_t ts = av_gettime_relative(); lock_frames(_context); -if (_context->current_frame != nil) { -CFRelease(_context->current_frame); +if (av_fifo_space(fifo) == 0) { +av_log(_context, AV_LOG_DEBUG, "video fifo is full, the oldest frame has been dropped\n"); +fifo_drain(fifo, 1); } -_context->current_frame = (CMSampleBufferRef)CFRetain(videoFrame); +fifo_write(fifo, ts, videoFrame); unlock_frames(_context); @@ -269,13 +323,16 @@ static void unlock_frames(AVFContext* ctx) didOutputSampleBuffer:(CMSampleBufferRef)audioFrame fromConnection:(AVCaptureConnection *)connection { +AVFifoBuffer *fifo = _context->audio_fifo; +int64_t ts = av_gettime_relative(); lock_frames(_context); -if (_context->current_audio_frame != nil) { -CFRelease(_context->current_audio_frame); +if (!av_fifo_space(fifo)) { +av_log(_context, AV_LOG_DEBUG, "audio fifo is full, the oldest frame has been dropped\n"); +fifo_drain(fifo, 1); } -_context->current_audio_frame = (CMSampleBufferRef)CFRetain(audioFrame); +fifo_write(fifo, ts, audioFrame); unlock_frames(_context); @@ -301,12 +358,10 @@ static void destroy_context(AVFContext* ctx) ctx->avf_audio_delegate = NULL; av_freep(&ctx->audio_buffer); +fifo_freep(&ctx->video_fifo); +fifo_freep(&ctx->audio_fifo); pthread_mutex_destroy(&ctx->frame_lock); - -if (ctx->current_frame) { -CFRelease(ctx->current_frame); -} } static void parse_device_name(AVForma
Re: [FFmpeg-devel] [PATCH 2/2] avfilter/x86/vf_gblur: add postscale SIMD
On 2/13/2021 8:10 AM, Paul B Mahol wrote: Signed-off-by: Paul B Mahol --- libavfilter/x86/vf_gblur.asm| 46 + libavfilter/x86/vf_gblur_init.c | 11 ++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/libavfilter/x86/vf_gblur.asm b/libavfilter/x86/vf_gblur.asm index a25b1659f5..8fea6d2a61 100644 --- a/libavfilter/x86/vf_gblur.asm +++ b/libavfilter/x86/vf_gblur.asm @@ -183,3 +183,49 @@ HORIZ_SLICE INIT_XMM avx2 HORIZ_SLICE %endif + +%macro POSTSCALE_SLICE 0 +%if UNIX64 +cglobal postscale_slice, 2, 6, 4, ptr, length, postscale, min, max, x cglobal postscale_slice, 2, 3, 4, ptr, length, x +%else +cglobal postscale_slice, 5, 6, 4, ptr, length, postscale, min, max, x +%endif +shl lengthd, 2 +%if WIN64 +SWAP 0, 2 +SWAP 1, 3 +SWAP 2, 4 +%endif +shufps xm0, xm0, 0 +shufps xm1, xm1, 0 +shufps xm2, xm2, 0 +%if cpuflag(avx2) +vinsertf128 m0, m0, xm0, 1 +vinsertf128 m1, m1, xm1, 1 +vinsertf128 m2, m2, xm2, 1 You can use vbroadcastss ymm, xmm with AVX2, which combines both the shufps and vinsertf128 into one instruction. As is, this function is base AVX. So if you can't measure any performance gain with vbroadcastss, then just mark the function as AVX. +%endif +xor xq, xq + +.loop: +movu m3, [ptrq + xq] +mulps m3, m0 AVX can use unaligned memory operands, so just do mulps m3, m0, [ptrq + xq] But keep the explicit movu + mulps for the SSE version, otherwise x86inc will expand it into a mova. +maxps m3, m1 +minps m3, m2 +movu [ptrq+xq], m3 + +add xq, mmsize +cmp xd, lengthd Can't you use the neg trick? It should let you reuse length instead of x. +jl .loop + +RET +%endmacro + +%if ARCH_X86_64 Nothing in this function seems to require x86_64. +INIT_XMM sse4 No instruction is SSE4 here. It's all base SSE. +POSTSCALE_SLICE + +%if HAVE_AVX_EXTERNAL Wrong check. +INIT_YMM avx2 +POSTSCALE_SLICE +%endif +%endif diff --git a/libavfilter/x86/vf_gblur_init.c b/libavfilter/x86/vf_gblur_init.c index e63e59fe23..7a9b40b0ad 100644 --- a/libavfilter/x86/vf_gblur_init.c +++ b/libavfilter/x86/vf_gblur_init.c @@ -27,14 +27,21 @@ void ff_horiz_slice_sse4(float *ptr, int width, int height, int steps, float nu, float bscale); void ff_horiz_slice_avx2(float *ptr, int width, int height, int steps, float nu, float bscale); +void ff_postscale_slice_sse4(float *ptr, int length, float postscale, float min, float max); +void ff_postscale_slice_avx2(float *ptr, int length, float postscale, float min, float max); + av_cold void ff_gblur_init_x86(GBlurContext *s) { #if ARCH_X86_64 int cpu_flags = av_get_cpu_flags(); -if (EXTERNAL_SSE4(cpu_flags)) +if (EXTERNAL_SSE4(cpu_flags)) { s->horiz_slice = ff_horiz_slice_sse4; -if (EXTERNAL_AVX2(cpu_flags)) +s->postscale_slice = ff_postscale_slice_sse4; +} +if (EXTERNAL_AVX2(cpu_flags)) { s->horiz_slice = ff_horiz_slice_avx2; +s->postscale_slice = ff_postscale_slice_avx2; Needs to be EXTERNAL_AVX2_FAST. You're using ymm regs, unlike in ff_horiz_slice_avx2. +} #endif } ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] Add support for the new key & value API in libaom.
On Wed, Feb 10, 2021 at 9:16 AM Bohan Li wrote: > > Hi Jan, > > Yes the modified patch looks good to me. > Please let me know if there is anything needed from my end. > > Thank you very much! > > Bohan > FYI, apparently the symbol is not exported in shared builds of libaom. I did test that versions before and after this feature got added to verify that the ABI number could be utilized as a build-time check, and that current release versions of libaom would still work, but unfortunately only in static configuration. Relevant libaom issue: https://bugs.chromium.org/p/aomedia/issues/detail?id=2962 Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 6/7] avcodec/fmvc: avoid copying uninitialized data
On Wed, Feb 03, 2021 at 12:13:33AM +0100, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 30049/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FMVC_fuzzer-5986909455253504 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/fmvc.c | 2 ++ > 1 file changed, 2 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 7/7] tools/target_dec_fuzzer: Adjust threshold for VMNC
On Wed, Feb 03, 2021 at 12:13:34AM +0100, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 30055/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMNC_fuzzer-4739482576355328 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > tools/target_dec_fuzzer.c | 1 + > 1 file changed, 1 insertion(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once"- "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..." signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/7] avcodec/fits: Check gcount and pcount being non negative
On Wed, Feb 03, 2021 at 12:13:31AM +0100, Michael Niedermayer wrote: > Fixes: signed integer overflow: 9223372036854775807 - -30069403896 cannot be > represented in type 'long' > Fixes: > 30046/clusterfuzz-testcase-minimized-ffmpeg_dem_FITS_fuzzer-5807144773484544 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/fits.c | 4 > 1 file changed, 4 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/7] tools/target_dec_fuzzer: Adjust the threshold of vc1image
On Wed, Feb 03, 2021 at 12:13:30AM +0100, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 30025/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5965511357759488 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > tools/target_dec_fuzzer.c | 1 + > 1 file changed, 1 insertion(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avformat/mov: sanity check STSD entries
On Sun, Feb 07, 2021 at 09:50:02PM +0100, Michael Niedermayer wrote: > The choosen value is arbitrary. I am not sure if this is a good idea > but i dont immedeately see an alternative better way, it seems either > an arbitrary limit or OOM > > Fixes: OOM > Fixes: > 27492/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6194970578649088 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/mov.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec: remove pointless lowres deprecation wrappers
Neither the feature, public fields, or AVOptions were ever truly deprecated, and will also not be removed if this FF_API_ define was left in place, so remove it as it's misleading. Signed-off-by: James Almer --- libavcodec/avcodec.h | 13 - libavcodec/version.h | 3 --- libavformat/utils.c | 2 -- 3 files changed, 18 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7dbf083a24..5df6a8aedc 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1741,14 +1741,12 @@ typedef struct AVCodecContext { */ int bits_per_raw_sample; -#if FF_API_LOWRES /** * low resolution decoding, 1-> 1/2 size, 2->1/4 size * - encoding: unused * - decoding: Set by user. */ int lowres; -#endif #if FF_API_CODED_FRAME /** @@ -2084,15 +2082,6 @@ typedef struct AVCodecContext { */ const AVCodecDescriptor *codec_descriptor; -#if !FF_API_LOWRES -/** - * low resolution decoding, 1-> 1/2 size, 2->1/4 size - * - encoding: unused - * - decoding: Set by user. - */ - int lowres; -#endif - /** * Current statistics for PTS correction. * - decoding: maintained and used by libavcodec, not intended to be used by user apps @@ -2366,12 +2355,10 @@ void av_codec_set_codec_descriptor(AVCodecContext *avctx, co attribute_deprecated unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); -#if FF_API_LOWRES attribute_deprecated int av_codec_get_lowres(const AVCodecContext *avctx); attribute_deprecated void av_codec_set_lowres(AVCodecContext *avctx, int val); -#endif attribute_deprecated int av_codec_get_seek_preroll(const AVCodecContext *avctx); diff --git a/libavcodec/version.h b/libavcodec/version.h index 83dbd1ad63..1eb140a6c9 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -51,9 +51,6 @@ * at once through the bump. This improves the git bisect-ability of the change. */ -#ifndef FF_API_LOWRES -#define FF_API_LOWRES(LIBAVCODEC_VERSION_MAJOR < 59) -#endif #ifndef FF_API_AVCTX_TIMEBASE #define FF_API_AVCTX_TIMEBASE(LIBAVCODEC_VERSION_MAJOR < 59) #endif diff --git a/libavformat/utils.c b/libavformat/utils.c index 3e955b85bc..5d40678325 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4130,7 +4130,6 @@ FF_DISABLE_DEPRECATION_WARNINGS if (ret < 0) goto find_stream_info_err; -#if FF_API_LOWRES // The old API (AVStream.codec) "requires" the resolution to be adjusted // by the lowres factor. if (st->internal->avctx->lowres && st->internal->avctx->width) { @@ -4138,7 +4137,6 @@ FF_DISABLE_DEPRECATION_WARNINGS st->codec->width = st->internal->avctx->width; st->codec->height = st->internal->avctx->height; } -#endif if (st->codec->codec_tag != MKTAG('t','m','c','d')) { st->codec->time_base = st->internal->avctx->time_base; -- 2.30.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/utils: force lowres to 0 in avformat_find_stream_info()
On 2/6/2021 2:39 PM, James Almer wrote: Instead of applying it and then restoring the original codecpar dimensions. Signed-off-by: James Almer --- Alternative to "[PATCH] avformat/utils: always preserve container dimensions for all streams" while we figure out and decide how to properly make avformat_find_stream_info() export the container dimensions and not what the probing decoder uses internally. Applied. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v3] avcodec/mediacodecdec: Do not abort when H264/HEVC extradata extraction fails
On Sat, Feb 13, 2021 at 12:48 AM sfan5 wrote: > > 12.02.21 - 21:43 - Andreas Rheinhardt: > > sfan5: > >> Hi, > >> > >> > >> attached v2 patch after discussion on IRC with JEEB (as he already > >> mentioned). > >> > >> Only change is that the log level turns to debug when missing parameter > >> sets are within spec (cf. 14496-15). > >> > >> > >> -av_log(avctx, AV_LOG_ERROR, "Could not extract PPS/SPS from > >> extradata"); > >> -ret = AVERROR_INVALIDDATA; > >> +const int warn = is_avc && avctx->codec_tag != > >> MKTAG('a','v','c','1') && > >> +avctx->codec_tag != MKTAG('a','v','c','2'); > >> +av_log(avctx, warn ? AV_LOG_WARNING : AV_LOG_DEBUG, > >> +"Could not extract PPS/SPS from extradata\n"); > >> +ret = 0; > >> } > > warn = is_avc && (avctx->codec_tag == MKTAG('a','v','c','1') || > >avctx->codec_tag == MKTAG('a','v','c','2') > > is what you (should) want. > > > > - Andreas > > Thanks for pointing that out, you're correct. > > here's v3: After some brief discussion on IRC, this looks good to me :) . Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add setts bitstream filter
On Sat, Feb 13, 2021 at 1:40 PM Gyan Doshi wrote: > > > On 13-02-2021 06:05 pm, Paul B Mahol wrote: > > On Sat, Feb 13, 2021 at 1:32 PM Gyan Doshi wrote: > > > >> > >> On 13-02-2021 05:11 pm, Paul B Mahol wrote: > >>> On Sat, Feb 13, 2021 at 10:16 AM Gyan Doshi wrote: > >>> > Would be nice to be able to reference the current computed DTS/PTS. > > >>> I doubt that would be useful. > >> Since video streams may contain out-of-order packets, it would be useful > >> to be able to peek at both the current and previous PTS when setting > DTS. > >> > >> > > That is already possible. > Sorry, by current, I meant computed/prospective. > Just use st(0), or dupe formula, no point in adding this. > Regards, > Gyan > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add setts bitstream filter
On 13-02-2021 06:05 pm, Paul B Mahol wrote: On Sat, Feb 13, 2021 at 1:32 PM Gyan Doshi wrote: On 13-02-2021 05:11 pm, Paul B Mahol wrote: On Sat, Feb 13, 2021 at 10:16 AM Gyan Doshi wrote: Would be nice to be able to reference the current computed DTS/PTS. I doubt that would be useful. Since video streams may contain out-of-order packets, it would be useful to be able to peek at both the current and previous PTS when setting DTS. That is already possible. Sorry, by current, I meant computed/prospective. Regards, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add setts bitstream filter
On Sat, Feb 13, 2021 at 1:32 PM Gyan Doshi wrote: > > > On 13-02-2021 05:11 pm, Paul B Mahol wrote: > > On Sat, Feb 13, 2021 at 10:16 AM Gyan Doshi wrote: > > > >> Would be nice to be able to reference the current computed DTS/PTS. > >> > > I doubt that would be useful. > > Since video streams may contain out-of-order packets, it would be useful > to be able to peek at both the current and previous PTS when setting DTS. > > That is already possible. > Regards, > Gyan > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add setts bitstream filter
On 13-02-2021 05:11 pm, Paul B Mahol wrote: On Sat, Feb 13, 2021 at 10:16 AM Gyan Doshi wrote: Would be nice to be able to reference the current computed DTS/PTS. I doubt that would be useful. Since video streams may contain out-of-order packets, it would be useful to be able to peek at both the current and previous PTS when setting DTS. Regards, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add setts bitstream filter
On Sat, Feb 13, 2021 at 10:16 AM Gyan Doshi wrote: > Would be nice to be able to reference the current computed DTS/PTS. > I doubt that would be useful. > > Also, FPS for video, and SR for audio. > FPS is not available, SR is. Patch welcome. > > Regards, > Gyan > > On 12-02-2021 03:26 pm, Paul B Mahol wrote: > > Will apply if nobody have comments. > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avfilter/x86/vf_gblur: add postscale SIMD
Signed-off-by: Paul B Mahol --- libavfilter/x86/vf_gblur.asm| 46 + libavfilter/x86/vf_gblur_init.c | 11 ++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/libavfilter/x86/vf_gblur.asm b/libavfilter/x86/vf_gblur.asm index a25b1659f5..8fea6d2a61 100644 --- a/libavfilter/x86/vf_gblur.asm +++ b/libavfilter/x86/vf_gblur.asm @@ -183,3 +183,49 @@ HORIZ_SLICE INIT_XMM avx2 HORIZ_SLICE %endif + +%macro POSTSCALE_SLICE 0 +%if UNIX64 +cglobal postscale_slice, 2, 6, 4, ptr, length, postscale, min, max, x +%else +cglobal postscale_slice, 5, 6, 4, ptr, length, postscale, min, max, x +%endif +shl lengthd, 2 +%if WIN64 +SWAP 0, 2 +SWAP 1, 3 +SWAP 2, 4 +%endif +shufps xm0, xm0, 0 +shufps xm1, xm1, 0 +shufps xm2, xm2, 0 +%if cpuflag(avx2) +vinsertf128 m0, m0, xm0, 1 +vinsertf128 m1, m1, xm1, 1 +vinsertf128 m2, m2, xm2, 1 +%endif +xor xq, xq + +.loop: +movu m3, [ptrq + xq] +mulps m3, m0 +maxps m3, m1 +minps m3, m2 +movu [ptrq+xq], m3 + +add xq, mmsize +cmp xd, lengthd +jl .loop + +RET +%endmacro + +%if ARCH_X86_64 +INIT_XMM sse4 +POSTSCALE_SLICE + +%if HAVE_AVX_EXTERNAL +INIT_YMM avx2 +POSTSCALE_SLICE +%endif +%endif diff --git a/libavfilter/x86/vf_gblur_init.c b/libavfilter/x86/vf_gblur_init.c index e63e59fe23..7a9b40b0ad 100644 --- a/libavfilter/x86/vf_gblur_init.c +++ b/libavfilter/x86/vf_gblur_init.c @@ -27,14 +27,21 @@ void ff_horiz_slice_sse4(float *ptr, int width, int height, int steps, float nu, float bscale); void ff_horiz_slice_avx2(float *ptr, int width, int height, int steps, float nu, float bscale); +void ff_postscale_slice_sse4(float *ptr, int length, float postscale, float min, float max); +void ff_postscale_slice_avx2(float *ptr, int length, float postscale, float min, float max); + av_cold void ff_gblur_init_x86(GBlurContext *s) { #if ARCH_X86_64 int cpu_flags = av_get_cpu_flags(); -if (EXTERNAL_SSE4(cpu_flags)) +if (EXTERNAL_SSE4(cpu_flags)) { s->horiz_slice = ff_horiz_slice_sse4; -if (EXTERNAL_AVX2(cpu_flags)) +s->postscale_slice = ff_postscale_slice_sse4; +} +if (EXTERNAL_AVX2(cpu_flags)) { s->horiz_slice = ff_horiz_slice_avx2; +s->postscale_slice = ff_postscale_slice_avx2; +} #endif } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avfilter/vf_gblur: factor out postscale function
Signed-off-by: Paul B Mahol --- libavfilter/gblur.h| 2 ++ libavfilter/vf_gblur.c | 23 ++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/libavfilter/gblur.h b/libavfilter/gblur.h index 15a8167fe5..dce50671f6 100644 --- a/libavfilter/gblur.h +++ b/libavfilter/gblur.h @@ -50,7 +50,9 @@ typedef struct GBlurContext { float nuV; int nb_planes; void (*horiz_slice)(float *buffer, int width, int height, int steps, float nu, float bscale); +void (*postscale_slice)(float *buffer, int length, float postscale, float min, float max); } GBlurContext; + void ff_gblur_init(GBlurContext *s); void ff_gblur_init_x86(GBlurContext *s); #endif diff --git a/libavfilter/vf_gblur.c b/libavfilter/vf_gblur.c index 68a2ed3520..70e2a668b4 100644 --- a/libavfilter/vf_gblur.c +++ b/libavfilter/vf_gblur.c @@ -54,6 +54,15 @@ typedef struct ThreadData { int width; } ThreadData; +static void postscale_c(float *buffer, int length, +float postscale, float min, float max) +{ +for (int i = 0; i < length; i++) { +buffer[i] *= postscale; +buffer[i] = av_clipf(buffer[i], min, max); +} +} + static void horiz_slice_c(float *buffer, int width, int height, int steps, float nu, float bscale) { @@ -154,7 +163,6 @@ static int filter_vertically(AVFilterContext *ctx, void *arg, int jobnr, int nb_ return 0; } - static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { GBlurContext *s = ctx->priv; @@ -164,16 +172,12 @@ static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_j const int height = td->height; const int width = td->width; const int64_t numpixels = width * (int64_t)height; -const unsigned slice_start = (numpixels * jobnr ) / nb_jobs; -const unsigned slice_end = (numpixels * (jobnr+1)) / nb_jobs; +const int slice_start = (numpixels * jobnr ) / nb_jobs; +const int slice_end = (numpixels * (jobnr+1)) / nb_jobs; const float postscale = s->postscale * s->postscaleV; -float *buffer = s->buffer; -unsigned i; +float *buffer = s->buffer + slice_start; -for (i = slice_start; i < slice_end; i++) { -buffer[i] *= postscale; -buffer[i] = av_clipf(buffer[i], min, max); -} +s->postscale_slice(buffer, slice_end - slice_start, postscale, min, max); return 0; } @@ -228,6 +232,7 @@ static int query_formats(AVFilterContext *ctx) void ff_gblur_init(GBlurContext *s) { s->horiz_slice = horiz_slice_c; +s->postscale_slice = postscale_c; if (ARCH_X86_64) ff_gblur_init_x86(s); } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add setts bitstream filter
Would be nice to be able to reference the current computed DTS/PTS. Also, FPS for video, and SR for audio. Regards, Gyan On 12-02-2021 03:26 pm, Paul B Mahol wrote: Will apply if nobody have comments. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".