Skip to content

Commit

Permalink
Обновление ffmpeg git-n7.1-dev-716-g0d9591841b.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed May 11, 2024
1 parent c2307e4 commit 27aaf87
Show file tree
Hide file tree
Showing 49 changed files with 378 additions and 258 deletions.
3 changes: 2 additions & 1 deletion docs/Changelog.Rus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ MPCVideoDec
Декодирование VVC сделано с помощью vvdec (https://github.com/fraunhoferhhi/vvdec).

Обновлены библиотеки:
vvdec git-v2.3.0;
ffmpeg git-n7.1-dev-716-g0d9591841b;
vvdec git-v2.3.0.


1.7.1 - 2024-05-07
Expand Down
3 changes: 2 additions & 1 deletion docs/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ MPCVideoDec
VVC decoding is done using vvdec (https://github.com/fraunhoferhhi/vvdec).

Updated libraries:
vvdec git-v2.3.0;
ffmpeg git-n7.1-dev-716-g0d9591841b;
vvdec git-v2.3.0.


1.7.1 - 2024-05-07
Expand Down
93 changes: 23 additions & 70 deletions src/ExtLib/ffmpeg/libavcodec/aac/aacdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "aacdec_tab.h"

#include "libavcodec/aac.h"
#include "libavcodec/aac_defines.h"
#include "libavcodec/aacsbr.h"
#include "libavcodec/aactab.h"
#include "libavcodec/adts_header.h"
Expand All @@ -60,7 +61,6 @@
#include "libavutil/opt.h"
#include "libavutil/tx.h"
#include "libavutil/version.h"
#include "libavutil/thread.h"

/*
* supported tools
Expand Down Expand Up @@ -149,11 +149,7 @@ static av_cold int che_configure(AACDecContext *ac,
return AVERROR_INVALIDDATA;
if (che_pos) {
if (!ac->che[type][id]) {
int ret;
if (ac->is_fixed)
ret = ff_aac_sbr_ctx_alloc_init_fixed(ac, &ac->che[type][id], type);
else
ret = ff_aac_sbr_ctx_alloc_init(ac, &ac->che[type][id], type);
int ret = ac->proc.sbr_ctx_alloc_init(ac, &ac->che[type][id], type);
if (ret < 0)
return ret;
}
Expand All @@ -170,10 +166,7 @@ static av_cold int che_configure(AACDecContext *ac,
}
} else {
if (ac->che[type][id]) {
if (ac->is_fixed)
ff_aac_sbr_ctx_close_fixed(ac->che[type][id]);
else
ff_aac_sbr_ctx_close(ac->che[type][id]);
ac->proc.sbr_ctx_close(ac->che[type][id]);
}
av_freep(&ac->che[type][id]);
}
Expand Down Expand Up @@ -531,7 +524,7 @@ static int output_configure(AACDecContext *ac,
return 0;
}

static void flush(AVCodecContext *avctx)
static av_cold void flush(AVCodecContext *avctx)
{
AACDecContext *ac= avctx->priv_data;
int type, i, j;
Expand Down Expand Up @@ -1111,23 +1104,14 @@ static int sample_rate_idx (int rate)
else return 11;
}

static av_cold void aac_static_table_init(void)
{
ff_aacdec_common_init_once();
}
static AVOnce aac_table_init = AV_ONCE_INIT;

static av_cold int decode_close(AVCodecContext *avctx)
{
AACDecContext *ac = avctx->priv_data;
int is_fixed = ac->is_fixed;
void (*sbr_close)(ChannelElement *che) = is_fixed ? ff_aac_sbr_ctx_close_fixed :
ff_aac_sbr_ctx_close;

for (int type = 0; type < FF_ARRAY_ELEMS(ac->che); type++) {
for (int i = 0; i < MAX_ELEM_ID; i++) {
if (ac->che[type][i]) {
sbr_close(ac->che[type][i]);
ac->proc.sbr_ctx_close(ac->che[type][i]);
av_freep(&ac->che[type][i]);
}
}
Expand All @@ -1142,7 +1126,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
av_tx_uninit(&ac->mdct_ltp);

// Compiler will optimize this branch away.
if (is_fixed)
if (ac->is_fixed)
av_freep(&ac->RENAME_FIXED(fdsp));
else
av_freep(&ac->fdsp);
Expand All @@ -1158,13 +1142,6 @@ static av_cold int init_dsp(AVCodecContext *avctx)
const float *const scalep = is_fixed ? &scale_fixed : &scale_float;
enum AVTXType tx_type = is_fixed ? AV_TX_INT32_MDCT : AV_TX_FLOAT_MDCT;

if (avctx->ch_layout.nb_channels > MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Too many channels\n");
return AVERROR_INVALIDDATA;
}

ac->random_state = 0x1f2e3d4c;

#define MDCT_INIT(s, fn, len, sval) \
scale_fixed = (sval) * 128.0f; \
scale_float = (sval) / 32768.0f; \
Expand All @@ -1187,32 +1164,22 @@ static av_cold int init_dsp(AVCodecContext *avctx)
if (ret < 0)
return ret;

ac->dsp = is_fixed ? aac_dsp_fixed : aac_dsp;
ac->proc = is_fixed ? aac_proc_fixed : aac_proc;

return ac->dsp.init(ac);
return 0;
}

static av_cold int aac_decode_init_internal(AVCodecContext *avctx)
av_cold int ff_aac_decode_init(AVCodecContext *avctx)
{
AACDecContext *ac = avctx->priv_data;
int ret;

if (avctx->sample_rate > 96000)
return AVERROR_INVALIDDATA;

ret = ff_thread_once(&aac_table_init, &aac_static_table_init);
if (ret != 0)
return AVERROR_UNKNOWN;
ff_aacdec_common_init_once();

ac->avctx = avctx;
ac->oc[1].m4ac.sample_rate = avctx->sample_rate;

if (ac->is_fixed)
avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
else
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;

if (avctx->extradata_size > 0) {
if ((ret = decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
avctx->extradata,
Expand Down Expand Up @@ -1249,21 +1216,14 @@ static av_cold int aac_decode_init_internal(AVCodecContext *avctx)
}
}

return init_dsp(avctx);
}
if (avctx->ch_layout.nb_channels > MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Too many channels\n");
return AVERROR_INVALIDDATA;
}

static av_cold int aac_decode_init(AVCodecContext *avctx)
{
AACDecContext *ac = avctx->priv_data;
ac->is_fixed = 0;
return aac_decode_init_internal(avctx);
}
ac->random_state = 0x1f2e3d4c;

static av_cold int aac_decode_init_fixed(AVCodecContext *avctx)
{
AACDecContext *ac = avctx->priv_data;
ac->is_fixed = 1;
return aac_decode_init_internal(avctx);
return init_dsp(avctx);
}

/**
Expand Down Expand Up @@ -1976,11 +1936,7 @@ static int decode_extension_payload(AACDecContext *ac, GetBitContext *gb, int cn
ac->avctx->profile = AV_PROFILE_AAC_HE;
}

if (CONFIG_AAC_FIXED_DECODER && ac->is_fixed)
res = ff_aac_sbr_decode_extension_fixed(ac, che, gb, crc_flag, cnt, elem_type);
else if (CONFIG_AAC_DECODER)
res = ff_aac_sbr_decode_extension(ac, che, gb, crc_flag, cnt, elem_type);

ac->proc.sbr_decode_extension(ac, che, gb, crc_flag, cnt, elem_type);

if (ac->oc[1].m4ac.ps == 1 && !ac->warned_he_aac_mono) {
av_log(ac->avctx, AV_LOG_VERBOSE, "Treating HE-AAC mono as stereo.\n");
Expand Down Expand Up @@ -2089,14 +2045,9 @@ static void spectral_to_sample(AACDecContext *ac, int samples)
ac->dsp.update_ltp(ac, &che->ch[1]);
}
if (ac->oc[1].m4ac.sbr > 0) {
if (CONFIG_AAC_FIXED_DECODER && ac->is_fixed)
ff_aac_sbr_apply_fixed(ac, che, type,
(void *)che->ch[0].output,
(void *)che->ch[1].output);
else if (CONFIG_AAC_DECODER)
ff_aac_sbr_apply(ac, che, type,
(void *)che->ch[0].output,
(void *)che->ch[1].output);
ac->proc.sbr_apply(ac, che, type,
che->ch[0].output,
che->ch[1].output);
}
}
if (type <= TYPE_CCE)
Expand Down Expand Up @@ -2517,7 +2468,9 @@ static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return buf_size > buf_offset ? buf_consumed : buf_size;
}

#if CONFIG_AAC_LATM_DECODER
#include "aacdec_latm.h"
#endif

#define AACDEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
#define OFF(field) offsetof(AACDecContext, field)
Expand Down Expand Up @@ -2560,7 +2513,7 @@ const FFCodec ff_aac_decoder = {
.p.id = AV_CODEC_ID_AAC,
.p.priv_class = &decoder_class,
.priv_data_size = sizeof(AACDecContext),
.init = aac_decode_init,
.init = ff_aac_decode_init_float,
.close = decode_close,
FF_CODEC_DECODE_CB(aac_decode_frame),
.p.sample_fmts = (const enum AVSampleFormat[]) {
Expand All @@ -2582,7 +2535,7 @@ const FFCodec ff_aac_fixed_decoder = {
.p.id = AV_CODEC_ID_AAC,
.p.priv_class = &decoder_class,
.priv_data_size = sizeof(AACDecContext),
.init = aac_decode_init_fixed,
.init = ff_aac_decode_init_fixed,
.close = decode_close,
FF_CODEC_DECODE_CB(aac_decode_frame),
.p.sample_fmts = (const enum AVSampleFormat[]) {
Expand Down
18 changes: 10 additions & 8 deletions src/ExtLib/ffmpeg/libavcodec/aac/aacdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,19 @@ typedef struct AACDecProc {
SingleChannelElement *sce);

int (*decode_cce)(AACDecContext *ac, GetBitContext *gb, ChannelElement *che);

int (*sbr_ctx_alloc_init)(AACDecContext *ac, ChannelElement **che, int id_aac);
int (*sbr_decode_extension)(AACDecContext *ac, ChannelElement *che,
GetBitContext *gb, int crc, int cnt, int id_aac);
void (*sbr_apply)(AACDecContext *ac, ChannelElement *che,
int id_aac, void /* INTFLOAT */ *L, void /* INTFLOAT */ *R);
void (*sbr_ctx_close)(ChannelElement *che);
} AACDecProc;

