chromium/third_party/libyuv/source/mjpeg_decoder.cc

/*
 *  Copyright 2012 The LibYuv Project Authors. All rights reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS. All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "libyuv/mjpeg_decoder.h"

#ifdef HAVE_JPEG
#include <assert.h>

#if !defined(__pnacl__) && !defined(__CLR_VER) && !defined(COVERAGE_ENABLED)
// Must be included before jpeglib.
#include <setjmp.h>
#define HAVE_SETJMP

#if defined(_MSC_VER)
// disable warning 4324: structure was padded due to __declspec(align())
#pragma warning(disable : 4324)
#endif

#endif

#include <stdio.h>  // For jpeglib.h.

// C++ build requires extern C for jpeg internals.
#ifdef __cplusplus
extern "C" {
#endif

#include <jpeglib.h>

#ifdef __cplusplus
}  // extern "C"
#endif

#include "libyuv/planar_functions.h"  // For CopyPlane().

namespace libyuv {

#ifdef HAVE_SETJMP
struct SetJmpErrorMgr {};
#endif

const int MJpegDecoder::kColorSpaceUnknown =;
const int MJpegDecoder::kColorSpaceGrayscale =;
const int MJpegDecoder::kColorSpaceRgb =;
const int MJpegDecoder::kColorSpaceYCbCr =;
const int MJpegDecoder::kColorSpaceCMYK =;
const int MJpegDecoder::kColorSpaceYCCK =;

// Methods that are passed to jpeglib.
boolean fill_input_buffer(jpeg_decompress_struct* cinfo);
void init_source(jpeg_decompress_struct* cinfo);
void skip_input_data(jpeg_decompress_struct* cinfo, long num_bytes);  // NOLINT
void term_source(jpeg_decompress_struct* cinfo);
void ErrorHandler(jpeg_common_struct* cinfo);
void OutputHandler(jpeg_common_struct* cinfo);

MJpegDecoder::MJpegDecoder()
    :{}

MJpegDecoder::~MJpegDecoder() {}

LIBYUV_BOOL MJpegDecoder::LoadFrame(const uint8_t* src, size_t src_len) {}

static int DivideAndRoundUp(int numerator, int denominator) {}

static int DivideAndRoundDown(int numerator, int denominator) {}

// Returns width of the last loaded frame.
int MJpegDecoder::GetWidth() {}

// Returns height of the last loaded frame.
int MJpegDecoder::GetHeight() {}

// Returns format of the last loaded frame. The return value is one of the
// kColorSpace* constants.
int MJpegDecoder::GetColorSpace() {}

// Number of color components in the color space.
int MJpegDecoder::GetNumComponents() {}

// Sample factors of the n-th component.
int MJpegDecoder::GetHorizSampFactor(int component) {}

int MJpegDecoder::GetVertSampFactor(int component) {}

int MJpegDecoder::GetHorizSubSampFactor(int component) {}

int MJpegDecoder::GetVertSubSampFactor(int component) {}

int MJpegDecoder::GetImageScanlinesPerImcuRow() {}

int MJpegDecoder::GetComponentScanlinesPerImcuRow(int component) {}

int MJpegDecoder::GetComponentWidth(int component) {}

int MJpegDecoder::GetComponentHeight(int component) {}

// Get width in bytes padded out to a multiple of DCTSIZE
int MJpegDecoder::GetComponentStride(int component) {}

int MJpegDecoder::GetComponentSize(int component) {}

LIBYUV_BOOL MJpegDecoder::UnloadFrame() {}

// TODO(fbarchard): Allow rectangle to be specified: x, y, width, height.
LIBYUV_BOOL MJpegDecoder::DecodeToBuffers(uint8_t** planes,
                                          int dst_width,
                                          int dst_height) {}

LIBYUV_BOOL MJpegDecoder::DecodeToCallback(CallbackFunction fn,
                                           void* opaque,
                                           int dst_width,
                                           int dst_height) {}

void init_source(j_decompress_ptr cinfo) {}

boolean fill_input_buffer(j_decompress_ptr cinfo) {}

void skip_input_data(j_decompress_ptr cinfo, long num_bytes) {}

void term_source(j_decompress_ptr cinfo) {}

#ifdef HAVE_SETJMP
void ErrorHandler(j_common_ptr cinfo) {}

// Suppress fprintf warnings.
void OutputHandler(j_common_ptr cinfo) {}

#endif  // HAVE_SETJMP

void MJpegDecoder::AllocOutputBuffers(int num_outbufs) {}

void MJpegDecoder::DestroyOutputBuffers() {}

// JDCT_IFAST and do_block_smoothing improve performance substantially.
LIBYUV_BOOL MJpegDecoder::StartDecode() {}

LIBYUV_BOOL MJpegDecoder::FinishDecode() {}

void MJpegDecoder::SetScanlinePointers(uint8_t** data) {}

inline LIBYUV_BOOL MJpegDecoder::DecodeImcuRow() {}

// The helper function which recognizes the jpeg sub-sampling type.
JpegSubsamplingType MJpegDecoder::JpegSubsamplingTypeHelper(
    int* subsample_x,
    int* subsample_y,
    int number_of_components) {}

}  // namespace libyuv
#endif  // HAVE_JPEG