simplify/reorganize arguments for CollectColorBlueTransforms

and other various call sites too.

Change-Id: Icb8f828dfe25672662de18d0e48e7d3144b1f38d
This commit is contained in:
Pascal Massimino
2015-01-15 07:31:46 -08:00
committed by James Zern
parent b9e356b998
commit 3fd59039bd
3 changed files with 75 additions and 84 deletions

View File

@ -378,21 +378,18 @@ static WEBP_INLINE uint8_t TransformColorBlue(uint8_t green_to_blue,
return (new_blue & 0xff);
}
static void CollectColorBlueTransforms(
int tile_x_offset, int tile_y_offset, int all_x_max, int all_y_max,
int xsize, int green_to_blue, int red_to_blue, int* histo,
const uint32_t* const argb) {
static void CollectColorBlueTransforms(const uint32_t* argb, int stride,
int tile_width, int tile_height,
int green_to_blue, int red_to_blue,
int histo[]) {
const int rtb = (red_to_blue << 16) | (red_to_blue & 0xffff);
const int gtb = (green_to_blue << 16) | (green_to_blue & 0xffff);
const uint32_t mask = 0xff00ffu;
int ix = tile_y_offset * xsize + tile_x_offset;
int all_y;
for (all_y = tile_y_offset; all_y < all_y_max; ++all_y) {
uint32_t* p_argb = (uint32_t*)&argb[ix];
const int loop_cnt = all_x_max - tile_x_offset;
int all_x;
ix += xsize;
for (all_x = 0; all_x < (loop_cnt >> 1); ++all_x) {
while (tile_height-- > 0) {
int x;
const uint32_t* p_argb = argb;
argb += stride;
for (x = 0; x < (tile_width >> 1); ++x) {
int temp0, temp1, temp2, temp3, temp4, temp5, temp6;
__asm__ volatile (
"lw %[temp0], 0(%[p_argb]) \n\t"
@ -418,7 +415,7 @@ static void CollectColorBlueTransforms(
++histo[(uint8_t)(temp2 >> 16)];
++histo[(uint8_t)temp2];
}
if (loop_cnt & 1) {
if (tile_width & 1) {
++histo[TransformColorBlue(green_to_blue, red_to_blue, *p_argb)];
}
}
@ -432,18 +429,15 @@ static WEBP_INLINE uint8_t TransformColorRed(uint8_t green_to_red,
return (new_red & 0xff);
}
static void CollectColorRedTransforms(
int tile_x_offset, int tile_y_offset, int all_x_max, int all_y_max,
int xsize, int green_to_red, int* histo, const uint32_t* const argb) {
static void CollectColorRedTransforms(const uint32_t* argb, int stride,
int tile_width, int tile_height,
int green_to_red, int histo[]) {
const int gtr = (green_to_red << 16) | (green_to_red & 0xffff);
int ix = tile_y_offset * xsize + tile_x_offset;
int all_y;
for (all_y = tile_y_offset; all_y < all_y_max; ++all_y) {
uint32_t* p_argb = (uint32_t*)&argb[ix];
const int loop_cnt = all_x_max - tile_x_offset;
int all_x;
ix += xsize;
for (all_x = 0; all_x < (loop_cnt >> 1); ++all_x) {
while (tile_height-- > 0) {
int x;
const uint32_t* p_argb = argb;
argb += stride;
for (x = 0; x < (tile_width >> 1); ++x) {
int temp0, temp1, temp2, temp3, temp4;
__asm__ volatile (
"lw %[temp0], 0(%[p_argb]) \n\t"
@ -463,7 +457,7 @@ static void CollectColorRedTransforms(
++histo[(uint8_t)(temp2 >> 16)];
++histo[(uint8_t)temp2];
}
if (loop_cnt & 1) {
if (tile_width & 1) {
++histo[TransformColorRed(green_to_red, *p_argb)];
}
}