MIPS: dspr2: added optimization for function MakeARGB32

inline function MakeARGB32 calls changed to call
via pointers to functions which make (a)rgb for
entire row

Change-Id: Ia4bd4be171a46c1e1821e408b073ff5791c587a9
This commit is contained in:
Djordje Pesut
2014-11-20 16:53:05 +01:00
parent 87c3d53180
commit 7ce8788b06
9 changed files with 197 additions and 11 deletions

View File

@ -15,6 +15,7 @@
#include <stdlib.h>
#include "./vp8enci.h"
#include "../dsp/dsp.h"
#include "../utils/utils.h"
//------------------------------------------------------------------------------
@ -38,6 +39,7 @@ int WebPPictureInitInternal(WebPPicture* picture, int version) {
memset(picture, 0, sizeof(*picture));
picture->writer = DummyWriter;
WebPEncodingSetError(picture, VP8_ENC_OK);
VP8EncDspARGBInit();
}
return 1;
}

View File

@ -32,10 +32,6 @@ static const union {
} test_endian = { 0xff000000u };
#define ALPHA_IS_LAST (test_endian.bytes[3] == 0xff)
static WEBP_INLINE uint32_t MakeARGB32(int a, int r, int g, int b) {
return (((uint32_t)a << 24) | (r << 16) | (g << 8) | b);
}
//------------------------------------------------------------------------------
// Detection of non-trivial transparency
@ -1065,13 +1061,19 @@ static int Import(WebPPicture* const picture,
if (!WebPPictureAlloc(picture)) return 0;
assert(step >= (import_alpha ? 4 : 3));
for (y = 0; y < height; ++y) {
uint32_t* const dst = &picture->argb[y * picture->argb_stride];
int x;
for (x = 0; x < width; ++x) {
const int offset = step * x + y * rgb_stride;
dst[x] = MakeARGB32(import_alpha ? a_ptr[offset] : 0xff,
r_ptr[offset], g_ptr[offset], b_ptr[offset]);
if (import_alpha) {
for (y = 0; y < height; ++y) {
uint32_t* const dst = &picture->argb[y * picture->argb_stride];
const int offset = y * rgb_stride;
VP8PackARGB(a_ptr + offset, r_ptr + offset, g_ptr + offset,
b_ptr + offset, width, step, dst);
}
} else {
for (y = 0; y < height; ++y) {
uint32_t* const dst = &picture->argb[y * picture->argb_stride];
const int offset = y * rgb_stride;
VP8PackRGB(r_ptr + offset, g_ptr + offset, b_ptr + offset,
width, step, dst);
}
}
return 1;