Commit 8b857c0a authored by fbarchard@google.com's avatar fbarchard@google.com

changes to accommodate libjpeg 9 interface.

BUG=327
TESTED=untested
R=tpsiaki@google.com

Review URL: https://webrtc-codereview.appspot.com/15489005

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1004 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent b846eb4f
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 1003 Version: 1004
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -43,6 +43,17 @@ enum JpegSubsamplingType { ...@@ -43,6 +43,17 @@ enum JpegSubsamplingType {
kJpegUnknown kJpegUnknown
}; };
struct Buffer {
const uint8* data;
int len;
};
struct BufferVector {
Buffer* buffers;
int len;
int pos;
};
struct SetJmpErrorMgr; struct SetJmpErrorMgr;
// MJPEG ("Motion JPEG") is a pseudo-standard video codec where the frames are // MJPEG ("Motion JPEG") is a pseudo-standard video codec where the frames are
...@@ -142,25 +153,6 @@ class LIBYUV_API MJpegDecoder { ...@@ -142,25 +153,6 @@ class LIBYUV_API MJpegDecoder {
int* subsample_x, int* subsample_y, int number_of_components); int* subsample_x, int* subsample_y, int number_of_components);
private: private:
struct Buffer {
const uint8* data;
int len;
};
struct BufferVector {
Buffer* buffers;
int len;
int pos;
};
// Methods that are passed to jpeglib.
static int fill_input_buffer(jpeg_decompress_struct* cinfo);
static void init_source(jpeg_decompress_struct* cinfo);
static void skip_input_data(jpeg_decompress_struct* cinfo,
long num_bytes); // NOLINT
static void term_source(jpeg_decompress_struct* cinfo);
static void ErrorHandler(jpeg_common_struct* cinfo);
void AllocOutputBuffers(int num_outbufs); void AllocOutputBuffers(int num_outbufs);
void DestroyOutputBuffers(); void DestroyOutputBuffers();
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1003 #define LIBYUV_VERSION 1004
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -50,6 +50,14 @@ const int MJpegDecoder::kColorSpaceYCbCr = JCS_YCbCr; ...@@ -50,6 +50,14 @@ const int MJpegDecoder::kColorSpaceYCbCr = JCS_YCbCr;
const int MJpegDecoder::kColorSpaceCMYK = JCS_CMYK; const int MJpegDecoder::kColorSpaceCMYK = JCS_CMYK;
const int MJpegDecoder::kColorSpaceYCCK = JCS_YCCK; const int MJpegDecoder::kColorSpaceYCCK = JCS_YCCK;
// 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);
MJpegDecoder::MJpegDecoder() MJpegDecoder::MJpegDecoder()
: has_scanline_padding_(LIBYUV_FALSE), : has_scanline_padding_(LIBYUV_FALSE),
num_outbufs_(0), num_outbufs_(0),
...@@ -398,11 +406,11 @@ LIBYUV_BOOL MJpegDecoder::DecodeToCallback(CallbackFunction fn, void* opaque, ...@@ -398,11 +406,11 @@ LIBYUV_BOOL MJpegDecoder::DecodeToCallback(CallbackFunction fn, void* opaque,
return FinishDecode(); return FinishDecode();
} }
void MJpegDecoder::init_source(j_decompress_ptr cinfo) { void init_source(j_decompress_ptr cinfo) {
fill_input_buffer(cinfo); fill_input_buffer(cinfo);
} }
boolean MJpegDecoder::fill_input_buffer(j_decompress_ptr cinfo) { boolean fill_input_buffer(j_decompress_ptr cinfo) {
BufferVector* buf_vec = (BufferVector*)(cinfo->client_data); BufferVector* buf_vec = (BufferVector*)(cinfo->client_data);
if (buf_vec->pos >= buf_vec->len) { if (buf_vec->pos >= buf_vec->len) {
assert(0 && "No more data"); assert(0 && "No more data");
...@@ -415,17 +423,17 @@ boolean MJpegDecoder::fill_input_buffer(j_decompress_ptr cinfo) { ...@@ -415,17 +423,17 @@ boolean MJpegDecoder::fill_input_buffer(j_decompress_ptr cinfo) {
return TRUE; return TRUE;
} }
void MJpegDecoder::skip_input_data(j_decompress_ptr cinfo, void skip_input_data(j_decompress_ptr cinfo,
long num_bytes) { // NOLINT long num_bytes) { // NOLINT
cinfo->src->next_input_byte += num_bytes; cinfo->src->next_input_byte += num_bytes;
} }
void MJpegDecoder::term_source(j_decompress_ptr cinfo) { void term_source(j_decompress_ptr cinfo) {
// Nothing to do. // Nothing to do.
} }
#ifdef HAVE_SETJMP #ifdef HAVE_SETJMP
void MJpegDecoder::ErrorHandler(j_common_ptr cinfo) { void ErrorHandler(j_common_ptr cinfo) {
// This is called when a jpeglib command experiences an error. Unfortunately // This is called when a jpeglib command experiences an error. Unfortunately
// jpeglib's error handling model is not very flexible, because it expects the // jpeglib's error handling model is not very flexible, because it expects the
// error handler to not return--i.e., it wants the program to terminate. To // error handler to not return--i.e., it wants the program to terminate. To
...@@ -491,11 +499,11 @@ LIBYUV_BOOL MJpegDecoder::StartDecode() { ...@@ -491,11 +499,11 @@ LIBYUV_BOOL MJpegDecoder::StartDecode() {
decompress_struct_->dct_method = JDCT_IFAST; // JDCT_ISLOW is default decompress_struct_->dct_method = JDCT_IFAST; // JDCT_ISLOW is default
decompress_struct_->dither_mode = JDITHER_NONE; decompress_struct_->dither_mode = JDITHER_NONE;
// Not applicable to 'raw': // Not applicable to 'raw':
decompress_struct_->do_fancy_upsampling = LIBYUV_FALSE; decompress_struct_->do_fancy_upsampling = (boolean)(LIBYUV_FALSE);
// Only for buffered mode: // Only for buffered mode:
decompress_struct_->enable_2pass_quant = LIBYUV_FALSE; decompress_struct_->enable_2pass_quant = (boolean)(LIBYUV_FALSE);
// Blocky but fast: // Blocky but fast:
decompress_struct_->do_block_smoothing = LIBYUV_FALSE; decompress_struct_->do_block_smoothing = (boolean)(LIBYUV_FALSE);
if (!jpeg_start_decompress(decompress_struct_)) { if (!jpeg_start_decompress(decompress_struct_)) {
// ERROR: Couldn't start JPEG decompressor"; // ERROR: Couldn't start JPEG decompressor";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment