[FFmpeg] Update libfdk-aac fixed point patch
Update this patch to the latest FFmpeg master source, and update to use fmtconvert instead of a naive for loop. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
d2eb4af3d5
commit
1ac3e5cd22
|
@ -1,8 +1,37 @@
|
||||||
|
diff --git a/configure b/configure
|
||||||
|
index 0de9b2abcb..7e9eb8f3b2 100755
|
||||||
|
--- a/configure
|
||||||
|
+++ b/configure
|
||||||
|
@@ -3328,7 +3328,7 @@ libdav1d_decoder_deps="libdav1d"
|
||||||
|
libdav1d_decoder_select="atsc_a53"
|
||||||
|
libdavs2_decoder_deps="libdavs2"
|
||||||
|
libdavs2_decoder_select="avs2_parser"
|
||||||
|
-libfdk_aac_decoder_deps="libfdk_aac"
|
||||||
|
+libfdk_aac_decoder_deps="libfdk_aac fmtconvert"
|
||||||
|
libfdk_aac_encoder_deps="libfdk_aac"
|
||||||
|
libfdk_aac_encoder_select="audio_frame_queue"
|
||||||
|
libgme_demuxer_deps="libgme"
|
||||||
diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
|
diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
|
||||||
index 1a86dffe4b..565621b973 100644
|
index 11eee51a98..9e199eb56f 100644
|
||||||
--- a/libavcodec/libfdk-aacdec.c
|
--- a/libavcodec/libfdk-aacdec.c
|
||||||
+++ b/libavcodec/libfdk-aacdec.c
|
+++ b/libavcodec/libfdk-aacdec.c
|
||||||
@@ -335,7 +335,7 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
|
@@ -25,6 +25,7 @@
|
||||||
|
#include "avcodec.h"
|
||||||
|
#include "codec_internal.h"
|
||||||
|
#include "internal.h"
|
||||||
|
+#include "fmtconvert.h"
|
||||||
|
|
||||||
|
#ifdef AACDECODER_LIB_VL0
|
||||||
|
#define FDKDEC_VER_AT_LEAST(vl0, vl1) \
|
||||||
|
@@ -65,6 +66,7 @@ typedef struct FDKAACDecContext {
|
||||||
|
int delay_samples;
|
||||||
|
#endif
|
||||||
|
AVChannelLayout downmix_layout;
|
||||||
|
+ FmtConvertContext fmt_conv;
|
||||||
|
} FDKAACDecContext;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -367,13 +369,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -11,23 +40,26 @@ index 1a86dffe4b..565621b973 100644
|
||||||
|
|
||||||
s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS;
|
s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS;
|
||||||
s->decoder_buffer = av_malloc(s->decoder_buffer_size);
|
s->decoder_buffer = av_malloc(s->decoder_buffer_size);
|
||||||
@@ -384,9 +384,19 @@ static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data,
|
if (!s->decoder_buffer)
|
||||||
(AVRational){1, avctx->sample_rate},
|
return AVERROR(ENOMEM);
|
||||||
avctx->time_base);
|
|
||||||
|
|
||||||
+#if 0
|
+ ff_fmt_convert_init(&s->fmt_conv, avctx);
|
||||||
memcpy(frame->extended_data[0], s->decoder_buffer,
|
+
|
||||||
avctx->channels * avctx->frame_size *
|
return 0;
|
||||||
av_get_bytes_per_sample(avctx->sample_fmt));
|
}
|
||||||
+#else
|
|
||||||
+ {
|
@@ -452,9 +456,11 @@ static int fdk_aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
+ INT_PCM *in = (INT_PCM *) s->decoder_buffer;
|
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||||
+ float *out = (float *) frame->extended_data[0];
|
goto end;
|
||||||
+ const float scale = 1.0f / (float)0x800000;
|
|
||||||
+ for (int i = 0, j = avctx->channels * avctx->frame_size; i < j; i++)
|
- memcpy(frame->extended_data[0], s->decoder_buffer + input_offset,
|
||||||
+ *out++ = (float)(*in++) * scale;
|
- avctx->ch_layout.nb_channels * frame->nb_samples *
|
||||||
+ }
|
- av_get_bytes_per_sample(avctx->sample_fmt));
|
||||||
+#endif
|
+ const int count = avctx->channels * avctx->frame_size;
|
||||||
|
+ const float scale = 1.0f / (float)0x800000;
|
||||||
|
+ s->fmt_conv.int32_to_float_fmul_scalar((float *) frame->extended_data[0],
|
||||||
|
+ (INT_PCM *) s->decoder_buffer,
|
||||||
|
+ scale, count);
|
||||||
|
|
||||||
*got_frame_ptr = 1;
|
*got_frame_ptr = 1;
|
||||||
ret = avpkt->size - valid;
|
ret = avpkt->size - valid;
|
||||||
|
|
Loading…
Reference in New Issue