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

Michael Niedermayer michaelni at gmx.at
Thu Nov 15 04:03:31 CET 2012


On Wed, Nov 14, 2012 at 11:22:45PM +0100, Clément Bœsch wrote:
> ---
>  libswresample/rematrix.c          | 41 ++++++++-------------------------------
>  libswresample/rematrix_template.c | 30 ++++++++++++++++++++++++++++
>  2 files changed, 38 insertions(+), 33 deletions(-)
> 
> diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
> index e23c45e..8c29fb0 100644
> --- a/libswresample/rematrix.c
> +++ b/libswresample/rematrix.c
> @@ -22,42 +22,17 @@
>  #include "libavutil/avassert.h"
>  #include "libavutil/channel_layout.h"
>  
> -#define ONE (1.0)
> -#define R(x) x
> -#define SAMPLE float
> -#define COEFF float
> -#define INTER float
> -#define RENAME(x) x ## _float
> +#define CONFIG_REMATRIX_FLT
>  #include "rematrix_template.c"
> -#undef SAMPLE
> -#undef RENAME
> -#undef R
> -#undef ONE
> -#undef COEFF
> -#undef INTER
> -
> -#define ONE (1.0)
> -#define R(x) x
> -#define SAMPLE double
> -#define COEFF double
> -#define INTER double
> -#define RENAME(x) x ## _double
> -#include "rematrix_template.c"
> -#undef SAMPLE
> -#undef RENAME
> -#undef R
> -#undef ONE
> -#undef COEFF
> -#undef INTER
> -
> -#define ONE (-32768)
> -#define R(x) (((x) + 16384)>>15)
> -#define SAMPLE int16_t
> -#define COEFF int
> -#define INTER int
> -#define RENAME(x) x ## _s16
> +#undef CONFIG_REMATRIX_FLT
> +
> +#define CONFIG_REMATRIX_DBL
>  #include "rematrix_template.c"
> +#undef CONFIG_REMATRIX_DBL
>  
> +#define CONFIG_REMATRIX_S16
> +#include "rematrix_template.c"
> +#undef CONFIG_REMATRIX_S16
>  
>  #define FRONT_LEFT             0
>  #define FRONT_RIGHT            1
> diff --git a/libswresample/rematrix_template.c b/libswresample/rematrix_template.c
> index 61d3fe9..6a5a3c5 100644
> --- a/libswresample/rematrix_template.c
> +++ b/libswresample/rematrix_template.c
> @@ -18,6 +18,29 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   */
>  
> +#if defined(CONFIG_REMATRIX_FLT)
> +# define ONE (1.0)
> +# define R(x) x
> +# define SAMPLE float
> +# define COEFF float
> +# define INTER float
> +# define RENAME(x) x ## _float
> +#elif defined(CONFIG_REMATRIX_DBL)
> +# define ONE (1.0)
> +# define R(x) x
> +# define SAMPLE double
> +# define COEFF double
> +# define INTER double
> +# define RENAME(x) x ## _double
> +#elif defined(CONFIG_REMATRIX_S16)
> +# define ONE (-32768)
> +# define R(x) (((x) + 16384)>>15)
> +# define SAMPLE int16_t
> +# define COEFF int
> +# define INTER int
> +# define RENAME(x) x ## _s16
> +#endif

these should get 4 spaces for indent
also CONFIG_* appers here too a bad name otherwise LGTM

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

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- 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/01d57dd6/attachment.asc>


More information about the ffmpeg-devel mailing list