[ffmpeg] branch master updated (3c902f68d7 -> ca5504fb5c)
This is an automated email from the git hooks/post-receive script. Git pushed a change to branch master in repository ffmpeg. from 3c902f68d7 configure: update whip dependences new ba1aea762b avcodec/liblc3{dec,enc}: Simplify sample_size, is_planar check new ca5504fb5c avcodec/liblc3dec: Simplify sample fmt selection The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: libavcodec/liblc3dec.c | 28 +++++----------------------- libavcodec/liblc3enc.c | 15 ++++++--------- 2 files changed, 11 insertions(+), 32 deletions(-)
This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg. commit ba1aea762b105edc023ed9783466b159612eb66c Author: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> AuthorDate: Sat Nov 22 23:56:14 2025 +0100 Commit: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> CommitDate: Thu Jan 29 14:08:15 2026 +0100 avcodec/liblc3{dec,enc}: Simplify sample_size, is_planar check Sample size is always sizeof(float), is planar is a simple if given that these codecs only support float and planar float. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/liblc3dec.c | 9 +++------ libavcodec/liblc3enc.c | 15 ++++++--------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c index 293325ba2b..a0989c88b0 100644 --- a/libavcodec/liblc3dec.c +++ b/libavcodec/liblc3dec.c @@ -123,8 +123,6 @@ static int liblc3_decode(AVCodecContext *avctx, AVFrame *frame, int channels = avctx->ch_layout.nb_channels; uint8_t *in = avpkt->data; int block_bytes, ret; - size_t sample_size; - int is_planar; frame->nb_samples = av_rescale( liblc3->frame_us, liblc3->srate_hz, 1000*1000); @@ -132,13 +130,12 @@ static int liblc3_decode(AVCodecContext *avctx, AVFrame *frame, return ret; block_bytes = avpkt->size; - is_planar = av_sample_fmt_is_planar(avctx->sample_fmt); - sample_size = av_get_bytes_per_sample(avctx->sample_fmt); + int is_planar = avctx->sample_fmt == AV_SAMPLE_FMT_FLTP; for (int ch = 0; ch < channels; ch++) { int nbytes = block_bytes / channels + (ch < block_bytes % channels); - void *pcm_data = is_planar ? frame->extended_data[ch] : - frame->extended_data[0] + ch * sample_size; + float *pcm_data = is_planar ? (float*)frame->extended_data[ch] : + (float*)frame->extended_data[0] + ch; int stride = is_planar ? 1 : channels; ret = lc3_decode(liblc3->decoder[ch], in, nbytes, diff --git a/libavcodec/liblc3enc.c b/libavcodec/liblc3enc.c index 8bdf6bd5d8..e64963b457 100644 --- a/libavcodec/liblc3enc.c +++ b/libavcodec/liblc3enc.c @@ -138,13 +138,8 @@ static int liblc3_encode(AVCodecContext *avctx, AVPacket *pkt, int block_bytes = liblc3->block_bytes; int channels = avctx->ch_layout.nb_channels; uint8_t *data_ptr; - size_t sample_size; - int is_planar; int ret; - is_planar = av_sample_fmt_is_planar(avctx->sample_fmt); - sample_size = av_get_bytes_per_sample(avctx->sample_fmt); - if ((ret = ff_get_encode_buffer(avctx, pkt, block_bytes, 0)) < 0) return ret; @@ -158,14 +153,16 @@ static int liblc3_encode(AVCodecContext *avctx, AVPacket *pkt, liblc3->remaining_samples = 0; } + int is_planar = avctx->sample_fmt == AV_SAMPLE_FMT_FLTP; + data_ptr = pkt->data; for (int ch = 0; ch < channels; ch++) { int nbytes = block_bytes / channels + (ch < block_bytes % channels); - const void *pcm = frame ? - (is_planar ? frame->data[ch] : - frame->data[0] + ch * sample_size) : - (const void *)(const float[]){ 0 }; + const float *pcm = frame ? + (is_planar ? (const float*)frame->data[ch] : + (const float*)frame->data[0] + ch) : + (const float[]){ 0 }; int stride = frame ? (is_planar ? 1 : channels) : 0;
This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg. commit ca5504fb5ca76a380c13157ef294741ecadad871 Author: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> AuthorDate: Sun Nov 23 00:26:07 2025 +0100 Commit: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> CommitDate: Thu Jan 29 14:08:15 2026 +0100 avcodec/liblc3dec: Simplify sample fmt selection Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/liblc3dec.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/libavcodec/liblc3dec.c b/libavcodec/liblc3dec.c index a0989c88b0..953445ecfa 100644 --- a/libavcodec/liblc3dec.c +++ b/libavcodec/liblc3dec.c @@ -43,14 +43,6 @@ static av_cold int liblc3_decode_init(AVCodecContext *avctx) int ep_mode; unsigned decoder_size; - static const struct { - enum AVSampleFormat av_format; - enum lc3_pcm_format lc3_format; - } format_map[] = { - { AV_SAMPLE_FMT_FLT, LC3_PCM_FORMAT_FLOAT }, - { AV_SAMPLE_FMT_FLTP, LC3_PCM_FORMAT_FLOAT }, - }; - if (avctx->extradata_size < 6) return AVERROR_INVALIDDATA; if (channels < 0 || channels > DECODER_MAX_CHANNELS) { @@ -90,15 +82,8 @@ static av_cold int liblc3_decode_init(AVCodecContext *avctx) (char *)liblc3->decoder_mem + ch * decoder_size); } - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - if (avctx->request_sample_fmt != AV_SAMPLE_FMT_NONE) { - for (int i = 0; i < FF_ARRAY_ELEMS(format_map); i++) { - if (format_map[i].av_format == avctx->request_sample_fmt) { - avctx->sample_fmt = avctx->request_sample_fmt; - break; - } - } - } + avctx->sample_fmt = avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT ? + AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_FLTP; avctx->delay = lc3_hr_delay_samples( liblc3->hr_mode, liblc3->frame_us, liblc3->srate_hz);
participants (2)
-
Andreas Rheinhardt -
ffmpeg-git