Commit 452472df authored by fbarchard@google.com's avatar fbarchard@google.com

Internals of scale use ptrdiff_t to allow ARGBInterpolate to use stride between 2 images.

BUG=53
TEST=none
Review URL: https://webrtc-codereview.appspot.com/695004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@306 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 4403be58
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 305
Version: 306
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 305
#define LIBYUV_VERSION 306
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -183,15 +183,15 @@ int I422ToI420(const uint8* src_y, int src_stride_y,
// source in scale.cc
#if !defined(YUV_DISABLE_ASM) && defined(__ARM_NEON__)
#define HAS_SCALEROWDOWN2_NEON
void ScaleRowDown2Int_NEON(const uint8* src_ptr, int src_stride,
void ScaleRowDown2Int_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst, int dst_width);
#elif !defined(YUV_DISABLE_ASM) && \
(defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
void ScaleRowDown2Int_SSE2(const uint8* src_ptr, int src_stride,
void ScaleRowDown2Int_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width);
#endif
void ScaleRowDown2Int_C(const uint8* src_ptr, int src_stride,
void ScaleRowDown2Int_C(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width);
int I444ToI420(const uint8* src_y, int src_stride_y,
......@@ -212,7 +212,7 @@ int I444ToI420(const uint8* src_y, int src_stride_y,
src_stride_v = -src_stride_v;
}
int halfwidth = (width + 1) >> 1;
void (*ScaleRowDown2)(const uint8* src_ptr, int src_stride,
void (*ScaleRowDown2)(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width) = ScaleRowDown2Int_C;
#if defined(HAS_SCALEROWDOWN2_NEON)
if (TestCpuFlag(kCpuHasNEON) &&
......@@ -785,8 +785,10 @@ int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
}
// Visual C x86 or GCC little endian.
#if defined(_M_X64) || defined(_M_IX86) || (defined(__BYTE_ORDER) && \
(__BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ || __BYTE_ORDER == __LITTLE_ENDIAN))
#if defined(__x86_64__) || defined(_M_X64) || \
defined(__i386__) || defined(_M_IX86) || \
defined(__arm__) || defined(_M_ARM) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define LIBYUV_LITTLE_ENDIAN
#endif
......
......@@ -402,8 +402,10 @@ static void I42xToUYVYRow_C(const uint8* src_y,
}
// Visual C x86 or GCC little endian.
#if defined(_M_X64) || defined(_M_IX86) || (defined(__BYTE_ORDER) && \
(__BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ || __BYTE_ORDER == __LITTLE_ENDIAN))
#if defined(__x86_64__) || defined(_M_X64) || \
defined(__i386__) || defined(_M_IX86) || \
defined(__arm__) || defined(_M_ARM) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define LIBYUV_LITTLE_ENDIAN
#endif
......
......@@ -1116,11 +1116,12 @@ int ARGBShade(const uint8* src_argb, int src_stride_argb,
(defined(__x86_64__) || defined(__i386__)))
#define HAS_SCALEARGBFILTERROWS_SSSE3
#endif
void ScaleARGBFilterRows_C(uint8* dst_ptr, const uint8* src_ptr, int src_stride,
void ScaleARGBFilterRows_C(uint8* dst_ptr,
const uint8* src_ptr, ptrdiff_t src_stride,
int dst_width, int source_y_fraction);
void ScaleARGBFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
int src_stride, int dst_width,
int source_y_fraction);
void ScaleARGBFilterRows_SSSE3(uint8* dst_ptr,
const uint8* src_ptr, ptrdiff_t src_stride,
int dst_width, int source_y_fraction);
// Interpolate 2 ARGB images by specified amount (0 to 255).
int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0,
......@@ -1137,7 +1138,7 @@ int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0,
dst_stride_argb = -dst_stride_argb;
}
void (*ScaleARGBFilterRows)(uint8* dst_ptr, const uint8* src_ptr,
int src_stride, int dst_width,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) = ScaleARGBFilterRows_C;
#if defined(HAS_SCALEARGBFILTERROWS_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
......
This diff is collapsed.
......@@ -37,7 +37,7 @@ extern "C" {
// Reads 8 pixels, throws half away and writes 4 even pixels (0, 2, 4, 6)
// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 16 byte aligned.
__declspec(naked) __declspec(align(16))
static void ScaleARGBRowDown2_SSE2(const uint8* src_ptr, int src_stride,
static void ScaleARGBRowDown2_SSE2(const uint8* src_ptr, ptrdiff_t /* src_stride */,
uint8* dst_ptr, int dst_width) {
__asm {
mov eax, [esp + 4] // src_ptr
......@@ -63,7 +63,7 @@ static void ScaleARGBRowDown2_SSE2(const uint8* src_ptr, int src_stride,
// Blends 8x2 rectangle to 4x1.
// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 16 byte aligned.
__declspec(naked) __declspec(align(16))
static void ScaleARGBRowDown2Int_SSE2(const uint8* src_ptr, int src_stride,
static void ScaleARGBRowDown2Int_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width) {
__asm {
push esi
......@@ -99,7 +99,7 @@ static void ScaleARGBRowDown2Int_SSE2(const uint8* src_ptr, int src_stride,
// Reads 4 pixels at a time.
// Alignment requirement: dst_ptr 16 byte aligned.
__declspec(naked) __declspec(align(16))
void ScaleARGBRowDownEven_SSE2(const uint8* src_ptr, int src_stride,
void ScaleARGBRowDownEven_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
int src_stepx,
uint8* dst_ptr, int dst_width) {
__asm {
......@@ -137,7 +137,7 @@ void ScaleARGBRowDownEven_SSE2(const uint8* src_ptr, int src_stride,
// Blends four 2x2 to 4x1.
// Alignment requirement: dst_ptr 16 byte aligned.
__declspec(naked) __declspec(align(16))
static void ScaleARGBRowDownEvenInt_SSE2(const uint8* src_ptr, int src_stride,
static void ScaleARGBRowDownEvenInt_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
int src_stepx,
uint8* dst_ptr, int dst_width) {
__asm {
......@@ -188,7 +188,7 @@ static void ScaleARGBRowDownEvenInt_SSE2(const uint8* src_ptr, int src_stride,
#define HAS_SCALEARGBFILTERROWS_SSE2_DISABLED
__declspec(naked) __declspec(align(16))
void ScaleARGBFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr,
int src_stride, int dst_width,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) {
__asm {
push esi
......@@ -276,7 +276,7 @@ void ScaleARGBFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr,
#define HAS_SCALEARGBFILTERROWS_SSSE3
__declspec(naked) __declspec(align(16))
void ScaleARGBFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
int src_stride, int dst_width,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) {
__asm {
push esi
......@@ -360,7 +360,8 @@ void ScaleARGBFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
// Generated using gcc disassembly on Visual C object file:
// objdump -D yuvscaler.obj >yuvscaler.txt
#define HAS_SCALEARGBROWDOWN2_SSE2
static void ScaleARGBRowDown2_SSE2(const uint8* src_ptr, int ,
static void ScaleARGBRowDown2_SSE2(const uint8* src_ptr,
ptrdiff_t /* src_stride */,
uint8* dst_ptr, int dst_width) {
asm volatile (
".p2align 4 \n"
......@@ -384,7 +385,8 @@ static void ScaleARGBRowDown2_SSE2(const uint8* src_ptr, int ,
);
}
static void ScaleARGBRowDown2Int_SSE2(const uint8* src_ptr, int src_stride,
static void ScaleARGBRowDown2Int_SSE2(const uint8* src_ptr,
ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width) {
asm volatile (
".p2align 4 \n"
......@@ -418,7 +420,7 @@ static void ScaleARGBRowDown2Int_SSE2(const uint8* src_ptr, int src_stride,
#define HAS_SCALEARGBROWDOWNEVEN_SSE2
// Reads 4 pixels at a time.
// Alignment requirement: dst_ptr 16 byte aligned.
void ScaleARGBRowDownEven_SSE2(const uint8* src_ptr, int src_stride,
void ScaleARGBRowDownEven_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
int src_stepx,
uint8* dst_ptr, int dst_width) {
intptr_t src_stepx_x4 = static_cast<intptr_t>(src_stepx);
......@@ -455,8 +457,8 @@ void ScaleARGBRowDownEven_SSE2(const uint8* src_ptr, int src_stride,
// Blends four 2x2 to 4x1.
// Alignment requirement: dst_ptr 16 byte aligned.
static void ScaleARGBRowDownEvenInt_SSE2(const uint8* src_ptr, int src_stride,
int src_stepx,
static void ScaleARGBRowDownEvenInt_SSE2(const uint8* src_ptr,
ptrdiff_t src_stride, int src_stepx,
uint8* dst_ptr, int dst_width) {
intptr_t src_stepx_x4 = static_cast<intptr_t>(src_stepx);
intptr_t src_stepx_x12 = 0;
......@@ -505,7 +507,7 @@ static void ScaleARGBRowDownEvenInt_SSE2(const uint8* src_ptr, int src_stride,
// Bilinear row filtering combines 4x2 -> 4x1. SSE2 version
#define HAS_SCALEARGBFILTERROWS_SSE2_DISABLED
void ScaleARGBFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr,
int src_stride, int dst_width,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) {
asm volatile (
"sub %1,%0 \n"
......@@ -577,7 +579,7 @@ void ScaleARGBFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr,
// Bilinear row filtering combines 4x2 -> 4x1. SSSE3 version
#define HAS_SCALEARGBFILTERROWS_SSSE3
void ScaleARGBFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
int src_stride, int dst_width,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) {
asm volatile (
"sub %1,%0 \n"
......@@ -643,7 +645,8 @@ void ScaleARGBFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
}
#endif // defined(__x86_64__) || defined(__i386__)
static void ScaleARGBRowDown2_C(const uint8* src_ptr, int,
static void ScaleARGBRowDown2_C(const uint8* src_ptr,
ptrdiff_t /* src_stride */,
uint8* dst_ptr, int dst_width) {
const uint32* src = reinterpret_cast<const uint32*>(src_ptr);
uint32* dst = reinterpret_cast<uint32*>(dst_ptr);
......@@ -659,7 +662,7 @@ static void ScaleARGBRowDown2_C(const uint8* src_ptr, int,
}
}
static void ScaleARGBRowDown2Int_C(const uint8* src_ptr, int src_stride,
static void ScaleARGBRowDown2Int_C(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width) {
for (int x = 0; x < dst_width; ++x) {
dst_ptr[0] = (src_ptr[0] + src_ptr[4] +
......@@ -675,7 +678,7 @@ static void ScaleARGBRowDown2Int_C(const uint8* src_ptr, int src_stride,
}
}
void ScaleARGBRowDownEven_C(const uint8* src_ptr, int,
void ScaleARGBRowDownEven_C(const uint8* src_ptr, ptrdiff_t /* src_stride */,
int src_stepx,
uint8* dst_ptr, int dst_width) {
const uint32* src = reinterpret_cast<const uint32*>(src_ptr);
......@@ -692,7 +695,8 @@ void ScaleARGBRowDownEven_C(const uint8* src_ptr, int,
}
}
static void ScaleARGBRowDownEvenInt_C(const uint8* src_ptr, int src_stride,
static void ScaleARGBRowDownEvenInt_C(const uint8* src_ptr,
ptrdiff_t src_stride,
int src_stepx,
uint8* dst_ptr, int dst_width) {
for (int x = 0; x < dst_width; ++x) {
......@@ -749,7 +753,8 @@ static void ScaleARGBFilterCols_C(uint8* dst_ptr, const uint8* src_ptr,
static const int kMaxInputWidth = 2560;
// C version 2x2 -> 2x1
void ScaleARGBFilterRows_C(uint8* dst_ptr, const uint8* src_ptr, int src_stride,
void ScaleARGBFilterRows_C(uint8* dst_ptr, const uint8* src_ptr,
ptrdiff_t src_stride,
int dst_width, int source_y_fraction) {
assert(dst_width > 0);
int y1_fraction = source_y_fraction;
......@@ -790,8 +795,8 @@ static void ScaleARGBDown2(int src_width, int src_height,
FilterMode filtering) {
assert(IS_ALIGNED(src_width, 2));
assert(IS_ALIGNED(src_height, 2));
void (*ScaleARGBRowDown2)(const uint8* src_ptr, int src_stride,
uint8* dst_ptr, int dst_width) =
void (*ScaleARGBRowDown2)(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width) =
filtering ? ScaleARGBRowDown2Int_C : ScaleARGBRowDown2_C;
#if defined(HAS_SCALEARGBROWDOWN2_SSE2)
if (TestCpuFlag(kCpuHasSSE2) &&
......@@ -825,7 +830,7 @@ static void ScaleARGBDownEven(int src_width, int src_height,
FilterMode filtering) {
assert(IS_ALIGNED(src_width, 2));
assert(IS_ALIGNED(src_height, 2));
void (*ScaleARGBRowDownEven)(const uint8* src_ptr, int src_stride,
void (*ScaleARGBRowDownEven)(const uint8* src_ptr, ptrdiff_t src_stride,
int src_step, uint8* dst_ptr, int dst_width) =
filtering ? ScaleARGBRowDownEvenInt_C : ScaleARGBRowDownEven_C;
#if defined(HAS_SCALEARGBROWDOWNEVEN_SSE2)
......@@ -861,7 +866,7 @@ static void ScaleARGBBilinear(int src_width, int src_height,
assert(src_width <= kMaxInputWidth);
SIMD_ALIGNED(uint8 row[kMaxInputWidth * 4 + 16]);
void (*ScaleARGBFilterRows)(uint8* dst_ptr, const uint8* src_ptr,
int src_stride,
ptrdiff_t src_stride,
int dst_width, int source_y_fraction) =
ScaleARGBFilterRows_C;
#if defined(HAS_SCALEARGBFILTERROWS_SSE2)
......
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