mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-30 16:14:11 +00:00
Convert gfx/scaler to C89-style for loop declarations too
This commit is contained in:
parent
8487cd0204
commit
d63ac7e7e2
@ -34,7 +34,8 @@ static bool allocate_filters(struct scaler_ctx *ctx)
|
||||
|
||||
static void gen_filter_point_sub(struct scaler_filter *filter, int len, int pos, int step)
|
||||
{
|
||||
for (int i = 0; i < len; i++, pos += step)
|
||||
int i;
|
||||
for (i = 0; i < len; i++, pos += step)
|
||||
{
|
||||
filter->filter_pos[i] = pos >> 16;
|
||||
filter->filter[i] = FILTER_UNITY;
|
||||
@ -66,7 +67,8 @@ static bool gen_filter_point(struct scaler_ctx *ctx)
|
||||
|
||||
static void gen_filter_bilinear_sub(struct scaler_filter *filter, int len, int pos, int step)
|
||||
{
|
||||
for (int i = 0; i < len; i++, pos += step)
|
||||
int i;
|
||||
for (i = 0; i < len; i++, pos += step)
|
||||
{
|
||||
filter->filter_pos[i] = pos >> 16;
|
||||
filter->filter[i * 2 + 1] = (pos & 0xffff) >> 2;
|
||||
@ -105,14 +107,15 @@ static inline double filter_sinc(double phase)
|
||||
|
||||
static void gen_filter_sinc_sub(struct scaler_filter *filter, int len, int pos, int step, double phase_mul)
|
||||
{
|
||||
int i, j;
|
||||
const int sinc_size = filter->filter_len;
|
||||
|
||||
for (int i = 0; i < len; i++, pos += step)
|
||||
for (i = 0; i < len; i++, pos += step)
|
||||
{
|
||||
filter->filter_pos[i] = pos >> 16;
|
||||
|
||||
//int16_t sinc_sum = 0;
|
||||
for (int j = 0; j < sinc_size; j++)
|
||||
for (j = 0; j < sinc_size; j++)
|
||||
{
|
||||
double sinc_phase = M_PI * ((double)((sinc_size << 15) + (pos & 0xffff)) / 0x10000 - j);
|
||||
double lanczos_phase = sinc_phase / ((sinc_size >> 1));
|
||||
@ -154,8 +157,9 @@ static bool gen_filter_sinc(struct scaler_ctx *ctx)
|
||||
|
||||
static bool validate_filter(struct scaler_ctx *ctx)
|
||||
{
|
||||
int i;
|
||||
int max_w_pos = ctx->in_width - ctx->horiz.filter_len;
|
||||
for (int i = 0; i < ctx->out_width; i++)
|
||||
for (i = 0; i < ctx->out_width; i++)
|
||||
{
|
||||
if (ctx->horiz.filter_pos[i] > max_w_pos || ctx->horiz.filter_pos[i] < 0)
|
||||
{
|
||||
@ -165,7 +169,7 @@ static bool validate_filter(struct scaler_ctx *ctx)
|
||||
}
|
||||
|
||||
int max_h_pos = ctx->in_height - ctx->vert.filter_len;
|
||||
for (int i = 0; i < ctx->out_height; i++)
|
||||
for (i = 0; i < ctx->out_height; i++)
|
||||
{
|
||||
if (ctx->vert.filter_pos[i] > max_h_pos || ctx->vert.filter_pos[i] < 0)
|
||||
{
|
||||
@ -179,9 +183,10 @@ static bool validate_filter(struct scaler_ctx *ctx)
|
||||
|
||||
static void fixup_filter_sub(struct scaler_filter *filter, int out_len, int in_len)
|
||||
{
|
||||
int i;
|
||||
int max_pos = in_len - filter->filter_len;
|
||||
|
||||
for (int i = 0; i < out_len; i++)
|
||||
for (i = 0; i < out_len; i++)
|
||||
{
|
||||
int postsample = filter->filter_pos[i] - max_pos;
|
||||
int presample = -filter->filter_pos[i];
|
||||
|
@ -32,6 +32,7 @@ void conv_rgb565_0rgb1555(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint16_t *output = (uint16_t*)output_;
|
||||
|
||||
@ -40,9 +41,8 @@ void conv_rgb565_0rgb1555(void *output_, const void *input_,
|
||||
const __m128i hi_mask = _mm_set1_epi16(0x7fe0);
|
||||
const __m128i lo_mask = _mm_set1_epi16(0x1f);
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1)
|
||||
{
|
||||
int w;
|
||||
for (w = 0; w < max_width; w += 8)
|
||||
{
|
||||
const __m128i in = _mm_loadu_si128((const __m128i*)(input + w));
|
||||
@ -65,12 +65,13 @@ void conv_rgb565_0rgb1555(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint16_t *output = (uint16_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1)
|
||||
{
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint16_t col = input[w];
|
||||
uint16_t hi = (col >> 1) & 0x7fe0;
|
||||
@ -87,6 +88,7 @@ void conv_0rgb1555_rgb565(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint16_t *output = (uint16_t*)output_;
|
||||
|
||||
@ -96,9 +98,8 @@ void conv_0rgb1555_rgb565(void *output_, const void *input_,
|
||||
const __m128i lo_mask = _mm_set1_epi16(0x1f);
|
||||
const __m128i glow_mask = _mm_set1_epi16(1 << 5);
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1)
|
||||
{
|
||||
int w;
|
||||
for (w = 0; w < max_width; w += 8)
|
||||
{
|
||||
const __m128i in = _mm_loadu_si128((const __m128i*)(input + w));
|
||||
@ -123,12 +124,13 @@ void conv_0rgb1555_rgb565(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint16_t *output = (uint16_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1)
|
||||
{
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint16_t col = input[w];
|
||||
uint16_t rg = (col << 1) & ((0x1f << 11) | (0x1f << 6));
|
||||
@ -145,6 +147,7 @@ void conv_0rgb1555_argb8888(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
@ -156,9 +159,8 @@ void conv_0rgb1555_argb8888(void *output_, const void *input_,
|
||||
|
||||
int max_width = width - 7;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 1)
|
||||
{
|
||||
int w;
|
||||
for (w = 0; w < max_width; w += 8)
|
||||
{
|
||||
const __m128i in = _mm_loadu_si128((const __m128i*)(input + w));
|
||||
@ -201,12 +203,13 @@ void conv_0rgb1555_argb8888(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 1)
|
||||
{
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t col = input[w];
|
||||
uint32_t r = (col >> 10) & 0x1f;
|
||||
@ -227,6 +230,7 @@ void conv_rgb565_argb8888(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
@ -240,9 +244,8 @@ void conv_rgb565_argb8888(void *output_, const void *input_,
|
||||
|
||||
int max_width = width - 7;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 1)
|
||||
{
|
||||
int w;
|
||||
for (w = 0; w < max_width; w += 8)
|
||||
{
|
||||
const __m128i in = _mm_loadu_si128((const __m128i*)(input + w));
|
||||
@ -285,12 +288,13 @@ void conv_rgb565_argb8888(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 1)
|
||||
{
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t col = input[w];
|
||||
uint32_t r = (col >> 11) & 0x1f;
|
||||
@ -352,6 +356,7 @@ void conv_0rgb1555_bgr24(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint8_t *output = (uint8_t*)output_;
|
||||
|
||||
@ -363,11 +368,10 @@ void conv_0rgb1555_bgr24(void *output_, const void *input_,
|
||||
|
||||
int max_width = width - 15;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride, input += in_stride >> 1)
|
||||
{
|
||||
uint8_t *out = output;
|
||||
|
||||
int w;
|
||||
for (w = 0; w < max_width; w += 16, out += 48)
|
||||
{
|
||||
const __m128i in0 = _mm_loadu_si128((const __m128i*)(input + w + 0));
|
||||
@ -425,6 +429,7 @@ void conv_rgb565_bgr24(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint8_t *output = (uint8_t*)output_;
|
||||
|
||||
@ -438,11 +443,10 @@ void conv_rgb565_bgr24(void *output_, const void *input_,
|
||||
|
||||
int max_width = width - 15;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride, input += in_stride >> 1)
|
||||
{
|
||||
uint8_t *out = output;
|
||||
|
||||
int w;
|
||||
for (w = 0; w < max_width; w += 16, out += 48)
|
||||
{
|
||||
const __m128i in0 = _mm_loadu_si128((const __m128i*)(input + w));
|
||||
@ -499,13 +503,14 @@ void conv_0rgb1555_bgr24(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint8_t *output = (uint8_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride, input += in_stride >> 1)
|
||||
{
|
||||
uint8_t *out = output;
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t col = input[w];
|
||||
uint32_t b = (col >> 0) & 0x1f;
|
||||
@ -526,13 +531,14 @@ void conv_rgb565_bgr24(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint8_t *output = (uint8_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride, input += in_stride >> 1)
|
||||
for (h = 0; h < height; h++, output += out_stride, input += in_stride >> 1)
|
||||
{
|
||||
uint8_t *out = output;
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t col = input[w];
|
||||
uint32_t b = (col >> 0) & 0x1f;
|
||||
@ -554,13 +560,14 @@ void conv_bgr24_argb8888(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint8_t *input = (const uint8_t*)input_;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 2, input += in_stride)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 2, input += in_stride)
|
||||
{
|
||||
const uint8_t *inp = input;
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t b = *inp++;
|
||||
uint32_t g = *inp++;
|
||||
@ -574,12 +581,13 @@ void conv_argb8888_0rgb1555(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
uint16_t *output = (uint16_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 2)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 2)
|
||||
{
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t col = input[w];
|
||||
uint16_t r = (col >> 19) & 0x1f;
|
||||
@ -595,15 +603,15 @@ void conv_argb8888_bgr24(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
uint8_t *output = (uint8_t*)output_;
|
||||
|
||||
int max_width = width - 15;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride, input += in_stride >> 2)
|
||||
for (h = 0; h < height; h++, output += out_stride, input += in_stride >> 2)
|
||||
{
|
||||
uint8_t *out = output;
|
||||
int w;
|
||||
|
||||
for (w = 0; w < max_width; w += 16, out += 48)
|
||||
{
|
||||
@ -628,13 +636,14 @@ void conv_argb8888_bgr24(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
uint8_t *output = (uint8_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride, input += in_stride >> 2)
|
||||
for (h = 0; h < height; h++, output += out_stride, input += in_stride >> 2)
|
||||
{
|
||||
uint8_t *out = output;
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t col = input[w];
|
||||
*out++ = (uint8_t)(col >> 0);
|
||||
@ -649,12 +658,13 @@ void conv_argb8888_abgr8888(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 2)
|
||||
for (h = 0; h < height; h++, output += out_stride >> 2, input += in_stride >> 2)
|
||||
{
|
||||
for (int w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t col = input[w];
|
||||
output[w] = ((col << 16) & 0xff0000) | ((col >> 16) & 0xff) | (col & 0xff00ff00);
|
||||
@ -666,6 +676,7 @@ void conv_copy(void *output_, const void *input_,
|
||||
int width, int height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h;
|
||||
int copy_len = abs(out_stride);
|
||||
if (abs(in_stride) < copy_len)
|
||||
copy_len = abs(in_stride);
|
||||
@ -673,7 +684,7 @@ void conv_copy(void *output_, const void *input_,
|
||||
const uint8_t *input = (const uint8_t*)input_;
|
||||
uint8_t *output = (uint8_t*)output_;
|
||||
|
||||
for (int h = 0; h < height; h++, output += out_stride, input += in_stride)
|
||||
for (h = 0; h < height; h++, output += out_stride, input += in_stride)
|
||||
memcpy(output, input, copy_len);
|
||||
}
|
||||
|
||||
|
@ -61,22 +61,22 @@ static inline uint8_t clamp_8bit(int16_t col)
|
||||
#if defined(__SSE2__)
|
||||
void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int stride)
|
||||
{
|
||||
int h, w, y;
|
||||
const uint64_t *input = ctx->scaled.frame;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
const int16_t *filter_vert = ctx->vert.filter;
|
||||
|
||||
for (int h = 0; h < ctx->out_height; h++, filter_vert += ctx->vert.filter_stride, output += stride >> 2)
|
||||
for (h = 0; h < ctx->out_height; h++, filter_vert += ctx->vert.filter_stride, output += stride >> 2)
|
||||
{
|
||||
const uint64_t *input_base = input + ctx->vert.filter_pos[h] * (ctx->scaled.stride >> 3);
|
||||
|
||||
for (int w = 0; w < ctx->out_width; w++)
|
||||
for (w = 0; w < ctx->out_width; w++)
|
||||
{
|
||||
__m128i res = _mm_setzero_si128();
|
||||
|
||||
const uint64_t *input_base_y = input_base + w;
|
||||
|
||||
size_t y;
|
||||
for (y = 0; (y + 1) < ctx->vert.filter_len; y += 2, input_base_y += (ctx->scaled.stride >> 2))
|
||||
{
|
||||
__m128i coeff = _mm_set_epi64x(filter_vert[y + 1] * 0x0001000100010001ll, filter_vert[y + 0] * 0x0001000100010001ll);
|
||||
@ -105,16 +105,17 @@ void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int strid
|
||||
#else
|
||||
void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int stride)
|
||||
{
|
||||
int h, w, y;
|
||||
const uint64_t *input = ctx->scaled.frame;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
const int16_t *filter_vert = ctx->vert.filter;
|
||||
|
||||
for (int h = 0; h < ctx->out_height; h++, filter_vert += ctx->vert.filter_stride, output += stride >> 2)
|
||||
for (h = 0; h < ctx->out_height; h++, filter_vert += ctx->vert.filter_stride, output += stride >> 2)
|
||||
{
|
||||
const uint64_t *input_base = input + ctx->vert.filter_pos[h] * (ctx->scaled.stride >> 3);
|
||||
|
||||
for (int w = 0; w < ctx->out_width; w++)
|
||||
for (w = 0; w < ctx->out_width; w++)
|
||||
{
|
||||
int16_t res_a = 0;
|
||||
int16_t res_r = 0;
|
||||
@ -122,7 +123,7 @@ void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int strid
|
||||
int16_t res_b = 0;
|
||||
|
||||
const uint64_t *input_base_y = input_base + w;
|
||||
for (size_t y = 0; y < ctx->vert.filter_len; y++, input_base_y += (ctx->scaled.stride >> 3))
|
||||
for (y = 0; y < ctx->vert.filter_len; y++, input_base_y += (ctx->scaled.stride >> 3))
|
||||
{
|
||||
uint64_t col = *input_base_y;
|
||||
|
||||
@ -153,20 +154,20 @@ void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int strid
|
||||
#if defined(__SSE2__)
|
||||
void scaler_argb8888_horiz(const struct scaler_ctx *ctx, const void *input_, int stride)
|
||||
{
|
||||
int h, w, x;
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
uint64_t *output = ctx->scaled.frame;
|
||||
|
||||
for (int h = 0; h < ctx->scaled.height; h++, input += stride >> 2, output += ctx->scaled.stride >> 3)
|
||||
for (h = 0; h < ctx->scaled.height; h++, input += stride >> 2, output += ctx->scaled.stride >> 3)
|
||||
{
|
||||
const int16_t *filter_horiz = ctx->horiz.filter;
|
||||
|
||||
for (int w = 0; w < ctx->scaled.width; w++, filter_horiz += ctx->horiz.filter_stride)
|
||||
for (w = 0; w < ctx->scaled.width; w++, filter_horiz += ctx->horiz.filter_stride)
|
||||
{
|
||||
__m128i res = _mm_setzero_si128();
|
||||
|
||||
const uint32_t *input_base_x = input + ctx->horiz.filter_pos[w];
|
||||
|
||||
size_t x;
|
||||
for (x = 0; (x + 1) < ctx->horiz.filter_len; x += 2)
|
||||
{
|
||||
__m128i coeff = _mm_set_epi64x(filter_horiz[x + 1] * 0x0001000100010001ll, filter_horiz[x + 0] * 0x0001000100010001ll);
|
||||
@ -207,14 +208,15 @@ void scaler_argb8888_horiz(const struct scaler_ctx *ctx, const void *input_, int
|
||||
#else
|
||||
void scaler_argb8888_horiz(const struct scaler_ctx *ctx, const void *input_, int stride)
|
||||
{
|
||||
int h, w, x;
|
||||
const uint32_t *input = (uint32_t*)input_;
|
||||
uint64_t *output = ctx->scaled.frame;
|
||||
|
||||
for (int h = 0; h < ctx->scaled.height; h++, input += stride >> 2, output += ctx->scaled.stride >> 3)
|
||||
for (h = 0; h < ctx->scaled.height; h++, input += stride >> 2, output += ctx->scaled.stride >> 3)
|
||||
{
|
||||
const int16_t *filter_horiz = ctx->horiz.filter;
|
||||
|
||||
for (int w = 0; w < ctx->scaled.width; w++, filter_horiz += ctx->horiz.filter_stride)
|
||||
for (w = 0; w < ctx->scaled.width; w++, filter_horiz += ctx->horiz.filter_stride)
|
||||
{
|
||||
const uint32_t *input_base_x = input + ctx->horiz.filter_pos[w];
|
||||
|
||||
@ -223,7 +225,7 @@ void scaler_argb8888_horiz(const struct scaler_ctx *ctx, const void *input_, int
|
||||
int16_t res_g = 0;
|
||||
int16_t res_b = 0;
|
||||
|
||||
for (size_t x = 0; x < ctx->horiz.filter_len; x++)
|
||||
for (x = 0; x < ctx->horiz.filter_len; x++)
|
||||
{
|
||||
uint32_t col = input_base_x[x];
|
||||
|
||||
@ -252,6 +254,7 @@ void scaler_argb8888_point_special(const struct scaler_ctx *ctx,
|
||||
int in_width, int in_height,
|
||||
int out_stride, int in_stride)
|
||||
{
|
||||
int h, w;
|
||||
(void)ctx;
|
||||
int x_pos = (1 << 15) * in_width / out_width - (1 << 15);
|
||||
int x_step = (1 << 16) * in_width / out_width;
|
||||
@ -266,12 +269,12 @@ void scaler_argb8888_point_special(const struct scaler_ctx *ctx,
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
uint32_t *output = (uint32_t*)output_;
|
||||
|
||||
for (int h = 0; h < out_height; h++, y_pos += y_step, output += out_stride >> 2)
|
||||
for (h = 0; h < out_height; h++, y_pos += y_step, output += out_stride >> 2)
|
||||
{
|
||||
int x = x_pos;
|
||||
const uint32_t *inp = input + (y_pos >> 16) * (in_stride >> 2);
|
||||
|
||||
for (int w = 0; w < out_width; w++, x += x_step)
|
||||
for (w = 0; w < out_width; w++, x += x_step)
|
||||
output[w] = inp[x >> 16];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user