Skip to content

Commit

Permalink
Обновлен ffmpeg n7.2-dev-1031-g5f38c82536.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Dec 28, 2024
1 parent f1a9320 commit 0f1d645
Show file tree
Hide file tree
Showing 47 changed files with 4,632 additions and 2,270 deletions.
2 changes: 1 addition & 1 deletion docs/Changelog.Rus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ MPC Video Renderer будет устанавливаться по умолчан
Обновлены библиотеки:
libflac 1.4.3;
libogg 1.3.5;
ffmpeg n7.2-dev-940-g6b31e42c47.
ffmpeg n7.2-dev-1031-g5f38c82536.


1.8.2 - 2024-12-07
Expand Down
2 changes: 1 addition & 1 deletion docs/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Updated Dutch and Chinese (Traditional) translation (by beter).
Updated libraries:
libflac 1.4.3;
libogg 1.3.5;
ffmpeg n7.2-dev-940-g6b31e42c47.
ffmpeg n7.2-dev-1031-g5f38c82536.


1.8.2 - 2024-12-07
Expand Down
33 changes: 15 additions & 18 deletions docs/custom_code/ffmpeg.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
The following files have MPC-BE specific custom code (compared to ffmpeg):

* config.h
* config.asm
* ffmpeg.mak

* compat/atomics/win32/stdatomic.h
* compat/w32dlfcn.h

* libavcodec/x86/hevcdsp.h
* libavcodec/x86/hevcdsp_init.c

* libavcodec/vvc/vvcdec.c
* compat/w32pthreads.h

* libavcodec/aacsbr_template.c
* libavcodec/allcodecs.c
* libavcodec/bsf_list.c
* libavcodec/codec_list.c
* libavcodec/d3d12va_hevc.c
* libavcodec/dxva2.c
* libavcodec/dxva2_hevc.c
Expand All @@ -25,18 +16,20 @@
* libavcodec/h264_slice.c
* libavcodec/h264dec.c
* libavcodec/h264dec.h
* libavcodec/hevc_ps.c
* libavcodec/hevcdec.c
* libavcodec/hevcpred.c
* libavcodec/hevcpred.h
* libavcodec/hevc/hevcdec.c
* libavcodec/hevc/pred.c
* libavcodec/hevc/pred.h
* libavcodec/hevc/ps.c
* libavcodec/hwconfig.h
* libavcodec/mpeg4audio.h
* libavcodec/mpeg12dec.c
* libavcodec/mpegaudio_parser.c
* libavcodec/parser_list.c
* libavcodec/vc1.h
* libavcodec/vc1dec.c
* libavcodec/vp9.c
* libavcodec/vvc/dec.c
* libavcodec/x86/hevc/dsp_init.c
* libavcodec/x86/hevcdsp.h

* libavutil/hwcontext_d3d11va.c
* libavutil/hwcontext_d3d11va.h
Expand All @@ -47,13 +40,17 @@
======
The following files are available only in MPC-BE (compared with ffmpeg):

* config.asm
* config.c
* config.h
* ffmpeg.mak

* compat/windows/d3d12.h
* compat/windows/d3d12video.h
* compat/windows/dxva_av1.h
* compat/windows/initguid.h

* libavcodec/libvvdec.c
* libavcodec/x86/hevc_idct_intrinsic.c
* libavcodec/x86/hevc_intra_intrinsic.c
* libavcodec/x86/hevcpred.h

