blob: 2505d5832b6f1da7721ef838b8a152ba57615667 [file] [log] [blame]
Harish Mahendrakarc315d742019-04-12 16:44:11 -07001cmake_minimum_required(VERSION 3.5)
2
3set(AVC_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
4set(AVC_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
5
6if("${AVC_ROOT}" STREQUAL "${AVC_CONFIG_DIR}")
7 message(FATAL_ERROR
8 "Building from within the libavc source tree is not supported.\n"
9 "Hint: Run these commands\n" "$ rm -rf CMakeCache.txt CMakeFiles\n"
10 "$ mkdir -p ./build\n" "$ cd ./build\n"
11 "And re-run CMake from the build directory.")
12endif()
13
14set(THREADS_PREFER_PTHREAD_FLAG ON)
15find_package(Threads REQUIRED)
16set(CMAKE_STATIC_LIBRARY_PREFIX "")
17
18if (SANITIZE)
19 string(TOLOWER ${SANITIZE} SANITIZE)
20
21 SET(CMAKE_SANITIZER_C_FLAGS "-fno-omit-frame-pointer -fsanitize=${SANITIZE}")
22 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SANITIZER_C_FLAGS}")
23endif()
24
25list(APPEND LIBAVCDEC_SRCS
26"${AVC_ROOT}/common/ih264_buf_mgr.c"
27"${AVC_ROOT}/common/ih264_disp_mgr.c"
28"${AVC_ROOT}/common/ih264_inter_pred_filters.c"
29"${AVC_ROOT}/common/ih264_luma_intra_pred_filters.c"
30"${AVC_ROOT}/common/ih264_chroma_intra_pred_filters.c"
31"${AVC_ROOT}/common/ih264_padding.c"
32"${AVC_ROOT}/common/ih264_mem_fns.c"
33"${AVC_ROOT}/common/ih264_deblk_edge_filters.c"
34"${AVC_ROOT}/common/ih264_iquant_itrans_recon.c"
35"${AVC_ROOT}/common/ih264_ihadamard_scaling.c"
36"${AVC_ROOT}/common/ih264_weighted_pred.c"
37"${AVC_ROOT}/common/ithread.c"
38"${AVC_ROOT}/decoder/ih264d_cabac.c"
39"${AVC_ROOT}/decoder/ih264d_parse_mb_header.c"
40"${AVC_ROOT}/decoder/ih264d_parse_cabac.c"
41"${AVC_ROOT}/decoder/ih264d_process_intra_mb.c"
42"${AVC_ROOT}/decoder/ih264d_inter_pred.c"
43"${AVC_ROOT}/decoder/ih264d_parse_bslice.c"
44"${AVC_ROOT}/decoder/ih264d_parse_pslice.c"
45"${AVC_ROOT}/decoder/ih264d_parse_islice.c"
46"${AVC_ROOT}/decoder/ih264d_cabac_init_tables.c"
47"${AVC_ROOT}/decoder/ih264d_bitstrm.c"
48"${AVC_ROOT}/decoder/ih264d_compute_bs.c"
49"${AVC_ROOT}/decoder/ih264d_deblocking.c"
50"${AVC_ROOT}/decoder/ih264d_parse_headers.c"
51"${AVC_ROOT}/decoder/ih264d_mb_utils.c"
52"${AVC_ROOT}/decoder/ih264d_mvpred.c"
53"${AVC_ROOT}/decoder/ih264d_utils.c"
54"${AVC_ROOT}/decoder/ih264d_process_bslice.c"
55"${AVC_ROOT}/decoder/ih264d_process_pslice.c"
56"${AVC_ROOT}/decoder/ih264d_parse_slice.c"
57"${AVC_ROOT}/decoder/ih264d_quant_scaling.c"
58"${AVC_ROOT}/decoder/ih264d_parse_cavlc.c"
59"${AVC_ROOT}/decoder/ih264d_dpb_mgr.c"
60"${AVC_ROOT}/decoder/ih264d_nal.c"
61"${AVC_ROOT}/decoder/ih264d_sei.c"
62"${AVC_ROOT}/decoder/ih264d_tables.c"
63"${AVC_ROOT}/decoder/ih264d_vui.c"
64"${AVC_ROOT}/decoder/ih264d_format_conv.c"
65"${AVC_ROOT}/decoder/ih264d_thread_parse_decode.c"
66"${AVC_ROOT}/decoder/ih264d_api.c"
67"${AVC_ROOT}/decoder/ih264d_thread_compute_bs.c"
68"${AVC_ROOT}/decoder/ih264d_function_selector_generic.c"
69)
70
71list(APPEND LIBAVCDEC_X86_SRCS
72"${AVC_ROOT}/decoder/x86/ih264d_function_selector.c"
73"${AVC_ROOT}/decoder/x86/ih264d_function_selector_sse42.c"
74"${AVC_ROOT}/decoder/x86/ih264d_function_selector_ssse3.c"
75"${AVC_ROOT}/common/x86/ih264_inter_pred_filters_ssse3.c"
76"${AVC_ROOT}/common/x86/ih264_deblk_luma_ssse3.c"
77"${AVC_ROOT}/common/x86/ih264_deblk_chroma_ssse3.c"
78"${AVC_ROOT}/common/x86/ih264_padding_ssse3.c"
79"${AVC_ROOT}/common/x86/ih264_mem_fns_ssse3.c"
80"${AVC_ROOT}/common/x86/ih264_iquant_itrans_recon_dc_ssse3.c"
81"${AVC_ROOT}/common/x86/ih264_iquant_itrans_recon_ssse3.c"
82"${AVC_ROOT}/common/x86/ih264_luma_intra_pred_filters_ssse3.c"
83"${AVC_ROOT}/common/x86/ih264_chroma_intra_pred_filters_ssse3.c"
84"${AVC_ROOT}/common/x86/ih264_iquant_itrans_recon_sse42.c"
85"${AVC_ROOT}/common/x86/ih264_weighted_pred_sse42.c"
86"${AVC_ROOT}/common/x86/ih264_ihadamard_scaling_sse42.c"
87)
88
89SET(LIBAVCDEC_INCLUDES
90${AVC_ROOT}/common
91${AVC_ROOT}/decoder
92)
93
94SET(LIBAVCDEC_X86_C_FLAGS "-DX86 -DDISABLE_AVX2 -msse4.2 -mno-avx -DDEFAULT_ARCH=D_ARCH_X86_SSE42" )
95SET(LIBAVCDEC_X86_INCLUDES ${AVC_ROOT}/common/x86 ${AVC_ROOT}/decoder/x86)
96SET(LIBAVCDEC_C_FLAGS "${LIBAVCDEC_X86_C_FLAGS}")
97
98include_directories(${LIBAVCDEC_INCLUDES} ${LIBAVCDEC_X86_INCLUDES})
99add_library(libavcdec ${LIBAVCDEC_SRCS} ${LIBAVCDEC_X86_SRCS})
100set_target_properties(libavcdec PROPERTIES COMPILE_FLAGS "${LIBAVCDEC_C_FLAGS}")
101
102
103list(APPEND AVCDEC_SRCS
104"${AVC_ROOT}/test/decoder/main.c"
105)
106
107add_executable(avcdec ${AVCDEC_SRCS})
108set_target_properties(avcdec PROPERTIES COMPILE_FLAGS "-DMD5_DISABLE -DPROFILE_ENABLE")
109target_link_libraries(avcdec libavcdec Threads::Threads)
110
111list(APPEND LIBAVCENC_SRCS
112"${AVC_ROOT}/common/ih264_resi_trans_quant.c"
113"${AVC_ROOT}/common/ih264_iquant_itrans_recon.c"
114"${AVC_ROOT}/common/ih264_ihadamard_scaling.c"
115"${AVC_ROOT}/common/ih264_inter_pred_filters.c"
116"${AVC_ROOT}/common/ih264_luma_intra_pred_filters.c"
117"${AVC_ROOT}/common/ih264_chroma_intra_pred_filters.c"
118"${AVC_ROOT}/common/ih264_padding.c"
119"${AVC_ROOT}/common/ih264_mem_fns.c"
120"${AVC_ROOT}/common/ih264_deblk_edge_filters.c"
121"${AVC_ROOT}/common/ih264_deblk_tables.c"
122"${AVC_ROOT}/common/ih264_cavlc_tables.c"
123"${AVC_ROOT}/common/ih264_cabac_tables.c"
124"${AVC_ROOT}/common/ih264_common_tables.c"
125"${AVC_ROOT}/common/ih264_trans_data.c"
126"${AVC_ROOT}/common/ih264_buf_mgr.c"
127"${AVC_ROOT}/common/ih264_dpb_mgr.c"
128"${AVC_ROOT}/common/ih264_list.c"
129"${AVC_ROOT}/common/ithread.c"
130"${AVC_ROOT}/encoder/ih264e_globals.c"
131"${AVC_ROOT}/encoder/ih264e_intra_modes_eval.c"
132"${AVC_ROOT}/encoder/ih264e_half_pel.c"
133"${AVC_ROOT}/encoder/ih264e_mc.c"
134"${AVC_ROOT}/encoder/ih264e_me.c"
135"${AVC_ROOT}/encoder/ih264e_rc_mem_interface.c"
136"${AVC_ROOT}/encoder/ih264e_time_stamp.c"
137"${AVC_ROOT}/encoder/ih264e_modify_frm_rate.c"
138"${AVC_ROOT}/encoder/ih264e_rate_control.c"
139"${AVC_ROOT}/encoder/ih264e_core_coding.c"
140"${AVC_ROOT}/encoder/ih264e_deblk.c"
141"${AVC_ROOT}/encoder/ih264e_api.c"
142"${AVC_ROOT}/encoder/ih264e_process.c"
143"${AVC_ROOT}/encoder/ih264e_encode.c"
144"${AVC_ROOT}/encoder/ih264e_utils.c"
145"${AVC_ROOT}/encoder/ih264e_version.c"
146"${AVC_ROOT}/encoder/ih264e_bitstream.c"
147"${AVC_ROOT}/encoder/ih264e_cavlc.c"
148"${AVC_ROOT}/encoder/ih264e_cabac_init.c"
149"${AVC_ROOT}/encoder/ih264e_cabac.c"
150"${AVC_ROOT}/encoder/ih264e_cabac_encode.c"
151"${AVC_ROOT}/encoder/ih264e_encode_header.c"
152"${AVC_ROOT}/encoder/ih264e_function_selector_generic.c"
153"${AVC_ROOT}/encoder/ih264e_fmt_conv.c"
154"${AVC_ROOT}/encoder/irc_rate_control_api.c"
155"${AVC_ROOT}/encoder/irc_bit_allocation.c"
156"${AVC_ROOT}/encoder/irc_cbr_buffer_control.c"
157"${AVC_ROOT}/encoder/irc_est_sad.c"
158"${AVC_ROOT}/encoder/irc_fixed_point_error_bits.c"
159"${AVC_ROOT}/encoder/irc_frame_info_collector.c"
160"${AVC_ROOT}/encoder/irc_mb_model_based.c"
161"${AVC_ROOT}/encoder/irc_picture_type.c"
162"${AVC_ROOT}/encoder/irc_rd_model.c"
163"${AVC_ROOT}/encoder/irc_vbr_storage_vbv.c"
164"${AVC_ROOT}/encoder/irc_vbr_str_prms.c"
165"${AVC_ROOT}/encoder/ime.c"
166"${AVC_ROOT}/encoder/ime_distortion_metrics.c"
167)
168
169list(APPEND LIBAVCENC_X86_SRCS
170"${AVC_ROOT}/encoder/x86/ih264e_function_selector.c"
171"${AVC_ROOT}/encoder/x86/ih264e_function_selector_sse42.c"
172"${AVC_ROOT}/encoder/x86/ih264e_function_selector_ssse3.c"
173"${AVC_ROOT}/common/x86/ih264_iquant_itrans_recon_ssse3.c"
174"${AVC_ROOT}/common/x86/ih264_iquant_itrans_recon_dc_ssse3.c"
175"${AVC_ROOT}/common/x86/ih264_ihadamard_scaling_ssse3.c"
176"${AVC_ROOT}/common/x86/ih264_inter_pred_filters_ssse3.c"
177"${AVC_ROOT}/common/x86/ih264_mem_fns_ssse3.c"
178"${AVC_ROOT}/common/x86/ih264_padding_ssse3.c"
179"${AVC_ROOT}/common/x86/ih264_luma_intra_pred_filters_ssse3.c"
180"${AVC_ROOT}/common/x86/ih264_chroma_intra_pred_filters_ssse3.c"
181"${AVC_ROOT}/common/x86/ih264_deblk_chroma_ssse3.c"
182"${AVC_ROOT}/common/x86/ih264_deblk_luma_ssse3.c"
183"${AVC_ROOT}/common/x86/ih264_iquant_itrans_recon_sse42.c"
184"${AVC_ROOT}/common/x86/ih264_ihadamard_scaling_sse42.c"
185"${AVC_ROOT}/common/x86/ih264_resi_trans_quant_sse42.c"
186"${AVC_ROOT}/common/x86/ih264_weighted_pred_sse42.c"
187"${AVC_ROOT}/encoder/x86/ih264e_half_pel_ssse3.c"
188"${AVC_ROOT}/encoder/x86/ih264e_intra_modes_eval_ssse3.c"
189"${AVC_ROOT}/encoder/x86/ime_distortion_metrics_sse42.c"
190)
191
192SET(LIBAVCENC_INCLUDES
193${AVC_ROOT}/common
194${AVC_ROOT}/encoder
195)
196
197SET(LIBAVCENC_X86_C_FLAGS "-msse4.2 -mno-avx -UHP_PL -DN_MB_ENABLE" )
198SET(LIBAVCENC_C_FLAGS "${LIBAVCENC_X86_C_FLAGS}")
199SET(LIBAVCENC_X86_INCLUDES ${AVC_ROOT}/common/x86 ${AVC_ROOT}/encoder/x86)
200
201
202include_directories(${LIBAVCENC_INCLUDES} ${LIBAVCENC_X86_INCLUDES})
203add_library(libavcenc ${LIBAVCENC_SRCS} ${LIBAVCENC_X86_SRCS})
204set_target_properties(libavcenc PROPERTIES COMPILE_FLAGS "${LIBAVCENC_C_FLAGS}")
205
206list(APPEND AVCENC_SRCS
207"${AVC_ROOT}/test/encoder/main.c"
208"${AVC_ROOT}/test/encoder/psnr.c"
209"${AVC_ROOT}/test/encoder/input.c"
210"${AVC_ROOT}/test/encoder/output.c"
211"${AVC_ROOT}/test/encoder/recon.c"
212)
213
214add_executable(avcenc ${AVCENC_SRCS})
215set_target_properties(avcenc PROPERTIES COMPILE_FLAGS "-DARM -DMD5_DISABLE -DPROFILE_ENABLE")
216target_link_libraries(avcenc libavcenc Threads::Threads m)
217