| 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 |
#ifndef LIB_JXL_JPEG_ENC_JPEG_DATA_H_ |
| 7 |
#define LIB_JXL_JPEG_ENC_JPEG_DATA_H_ |
| 8 |
|
| 9 |
#include <jxl/memory_manager.h> |
| 10 |
|
| 11 |
#include <cstdint> |
| 12 |
#include <vector> |
| 13 |
|
| 14 |
#include "lib/jxl/base/span.h" |
| 15 |
#include "lib/jxl/base/status.h" |
| 16 |
#include "lib/jxl/color_encoding_internal.h" |
| 17 |
#include "lib/jxl/enc_params.h" |
| 18 |
#include "lib/jxl/frame_header.h" |
| 19 |
#include "lib/jxl/jpeg/jpeg_data.h" |
| 20 |
|
| 21 |
namespace jxl { |
| 22 |
|
| 23 |
class CodecInOut; |
| 24 |
|
| 25 |
namespace jpeg { |
| 26 |
Status EncodeJPEGData(JxlMemoryManager* memory_manager, JPEGData& jpeg_data, |
| 27 |
std::vector<uint8_t>* bytes, |
| 28 |
const CompressParams& cparams); |
| 29 |
|
| 30 |
Status SetColorEncodingFromJpegData(const jpeg::JPEGData& jpg, |
| 31 |
ColorEncoding* color_encoding); |
| 32 |
Status SetChromaSubsamplingFromJpegData(const JPEGData& jpg, |
| 33 |
YCbCrChromaSubsampling* cs); |
| 34 |
Status SetColorTransformFromJpegData(const JPEGData& jpg, |
| 35 |
ColorTransform* color_transform); |
| 36 |
|
| 37 |
/** |
| 38 |
* Decodes bytes containing JPEG codestream into a CodecInOut as coefficients |
| 39 |
* only, for lossless JPEG transcoding. |
| 40 |
*/ |
| 41 |
Status DecodeImageJPG(Span<const uint8_t> bytes, CodecInOut* io); |
| 42 |
|
| 43 |
} // namespace jpeg |
| 44 |
} // namespace jxl |
| 45 |
|
| 46 |
#endif // LIB_JXL_JPEG_ENC_JPEG_DATA_H_ |