diff options
-rw-r--r-- | tensorflow/core/BUILD | 80 | ||||
-rw-r--r-- | tensorflow/core/kernels/BUILD | 26 | ||||
-rw-r--r-- | tensorflow/core/platform/gif.h | 2 | ||||
-rw-r--r-- | tensorflow/core/platform/jpeg.h | 2 | ||||
-rw-r--r-- | tensorflow/core/platform/png.h | 2 | ||||
-rw-r--r-- | tensorflow/examples/label_image/BUILD | 3 | ||||
-rw-r--r-- | third_party/gif.BUILD | 16 |
7 files changed, 128 insertions, 3 deletions
diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index deb2d99feb..11df834c75 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -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, diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD index 692e1c37f0..f45bb72c38 100644 --- a/tensorflow/core/kernels/BUILD +++ b/tensorflow/core/kernels/BUILD @@ -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( diff --git a/tensorflow/core/platform/gif.h b/tensorflow/core/platform/gif.h index 8a719a8cf1..9c72d34ff5 100644 --- a/tensorflow/core/platform/gif.h +++ b/tensorflow/core/platform/gif.h @@ -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 diff --git a/tensorflow/core/platform/jpeg.h b/tensorflow/core/platform/jpeg.h index f5b4deed55..edbcbd960a 100644 --- a/tensorflow/core/platform/jpeg.h +++ b/tensorflow/core/platform/jpeg.h @@ -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> diff --git a/tensorflow/core/platform/png.h b/tensorflow/core/platform/png.h index 4500d9abe2..5b0203c343 100644 --- a/tensorflow/core/platform/png.h +++ b/tensorflow/core/platform/png.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 diff --git a/tensorflow/examples/label_image/BUILD b/tensorflow/examples/label_image/BUILD index d677e58ac3..ddbcf68df8 100644 --- a/tensorflow/examples/label_image/BUILD +++ b/tensorflow/examples/label_image/BUILD @@ -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", diff --git a/third_party/gif.BUILD b/third_party/gif.BUILD index ad6821af3c..21c5c11a44 100644 --- a/third_party/gif.BUILD +++ b/third_party/gif.BUILD @@ -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"}, +) + + |