16 SRCS
= common
/osdep.c common
/base.c common
/cpu.c common
/tables.c \
19 SRCS_X
= common
/mc.c common
/predict.c common
/pixel.c common
/macroblock.c \
20 common
/frame.c common
/dct.c common
/cabac.c \
21 common
/common.c common
/rectangle.c \
22 common
/set.c common
/quant.c common
/deblock.c common
/vlc.c \
23 common
/mvpred.c common
/bitstream.c \
24 encoder
/analyse.c encoder
/me.c encoder
/ratecontrol.c \
25 encoder
/set.c encoder
/macroblock.c encoder
/cabac.c \
26 encoder
/cavlc.c encoder
/encoder.c encoder
/lookahead.c
30 SRCCLI
= x264.c autocomplete.c input
/input.c input
/timecode.c input
/raw.c \
31 input
/y4m.c output
/raw.c output
/matroska.c output
/matroska_ebml.c \
32 output
/flv.c output
/flv_bytestream.c filters
/filters.c \
33 filters
/video
/video.c filters
/video
/source.c filters
/video
/internal.c \
34 filters
/video
/resize.c filters
/video
/fix_vfr_pts.c \
35 filters
/video
/select_every.c filters
/video
/crop.c
37 SRCCLI_X
= filters
/video
/cache.c filters
/video
/depth.c
41 SRCCHK_X
= tools
/checkasm.c
43 SRCEXAMPLE
= example.c
54 CONFIG
:= $(shell cat config.h
)
56 # Optional module sources
57 ifneq ($(findstring HAVE_AVS
1, $(CONFIG
)),)
61 ifneq ($(findstring HAVE_THREAD
1, $(CONFIG
)),)
62 SRCS_X
+= common
/threadpool.c
63 SRCCLI_X
+= input
/thread.c
66 ifneq ($(findstring HAVE_WIN32THREAD
1, $(CONFIG
)),)
67 SRCS
+= common
/win32thread.c
70 ifneq ($(findstring HAVE_LAVF
1, $(CONFIG
)),)
71 SRCCLI
+= input
/lavf.c
74 ifneq ($(findstring HAVE_FFMS
1, $(CONFIG
)),)
75 SRCCLI
+= input
/ffms.c
78 ifneq ($(findstring HAVE_GPAC
1, $(CONFIG
)),)
79 SRCCLI
+= output
/mp4.c
82 ifneq ($(findstring HAVE_LSMASH
1, $(CONFIG
)),)
83 SRCCLI
+= output
/mp4_lsmash.c
90 ifeq ($(SYS_ARCH
),X86
)
92 SRCASM_X
+= common
/x86
/dct-32.asm \
93 common
/x86
/pixel-32.asm
95 ifeq ($(SYS_ARCH
),X86_64
)
97 SRCASM_X
+= common
/x86
/dct-64.asm \
98 common
/x86
/trellis-64.asm
102 SRCASM_X
+= common
/x86
/bitstream-a.asm \
103 common
/x86
/const-a.asm \
104 common
/x86
/cabac-a.asm \
105 common
/x86
/dct-a.asm \
106 common
/x86
/deblock-a.asm \
107 common
/x86
/mc-a.asm \
108 common
/x86
/mc-a2.asm \
109 common
/x86
/pixel-a.asm \
110 common
/x86
/predict-a.asm \
111 common
/x86
/quant-a.asm
112 SRCS_X
+= common
/x86
/mc-c.c \
113 common
/x86
/predict-c.c
115 OBJASM
+= common
/x86
/cpu-a.o
116 ifneq ($(findstring HAVE_BITDEPTH8
1, $(CONFIG
)),)
117 OBJASM
+= $(SRCASM_X
:%.asm
=%-8.o
) common
/x86
/sad-a-8.o
119 ifneq ($(findstring HAVE_BITDEPTH10
1, $(CONFIG
)),)
120 OBJASM
+= $(SRCASM_X
:%.asm
=%-10.o
) common
/x86
/sad16-a-10.o
123 OBJCHK
+= tools
/checkasm-a.o
127 ifeq ($(SYS_ARCH
),PPC
)
128 SRCS_X
+= common
/ppc
/dct.c \
129 common
/ppc
/deblock.c \
132 common
/ppc
/predict.c \
137 ifeq ($(SYS_ARCH
),ARM
)
138 SRCASM_X
= common
/arm
/bitstream-a.S \
140 common
/arm
/deblock-a.S \
142 common
/arm
/pixel-a.S \
143 common
/arm
/predict-a.S \
145 SRCS_X
+= common
/arm
/mc-c.c \
146 common
/arm
/predict-c.c
148 OBJASM
+= common
/arm
/cpu-a.o
149 ifneq ($(findstring HAVE_BITDEPTH8
1, $(CONFIG
)),)
150 OBJASM
+= $(SRCASM_X
:%.S
=%-8.o
)
152 ifneq ($(findstring HAVE_BITDEPTH10
1, $(CONFIG
)),)
153 OBJASM
+= $(SRCASM_X
:%.S
=%-10.o
)
156 OBJCHK
+= tools
/checkasm-arm.o
159 # AArch64 NEON optims
160 ifeq ($(SYS_ARCH
),AARCH64
)
161 SRCASM_X
= common
/aarch64
/bitstream-a.S \
162 common
/aarch64
/cabac-a.S \
163 common
/aarch64
/dct-a.S \
164 common
/aarch64
/deblock-a.S \
165 common
/aarch64
/mc-a.S \
166 common
/aarch64
/pixel-a.S \
167 common
/aarch64
/predict-a.S \
168 common
/aarch64
/quant-a.S
169 SRCS_X
+= common
/aarch64
/asm-offsets.c \
170 common
/aarch64
/mc-c.c \
171 common
/aarch64
/predict-c.c
174 ifneq ($(findstring HAVE_BITDEPTH8
1, $(CONFIG
)),)
175 OBJASM
+= $(SRCASM_X
:%.S
=%-8.o
)
177 ifneq ($(findstring HAVE_BITDEPTH10
1, $(CONFIG
)),)
178 OBJASM
+= $(SRCASM_X
:%.S
=%-10.o
)
181 OBJCHK
+= tools
/checkasm-aarch64.o
185 ifeq ($(SYS_ARCH
),MIPS
)
186 ifneq ($(findstring HAVE_MSA
1, $(CONFIG
)),)
187 SRCS_X
+= common
/mips
/dct-c.c \
188 common
/mips
/deblock-c.c \
190 common
/mips
/pixel-c.c \
191 common
/mips
/predict-c.c \
192 common
/mips
/quant-c.c
198 ifneq ($(HAVE_GETOPT_LONG
),1)
199 SRCCLI
+= extras
/getopt.c
202 ifeq ($(SYS
),WINDOWS
)
203 OBJCLI
+= $(if
$(RC
), x264res.o
)
206 OBJSO
+= $(if
$(RC
), x264res.dll.o
)
210 ifeq ($(HAVE_OPENCL
),yes
)
211 common
/oclobj.h
: common
/opencl
/x264-cl.h
$(wildcard $(SRCPATH
)/common
/opencl
/*.cl
)
212 cat
$^ |
$(SRCPATH
)/tools
/cltostr.sh
$@
213 GENERATED
+= common
/oclobj.h
214 SRCS_8
+= common
/opencl.c encoder
/slicetype-cl.c
217 OBJS
+= $(SRCS
:%.c
=%.o
)
218 OBJCLI
+= $(SRCCLI
:%.c
=%.o
)
219 OBJSO
+= $(SRCSO
:%.c
=%.o
)
220 OBJEXAMPLE
+= $(SRCEXAMPLE
:%.c
=%.o
)
222 ifneq ($(findstring HAVE_BITDEPTH8
1, $(CONFIG
)),)
223 OBJS
+= $(SRCS_X
:%.c
=%-8.o
) $(SRCS_8
:%.c
=%-8.o
)
224 OBJCLI
+= $(SRCCLI_X
:%.c
=%-8.o
)
225 OBJCHK_8
+= $(SRCCHK_X
:%.c
=%-8.o
)
226 checkasm
: checkasm8
$(EXE
)
228 ifneq ($(findstring HAVE_BITDEPTH10
1, $(CONFIG
)),)
229 OBJS
+= $(SRCS_X
:%.c
=%-10.o
)
230 OBJCLI
+= $(SRCCLI_X
:%.c
=%-10.o
)
231 OBJCHK_10
+= $(SRCCHK_X
:%.c
=%-10.o
)
232 checkasm
: checkasm10
$(EXE
)
235 .PHONY
: all default fprofiled
clean distclean install install-
* uninstall cli lib-
* checkasm etags
238 lib-static
: $(LIBX264
)
239 lib-shared
: $(SONAME
)
241 $(LIBX264
): $(GENERATED
) .depend
$(OBJS
) $(OBJASM
)
243 $(AR
)$@
$(OBJS
) $(OBJASM
)
244 $(if
$(RANLIB
), $(RANLIB
) $@
)
246 $(SONAME
): $(GENERATED
) .depend
$(OBJS
) $(OBJASM
) $(OBJSO
)
247 $(LD
)$@
$(OBJS
) $(OBJASM
) $(OBJSO
) $(SOFLAGS
) $(LDFLAGS
)
250 .PHONY
: x264 checkasm8 checkasm10 example
252 checkasm8
: checkasm8
$(EXE
)
253 checkasm10
: checkasm10
$(EXE
)
254 example
: example
$(EXE
)
257 x264
$(EXE
): $(GENERATED
) .depend
$(OBJCLI
) $(CLI_LIBX264
)
258 $(LD
)$@
$(OBJCLI
) $(CLI_LIBX264
) $(LDFLAGSCLI
) $(LDFLAGS
)
260 checkasm8
$(EXE
): $(GENERATED
) .depend
$(OBJCHK
) $(OBJCHK_8
) $(LIBX264
)
261 $(LD
)$@
$(OBJCHK
) $(OBJCHK_8
) $(LIBX264
) $(LDFLAGS
)
263 checkasm10
$(EXE
): $(GENERATED
) .depend
$(OBJCHK
) $(OBJCHK_10
) $(LIBX264
)
264 $(LD
)$@
$(OBJCHK
) $(OBJCHK_10
) $(LIBX264
) $(LDFLAGS
)
266 example
$(EXE
): $(GENERATED
) .depend
$(OBJEXAMPLE
) $(LIBX264
)
267 $(LD
)$@
$(OBJEXAMPLE
) $(LIBX264
) $(LDFLAGS
)
269 $(OBJS
) $(OBJASM
) $(OBJSO
) $(OBJCLI
) $(OBJCHK
) $(OBJCHK_8
) $(OBJCHK_10
) $(OBJEXAMPLE
): .depend
272 $(CC
) $(CFLAGS
) -c
$< $(CC_O
)
275 $(CC
) $(CFLAGS
) -c
$< $(CC_O
) -DHIGH_BIT_DEPTH
=0 -DBIT_DEPTH
=8
278 $(CC
) $(CFLAGS
) -c
$< $(CC_O
) -DHIGH_BIT_DEPTH
=1 -DBIT_DEPTH
=10
280 %.o
: %.asm common
/x86
/x86inc.asm common
/x86
/x86util.asm
281 $(AS
) $(ASFLAGS
) -o
$@
$<
282 -@
$(if
$(STRIP
), $(STRIP
) -x
$@
) # delete local/anonymous symbols, so they don't show up in oprofile
284 %-8.o
: %.asm common
/x86
/x86inc.asm common
/x86
/x86util.asm
285 $(AS
) $(ASFLAGS
) -o
$@
$< -DBIT_DEPTH
=8 -Dprivate_prefix
=x264_8
286 -@
$(if
$(STRIP
), $(STRIP
) -x
$@
)
288 %-10.o
: %.asm common
/x86
/x86inc.asm common
/x86
/x86util.asm
289 $(AS
) $(ASFLAGS
) -o
$@
$< -DBIT_DEPTH
=10 -Dprivate_prefix
=x264_10
290 -@
$(if
$(STRIP
), $(STRIP
) -x
$@
)
293 $(AS
) $(ASFLAGS
) -o
$@
$<
294 -@
$(if
$(STRIP
), $(STRIP
) -x
$@
) # delete local/anonymous symbols, so they don't show up in oprofile
297 $(AS
) $(ASFLAGS
) -o
$@
$< -DHIGH_BIT_DEPTH
=0 -DBIT_DEPTH
=8
298 -@
$(if
$(STRIP
), $(STRIP
) -x
$@
)
301 $(AS
) $(ASFLAGS
) -o
$@
$< -DHIGH_BIT_DEPTH
=1 -DBIT_DEPTH
=10
302 -@
$(if
$(STRIP
), $(STRIP
) -x
$@
)
305 $(RC
) $(RCFLAGS
)$@
-DDLL
$<
308 $(RC
) $(RCFLAGS
)$@
$<
312 @echo
'dependency file generation...'
313 ifeq ($(COMPILER
),CL
)
314 @
$(foreach SRC
, $(addprefix $(SRCPATH
)/, $(SRCS
) $(SRCCLI
) $(SRCSO
) $(SRCEXAMPLE
)), $(SRCPATH
)/tools
/msvsdepend.sh
"$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%.o)" 1>> .depend
;)
315 ifneq ($(findstring HAVE_BITDEPTH8
1, $(CONFIG
)),)
316 @
$(foreach SRC
, $(addprefix $(SRCPATH
)/, $(SRCS_X
) $(SRCS_8
) $(SRCCLI_X
) $(SRCCHK_X
)), $(SRCPATH
)/tools
/msvsdepend.sh
"$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-8.o)" 1>> .depend
;)
318 ifneq ($(findstring HAVE_BITDEPTH10
1, $(CONFIG
)),)
319 @
$(foreach SRC
, $(addprefix $(SRCPATH
)/, $(SRCS_X
) $(SRCCLI_X
) $(SRCCHK_X
)), $(SRCPATH
)/tools
/msvsdepend.sh
"$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-10.o)" 1>> .depend
;)
322 @
$(foreach SRC
, $(addprefix $(SRCPATH
)/, $(SRCS
) $(SRCCLI
) $(SRCSO
) $(SRCEXAMPLE
)), $(CC
) $(CFLAGS
) $(SRC
) $(DEPMT
) $(SRC
:$(SRCPATH
)/%.c
=%.o
) $(DEPMM
) 1>> .depend
;)
323 ifneq ($(findstring HAVE_BITDEPTH8
1, $(CONFIG
)),)
324 @
$(foreach SRC
, $(addprefix $(SRCPATH
)/, $(SRCS_X
) $(SRCS_8
) $(SRCCLI_X
) $(SRCCHK_X
)), $(CC
) $(CFLAGS
) $(SRC
) $(DEPMT
) $(SRC
:$(SRCPATH
)/%.c
=%-8.o
) $(DEPMM
) 1>> .depend
;)
326 ifneq ($(findstring HAVE_BITDEPTH10
1, $(CONFIG
)),)
327 @
$(foreach SRC
, $(addprefix $(SRCPATH
)/, $(SRCS_X
) $(SRCCLI_X
) $(SRCCHK_X
)), $(CC
) $(CFLAGS
) $(SRC
) $(DEPMT
) $(SRC
:$(SRCPATH
)/%.c
=%-10.o
) $(DEPMM
) 1>> .depend
;)
335 ifneq ($(wildcard .depend
),)
339 OBJPROF
= $(OBJS
) $(OBJCLI
)
340 # These should cover most of the important codepaths
341 OPT0
= --crf
30 -b1
-m1
-r1
--me dia
--no-cabac
--direct temporal
--ssim
--no-weightb
342 OPT1
= --crf
16 -b2
-m3
-r3
--me hex
--no-8x8dct
--direct spatial
--no-dct-decimate
-t0
--slice-max-mbs
50
343 OPT2
= --crf
26 -b4
-m5
-r2
--me hex
--cqm jvt
--nr
100 --psnr
--no-mixed-refs
--b-adapt
2 --slice-max-size
1500
344 OPT3
= --crf
18 -b3
-m9
-r5
--me umh
-t1
-A
all --b-pyramid normal
--direct auto
--no-fast-pskip
--no-mbtree
345 OPT4
= --crf
22 -b3
-m7
-r4
--me esa
-t2
-A
all --psy-rd
1.0:1.0 --slices
4
346 OPT5
= --frames
50 --crf
24 -b3
-m10
-r3
--me tesa
-t2
347 OPT6
= --frames
50 -q0
-m9
-r2
--me hex
-Aall
348 OPT7
= --frames
50 -q0
-m2
-r1
--me hex
--no-cabac
352 @echo
'usage: make fprofiled VIDS="infile1 infile2 ..."'
353 @echo
'where infiles are anything that x264 understands,'
354 @echo
'i.e. YUV with resolution in the filename, y4m, or avisynth.'
357 $(MAKE
) x264
$(EXE
) CFLAGS
="$(CFLAGS) $(PROF_GEN_CC)" LDFLAGS
="$(LDFLAGS) $(PROF_GEN_LD)"
358 $(foreach V
, $(VIDS
), $(foreach I
, 0 1 2 3 4 5 6 7, .
/x264
$(EXE
) $(OPT
$I) --threads
1 $(V
) -o
$(DEVNULL
) ;))
359 ifeq ($(COMPILER
),CL
)
360 # Because Visual Studio timestamps the object files within the PGD, it fails to build if they change - only the executable should be deleted
365 $(MAKE
) CFLAGS
="$(CFLAGS) $(PROF_USE_CC)" LDFLAGS
="$(LDFLAGS) $(PROF_USE_LD)"
366 rm -f
$(OBJPROF
:%.o
=%.gcda
) $(OBJPROF
:%.o
=%.gcno
) *.dyn pgopti.dpi pgopti.dpi.lock
*.pgd
*.pgc
370 rm -f
$(OBJS
) $(OBJASM
) $(OBJCLI
) $(OBJSO
) $(GENERATED
) .depend TAGS
371 rm -f
$(SONAME
) *.a
*.lib
*.exp
*.pdb x264
$(EXE
) x264_lookahead.clbin
372 rm -f checkasm8
$(EXE
) checkasm10
$(EXE
) $(OBJCHK
) $(OBJCHK_8
) $(OBJCHK_10
)
373 rm -f example
$(EXE
) $(OBJEXAMPLE
)
374 rm -f
$(OBJPROF
:%.o
=%.gcda
) $(OBJPROF
:%.o
=%.gcno
) *.dyn pgopti.dpi pgopti.dpi.lock
*.pgd
*.pgc
377 rm -f config.mak x264_config.h config.h config.log x264.
pc x264.def
381 $(INSTALL
) -d
$(DESTDIR
)$(bindir)
382 $(INSTALL
) x264
$(EXE
) $(DESTDIR
)$(bindir)
385 $(INSTALL
) -d
$(DESTDIR
)$(includedir) $(DESTDIR
)$(libdir)/pkgconfig
386 $(INSTALL
) -m
644 $(SRCPATH
)/x264.h x264_config.h
$(DESTDIR
)$(includedir)
387 $(INSTALL
) -m
644 x264.
pc $(DESTDIR
)$(libdir)/pkgconfig
389 install-lib-static
: lib-static install-lib-dev
390 $(INSTALL
) -d
$(DESTDIR
)$(libdir)
391 $(INSTALL
) -m
644 $(LIBX264
) $(DESTDIR
)$(libdir)
392 $(if
$(RANLIB
), $(RANLIB
) $(DESTDIR
)$(libdir)/$(LIBX264
))
394 install-lib-shared
: lib-shared install-lib-dev
395 $(INSTALL
) -d
$(DESTDIR
)$(libdir)
396 ifneq ($(IMPLIBNAME
),)
397 $(INSTALL
) -d
$(DESTDIR
)$(bindir)
398 $(INSTALL
) -m
755 $(SONAME
) $(DESTDIR
)$(bindir)
399 $(INSTALL
) -m
644 $(IMPLIBNAME
) $(DESTDIR
)$(libdir)
400 else ifneq ($(SONAME
),)
401 ln
-f
-s
$(SONAME
) $(DESTDIR
)$(libdir)/libx264.
$(SOSUFFIX
)
402 $(INSTALL
) -m
755 $(SONAME
) $(DESTDIR
)$(libdir)
406 rm -f
$(DESTDIR
)$(includedir)/x264.h
$(DESTDIR
)$(includedir)/x264_config.h
$(DESTDIR
)$(libdir)/libx264.a
407 rm -f
$(DESTDIR
)$(bindir)/x264
$(EXE
) $(DESTDIR
)$(libdir)/pkgconfig
/x264.
pc
408 ifneq ($(IMPLIBNAME
),)
409 rm -f
$(DESTDIR
)$(bindir)/$(SONAME
) $(DESTDIR
)$(libdir)/$(IMPLIBNAME
)
410 else ifneq ($(SONAME
),)
411 rm -f
$(DESTDIR
)$(libdir)/$(SONAME
) $(DESTDIR
)$(libdir)/libx264.
$(SOSUFFIX
)
415 etags
$(SRCS
) $(SRCS_X
) $(SRCS_8
)