The branch, master has been updated
via 188440929d3fdc7ae40b119acbc151054afce53f (commit)
via ca7679c82f8aa5fe3c7d00455e79b576bc72e3fe (commit)
via 7cd0641a9912e5c3cdf718faf26404285dc1ff2a (commit)
via 0ec21ea8d09d991d3e7f767f0dfadc2e0af75655 (commit)
via f46bd4add2ed0129ad71d654c85f2cc84bc1a4d4 (commit)
via 60b88e75e42941d7142e4ed5e94a6886d5dd6e08 (commit)
via a98f75d22c37e20f55f0b4566e4b436cbc515a91 (commit)
via 839042b0c0fce43c96ca1d09bdb78e40b1a3b1d4 (commit)
via b8f341ff058d78df201c04f1725727024e31c16e (commit)
from 6d8732f397bfb07f2292e15a61904665abe13ce3 (commit)
- Log -----------------------------------------------------------------
commit 188440929d3fdc7ae40b119acbc151054afce53f
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 18:07:10 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:38:46 2025 +0200
avcodec/libmpeghdec: Check channel layouts generically
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index 527627ba16..ecc3a2dc09 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -68,75 +68,36 @@ static av_cold int mpegh3dadec_close(AVCodecContext *avctx)
//
https://github.com/Fraunhofer-IIS/mpeghdec/wiki/MPEG-H-decoder-target-layouts
static av_cold int channel_layout_to_cicp(const AVChannelLayout *layout)
{
- const AVChannelLayout layout_7point2point3 =
- (AVChannelLayout) AV_CHANNEL_LAYOUT_MASK(
- 12, (AV_CH_LAYOUT_5POINT1POINT2 | AV_CH_SIDE_SURROUND_LEFT |
- AV_CH_SIDE_SURROUND_RIGHT | AV_CH_TOP_BACK_CENTER |
- AV_CH_LOW_FREQUENCY_2));
- const AVChannelLayout layout_5point1point6 =
- (AVChannelLayout) AV_CHANNEL_LAYOUT_MASK(
- 12, (AV_CH_LAYOUT_5POINT1POINT4_BACK | AV_CH_TOP_FRONT_CENTER |
- AV_CH_TOP_CENTER));
- const AVChannelLayout layout_7point1point6 =
- (AVChannelLayout) AV_CHANNEL_LAYOUT_MASK(
- 14, (AV_CH_LAYOUT_7POINT1POINT4_BACK | AV_CH_TOP_FRONT_CENTER |
- AV_CH_TOP_CENTER));
-
- if (!av_channel_layout_compare(layout,
- &(AVChannelLayout) AV_CHANNEL_LAYOUT_MONO))
{
- return 1;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_STEREO)) {
- return 2;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_SURROUND)) {
- return 3;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_4POINT0)) {
- return 4;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_5POINT0)) {
- return 5;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_5POINT1)) {
- return 6;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_7POINT1_WIDE))
{
- return 7;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_2_1)) {
- return 9;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_2_2)) {
- return 10;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_6POINT1)) {
- return 11;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_7POINT1)) {
- return 12;
- } else if (!av_channel_layout_compare(
- layout, &(AVChannelLayout) AV_CHANNEL_LAYOUT_22POINT2)) {
- return 13;
- } else if (!av_channel_layout_compare(
- layout,
- &(AVChannelLayout) AV_CHANNEL_LAYOUT_5POINT1POINT2)) {
- return 14;
- } else if (!av_channel_layout_compare(layout, &layout_7point2point3)) {
- return 15;
- } else if (!av_channel_layout_compare(
- layout,
- &(AVChannelLayout) AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK)) {
- return 16;
- } else if (!av_channel_layout_compare(layout, &layout_5point1point6)) {
- return 17;
- } else if (!av_channel_layout_compare(layout, &layout_7point1point6)) {
- return 18;
- } else if (!av_channel_layout_compare(
- layout,
- &(AVChannelLayout) AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK)) {
- return 19;
+// different from AV_CH_LAYOUT_7POINT2POINT3
+#define CH_LAYOUT_7POINT2POINT3 AV_CH_LAYOUT_5POINT1POINT2 |
AV_CH_SIDE_SURROUND_LEFT | \
+ AV_CH_SIDE_SURROUND_RIGHT |
AV_CH_TOP_BACK_CENTER | \
+ AV_CH_LOW_FREQUENCY_2
+#define CH_LAYOUT_5POINT1POINT6 AV_CH_LAYOUT_5POINT1POINT4_BACK | \
+ AV_CH_TOP_FRONT_CENTER | AV_CH_TOP_CENTER
+#define CH_LAYOUT_7POINT1POINT6 AV_CH_LAYOUT_7POINT1POINT4_BACK | \
+ AV_CH_TOP_FRONT_CENTER | AV_CH_TOP_CENTER
+ static const uint64_t channel_layout_masks[] = {
+ 0,
+ AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_SURROUND, AV_CH_LAYOUT_4POINT0,
+ AV_CH_LAYOUT_5POINT0, AV_CH_LAYOUT_5POINT1,
+ AV_CH_LAYOUT_7POINT1_WIDE, 0,
+ AV_CH_LAYOUT_2_1, AV_CH_LAYOUT_2_2,
+ AV_CH_LAYOUT_6POINT1, AV_CH_LAYOUT_7POINT1,
+ AV_CH_LAYOUT_22POINT2, AV_CH_LAYOUT_5POINT1POINT2,
+ CH_LAYOUT_7POINT2POINT3, AV_CH_LAYOUT_5POINT1POINT4_BACK,
+ CH_LAYOUT_5POINT1POINT6, CH_LAYOUT_7POINT1POINT6,
+ AV_CH_LAYOUT_7POINT1POINT4_BACK,
+ };
+ for (size_t i = 0; i < FF_ARRAY_ELEMS(channel_layout_masks); ++i) {
+ if (channel_layout_masks[i]) {
+ AVChannelLayout ch_layout;
+ av_channel_layout_from_mask(&ch_layout, channel_layout_masks[i]);
+ if (!av_channel_layout_compare(layout, &ch_layout))
+ return i;
+ }
}
+
return 0;
}
commit ca7679c82f8aa5fe3c7d00455e79b576bc72e3fe
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 17:05:27 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:38:41 2025 +0200
avcodec/libmpeghdec: Don't set AVCodecContext.frame_size
It indicates a constant frame size (in samples); yet the documentation
of the MPEGH_DECODER_OUTPUT_INFO structure says that it
"gives information about the currently decoded audio data"
and makes no guarantees about it being constant.
Reviewed-by: Lynne <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index bd63db8ed6..527627ba16 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -225,7 +225,7 @@ static int mpegh3dadec_decode_frame(AVCodecContext *avctx,
AVFrame *frame,
return AVERROR_UNKNOWN;
}
- frame->nb_samples = avctx->frame_size = out_info.numSamplesPerChannel;
+ frame->nb_samples = out_info.numSamplesPerChannel;
frame->sample_rate = avctx->sample_rate = out_info.sampleRate;
frame->pts = out_info.ticks;
frame->time_base.num = 1;
@@ -235,7 +235,7 @@ static int mpegh3dadec_decode_frame(AVCodecContext *avctx,
AVFrame *frame,
return ret;
memcpy(frame->extended_data[0], s->decoder_buffer,
- avctx->ch_layout.nb_channels * avctx->frame_size *
+ avctx->ch_layout.nb_channels * frame->nb_samples *
sizeof(*s->decoder_buffer) /* only AV_SAMPLE_FMT_S32 is supported
*/);
*got_frame_ptr = 1;
commit 7cd0641a9912e5c3cdf718faf26404285dc1ff2a
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 15:00:25 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:38:37 2025 +0200
avcodec/libmpeghdec: Align FFCodec initializers
Reviewed-by: Lynne <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index 174fd5da34..bd63db8ed6 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -254,17 +254,17 @@ static av_cold void mpegh3dadec_flush(AVCodecContext
*avctx)
}
const FFCodec ff_libmpeghdec_decoder = {
- .p.name = "libmpeghdec",
+ .p.name = "libmpeghdec",
CODEC_LONG_NAME("libmpeghdec (MPEG-H 3D Audio)"),
- .p.type = AVMEDIA_TYPE_AUDIO,
- .p.id = AV_CODEC_ID_MPEGH_3D_AUDIO,
- .p.capabilities =
- AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_CHANNEL_CONF,
+ .p.type = AVMEDIA_TYPE_AUDIO,
+ .p.id = AV_CODEC_ID_MPEGH_3D_AUDIO,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+ AV_CODEC_CAP_CHANNEL_CONF,
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MPEGH3DADecContext),
- .init = mpegh3dadec_init,
+ .init = mpegh3dadec_init,
FF_CODEC_DECODE_CB(mpegh3dadec_decode_frame),
- .close = mpegh3dadec_close,
- .flush = mpegh3dadec_flush,
- .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
+ .flush = mpegh3dadec_flush,
+ .close = mpegh3dadec_close,
.p.wrapper_name = "libmpeghdec",
};
commit 0ec21ea8d09d991d3e7f767f0dfadc2e0af75655
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 12:22:33 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:38:32 2025 +0200
avcodec/libmpeghdec: Remove always-false check
The pointer to the decoder is always set after init has been
called successfully.
Reviewed-by: Lynne <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index ebb5e54d7b..174fd5da34 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -247,9 +247,6 @@ static av_cold void mpegh3dadec_flush(AVCodecContext *avctx)
MPEGH_DECODER_ERROR err;
MPEGH3DADecContext *s = avctx->priv_data;
- if (!s->decoder)
- return;
-
err = mpeghdecoder_flush(s->decoder);
if (err != MPEGH_DEC_OK && err != MPEGH_DEC_FEED_DATA)
commit f46bd4add2ed0129ad71d654c85f2cc84bc1a4d4
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 12:18:57 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:37:55 2025 +0200
avcodec/libmpeghdec: Don't use too big buffer
The channel count is fixed, so we don't need to allocate
space to hold samples for nonexisting channels. This also
means that the maximum channel count is no longer hardcoded
in the macro.
Also switch to decoder_buffer_size to be samples-based.
Reviewed-by: Lynne <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index 5233b36bc3..ebb5e54d7b 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -40,8 +40,8 @@
#include "decode.h"
#define MAX_LOST_FRAMES 2
-// 32-bit int * 22.2 * max framesize * (max delay frames + 1)
-#define MAX_OUTBUF_SIZE (sizeof(int32_t) * 24 * 3072 * (MAX_LOST_FRAMES + 1))
+// max framesize * (max delay frames + 1)
+#define PER_CHANNEL_OUTBUF_SIZE (3072 * (MAX_LOST_FRAMES + 1))
typedef struct MPEGH3DADecContext {
// pointer to the decoder
@@ -49,7 +49,7 @@ typedef struct MPEGH3DADecContext {
// Internal values
int32_t *decoder_buffer;
- int decoder_buffer_size;
+ int decoder_buffer_size; ///< in samples
} MPEGH3DADecContext;
static av_cold int mpegh3dadec_close(AVCodecContext *avctx)
@@ -160,8 +160,8 @@ static av_cold int mpegh3dadec_init(AVCodecContext *avctx)
avctx->sample_fmt = AV_SAMPLE_FMT_S32;
avctx->sample_rate = 48000;
- s->decoder_buffer_size = MAX_OUTBUF_SIZE;
- s->decoder_buffer = av_malloc(s->decoder_buffer_size);
+ s->decoder_buffer_size = PER_CHANNEL_OUTBUF_SIZE *
avctx->ch_layout.nb_channels;
+ s->decoder_buffer = av_malloc_array(s->decoder_buffer_size,
sizeof(*s->decoder_buffer));
if (!s->decoder_buffer)
return AVERROR(ENOMEM);
@@ -214,7 +214,7 @@ static int mpegh3dadec_decode_frame(AVCodecContext *avctx,
AVFrame *frame,
}
err = mpeghdecoder_getSamples(s->decoder, s->decoder_buffer,
- s->decoder_buffer_size / sizeof(int32_t),
+ s->decoder_buffer_size,
&out_info);
if (err == MPEGH_DEC_FEED_DATA) {
// no frames to produce at the moment
commit 60b88e75e42941d7142e4ed5e94a6886d5dd6e08
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 12:13:16 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:37:51 2025 +0200
avcodec/libmpeghdec: Inline constant
Reviewed-by: Lynne <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index e3cb219838..5233b36bc3 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -236,7 +236,7 @@ static int mpegh3dadec_decode_frame(AVCodecContext *avctx,
AVFrame *frame,
memcpy(frame->extended_data[0], s->decoder_buffer,
avctx->ch_layout.nb_channels * avctx->frame_size *
- av_get_bytes_per_sample(avctx->sample_fmt));
+ sizeof(*s->decoder_buffer) /* only AV_SAMPLE_FMT_S32 is supported
*/);
*got_frame_ptr = 1;
return ret = avpkt->size;
commit a98f75d22c37e20f55f0b4566e4b436cbc515a91
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 12:10:32 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:37:30 2025 +0200
avcodec/libmpeghdec: Don't set AVCodec.sample_fmts
It is mostly pointless for decoders (only useful for those
codecs for which a floating-point and a fixed-point decoder
exist).
Reviewed-by: Lynne <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index 2d6798e49e..e3cb219838 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -268,7 +268,6 @@ const FFCodec ff_libmpeghdec_decoder = {
FF_CODEC_DECODE_CB(mpegh3dadec_decode_frame),
.close = mpegh3dadec_close,
.flush = mpegh3dadec_flush,
- CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S32),
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "libmpeghdec",
};
commit 839042b0c0fce43c96ca1d09bdb78e40b1a3b1d4
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 12:09:39 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:37:24 2025 +0200
avcodec/libmpeghdec: Remove private class
This decoder doesn't have any options.
Reviewed-by: Lynne <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index ae85924625..2d6798e49e 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -35,7 +35,6 @@
#include "libavutil/channel_layout.h"
#include "libavutil/frame.h"
#include "libavutil/mem.h"
-#include "libavutil/opt.h"
#include "codec_internal.h"
#include "decode.h"
@@ -45,7 +44,6 @@
#define MAX_OUTBUF_SIZE (sizeof(int32_t) * 24 * 3072 * (MAX_LOST_FRAMES + 1))
typedef struct MPEGH3DADecContext {
- AVClass *av_class;
// pointer to the decoder
HANDLE_MPEGH_DECODER_CONTEXT decoder;
@@ -54,13 +52,6 @@ typedef struct MPEGH3DADecContext {
int decoder_buffer_size;
} MPEGH3DADecContext;
-// private class definition for ffmpeg
-static const AVClass mpegh3da_class = {
- .class_name = "MPEG-H 3D Audio Decoder",
- .item_name = av_default_item_name,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
static av_cold int mpegh3dadec_close(AVCodecContext *avctx)
{
MPEGH3DADecContext *s = avctx->priv_data;
@@ -268,7 +259,6 @@ static av_cold void mpegh3dadec_flush(AVCodecContext *avctx)
const FFCodec ff_libmpeghdec_decoder = {
.p.name = "libmpeghdec",
CODEC_LONG_NAME("libmpeghdec (MPEG-H 3D Audio)"),
- .p.priv_class = &mpegh3da_class,
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_MPEGH_3D_AUDIO,
.p.capabilities =
commit b8f341ff058d78df201c04f1725727024e31c16e
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Sep 24 12:07:28 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Fri Sep 26 05:36:42 2025 +0200
avcodec/libmpeghdec: Remove redundant manual close calls
This decoder has the INIT_CLEANUP flag set.
Reviewed-by: Lynne <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavcodec/libmpeghdec.c b/libavcodec/libmpeghdec.c
index e293ec3396..ae85924625 100644
--- a/libavcodec/libmpeghdec.c
+++ b/libavcodec/libmpeghdec.c
@@ -171,16 +171,13 @@ static av_cold int mpegh3dadec_init(AVCodecContext *avctx)
s->decoder_buffer_size = MAX_OUTBUF_SIZE;
s->decoder_buffer = av_malloc(s->decoder_buffer_size);
- if (!s->decoder_buffer) {
- mpegh3dadec_close(avctx);
+ if (!s->decoder_buffer)
return AVERROR(ENOMEM);
- }
// initialize the decoder
s->decoder = mpeghdecoder_init(cicp);
if (s->decoder == NULL) {
av_log(avctx, AV_LOG_ERROR, "MPEG-H decoder library init failed.\n");
- mpegh3dadec_close(avctx);
return AVERROR_EXTERNAL;
}
@@ -188,7 +185,6 @@ static av_cold int mpegh3dadec_init(AVCodecContext *avctx)
if (mpeghdecoder_setMhaConfig(s->decoder, avctx->extradata,
avctx->extradata_size)) {
av_log(avctx, AV_LOG_ERROR, "Unable to set MHA configuration\n");
- mpegh3dadec_close(avctx);
return AVERROR_INVALIDDATA;
}
}
-----------------------------------------------------------------------
Summary of changes:
libavcodec/libmpeghdec.c | 153 +++++++++++++++--------------------------------
1 file changed, 48 insertions(+), 105 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]