mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 14:34:33 +02:00
fix rescaler vertical interpolation
* vertical expansion now uses bilinear interpolation * heavily assumes that the alpha plane is decoded in full, not row-by-row * split the RescalerExportRow and RescalerImportRow methods into Shrink and Expand variants. * MIPS implementation of ExportRowExpand is missing. There's room for extra speed optim and code re-org, but let's keep that for later patches. addresses https://code.google.com/p/webp/issues/detail?id=254 Change-Id: I8f12b855342bf07dd467fe85e4fde5fd814effdb
This commit is contained in:
committed by
James Zern
parent
cd82440ec7
commit
5ff0079ece
@ -335,15 +335,35 @@ void WebPInitYUV444Converters(void);
|
||||
struct WebPRescaler;
|
||||
|
||||
// Import a row of data and save its contribution in the rescaler.
|
||||
// 'channel' denotes the channel number to be imported.
|
||||
extern void (*WebPRescalerImportRow)(struct WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel);
|
||||
// 'channel' denotes the channel number to be imported. 'Expand' corresponds to
|
||||
// the wrk->x_expand case. Otherwise, 'Shrink' is to be used.
|
||||
typedef void (*WebPRescalerImportRowFunc)(struct WebPRescaler* const wrk,
|
||||
const uint8_t* const src,
|
||||
int channel);
|
||||
|
||||
extern WebPRescalerImportRowFunc WebPRescalerImportRowExpand;
|
||||
extern WebPRescalerImportRowFunc WebPRescalerImportRowShrink;
|
||||
|
||||
// Export one row (starting at x_out position) from rescaler.
|
||||
extern void (*WebPRescalerExportRow)(struct WebPRescaler* const wrk, int x_out);
|
||||
// 'Expand' corresponds to the wrk->y_expand case.
|
||||
// Otherwise 'Shrink' is to be used
|
||||
typedef void (*WebPRescalerExportRowFunc)(struct WebPRescaler* const wrk);
|
||||
extern WebPRescalerExportRowFunc WebPRescalerExportRowExpand;
|
||||
extern WebPRescalerExportRowFunc WebPRescalerExportRowShrink;
|
||||
|
||||
// Plain-C implementation, as fall-back.
|
||||
extern void WebPRescalerExportRowC(struct WebPRescaler* const wrk, int x_out);
|
||||
extern void WebPRescalerImportRowExpandC(struct WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel);
|
||||
extern void WebPRescalerImportRowShrinkC(struct WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel);
|
||||
extern void WebPRescalerExportRowExpandC(struct WebPRescaler* const wrk);
|
||||
extern void WebPRescalerExportRowShrinkC(struct WebPRescaler* const wrk);
|
||||
|
||||
// Main entry calls:
|
||||
extern void WebPRescalerImportRow(struct WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel);
|
||||
// Export one row (starting at x_out position) from rescaler.
|
||||
extern void WebPRescalerExportRow(struct WebPRescaler* const wrk);
|
||||
|
||||
// Must be called first before using the above.
|
||||
void WebPRescalerDspInit(void);
|
||||
|
@ -17,78 +17,125 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Implementations of critical functions ImportRow / ExportRow
|
||||
|
||||
#define ROUNDER (1 << (WEBP_RESCALER_RFIX - 1))
|
||||
#define MULT_FIX(x, y) (((int64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX)
|
||||
#define ROUNDER (WEBP_RESCALER_ONE >> 1)
|
||||
#define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX)
|
||||
|
||||
static void RescalerImportRowC(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
//------------------------------------------------------------------------------
|
||||
// Row import
|
||||
|
||||
void WebPRescalerImportRowExpandC(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
const int x_stride = wrk->num_channels;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
int x_in = channel;
|
||||
int x_out;
|
||||
if (!wrk->x_expand) {
|
||||
uint32_t sum = 0;
|
||||
int accum = 0;
|
||||
for (x_out = channel; x_out < x_out_max; x_out += x_stride) {
|
||||
uint32_t base = 0;
|
||||
// simple bilinear interpolation
|
||||
int accum = wrk->x_add;
|
||||
int left = src[x_in];
|
||||
int right = (wrk->src_width > 1) ? src[x_in + x_stride] : left;
|
||||
x_in += x_stride;
|
||||
x_out = channel;
|
||||
|
||||
assert(!WebPRescalerInputDone(wrk));
|
||||
assert(wrk->x_expand);
|
||||
while (1) {
|
||||
wrk->frow[x_out] = right * wrk->x_add + (left - right) * accum;
|
||||
x_out += x_stride;
|
||||
if (x_out >= x_out_max) break;
|
||||
accum -= wrk->x_sub;
|
||||
if (accum < 0) {
|
||||
left = right;
|
||||
x_in += x_stride;
|
||||
assert(x_in < wrk->src_width * x_stride);
|
||||
right = src[x_in];
|
||||
accum += wrk->x_add;
|
||||
while (accum > 0) {
|
||||
accum -= wrk->x_sub;
|
||||
assert(x_in < wrk->src_width * x_stride);
|
||||
base = src[x_in];
|
||||
sum += base;
|
||||
x_in += x_stride;
|
||||
}
|
||||
{ // Emit next horizontal pixel.
|
||||
const int32_t frac = base * (-accum);
|
||||
wrk->frow[x_out] = sum * wrk->x_sub - frac;
|
||||
// fresh fractional start for next pixel
|
||||
sum = (int)MULT_FIX(frac, wrk->fx_scale);
|
||||
}
|
||||
}
|
||||
assert(accum == 0);
|
||||
} else { // simple bilinear interpolation
|
||||
int accum = wrk->x_add;
|
||||
int left = src[x_in];
|
||||
int right = (wrk->src_width > 1) ? src[x_in + x_stride] : left;
|
||||
x_in += x_stride;
|
||||
x_out = channel;
|
||||
while (1) {
|
||||
wrk->frow[x_out] = right * wrk->x_add + (left - right) * accum;
|
||||
x_out += x_stride;
|
||||
if (x_out >= x_out_max) break;
|
||||
accum -= wrk->x_sub;
|
||||
if (accum < 0) {
|
||||
left = right;
|
||||
x_in += x_stride;
|
||||
assert(x_in < wrk->src_width * x_stride);
|
||||
right = src[x_in];
|
||||
accum += wrk->x_add;
|
||||
}
|
||||
}
|
||||
assert(wrk->x_sub == 0 /* <- special case for src_width=1 */ || accum == 0);
|
||||
}
|
||||
// Accumulate the contribution of the new row.
|
||||
assert(wrk->x_sub == 0 /* <- special case for src_width=1 */ || accum == 0);
|
||||
}
|
||||
|
||||
void WebPRescalerImportRowShrinkC(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
const int x_stride = wrk->num_channels;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
int x_in = channel;
|
||||
int x_out;
|
||||
uint32_t sum = 0;
|
||||
int accum = 0;
|
||||
|
||||
assert(!WebPRescalerInputDone(wrk));
|
||||
assert(!wrk->x_expand);
|
||||
for (x_out = channel; x_out < x_out_max; x_out += x_stride) {
|
||||
wrk->irow[x_out] += wrk->frow[x_out];
|
||||
uint32_t base = 0;
|
||||
accum += wrk->x_add;
|
||||
while (accum > 0) {
|
||||
accum -= wrk->x_sub;
|
||||
assert(x_in < wrk->src_width * x_stride);
|
||||
base = src[x_in];
|
||||
sum += base;
|
||||
x_in += x_stride;
|
||||
}
|
||||
{ // Emit next horizontal pixel.
|
||||
const rescaler_t frac = base * (-accum);
|
||||
wrk->frow[x_out] = sum * wrk->x_sub - frac;
|
||||
// fresh fractional start for next pixel
|
||||
sum = (int)MULT_FIX(frac, wrk->fx_scale);
|
||||
}
|
||||
}
|
||||
assert(accum == 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Row export
|
||||
|
||||
void WebPRescalerExportRowExpandC(WebPRescaler* const wrk) {
|
||||
int x_out;
|
||||
uint8_t* const dst = wrk->dst;
|
||||
rescaler_t* const irow = wrk->irow;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
const rescaler_t* const frow = wrk->frow;
|
||||
assert(!WebPRescalerOutputDone(wrk));
|
||||
assert(wrk->y_accum <= 0);
|
||||
assert(wrk->y_expand);
|
||||
if (wrk->y_accum == 0) {
|
||||
for (x_out = 0; x_out < x_out_max; ++x_out) {
|
||||
const int v = (int)MULT_FIX(frow[x_out], wrk->fy_scale);
|
||||
dst[x_out] = (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255;
|
||||
}
|
||||
} else {
|
||||
const int64_t A = wrk->y_sub + wrk->y_accum;
|
||||
const int64_t B = -wrk->y_accum;
|
||||
for (x_out = 0; x_out < x_out_max; ++x_out) {
|
||||
const int64_t I = A * frow[x_out] + B * irow[x_out];
|
||||
const int v = (int)MULT_FIX(I, wrk->fxy_scale);
|
||||
dst[x_out] = (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WebPRescalerExportRowC(WebPRescaler* const wrk, int x_out) {
|
||||
if (wrk->y_accum <= 0) {
|
||||
uint8_t* const dst = wrk->dst;
|
||||
int32_t* const irow = wrk->irow;
|
||||
const int32_t* const frow = wrk->frow;
|
||||
const int yscale = wrk->fy_scale * (-wrk->y_accum);
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
for (; x_out < x_out_max; ++x_out) {
|
||||
void WebPRescalerExportRowShrinkC(WebPRescaler* const wrk) {
|
||||
int x_out;
|
||||
uint8_t* const dst = wrk->dst;
|
||||
rescaler_t* const irow = wrk->irow;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
const rescaler_t* const frow = wrk->frow;
|
||||
const int yscale = wrk->fy_scale * (-wrk->y_accum);
|
||||
assert(!WebPRescalerOutputDone(wrk));
|
||||
assert(wrk->y_accum <= 0);
|
||||
assert(!wrk->y_expand);
|
||||
if (yscale) {
|
||||
for (x_out = 0; x_out < x_out_max; ++x_out) {
|
||||
const int frac = (int)MULT_FIX(frow[x_out], yscale);
|
||||
const int v = (int)MULT_FIX(irow[x_out] - frac, wrk->fxy_scale);
|
||||
dst[x_out] = (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255;
|
||||
irow[x_out] = frac; // new fractional start
|
||||
}
|
||||
wrk->y_accum += wrk->y_add;
|
||||
wrk->dst += wrk->dst_stride;
|
||||
} else {
|
||||
for (x_out = 0; x_out < x_out_max; ++x_out) {
|
||||
const int v = (int)MULT_FIX(irow[x_out], wrk->fxy_scale);
|
||||
dst[x_out] = (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255;
|
||||
irow[x_out] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,10 +143,39 @@ void WebPRescalerExportRowC(WebPRescaler* const wrk, int x_out) {
|
||||
#undef ROUNDER
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Main entry calls
|
||||
|
||||
void (*WebPRescalerImportRow)(struct WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel);
|
||||
void (*WebPRescalerExportRow)(struct WebPRescaler* const wrk, int x_out);
|
||||
void WebPRescalerImportRow(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
assert(!WebPRescalerInputDone(wrk));
|
||||
if (!wrk->x_expand) {
|
||||
WebPRescalerImportRowShrink(wrk, src, channel);
|
||||
} else {
|
||||
WebPRescalerImportRowExpand(wrk, src, channel);
|
||||
}
|
||||
}
|
||||
|
||||
void WebPRescalerExportRow(WebPRescaler* const wrk) {
|
||||
if (wrk->y_accum <= 0) {
|
||||
assert(!WebPRescalerOutputDone(wrk));
|
||||
if (wrk->y_expand) {
|
||||
WebPRescalerExportRowExpand(wrk);
|
||||
} else {
|
||||
WebPRescalerExportRowShrink(wrk);
|
||||
}
|
||||
wrk->y_accum += wrk->y_add;
|
||||
wrk->dst += wrk->dst_stride;
|
||||
++wrk->dst_y;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
WebPRescalerImportRowFunc WebPRescalerImportRowExpand;
|
||||
WebPRescalerImportRowFunc WebPRescalerImportRowShrink;
|
||||
|
||||
WebPRescalerExportRowFunc WebPRescalerExportRowExpand;
|
||||
WebPRescalerExportRowFunc WebPRescalerExportRowShrink;
|
||||
|
||||
extern void WebPRescalerDspInitMIPS32(void);
|
||||
extern void WebPRescalerDspInitMIPSdspR2(void);
|
||||
@ -110,8 +186,11 @@ static volatile VP8CPUInfo rescaler_last_cpuinfo_used =
|
||||
WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) {
|
||||
if (rescaler_last_cpuinfo_used == VP8GetCPUInfo) return;
|
||||
|
||||
WebPRescalerImportRow = RescalerImportRowC;
|
||||
WebPRescalerExportRow = WebPRescalerExportRowC;
|
||||
WebPRescalerImportRowExpand = WebPRescalerImportRowExpandC;
|
||||
WebPRescalerImportRowShrink = WebPRescalerImportRowShrinkC;
|
||||
WebPRescalerExportRowExpand = WebPRescalerExportRowExpandC;
|
||||
WebPRescalerExportRowShrink = WebPRescalerExportRowShrinkC;
|
||||
|
||||
if (VP8GetCPUInfo != NULL) {
|
||||
#if defined(WEBP_USE_MIPS32)
|
||||
if (VP8GetCPUInfo(kMIPS32)) {
|
||||
|
@ -15,177 +15,183 @@
|
||||
|
||||
#if defined(WEBP_USE_MIPS32)
|
||||
|
||||
#include <assert.h>
|
||||
#include "../utils/rescaler.h"
|
||||
|
||||
static void ImportRow(WebPRescaler* const wrk,
|
||||
static void ImportRowShrink(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
const int x_stride = wrk->num_channels;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
const int fx_scale = wrk->fx_scale;
|
||||
const int x_add = wrk->x_add;
|
||||
const int x_sub = wrk->x_sub;
|
||||
const int src_width = wrk->src_width;
|
||||
int* frow = wrk->frow + channel;
|
||||
int* irow = wrk->irow + channel;
|
||||
const uint8_t* src1 = src + channel;
|
||||
int temp1, temp2, temp3, temp4;
|
||||
int temp1, temp2, temp3;
|
||||
int base, frac, sum;
|
||||
int accum, accum1;
|
||||
const int x_stride1 = x_stride << 2;
|
||||
int loop_c = x_out_max - channel;
|
||||
|
||||
assert(!wrk->x_expand);
|
||||
assert(!WebPRescalerInputDone(wrk));
|
||||
__asm__ volatile (
|
||||
"li %[temp1], 0x8000 \n\t"
|
||||
"li %[temp2], 0x10000 \n\t"
|
||||
"li %[sum], 0 \n\t"
|
||||
"li %[accum], 0 \n\t"
|
||||
"1: \n\t"
|
||||
"addu %[accum], %[accum], %[x_add] \n\t"
|
||||
"li %[base], 0 \n\t"
|
||||
"blez %[accum], 3f \n\t"
|
||||
"2: \n\t"
|
||||
"lbu %[base], 0(%[src1]) \n\t"
|
||||
"subu %[accum], %[accum], %[x_sub] \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"addu %[sum], %[sum], %[base] \n\t"
|
||||
"bgtz %[accum], 2b \n\t"
|
||||
"3: \n\t"
|
||||
"negu %[accum1], %[accum] \n\t"
|
||||
"mul %[frac], %[base], %[accum1] \n\t"
|
||||
"mul %[temp3], %[sum], %[x_sub] \n\t"
|
||||
"subu %[loop_c], %[loop_c], %[x_stride] \n\t"
|
||||
"sll %[accum1], %[frac], 2 \n\t"
|
||||
"mult %[temp1], %[temp2] \n\t"
|
||||
"madd %[accum1], %[fx_scale] \n\t"
|
||||
"mfhi %[sum] \n\t"
|
||||
"subu %[temp3], %[temp3], %[frac] \n\t"
|
||||
"sw %[temp3], 0(%[frow]) \n\t"
|
||||
"addu %[frow], %[frow], %[x_stride1] \n\t"
|
||||
"bgtz %[loop_c], 1b \n\t"
|
||||
: [accum] "=&r" (accum), [src1] "+r" (src1), [temp3] "=&r" (temp3),
|
||||
[sum] "=&r" (sum), [base] "=&r" (base), [frac] "=&r" (frac),
|
||||
[frow] "+r" (frow), [accum1] "=&r" (accum1),
|
||||
[temp2] "=&r" (temp2), [temp1] "=&r" (temp1)
|
||||
: [x_stride] "r" (x_stride), [fx_scale] "r" (fx_scale),
|
||||
[x_sub] "r" (x_sub), [x_add] "r" (x_add),
|
||||
[loop_c] "r" (loop_c), [x_stride1] "r" (x_stride1)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
}
|
||||
|
||||
static void ImportRowExpand(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
const int x_stride = wrk->num_channels;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
const int x_add = wrk->x_add;
|
||||
const int x_sub = wrk->x_sub;
|
||||
const int src_width = wrk->src_width;
|
||||
int* frow = wrk->frow + channel;
|
||||
const uint8_t* src1 = src + channel;
|
||||
int temp1, temp2, temp3, temp4;
|
||||
int frac;
|
||||
int accum;
|
||||
const int x_stride1 = x_stride << 2;
|
||||
int x_out = channel;
|
||||
|
||||
if (!wrk->x_expand) {
|
||||
__asm__ volatile (
|
||||
"li %[temp1], 0x8000 \n\t"
|
||||
"li %[temp2], 0x10000 \n\t"
|
||||
"li %[sum], 0 \n\t"
|
||||
"li %[accum], 0 \n\t"
|
||||
"1: \n\t"
|
||||
"addu %[accum], %[accum], %[x_add] \n\t"
|
||||
"li %[base], 0 \n\t"
|
||||
"blez %[accum], 3f \n\t"
|
||||
"2: \n\t"
|
||||
"lbu %[base], 0(%[src1]) \n\t"
|
||||
"subu %[accum], %[accum], %[x_sub] \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"addu %[sum], %[sum], %[base] \n\t"
|
||||
"bgtz %[accum], 2b \n\t"
|
||||
"3: \n\t"
|
||||
"negu %[accum1], %[accum] \n\t"
|
||||
"mul %[frac], %[base], %[accum1] \n\t"
|
||||
"mul %[temp3], %[sum], %[x_sub] \n\t"
|
||||
"lw %[base], 0(%[irow]) \n\t"
|
||||
"subu %[loop_c], %[loop_c], %[x_stride] \n\t"
|
||||
"sll %[accum1], %[frac], 2 \n\t"
|
||||
"mult %[temp1], %[temp2] \n\t"
|
||||
"madd %[accum1], %[fx_scale] \n\t"
|
||||
"mfhi %[sum] \n\t"
|
||||
"subu %[temp3], %[temp3], %[frac] \n\t"
|
||||
"sw %[temp3], 0(%[frow]) \n\t"
|
||||
"addu %[base], %[base], %[temp3] \n\t"
|
||||
"sw %[base], 0(%[irow]) \n\t"
|
||||
"addu %[irow], %[irow], %[x_stride1] \n\t"
|
||||
"addu %[frow], %[frow], %[x_stride1] \n\t"
|
||||
"bgtz %[loop_c], 1b \n\t"
|
||||
: [accum] "=&r" (accum), [src1] "+r" (src1), [temp3] "=&r" (temp3),
|
||||
[sum] "=&r" (sum), [base] "=&r" (base), [frac] "=&r" (frac),
|
||||
[frow] "+r" (frow), [irow] "+r" (irow), [accum1] "=&r" (accum1),
|
||||
[temp2] "=&r" (temp2), [temp1] "=&r" (temp1)
|
||||
: [x_stride] "r" (x_stride), [fx_scale] "r" (fx_scale),
|
||||
[x_sub] "r" (x_sub), [x_add] "r" (x_add),
|
||||
[loop_c] "r" (loop_c), [x_stride1] "r" (x_stride1)
|
||||
assert(wrk->x_expand);
|
||||
assert(!WebPRescalerInputDone(wrk));
|
||||
__asm__ volatile (
|
||||
"addiu %[temp3], %[src_width], -1 \n\t"
|
||||
"lbu %[temp2], 0(%[src1]) \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"bgtz %[temp3], 0f \n\t"
|
||||
"addiu %[temp1], %[temp2], 0 \n\t"
|
||||
"b 3f \n\t"
|
||||
"0: \n\t"
|
||||
"lbu %[temp1], 0(%[src1]) \n\t"
|
||||
"3: \n\t"
|
||||
"addiu %[accum], %[x_add], 0 \n\t"
|
||||
"1: \n\t"
|
||||
"subu %[temp3], %[temp2], %[temp1] \n\t"
|
||||
"mul %[temp3], %[temp3], %[accum] \n\t"
|
||||
"mul %[temp4], %[temp1], %[x_add] \n\t"
|
||||
"addu %[temp3], %[temp4], %[temp3] \n\t"
|
||||
"sw %[temp3], 0(%[frow]) \n\t"
|
||||
"addu %[frow], %[frow], %[x_stride1] \n\t"
|
||||
"addu %[x_out], %[x_out], %[x_stride] \n\t"
|
||||
"subu %[temp3], %[x_out], %[x_out_max] \n\t"
|
||||
"bgez %[temp3], 2f \n\t"
|
||||
"subu %[accum], %[accum], %[x_sub] \n\t"
|
||||
"bgez %[accum], 4f \n\t"
|
||||
"addiu %[temp2], %[temp1], 0 \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"lbu %[temp1], 0(%[src1]) \n\t"
|
||||
"addu %[accum], %[accum], %[x_add] \n\t"
|
||||
"4: \n\t"
|
||||
"b 1b \n\t"
|
||||
"2: \n\t"
|
||||
: [src1] "+r" (src1), [accum] "=&r" (accum), [temp1] "=&r" (temp1),
|
||||
[temp2] "=&r" (temp2), [temp3] "=&r" (temp3), [temp4] "=&r" (temp4),
|
||||
[x_out] "+r" (x_out), [frac] "=&r" (frac), [frow] "+r" (frow)
|
||||
: [x_stride] "r" (x_stride), [x_add] "r" (x_add), [x_sub] "r" (x_sub),
|
||||
[x_stride1] "r" (x_stride1), [src_width] "r" (src_width),
|
||||
[x_out_max] "r" (x_out_max)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
}
|
||||
|
||||
static void ExportRowShrink(WebPRescaler* const wrk) {
|
||||
assert(!WebPRescalerOutputDone(wrk));
|
||||
assert(wrk->y_accum <= 0);
|
||||
assert(!wrk->y_expand);
|
||||
// if wrk->fxy_scale can fit into 32 bits use optimized code,
|
||||
// otherwise use C code
|
||||
if ((wrk->fxy_scale >> 32) == 0) {
|
||||
uint8_t* dst = wrk->dst;
|
||||
rescaler_t* irow = wrk->irow;
|
||||
const rescaler_t* frow = wrk->frow;
|
||||
const int yscale = wrk->fy_scale * (-wrk->y_accum);
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
|
||||
int temp0, temp1, temp3, temp4, temp5, temp6, temp7, loop_end;
|
||||
const int temp2 = (int)(wrk->fxy_scale);
|
||||
const int temp8 = x_out_max << 2;
|
||||
|
||||
__asm__ volatile(
|
||||
"addiu %[temp6], $zero, -256 \n\t"
|
||||
"addiu %[temp7], $zero, 255 \n\t"
|
||||
"li %[temp3], 0x10000 \n\t"
|
||||
"li %[temp4], 0x8000 \n\t"
|
||||
"addu %[loop_end], %[frow], %[temp8] \n\t"
|
||||
"1: \n\t"
|
||||
"lw %[temp0], 0(%[frow]) \n\t"
|
||||
"mult %[temp3], %[temp4] \n\t"
|
||||
"addiu %[frow], %[frow], 4 \n\t"
|
||||
"sll %[temp0], %[temp0], 2 \n\t"
|
||||
"madd %[temp0], %[yscale] \n\t"
|
||||
"mfhi %[temp1] \n\t"
|
||||
"lw %[temp0], 0(%[irow]) \n\t"
|
||||
"addiu %[dst], %[dst], 1 \n\t"
|
||||
"addiu %[irow], %[irow], 4 \n\t"
|
||||
"subu %[temp0], %[temp0], %[temp1] \n\t"
|
||||
"mult %[temp3], %[temp4] \n\t"
|
||||
"sll %[temp0], %[temp0], 2 \n\t"
|
||||
"madd %[temp0], %[temp2] \n\t"
|
||||
"mfhi %[temp5] \n\t"
|
||||
"sw %[temp1], -4(%[irow]) \n\t"
|
||||
"and %[temp0], %[temp5], %[temp6] \n\t"
|
||||
"slti %[temp1], %[temp5], 0 \n\t"
|
||||
"beqz %[temp0], 2f \n\t"
|
||||
"xor %[temp5], %[temp5], %[temp5] \n\t"
|
||||
"movz %[temp5], %[temp7], %[temp1] \n\t"
|
||||
"2: \n\t"
|
||||
"sb %[temp5], -1(%[dst]) \n\t"
|
||||
"bne %[frow], %[loop_end], 1b \n\t"
|
||||
|
||||
: [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp3]"=&r"(temp3),
|
||||
[temp4]"=&r"(temp4), [temp5]"=&r"(temp5), [temp6]"=&r"(temp6),
|
||||
[temp7]"=&r"(temp7), [frow]"+r"(frow), [irow]"+r"(irow),
|
||||
[dst]"+r"(dst), [loop_end]"=&r"(loop_end)
|
||||
: [temp2]"r"(temp2), [yscale]"r"(yscale), [temp8]"r"(temp8)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
} else {
|
||||
__asm__ volatile (
|
||||
"addiu %[temp3], %[src_width], -1 \n\t"
|
||||
"lbu %[temp2], 0(%[src1]) \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"bgtz %[temp3], 0f \n\t"
|
||||
"addiu %[temp1], %[temp2], 0 \n\t"
|
||||
"b 3f \n\t"
|
||||
"0: \n\t"
|
||||
"lbu %[temp1], 0(%[src1]) \n\t"
|
||||
"3: \n\t"
|
||||
"addiu %[accum], %[x_add], 0 \n\t"
|
||||
"1: \n\t"
|
||||
"subu %[temp3], %[temp2], %[temp1] \n\t"
|
||||
"mul %[temp3], %[temp3], %[accum] \n\t"
|
||||
"mul %[temp4], %[temp1], %[x_add] \n\t"
|
||||
"lw %[frac], 0(%[irow]) \n\t"
|
||||
"addu %[temp3], %[temp4], %[temp3] \n\t"
|
||||
"sw %[temp3], 0(%[frow]) \n\t"
|
||||
"addu %[frow], %[frow], %[x_stride1] \n\t"
|
||||
"addu %[frac], %[frac], %[temp3] \n\t"
|
||||
"addu %[x_out], %[x_out], %[x_stride] \n\t"
|
||||
"sw %[frac], 0(%[irow]) \n\t"
|
||||
"subu %[temp3], %[x_out], %[x_out_max] \n\t"
|
||||
"addu %[irow], %[irow], %[x_stride1] \n\t"
|
||||
"bgez %[temp3], 2f \n\t"
|
||||
"subu %[accum], %[accum], %[x_sub] \n\t"
|
||||
"bgez %[accum], 4f \n\t"
|
||||
"addiu %[temp2], %[temp1], 0 \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"lbu %[temp1], 0(%[src1]) \n\t"
|
||||
"addu %[accum], %[accum], %[x_add] \n\t"
|
||||
"4: \n\t"
|
||||
"b 1b \n\t"
|
||||
"2: \n\t"
|
||||
: [src1] "+r" (src1), [accum] "=&r" (accum), [temp1] "=&r" (temp1),
|
||||
[temp2] "=&r" (temp2), [temp3] "=&r" (temp3), [temp4] "=&r" (temp4),
|
||||
[x_out] "+r" (x_out), [frac] "=&r" (frac), [frow] "+r" (frow),
|
||||
[irow] "+r" (irow)
|
||||
: [x_stride] "r" (x_stride), [x_add] "r" (x_add), [x_sub] "r" (x_sub),
|
||||
[x_stride1] "r" (x_stride1), [src_width] "r" (src_width),
|
||||
[x_out_max] "r" (x_out_max)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
WebPRescalerExportRowShrinkC(wrk);
|
||||
}
|
||||
}
|
||||
|
||||
static void ExportRow(WebPRescaler* const wrk, int x_out) {
|
||||
if (wrk->y_accum <= 0) {
|
||||
uint8_t* const dst = wrk->dst;
|
||||
int32_t* const irow = wrk->irow;
|
||||
const int32_t* const frow = wrk->frow;
|
||||
const int yscale = wrk->fy_scale * (-wrk->y_accum);
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
// if wrk->fxy_scale can fit into 32 bits use optimized code,
|
||||
// otherwise use C code
|
||||
if ((wrk->fxy_scale >> 32) == 0) {
|
||||
int temp0, temp1, temp3, temp4, temp5, temp6, temp7, loop_end;
|
||||
const int temp2 = (int)(wrk->fxy_scale);
|
||||
const int temp8 = x_out_max << 2;
|
||||
uint8_t* dst_t = (uint8_t*)dst;
|
||||
int32_t* irow_t = (int32_t*)irow;
|
||||
const int32_t* frow_t = (const int32_t*)frow;
|
||||
|
||||
__asm__ volatile(
|
||||
"addiu %[temp6], $zero, -256 \n\t"
|
||||
"addiu %[temp7], $zero, 255 \n\t"
|
||||
"li %[temp3], 0x10000 \n\t"
|
||||
"li %[temp4], 0x8000 \n\t"
|
||||
"addu %[loop_end], %[frow_t], %[temp8] \n\t"
|
||||
"1: \n\t"
|
||||
"lw %[temp0], 0(%[frow_t]) \n\t"
|
||||
"mult %[temp3], %[temp4] \n\t"
|
||||
"addiu %[frow_t], %[frow_t], 4 \n\t"
|
||||
"sll %[temp0], %[temp0], 2 \n\t"
|
||||
"madd %[temp0], %[yscale] \n\t"
|
||||
"mfhi %[temp1] \n\t"
|
||||
"lw %[temp0], 0(%[irow_t]) \n\t"
|
||||
"addiu %[dst_t], %[dst_t], 1 \n\t"
|
||||
"addiu %[irow_t], %[irow_t], 4 \n\t"
|
||||
"subu %[temp0], %[temp0], %[temp1] \n\t"
|
||||
"mult %[temp3], %[temp4] \n\t"
|
||||
"sll %[temp0], %[temp0], 2 \n\t"
|
||||
"madd %[temp0], %[temp2] \n\t"
|
||||
"mfhi %[temp5] \n\t"
|
||||
"sw %[temp1], -4(%[irow_t]) \n\t"
|
||||
"and %[temp0], %[temp5], %[temp6] \n\t"
|
||||
"slti %[temp1], %[temp5], 0 \n\t"
|
||||
"beqz %[temp0], 2f \n\t"
|
||||
"xor %[temp5], %[temp5], %[temp5] \n\t"
|
||||
"movz %[temp5], %[temp7], %[temp1] \n\t"
|
||||
"2: \n\t"
|
||||
"sb %[temp5], -1(%[dst_t]) \n\t"
|
||||
"bne %[frow_t], %[loop_end], 1b \n\t"
|
||||
|
||||
: [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp3]"=&r"(temp3),
|
||||
[temp4]"=&r"(temp4), [temp5]"=&r"(temp5), [temp6]"=&r"(temp6),
|
||||
[temp7]"=&r"(temp7), [frow_t]"+r"(frow_t), [irow_t]"+r"(irow_t),
|
||||
[dst_t]"+r"(dst_t), [loop_end]"=&r"(loop_end)
|
||||
: [temp2]"r"(temp2), [yscale]"r"(yscale), [temp8]"r"(temp8)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
wrk->y_accum += wrk->y_add;
|
||||
wrk->dst += wrk->dst_stride;
|
||||
} else {
|
||||
WebPRescalerExportRowC(wrk, x_out);
|
||||
}
|
||||
}
|
||||
}
|
||||
// no ExportRowExpand yet.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point
|
||||
@ -193,8 +199,9 @@ static void ExportRow(WebPRescaler* const wrk, int x_out) {
|
||||
extern void WebPRescalerDspInitMIPS32(void);
|
||||
|
||||
WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMIPS32(void) {
|
||||
WebPRescalerImportRow = ImportRow;
|
||||
WebPRescalerExportRow = ExportRow;
|
||||
WebPRescalerImportRowExpand = ImportRowExpand;
|
||||
WebPRescalerImportRowShrink = ImportRowShrink;
|
||||
WebPRescalerExportRowShrink = ExportRowShrink;
|
||||
}
|
||||
|
||||
#else // !WEBP_USE_MIPS32
|
||||
|
@ -15,28 +15,27 @@
|
||||
|
||||
#if defined(WEBP_USE_MIPS_DSP_R2)
|
||||
|
||||
#include <assert.h>
|
||||
#include "../utils/rescaler.h"
|
||||
|
||||
static void ImportRow(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
static void ImportRowShrink(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
const int x_stride = wrk->num_channels;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
const int fx_scale = wrk->fx_scale;
|
||||
const int x_add = wrk->x_add;
|
||||
const int x_sub = wrk->x_sub;
|
||||
const int src_width = wrk->src_width;
|
||||
int* frow = wrk->frow + channel;
|
||||
int* irow = wrk->irow + channel;
|
||||
const uint8_t* src1 = src + channel;
|
||||
int temp1, temp2, temp3, temp4;
|
||||
int temp3;
|
||||
int base, frac, sum;
|
||||
int accum, accum1;
|
||||
const int x_stride1 = x_stride << 2;
|
||||
int loop_c = x_out_max - channel;
|
||||
int x_out = channel;
|
||||
|
||||
if (!wrk->x_expand) {
|
||||
__asm__ volatile (
|
||||
assert(!wrk->x_expand);
|
||||
assert(!WebPRescalerInputDone(wrk));
|
||||
__asm__ volatile (
|
||||
"li %[sum], 0 \n\t"
|
||||
"li %[accum], 0 \n\t"
|
||||
"1: \n\t"
|
||||
@ -53,88 +52,99 @@ static void ImportRow(WebPRescaler* const wrk,
|
||||
"negu %[accum1], %[accum] \n\t"
|
||||
"mul %[frac], %[base], %[accum1] \n\t"
|
||||
"mul %[temp3], %[sum], %[x_sub] \n\t"
|
||||
"lw %[base], 0(%[irow]) \n\t"
|
||||
"sll %[accum1], %[frac], 1 \n\t"
|
||||
"subu %[loop_c], %[loop_c], %[x_stride] \n\t"
|
||||
"mulq_rs.w %[sum], %[accum1], %[fx_scale] \n\t"
|
||||
"subu %[temp3], %[temp3], %[frac] \n\t"
|
||||
"sw %[temp3], 0(%[frow]) \n\t"
|
||||
"addu %[base], %[base], %[temp3] \n\t"
|
||||
"sw %[base], 0(%[irow]) \n\t"
|
||||
"addu %[irow], %[irow], %[x_stride1] \n\t"
|
||||
"addu %[frow], %[frow], %[x_stride1] \n\t"
|
||||
"bgtz %[loop_c], 1b \n\t"
|
||||
: [accum]"=&r"(accum), [src1]"+&r"(src1), [temp3]"=&r"(temp3),
|
||||
[sum]"=&r"(sum), [base]"=&r"(base), [frac]"=&r"(frac),
|
||||
[frow]"+&r"(frow), [irow]"+&r"(irow), [accum1]"=&r"(accum1),
|
||||
[loop_c]"+&r"(loop_c)
|
||||
: [x_stride]"r"(x_stride), [fx_scale]"r"(fx_scale), [x_sub]"r"(x_sub),
|
||||
[x_add] "r" (x_add), [x_stride1] "r" (x_stride1)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
} else {
|
||||
__asm__ volatile (
|
||||
"addiu %[temp3], %[src_width], -1 \n\t"
|
||||
"lbu %[temp2], 0(%[src1]) \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"bgtz %[temp3], 0f \n\t"
|
||||
"addiu %[temp1], %[temp2], 0 \n\t"
|
||||
"b 3f \n\t"
|
||||
"0: \n\t"
|
||||
"lbu %[temp1], 0(%[src1]) \n\t"
|
||||
"3: \n\t"
|
||||
"addiu %[accum], %[x_add], 0 \n\t"
|
||||
"1: \n\t"
|
||||
"subu %[temp3], %[temp2], %[temp1] \n\t"
|
||||
"mul %[temp3], %[temp3], %[accum] \n\t"
|
||||
"mul %[temp4], %[temp1], %[x_add] \n\t"
|
||||
"lw %[frac], 0(%[irow]) \n\t"
|
||||
"addu %[temp3], %[temp4], %[temp3] \n\t"
|
||||
"sw %[temp3], 0(%[frow]) \n\t"
|
||||
"addu %[frow], %[frow], %[x_stride1] \n\t"
|
||||
"addu %[frac], %[frac], %[temp3] \n\t"
|
||||
"addu %[x_out], %[x_out], %[x_stride] \n\t"
|
||||
"sw %[frac], 0(%[irow]) \n\t"
|
||||
"subu %[temp3], %[x_out], %[x_out_max] \n\t"
|
||||
"addu %[irow], %[irow], %[x_stride1] \n\t"
|
||||
"bgez %[temp3], 2f \n\t"
|
||||
"subu %[accum], %[accum], %[x_sub] \n\t"
|
||||
"bgez %[accum], 4f \n\t"
|
||||
"addiu %[temp2], %[temp1], 0 \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"lbu %[temp1], 0(%[src1]) \n\t"
|
||||
"addu %[accum], %[accum], %[x_add] \n\t"
|
||||
"4: \n\t"
|
||||
"b 1b \n\t"
|
||||
"2: \n\t"
|
||||
: [src1] "+r" (src1), [accum] "=&r" (accum), [temp1] "=&r" (temp1),
|
||||
[temp2] "=&r" (temp2), [temp3] "=&r" (temp3), [temp4] "=&r" (temp4),
|
||||
[x_out] "+r" (x_out), [frac] "=&r" (frac), [frow] "+r" (frow),
|
||||
[irow] "+r" (irow)
|
||||
: [x_stride] "r" (x_stride), [x_add] "r" (x_add), [x_sub] "r" (x_sub),
|
||||
[x_stride1] "r" (x_stride1), [src_width] "r" (src_width),
|
||||
[x_out_max] "r" (x_out_max)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
}
|
||||
: [accum]"=&r"(accum), [src1]"+&r"(src1), [temp3]"=&r"(temp3),
|
||||
[sum]"=&r"(sum), [base]"=&r"(base), [frac]"=&r"(frac),
|
||||
[frow]"+&r"(frow), [accum1]"=&r"(accum1),
|
||||
[loop_c]"+&r"(loop_c)
|
||||
: [x_stride]"r"(x_stride), [fx_scale]"r"(fx_scale), [x_sub]"r"(x_sub),
|
||||
[x_add] "r" (x_add), [x_stride1] "r" (x_stride1)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
}
|
||||
|
||||
static void ExportRow(WebPRescaler* const wrk, int x_out) {
|
||||
if (wrk->y_accum <= 0) {
|
||||
// if wrk->fxy_scale can fit into 32 bits use optimized code,
|
||||
// otherwise use C code
|
||||
if ((wrk->fxy_scale >> 32) == 0) {
|
||||
uint8_t* dst = wrk->dst;
|
||||
int32_t* irow = wrk->irow;
|
||||
const int32_t* frow = wrk->frow;
|
||||
const int yscale = wrk->fy_scale * (-wrk->y_accum);
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
int temp0, temp1, temp3, temp4, temp5, temp6, temp7;
|
||||
const int temp2 = (int)wrk->fxy_scale;
|
||||
const int rest = (x_out_max - x_out) & 1;
|
||||
const int32_t* const loop_end = frow + (x_out_max - x_out) - rest;
|
||||
static void ImportRowExpand(WebPRescaler* const wrk,
|
||||
const uint8_t* const src, int channel) {
|
||||
const int x_stride = wrk->num_channels;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
const int x_add = wrk->x_add;
|
||||
const int x_sub = wrk->x_sub;
|
||||
const int src_width = wrk->src_width;
|
||||
int* frow = wrk->frow + channel;
|
||||
const uint8_t* src1 = src + channel;
|
||||
int temp1, temp2, temp3, temp4;
|
||||
int frac;
|
||||
int accum;
|
||||
const int x_stride1 = x_stride << 2;
|
||||
int x_out = channel;
|
||||
|
||||
__asm__ volatile (
|
||||
assert(wrk->x_expand);
|
||||
assert(!WebPRescalerInputDone(wrk));
|
||||
__asm__ volatile (
|
||||
"addiu %[temp3], %[src_width], -1 \n\t"
|
||||
"lbu %[temp2], 0(%[src1]) \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"bgtz %[temp3], 0f \n\t"
|
||||
"addiu %[temp1], %[temp2], 0 \n\t"
|
||||
"b 3f \n\t"
|
||||
"0: \n\t"
|
||||
"lbu %[temp1], 0(%[src1]) \n\t"
|
||||
"3: \n\t"
|
||||
"addiu %[accum], %[x_add], 0 \n\t"
|
||||
"1: \n\t"
|
||||
"subu %[temp3], %[temp2], %[temp1] \n\t"
|
||||
"mul %[temp3], %[temp3], %[accum] \n\t"
|
||||
"mul %[temp4], %[temp1], %[x_add] \n\t"
|
||||
"addu %[temp3], %[temp4], %[temp3] \n\t"
|
||||
"sw %[temp3], 0(%[frow]) \n\t"
|
||||
"addu %[frow], %[frow], %[x_stride1] \n\t"
|
||||
"addu %[x_out], %[x_out], %[x_stride] \n\t"
|
||||
"subu %[temp3], %[x_out], %[x_out_max] \n\t"
|
||||
"bgez %[temp3], 2f \n\t"
|
||||
"subu %[accum], %[accum], %[x_sub] \n\t"
|
||||
"bgez %[accum], 4f \n\t"
|
||||
"addiu %[temp2], %[temp1], 0 \n\t"
|
||||
"addu %[src1], %[src1], %[x_stride] \n\t"
|
||||
"lbu %[temp1], 0(%[src1]) \n\t"
|
||||
"addu %[accum], %[accum], %[x_add] \n\t"
|
||||
"4: \n\t"
|
||||
"b 1b \n\t"
|
||||
"2: \n\t"
|
||||
: [src1] "+r" (src1), [accum] "=&r" (accum), [temp1] "=&r" (temp1),
|
||||
[temp2] "=&r" (temp2), [temp3] "=&r" (temp3), [temp4] "=&r" (temp4),
|
||||
[x_out] "+r" (x_out), [frac] "=&r" (frac), [frow] "+r" (frow)
|
||||
: [x_stride] "r" (x_stride), [x_add] "r" (x_add), [x_sub] "r" (x_sub),
|
||||
[x_stride1] "r" (x_stride1), [src_width] "r" (src_width),
|
||||
[x_out_max] "r" (x_out_max)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
}
|
||||
|
||||
static void ExportRowShrink(WebPRescaler* const wrk) {
|
||||
assert(!WebPRescalerOutputDone(wrk));
|
||||
assert(wrk->y_accum <= 0);
|
||||
assert(!wrk->y_expand);
|
||||
// if wrk->fxy_scale can fit into 32 bits use optimized code,
|
||||
// otherwise use C code
|
||||
if ((wrk->fxy_scale >> 32) == 0) {
|
||||
uint8_t* dst = wrk->dst;
|
||||
rescaler_t* irow = wrk->irow;
|
||||
const rescaler_t* frow = wrk->frow;
|
||||
const int yscale = wrk->fy_scale * (-wrk->y_accum);
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
|
||||
int temp0, temp1, temp3, temp4, temp5, temp6, temp7;
|
||||
const int temp2 = (int)wrk->fxy_scale;
|
||||
const int rest = x_out_max & 1;
|
||||
const rescaler_t* const loop_end = frow + x_out_max - rest;
|
||||
|
||||
__asm__ volatile (
|
||||
".set push \n\t"
|
||||
".set noreorder \n\t"
|
||||
"beq %[frow], %[loop_end], 1f \n\t"
|
||||
@ -188,30 +198,30 @@ static void ExportRow(WebPRescaler* const wrk, int x_out) {
|
||||
"sb %[temp5], 0(%[dst]) \n\t"
|
||||
"3: \n\t"
|
||||
".set pop \n\t"
|
||||
: [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp3]"=&r"(temp3),
|
||||
[temp4]"=&r"(temp4), [temp5]"=&r"(temp5), [temp6]"=&r"(temp6),
|
||||
[temp7]"=&r"(temp7), [frow]"+&r"(frow), [irow]"+&r"(irow),
|
||||
[dst]"+&r"(dst)
|
||||
: [temp2]"r"(temp2), [yscale]"r"(yscale), [loop_end]"r"(loop_end),
|
||||
[rest]"r"(rest)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
wrk->y_accum += wrk->y_add;
|
||||
wrk->dst += wrk->dst_stride;
|
||||
} else {
|
||||
WebPRescalerExportRowC(wrk, x_out);
|
||||
}
|
||||
: [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp3]"=&r"(temp3),
|
||||
[temp4]"=&r"(temp4), [temp5]"=&r"(temp5), [temp6]"=&r"(temp6),
|
||||
[temp7]"=&r"(temp7), [frow]"+&r"(frow), [irow]"+&r"(irow),
|
||||
[dst]"+&r"(dst)
|
||||
: [temp2]"r"(temp2), [yscale]"r"(yscale), [loop_end]"r"(loop_end),
|
||||
[rest]"r"(rest)
|
||||
: "memory", "hi", "lo"
|
||||
);
|
||||
} else {
|
||||
WebPRescalerExportRowShrinkC(wrk);
|
||||
}
|
||||
}
|
||||
|
||||
// no ExportRowExpand yet.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point
|
||||
|
||||
extern void WebPRescalerDspInitMIPSdspR2(void);
|
||||
|
||||
WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMIPSdspR2(void) {
|
||||
WebPRescalerImportRow = ImportRow;
|
||||
WebPRescalerExportRow = ExportRow;
|
||||
WebPRescalerImportRowExpand = ImportRowExpand;
|
||||
WebPRescalerImportRowShrink = ImportRowShrink;
|
||||
WebPRescalerExportRowShrink = ExportRowShrink;
|
||||
}
|
||||
|
||||
#else // !WEBP_USE_MIPS_DSP_R2
|
||||
|
Reference in New Issue
Block a user