PR again: Enable building label_image with jpeg/gif/png decoder for Android. (#11475)
* Enable building label_image with jpeg/gif/png decoder for Android. Add dependency "android_tesnorflow_image_op" to label_image, which is not overlapped with android_tensorflow_kernels. * Running buildifier to reformat the BUILD files for sanity check.
This commit is contained in:
parent
599165861e
commit
f40189d262
@ -1429,6 +1429,86 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "android_jpeg_internal",
|
||||
srcs = [
|
||||
"lib/jpeg/jpeg_handle.cc",
|
||||
"lib/jpeg/jpeg_mem.cc",
|
||||
"platform/jpeg.h",
|
||||
],
|
||||
hdrs = [
|
||||
"lib/core/stringpiece.h",
|
||||
"lib/jpeg/jpeg_handle.h",
|
||||
"lib/jpeg/jpeg_mem.h",
|
||||
"platform/default/dynamic_annotations.h",
|
||||
"platform/default/integral_types.h",
|
||||
"platform/default/logging.h",
|
||||
"platform/dynamic_annotations.h",
|
||||
"platform/logging.h",
|
||||
"platform/macros.h",
|
||||
"platform/mem.h",
|
||||
"platform/platform.h",
|
||||
"platform/types.h",
|
||||
],
|
||||
copts = tf_copts(),
|
||||
linkopts = ["-ldl"],
|
||||
deps = [
|
||||
"//tensorflow/core/platform/default/build_config:jpeg",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "android_gif_internal",
|
||||
srcs = [
|
||||
"lib/gif/gif_io.cc",
|
||||
"platform/gif.h",
|
||||
],
|
||||
hdrs = [
|
||||
"lib/core/stringpiece.h",
|
||||
"lib/gif/gif_io.h",
|
||||
"lib/gtl/cleanup.h",
|
||||
"platform/default/dynamic_annotations.h",
|
||||
"platform/default/integral_types.h",
|
||||
"platform/default/logging.h",
|
||||
"platform/dynamic_annotations.h",
|
||||
"platform/logging.h",
|
||||
"platform/macros.h",
|
||||
"platform/mem.h",
|
||||
"platform/platform.h",
|
||||
"platform/types.h",
|
||||
],
|
||||
copts = tf_copts(),
|
||||
linkopts = ["-ldl"],
|
||||
deps = [
|
||||
"//tensorflow/core/platform/default/build_config:gif",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "android_png_internal",
|
||||
srcs = [
|
||||
"lib/png/png_io.cc",
|
||||
"platform/png.h",
|
||||
],
|
||||
hdrs = [
|
||||
"lib/core/casts.h",
|
||||
"lib/core/stringpiece.h",
|
||||
"lib/png/png_io.h",
|
||||
"platform/cpu_info.h",
|
||||
"platform/default/integral_types.h",
|
||||
"platform/default/logging.h",
|
||||
"platform/logging.h",
|
||||
"platform/macros.h",
|
||||
"platform/platform.h",
|
||||
"platform/types.h",
|
||||
],
|
||||
copts = tf_copts(),
|
||||
linkopts = ["-ldl"],
|
||||
deps = [
|
||||
"@png_archive//:png",
|
||||
],
|
||||
)
|
||||
|
||||
proto_text_hdrs_and_srcs = tf_generate_proto_text_sources(
|
||||
name = "proto_text_srcs_all",
|
||||
srcs = CORE_PROTO_SRCS,
|
||||
|
@ -4536,6 +4536,32 @@ cc_library(
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "android_tensorflow_image_op",
|
||||
srcs = [
|
||||
"decode_image_op.cc",
|
||||
],
|
||||
copts = tf_copts(),
|
||||
linkopts = select({
|
||||
"//tensorflow:android": [
|
||||
"-ldl",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
tags = [
|
||||
"manual",
|
||||
"notap",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//tensorflow/core:android_gif_internal",
|
||||
"//tensorflow/core:android_jpeg_internal",
|
||||
"//tensorflow/core:android_png_internal",
|
||||
"//tensorflow/core:android_tensorflow_lib_lite",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
# Quantization-specific OpKernels
|
||||
|
||||
tf_kernel_library(
|
||||
|
@ -20,7 +20,7 @@ limitations under the License.
|
||||
|
||||
#if defined(PLATFORM_GOOGLE)
|
||||
#include "tensorflow/core/platform/google/build_config/gif.h"
|
||||
#elif (defined(PLATFORM_POSIX) && !defined(IS_MOBILE_PLATFORM)) || defined(PLATFORM_WINDOWS)
|
||||
#elif defined(PLATFORM_POSIX)|| defined(PLATFORM_WINDOWS) ||defined(PLATFORM_POSIX_ANDROID)
|
||||
#include <gif_lib.h>
|
||||
#else
|
||||
#error Define the appropriate PLATFORM_<foo> macro for this platform
|
||||
|
@ -20,7 +20,7 @@ limitations under the License.
|
||||
|
||||
#if defined(PLATFORM_GOOGLE)
|
||||
#include "tensorflow/core/platform/google/build_config/jpeg.h"
|
||||
#elif (defined(PLATFORM_POSIX) && !defined(IS_MOBILE_PLATFORM)) || defined(PLATFORM_WINDOWS)
|
||||
#elif defined(PLATFORM_POSIX)|| defined(PLATFORM_WINDOWS) ||defined(PLATFORM_POSIX_ANDROID)
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -20,7 +20,7 @@ limitations under the License.
|
||||
|
||||
#if defined(PLATFORM_GOOGLE)
|
||||
#include "tensorflow/core/platform/google/build_config/png.h"
|
||||
#elif (defined(PLATFORM_POSIX) && !defined(IS_MOBILE_PLATFORM)) || defined(PLATFORM_WINDOWS)
|
||||
#elif defined(PLATFORM_POSIX)|| defined(PLATFORM_WINDOWS) ||defined(PLATFORM_POSIX_ANDROID)
|
||||
#include <png.h>
|
||||
#else
|
||||
#error Define the appropriate PLATFORM_<foo> macro for this platform
|
||||
|
@ -31,6 +31,9 @@ cc_binary(
|
||||
# Jpg, gif, and png related code won't be included
|
||||
"//tensorflow/cc:cc_ops",
|
||||
"//tensorflow/core:android_tensorflow_lib",
|
||||
# cc:android_tensorflow_image_op is for including jpeg/gif/png
|
||||
# decoder to enable real-image evaluation on Android
|
||||
"//tensorflow/core/kernels:android_tensorflow_image_op",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"//tensorflow/cc:cc_ops",
|
||||
|
16
third_party/gif.BUILD
vendored
16
third_party/gif.BUILD
vendored
@ -20,6 +20,15 @@ cc_library(
|
||||
"lib/quantize.c",
|
||||
],
|
||||
hdrs = ["lib/gif_lib.h"],
|
||||
defines = select({
|
||||
#"@%ws%//tensorflow:android": [
|
||||
":android": [
|
||||
"S_IREAD=S_IRUSR",
|
||||
"S_IWRITE=S_IWUSR",
|
||||
"S_IEXEC=S_IXUSR",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
includes = ["lib/."],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = select({
|
||||
@ -54,3 +63,10 @@ config_setting(
|
||||
"cpu": "x64_windows",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "android",
|
||||
values = {"crosstool_top": "//external:android/crosstool"},
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user