Home | History | Annotate | Download | only in gif
      1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
      2 
      3 Licensed under the Apache License, Version 2.0 (the "License");
      4 you may not use this file except in compliance with the License.
      5 You may obtain a copy of the License at
      6 
      7     http://www.apache.org/licenses/LICENSE-2.0
      8 
      9 Unless required by applicable law or agreed to in writing, software
     10 distributed under the License is distributed on an "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 See the License for the specific language governing permissions and
     13 limitations under the License.
     14 ==============================================================================*/
     15 
     16 // Functions to read and write images in GIF format.
     17 //
     18 // The advantage over image/codec/png{enc,dec}ocder.h is that this library
     19 // supports both 8 and 16 bit images.
     20 //
     21 // The decoding routine accepts binary image data as a StringPiece.  These are
     22 // implicitly constructed from strings or char* so they're completely
     23 // transparent to the caller.  They're also very cheap to construct so this
     24 // doesn't introduce any additional overhead.
     25 //
     26 // The primary benefit of StringPieces being, in this case, that APIs already
     27 // returning StringPieces (e.g., Bigtable Scanner) or Cords (e.g., IOBuffer;
     28 // only when they're flat, though) or protocol buffer fields typed to either of
     29 // these can be decoded without copying the data into a C++ string.
     30 
     31 #ifndef TENSORFLOW_CORE_LIB_GIF_GIF_IO_H_
     32 #define TENSORFLOW_CORE_LIB_GIF_GIF_IO_H_
     33 
     34 #include <functional>
     35 #include <string>
     36 #include <utility>
     37 #include <vector>
     38 
     39 #include "tensorflow/core/lib/core/stringpiece.h"
     40 #include "tensorflow/core/platform/types.h"
     41 
     42 namespace tensorflow {
     43 namespace gif {
     44 
     45 uint8* Decode(const void* srcdata, int datasize,
     46               const std::function<uint8*(int, int, int, int)>& allocate_output,
     47               string* error_string);
     48 
     49 }  // namespace gif
     50 }  // namespace tensorflow
     51 
     52 #endif  // TENSORFLOW_CORE_LIB_GIF_GIF_IO_H_
     53