Skip to content

Commit

Permalink
Обновление ffmpeg git-n6.2-dev-1097-geb5b4e60c9.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Feb 14, 2024
1 parent 50b02fc commit 3a393d9
Show file tree
Hide file tree
Showing 59 changed files with 480 additions and 325 deletions.
2 changes: 1 addition & 1 deletion docs/Changelog.Rus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion docs/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/ac3enc_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
13 changes: 10 additions & 3 deletions src/ExtLib/ffmpeg/libavcodec/avcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ FF_ENABLE_DEPRECATION_WARNINGS

return ret;
free_and_end:
avcodec_close(avctx);
ff_codec_close(avctx);
goto end;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)",
Expand Down
5 changes: 4 additions & 1 deletion src/ExtLib/ffmpeg/libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/avcodec_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 25 additions & 6 deletions src/ExtLib/ffmpeg/libavcodec/avfft.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -162,24 +162,43 @@ 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)
{
if (s) {
AVTXWrapper *w = (AVTXWrapper *)s;
av_tx_uninit(&w->ctx);
av_free(w->tmp);
av_free(w);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/blockdsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/ExtLib/ffmpeg/libavcodec/blockdsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 4 additions & 2 deletions src/ExtLib/ffmpeg/libavcodec/bsf/hevc_mp4toannexb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 4 additions & 3 deletions src/ExtLib/ffmpeg/libavcodec/bsf/vvc_mp4toannexb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
17 changes: 0 additions & 17 deletions src/ExtLib/ffmpeg/libavcodec/dca_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include "libavutil/channel_layout.h"
#include "libavutil/emms.h"
#include "dcaadpcm.h"
#include "dcadec.h"
#include "dcadata.h"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 0 additions & 2 deletions src/ExtLib/ffmpeg/libavcodec/flashsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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 */
2 changes: 0 additions & 2 deletions src/ExtLib/ffmpeg/libavcodec/flvdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
};
5 changes: 3 additions & 2 deletions src/ExtLib/ffmpeg/libavcodec/frame_thread_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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");
Expand Down
43 changes: 23 additions & 20 deletions src/ExtLib/ffmpeg/libavcodec/h263dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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)
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
};

Expand All @@ -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,
};
2 changes: 0 additions & 2 deletions src/ExtLib/ffmpeg/libavcodec/h263dec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 3a393d9

Please sign in to comment.