[FFmpeg-devel] [PATCH v2] avcodec/ac3dec: add a flush callback for the ac3 and eac3 decoders
Michael Niedermayer
michael at niedermayer.cc
Wed Feb 12 00:55:27 EET 2025
Hi James
On Thu, Feb 06, 2025 at 04:17:47PM -0300, James Almer wrote:
> Fixes ticket #10732
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libavcodec/ac3dec.c | 10 ++++++++++
> libavcodec/ac3dec.h | 40 ++++++++++++++++++++++-----------------
> libavcodec/ac3dec_fixed.c | 1 +
> libavcodec/ac3dec_float.c | 2 ++
> 4 files changed, 36 insertions(+), 17 deletions(-)
>
> diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
> index ff8cbfb0b4..2cf82abc19 100644
> --- a/libavcodec/ac3dec.c
> +++ b/libavcodec/ac3dec.c
[...]
> /**
> * Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream.
> * GetBitContext within AC3DecodeContext must point to
> diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h
> index 98de7b5abf..cc6d1a118e 100644
> --- a/libavcodec/ac3dec.h
> +++ b/libavcodec/ac3dec.h
> @@ -75,8 +75,30 @@ typedef struct AC3DecodeContext {
> AVCodecContext *avctx; ///< parent context
> GetBitContext gbc; ///< bitstream reader
>
> + AVTXContext *tx_128, *tx_256;
> + av_tx_fn tx_fn_128, tx_fn_256;
> +
> +///@name Optimization
> + BswapDSPContext bdsp;
> +#if USE_FIXED
> + AVFixedDSPContext *fdsp;
> +#else
> + AVFloatDSPContext *fdsp;
> +#endif
> + AC3DSPContext ac3dsp;
> + FmtConvertContext fmt_conv; ///< optimized conversion functions
> +///@}
> +
> + INTFLOAT *xcfptr[AC3_MAX_CHANNELS];
> + INTFLOAT *dlyptr[AC3_MAX_CHANNELS];
> +
> + AVChannelLayout downmix_layout;
> + SHORTFLOAT *downmix_coeffs[2]; ///< stereo downmix coefficients
> +
> +// Start of flushable fields
> ///@name Bit stream information
> ///@{
> + // frame_type must be first
> int frame_type; ///< frame type (strmtyp)
> int substreamid; ///< substream identification
> int superframe_size; ///< current superframe size, in bytes
> @@ -164,7 +186,6 @@ typedef struct AC3DecodeContext {
> int fbw_channels; ///< number of full-bandwidth channels
> int channels; ///< number of total channels
> int lfe_ch; ///< index of LFE channel
> - SHORTFLOAT *downmix_coeffs[2]; ///< stereo downmix coefficients
> int downmixed; ///< indicates if coeffs are currently downmixed
> int output_mode; ///< output channel configuration
> int prev_output_mode; ///< output channel configuration for previous frame
> @@ -222,24 +243,9 @@ typedef struct AC3DecodeContext {
>
> ///@name IMDCT
> int block_switch[AC3_MAX_CHANNELS]; ///< block switch flags (blksw)
> - AVTXContext *tx_128, *tx_256;
> - av_tx_fn tx_fn_128, tx_fn_256;
> -///@}
> -
> -///@name Optimization
> - BswapDSPContext bdsp;
> -#if USE_FIXED
> - AVFixedDSPContext *fdsp;
> -#else
> - AVFloatDSPContext *fdsp;
> -#endif
> - AC3DSPContext ac3dsp;
> - FmtConvertContext fmt_conv; ///< optimized conversion functions
> ///@}
>
> SHORTFLOAT *outptr[AC3_MAX_CHANNELS];
> - INTFLOAT *xcfptr[AC3_MAX_CHANNELS];
> - INTFLOAT *dlyptr[AC3_MAX_CHANNELS];
>
> ///@name Aligned arrays
> DECLARE_ALIGNED(16, int, fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< fixed-point transform coefficients
> @@ -252,7 +258,7 @@ typedef struct AC3DecodeContext {
> DECLARE_ALIGNED(32, SHORTFLOAT, output_buffer)[EAC3_MAX_CHANNELS][AC3_BLOCK_SIZE * 6]; ///< final output buffer
> ///@}
>
> - AVChannelLayout downmix_layout;
> +// End of flushable fields
> } AC3DecodeContext;
This seems moving fields around,
if so, maybe this should be in a seperate patch
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250211/b3a9fd56/attachment.sig>
More information about the ffmpeg-devel
mailing list