This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 915a2f32b8a738fe1693d5935bb2b00b890c4168 Author: Romain Beauxis <[email protected]> AuthorDate: Sat Oct 31 09:16:23 2026 -0500 Commit: Romain Beauxis <[email protected]> CommitDate: Thu Nov 5 13:37:08 2026 +0000 avcodec/flacdec: split frame header and subframe decoding Request the output buffer once the frame header has given the block size, before decoding the subframes. With frame threading, all the state a frame header sets can then be handed to the next thread before the costly part of the frame starts. --- libavcodec/flacdec.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index b3e56df0a0..d269e6b432 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -599,9 +599,9 @@ static inline int decode_subframe(FLACContext *s, int channel) return 0; } -static int decode_frame(FLACContext *s) +static int decode_frame_header(FLACContext *s) { - int i, ret; + int ret; GetBitContext *gb = &s->gb; FLACFrameInfo fi; @@ -670,6 +670,14 @@ static int decode_frame(FLACContext *s) // dump_headers(s->avctx, &s->stream_info); + return 0; +} + +static int decode_subframes(FLACContext *s) +{ + int i, ret; + GetBitContext *gb = &s->gb; + /* subframes */ for (i = 0; i < s->stream_info.channels; i++) { if ((ret = decode_subframe(s, i)) < 0) @@ -743,7 +751,17 @@ static int flac_decode_frame(AVCodecContext *avctx, AVFrame *frame, /* decode frame */ if ((ret = init_get_bits8(&s->gb, buf, buf_size)) < 0) return ret; - if ((ret = decode_frame(s)) < 0) { + if ((ret = decode_frame_header(s)) < 0) { + av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n"); + return ret; + } + + /* get output buffer */ + frame->nb_samples = s->blocksize; + if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + return ret; + + if ((ret = decode_subframes(s)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n"); return ret; } @@ -757,11 +775,6 @@ static int flac_decode_frame(AVCodecContext *avctx, AVFrame *frame, return AVERROR_INVALIDDATA; } - /* get output buffer */ - frame->nb_samples = s->blocksize; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) - return ret; - if (s->stream_info.bps == 32 && s->ch_mode > 0) { decorrelate_33bps(s->ch_mode, s->decoded, s->decoded_33bps, s->blocksize); s->dsp.decorrelate[0](frame->data, s->decoded, s->stream_info.channels, -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
