[FFmpeg-devel] [PATCH 1/2] swr/resample: move templating parameters to template itself.

Michael Niedermayer michaelni at gmx.at
Thu Nov 15 04:00:38 CET 2012


On Wed, Nov 14, 2012 at 11:22:44PM +0100, Clément Bœsch wrote:
> It has various benefits such as allowing some refactoring, clarifying
> the code in the inclusion part, and making the template understandable
> in standalone.
> 
> This commit is based on the templating method used by Justin Ruggles for
> libavresample.
> ---
>  libswresample/resample.c          | 127 +++++---------------------------------
>  libswresample/resample_template.c |  67 ++++++++++++++++++++
>  2 files changed, 82 insertions(+), 112 deletions(-)
> 
> diff --git a/libswresample/resample.c b/libswresample/resample.c
> index bf412dd..2a0d06e 100644
> --- a/libswresample/resample.c
> +++ b/libswresample/resample.c
> @@ -289,132 +289,35 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio
>      return 0;
>  }
>  
> -#define RENAME(N) N ## _int16
> -#define FILTER_SHIFT 15
> -#define DELEM  int16_t
> -#define FELEM  int16_t
> -#define FELEM2 int32_t
> -#define FELEML int64_t
> -#define FELEM_MAX INT16_MAX
> -#define FELEM_MIN INT16_MIN
> -#define OUT(d, v) v = (v + (1<<(FILTER_SHIFT-1)))>>FILTER_SHIFT;\
> -                  d = (unsigned)(v + 32768) > 65535 ? (v>>31) ^ 32767 : v

> +#define CONFIG_RESAMPLE_S16

maybe something else than CONFIG_* should be used here, so theres a
clear seperation from configure/config.h setup #defines
rest LGTM

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121115/dcd6f2e3/attachment.asc>


More information about the ffmpeg-devel mailing list