History

Build libsimple_encode.a separately

BUG=webm:1689

angiebird committed 6 years ago

Commit 56345d21 parent 16935394 files · +63 −9Browse files

Unified · Split

4 files
  1. libs.mk +54 −5
  2. test/simple_encode_test.cc +5 −0
  3. test/test.mk +4 −1
  4. vp9/vp9cx.mk +0 −3
libs.mk+54−5
@@ -173,7 +173,18 @@ INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a · 172 unmodified lines
173173 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
174174 endif
175175
176+ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_RATE_CTRL),yesyes)
177+ SIMPLE_ENCODE_SRCS := $(call enabled,CODEC_SRCS)
178+ SIMPLE_ENCODE_SRCS += $(VP9_PREFIX)simple_encode.cc
179+ SIMPLE_ENCODE_SRCS += $(VP9_PREFIX)simple_encode.h
180+ SIMPLE_ENCODE_SRCS += ivfenc.h
181+ SIMPLE_ENCODE_SRCS += ivfenc.c
182+ INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP9_PREFIX)simple_encode.cc
183+ INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP9_PREFIX)simple_encode.h
184+endif
185+
176186 CODEC_SRCS=$(call enabled,CODEC_SRCS)
187+
177188 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
178189 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
179190
@@ -263,8 +274,8 @@ PROJECTS-yes += vp9rc.$(VCPROJ_SFX) · 83 unmodified lines
263274 vp9rc.$(VCPROJ_SFX): vpx_config.asm
264275 vp9rc.$(VCPROJ_SFX): $(RTCD)
265276
266−endif
267−else
277+endif # ifeq ($(CONFIG_MSVS),yes)
278+else # ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
268279 LIBVPX_OBJS=$(call objs, $(filter-out $(ASM_INCLUDES), $(CODEC_SRCS)))
269280 OBJS-yes += $(LIBVPX_OBJS)
270281 LIBS-$(if yes,$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
@@ -377,8 +388,15 @@ ifeq ($(CONFIG_VP9_ENCODER),yes) · 106 unmodified lines
377388 $(BUILD_PFX)libvp9rc_g.a: $(RC_RTC_OBJS)
378389 endif
379390
391+ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_RATE_CTRL),yesyes)
392+ SIMPLE_ENCODE_OBJS=$(call objs,$(SIMPLE_ENCODE_SRCS))
393+ OBJS-yes += $(SIMPLE_ENCODE_OBJS)
394+ LIBS-yes += $(BUILD_PFX)libsimple_encode.a $(BUILD_PFX)libsimple_encode_g.a
395+ $(BUILD_PFX)libsimple_encode_g.a: $(SIMPLE_ENCODE_OBJS)
380396 endif
381397
398+endif # ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
399+
382400 libvpx.ver: $(call enabled,CODEC_EXPORTS)
383401 @echo " [CREATE] $@"
384402 $(qexec)echo "{ global:" > $@
@@ -434,20 +452,39 @@ ifeq ($(CONFIG_UNIT_TESTS),yes) · 49 unmodified lines
434452 LIBVPX_TEST_DATA_PATH ?= .
435453
436454 include $(SRC_PATH_BARE)/test/test.mk
437−LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
455+
456+# addprefix_clean behaves like addprefix if the target doesn't start with "../"
457+# However, if the target starts with "../", instead of adding prefix,
458+# it will remove "../".
459+# Using addprefix_clean, we can avoid two different targets building the
460+# same file, i.e.
461+# test/../ivfenc.c.d: ivfenc.o
462+# ivfenc.c.d: ivfenc.o
463+# Note that the other way to solve this problem is using "realpath".
464+# The "realpath" is supported by make 3.81 or later.
465+addprefix_clean=$(patsubst $(1)../%,%,$(addprefix $(1), $(2)))
466+LIBVPX_TEST_SRCS=$(call addprefix_clean,test/,$(call enabled,LIBVPX_TEST_SRCS))
467+
438468 LIBVPX_TEST_BIN=./test_libvpx$(EXE_SFX)
439469 LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
440470 $(call enabled,LIBVPX_TEST_DATA))
441471 libvpx_test_data_url=https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx/$(1)
442472
443473 TEST_INTRA_PRED_SPEED_BIN=./test_intra_pred_speed$(EXE_SFX)
444−TEST_INTRA_PRED_SPEED_SRCS=$(addprefix test/,$(call enabled,TEST_INTRA_PRED_SPEED_SRCS))
474+TEST_INTRA_PRED_SPEED_SRCS=$(call addprefix_clean,test/,\
475+ $(call enabled,TEST_INTRA_PRED_SPEED_SRCS))
445476 TEST_INTRA_PRED_SPEED_OBJS := $(sort $(call objs,$(TEST_INTRA_PRED_SPEED_SRCS)))
446477
447478 RC_INTERFACE_TEST_BIN=./test_rc_interface$(EXE_SFX)
448−RC_INTERFACE_TEST_SRCS=$(addprefix test/,$(call enabled,RC_INTERFACE_TEST_SRCS))
479+RC_INTERFACE_TEST_SRCS=$(call addprefix_clean,test/,\
480+ $(call enabled,RC_INTERFACE_TEST_SRCS))
449481 RC_INTERFACE_TEST_OBJS := $(sort $(call objs,$(RC_INTERFACE_TEST_SRCS)))
450482
483+SIMPLE_ENCODE_TEST_BIN=./test_simple_encode$(EXE_SFX)
484+SIMPLE_ENCODE_TEST_SRCS=$(call addprefix_clean,test/,\
485+ $(call enabled,SIMPLE_ENCODE_TEST_SRCS))
486+SIMPLE_ENCODE_TEST_OBJS := $(sort $(call objs,$(SIMPLE_ENCODE_TEST_SRCS)))
487+
451488 libvpx_test_srcs.txt:
452489 @echo " [CREATE] $@"
453490 @echo $(LIBVPX_TEST_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@
@@ -609,6 +646,18 @@ $(eval $(call linkerxx_template,$(RC_INTERFACE_TEST_BIN), \ · 155 unmodified lines
609646 -L. -lvpx -lgtest -lvp9rc $(extralibs) -lm))
610647 endif # RC_INTERFACE_TEST
611648
649+ifneq ($(strip $(SIMPLE_ENCODE_TEST_OBJS)),)
650+$(SIMPLE_ENCODE_TEST_OBJS) $(SIMPLE_ENCODE_TEST_OBJS:.o=.d): \
651+ CXXFLAGS += $(GTEST_INCLUDES)
652+OBJS-yes += $(SIMPLE_ENCODE_TEST_OBJS)
653+BINS-yes += $(SIMPLE_ENCODE_TEST_BIN)
654+
655+$(SIMPLE_ENCODE_TEST_BIN): $(TEST_LIBS) libsimple_encode.a
656+$(eval $(call linkerxx_template,$(SIMPLE_ENCODE_TEST_BIN), \
657+ $(SIMPLE_ENCODE_TEST_OBJS) \
658+ -L. -lsimple_encode -lvpx -lgtest $(extralibs) -lm))
659+endif # SIMPLE_ENCODE_TEST
660+
612661 endif # CONFIG_UNIT_TESTS
613662
614663 # Install test sources only if codec source is included
test/simple_encode_test.cc+5−0
@@ -504,3 +504,8 @@ TEST_F(SimpleEncodeTest, GetFramePixelCount) { · 503 unmodified lines
504504
505505 } // namespace
506506 } // namespace vp9
507+
508+int main(int argc, char **argv) {
509+ ::testing::InitGoogleTest(&argc, argv);
510+ return RUN_ALL_TESTS();
511+}
test/test.mk+4−1
@@ -58,7 +58,6 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.cc · 57 unmodified lines
5858 LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.h
5959 LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_end_to_end_test.cc
6060 LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += timestamp_test.cc
61−LIBVPX_TEST_SRCS-$(CONFIG_RATE_CTRL) += simple_encode_test.cc
6261
6362 LIBVPX_TEST_SRCS-yes += decode_test_driver.cc
6463 LIBVPX_TEST_SRCS-yes += decode_test_driver.h
@@ -193,6 +192,10 @@ LIBVPX_TEST_SRCS-yes += vp9_denoiser_test.cc · 128 unmodified lines
193192 endif
194193 LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_arf_freq_test.cc
195194
195+ifeq ($(CONFIG_VP9_ENCODER),yes)
196+SIMPLE_ENCODE_TEST_SRCS-$(CONFIG_RATE_CTRL) := simple_encode_test.cc
197+endif
198+
196199 endif # VP9
197200
198201 ## Multi-codec / unconditional whitebox tests.
vp9/vp9cx.mk+0−3
@@ -18,9 +18,6 @@ VP9_CX_SRCS_REMOVE-no += $(VP9_COMMON_SRCS_REMOVE-no) · 17 unmodified lines
1818 VP9_CX_SRCS-yes += vp9_cx_iface.c
1919 VP9_CX_SRCS-yes += vp9_cx_iface.h
2020
21−VP9_CX_SRCS-$(CONFIG_RATE_CTRL) += simple_encode.cc
22−VP9_CX_SRCS-$(CONFIG_RATE_CTRL) += simple_encode.h
23−
2421 VP9_CX_SRCS-yes += encoder/vp9_bitstream.c
2522 VP9_CX_SRCS-yes += encoder/vp9_context_tree.c
2623 VP9_CX_SRCS-yes += encoder/vp9_context_tree.h

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t