Skip to content

Commit a6be42d

Browse files
committed
Meson and Makefile changes to search for libmebo, aom related libs
1 parent 95f4fc2 commit a6be42d

File tree

7 files changed

+320
-13
lines changed

7 files changed

+320
-13
lines changed

Makefile.am

+28
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@ if ENABLE_TESTS
3838
SUBDIRS += test
3939
endif
4040

41+
#libmebo and libaom_av1_rc support
42+
if ENABLE_MEBO
43+
MEBO_SUPPORT = yes
44+
endif
45+
46+
if ENABLE_AOM_AV1_RC
47+
AOM_AV1_RC_SUPPORT = yes
48+
endif
49+
50+
if ENABLE_BRC
51+
BRC_SUPPORT = yes
52+
endif
53+
54+
if ENABLE_BRC_CONTROLLER
55+
BRC_CONTROLLER_SUPPORT = yes
56+
endif
57+
58+
export DL_LIBS
59+
60+
MEBO_LOCAL_PATH = $(abs_top_srcdir)/encode/libmebo/libs
61+
AOM_AV1_RC_LOCAL_PATH = $(abs_top_srcdir)/encode/aom_libs/
62+
SYSTEM_LIBS_DIR = /usr/local/lib/x86_64-linux-gnu/
63+
64+
export MEBO_LOCAL_PATH
65+
export AOM_AV1_RC_LOCAL_PATH
66+
export SYSTEM_LIBS_DIR
67+
68+
4169
# Extra clean files so that maintainer-clean removes *everything*
4270
MAINTAINERCLEANFILES = \
4371
aclocal.m4 compile config.guess config.sub \

configure.ac

+150
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,156 @@ AC_ARG_ENABLE([tests],
9393
[build unit tests @<:@default=no@:>@])],
9494
[], [enable_tests="no"])
9595