/**
* DSP-specific primitives
*/
typedef struct AACDecDSP {
int (*init)(AACDecContext *ac);

void (*dequant_scalefactors)(SingleChannelElement *sce);

void (*apply_mid_side_stereo)(AACDecContext *ac, ChannelElement *cpe);
Expand Down Expand Up @@ -339,12 +344,9 @@ struct AACDecContext {
#define fdsp RENAME_FIXED(fdsp)
#endif

extern const AACDecDSP aac_dsp;
extern const AACDecDSP aac_dsp_fixed;

extern const AACDecProc aac_proc;
extern const AACDecProc aac_proc_fixed;

int ff_aac_decode_init(struct AVCodecContext *avctx);
int ff_aac_decode_init_float(struct AVCodecContext *avctx);
int ff_aac_decode_init_fixed(struct AVCodecContext *avctx);
int ff_aac_decode_ics(AACDecContext *ac, SingleChannelElement *sce,
GetBitContext *gb, int common_window, int scale_flag);

Expand Down
45 changes: 23 additions & 22 deletions src/ExtLib/ffmpeg/libavcodec/aac/aacdec_dsp_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,25 +615,26 @@ static void AAC_RENAME(apply_prediction)(AACDecContext *ac, SingleChannelElement
reset_all_predictors(sce->AAC_RENAME(predictor_state));
}

const AACDecDSP AAC_RENAME(aac_dsp) = {
.init = &AAC_RENAME(init),

.dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),
.apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo),
.apply_intensity_stereo = &AAC_RENAME(apply_intensity_stereo),
.apply_tns = &AAC_RENAME(apply_tns),
.apply_ltp = &AAC_RENAME(apply_ltp),
.update_ltp = &AAC_RENAME(update_ltp),

.apply_prediction = AAC_RENAME(apply_prediction),

.imdct_and_windowing = AAC_RENAME(imdct_and_windowing),
.imdct_and_windowing_960 = AAC_RENAME(imdct_and_windowing_960),
.imdct_and_windowing_ld = AAC_RENAME(imdct_and_windowing_ld),
.imdct_and_windowing_eld = AAC_RENAME(imdct_and_windowing_eld),

.apply_dependent_coupling = AAC_RENAME(apply_dependent_coupling),
.apply_independent_coupling = AAC_RENAME(apply_independent_coupling),

.clip_output = AAC_RENAME(clip_output),
};
static av_cold void AAC_RENAME(aac_dsp_init)(AACDecDSP *aac_dsp)
{
#define SET(member) aac_dsp->member = AAC_RENAME(member)
SET(dequant_scalefactors);
SET(apply_mid_side_stereo);
SET(apply_intensity_stereo);
SET(apply_tns);
SET(apply_ltp);
SET(update_ltp);

SET(apply_prediction);

SET(imdct_and_windowing);
SET(imdct_and_windowing_960);
SET(imdct_and_windowing_ld);
SET(imdct_and_windowing_eld);

SET(apply_dependent_coupling);
SET(apply_independent_coupling);

SET(clip_output);
#undef SET
}
Loading

0 comments on commit 27aaf87

Please sign in to comment.