From 3a393d98fb4fe4763279356a8e3a19a043610f12 Mon Sep 17 00:00:00 2001 From: v0lt Date: Wed, 14 Feb 2024 06:41:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20ffmpeg=20git-n6.2-dev-1097-geb5b4e60c9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Changelog.Rus.txt | 2 +- docs/Changelog.txt | 2 +- .../ffmpeg/libavcodec/ac3enc_template.c | 2 + src/ExtLib/ffmpeg/libavcodec/avcodec.c | 13 +- src/ExtLib/ffmpeg/libavcodec/avcodec.h | 5 +- .../ffmpeg/libavcodec/avcodec_internal.h | 2 + src/ExtLib/ffmpeg/libavcodec/avfft.c | 31 ++++- src/ExtLib/ffmpeg/libavcodec/blockdsp.c | 2 + src/ExtLib/ffmpeg/libavcodec/blockdsp.h | 1 + .../ffmpeg/libavcodec/bsf/hevc_mp4toannexb.c | 6 +- .../ffmpeg/libavcodec/bsf/vvc_mp4toannexb.c | 7 +- src/ExtLib/ffmpeg/libavcodec/dca_core.c | 17 --- src/ExtLib/ffmpeg/libavcodec/flashsv.c | 2 - src/ExtLib/ffmpeg/libavcodec/flvdec.c | 2 - .../ffmpeg/libavcodec/frame_thread_encoder.c | 5 +- src/ExtLib/ffmpeg/libavcodec/h263dec.c | 43 +++--- src/ExtLib/ffmpeg/libavcodec/h263dec.h | 2 - src/ExtLib/ffmpeg/libavcodec/hevcdsp.c | 6 +- src/ExtLib/ffmpeg/libavcodec/hevcdsp.h | 5 +- .../ffmpeg/libavcodec/hevcdsp_template.c | 38 +++--- .../ffmpeg/libavcodec/hwaccel_internal.h | 2 +- src/ExtLib/ffmpeg/libavcodec/indeo3.c | 3 + src/ExtLib/ffmpeg/libavcodec/intelh263dec.c | 4 - src/ExtLib/ffmpeg/libavcodec/libuavs3d.c | 3 - src/ExtLib/ffmpeg/libavcodec/mpeg4videodec.c | 1 - src/ExtLib/ffmpeg/libavcodec/msmpeg4dec.c | 16 --- src/ExtLib/ffmpeg/libavcodec/nvdec.c | 2 +- src/ExtLib/ffmpeg/libavcodec/nvdec.h | 2 +- src/ExtLib/ffmpeg/libavcodec/nvdec_av1.c | 4 +- src/ExtLib/ffmpeg/libavcodec/nvdec_h264.c | 4 +- src/ExtLib/ffmpeg/libavcodec/nvdec_hevc.c | 4 +- src/ExtLib/ffmpeg/libavcodec/options.c | 3 +- src/ExtLib/ffmpeg/libavcodec/pngdec.c | 63 +++++++++ src/ExtLib/ffmpeg/libavcodec/pthread_frame.c | 2 +- src/ExtLib/ffmpeg/libavcodec/refstruct.c | 2 +- src/ExtLib/ffmpeg/libavcodec/rv10.c | 8 -- src/ExtLib/ffmpeg/libavcodec/rv30.c | 4 - src/ExtLib/ffmpeg/libavcodec/rv40.c | 4 - src/ExtLib/ffmpeg/libavcodec/svq1dec.c | 2 - src/ExtLib/ffmpeg/libavcodec/svq3.c | 2 - src/ExtLib/ffmpeg/libavcodec/texturedsp.c | 9 +- src/ExtLib/ffmpeg/libavcodec/tiff.c | 2 +- src/ExtLib/ffmpeg/libavcodec/vc1dec.c | 81 +++++------ src/ExtLib/ffmpeg/libavcodec/version_major.h | 1 + src/ExtLib/ffmpeg/libavcodec/wmv2dec.c | 2 - .../ffmpeg/libavcodec/x86/h264_intrapred.asm | 16 +-- .../libavcodec/x86/h264_intrapred_init.c | 14 +- .../ffmpeg/libavcodec/x86/hevcdsp_init.c | 4 +- src/ExtLib/ffmpeg/libavcodec/x86/vp6dsp.asm | 55 -------- src/ExtLib/ffmpeg/libavfilter/allfilters.c | 2 - src/ExtLib/ffmpeg/libavfilter/buffersink.c | 29 +++- src/ExtLib/ffmpeg/libavfilter/buffersink.h | 2 + src/ExtLib/ffmpeg/libavfilter/buffersrc.c | 15 ++- src/ExtLib/ffmpeg/libavutil/channel_layout.c | 126 ++++++++++++++++++ src/ExtLib/ffmpeg/libavutil/channel_layout.h | 57 ++++++++ src/ExtLib/ffmpeg/libavutil/rational.h | 4 + src/ExtLib/ffmpeg/libavutil/version.h | 4 +- .../ffmpeg/libavutil/x86/intreadwrite.h | 36 ----- .../ffmpeg/libavutil/x86/tx_float_init.c | 18 +-- 59 files changed, 480 insertions(+), 325 deletions(-) diff --git a/docs/Changelog.Rus.txt b/docs/Changelog.Rus.txt index 3618ebade7..d0dbfd11b4 100644 --- a/docs/Changelog.Rus.txt +++ b/docs/Changelog.Rus.txt @@ -30,7 +30,7 @@ MPCVideoDec Обновлен корейский перевод (автор Hackjjang). Обновлены библиотеки: - ffmpeg git-n6.2-dev-1026-gcd31eac999; + ffmpeg git-n6.2-dev-1097-geb5b4e60c9; Little-CMS git-lcms2.16-26-gc2a5401; MediaInfo git-v24.01-g51dbd896; nanosvg git-93ce879; diff --git a/docs/Changelog.txt b/docs/Changelog.txt index 769127b527..f875e777e8 100644 --- a/docs/Changelog.txt +++ b/docs/Changelog.txt @@ -30,7 +30,7 @@ Updated Italian translation (by mapi68). Updated Korean translation (by Hackjjang). Updated libraries: - ffmpeg git-n6.2-dev-1026-gcd31eac999; + ffmpeg git-n6.2-dev-1097-geb5b4e60c9; Little-CMS git-lcms2.16-26-gc2a5401; MediaInfo git-v24.01-g51dbd896; nanosvg git-93ce879; diff --git a/src/ExtLib/ffmpeg/libavcodec/ac3enc_template.c b/src/ExtLib/ffmpeg/libavcodec/ac3enc_template.c index a41c6a5fb5..26439ceba9 100644 --- a/src/ExtLib/ffmpeg/libavcodec/ac3enc_template.c +++ b/src/ExtLib/ffmpeg/libavcodec/ac3enc_template.c @@ -223,6 +223,8 @@ static void apply_channel_coupling(AC3EncodeContext *s) } } + av_assert1(s->fbw_channels > 0); + /* calculate final coupling coordinates, taking into account reusing of coordinates in successive blocks */ for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { diff --git a/src/ExtLib/ffmpeg/libavcodec/avcodec.c b/src/ExtLib/ffmpeg/libavcodec/avcodec.c index a6c8629f6c..a13b781996 100644 --- a/src/ExtLib/ffmpeg/libavcodec/avcodec.c +++ b/src/ExtLib/ffmpeg/libavcodec/avcodec.c @@ -377,7 +377,7 @@ FF_ENABLE_DEPRECATION_WARNINGS return ret; free_and_end: - avcodec_close(avctx); + ff_codec_close(avctx); goto end; } @@ -432,12 +432,12 @@ void avsubtitle_free(AVSubtitle *sub) memset(sub, 0, sizeof(*sub)); } -av_cold int avcodec_close(AVCodecContext *avctx) +av_cold void ff_codec_close(AVCodecContext *avctx) { int i; if (!avctx) - return 0; + return; if (avcodec_is_open(avctx)) { AVCodecInternal *avci = avctx->internal; @@ -497,9 +497,15 @@ av_cold int avcodec_close(AVCodecContext *avctx) avctx->codec = NULL; avctx->active_thread_type = 0; +} +#if FF_API_AVCODEC_CLOSE +int avcodec_close(AVCodecContext *avctx) +{ + ff_codec_close(avctx); return 0; } +#endif static const char *unknown_if_null(const char *str) { @@ -619,6 +625,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) enc->width, enc->height); if (av_log_get_level() >= AV_LOG_VERBOSE && + enc->coded_width && enc->coded_height && (enc->width != enc->coded_width || enc->height != enc->coded_height)) av_bprintf(&bprint, " (%dx%d)", diff --git a/src/ExtLib/ffmpeg/libavcodec/avcodec.h b/src/ExtLib/ffmpeg/libavcodec/avcodec.h index 7fb44e28f4..0018ccbb0c 100644 --- a/src/ExtLib/ffmpeg/libavcodec/avcodec.h +++ b/src/ExtLib/ffmpeg/libavcodec/avcodec.h @@ -2411,6 +2411,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec, */ int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); +#if FF_API_AVCODEC_CLOSE /** * Close a given AVCodecContext and free all the data associated with it * (but not the AVCodecContext itself). @@ -2419,12 +2420,14 @@ int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **op * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL * codec. Subsequent calls will do nothing. * - * @note Do not use this function. Use avcodec_free_context() to destroy a + * @deprecated Do not use this function. Use avcodec_free_context() to destroy a * codec context (either open or closed). Opening and closing a codec context * multiple times is not supported anymore -- use multiple codec contexts * instead. */ +attribute_deprecated int avcodec_close(AVCodecContext *avctx); +#endif /** * Free all allocated data in the given subtitle struct. diff --git a/src/ExtLib/ffmpeg/libavcodec/avcodec_internal.h b/src/ExtLib/ffmpeg/libavcodec/avcodec_internal.h index 9b93ff3d81..4d1cb3a314 100644 --- a/src/ExtLib/ffmpeg/libavcodec/avcodec_internal.h +++ b/src/ExtLib/ffmpeg/libavcodec/avcodec_internal.h @@ -56,4 +56,6 @@ void ff_encode_flush_buffers(struct AVCodecContext *avctx); struct AVCodecInternal *ff_decode_internal_alloc(void); struct AVCodecInternal *ff_encode_internal_alloc(void); +void ff_codec_close(struct AVCodecContext *avctx); + #endif // AVCODEC_AVCODEC_INTERNAL_H diff --git a/src/ExtLib/ffmpeg/libavcodec/avfft.c b/src/ExtLib/ffmpeg/libavcodec/avfft.c index 08198b48a4..dc37b3ac10 100644 --- a/src/ExtLib/ffmpeg/libavcodec/avfft.c +++ b/src/ExtLib/ffmpeg/libavcodec/avfft.c @@ -152,7 +152,7 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans) return NULL; ret = av_tx_init(&s->ctx, &s->fn, AV_TX_FLOAT_RDFT, trans == IDFT_C2R, - 1 << nbits, &scale, AV_TX_INPLACE); + 1 << nbits, &scale, 0x0); if (ret < 0) { av_free(s); return NULL; @@ -162,17 +162,35 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans) s->len = 1 << nbits; s->inv = trans == IDFT_C2R; + s->tmp = av_malloc((s->len + 2)*sizeof(float)); + if (!s->tmp) { + av_tx_uninit(&s->ctx); + av_free(s); + return NULL; + } + return (RDFTContext *)s; } void av_rdft_calc(RDFTContext *s, FFTSample *data) { AVTXWrapper *w = (AVTXWrapper *)s; - if (w->inv) - FFSWAP(float, data[1], data[w->len]); - w->fn(w->ctx, data, (void *)data, w->stride); - if (!w->inv) - FFSWAP(float, data[1], data[w->len]); + float *src = w->inv ? w->tmp : (float *)data; + float *dst = w->inv ? (float *)data : w->tmp; + + if (w->inv) { + memcpy(src, data, w->len*sizeof(float)); + + src[w->len] = src[1]; + src[1] = 0.0f; + } + + w->fn(w->ctx, dst, (void *)src, w->stride); + + if (!w->inv) { + dst[1] = dst[w->len]; + memcpy(data, dst, w->len*sizeof(float)); + } } av_cold void av_rdft_end(RDFTContext *s) @@ -180,6 +198,7 @@ av_cold void av_rdft_end(RDFTContext *s) if (s) { AVTXWrapper *w = (AVTXWrapper *)s; av_tx_uninit(&w->ctx); + av_free(w->tmp); av_free(w); } } diff --git a/src/ExtLib/ffmpeg/libavcodec/blockdsp.c b/src/ExtLib/ffmpeg/libavcodec/blockdsp.c index 43b1c6654f..af932a264e 100644 --- a/src/ExtLib/ffmpeg/libavcodec/blockdsp.c +++ b/src/ExtLib/ffmpeg/libavcodec/blockdsp.c @@ -69,6 +69,8 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c) ff_blockdsp_init_arm(c); #elif ARCH_PPC ff_blockdsp_init_ppc(c); +#elif ARCH_RISCV + ff_blockdsp_init_riscv(c); #elif ARCH_X86 ff_blockdsp_init_x86(c); #elif ARCH_MIPS diff --git a/src/ExtLib/ffmpeg/libavcodec/blockdsp.h b/src/ExtLib/ffmpeg/libavcodec/blockdsp.h index a82a617f65..5ceca8208d 100644 --- a/src/ExtLib/ffmpeg/libavcodec/blockdsp.h +++ b/src/ExtLib/ffmpeg/libavcodec/blockdsp.h @@ -41,6 +41,7 @@ void ff_blockdsp_init(BlockDSPContext *c); void ff_blockdsp_init_alpha(BlockDSPContext *c); void ff_blockdsp_init_arm(BlockDSPContext *c); void ff_blockdsp_init_ppc(BlockDSPContext *c); +void ff_blockdsp_init_riscv(BlockDSPContext *c); void ff_blockdsp_init_x86(BlockDSPContext *c); void ff_blockdsp_init_mips(BlockDSPContext *c); diff --git a/src/ExtLib/ffmpeg/libavcodec/bsf/hevc_mp4toannexb.c b/src/ExtLib/ffmpeg/libavcodec/bsf/hevc_mp4toannexb.c index d91229a895..8eec18f31e 100644 --- a/src/ExtLib/ffmpeg/libavcodec/bsf/hevc_mp4toannexb.c +++ b/src/ExtLib/ffmpeg/libavcodec/bsf/hevc_mp4toannexb.c @@ -65,9 +65,11 @@ static int hevc_extradata_to_annexb(AVBSFContext *ctx) } for (j = 0; j < cnt; j++) { - int nalu_len = bytestream2_get_be16(&gb); + const int nalu_len = bytestream2_get_be16(&gb); - if (4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) { + if (!nalu_len || + nalu_len > bytestream2_get_bytes_left(&gb) || + 4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) { ret = AVERROR_INVALIDDATA; goto fail; } diff --git a/src/ExtLib/ffmpeg/libavcodec/bsf/vvc_mp4toannexb.c b/src/ExtLib/ffmpeg/libavcodec/bsf/vvc_mp4toannexb.c index 25c3726918..36bdae8f49 100644 --- a/src/ExtLib/ffmpeg/libavcodec/bsf/vvc_mp4toannexb.c +++ b/src/ExtLib/ffmpeg/libavcodec/bsf/vvc_mp4toannexb.c @@ -155,10 +155,11 @@ static int vvc_extradata_to_annexb(AVBSFContext *ctx) } for (j = 0; j < cnt; j++) { - int nalu_len = bytestream2_get_be16(&gb); + const int nalu_len = bytestream2_get_be16(&gb); - if (4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len > - SIZE_MAX - new_extradata_size) { + if (!nalu_len || + nalu_len > bytestream2_get_bytes_left(&gb) || + 4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) { ret = AVERROR_INVALIDDATA; goto fail; } diff --git a/src/ExtLib/ffmpeg/libavcodec/dca_core.c b/src/ExtLib/ffmpeg/libavcodec/dca_core.c index 60508fabb9..697fc74295 100644 --- a/src/ExtLib/ffmpeg/libavcodec/dca_core.c +++ b/src/ExtLib/ffmpeg/libavcodec/dca_core.c @@ -19,7 +19,6 @@ */ #include "libavutil/channel_layout.h" -#include "libavutil/emms.h" #include "dcaadpcm.h" #include "dcadec.h" #include "dcadata.h" @@ -770,10 +769,6 @@ static void erase_adpcm_history(DCACoreDecoder *s) for (ch = 0; ch < DCA_CHANNELS; ch++) for (band = 0; band < DCA_SUBBANDS; band++) AV_ZERO128(s->subband_samples[ch][band] - DCA_ADPCM_COEFFS); - -#ifdef FF_COPY_SWAP_ZERO_USES_MMX - emms_c(); -#endif } static int alloc_sample_buffer(DCACoreDecoder *s) @@ -837,10 +832,6 @@ static int parse_frame_data(DCACoreDecoder *s, enum HeaderType header, int xch_b } } -#ifdef FF_COPY_SWAP_ZERO_USES_MMX - emms_c(); -#endif - return 0; } @@ -1283,10 +1274,6 @@ static void erase_x96_adpcm_history(DCACoreDecoder *s) for (ch = 0; ch < DCA_CHANNELS; ch++) for (band = 0; band < DCA_SUBBANDS_X96; band++) AV_ZERO128(s->x96_subband_samples[ch][band] - DCA_ADPCM_COEFFS); - -#ifdef FF_COPY_SWAP_ZERO_USES_MMX - emms_c(); -#endif } static int alloc_x96_sample_buffer(DCACoreDecoder *s) @@ -1516,10 +1503,6 @@ static int parse_x96_frame_data(DCACoreDecoder *s, int exss, int xch_base) } } -#ifdef FF_COPY_SWAP_ZERO_USES_MMX - emms_c(); -#endif - return 0; } diff --git a/src/ExtLib/ffmpeg/libavcodec/flashsv.c b/src/ExtLib/ffmpeg/libavcodec/flashsv.c index 8a01e3a4b6..fe00e529a5 100644 --- a/src/ExtLib/ffmpeg/libavcodec/flashsv.c +++ b/src/ExtLib/ffmpeg/libavcodec/flashsv.c @@ -511,7 +511,6 @@ const FFCodec ff_flashsv_decoder = { FF_CODEC_DECODE_CB(flashsv_decode_frame), .p.capabilities = AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, - .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }, }; #endif /* CONFIG_FLASHSV_DECODER */ @@ -579,6 +578,5 @@ const FFCodec ff_flashsv2_decoder = { FF_CODEC_DECODE_CB(flashsv_decode_frame), .p.capabilities = AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, - .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }, }; #endif /* CONFIG_FLASHSV2_DECODER */ diff --git a/src/ExtLib/ffmpeg/libavcodec/flvdec.c b/src/ExtLib/ffmpeg/libavcodec/flvdec.c index 09fefd3d1c..8baaed06a8 100644 --- a/src/ExtLib/ffmpeg/libavcodec/flvdec.c +++ b/src/ExtLib/ffmpeg/libavcodec/flvdec.c @@ -123,6 +123,4 @@ const FFCodec ff_flv_decoder = { .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .p.max_lowres = 3, - .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE }, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/frame_thread_encoder.c b/src/ExtLib/ffmpeg/libavcodec/frame_thread_encoder.c index 62d9580ad4..cda5158117 100644 --- a/src/ExtLib/ffmpeg/libavcodec/frame_thread_encoder.c +++ b/src/ExtLib/ffmpeg/libavcodec/frame_thread_encoder.c @@ -27,6 +27,7 @@ #include "libavutil/opt.h" #include "libavutil/thread.h" #include "avcodec.h" +#include "avcodec_internal.h" #include "encode.h" #include "internal.h" #include "pthread_internal.h" @@ -110,7 +111,7 @@ static void * attribute_align_arg worker(void *v){ pthread_mutex_unlock(&c->finished_task_mutex); } end: - avcodec_close(avctx); + ff_codec_close(avctx); av_freep(&avctx); return NULL; } @@ -230,7 +231,7 @@ av_cold int ff_frame_thread_encoder_init(AVCodecContext *avctx) return 0; fail: - avcodec_close(thread_avctx); + ff_codec_close(thread_avctx); av_freep(&thread_avctx); avctx->thread_count = i; av_log(avctx, AV_LOG_ERROR, "ff_frame_thread_encoder_init failed\n"); diff --git a/src/ExtLib/ffmpeg/libavcodec/h263dec.c b/src/ExtLib/ffmpeg/libavcodec/h263dec.c index eb1d87a2fe..910df7585f 100644 --- a/src/ExtLib/ffmpeg/libavcodec/h263dec.c +++ b/src/ExtLib/ffmpeg/libavcodec/h263dec.c @@ -49,6 +49,23 @@ #include "thread.h" #include "wmv2dec.h" +static const enum AVPixelFormat h263_hwaccel_pixfmt_list_420[] = { +#if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL + AV_PIX_FMT_VAAPI, +#endif +#if CONFIG_MPEG4_NVDEC_HWACCEL + AV_PIX_FMT_CUDA, +#endif +#if CONFIG_MPEG4_VDPAU_HWACCEL + AV_PIX_FMT_VDPAU, +#endif +#if CONFIG_H263_VIDEOTOOLBOX_HWACCEL || CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL + AV_PIX_FMT_VIDEOTOOLBOX, +#endif + AV_PIX_FMT_YUV420P, + AV_PIX_FMT_NONE +}; + static enum AVPixelFormat h263_get_format(AVCodecContext *avctx) { /* MPEG-4 Studio Profile only, not supported by hardware */ @@ -63,7 +80,12 @@ static enum AVPixelFormat h263_get_format(AVCodecContext *avctx) return AV_PIX_FMT_GRAY8; } - return avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); + if (avctx->codec_id == AV_CODEC_ID_H263 || + avctx->codec_id == AV_CODEC_ID_H263P || + avctx->codec_id == AV_CODEC_ID_MPEG4) + return avctx->pix_fmt = ff_get_format(avctx, h263_hwaccel_pixfmt_list_420); + + return AV_PIX_FMT_YUV420P; } av_cold int ff_h263_decode_init(AVCodecContext *avctx) @@ -659,23 +681,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, return get_consumed_bytes(s, buf_size); } -const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = { -#if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL - AV_PIX_FMT_VAAPI, -#endif -#if CONFIG_MPEG4_NVDEC_HWACCEL - AV_PIX_FMT_CUDA, -#endif -#if CONFIG_MPEG4_VDPAU_HWACCEL - AV_PIX_FMT_VDPAU, -#endif -#if CONFIG_H263_VIDEOTOOLBOX_HWACCEL || CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL - AV_PIX_FMT_VIDEOTOOLBOX, -#endif - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE -}; - static const AVCodecHWConfigInternal *const h263_hw_config_list[] = { #if CONFIG_H263_VAAPI_HWACCEL HWACCEL_VAAPI(h263), @@ -706,7 +711,6 @@ const FFCodec ff_h263_decoder = { .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = ff_mpeg_flush, .p.max_lowres = 3, - .p.pix_fmts = ff_h263_hwaccel_pixfmt_list_420, .hw_configs = h263_hw_config_list, }; @@ -724,6 +728,5 @@ const FFCodec ff_h263p_decoder = { .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = ff_mpeg_flush, .p.max_lowres = 3, - .p.pix_fmts = ff_h263_hwaccel_pixfmt_list_420, .hw_configs = h263_hw_config_list, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/h263dec.h b/src/ExtLib/ffmpeg/libavcodec/h263dec.h index 06ff7c1c48..89c5fcf58f 100644 --- a/src/ExtLib/ffmpeg/libavcodec/h263dec.h +++ b/src/ExtLib/ffmpeg/libavcodec/h263dec.h @@ -38,8 +38,6 @@ extern VLCElem ff_h263_inter_MCBPC_vlc[]; extern VLCElem ff_h263_cbpy_vlc[]; extern VLCElem ff_h263_mv_vlc[]; -extern const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[]; - int ff_h263_decode_motion(MpegEncContext * s, int pred, int f_code); int ff_h263_decode_init(AVCodecContext *avctx); int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *frame, diff --git a/src/ExtLib/ffmpeg/libavcodec/hevcdsp.c b/src/ExtLib/ffmpeg/libavcodec/hevcdsp.c index 8aa7a046a6..89a07fe478 100644 --- a/src/ExtLib/ffmpeg/libavcodec/hevcdsp.c +++ b/src/ExtLib/ffmpeg/libavcodec/hevcdsp.c @@ -91,7 +91,8 @@ static const int8_t transform[32][32] = { 90, -90, 88, -85, 82, -78, 73, -67, 61, -54, 46, -38, 31, -22, 13, -4 }, }; -DECLARE_ALIGNED(16, const int8_t, ff_hevc_epel_filters)[7][4] = { +DECLARE_ALIGNED(16, const int8_t, ff_hevc_epel_filters)[8][4] = { + { 0 }, { -2, 58, 10, -2}, { -4, 54, 16, -2}, { -6, 46, 28, -4}, @@ -101,7 +102,8 @@ DECLARE_ALIGNED(16, const int8_t, ff_hevc_epel_filters)[7][4] = { { -2, 10, 58, -2}, }; -DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters)[3][16] = { +DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters)[4][16] = { + { 0 }, { -1, 4,-10, 58, 17, -5, 1, 0, -1, 4,-10, 58, 17, -5, 1, 0}, { -1, 4,-11, 40, 40,-11, 4, -1, -1, 4,-11, 40, 40,-11, 4, -1}, { 0, 1, -5, 17, 58,-10, 4, -1, 0, 1, -5, 17, 58,-10, 4, -1} diff --git a/src/ExtLib/ffmpeg/libavcodec/hevcdsp.h b/src/ExtLib/ffmpeg/libavcodec/hevcdsp.h index 1b9c5bb6bc..a5933dcac4 100644 --- a/src/ExtLib/ffmpeg/libavcodec/hevcdsp.h +++ b/src/ExtLib/ffmpeg/libavcodec/hevcdsp.h @@ -126,8 +126,9 @@ typedef struct HEVCDSPContext { void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth); -extern const int8_t ff_hevc_epel_filters[7][4]; -extern const int8_t ff_hevc_qpel_filters[3][16]; +/** ff_hevc_.pel_filters[0] are dummies to simplify array addressing */ +extern const int8_t ff_hevc_epel_filters[8][4]; +extern const int8_t ff_hevc_qpel_filters[4][16]; void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth); diff --git a/src/ExtLib/ffmpeg/libavcodec/hevcdsp_template.c b/src/ExtLib/ffmpeg/libavcodec/hevcdsp_template.c index 9b48bdf08e..121c44c401 100644 --- a/src/ExtLib/ffmpeg/libavcodec/hevcdsp_template.c +++ b/src/ExtLib/ffmpeg/libavcodec/hevcdsp_template.c @@ -301,9 +301,9 @@ IDCT_DC(32) // //////////////////////////////////////////////////////////////////////////////// #define ff_hevc_pel_filters ff_hevc_qpel_filters -#define DECL_HV_FILTER(f) \ - const uint8_t *hf = ff_hevc_ ## f ## _filters[mx - 1]; \ - const uint8_t *vf = ff_hevc_ ## f ## _filters[my - 1]; +#define DECL_HV_FILTER(f) \ + const uint8_t *hf = ff_hevc_ ## f ## _filters[mx]; \ + const uint8_t *vf = ff_hevc_ ## f ## _filters[my]; #define FW_PUT(p, f, t) \ static void FUNC(put_hevc_## f)(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride, int height, \ @@ -421,7 +421,7 @@ static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, const pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); - const int8_t *filter = ff_hevc_qpel_filters[mx - 1]; + const int8_t *filter = ff_hevc_qpel_filters[mx]; int shift = 14 + 1 - BIT_DEPTH; #if BIT_DEPTH < 14 @@ -449,7 +449,7 @@ static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); - const int8_t *filter = ff_hevc_qpel_filters[my - 1]; + const int8_t *filter = ff_hevc_qpel_filters[my]; int shift = 14 + 1 - BIT_DEPTH; #if BIT_DEPTH < 14 @@ -487,7 +487,7 @@ static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, #endif src -= QPEL_EXTRA_BEFORE * srcstride; - filter = ff_hevc_qpel_filters[mx - 1]; + filter = ff_hevc_qpel_filters[mx]; for (y = 0; y < height + QPEL_EXTRA; y++) { for (x = 0; x < width; x++) tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); @@ -496,7 +496,7 @@ static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, } tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; - filter = ff_hevc_qpel_filters[my - 1]; + filter = ff_hevc_qpel_filters[my]; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) @@ -518,7 +518,7 @@ static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); - const int8_t *filter = ff_hevc_qpel_filters[mx - 1]; + const int8_t *filter = ff_hevc_qpel_filters[mx]; int shift = 14 + 1 - BIT_DEPTH; int log2Wd = denom + shift - 1; @@ -546,7 +546,7 @@ static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); - const int8_t *filter = ff_hevc_qpel_filters[my - 1]; + const int8_t *filter = ff_hevc_qpel_filters[my]; int shift = 14 + 1 - BIT_DEPTH; int log2Wd = denom + shift - 1; @@ -580,7 +580,7 @@ static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, int log2Wd = denom + shift - 1; src -= QPEL_EXTRA_BEFORE * srcstride; - filter = ff_hevc_qpel_filters[mx - 1]; + filter = ff_hevc_qpel_filters[mx]; for (y = 0; y < height + QPEL_EXTRA; y++) { for (x = 0; x < width; x++) tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); @@ -589,7 +589,7 @@ static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, } tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; - filter = ff_hevc_qpel_filters[my - 1]; + filter = ff_hevc_qpel_filters[my]; ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ox1 = ox1 * (1 << (BIT_DEPTH - 8)); @@ -621,7 +621,7 @@ static void FUNC(put_hevc_epel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, ptrdiff_t srcstride = _srcstride / sizeof(pixel); pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); - const int8_t *filter = ff_hevc_epel_filters[mx - 1]; + const int8_t *filter = ff_hevc_epel_filters[mx]; int shift = 14 + 1 - BIT_DEPTH; #if BIT_DEPTH < 14 int offset = 1 << (shift - 1); @@ -646,7 +646,7 @@ static void FUNC(put_hevc_epel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, int x, y; const pixel *src = (const pixel *)_src; ptrdiff_t srcstride = _srcstride / sizeof(pixel); - const int8_t *filter = ff_hevc_epel_filters[my - 1]; + const int8_t *filter = ff_hevc_epel_filters[my]; pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); int shift = 14 + 1 - BIT_DEPTH; @@ -674,7 +674,7 @@ static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, ptrdiff_t srcstride = _srcstride / sizeof(pixel); pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); - const int8_t *filter = ff_hevc_epel_filters[mx - 1]; + const int8_t *filter = ff_hevc_epel_filters[mx]; int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; int16_t *tmp = tmp_array; int shift = 14 + 1 - BIT_DEPTH; @@ -694,7 +694,7 @@ static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, } tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; - filter = ff_hevc_epel_filters[my - 1]; + filter = ff_hevc_epel_filters[my]; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) @@ -715,7 +715,7 @@ static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, ptrdiff_t srcstride = _srcstride / sizeof(pixel); pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); - const int8_t *filter = ff_hevc_epel_filters[mx - 1]; + const int8_t *filter = ff_hevc_epel_filters[mx]; int shift = 14 + 1 - BIT_DEPTH; int log2Wd = denom + shift - 1; @@ -739,7 +739,7 @@ static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, int x, y; const pixel *src = (const pixel *)_src; ptrdiff_t srcstride = _srcstride / sizeof(pixel); - const int8_t *filter = ff_hevc_epel_filters[my - 1]; + const int8_t *filter = ff_hevc_epel_filters[my]; pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); int shift = 14 + 1 - BIT_DEPTH; @@ -767,7 +767,7 @@ static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, ptrdiff_t srcstride = _srcstride / sizeof(pixel); pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); - const int8_t *filter = ff_hevc_epel_filters[mx - 1]; + const int8_t *filter = ff_hevc_epel_filters[mx]; int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; int16_t *tmp = tmp_array; int shift = 14 + 1 - BIT_DEPTH; @@ -783,7 +783,7 @@ static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, } tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; - filter = ff_hevc_epel_filters[my - 1]; + filter = ff_hevc_epel_filters[my]; ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ox1 = ox1 * (1 << (BIT_DEPTH - 8)); diff --git a/src/ExtLib/ffmpeg/libavcodec/hwaccel_internal.h b/src/ExtLib/ffmpeg/libavcodec/hwaccel_internal.h index 057b07323d..b0cc22bb68 100644 --- a/src/ExtLib/ffmpeg/libavcodec/hwaccel_internal.h +++ b/src/ExtLib/ffmpeg/libavcodec/hwaccel_internal.h @@ -128,7 +128,7 @@ typedef struct FFHWAccel { /** * Uninitialize the hwaccel private data. * - * This will be called from get_format() or avcodec_close(), after hwaccel + * This will be called from get_format() or ff_codec_close(), after hwaccel * and hwaccel_context are already uninitialized. */ int (*uninit)(AVCodecContext *avctx); diff --git a/src/ExtLib/ffmpeg/libavcodec/indeo3.c b/src/ExtLib/ffmpeg/libavcodec/indeo3.c index 5f1014f0d4..7bb0235bdb 100644 --- a/src/ExtLib/ffmpeg/libavcodec/indeo3.c +++ b/src/ExtLib/ffmpeg/libavcodec/indeo3.c @@ -171,6 +171,9 @@ static av_cold int allocate_frame_buffers(Indeo3DecodeContext *ctx, int luma_size, chroma_size; ptrdiff_t luma_pitch, chroma_pitch; + luma_width = FFALIGN(luma_width , 2); + luma_height = FFALIGN(luma_height, 2); + if (luma_width < 16 || luma_width > 640 || luma_height < 16 || luma_height > 480 || luma_width & 1 || luma_height & 1) { diff --git a/src/ExtLib/ffmpeg/libavcodec/intelh263dec.c b/src/ExtLib/ffmpeg/libavcodec/intelh263dec.c index 2c216b00a6..f8eeb6b44e 100644 --- a/src/ExtLib/ffmpeg/libavcodec/intelh263dec.c +++ b/src/ExtLib/ffmpeg/libavcodec/intelh263dec.c @@ -138,8 +138,4 @@ const FFCodec ff_h263i_decoder = { FF_CODEC_DECODE_CB(ff_h263_decode_frame), .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/libuavs3d.c b/src/ExtLib/ffmpeg/libavcodec/libuavs3d.c index 66e8d31001..f5d47f28ed 100644 --- a/src/ExtLib/ffmpeg/libavcodec/libuavs3d.c +++ b/src/ExtLib/ffmpeg/libavcodec/libuavs3d.c @@ -274,8 +274,5 @@ const FFCodec ff_libuavs3d_decoder = { .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_AUTO_THREADS, .flush = libuavs3d_flush, - .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUV420P10LE, - AV_PIX_FMT_NONE }, .p.wrapper_name = "libuavs3d", }; diff --git a/src/ExtLib/ffmpeg/libavcodec/mpeg4videodec.c b/src/ExtLib/ffmpeg/libavcodec/mpeg4videodec.c index 65d4bf429b..07de5d6d91 100644 --- a/src/ExtLib/ffmpeg/libavcodec/mpeg4videodec.c +++ b/src/ExtLib/ffmpeg/libavcodec/mpeg4videodec.c @@ -3865,7 +3865,6 @@ const FFCodec ff_mpeg4_decoder = { FF_CODEC_CAP_ALLOCATE_PROGRESS, .flush = ff_mpeg_flush, .p.max_lowres = 3, - .p.pix_fmts = ff_h263_hwaccel_pixfmt_list_420, .p.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg4_video_profiles), UPDATE_THREAD_CONTEXT(mpeg4_update_thread_context), UPDATE_THREAD_CONTEXT_FOR_USER(mpeg4_update_thread_context_for_user), diff --git a/src/ExtLib/ffmpeg/libavcodec/msmpeg4dec.c b/src/ExtLib/ffmpeg/libavcodec/msmpeg4dec.c index 5b10d8f225..bf1e4877bd 100644 --- a/src/ExtLib/ffmpeg/libavcodec/msmpeg4dec.c +++ b/src/ExtLib/ffmpeg/libavcodec/msmpeg4dec.c @@ -853,10 +853,6 @@ const FFCodec ff_msmpeg4v1_decoder = { .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .p.max_lowres = 3, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; const FFCodec ff_msmpeg4v2_decoder = { @@ -871,10 +867,6 @@ const FFCodec ff_msmpeg4v2_decoder = { .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .p.max_lowres = 3, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; const FFCodec ff_msmpeg4v3_decoder = { @@ -889,10 +881,6 @@ const FFCodec ff_msmpeg4v3_decoder = { .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .p.max_lowres = 3, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; const FFCodec ff_wmv1_decoder = { @@ -907,8 +895,4 @@ const FFCodec ff_wmv1_decoder = { .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .p.max_lowres = 3, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/nvdec.c b/src/ExtLib/ffmpeg/libavcodec/nvdec.c index d13b790632..553c9bdf18 100644 --- a/src/ExtLib/ffmpeg/libavcodec/nvdec.c +++ b/src/ExtLib/ffmpeg/libavcodec/nvdec.c @@ -680,7 +680,7 @@ int ff_nvdec_simple_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, ctx->slice_offsets = tmp; if (!ctx->bitstream) - ctx->bitstream = (uint8_t*)buffer; + ctx->bitstream = buffer; ctx->slice_offsets[ctx->nb_slices] = buffer - ctx->bitstream; ctx->bitstream_len += size; diff --git a/src/ExtLib/ffmpeg/libavcodec/nvdec.h b/src/ExtLib/ffmpeg/libavcodec/nvdec.h index 812199dc6f..7e69e9660a 100644 --- a/src/ExtLib/ffmpeg/libavcodec/nvdec.h +++ b/src/ExtLib/ffmpeg/libavcodec/nvdec.h @@ -56,7 +56,7 @@ typedef struct NVDECContext { struct NVDECDecoder *decoder; ///< RefStruct reference - uint8_t *bitstream; + const uint8_t *bitstream; int bitstream_len; unsigned int bitstream_allocated; uint8_t *bitstream_internal; diff --git a/src/ExtLib/ffmpeg/libavcodec/nvdec_av1.c b/src/ExtLib/ffmpeg/libavcodec/nvdec_av1.c index 34e6e5b43b..d49980366e 100644 --- a/src/ExtLib/ffmpeg/libavcodec/nvdec_av1.c +++ b/src/ExtLib/ffmpeg/libavcodec/nvdec_av1.c @@ -303,7 +303,7 @@ static int nvdec_av1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, /* Shortcut if all tiles are in the same buffer */ if (ctx->nb_slices == s->tg_end - s->tg_start + 1) { - ctx->bitstream = (uint8_t*)buffer; + ctx->bitstream = buffer; ctx->bitstream_len = size; for (int i = 0; i < ctx->nb_slices; ++i) { @@ -321,7 +321,7 @@ static int nvdec_av1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, } ctx->bitstream = ctx->bitstream_internal = tmp; - memcpy(ctx->bitstream + ctx->bitstream_len, buffer, size); + memcpy(ctx->bitstream_internal + ctx->bitstream_len, buffer, size); for (uint32_t tile_num = s->tg_start; tile_num <= s->tg_end; ++tile_num) { ctx->slice_offsets[tile_num*2 ] = ctx->bitstream_len + s->tile_group_info[tile_num].tile_offset; diff --git a/src/ExtLib/ffmpeg/libavcodec/nvdec_h264.c b/src/ExtLib/ffmpeg/libavcodec/nvdec_h264.c index b9b0cc4125..95b8d56940 100644 --- a/src/ExtLib/ffmpeg/libavcodec/nvdec_h264.c +++ b/src/ExtLib/ffmpeg/libavcodec/nvdec_h264.c @@ -150,8 +150,8 @@ static int nvdec_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, return AVERROR(ENOMEM); ctx->slice_offsets = tmp; - AV_WB24(ctx->bitstream + ctx->bitstream_len, 1); - memcpy(ctx->bitstream + ctx->bitstream_len + 3, buffer, size); + AV_WB24(ctx->bitstream_internal + ctx->bitstream_len, 1); + memcpy(ctx->bitstream_internal + ctx->bitstream_len + 3, buffer, size); ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ; ctx->bitstream_len += size + 3; ctx->nb_slices++; diff --git a/src/ExtLib/ffmpeg/libavcodec/nvdec_hevc.c b/src/ExtLib/ffmpeg/libavcodec/nvdec_hevc.c index 25319a1328..ff118af04b 100644 --- a/src/ExtLib/ffmpeg/libavcodec/nvdec_hevc.c +++ b/src/ExtLib/ffmpeg/libavcodec/nvdec_hevc.c @@ -286,8 +286,8 @@ static int nvdec_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, return AVERROR(ENOMEM); ctx->slice_offsets = tmp; - AV_WB24(ctx->bitstream + ctx->bitstream_len, 1); - memcpy(ctx->bitstream + ctx->bitstream_len + 3, buffer, size); + AV_WB24(ctx->bitstream_internal + ctx->bitstream_len, 1); + memcpy(ctx->bitstream_internal + ctx->bitstream_len + 3, buffer, size); ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ; ctx->bitstream_len += size + 3; ctx->nb_slices++; diff --git a/src/ExtLib/ffmpeg/libavcodec/options.c b/src/ExtLib/ffmpeg/libavcodec/options.c index a9b35ee1c3..05a355fb45 100644 --- a/src/ExtLib/ffmpeg/libavcodec/options.c +++ b/src/ExtLib/ffmpeg/libavcodec/options.c @@ -27,6 +27,7 @@ #include "config_components.h" #include "avcodec.h" +#include "avcodec_internal.h" #include "codec_internal.h" #include "libavutil/avassert.h" #include "libavutil/internal.h" @@ -172,7 +173,7 @@ void avcodec_free_context(AVCodecContext **pavctx) if (!avctx) return; - avcodec_close(avctx); + ff_codec_close(avctx); av_freep(&avctx->extradata); av_freep(&avctx->subtitle_header); diff --git a/src/ExtLib/ffmpeg/libavcodec/pngdec.c b/src/ExtLib/ffmpeg/libavcodec/pngdec.c index d1aae4c70e..026da30c25 100644 --- a/src/ExtLib/ffmpeg/libavcodec/pngdec.c +++ b/src/ExtLib/ffmpeg/libavcodec/pngdec.c @@ -29,6 +29,7 @@ #include "libavutil/csp.h" #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" +#include "libavutil/mastering_display_metadata.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" #include "libavutil/stereo3d.h" @@ -81,6 +82,14 @@ typedef struct PNGDecContext { enum AVColorPrimaries cicp_primaries; enum AVColorTransferCharacteristic cicp_trc; enum AVColorRange cicp_range; + int have_clli; + uint32_t clli_max; + uint32_t clli_avg; + int have_mdvc; + uint16_t mdvc_primaries[3][2]; + uint16_t mdvc_white_point[2]; + uint32_t mdvc_max_lum; + uint32_t mdvc_min_lum; enum PNGHeaderState hdr_state; enum PNGImageState pic_state; @@ -731,6 +740,36 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) if (!s->has_trns && s->significant_bits > 0) avctx->bits_per_raw_sample = s->significant_bits; + if (s->have_clli) { + AVContentLightMetadata *clli = + av_content_light_metadata_create_side_data(frame); + if (!clli) + return AVERROR(ENOMEM); + /* + * 0.0001 divisor value + * see: https://www.w3.org/TR/png-3/#cLLi-chunk + */ + clli->MaxCLL = s->clli_max / 10000; + clli->MaxFALL = s->clli_avg / 10000; + } + + if (s->have_mdvc) { + AVMasteringDisplayMetadata *mdvc = + av_mastering_display_metadata_create_side_data(frame); + if (!mdvc) + return AVERROR(ENOMEM); + mdvc->has_primaries = 1; + for (int i = 0; i < 3; i++) { + mdvc->display_primaries[i][0] = av_make_q(s->mdvc_primaries[i][0], 50000); + mdvc->display_primaries[i][1] = av_make_q(s->mdvc_primaries[i][1], 50000); + } + mdvc->white_point[0] = av_make_q(s->mdvc_white_point[0], 50000); + mdvc->white_point[1] = av_make_q(s->mdvc_white_point[1], 50000); + mdvc->has_luminance = 1; + mdvc->max_luminance = av_make_q(s->mdvc_max_lum, 10000); + mdvc->min_luminance = av_make_q(s->mdvc_min_lum, 10000); + } + return 0; } @@ -1508,6 +1547,30 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, break; } + case MKTAG('c', 'L', 'L', 'i'): + if (bytestream2_get_bytes_left(&gb_chunk) != 8) { + av_log(avctx, AV_LOG_WARNING, "Invalid cLLi chunk size: %d\n", bytestream2_get_bytes_left(&gb_chunk)); + break; + } + s->have_clli = 1; + s->clli_max = bytestream2_get_be32u(&gb_chunk); + s->clli_avg = bytestream2_get_be32u(&gb_chunk); + break; + case MKTAG('m', 'D', 'V', 'c'): + if (bytestream2_get_bytes_left(&gb_chunk) != 24) { + av_log(avctx, AV_LOG_WARNING, "Invalid mDVc chunk size: %d\n", bytestream2_get_bytes_left(&gb_chunk)); + break; + } + s->have_mdvc = 1; + for (int i = 0; i < 3; i++) { + s->mdvc_primaries[i][0] = bytestream2_get_be16u(&gb_chunk); + s->mdvc_primaries[i][1] = bytestream2_get_be16u(&gb_chunk); + } + s->mdvc_white_point[0] = bytestream2_get_be16u(&gb_chunk); + s->mdvc_white_point[1] = bytestream2_get_be16u(&gb_chunk); + s->mdvc_max_lum = bytestream2_get_be32u(&gb_chunk); + s->mdvc_min_lum = bytestream2_get_be32u(&gb_chunk); + break; case MKTAG('I', 'E', 'N', 'D'): if (!(s->pic_state & PNG_ALLIMAGE)) av_log(avctx, AV_LOG_ERROR, "IEND without all image\n"); diff --git a/src/ExtLib/ffmpeg/libavcodec/pthread_frame.c b/src/ExtLib/ffmpeg/libavcodec/pthread_frame.c index 71e99a5728..2274d3fd7a 100644 --- a/src/ExtLib/ffmpeg/libavcodec/pthread_frame.c +++ b/src/ExtLib/ffmpeg/libavcodec/pthread_frame.c @@ -761,7 +761,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) ff_pthread_free(fctx, thread_ctx_offsets); /* if we have stashed hwaccel state, move it to the user-facing context, - * so it will be freed in avcodec_close() */ + * so it will be freed in ff_codec_close() */ av_assert0(!avctx->hwaccel); FFSWAP(const AVHWAccel*, avctx->hwaccel, fctx->stash_hwaccel); FFSWAP(void*, avctx->hwaccel_context, fctx->stash_hwaccel_context); diff --git a/src/ExtLib/ffmpeg/libavcodec/refstruct.c b/src/ExtLib/ffmpeg/libavcodec/refstruct.c index 7597f6d0ee..81e8c9795c 100644 --- a/src/ExtLib/ffmpeg/libavcodec/refstruct.c +++ b/src/ExtLib/ffmpeg/libavcodec/refstruct.c @@ -45,7 +45,7 @@ #define REFSTRUCT_COOKIE AV_NE((uint64_t)MKBETAG('R', 'e', 'f', 'S') << 32 | MKBETAG('t', 'r', 'u', 'c'), \ MKTAG('R', 'e', 'f', 'S') | (uint64_t)MKTAG('t', 'r', 'u', 'c') << 32) -#if __STDC_VERSION__ >= 201112L +#if __STDC_VERSION__ >= 201112L && !defined(_MSC_VER) #define REFCOUNT_OFFSET FFALIGN(sizeof(RefCount), FFMAX3(STRIDE_ALIGN, 16, _Alignof(max_align_t))) #else #define REFCOUNT_OFFSET FFALIGN(sizeof(RefCount), FFMAX(STRIDE_ALIGN, 16)) diff --git a/src/ExtLib/ffmpeg/libavcodec/rv10.c b/src/ExtLib/ffmpeg/libavcodec/rv10.c index 216328ffe7..d32faa628b 100644 --- a/src/ExtLib/ffmpeg/libavcodec/rv10.c +++ b/src/ExtLib/ffmpeg/libavcodec/rv10.c @@ -671,10 +671,6 @@ const FFCodec ff_rv10_decoder = { FF_CODEC_DECODE_CB(rv10_decode_frame), .p.capabilities = AV_CODEC_CAP_DR1, .p.max_lowres = 3, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; const FFCodec ff_rv20_decoder = { @@ -689,8 +685,4 @@ const FFCodec ff_rv20_decoder = { .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .flush = ff_mpeg_flush, .p.max_lowres = 3, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/rv30.c b/src/ExtLib/ffmpeg/libavcodec/rv30.c index be62577f99..9e13e71805 100644 --- a/src/ExtLib/ffmpeg/libavcodec/rv30.c +++ b/src/ExtLib/ffmpeg/libavcodec/rv30.c @@ -303,10 +303,6 @@ const FFCodec ff_rv30_decoder = { .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS, .flush = ff_mpeg_flush, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, UPDATE_THREAD_CONTEXT(ff_rv34_decode_update_thread_context), .caps_internal = FF_CODEC_CAP_ALLOCATE_PROGRESS, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/rv40.c b/src/ExtLib/ffmpeg/libavcodec/rv40.c index 3ee405f33c..e48aa1f684 100644 --- a/src/ExtLib/ffmpeg/libavcodec/rv40.c +++ b/src/ExtLib/ffmpeg/libavcodec/rv40.c @@ -581,10 +581,6 @@ const FFCodec ff_rv40_decoder = { .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS, .flush = ff_mpeg_flush, - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, UPDATE_THREAD_CONTEXT(ff_rv34_decode_update_thread_context), .caps_internal = FF_CODEC_CAP_ALLOCATE_PROGRESS, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/svq1dec.c b/src/ExtLib/ffmpeg/libavcodec/svq1dec.c index af02063a45..d2cfe4cf40 100644 --- a/src/ExtLib/ffmpeg/libavcodec/svq1dec.c +++ b/src/ExtLib/ffmpeg/libavcodec/svq1dec.c @@ -863,6 +863,4 @@ const FFCodec ff_svq1_decoder = { FF_CODEC_DECODE_CB(svq1_decode_frame), .p.capabilities = AV_CODEC_CAP_DR1, .flush = svq1_flush, - .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV410P, - AV_PIX_FMT_NONE }, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/svq3.c b/src/ExtLib/ffmpeg/libavcodec/svq3.c index 2d03dbc457..d2f53742e1 100644 --- a/src/ExtLib/ffmpeg/libavcodec/svq3.c +++ b/src/ExtLib/ffmpeg/libavcodec/svq3.c @@ -1602,7 +1602,5 @@ const FFCodec ff_svq3_decoder = { .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, - .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, - AV_PIX_FMT_NONE}, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/texturedsp.c b/src/ExtLib/ffmpeg/libavcodec/texturedsp.c index fae7b932dc..e2161060b7 100644 --- a/src/ExtLib/ffmpeg/libavcodec/texturedsp.c +++ b/src/ExtLib/ffmpeg/libavcodec/texturedsp.c @@ -175,9 +175,12 @@ static av_always_inline void premult2straight(uint8_t *src) int b = src[2]; int a = src[3]; /* unchanged */ - src[0] = (uint8_t) r * a / 255; - src[1] = (uint8_t) g * a / 255; - src[2] = (uint8_t) b * a / 255; + if (a == 0) + return; + + src[0] = (uint8_t) FFMIN(r * 255 / a, 255); + src[1] = (uint8_t) FFMIN(g * 255 / a, 255); + src[2] = (uint8_t) FFMIN(b * 255 / a, 255); } /** diff --git a/src/ExtLib/ffmpeg/libavcodec/tiff.c b/src/ExtLib/ffmpeg/libavcodec/tiff.c index adb49e4525..3ce441aa2c 100644 --- a/src/ExtLib/ffmpeg/libavcodec/tiff.c +++ b/src/ExtLib/ffmpeg/libavcodec/tiff.c @@ -1701,7 +1701,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) break; case TIFF_ICC_PROFILE: gb_temp = s->gb; - bytestream2_seek(&gb_temp, SEEK_SET, off); + bytestream2_seek(&gb_temp, off, SEEK_SET); if (bytestream2_get_bytes_left(&gb_temp) < count) return AVERROR_INVALIDDATA; diff --git a/src/ExtLib/ffmpeg/libavcodec/vc1dec.c b/src/ExtLib/ffmpeg/libavcodec/vc1dec.c index d5046c358b..1c27f057f1 100644 --- a/src/ExtLib/ffmpeg/libavcodec/vc1dec.c +++ b/src/ExtLib/ffmpeg/libavcodec/vc1dec.c @@ -51,6 +51,30 @@ #include "libavutil/thread.h" +static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = { +#if CONFIG_VC1_DXVA2_HWACCEL + AV_PIX_FMT_DXVA2_VLD, +#endif +#if CONFIG_VC1_D3D11VA_HWACCEL + AV_PIX_FMT_D3D11VA_VLD, + AV_PIX_FMT_D3D11, +#endif +#if CONFIG_VC1_D3D12VA_HWACCEL + AV_PIX_FMT_D3D12, +#endif +#if CONFIG_VC1_NVDEC_HWACCEL + AV_PIX_FMT_CUDA, +#endif +#if CONFIG_VC1_VAAPI_HWACCEL + AV_PIX_FMT_VAAPI, +#endif +#if CONFIG_VC1_VDPAU_HWACCEL + AV_PIX_FMT_VDPAU, +#endif + AV_PIX_FMT_YUV420P, + AV_PIX_FMT_NONE +}; + #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER typedef struct SpriteData { @@ -417,7 +441,11 @@ static enum AVPixelFormat vc1_get_format(AVCodecContext *avctx) return AV_PIX_FMT_GRAY8; } - return ff_get_format(avctx, avctx->codec->pix_fmts); + if (avctx->codec_id == AV_CODEC_ID_VC1IMAGE || + avctx->codec_id == AV_CODEC_ID_WMV3IMAGE) + return AV_PIX_FMT_YUV420P; + + return ff_get_format(avctx, vc1_hwaccel_pixfmt_list_420); } av_cold int ff_vc1_decode_init(AVCodecContext *avctx) @@ -691,14 +719,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) if (v->profile == PROFILE_ADVANCED) avctx->level = v->level; - if (!CONFIG_GRAY || !(avctx->flags & AV_CODEC_FLAG_GRAY)) - avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); - else { - avctx->pix_fmt = AV_PIX_FMT_GRAY8; - if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED) - avctx->color_range = AVCOL_RANGE_MPEG; - } - ff_blockdsp_init(&s->bdsp); ff_h264chroma_init(&v->h264chroma, 8); @@ -846,14 +866,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, if (size <= 0) continue; switch (AV_RB32(start)) { case VC1_CODE_FRAME: - if (avctx->hwaccel) - buf_start = start; + buf_start = start; buf_size2 = v->vc1dsp.vc1_unescape_buffer(start + 4, size, buf2); break; case VC1_CODE_FIELD: { int buf_size3; - if (avctx->hwaccel) - buf_start_second_field = start; + buf_start_second_field = start; av_size_mult(sizeof(*slices), n_slices+1, &next_allocated); tmp = next_allocated ? av_fast_realloc(slices, &slices_allocated, next_allocated) : NULL; if (!tmp) { @@ -918,8 +936,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, ret = AVERROR_INVALIDDATA; goto err; } else { // found field marker, unescape second field - if (avctx->hwaccel) - buf_start_second_field = divider; + buf_start_second_field = divider; av_size_mult(sizeof(*slices), n_slices+1, &next_allocated); tmp = next_allocated ? av_fast_realloc(slices, &slices_allocated, next_allocated) : NULL; if (!tmp) { @@ -1384,30 +1401,6 @@ static void vc1_decode_flush(AVCodecContext *avctx) } // ==> End patch MPC -static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = { -#if CONFIG_VC1_DXVA2_HWACCEL - AV_PIX_FMT_DXVA2_VLD, -#endif -#if CONFIG_VC1_D3D11VA_HWACCEL - AV_PIX_FMT_D3D11VA_VLD, - AV_PIX_FMT_D3D11, -#endif -#if CONFIG_VC1_D3D12VA_HWACCEL - AV_PIX_FMT_D3D12, -#endif -#if CONFIG_VC1_NVDEC_HWACCEL - AV_PIX_FMT_CUDA, -#endif -#if CONFIG_VC1_VAAPI_HWACCEL - AV_PIX_FMT_VAAPI, -#endif -#if CONFIG_VC1_VDPAU_HWACCEL - AV_PIX_FMT_VDPAU, -#endif - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE -}; - const FFCodec ff_vc1_decoder = { .p.name = "vc1", CODEC_LONG_NAME("SMPTE VC-1"), @@ -1421,7 +1414,6 @@ const FFCodec ff_vc1_decoder = { .flush = vc1_decode_flush/*ff_mpeg_flush*/, // ==> End patch MPC .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, - .p.pix_fmts = vc1_hwaccel_pixfmt_list_420, .hw_configs = (const AVCodecHWConfigInternal *const []) { #if CONFIG_VC1_DXVA2_HWACCEL HWACCEL_DXVA2(vc1), @@ -1463,7 +1455,6 @@ const FFCodec ff_wmv3_decoder = { .flush = vc1_decode_flush/*ff_mpeg_flush*/, // ==> End patch MPC .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, - .p.pix_fmts = vc1_hwaccel_pixfmt_list_420, .hw_configs = (const AVCodecHWConfigInternal *const []) { #if CONFIG_WMV3_DXVA2_HWACCEL HWACCEL_DXVA2(wmv3), @@ -1506,10 +1497,6 @@ const FFCodec ff_wmv3image_decoder = { // ==> Start patch MPC //.flush = vc1_sprite_flush, // ==> end patch MPC - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; #endif @@ -1527,9 +1514,5 @@ const FFCodec ff_vc1image_decoder = { // ==> Start patch MPC //.flush = vc1_sprite_flush, // ==> end patch MPC - .p.pix_fmts = (const enum AVPixelFormat[]) { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE - }, }; #endif diff --git a/src/ExtLib/ffmpeg/libavcodec/version_major.h b/src/ExtLib/ffmpeg/libavcodec/version_major.h index b9164fe5c6..45209c0a4f 100644 --- a/src/ExtLib/ffmpeg/libavcodec/version_major.h +++ b/src/ExtLib/ffmpeg/libavcodec/version_major.h @@ -52,6 +52,7 @@ #define FF_API_AVFFT (LIBAVCODEC_VERSION_MAJOR < 62) #define FF_API_FF_PROFILE_LEVEL (LIBAVCODEC_VERSION_MAJOR < 62) +#define FF_API_AVCODEC_CLOSE (LIBAVCODEC_VERSION_MAJOR < 62) // reminder to remove CrystalHD decoders on next major bump #define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61) diff --git a/src/ExtLib/ffmpeg/libavcodec/wmv2dec.c b/src/ExtLib/ffmpeg/libavcodec/wmv2dec.c index ab72590a8e..ff27d1b4d0 100644 --- a/src/ExtLib/ffmpeg/libavcodec/wmv2dec.c +++ b/src/ExtLib/ffmpeg/libavcodec/wmv2dec.c @@ -599,6 +599,4 @@ const FFCodec ff_wmv2_decoder = { FF_CODEC_DECODE_CB(ff_h263_decode_frame), .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, - .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE }, }; diff --git a/src/ExtLib/ffmpeg/libavcodec/x86/h264_intrapred.asm b/src/ExtLib/ffmpeg/libavcodec/x86/h264_intrapred.asm index 8a38ba2bb5..ea46bc595d 100644 --- a/src/ExtLib/ffmpeg/libavcodec/x86/h264_intrapred.asm +++ b/src/ExtLib/ffmpeg/libavcodec/x86/h264_intrapred.asm @@ -86,8 +86,6 @@ cglobal pred16x16_horizontal_8, 2,3 punpcklbw m1, m1 SPLATW m0, m0, 3 SPLATW m1, m1, 3 - mova [r0+r1*0+8], m0 - mova [r0+r1*1+8], m1 %endif mova [r0+r1*0], m0 @@ -98,7 +96,7 @@ cglobal pred16x16_horizontal_8, 2,3 RET %endmacro -INIT_MMX mmxext +INIT_XMM sse2 PRED16x16_H INIT_XMM ssse3 PRED16x16_H @@ -568,17 +566,17 @@ H264_PRED8x8_PLANE ; void ff_pred8x8_vertical_8(uint8_t *src, ptrdiff_t stride) ;----------------------------------------------------------------------------- -INIT_MMX mmx +INIT_XMM sse2 cglobal pred8x8_vertical_8, 2,2 sub r0, r1 - movq mm0, [r0] + movq m0, [r0] %rep 3 - movq [r0+r1*1], mm0 - movq [r0+r1*2], mm0 + movq [r0+r1*1], m0 + movq [r0+r1*2], m0 lea r0, [r0+r1*2] %endrep - movq [r0+r1*1], mm0 - movq [r0+r1*2], mm0 + movq [r0+r1*1], m0 + movq [r0+r1*2], m0 RET ;----------------------------------------------------------------------------- diff --git a/src/ExtLib/ffmpeg/libavcodec/x86/h264_intrapred_init.c b/src/ExtLib/ffmpeg/libavcodec/x86/h264_intrapred_init.c index ee46927a24..aa9bc721f0 100644 --- a/src/ExtLib/ffmpeg/libavcodec/x86/h264_intrapred_init.c +++ b/src/ExtLib/ffmpeg/libavcodec/x86/h264_intrapred_init.c @@ -100,7 +100,7 @@ PRED16x16(horizontal, 10, sse2) /* 8-bit versions */ PRED16x16(vertical, 8, sse) -PRED16x16(horizontal, 8, mmxext) +PRED16x16(horizontal, 8, sse2) PRED16x16(horizontal, 8, ssse3) PRED16x16(dc, 8, sse2) PRED16x16(dc, 8, ssse3) @@ -116,7 +116,7 @@ PRED16x16(tm_vp8, 8, avx2) PRED8x8(top_dc, 8, mmxext) PRED8x8(dc_rv40, 8, mmxext) PRED8x8(dc, 8, mmxext) -PRED8x8(vertical, 8, mmx) +PRED8x8(vertical, 8, sse2) PRED8x8(horizontal, 8, mmxext) PRED8x8(horizontal, 8, ssse3) PRED8x8(plane, 8, sse2) @@ -163,14 +163,7 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, int cpu_flags = av_get_cpu_flags(); if (bit_depth == 8) { - if (EXTERNAL_MMX(cpu_flags)) { - if (chroma_format_idc <= 1) { - h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_mmx; - } - } - if (EXTERNAL_MMXEXT(cpu_flags)) { - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_mmxext; if (chroma_format_idc <= 1) h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_mmxext; h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_8_mmxext; @@ -210,12 +203,15 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, } if (EXTERNAL_SSE2(cpu_flags)) { + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_sse2; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_sse2; h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_8_sse2; h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_sse2; h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_sse2; h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_8_sse2; h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_sse2; + if (chroma_format_idc <= 1) + h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_sse2; if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_sse2; h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_sse2; diff --git a/src/ExtLib/ffmpeg/libavcodec/x86/hevcdsp_init.c b/src/ExtLib/ffmpeg/libavcodec/x86/hevcdsp_init.c index f75ca03a2b..e132699105 100644 --- a/src/ExtLib/ffmpeg/libavcodec/x86/hevcdsp_init.c +++ b/src/ExtLib/ffmpeg/libavcodec/x86/hevcdsp_init.c @@ -88,8 +88,8 @@ IDCT_FUNCS(avx) #define ff_hevc_pel_filters ff_hevc_qpel_filters #define DECL_HV_FILTER(f) \ - const uint8_t *hf = ff_hevc_ ## f ## _filters[mx - 1]; \ - const uint8_t *vf = ff_hevc_ ## f ## _filters[my - 1]; + const uint8_t *hf = ff_hevc_ ## f ## _filters[mx]; \ + const uint8_t *vf = ff_hevc_ ## f ## _filters[my]; #define FW_PUT(p, a, b, depth, opt) \ void ff_hevc_put_hevc_ ## a ## _ ## depth ## _##opt(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride, \ diff --git a/src/ExtLib/ffmpeg/libavcodec/x86/vp6dsp.asm b/src/ExtLib/ffmpeg/libavcodec/x86/vp6dsp.asm index 512fe89def..0106541734 100644 --- a/src/ExtLib/ffmpeg/libavcodec/x86/vp6dsp.asm +++ b/src/ExtLib/ffmpeg/libavcodec/x86/vp6dsp.asm @@ -27,44 +27,6 @@ cextern pw_64 SECTION .text %macro DIAG4 6 -%if mmsize == 8 - movq m0, [%1+%2] - movq m1, [%1+%3] - movq m3, m0 - movq m4, m1 - punpcklbw m0, m7 - punpcklbw m1, m7 - punpckhbw m3, m7 - punpckhbw m4, m7 - pmullw m0, [rsp+8*11] ; src[x-8 ] * biweight [0] - pmullw m1, [rsp+8*12] ; src[x ] * biweight [1] - pmullw m3, [rsp+8*11] ; src[x-8 ] * biweight [0] - pmullw m4, [rsp+8*12] ; src[x ] * biweight [1] - paddw m0, m1 - paddw m3, m4 - movq m1, [%1+%4] - movq m2, [%1+%5] - movq m4, m1 - movq m5, m2 - punpcklbw m1, m7 - punpcklbw m2, m7 - punpckhbw m4, m7 - punpckhbw m5, m7 - pmullw m1, [rsp+8*13] ; src[x+8 ] * biweight [2] - pmullw m2, [rsp+8*14] ; src[x+16] * biweight [3] - pmullw m4, [rsp+8*13] ; src[x+8 ] * biweight [2] - pmullw m5, [rsp+8*14] ; src[x+16] * biweight [3] - paddw m1, m2 - paddw m4, m5 - paddsw m0, m1 - paddsw m3, m4 - paddsw m0, m6 ; Add 64 - paddsw m3, m6 ; Add 64 - psraw m0, 7 - psraw m3, 7 - packuswb m0, m3 - movq [%6], m0 -%else ; mmsize == 16 movq m0, [%1+%2] movq m1, [%1+%3] punpcklbw m0, m7 @@ -84,25 +46,9 @@ SECTION .text psraw m0, 7 packuswb m0, m0 movq [%6], m0 -%endif ; mmsize == 8/16 %endmacro %macro SPLAT4REGS 0 -%if mmsize == 8 - movq m5, m3 - punpcklwd m3, m3 - movq m4, m3 - punpckldq m3, m3 - punpckhdq m4, m4 - punpckhwd m5, m5 - movq m2, m5 - punpckhdq m2, m2 - punpckldq m5, m5 - movq [rsp+8*11], m3 - movq [rsp+8*12], m4 - movq [rsp+8*13], m5 - movq [rsp+8*14], m2 -%else ; mmsize == 16 pshuflw m4, m3, 0x0 pshuflw m5, m3, 0x55 pshuflw m6, m3, 0xAA @@ -111,7 +57,6 @@ SECTION .text punpcklqdq m5, m5 punpcklqdq m6, m6 punpcklqdq m3, m3 -%endif ; mmsize == 8/16 %endmacro ; void ff_vp6_filter_diag4_(uint8_t *dst, uint8_t *src, ptrdiff_t stride, diff --git a/src/ExtLib/ffmpeg/libavfilter/allfilters.c b/src/ExtLib/ffmpeg/libavfilter/allfilters.c index af84aa3d97..149bf50997 100644 --- a/src/ExtLib/ffmpeg/libavfilter/allfilters.c +++ b/src/ExtLib/ffmpeg/libavfilter/allfilters.c @@ -611,8 +611,6 @@ extern const AVFilter ff_asrc_abuffer; extern const AVFilter ff_vsrc_buffer; extern const AVFilter ff_asink_abuffer; extern const AVFilter ff_vsink_buffer; -extern const AVFilter ff_af_afifo; -extern const AVFilter ff_vf_fifo; #include "libavfilter/filter_list.c" diff --git a/src/ExtLib/ffmpeg/libavfilter/buffersink.c b/src/ExtLib/ffmpeg/libavfilter/buffersink.c index 6ba2970dd5..af7f8ab58a 100644 --- a/src/ExtLib/ffmpeg/libavfilter/buffersink.c +++ b/src/ExtLib/ffmpeg/libavfilter/buffersink.c @@ -48,6 +48,10 @@ typedef struct BufferSinkContext { /* only used for video */ enum AVPixelFormat *pixel_fmts; ///< list of accepted pixel formats int pixel_fmts_size; + enum AVColorSpace *color_spaces; ///< list of accepted color spaces + int color_spaces_size; + enum AVColorRange *color_ranges; ///< list of accepted color ranges + int color_ranges_size; /* only used for audio */ enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats @@ -250,19 +254,36 @@ int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out static int vsink_query_formats(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; - AVFilterFormats *formats = NULL; unsigned i; int ret; CHECK_LIST_SIZE(pixel_fmts) + CHECK_LIST_SIZE(color_spaces) + CHECK_LIST_SIZE(color_ranges) if (buf->pixel_fmts_size) { + AVFilterFormats *formats = NULL; for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++) if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0) return ret; if ((ret = ff_set_common_formats(ctx, formats)) < 0) return ret; - } else { - if ((ret = ff_default_query_formats(ctx)) < 0) + } + + if (buf->color_spaces_size) { + AVFilterFormats *formats = NULL; + for (i = 0; i < NB_ITEMS(buf->color_spaces); i++) + if ((ret = ff_add_format(&formats, buf->color_spaces[i])) < 0) + return ret; + if ((ret = ff_set_common_color_spaces(ctx, formats)) < 0) + return ret; + } + + if (buf->color_ranges_size) { + AVFilterFormats *formats = NULL; + for (i = 0; i < NB_ITEMS(buf->color_ranges); i++) + if ((ret = ff_add_format(&formats, buf->color_ranges[i])) < 0) + return ret; + if ((ret = ff_set_common_color_ranges(ctx, formats)) < 0) return ret; } @@ -365,6 +386,8 @@ static int asink_query_formats(AVFilterContext *ctx) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM static const AVOption buffersink_options[] = { { "pix_fmts", "set the supported pixel formats", OFFSET(pixel_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS }, + { "color_spaces", "set the supported color spaces", OFFSET(color_spaces), AV_OPT_TYPE_BINARY, .flags = FLAGS }, + { "color_ranges", "set the supported color ranges", OFFSET(color_ranges), AV_OPT_TYPE_BINARY, .flags = FLAGS }, { NULL }, }; #undef FLAGS diff --git a/src/ExtLib/ffmpeg/libavfilter/buffersink.h b/src/ExtLib/ffmpeg/libavfilter/buffersink.h index 147e83114c..539a055ac2 100644 --- a/src/ExtLib/ffmpeg/libavfilter/buffersink.h +++ b/src/ExtLib/ffmpeg/libavfilter/buffersink.h @@ -55,6 +55,8 @@ * The format can be constrained by setting options, using av_opt_set() and * related functions with the AV_OPT_SEARCH_CHILDREN flag. * - pix_fmts (int list), + * - color_spaces (int list), + * - color_ranges (int list), * - sample_fmts (int list), * - sample_rates (int list), * - ch_layouts (string), diff --git a/src/ExtLib/ffmpeg/libavfilter/buffersrc.c b/src/ExtLib/ffmpeg/libavfilter/buffersrc.c index 6e450ff6b7..a6a000df1e 100644 --- a/src/ExtLib/ffmpeg/libavfilter/buffersrc.c +++ b/src/ExtLib/ffmpeg/libavfilter/buffersrc.c @@ -291,6 +291,11 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif + if (copy->colorspace == AVCOL_SPC_UNSPECIFIED) + copy->colorspace = ctx->outputs[0]->colorspace; + if (copy->color_range == AVCOL_RANGE_UNSPECIFIED) + copy->color_range = ctx->outputs[0]->color_range; + ret = ff_filter_frame(ctx->outputs[0], copy); if (ret < 0) return ret; @@ -501,8 +506,14 @@ static int query_formats(AVFilterContext *ctx) if ((ret = ff_add_format(&color_spaces, c->color_space)) < 0 || (ret = ff_set_common_color_spaces(ctx, color_spaces)) < 0) return ret; - if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0 || - (ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0) + if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0) + return ret; + if (c->color_range == AVCOL_RANGE_UNSPECIFIED) { + /* allow implicitly promoting unspecified to mpeg */ + if ((ret = ff_add_format(&color_ranges, AVCOL_RANGE_MPEG)) < 0) + return ret; + } + if ((ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0) return ret; } break; diff --git a/src/ExtLib/ffmpeg/libavutil/channel_layout.c b/src/ExtLib/ffmpeg/libavutil/channel_layout.c index b30df0c8be..8b488c48c0 100644 --- a/src/ExtLib/ffmpeg/libavutil/channel_layout.c +++ b/src/ExtLib/ffmpeg/libavutil/channel_layout.c @@ -398,6 +398,26 @@ int av_get_standard_channel_layout(unsigned index, uint64_t *layout, FF_ENABLE_DEPRECATION_WARNINGS #endif +int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels) +{ + AVChannelCustom *map; + + if (nb_channels <= 0) + return AVERROR(EINVAL); + + map = av_calloc(nb_channels, sizeof(*channel_layout->u.map)); + if (!map) + return AVERROR(ENOMEM); + for (int i = 0; i < nb_channels; i++) + map[i].id = AV_CHAN_UNKNOWN; + + channel_layout->order = AV_CHANNEL_ORDER_CUSTOM; + channel_layout->nb_channels = nb_channels; + channel_layout->u.map = map; + + return 0; +} + int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask) { @@ -1016,3 +1036,109 @@ uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, return ret; } + +static int64_t masked_description(AVChannelLayout *channel_layout, int start_channel) +{ + uint64_t mask = 0; + for (int i = start_channel; i < channel_layout->nb_channels; i++) { + enum AVChannel ch = channel_layout->u.map[i].id; + if (ch >= 0 && ch < 63 && mask < (1ULL << ch)) + mask |= (1ULL << ch); + else + return AVERROR(EINVAL); + } + return mask; +} + +static int has_channel_names(AVChannelLayout *channel_layout) +{ + if (channel_layout->order != AV_CHANNEL_ORDER_CUSTOM) + return 0; + for (int i = 0; i < channel_layout->nb_channels; i++) + if (channel_layout->u.map[i].name[0]) + return 1; + return 0; +} + +int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags) +{ + int allow_lossy = !(flags & AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS); + int lossy; + + if (!av_channel_layout_check(channel_layout)) + return AVERROR(EINVAL); + + if (channel_layout->order == order) + return 0; + + switch (order) { + case AV_CHANNEL_ORDER_UNSPEC: { + int nb_channels = channel_layout->nb_channels; + if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM) { + lossy = 0; + for (int i = 0; i < nb_channels; i++) { + if (channel_layout->u.map[i].id != AV_CHAN_UNKNOWN || channel_layout->u.map[i].name[0]) { + lossy = 1; + break; + } + } + } else { + lossy = 1; + } + if (!lossy || allow_lossy) { + av_channel_layout_uninit(channel_layout); + channel_layout->order = AV_CHANNEL_ORDER_UNSPEC; + channel_layout->nb_channels = nb_channels; + return lossy; + } + return AVERROR(ENOSYS); + } + case AV_CHANNEL_ORDER_NATIVE: + if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM) { + int64_t mask = masked_description(channel_layout, 0); + if (mask < 0) + return AVERROR(ENOSYS); + lossy = has_channel_names(channel_layout); + if (!lossy || allow_lossy) { + av_channel_layout_uninit(channel_layout); + av_channel_layout_from_mask(channel_layout, mask); + return lossy; + } + } + return AVERROR(ENOSYS); + case AV_CHANNEL_ORDER_CUSTOM: { + AVChannelLayout custom = { 0 }; + int ret = av_channel_layout_custom_init(&custom, channel_layout->nb_channels); + if (ret < 0) + return ret; + if (channel_layout->order != AV_CHANNEL_ORDER_UNSPEC) + for (int i = 0; i < channel_layout->nb_channels; i++) + custom.u.map[i].id = av_channel_layout_channel_from_index(channel_layout, i); + av_channel_layout_uninit(channel_layout); + *channel_layout = custom; + return 0; + } + case AV_CHANNEL_ORDER_AMBISONIC: + if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM) { + int64_t mask; + int nb_channels = channel_layout->nb_channels; + int order = ambisonic_order(channel_layout); + if (order < 0) + return AVERROR(ENOSYS); + mask = masked_description(channel_layout, (order + 1) * (order + 1)); + if (mask < 0) + return AVERROR(ENOSYS); + lossy = has_channel_names(channel_layout); + if (!lossy || allow_lossy) { + av_channel_layout_uninit(channel_layout); + channel_layout->order = AV_CHANNEL_ORDER_AMBISONIC; + channel_layout->nb_channels = nb_channels; + channel_layout->u.mask = mask; + return lossy; + } + } + return AVERROR(ENOSYS); + default: + return AVERROR(EINVAL); + } +} diff --git a/src/ExtLib/ffmpeg/libavutil/channel_layout.h b/src/ExtLib/ffmpeg/libavutil/channel_layout.h index 682c7d468c..d8c76f9005 100644 --- a/src/ExtLib/ffmpeg/libavutil/channel_layout.h +++ b/src/ExtLib/ffmpeg/libavutil/channel_layout.h @@ -617,6 +617,23 @@ void av_channel_description_bprint(struct AVBPrint *bp, enum AVChannel channel_i */ enum AVChannel av_channel_from_string(const char *name); +/** + * Initialize a custom channel layout with the specified number of channels. + * The channel map will be allocated and the designation of all channels will + * be set to AV_CHAN_UNKNOWN. + * + * This is only a convenience helper function, a custom channel layout can also + * be constructed without using this. + * + * @param channel_layout the layout structure to be initialized + * @param nb_channels the number of channels + * + * @return 0 on success + * AVERROR(EINVAL) if the number of channels <= 0 + * AVERROR(ENOMEM) if the channel map could not be allocated + */ +int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels); + /** * Initialize a native channel layout from a bitmask indicating which channels * are present. @@ -804,6 +821,46 @@ int av_channel_layout_check(const AVChannelLayout *channel_layout); */ int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1); +/** + * The conversion must be lossless. + */ +#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS (1 << 0) + +/** + * Change the AVChannelOrder of a channel layout. + * + * Change of AVChannelOrder can be either lossless or lossy. In case of a + * lossless conversion all the channel designations and the associated channel + * names (if any) are kept. On a lossy conversion the channel names and channel + * designations might be lost depending on the capabilities of the desired + * AVChannelOrder. Note that some conversions are simply not possible in which + * case this function returns AVERROR(ENOSYS). + * + * The following conversions are supported: + * + * Any -> Custom : Always possible, always lossless. + * Any -> Unspecified: Always possible, lossless if channel designations + * are all unknown and channel names are not used, lossy otherwise. + * Custom -> Ambisonic : Possible if it contains ambisonic channels with + * optional non-diegetic channels in the end. Lossy if the channels have + * custom names, lossless otherwise. + * Custom -> Native : Possible if it contains native channels in native + * order. Lossy if the channels have custom names, lossless otherwise. + * + * On error this function keeps the original channel layout untouched. + * + * @param channel_layout channel layout which will be changed + * @param order the desired channel layout order + * @param flags a combination of AV_CHANNEL_LAYOUT_RETYPE_FLAG_* constants + * @return 0 if the conversion was successful and lossless or if the channel + * layout was already in the desired order + * >0 if the conversion was successful but lossy + * AVERROR(ENOSYS) if the conversion was not possible (or would be + * lossy and AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS was specified) + * AVERROR(EINVAL), AVERROR(ENOMEM) on error + */ +int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags); + /** * @} */ diff --git a/src/ExtLib/ffmpeg/libavutil/rational.h b/src/ExtLib/ffmpeg/libavutil/rational.h index 8cbfc8e066..849f47f38d 100644 --- a/src/ExtLib/ffmpeg/libavutil/rational.h +++ b/src/ExtLib/ffmpeg/libavutil/rational.h @@ -168,6 +168,10 @@ static av_always_inline AVRational av_inv_q(AVRational q) * In case of infinity, the returned value is expressed as `{1, 0}` or * `{-1, 0}` depending on the sign. * + * In general rational numbers with |num| <= 1<<26 && |den| <= 1<<26 + * can be recovered exactly from their double representation. + * (no exceptions were found within 1B random ones) + * * @param d `double` to convert * @param max Maximum allowed numerator and denominator * @return `d` in AVRational form diff --git a/src/ExtLib/ffmpeg/libavutil/version.h b/src/ExtLib/ffmpeg/libavutil/version.h index 772c4e209c..cebf4a0acd 100644 --- a/src/ExtLib/ffmpeg/libavutil/version.h +++ b/src/ExtLib/ffmpeg/libavutil/version.h @@ -79,8 +79,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 58 -#define LIBAVUTIL_VERSION_MINOR 36 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MINOR 38 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/src/ExtLib/ffmpeg/libavutil/x86/intreadwrite.h b/src/ExtLib/ffmpeg/libavutil/x86/intreadwrite.h index 40f375b013..5e57d6a8cd 100644 --- a/src/ExtLib/ffmpeg/libavutil/x86/intreadwrite.h +++ b/src/ExtLib/ffmpeg/libavutil/x86/intreadwrite.h @@ -27,42 +27,6 @@ #if HAVE_MMX -#if !HAVE_FAST_64BIT && defined(__MMX__) - -#define FF_COPY_SWAP_ZERO_USES_MMX - -#define AV_COPY64 AV_COPY64 -static av_always_inline void AV_COPY64(void *d, const void *s) -{ - __asm__("movq %1, %%mm0 \n\t" - "movq %%mm0, %0 \n\t" - : "=m"(*(uint64_t*)d) - : "m" (*(const uint64_t*)s) - : "mm0"); -} - -#define AV_SWAP64 AV_SWAP64 -static av_always_inline void AV_SWAP64(void *a, void *b) -{ - __asm__("movq %1, %%mm0 \n\t" - "movq %0, %%mm1 \n\t" - "movq %%mm0, %0 \n\t" - "movq %%mm1, %1 \n\t" - : "+m"(*(uint64_t*)a), "+m"(*(uint64_t*)b) - ::"mm0", "mm1"); -} - -#define AV_ZERO64 AV_ZERO64 -static av_always_inline void AV_ZERO64(void *d) -{ - __asm__("pxor %%mm0, %%mm0 \n\t" - "movq %%mm0, %0 \n\t" - : "=m"(*(uint64_t*)d) - :: "mm0"); -} - -#endif /* !HAVE_FAST_64BIT && defined(__MMX__) */ - #ifdef __SSE__ #define AV_COPY128 AV_COPY128 diff --git a/src/ExtLib/ffmpeg/libavutil/x86/tx_float_init.c b/src/ExtLib/ffmpeg/libavutil/x86/tx_float_init.c index d3c0beb50f..84ec1122f6 100644 --- a/src/ExtLib/ffmpeg/libavutil/x86/tx_float_init.c +++ b/src/ExtLib/ffmpeg/libavutil/x86/tx_float_init.c @@ -270,15 +270,15 @@ const FFTXCodelet * const ff_tx_codelet_list_float_x86[] = { AV_TX_INPLACE | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL, AV_CPU_FLAG_AVXSLOW), TX_DEF(fft32_ns, FFT, 32, 32, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr, FFT, 64, 131072, 2, 0, 256, b8_i2, avx, AVX, 0, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr_asm, FFT, 64, 131072, 2, 0, 320, b8_i2, avx, AVX, + TX_DEF(fft_sr, FFT, 64, 2097152, 2, 0, 256, b8_i2, avx, AVX, 0, AV_CPU_FLAG_AVXSLOW), + TX_DEF(fft_sr_asm, FFT, 64, 2097152, 2, 0, 320, b8_i2, avx, AVX, AV_TX_INPLACE | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr_ns, FFT, 64, 131072, 2, 0, 320, b8_i2, avx, AVX, AV_TX_INPLACE | FF_TX_PRESHUFFLE, + TX_DEF(fft_sr_ns, FFT, 64, 2097152, 2, 0, 320, b8_i2, avx, AVX, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr, FFT, 64, 131072, 2, 0, 288, b8_i2, fma3, FMA3, 0, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr_asm, FFT, 64, 131072, 2, 0, 352, b8_i2, fma3, FMA3, + TX_DEF(fft_sr, FFT, 64, 2097152, 2, 0, 288, b8_i2, fma3, FMA3, 0, AV_CPU_FLAG_AVXSLOW), + TX_DEF(fft_sr_asm, FFT, 64, 2097152, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr_ns, FFT, 64, 131072, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE, + TX_DEF(fft_sr_ns, FFT, 64, 2097152, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW), #if HAVE_AVX2_EXTERNAL @@ -287,11 +287,11 @@ const FFTXCodelet * const ff_tx_codelet_list_float_x86[] = { TX_DEF(fft15_ns, FFT, 15, 15, 15, 0, 384, factor_init, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr, FFT, 64, 131072, 2, 0, 320, b8_i2, avx2, AVX2, 0, + TX_DEF(fft_sr, FFT, 64, 2097152, 2, 0, 320, b8_i2, avx2, AVX2, 0, AV_CPU_FLAG_AVXSLOW | AV_CPU_FLAG_SLOW_GATHER), - TX_DEF(fft_sr_asm, FFT, 64, 131072, 2, 0, 384, b8_i2, avx2, AVX2, + TX_DEF(fft_sr_asm, FFT, 64, 2097152, 2, 0, 384, b8_i2, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL, AV_CPU_FLAG_AVXSLOW | AV_CPU_FLAG_SLOW_GATHER), - TX_DEF(fft_sr_ns, FFT, 64, 131072, 2, 0, 384, b8_i2, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE, + TX_DEF(fft_sr_ns, FFT, 64, 2097152, 2, 0, 384, b8_i2, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW | AV_CPU_FLAG_SLOW_GATHER), TX_DEF(fft_pfa_15xM, FFT, 60, TX_LEN_UNLIMITED, 15, 2, 320, fft_pfa_init, avx2, AVX2,