96+
AC_ARG_ENABLE(mebo,
97+
[AC_HELP_STRING([--enable-mebo],
98+
[Enable LibMebo Support @<:@default=yes@:>@])],
99+
[], [enable_mebo="yes"])
100+
101+
AC_ARG_ENABLE(aom_av1_rc,
102+
[AC_HELP_STRING([--enable-aom_av1_rc],
103+
[Enable AOM AV1 RC Support @<:@default=yes@:>@])],
104+
[], [enable_aom_av1_rc="yes"])
105+
106+
AC_ARG_ENABLE(brc,
107+
[AC_HELP_STRING([--enable-brc],
108+
[Enable Bitrate RC for VP9,VP8 Support
109+
@<:@default=yes@:>@])],
110+
[], [enable_brc="yes"])
111+
112+
AC_ARG_ENABLE(brc_controller,
113+
[AC_HELP_STRING([--enable-brc_controller],
114+
[Enable Bitrate RC_controller
115+
to support libmebo @<:@default=yes@:>@])],
116+
[], [enable_brc_controller="yes"])
117+
118+
#check for LibMebo library
119+
MEBO_LIBDIR=""
120+
abs_srcdir="$(cd "$srcdir" && pwd)"
121+
if test "x$enable_mebo" != "xno" ; then
122+
#local path
123+
if test -f "$srcdir/encode/libmebo/libs/libmebo.so"; then
124+
MEBO_LIBDIR="${abs_srcdir}/encode/libmebo/libs"
125+
AC_DEFINE([HAVE_MEBO], [1], [Define if MEBO is available])
126+
AC_MSG_NOTICE([MEBO LIB INSTALLED in local path])
127+
else
128+
AC_MSG_NOTICE([Mebo LIB NOT INSTALLED in local path])
129+
#system path
130+
if test -f "/usr/local/lib/x86_64-linux-gnu/libmebo.so" ; then
131+
MEBO_LIBDIR="/usr/local/lib/x86_64-linux-gnu"
132+
AC_DEFINE([HAVE_MEBO], [1], [Define if MEBO is available])
133+
AC_MSG_NOTICE([MEBO LIB INSTALLED in SYSTEM path])
134+
else
135+
AC_MSG_NOTICE([Mebo LIB NOT INSTALLED in system path])
136+
if test "x$enable_mebo"="xyes"; then
137+
AC_MSG_ERROR(
138+
[LibMebo NOT installed in local path nor in system paths])
139+
fi
140+
fi
141+
fi
142+
fi
143+
AC_SUBST([MEBO_LIBDIR])
144+
145+
#CHECK FOR AOM AV1 RC library
146+
AOM_AV1_RC_LIBDIR=""
147+
if test "x$enable_aom_av1_rc" != "xno" ; then
148+
#local path
149+
if test -f "$srcdir/encode/libmebo/libs/aom_libs/libaom_av1_rc.so"; then
150+
AOM_AV1_RC_LIBDIR="${abs_srcdir}/encode/libmebo/libs/aom_libs/"
151+
AC_DEFINE([HAVE_AOM_AV1_RC], [1], [Define if AOM AV1 RC is available])
152+
AC_MSG_NOTICE([AOM AV1 RC LIB INSTALLED in local path])
153+
else
154+
AC_MSG_NOTICE([AOM AV1 RC LIB NOT INSTALLED in local path])
155+
#system path
156+
if test -f "/usr/local/lib/x86_64-linux-gnu/libaom_av1_rc.so" ; then
157+
AOM_AV1_RC_LIBDIR="/usr/local/lib/x86_64-linux-gnu"
158+
AC_DEFINE([HAVE_AOM_AV1_RC], [1], [Define if AOM AV1 RC
159+
is available])
160+
AC_MSG_NOTICE([AOM AV1 RC LIB INSTALLED in SYSTEM path])
161+
else
162+
AC_MSG_NOTICE([AOM AV1 RC LIB NOT INSTALLED in system path])
163+
if test "x$enable_aom_av1_rc"="xyes"; then
164+
AC_MSG_ERROR(
165+
[AOM AV1 RC NOT installed in local path nor in system paths])
166+
fi
167+
fi
168+
fi
169+
fi
170+
AC_SUBST([AOM_AV1_RC_LIBDIR])
171+
172+
173+
#Check for brc library
174+
BRC_LIBDIR=""
175+
if test "x$enable_brc" != "xno" ; then
176+
#local path
177+
if test -f "$srcdir/encode/libmebo/libs/libbrc.so"; then
178+
BRC_LIBDIR="${abs_srcdir}/encode/libmebo/libs"
179+
AC_DEFINE([HAVE_BRC], [1], [Define if BRC is available])
180+
AC_MSG_NOTICE([BRC LIB INSTALLED in local path])
181+
else
182+
AC_MSG_NOTICE([BRC LIB NOT INSTALLED in local path])
183+
#system path
184+
if test -f "/usr/local/lib/x86_64-linux-gnu/libbrc.so" ; then
185+
BRC_LIBDIR="/usr/local/lib/x86_64-linux-gnu"
186+
AC_DEFINE([HAVE_BRC], [1], [Define if BRC is available])
187+
AC_MSG_NOTICE([BRC LIB INSTALLED in SYSTEM path])
188+
else
189+
AC_MSG_NOTICE([BRC LIB NOT INSTALLED in system path])
190+
if test "x$enable_brc"="xyes"; then
191+
AC_MSG_ERROR(
192+
[BRC NOT installed in local path nor in system paths])
193+
fi
194+
fi
195+
fi
196+
fi
197+
AC_SUBST([BRC_LIBDIR])
198+
199+
#Check for brc_controller library
200+
BRC_CONTROLLER_LIBDIR=""
201+
if test "x$enable_brc_controller" != "xno" ; then
202+
#local path
203+
if test -f "$srcdir/encode/libmebo/libs/libbrc_controller.so"; then
204+
BRC_CONTROLLER_LIBDIR="${abs_srcdir}/encode/libmebo/libs"
205+
AC_DEFINE([HAVE_BRC_CONTROLLER], [1], [Define if BRC_CONTROLLER
206+
is available])
207+
AC_MSG_NOTICE([BRC_CONTROLLER LIB INSTALLED in local path])
208+
else
209+
AC_MSG_NOTICE([BRC_CONTROLLER LIB NOT INSTALLED in local path])
210+
#system path
211+
if test -f "/usr/local/lib/x86_64-linux-gnu/libbrc_controller.so" ; then
212+
BRC_CONTROLLER_LIBDIR="/usr/local/lib/x86_64-linux-gnu"
213+
AC_DEFINE([HAVE_BRC_CONTROLLER], [1], [Define if BRC_CONTROLLER
214+
is available])
215+
AC_MSG_NOTICE([BRC_CONTROLLER LIB INSTALLED in SYSTEM path])
216+
else
217+
AC_MSG_NOTICE([BRC LIB NOT INSTALLED in system path])
218+
if test "x$enable_brc_controller"="xyes"; then
219+
AC_MSG_ERROR(
220+
[BRC_CONTROLLER NOT installed in local path nor
221+
in system paths])
222+
fi
223+
fi
224+
fi
225+
fi
226+
AC_SUBST([BRC_CONTROLLER_LIBDIR])
227+
228+
# configure for ldl lib
229+
AC_CHECK_LIB([dl], [dlopen],
230+
[DL_LIBS= "-ldl",
231+
AC_DEFINE([HAVE_DLOPEN], [1], [Define if dlopen is available])],
232+
[AC_MSG_ERROR([Unable to find library support dlopen, dlsym])])
233+
AC_SUBST([DL_LIBS])
234+
235+
#libs path
236+
AC_MSG_NOTICE([LIBRARY PATHS ARE set to])
237+
AC_MSG_NOTICE([MEBO_LIBDIR is set to :${MEBO_LIBDIR}])
238+
AC_MSG_NOTICE([AOM_AV1_RC_LIBDIR is set to :${AOM_AV1_RC_LIBDIR}])
239+
AC_MSG_NOTICE([BRC_LIBDIR is set to :${BRC_LIBDIR}])
240+
AC_MSG_NOTICE([BRC_CONTROLLER is set to :${BRC_CONTROLLER_LIBDIR}])
241+
242+
AM_CONDITIONAL([ENABLE_MEBO], [test "x$MEBO_LIBDIR"!="x"])
243+
AM_CONDITIONAL([ENABLE_AOM_AV1_RC], [test "x$AOM_AV1_RC_LIBDIR"!="x"])
244+
AM_CONDITIONAL([ENABLE_BRC], [test "x$BRC_LIBDIR"!="x"])
245+
AM_CONDITIONAL([ENABLE_BRC_CONTROLLER], [test "x$BRC_CONTROLLER_LIBDIR"!="x"])
96246

