aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib/strings/str_util.h
diff options
context:
space:
mode:
authorGravatar Geoffrey Irving <geoffreyi@google.com>2017-05-12 11:14:24 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-05-12 11:18:28 -0700
commit04891087aa887ac744c5ec2d991314b5b3c4f78e (patch)
tree90b8492e6475034ef39420c5a6c9baf25512c985 /tensorflow/core/lib/strings/str_util.h
parent365b5c1c322df7870688d9f08320d4012ef1b6bc (diff)
Make all the image decode ops handle all formats
Too many users try to decode pngs as jpegs. Now, if you pass a png to decode_jpeg, or a gif to decode_png, it silently does what the user was expecting. Unfortunately, tf.image.decode_image still exists as a separate thing in Python, since decode_gif returns 4-D shapes incompatible with the other ops. A future CL could clean that up, but it's hard to do in a backwards compatible way. As is, decode_png and decode_jpeg will bail if you try to decode an animated gif, and produce 3-D images for nonanimated gifs. Also fix some crash-on-error bugs and memory leak bugs in gif_io.cc. RELNOTES: Make decode_jpeg/decode_png/decode_gif handle all formats, since users frequently try to decode an image as the wrong type. Fixes #9786. PiperOrigin-RevId: 155888493
Diffstat (limited to 'tensorflow/core/lib/strings/str_util.h')
-rw-r--r--tensorflow/core/lib/strings/str_util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/core/lib/strings/str_util.h b/tensorflow/core/lib/strings/str_util.h
index af24975ef4..669f0d3c52 100644
--- a/tensorflow/core/lib/strings/str_util.h
+++ b/tensorflow/core/lib/strings/str_util.h
@@ -30,7 +30,7 @@ namespace str_util {
// Returns a version of 'src' where unprintable characters have been
// escaped using C-style escape sequences.
-string CEscape(const string& src);
+string CEscape(StringPiece src);
// Copies "source" to "dest", rewriting C-style escape sequences --
// '\n', '\r', '\\', '\ooo', etc -- to their ASCII equivalents.