* libavcodec/libvvdec.c
1 change: 1 addition & 0 deletions src/ExtLib/ffmpeg/config_components.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@
#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 1
#define CONFIG_ADPCM_IMA_WAV_DECODER 1
#define CONFIG_ADPCM_IMA_WS_DECODER 1
#define CONFIG_ADPCM_IMA_XBOX_DECODER 0
#define CONFIG_ADPCM_MS_DECODER 1
#define CONFIG_ADPCM_MTAF_DECODER 0
#define CONFIG_ADPCM_PSX_DECODER 0
Expand Down
32 changes: 19 additions & 13 deletions src/ExtLib/ffmpeg/ffmpeg.mak
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ OBJ_DIRS = $(OBJ_DIR) \
$(OBJ_DIR)libavcodec/vvc \
$(OBJ_DIR)libavcodec/x86 \
$(OBJ_DIR)libavcodec/x86/h26x \
$(OBJ_DIR)libavcodec/x86/hevc \
$(OBJ_DIR)libavcodec/x86/vvc \
$(OBJ_DIR)libavfilter \
$(OBJ_DIR)libavfilter/x86 \
Expand Down Expand Up @@ -632,7 +633,6 @@ SRCS_LC_B = \
libavcodec/x86/h264dsp_init.c \
libavcodec/x86/hevc_idct_intrinsic.c \
libavcodec/x86/hevc_intra_intrinsic.c \
libavcodec/x86/hevcdsp_init.c \
libavcodec/x86/h264_qpel.c \
libavcodec/x86/hpeldsp_init.c \
libavcodec/x86/huffyuvdsp_init.c \
Expand Down Expand Up @@ -675,7 +675,9 @@ SRCS_LC_B = \
\
libavcodec/x86/h26x/h2656dsp.c \
\
libavcodec/x86/vvc/vvcdsp_init.c
libavcodec/x86/hevc/dsp_init.c \
\
libavcodec/x86/vvc/dsp_init.c

SRCS_LC_BSF = \
libavcodec/bsf/aac_adtstoasc.c \
Expand Down Expand Up @@ -813,12 +815,15 @@ SRCS_LR = \

SRCS_LS = \
libswscale/alphablend.c \
libswscale/cms.c \
libswscale/csputils.c \
libswscale/gamma.c \
libswscale/graph.c \
libswscale/half2float.c \
libswscale/hscale.c \
libswscale/hscale_fast_bilinear.c \
libswscale/input.c \
libswscale/lut3d.c \
libswscale/options.c \
libswscale/output.c \
libswscale/rgb2rgb.c \
Expand Down Expand Up @@ -865,12 +870,6 @@ SRCS_ASM_LC = \
libavcodec/x86/h264_qpel_8bit.asm \
libavcodec/x86/h264_weight.asm \
libavcodec/x86/h264_weight_10bit.asm \
libavcodec/x86/hevc_add_res.asm \
libavcodec/x86/hevc_deblock.asm \
libavcodec/x86/hevc_idct.asm \
libavcodec/x86/hevc_mc.asm \
libavcodec/x86/hevc_sao.asm \
libavcodec/x86/hevc_sao_10bit.asm \
libavcodec/x86/hpeldsp.asm \
libavcodec/x86/huffyuvdsp.asm \
libavcodec/x86/idctdsp.asm \
Expand Down Expand Up @@ -917,11 +916,18 @@ SRCS_ASM_LC = \
\
libavcodec/x86/h26x/h2656_inter.asm \
\
libavcodec/x86/vvc/vvc_alf.asm \
libavcodec/x86/vvc/vvc_dmvr.asm \
libavcodec/x86/vvc/vvc_mc.asm \
libavcodec/x86/vvc/vvc_of.asm \
libavcodec/x86/vvc/vvc_sad.asm
libavcodec/x86/hevc/add_res.asm \
libavcodec/x86/hevc/deblock.asm \
libavcodec/x86/hevc/idct.asm \
libavcodec/x86/hevc/mc.asm \
libavcodec/x86/hevc/sao.asm \
libavcodec/x86/hevc/sao_10bit.asm \
\
libavcodec/x86/vvc/alf.asm \
libavcodec/x86/vvc/dmvr.asm \
libavcodec/x86/vvc/mc.asm \
libavcodec/x86/vvc/of.asm \
libavcodec/x86/vvc/sad.asm

SRCS_ASM_LF =