97247
LT_INIT
98248
AC_DISABLE_STATIC

encode/Makefile.am

+9-3
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,22 @@ vp8enc_LDADD = \
8989
$(top_builddir)/common/libva-display.la \
9090
-lpthread -lm
9191

92+
AUTOMAKE_OPTIONS =subdir-objects
93+
9294
av1encode_SOURCES = av1encode.c
9395
av1encode_SOURCES += libmebo/libmebo_interface.cc
9496
av1encode_CFLAGS = -I$(top_srcdir)/common -g
9597
av1encode_LDADD = \
9698
$(LIBVA_LIBS) \
9799
$(top_builddir)/common/libva-display.la \
98100
-lpthread -lm \
99-
-ldl \
100-
-lmebo \
101-
-laom_av1_rc
101+
-L$(MEBO_LIBDIR)-lmebo \
102+
-L$(BRC_LIBDIR)-lbrc \
103+
-L$(BRC_CONTROLLER_LIBDIR)-lbrc_controller \
104+
-L$(AOM_AV1_RC_LIBDIR)-laom_av1_rc \
105+
-ldl
106+
107+
102108

103109
valgrind: $(bin_PROGRAMS) $(noinst_PROGRAMS)
104110
for a in $(bin_PROGRAMS) $(noinst_PROGRAMS); do \

encode/av1encode.c

-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@
5858
* */
5959
#define BITSTREAM_ALLOCATE_STEPPING 1024 // in byte
6060

