aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib/strings/str_util.cc
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.cc
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.cc')
-rw-r--r--tensorflow/core/lib/strings/str_util.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/core/lib/strings/str_util.cc b/tensorflow/core/lib/strings/str_util.cc
index e9a3a8bdb4..c68e14f09f 100644
--- a/tensorflow/core/lib/strings/str_util.cc
+++ b/tensorflow/core/lib/strings/str_util.cc
@@ -25,7 +25,7 @@ namespace str_util {
static char hex_char[] = "0123456789abcdef";
-string CEscape(const string& src) {
+string CEscape(StringPiece src) {
string dest;
for (unsigned char c : src) {