Commit db73518b authored by fbarchard@google.com's avatar fbarchard@google.com

use LIBYUV_BOOL instead of bool

BUG=303
TESTED=try
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@953 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent a1f5254a
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 952
Version: 953
License: BSD
License File: LICENSE
......
......@@ -70,11 +70,12 @@ class LIBYUV_API MJpegDecoder {
~MJpegDecoder();
// Loads a new frame, reads its headers, and determines the uncompressed
// image format. Returns true if image looks valid and format is supported.
// If return value is true, then the values for all the following getters
// are populated.
// image format.
// Returns LIBYUV_TRUE if image looks valid and format is supported.
// If return value is LIBYUV_TRUE, then the values for all the following
// getters are populated.
// src_len is the size of the compressed mjpeg frame in bytes.
bool LoadFrame(const uint8* src, size_t src_len);
LIBYUV_BOOL LoadFrame(const uint8* src, size_t src_len);
// Returns width of the last loaded frame in pixels.
int GetWidth();
......@@ -118,7 +119,7 @@ class LIBYUV_API MJpegDecoder {
// Call this after LoadFrame() if you decide you don't want to decode it
// after all.
bool UnloadFrame();
LIBYUV_BOOL UnloadFrame();
// Decodes the entire image into a one-buffer-per-color-component format.
// dst_width must match exactly. dst_height must be <= to image height; if
......@@ -127,13 +128,13 @@ class LIBYUV_API MJpegDecoder {
// at least GetComponentSize(i). The pointers in planes are incremented
// to point to after the end of the written data.
// TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
bool DecodeToBuffers(uint8** planes, int dst_width, int dst_height);
LIBYUV_BOOL DecodeToBuffers(uint8** planes, int dst_width, int dst_height);
// Decodes the entire image and passes the data via repeated calls to a
// callback function. Each call will get the data for a whole number of
// image scanlines.
// TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
bool DecodeToCallback(CallbackFunction fn, void* opaque,
LIBYUV_BOOL DecodeToCallback(CallbackFunction fn, void* opaque,
int dst_width, int dst_height);
// The helper function which recognizes the jpeg sub-sampling type.
......@@ -164,11 +165,11 @@ class LIBYUV_API MJpegDecoder {
void AllocOutputBuffers(int num_outbufs);
void DestroyOutputBuffers();
bool StartDecode();
bool FinishDecode();
LIBYUV_BOOL StartDecode();
LIBYUV_BOOL FinishDecode();
void SetScanlinePointers(uint8** data);
bool DecodeImcuRow();
LIBYUV_BOOL DecodeImcuRow();
int GetComponentScanlinePadding(int component);
......@@ -180,9 +181,9 @@ class LIBYUV_API MJpegDecoder {
jpeg_source_mgr* source_mgr_;
SetJmpErrorMgr* error_mgr_;
// true iff at least one component has scanline padding. (i.e.,
// LIBYUV_TRUE iff at least one component has scanline padding. (i.e.,
// GetComponentScanlinePadding() != 0.)
bool has_scanline_padding_;
LIBYUV_BOOL has_scanline_padding_;
// Temporaries used to point to scanline outputs.
int num_outbufs_; // Outermost size of all arrays below.
......
......@@ -19,7 +19,7 @@ extern "C" {
#endif
// Supported rotation.
enum RotationMode {
typedef enum RotationMode {
kRotate0 = 0, // No rotation.
kRotate90 = 90, // Rotate 90 degrees clockwise.
kRotate180 = 180, // Rotate 180 degrees.
......@@ -29,7 +29,7 @@ enum RotationMode {
kRotateNone = 0,
kRotateClockwise = 90,
kRotateCounterClockwise = 270,
};
} RotationModeEnum;
// Rotate I420 frame.
LIBYUV_API
......
......@@ -33,15 +33,14 @@ extern "C" {
#define align_buffer_64(var, size) \
uint8* var; \
uint8* var##_mem; \
var##_mem = (uint8*)(malloc((size) + 63)); \
var = (uint8*) (((intptr_t)(var##_mem) + 63) & ~63)
var##_mem = (uint8*)(malloc((size) + 63)); /* NOLINT */ \
var = (uint8*) (((intptr_t)(var##_mem) + 63) & ~63) /* NOLINT */
#endif
#define free_aligned_buffer_64(var) \
free(var##_mem); \
var = 0
#if defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \
defined(TARGET_IPHONE_SIMULATOR)
#define LIBYUV_DISABLE_X86
......
......@@ -19,12 +19,12 @@ extern "C" {
#endif
// Supported filtering.
enum FilterMode {
typedef enum FilterMode {
kFilterNone = 0, // Point sample; Fastest.
kFilterLinear = 1, // Filter horizontally only.
kFilterBilinear = 2, // Faster than box, but lower quality scaling down.
kFilterBox = 3 // Highest quality.
};
} FilterModeEnum;
// Scale a YUV plane.
LIBYUV_API
......@@ -64,17 +64,17 @@ int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
uint8* dst_y, uint8* dst_u, uint8* dst_v,
int dst_stride_y, int dst_stride_u, int dst_stride_v,
int dst_width, int dst_height,
bool interpolate);
LIBYUV_BOOL interpolate);
// Legacy API. Deprecated.
LIBYUV_API
int ScaleOffset(const uint8* src_i420, int src_width, int src_height,
uint8* dst_i420, int dst_width, int dst_height, int dst_yoffset,
bool interpolate);
LIBYUV_BOOL interpolate);
// For testing, allow disabling of specialized scalers.
LIBYUV_API
void SetUseReferenceImpl(bool use);
void SetUseReferenceImpl(LIBYUV_BOOL use);
#endif // __cplusplus
#ifdef __cplusplus
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 952
#define LIBYUV_VERSION 953
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -124,7 +124,7 @@ LIBYUV_API
int MJPGSize(const uint8* sample, size_t sample_size,
int* width, int* height) {
MJpegDecoder mjpeg_decoder;
bool ret = mjpeg_decoder.LoadFrame(sample, sample_size);
LIBYUV_BOOL ret = mjpeg_decoder.LoadFrame(sample, sample_size);
if (ret) {
*width = mjpeg_decoder.GetWidth();
*height = mjpeg_decoder.GetHeight();
......@@ -150,7 +150,7 @@ int MJPGToI420(const uint8* sample,
// TODO(fbarchard): Port MJpeg to C.
MJpegDecoder mjpeg_decoder;
bool ret = mjpeg_decoder.LoadFrame(sample, sample_size);
LIBYUV_BOOL ret = mjpeg_decoder.LoadFrame(sample, sample_size);
if (ret && (mjpeg_decoder.GetWidth() != w ||
mjpeg_decoder.GetHeight() != h)) {
// ERROR: MJPEG frame has unexpected dimensions
......@@ -312,7 +312,7 @@ int MJPGToARGB(const uint8* sample,
// TODO(fbarchard): Port MJpeg to C.
MJpegDecoder mjpeg_decoder;
bool ret = mjpeg_decoder.LoadFrame(sample, sample_size);
LIBYUV_BOOL ret = mjpeg_decoder.LoadFrame(sample, sample_size);
if (ret && (mjpeg_decoder.GetWidth() != w ||
mjpeg_decoder.GetHeight() != h)) {
// ERROR: MJPEG frame has unexpected dimensions
......
......@@ -35,7 +35,7 @@ int ConvertToARGB(const uint8* sample, size_t sample_size,
int crop_x, int crop_y,
int src_width, int src_height,
int crop_width, int crop_height,
RotationMode rotation,
enum RotationMode rotation,
uint32 fourcc) {
uint32 format = CanonicalFourCC(fourcc);
if (crop_argb == NULL || sample == NULL ||
......@@ -58,7 +58,8 @@ int ConvertToARGB(const uint8* sample, size_t sample_size,
// and then rotate the I420 to the final destination buffer.
// For in-place conversion, if destination crop_argb is same as source sample,
// also enable temporary buffer.
bool need_buf = (rotation && format != FOURCC_ARGB) || crop_argb == sample;
LIBYUV_BOOL need_buf = (rotation && format != FOURCC_ARGB) ||
crop_argb == sample;
uint8* tmp_argb = crop_argb;
int tmp_argb_stride = argb_stride;
uint8* rotate_buffer = NULL;
......
......@@ -36,7 +36,7 @@ int ConvertToI420(const uint8* sample,
int crop_x, int crop_y,
int src_width, int src_height,
int crop_width, int crop_height,
RotationMode rotation,
enum RotationMode rotation,
uint32 fourcc) {
uint32 format = CanonicalFourCC(fourcc);
if (!y || !u || !v || !sample ||
......@@ -59,7 +59,7 @@ int ConvertToI420(const uint8* sample,
// and then rotate the I420 to the final destination buffer.
// For in-place conversion, if destination y is same as source sample,
// also enable temporary buffer.
bool need_buf = (rotation && format != FOURCC_I420 &&
LIBYUV_BOOL need_buf = (rotation && format != FOURCC_I420 &&
format != FOURCC_NV12 && format != FOURCC_NV21 &&
format != FOURCC_YU12 && format != FOURCC_YV12) || y == sample;
uint8* tmp_y = y;
......
......@@ -39,7 +39,7 @@ const int MJpegDecoder::kColorSpaceCMYK = JCS_CMYK;
const int MJpegDecoder::kColorSpaceYCCK = JCS_YCCK;
MJpegDecoder::MJpegDecoder()
: has_scanline_padding_(false),
: has_scanline_padding_(LIBYUV_FALSE),
num_outbufs_(0),
scanlines_(NULL),
scanlines_sizes_(NULL),
......@@ -75,9 +75,9 @@ MJpegDecoder::~MJpegDecoder() {
DestroyOutputBuffers();
}
bool MJpegDecoder::LoadFrame(const uint8* src, size_t src_len) {
LIBYUV_BOOL MJpegDecoder::LoadFrame(const uint8* src, size_t src_len) {
if (!ValidateJpeg(src, src_len)) {
return false;
return LIBYUV_FALSE;
}
buf_.data = src;
......@@ -88,12 +88,12 @@ bool MJpegDecoder::LoadFrame(const uint8* src, size_t src_len) {
if (setjmp(error_mgr_->setjmp_buffer)) {
// We called jpeg_read_header, it experienced an error, and we called
// longjmp() and rewound the stack to here. Return error.
return false;
return LIBYUV_FALSE;
}
#endif
if (jpeg_read_header(decompress_struct_, TRUE) != JPEG_HEADER_OK) {
// ERROR: Bad MJPEG header
return false;
return LIBYUV_FALSE;
}
AllocOutputBuffers(GetNumComponents());
for (int i = 0; i < num_outbufs_; ++i) {
......@@ -123,10 +123,10 @@ bool MJpegDecoder::LoadFrame(const uint8* src, size_t src_len) {
}
if (GetComponentStride(i) != GetComponentWidth(i)) {
has_scanline_padding_ = true;
has_scanline_padding_ = LIBYUV_TRUE;
}
}
return true;
return LIBYUV_TRUE;
}
static int DivideAndRoundUp(int numerator, int denominator) {
......@@ -205,36 +205,36 @@ int MJpegDecoder::GetComponentSize(int component) {
return GetComponentWidth(component) * GetComponentHeight(component);
}
bool MJpegDecoder::UnloadFrame() {
LIBYUV_BOOL MJpegDecoder::UnloadFrame() {
#ifdef HAVE_SETJMP
if (setjmp(error_mgr_->setjmp_buffer)) {
// We called jpeg_abort_decompress, it experienced an error, and we called
// longjmp() and rewound the stack to here. Return error.
return false;
return LIBYUV_FALSE;
}
#endif
jpeg_abort_decompress(decompress_struct_);
return true;
return LIBYUV_TRUE;
}
// TODO(fbarchard): Allow rectangle to be specified: x, y, width, height.
bool MJpegDecoder::DecodeToBuffers(
LIBYUV_BOOL MJpegDecoder::DecodeToBuffers(
uint8** planes, int dst_width, int dst_height) {
if (dst_width != GetWidth() ||
dst_height > GetHeight()) {
// ERROR: Bad dimensions
return false;
return LIBYUV_FALSE;
}
#ifdef HAVE_SETJMP
if (setjmp(error_mgr_->setjmp_buffer)) {
// We called into jpeglib, it experienced an error sometime during this
// function call, and we called longjmp() and rewound the stack to here.
// Return error.
return false;
return LIBYUV_FALSE;
}
#endif
if (!StartDecode()) {
return false;
return LIBYUV_FALSE;
}
SetScanlinePointers(databuf_);
int lines_left = dst_height;
......@@ -248,7 +248,7 @@ bool MJpegDecoder::DecodeToBuffers(
while (skip >= GetImageScanlinesPerImcuRow()) {
if (!DecodeImcuRow()) {
FinishDecode();
return false;
return LIBYUV_FALSE;
}
skip -= GetImageScanlinesPerImcuRow();
}
......@@ -257,7 +257,7 @@ bool MJpegDecoder::DecodeToBuffers(
// copy the parts we want into the destination.
if (!DecodeImcuRow()) {
FinishDecode();
return false;
return LIBYUV_FALSE;
}
for (int i = 0; i < num_outbufs_; ++i) {
// TODO(fbarchard): Compute skip to avoid this
......@@ -281,7 +281,7 @@ bool MJpegDecoder::DecodeToBuffers(
lines_left -= GetImageScanlinesPerImcuRow()) {
if (!DecodeImcuRow()) {
FinishDecode();
return false;
return LIBYUV_FALSE;
}
for (int i = 0; i < num_outbufs_; ++i) {
int scanlines_to_copy = GetComponentScanlinesPerImcuRow(i);
......@@ -296,7 +296,7 @@ bool MJpegDecoder::DecodeToBuffers(
// Have a partial iMCU row left over to decode.
if (!DecodeImcuRow()) {
FinishDecode();
return false;
return LIBYUV_FALSE;
}
for (int i = 0; i < num_outbufs_; ++i) {
int scanlines_to_copy =
......@@ -310,23 +310,23 @@ bool MJpegDecoder::DecodeToBuffers(
return FinishDecode();
}
bool MJpegDecoder::DecodeToCallback(CallbackFunction fn, void* opaque,
LIBYUV_BOOL MJpegDecoder::DecodeToCallback(CallbackFunction fn, void* opaque,
int dst_width, int dst_height) {
if (dst_width != GetWidth() ||
dst_height > GetHeight()) {
// ERROR: Bad dimensions
return false;
return LIBYUV_FALSE;
}
#ifdef HAVE_SETJMP
if (setjmp(error_mgr_->setjmp_buffer)) {
// We called into jpeglib, it experienced an error sometime during this
// function call, and we called longjmp() and rewound the stack to here.
// Return error.
return false;
return LIBYUV_FALSE;
}
#endif
if (!StartDecode()) {
return false;
return LIBYUV_FALSE;
}
SetScanlinePointers(databuf_);
int lines_left = dst_height;
......@@ -336,7 +336,7 @@ bool MJpegDecoder::DecodeToCallback(CallbackFunction fn, void* opaque,
while (skip >= GetImageScanlinesPerImcuRow()) {
if (!DecodeImcuRow()) {
FinishDecode();
return false;
return LIBYUV_FALSE;
}
skip -= GetImageScanlinesPerImcuRow();
}
......@@ -344,7 +344,7 @@ bool MJpegDecoder::DecodeToCallback(CallbackFunction fn, void* opaque,
// Have a partial iMCU row left over to skip.
if (!DecodeImcuRow()) {
FinishDecode();
return false;
return LIBYUV_FALSE;
}
for (int i = 0; i < num_outbufs_; ++i) {
// TODO(fbarchard): Compute skip to avoid this
......@@ -371,7 +371,7 @@ bool MJpegDecoder::DecodeToCallback(CallbackFunction fn, void* opaque,
lines_left -= GetImageScanlinesPerImcuRow()) {
if (!DecodeImcuRow()) {
FinishDecode();
return false;
return LIBYUV_FALSE;
}
(*fn)(opaque, databuf_, databuf_strides_, GetImageScanlinesPerImcuRow());
}
......@@ -379,7 +379,7 @@ bool MJpegDecoder::DecodeToCallback(CallbackFunction fn, void* opaque,
// Have a partial iMCU row left over to decode.
if (!DecodeImcuRow()) {
FinishDecode();
return false;
return LIBYUV_FALSE;
}
(*fn)(opaque, databuf_, databuf_strides_, lines_left);
}
......@@ -474,26 +474,29 @@ void MJpegDecoder::DestroyOutputBuffers() {
}
// JDCT_IFAST and do_block_smoothing improve performance substantially.
bool MJpegDecoder::StartDecode() {
LIBYUV_BOOL MJpegDecoder::StartDecode() {
decompress_struct_->raw_data_out = TRUE;
decompress_struct_->dct_method = JDCT_IFAST; // JDCT_ISLOW is default
decompress_struct_->dither_mode = JDITHER_NONE;
decompress_struct_->do_fancy_upsampling = false; // Not applicable to 'raw'
decompress_struct_->enable_2pass_quant = false; // Only for buffered mode
decompress_struct_->do_block_smoothing = false; // blocky but fast
// Not applicable to 'raw':
decompress_struct_->do_fancy_upsampling = LIBYUV_FALSE;
// Only for buffered mode:
decompress_struct_->enable_2pass_quant = LIBYUV_FALSE;
// Blocky but fast:
decompress_struct_->do_block_smoothing = LIBYUV_FALSE;
if (!jpeg_start_decompress(decompress_struct_)) {
// ERROR: Couldn't start JPEG decompressor";
return false;
return LIBYUV_FALSE;
}
return true;
return LIBYUV_TRUE;
}
bool MJpegDecoder::FinishDecode() {
LIBYUV_BOOL MJpegDecoder::FinishDecode() {
// jpeglib considers it an error if we finish without decoding the whole
// image, so we call "abort" rather than "finish".
jpeg_abort_decompress(decompress_struct_);
return true;
return LIBYUV_TRUE;
}
void MJpegDecoder::SetScanlinePointers(uint8** data) {
......@@ -506,7 +509,7 @@ void MJpegDecoder::SetScanlinePointers(uint8** data) {
}
}
inline bool MJpegDecoder::DecodeImcuRow() {
inline LIBYUV_BOOL MJpegDecoder::DecodeImcuRow() {
return (unsigned int)(GetImageScanlinesPerImcuRow()) ==
jpeg_read_raw_data(decompress_struct_,
scanlines_,
......
......@@ -1102,7 +1102,7 @@ LIBYUV_API
int RotatePlane(const uint8* src, int src_stride,
uint8* dst, int dst_stride,
int width, int height,
RotationMode mode) {
enum RotationMode mode) {
if (!src || width <= 0 || height == 0 || !dst) {
return -1;
}
......@@ -1150,7 +1150,7 @@ int I420Rotate(const uint8* src_y, int src_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int width, int height,
RotationMode mode) {
enum RotationMode mode) {
if (!src_y || !src_u || !src_v || width <= 0 || height == 0 ||
!dst_y || !dst_u || !dst_v) {
return -1;
......@@ -1226,7 +1226,7 @@ int NV12ToI420Rotate(const uint8* src_y, int src_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int width, int height,
RotationMode mode) {
enum RotationMode mode) {
if (!src_y || !src_uv || width <= 0 || height == 0 ||
!dst_y || !dst_u || !dst_v) {
return -1;
......
......@@ -162,7 +162,7 @@ LIBYUV_API
int ARGBRotate(const uint8* src_argb, int src_stride_argb,
uint8* dst_argb, int dst_stride_argb,
int width, int height,
RotationMode mode) {
enum RotationMode mode) {
if (!src_argb || width <= 0 || height == 0 || !dst_argb) {
return -1;
}
......
......@@ -40,7 +40,7 @@ static void ScalePlaneDown2(int /* src_width */, int /* src_height */,
int dst_width, int dst_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr,
FilterMode filtering) {
enum FilterMode filtering) {
void (*ScaleRowDown2)(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width) =
filtering == kFilterNone ? ScaleRowDown2_C :
......@@ -97,7 +97,7 @@ static void ScalePlaneDown4(int /* src_width */, int /* src_height */,
int dst_width, int dst_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr,
FilterMode filtering) {
enum FilterMode filtering) {
void (*ScaleRowDown4)(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width) =
filtering ? ScaleRowDown4Box_C : ScaleRowDown4_C;
......@@ -141,7 +141,7 @@ static void ScalePlaneDown34(int /* src_width */, int /* src_height */,
int dst_width, int dst_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr,
FilterMode filtering) {
enum FilterMode filtering) {
assert(dst_width % 3 == 0);
void (*ScaleRowDown34_0)(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width);
......@@ -236,7 +236,7 @@ static void ScalePlaneDown38(int /* src_width */, int /* src_height */,
int dst_width, int dst_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr,
FilterMode filtering) {
enum FilterMode filtering) {
assert(dst_width % 3 == 0);
void (*ScaleRowDown38_3)(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width);
......@@ -448,7 +448,7 @@ void ScalePlaneBilinearDown(int src_width, int src_height,
int dst_width, int dst_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr,
FilterMode filtering) {
enum FilterMode filtering) {
assert(dst_width > 0);
assert(dst_height > 0);
......@@ -549,7 +549,7 @@ void ScalePlaneBilinearUp(int src_width, int src_height,
int dst_width, int dst_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr,
FilterMode filtering) {
enum FilterMode filtering) {
assert(src_width != 0);
assert(src_height != 0);
assert(dst_width > 0);
......@@ -731,7 +731,7 @@ void ScalePlane(const uint8* src, int src_stride,
int src_width, int src_height,
uint8* dst, int dst_stride,
int dst_width, int dst_height,
FilterMode filtering) {
enum FilterMode filtering) {
// Simplify filtering when possible.
filtering = ScaleFilterReduce(src_width, src_height,
dst_width, dst_height,
......@@ -822,7 +822,7 @@ int I420Scale(const uint8* src_y, int src_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int dst_width, int dst_height,
FilterMode filtering) {
enum FilterMode filtering) {
if (!src_y || !src_u || !src_v || src_width == 0 || src_height == 0 ||
!dst_y || !dst_u || !dst_v || dst_width <= 0 || dst_height <= 0) {
return -1;
......@@ -852,7 +852,7 @@ int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
uint8* dst_y, uint8* dst_u, uint8* dst_v,
int dst_stride_y, int dst_stride_u, int dst_stride_v,
int dst_width, int dst_height,
bool interpolate) {
LIBYUV_BOOL interpolate) {
return I420Scale(src_y, src_stride_y,
src_u, src_stride_u,
src_v, src_stride_v,
......@@ -868,7 +868,7 @@ int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
LIBYUV_API
int ScaleOffset(const uint8* src, int src_width, int src_height,
uint8* dst, int dst_width, int dst_height, int dst_yoffset,
bool interpolate) {
LIBYUV_BOOL interpolate) {
if (!src || src_width <= 0 || src_height <= 0 ||
!dst || dst_width <= 0 || dst_height <= 0 || dst_yoffset < 0 ||
dst_yoffset >= dst_height) {
......
......@@ -35,7 +35,7 @@ static void ScaleARGBDown2(int /* src_width */, int /* src_height */,
int src_stride, int dst_stride,
const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy,
FilterMode filtering) {
enum FilterMode filtering) {
assert(dx == 65536 * 2); // Test scale factor of 2.
assert((dy & 0x1ffff) == 0); // Test vertical scale is multiple of 2.
// Advance to odd row, even column.
......@@ -128,7 +128,7 @@ static void ScaleARGBDownEven(int src_width, int src_height,
int src_stride, int dst_stride,
const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy,
FilterMode filtering) {
enum FilterMode filtering) {
assert(IS_ALIGNED(src_width, 2));
assert(IS_ALIGNED(src_height, 2));
int col_step = dx >> 16;
......@@ -167,7 +167,7 @@ static void ScaleARGBBilinearDown(int src_width, int src_height,
int src_stride, int dst_stride,
const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy,
FilterMode filtering) {
enum FilterMode filtering) {
assert(src_height > 0);
assert(dst_width > 0);
assert(dst_height > 0);
......@@ -267,7 +267,7 @@ static void ScaleARGBBilinearUp(int src_width, int src_height,
int src_stride, int dst_stride,
const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy,
FilterMode filtering) {
enum FilterMode filtering) {
assert(src_width > 0);
assert(src_height > 0);
assert(dst_width > 0);
......@@ -410,7 +410,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height,
const uint8* src_v,
uint8* dst_argb,
int x, int dx, int y, int dy,
FilterMode filtering) {
enum FilterMode filtering) {
assert(src_width > 0);
assert(src_height > 0);
assert(dst_width > 0);
......@@ -658,7 +658,7 @@ static void ScaleARGB(const uint8* src, int src_stride,
uint8* dst, int dst_stride,
int dst_width, int dst_height,
int clip_x, int clip_y, int clip_width, int clip_height,
FilterMode filtering) {
enum FilterMode filtering) {
// ARGB does not support box filter yet, but allow the user to pass it.
// Simplify filtering when possible.
filtering = ScaleFilterReduce(src_width, src_height,
......@@ -785,7 +785,7 @@ int ARGBScale(const uint8* src_argb, int src_stride_argb,
int src_width, int src_height,
uint8* dst_argb, int dst_stride_argb,
int dst_width, int dst_height,
FilterMode filtering) {
enum FilterMode filtering) {
if (!src_argb || src_width == 0 || src_height == 0 ||
!dst_argb || dst_width <= 0 || dst_height <= 0) {
return -1;
......
......@@ -533,7 +533,7 @@ void ScalePlaneVertical(int src_height,
int src_stride, int dst_stride,
const uint8* src_argb, uint8* dst_argb,
int x, int y, int dy,
int bpp, FilterMode filtering) {
int bpp, enum FilterMode filtering) {
// TODO(fbarchard): Allow higher bpp.
assert(bpp >= 1 && bpp <= 4);
assert(src_height != 0);
......@@ -609,9 +609,9 @@ void ScalePlaneVertical(int src_height,
}
// Simplify the filtering based on scale factors.
FilterMode ScaleFilterReduce(int src_width, int src_height,
int dst_width, int dst_height,
FilterMode filtering) {
enum FilterMode ScaleFilterReduce(int src_width, int src_height,
int dst_width, int dst_height,
enum FilterMode filtering) {
if (src_width < 0) {
src_width = -src_width;
}
......@@ -670,7 +670,7 @@ int FixedDiv1_C(int num, int div) {
// Compute slope values for stepping.
void ScaleSlope(int src_width, int src_height,
int dst_width, int dst_height,
FilterMode filtering,
enum FilterMode filtering,
int* x, int* y, int* dx, int* dy) {
assert(x != NULL);
assert(y != NULL);
......
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