61-
#define SWBRC 1
62-
6361
struct __bitstream {
6462
uint8_t *buffer; // managed by u8 to avoid swap every 4byte
6563
int bit_offset;

encode/meson.build

+20-8
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,30 @@ executable('vp8enc', [ 'vp8enc.c' ],
2828
c_compiler = meson.get_compiler('c')
2929
cpp_compiler = meson.get_compiler('cpp')
3030

31-
mebo_cpp = cpp_compiler.find_library('mebo')
32-
aom_av1_rc_cpp = cpp_compiler.find_library('aom_av1_rc')
33-
34-
mebo_c = c_compiler.find_library('mebo')
35-
aom_av1_rc_c = c_compiler.find_library('aom_av1_rc')
36-
3731
dl = c.find_library('dl')
3832
dl_dep_cpp = cpp_compiler.find_library('dl', required:true)
3933

34+
4035
if libva_dep.version().version_compare('>= 1.14.0')
36+
37+
av1_deps = [libva_display_dep, threads, m, dl, dl_dep_cpp]
38+
if use_mebo and mebo_dep.found()
39+
av1_deps += mebo_dep
40+
endif
41+
42+
if use_aom_av1_rc and aom_av1_rc_dep.found()
43+
av1_deps += aom_av1_rc_dep
44+
endif
45+
46+
if use_brc and brc_dep.found()
47+
av1_deps += brc_dep
48+
endif
49+
50+
if use_brc_controller and brc_controller_dep.found()
51+
av1_deps += brc_controller_dep
52+
endif
53+
4154
executable('av1encode', [ 'av1encode.c', 'libmebo/libmebo_interface.cc' ],
42-
dependencies: [ libva_display_dep, threads, m, dl, dl_dep_cpp,
43-
mebo_cpp, mebo_c, aom_av1_rc_cpp, aom_av1_rc_c],
55+
dependencies: av1_deps,
4456
install: true)
4557
endif

meson.build

+102
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,108 @@ libva_utils_flags = [ '-Wno-unused-parameter',
1919

2020
backends = ''
2121

22+
c_compiler = meson.get_compiler('c')
23+
cpp_compiler = meson.get_compiler('cpp')
24+
25+
#Add Mebo support
26+
use_mebo = false
27+
if get_option('mebo') != 'disabled'
28+
require_mebo = get_option('mebo') == 'enabled'
29+
local_mebo_path = join_paths(meson.current_source_dir(),
30+
'encode', 'libmebo', 'libs')
31+
mebo_dep = cpp_compiler.find_library('mebo',
32+
dirs :[local_mebo_path,
33+
'/usr/local/lib/x86_64-linux-gnu'],
34+
required:false)
35+
if not mebo_dep.found() and require_mebo
36+
error('''LibMebo library not installed in local path or system:
37+
local path=/encode/libmebo/libs''')
38+
endif
39+
40+
if mebo_dep.found()
41+
use_mebo = true
42+
message('mebo library found')
43+
libva_utils_flags += ['-DHAVE_MEBO=1']
44+
endif
45+
if not mebo_dep.found()
46+
error('LibMebo not installed')
47+
endif
48+
endif
49+
50+
use_brc = false
51+
if get_option('brc') != 'disabled'
52+
require_brc = get_option('brc') == 'enabled'
53+
local_brc_path = join_paths(meson.current_source_dir(),
54+
'encode', 'libmebo', 'libs')
55+
brc_dep = cpp_compiler.find_library('brc',
56+
dirs :[local_brc_path,
57+
'/usr/local/lib/x86_64-linux-gnu'],
58+
required:false)
59+
if not brc_dep.found() and require_brc
60+
error('''Libbrc library not installed in local path or system:
61+
local path=/encode/libmebo/libs''')
62+
endif
63+
64+
if brc_dep.found()
65+
use_brc = true
66+
message('brc library found')
67+
libva_utils_flags += ['-DHAVE_BRC=1']
68+
endif
69+
if not brc_dep.found()
70+
error('LIBBRC not installed')
71+
endif
72+
endif
73+
74+
use_brc_controller = false
75+
if get_option('brc_controller') != 'disabled'
76+
require_brc_controller = get_option('brc_controller') == 'enabled'
77+
local_brc_controller_path = join_paths(meson.current_source_dir(),
78+
'encode', 'libmebo', 'libs')
79+
brc_controller_dep = cpp_compiler.find_library('brc_controller',
80+
dirs :[local_brc_controller_path,
81+
'/usr/local/lib/x86_64-linux-gnu'],
82+
required:false)
83+
if not brc_controller_dep.found() and require_brc_controller
84+
error('Libbrc_controller library not installed in local path or system:
85+
local path=/encode/libmebo/libs')
86+
endif
87+
88+
if brc_controller_dep.found()
89+
use_brc_controller = true
90+
message('Libbrc_controller library found')
91+
libva_utils_flags += ['-DHAVE_BRC=1']
92+
endif
93+
if not brc_controller_dep.found()
94+
error('Libbrc_controller not installed')
95+
endif
96+
endif
97+
98+
#Add AOM_AV1_RC support
99+
use_aom_av1_rc = false
100+
if get_option('aom_av1_rc') != 'disabled'
101+
require_aom_av1_rc = get_option('aom_av1_rc') == 'enabled'
102+
local_aom_av1_rc_path = join_paths(meson.current_source_dir(),
103+
'encode', 'libs', 'aom_libs')
104+
aom_av1_rc_dep = cpp_compiler.find_library('aom_av1_rc',
105+
dirs :[local_aom_av1_rc_path,
106+
'/usr/local/lib/x86_64-linux-gnu'],
107+
required:false)
108+
if not aom_av1_rc_dep.found() and require_aom_av1_rc
109+
error('''libaom_av1_rc.so not installed in local path or system:
110+
local path= encode/libmebo/libs/aom_libs''')
111+
endif
112+
113+
if aom_av1_rc_dep.found()
114+
use_aom_av1_rc = true
115+
message('aom_av1_rc library found ')
116+
libva_utils_flags += ['-DHAVE_AOM_AV1_RC=1']
117+
endif
118+
119+
if not aom_av1_rc_dep.found()
120+
error('Lib AOM AV1 RC not installed')
121+
endif
122+
endif
123+
22124
# DRM
23125
use_drm = false
24126
drm_deps=[]

meson_options.txt

+11
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ option('win32',
1717
option('tests',
1818
type : 'boolean',
1919
value : false)
20+
option ('mebo', type: 'feature', value: 'enabled',
21+
description: 'Enable LibMebo library support')
22+
23+
option ('aom_av1_rc', type: 'feature', value: 'enabled',
24+
description: 'Enable AV1 software BRC from AOM library')
25+
26+
option ('brc', type: 'feature', value: 'enabled',
27+
description: 'Enable brc to support libmebo library ')
28+
29+
option ('brc_controller', type: 'feature', value: 'enabled',
30+
description: 'Enable brc_controller to support libmebo')

0 commit comments

Comments
 (0)