Expand Down
41 changes: 41 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/adpcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
avctx->block_align != 17 * avctx->ch_layout.nb_channels)
return AVERROR_INVALIDDATA;
break;
case AV_CODEC_ID_ADPCM_IMA_XBOX:
if (avctx->bits_per_coded_sample != 4)
return AVERROR_INVALIDDATA;
break;
case AV_CODEC_ID_ADPCM_ZORK:
if (avctx->bits_per_coded_sample != 8)
return AVERROR_INVALIDDATA;
Expand All @@ -321,6 +325,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
case AV_CODEC_ID_ADPCM_IMA_DAT4:
case AV_CODEC_ID_ADPCM_IMA_QT:
case AV_CODEC_ID_ADPCM_IMA_WAV:
case AV_CODEC_ID_ADPCM_IMA_XBOX:
case AV_CODEC_ID_ADPCM_4XM:
case AV_CODEC_ID_ADPCM_XA:
case AV_CODEC_ID_ADPCM_XMD:
Expand Down Expand Up @@ -979,6 +984,15 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
return AVERROR_INVALIDDATA;
nb_samples = 1 + (buf_size - 4 * ch) / (bsize * ch) * bsamples;
) /* End of CASE */
CASE(ADPCM_IMA_XBOX,
int bsize = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2];
int bsamples = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
if (avctx->block_align > 0)
buf_size = FFMIN(buf_size, avctx->block_align);
if (buf_size < 4 * ch)
return AVERROR_INVALIDDATA;
nb_samples = (buf_size - 4 * ch) / (bsize * ch) * bsamples + 1;
) /* End of CASE */
case AV_CODEC_ID_ADPCM_MS:
if (avctx->block_align > 0)
buf_size = FFMIN(buf_size, avctx->block_align);
Expand Down Expand Up @@ -1197,6 +1211,32 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
}
) /* End of CASE */
CASE(ADPCM_IMA_XBOX,
for (int i = 0; i < channels; i++) {
ADPCMChannelStatus *cs = &c->status[i];
cs->predictor = samples_p[i][0] = sign_extend(bytestream2_get_le16u(&gb), 16);

cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16);
if (cs->step_index > 88u) {
av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
i, cs->step_index);
return AVERROR_INVALIDDATA;
}
}

for (int n = 0; n < (nb_samples-1) / 8; n++) {
for (int i = 0; i < channels; i++) {
ADPCMChannelStatus *cs = &c->status[i];
samples = &samples_p[i][1 + n * 8];
for (int m = 0; m < 8; m += 2) {
int v = bytestream2_get_byteu(&gb);
samples[m ] = adpcm_ima_expand_nibble(cs, v & 0x0F, 3);
samples[m + 1] = adpcm_ima_expand_nibble(cs, v >> 4 , 3);
}
}
}
frame->nb_samples--;
) /* End of CASE */
CASE(ADPCM_4XM,
for (int i = 0; i < channels; i++)
c->status[i].predictor = sign_extend(bytestream2_get_le16u(&gb), 16);
Expand Down Expand Up @@ -2404,6 +2444,7 @@ ADPCM_DECODER(ADPCM_IMA_SMJPEG, sample_fmts_s16, adpcm_ima_smjpeg, "ADPCM IMA
ADPCM_DECODER(ADPCM_IMA_ALP, sample_fmts_s16, adpcm_ima_alp, "ADPCM IMA High Voltage Software ALP")
ADPCM_DECODER(ADPCM_IMA_WAV, sample_fmts_s16p, adpcm_ima_wav, "ADPCM IMA WAV")
ADPCM_DECODER(ADPCM_IMA_WS, sample_fmts_both, adpcm_ima_ws, "ADPCM IMA Westwood")
ADPCM_DECODER(ADPCM_IMA_XBOX, sample_fmts_s16p, adpcm_ima_xbox, "ADPCM IMA Xbox")
ADPCM_DECODER(ADPCM_MS, sample_fmts_both, adpcm_ms, "ADPCM Microsoft")
ADPCM_DECODER(ADPCM_MTAF, sample_fmts_s16p, adpcm_mtaf, "ADPCM MTAF")
ADPCM_DECODER(ADPCM_PSX, sample_fmts_s16p, adpcm_psx, "ADPCM Playstation")
Expand Down
1 change: 1 addition & 0 deletions src/ExtLib/ffmpeg/libavcodec/allcodecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ extern const FFCodec ff_adpcm_ima_wav_encoder;
extern const FFCodec ff_adpcm_ima_wav_decoder;
extern const FFCodec ff_adpcm_ima_ws_encoder;
extern const FFCodec ff_adpcm_ima_ws_decoder;
extern const FFCodec ff_adpcm_ima_xbox_decoder;
extern const FFCodec ff_adpcm_ms_encoder;
extern const FFCodec ff_adpcm_ms_decoder;
extern const FFCodec ff_adpcm_mtaf_decoder;
Expand Down
10 changes: 5 additions & 5 deletions src/ExtLib/ffmpeg/libavcodec/cbs_av1.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,16 +728,16 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
}

while (size > 0) {
AV1RawOBUHeader header;
AV1RawOBUHeader obu_header;
uint64_t obu_size;

init_get_bits(&gbc, data, 8 * size);

err = cbs_av1_read_obu_header(ctx, &gbc, &header);
err = cbs_av1_read_obu_header(ctx, &gbc, &obu_header);
if (err < 0)
goto fail;

if (header.obu_has_size_field) {
if (obu_header.obu_has_size_field) {
if (get_bits_left(&gbc) < 8) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment "
"too short (%"SIZE_SPECIFIER" bytes).\n", size);
Expand All @@ -748,7 +748,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
if (err < 0)
goto fail;
} else
obu_size = size - 1 - header.obu_extension_flag;
obu_size = size - 1 - obu_header.obu_extension_flag;

pos = get_bits_count(&gbc);
av_assert0(pos % 8 == 0 && pos / 8 <= size);
Expand All @@ -763,7 +763,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
goto fail;
}

err = ff_cbs_append_unit_data(frag, header.obu_type,
err = ff_cbs_append_unit_data(frag, obu_header.obu_type,
data, obu_length, frag->data_ref);
if (err < 0)
goto fail;
Expand Down
7 changes: 7 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/codec_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2597,6 +2597,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("ADPCM Konami XMD"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_ADPCM_IMA_XBOX,
.type = AVMEDIA_TYPE_AUDIO,
.name = "adpcm_ima_xbox",
.long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Xbox"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
},

/* AMR */
{
Expand Down
1 change: 1 addition & 0 deletions src/ExtLib/ffmpeg/libavcodec/codec_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ enum AVCodecID {
AV_CODEC_ID_ADPCM_IMA_MOFLEX,
AV_CODEC_ID_ADPCM_IMA_ACORN,
AV_CODEC_ID_ADPCM_XMD,
AV_CODEC_ID_ADPCM_IMA_XBOX,

/* AMR */
AV_CODEC_ID_AMR_NB = 0x12000,
Expand Down
8 changes: 7 additions & 1 deletion src/ExtLib/ffmpeg/libavcodec/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ int av_get_bits_per_sample(enum AVCodecID codec_id)
return 3;
case AV_CODEC_ID_ADPCM_SBPRO_4:
case AV_CODEC_ID_ADPCM_IMA_WAV:
case AV_CODEC_ID_ADPCM_IMA_XBOX:
case AV_CODEC_ID_ADPCM_IMA_QT:
case AV_CODEC_ID_ADPCM_SWF:
case AV_CODEC_ID_ADPCM_MS:
Expand Down Expand Up @@ -720,10 +721,15 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
int blocks = frame_bytes / ba;
int64_t tmp = 0;
switch (id) {
case AV_CODEC_ID_ADPCM_IMA_XBOX:
if (bps != 4)
return 0;
tmp = blocks * ((ba - 4 * ch) / (bps * ch) * 8);
break;
case AV_CODEC_ID_ADPCM_IMA_WAV:
if (bps < 2 || bps > 5)
return 0;
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8LL);
break;
case AV_CODEC_ID_ADPCM_IMA_DK3:
tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
Expand Down
4 changes: 2 additions & 2 deletions src/ExtLib/ffmpeg/libavcodec/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#include "version_major.h"

#define LIBAVCODEC_VERSION_MINOR 27
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_MINOR 28
#define LIBAVCODEC_VERSION_MICRO 100

#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
Expand Down
Loading

0 comments on commit 0f1d645

Please sign in to comment.