libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

enc_jpeg_data_reader.h (1072B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 // Functions for reading a jpeg byte stream into a JPEGData object.
      7 
      8 #ifndef LIB_JXL_JPEG_ENC_JPEG_DATA_READER_H_
      9 #define LIB_JXL_JPEG_ENC_JPEG_DATA_READER_H_
     10 
     11 #include <stddef.h>
     12 #include <stdint.h>
     13 
     14 #include "lib/jxl/jpeg/jpeg_data.h"
     15 
     16 namespace jxl {
     17 namespace jpeg {
     18 
     19 enum class JpegReadMode {
     20   kReadHeader,  // only basic headers
     21   kReadTables,  // headers and tables (quant, Huffman, ...)
     22   kReadAll,     // everything
     23 };
     24 
     25 // Parses the JPEG stream contained in data[*pos ... len) and fills in *jpg with
     26 // the parsed information.
     27 // If mode is kReadHeader, it fills in only the image dimensions in *jpg.
     28 // Returns false if the data is not valid JPEG, or if it contains an unsupported
     29 // JPEG feature.
     30 bool ReadJpeg(const uint8_t* data, size_t len, JpegReadMode mode,
     31               JPEGData* jpg);
     32 
     33 }  // namespace jpeg
     34 }  // namespace jxl
     35 
     36 #endif  // LIB_JXL_JPEG_ENC_JPEG_DATA_READER_H_