chromium/media/parsers/jpeg_parser.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "media/parsers/jpeg_parser.h"

#include <cstring>

#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/containers/span_reader.h"
#include "base/logging.h"

#define READ_U8_OR_RETURN_FALSE(out)

#define READ_U16_OR_RETURN_FALSE(out)

namespace media {

const JpegHuffmanTable kDefaultDcTable[kJpegMaxHuffmanTableNumBaseline] =;

const JpegHuffmanTable kDefaultAcTable[kJpegMaxHuffmanTableNumBaseline] =;

constexpr uint8_t kZigZag8x8[64] =;

constexpr JpegQuantizationTable kDefaultQuantTable[2] =;

static bool InRange(int value, int a, int b) {}

// Round up |value| to multiple of |mul|. |value| must be non-negative.
// |mul| must be positive.
static int RoundUp(int value, int mul) {}

// |frame_header| is already initialized to 0 in ParseJpegPicture.
static bool ParseSOF(base::span<const uint8_t> buffer,
                     JpegFrameHeader* frame_header) {}

// |q_table| is already initialized to 0 in ParseJpegPicture.
static bool ParseDQT(base::span<const uint8_t> buffer,
                     JpegQuantizationTable* q_table) {}

// |dc_table| and |ac_table| are already initialized to 0 in ParseJpegPicture.
static bool ParseDHT(base::span<const uint8_t> buffer,
                     JpegHuffmanTable* dc_table,
                     JpegHuffmanTable* ac_table) {}

static bool ParseDRI(base::span<const uint8_t> buffer,
                     uint16_t* restart_interval) {}

// |scan| is already initialized to 0 in ParseJpegPicture.
static bool ParseSOS(base::span<const uint8_t> buffer,
                     const JpegFrameHeader& frame_header,
                     JpegScanHeader* scan) {}

// |eoi_begin_ptr| will point to the beginning of the EOI marker (the FF byte)
// and |eoi_end_ptr| will point to the end of image (right after the end of the
// EOI marker) after search succeeds. Returns true on EOI marker found, or false
// otherwise.
static bool SearchEOI(base::span<const uint8_t> buffer,
                      const char** eoi_begin_ptr,
                      const char** eoi_end_ptr) {}

// |result| is already initialized to 0 in ParseJpegPicture.
static bool ParseSOI(base::span<const uint8_t> buffer,
                     JpegParseResult* result) {}

bool ParseJpegPicture(base::span<const uint8_t> buffer,
                      JpegParseResult* result) {}

// TODO(andrescj): this function no longer seems necessary. Fix call sites to
// use ParseJpegPicture() directly.
bool ParseJpegStream(base::span<const uint8_t> buffer,
                     JpegParseResult* result) {}

}  // namespace media