[FFmpeg-devel] [PATCH] avcodec/eac3dec: remove function duplicates

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu May 11 21:16:53 EEST 2023


James Almer:
> Thee are not part of the float/fixed ac3 template distinction.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/Makefile       | 2 +-
>  libavcodec/ac3dec.h       | 6 +++---
>  libavcodec/ac3dec_fixed.c | 1 -
>  libavcodec/ac3dec_float.c | 1 -
>  libavcodec/eac3dec.c      | 6 +++---
>  5 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 3cf4444b7e..deaf233021 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -336,7 +336,7 @@ OBJS-$(CONFIG_DVVIDEO_ENCODER)         += dvenc.o dv.o dvdata.o
>  OBJS-$(CONFIG_DXA_DECODER)             += dxa.o
>  OBJS-$(CONFIG_DXTORY_DECODER)          += dxtory.o
>  OBJS-$(CONFIG_DXV_DECODER)             += dxv.o
> -OBJS-$(CONFIG_EAC3_DECODER)            += eac3_data.o
> +OBJS-$(CONFIG_EAC3_DECODER)            += eac3dec.o eac3_data.o
>  OBJS-$(CONFIG_EAC3_ENCODER)            += eac3enc.o eac3_data.o
>  OBJS-$(CONFIG_EACMV_DECODER)           += eacmv.o
>  OBJS-$(CONFIG_EAMAD_DECODER)           += eamad.o eaidct.o mpeg12.o \
> diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h
> index 98de7b5abf..99729adf0d 100644
> --- a/libavcodec/ac3dec.h
> +++ b/libavcodec/ac3dec.h
> @@ -259,20 +259,20 @@ typedef struct AC3DecodeContext {
>   * Parse the E-AC-3 frame header.
>   * This parses both the bit stream info and audio frame header.
>   */
> -static int ff_eac3_parse_header(AC3DecodeContext *s);
> +int ff_eac3_parse_header(AC3DecodeContext *s);
>  
>  /**
>   * Decode mantissas in a single channel for the entire frame.
>   * This is used when AHT mode is enabled.
>   */
> -static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
> +void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
>  
>  /**
>   * Apply spectral extension to each channel by copying lower frequency
>   * coefficients to higher frequency bins and applying side information to
>   * approximate the original high frequency signal.
>   */
> -static void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
> +void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
>  
>  #if (!USE_FIXED)
>  extern float ff_ac3_heavy_dynamic_range_tab[256];
> diff --git a/libavcodec/ac3dec_fixed.c b/libavcodec/ac3dec_fixed.c
> index c9e5cda69c..0909c363f2 100644
> --- a/libavcodec/ac3dec_fixed.c
> +++ b/libavcodec/ac3dec_fixed.c
> @@ -152,7 +152,6 @@ static void ac3_downmix_c_fixed16(int16_t **samples, int16_t **matrix,
>      }
>  }
>  
> -#include "eac3dec.c"
>  #include "ac3dec.c"
>  
>  static const AVOption options[] = {
> diff --git a/libavcodec/ac3dec_float.c b/libavcodec/ac3dec_float.c
> index 39d3cbd282..9756829643 100644
> --- a/libavcodec/ac3dec_float.c
> +++ b/libavcodec/ac3dec_float.c
> @@ -34,7 +34,6 @@
>  #include "ac3dec.h"
>  #include "codec_internal.h"
>  #include "profiles.h"
> -#include "eac3dec.c"
>  #include "ac3dec.c"
>  
>  static const AVOption options[] = {
> diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c
> index 5c71751a0c..491f663d3e 100644
> --- a/libavcodec/eac3dec.c
> +++ b/libavcodec/eac3dec.c
> @@ -55,7 +55,7 @@ typedef enum {
>  
>  #define EAC3_SR_CODE_REDUCED  3
>  
> -static void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
> +void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
>  {
>      int bin, bnd, ch, i;
>      uint8_t wrapflag[SPX_MAX_BANDS]={1,0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS];
> @@ -194,7 +194,7 @@ static void idct6(int pre_mant[6])
>      pre_mant[5] = even0 - odd0;
>  }
>  
> -static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
> +void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
>  {
>      int bin, blk, gs;
>      int end_bap, gaq_mode;
> @@ -287,7 +287,7 @@ static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
>      }
>  }
>  
> -static int ff_eac3_parse_header(AC3DecodeContext *s)
> +int ff_eac3_parse_header(AC3DecodeContext *s)
>  {
>      int i, blk, ch;
>      int ac3_exponent_strategy, parse_aht_info, parse_spx_atten_data;

Won't this uninline functions needlessly in the float case?

- Andreas



More information about the ffmpeg-devel mailing list