Compiling google libyuv so Library

libyuv is Google's Open-Source Library for conversion, rotation and scaling between YUV and RGB. It supports compiling and execution on Windows, Linux, Mac, and other platforms, x86, x64, arm architectures, and SIMD instruction acceleration such as SSE, AVX, NEON.

download

Download address:
https://code.google.com/p/libyuv/source/checkout
perhaps
https://github.com/lemenkov/libyuv

Compile

Compiled under ubuntu:

  • android-ndk-r13b
  • git

    Download:

git clone https://github.com/lemenkov/libyuv.git

After downloading, it is libyuv, whose directory is as follows:

Configure ndk environment

gedit .bashrc
//Add ndk environment as follows
export PATH="/home/lammy/ffmpeg/android-ndk-r13b/:$PATH"
source .bashrc

New jni directory
According to other blogs, you only need to execute NDK build, but my execution always reports an error:

Android NDK: Could not find application project directory !    
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.    
/home/lammy/ffmpeg/android-ndk-r13b/build/core/build-local.mk:151: *** Android NDK: 
Aborting    .  Stop.

Later, I checked a lot of data and learned that ndk only compiles jin, so I created a new jni directory under libyuv, and then copied all the files in.

Modify Android.mk file

Replace local module: = libyuv static with local module: = libyuv
Replace include $(build & Static & Library) with include $(build & shared & Library)

# This is the Android makefile for libyuv for both platform and NDK.
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_CPP_EXTENSION := .cc

LOCAL_SRC_FILES := \
    source/compare.cc           \
    source/compare_common.cc    \
    source/compare_neon64.cc    \
    source/compare_gcc.cc       \
    source/convert.cc           \
    source/convert_argb.cc      \
    source/convert_from.cc      \
    source/convert_from_argb.cc \
    source/convert_to_argb.cc   \
    source/convert_to_i420.cc   \
    source/cpu_id.cc            \
    source/planar_functions.cc  \
    source/rotate.cc            \
    source/rotate_any.cc        \
    source/rotate_argb.cc       \
    source/rotate_common.cc     \
    source/rotate_mips.cc       \
    source/rotate_neon64.cc     \
    source/rotate_gcc.cc        \
    source/row_any.cc           \
    source/row_common.cc        \
    source/row_mips.cc          \
    source/row_neon64.cc        \
    source/row_gcc.cc           \
    source/scale.cc             \
    source/scale_any.cc         \
    source/scale_argb.cc        \
    source/scale_common.cc      \
    source/scale_mips.cc        \
    source/scale_neon64.cc      \
    source/scale_gcc.cc         \
    source/video_common.cc

# TODO(fbarchard): Enable mjpeg encoder.
#   source/mjpeg_decoder.cc
#   source/convert_jpeg.cc
#   source/mjpeg_validate.cc

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
    LOCAL_CFLAGS += -DLIBYUV_NEON
    LOCAL_SRC_FILES += \
        source/compare_neon.cc.neon    \
        source/rotate_neon.cc.neon     \
        source/row_neon.cc.neon        \
        source/scale_neon.cc.neon
endif

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include

#LOCAL_MODULE := libyuv-static
LOCAL_MODULE := libyuv
LOCAL_MODULE_TAGS := optional

# include $(BUILD_STATIC_LIBRARY)
include $(BUILD_SHARED_LIBRARY)

Then go back to the libyuv directory and execute:

ndk-build clean
ndk-build

You can see that the objeec and lib directories are generated

libs is our compiled library file

In order to use android, we have to copy the jni/include/libyuv directory. It is the header file and so together, which is convenient for the use of the underlying c of ndk.
Here's me Compiled so and header files Compressed package, welcome old fellow iron to download.

Keywords: Android git Google github

Added by DimeDropper on Sun, 05 Jan 2020 14:22:57 +0200