From 178e9a69ae7937f41aba11cc0b9e8efe278e9d3d Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 22 May 2014 00:26:18 -0700 Subject: [PATCH] add stub dsp/enc_avx2.c VP8EncDspInitAVX2 is included in sse2 builds for now, later a configure flag should be added to avoid the stub when avx2 is unavailable/disabled Change-Id: I6127b687c273f46f41652aaf8e3b86ae3cfb8108 --- Android.mk | 1 + Makefile.vc | 1 + makefile.unix | 1 + src/dsp/Makefile.am | 13 ++++++++++--- src/dsp/enc.c | 7 +++++++ src/dsp/enc_avx2.c | 24 ++++++++++++++++++++++++ 6 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/dsp/enc_avx2.c diff --git a/Android.mk b/Android.mk index 1035c3e2..36808db3 100644 --- a/Android.mk +++ b/Android.mk @@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \ src/dsp/dec_neon.$(NEON) \ src/dsp/dec_sse2.c \ src/dsp/enc.c \ + src/dsp/enc_avx2.c \ src/dsp/enc_mips32.c \ src/dsp/enc_neon.$(NEON) \ src/dsp/enc_sse2.c \ diff --git a/Makefile.vc b/Makefile.vc index 7a70e9f8..760bc91c 100644 --- a/Makefile.vc +++ b/Makefile.vc @@ -184,6 +184,7 @@ DSP_DEC_OBJS = \ DSP_ENC_OBJS = \ $(DIROBJ)\dsp\enc.obj \ + $(DIROBJ)\dsp\enc_avx2.obj \ $(DIROBJ)\dsp\enc_mips32.obj \ $(DIROBJ)\dsp\enc_neon.obj \ $(DIROBJ)\dsp\enc_sse2.obj \ diff --git a/makefile.unix b/makefile.unix index 17b1d451..8b413900 100644 --- a/makefile.unix +++ b/makefile.unix @@ -119,6 +119,7 @@ DSP_DEC_OBJS = \ DSP_ENC_OBJS = \ src/dsp/enc.o \ + src/dsp/enc_avx2.o \ src/dsp/enc_mips32.o \ src/dsp/enc_neon.o \ src/dsp/enc_sse2.o \ diff --git a/src/dsp/Makefile.am b/src/dsp/Makefile.am index 24fb75d7..b6de081b 100644 --- a/src/dsp/Makefile.am +++ b/src/dsp/Makefile.am @@ -1,5 +1,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/src -noinst_LTLIBRARIES = libwebpdsp.la +noinst_LTLIBRARIES = libwebpdsp.la libwebpdsp_avx2.la if BUILD_LIBWEBPDECODER noinst_LTLIBRARIES += libwebpdspdecode.la @@ -35,18 +35,25 @@ ENC_SOURCES += enc_mips32.c ENC_SOURCES += enc_neon.c ENC_SOURCES += enc_sse2.c +libwebpdsp_avx2_la_SOURCES = +libwebpdsp_avx2_la_SOURCES += enc_avx2.c +libwebpdsp_avx2_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) +libwebpdsp_avx2_la_CFLAGS = $(AM_CFLAGS) $(AVX2_FLAGS) + libwebpdsp_la_SOURCES = $(COMMON_SOURCES) $(ENC_SOURCES) noinst_HEADERS = noinst_HEADERS += ../dec/decode_vp8.h noinst_HEADERS += ../webp/decode.h -libwebpdsp_la_LDFLAGS = -lm libwebpdsp_la_CPPFLAGS = $(USE_EXPERIMENTAL_CODE) $(USE_SWAP_16BIT_CSP) +libwebpdsp_la_LDFLAGS = -lm +libwebpdsp_la_LIBADD = libwebpdsp_avx2.la if BUILD_LIBWEBPDECODER libwebpdspdecode_la_SOURCES = $(COMMON_SOURCES) - libwebpdspdecode_la_LDFLAGS = $(libwebpdsp_la_LDFLAGS) libwebpdspdecode_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) + libwebpdspdecode_la_LDFLAGS = $(libwebpdsp_la_LDFLAGS) + libwebpdspdecode_la_LIBADD = libwebpdsp_avx2.la endif diff --git a/src/dsp/enc.c b/src/dsp/enc.c index 66f3a6a9..d9b25904 100644 --- a/src/dsp/enc.c +++ b/src/dsp/enc.c @@ -688,6 +688,7 @@ VP8QuantizeBlockWHT VP8EncQuantizeBlockWHT; VP8BlockCopy VP8Copy4x4; extern void VP8EncDspInitSSE2(void); +extern void VP8EncDspInitAVX2(void); extern void VP8EncDspInitNEON(void); extern void VP8EncDspInitMIPS32(void); @@ -719,6 +720,12 @@ void VP8EncDspInit(void) { if (VP8GetCPUInfo(kSSE2)) { VP8EncDspInitSSE2(); } + // TODO(jzern): this should be conditionally included based on a configure + // (HAVE_AVX2) define. We can't use WEBP_USE_AVX2/__AVX2__ here as -mavx2 + // won't be defined for this file. + if (VP8GetCPUInfo(kAVX2)) { + VP8EncDspInitAVX2(); + } #elif defined(WEBP_USE_NEON) if (VP8GetCPUInfo(kNEON)) { VP8EncDspInitNEON(); diff --git a/src/dsp/enc_avx2.c b/src/dsp/enc_avx2.c new file mode 100644 index 00000000..372e6169 --- /dev/null +++ b/src/dsp/enc_avx2.c @@ -0,0 +1,24 @@ +// Copyright 2014 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// AVX2 version of speed-critical encoding functions. + +#include "./dsp.h" + +#if defined(WEBP_USE_AVX2) + +#endif // WEBP_USE_AVX2 + +//------------------------------------------------------------------------------ +// Entry point + +extern void VP8EncDspInitAVX2(void); + +void VP8EncDspInitAVX2(void) { +}