|
|
|
@ -26,7 +26,8 @@ |
|
|
|
|
|
|
|
|
|
#include <stddef.h> |
|
|
|
|
|
|
|
|
|
static inline void rgb24tobgr32_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void rgb24tobgr32_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
uint8_t *dest = dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
@ -49,7 +50,8 @@ static inline void rgb24tobgr32_c(const uint8_t *src, uint8_t *dst, int src_size |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void rgb32tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void rgb32tobgr24_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
uint8_t *dest = dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
@ -73,15 +75,15 @@ static inline void rgb32tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
original by Strepto/Astral |
|
|
|
|
ported to gcc & bugfixed: A'rpi |
|
|
|
|
MMX2, 3DNOW optimization by Nick Kurshev |
|
|
|
|
32-bit C version, and and&add trick by Michael Niedermayer |
|
|
|
|
* original by Strepto/Astral |
|
|
|
|
* ported to gcc & bugfixed: A'rpi |
|
|
|
|
* MMX2, 3DNOW optimization by Nick Kurshev |
|
|
|
|
* 32-bit C version, and and&add trick by Michael Niedermayer |
|
|
|
|
*/ |
|
|
|
|
static inline void rgb15to16_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
{ |
|
|
|
|
register const uint8_t* s=src; |
|
|
|
|
register uint8_t *d = dst; |
|
|
|
|
register const uint8_t *s = src; |
|
|
|
|
register const uint8_t *end = s + src_size; |
|
|
|
|
const uint8_t *mm_end = end - 3; |
|
|
|
|
|
|
|
|
@ -99,8 +101,8 @@ static inline void rgb15to16_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
|
|
|
|
|
static inline void rgb16to15_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
{ |
|
|
|
|
register const uint8_t* s=src; |
|
|
|
|
register uint8_t *d = dst; |
|
|
|
|
register const uint8_t *s = src; |
|
|
|
|
register const uint8_t *end = s + src_size; |
|
|
|
|
const uint8_t *mm_end = end - 3; |
|
|
|
|
|
|
|
|
@ -118,56 +120,71 @@ static inline void rgb16to15_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
|
|
|
|
|
static inline void rgb32to16_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
{ |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
uint16_t *d = (uint16_t *)dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
const uint8_t *end = s + src_size; |
|
|
|
|
|
|
|
|
|
while (s < end) { |
|
|
|
|
register int rgb = *(const uint32_t*)s; s += 4; |
|
|
|
|
*d++ = ((rgb&0xFF)>>3) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>8); |
|
|
|
|
register int rgb = *(const uint32_t *)s; |
|
|
|
|
s += 4; |
|
|
|
|
*d++ = ((rgb & 0xFF) >> 3) + |
|
|
|
|
((rgb & 0xFC00) >> 5) + |
|
|
|
|
((rgb & 0xF80000) >> 8); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void rgb32tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void rgb32tobgr16_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
uint16_t *d = (uint16_t *)dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
const uint8_t *end = s + src_size; |
|
|
|
|
|
|
|
|
|
while (s < end) { |
|
|
|
|
register int rgb = *(const uint32_t*)s; s += 4; |
|
|
|
|
*d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19); |
|
|
|
|
register int rgb = *(const uint32_t *)s; |
|
|
|
|
s += 4; |
|
|
|
|
*d++ = ((rgb & 0xF8) << 8) + |
|
|
|
|
((rgb & 0xFC00) >> 5) + |
|
|
|
|
((rgb & 0xF80000) >> 19); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void rgb32to15_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
{ |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
uint16_t *d = (uint16_t *)dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
const uint8_t *end = s + src_size; |
|
|
|
|
|
|
|
|
|
while (s < end) { |
|
|
|
|
register int rgb = *(const uint32_t*)s; s += 4; |
|
|
|
|
*d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9); |
|
|
|
|
register int rgb = *(const uint32_t *)s; |
|
|
|
|
s += 4; |
|
|
|
|
*d++ = ((rgb & 0xFF) >> 3) + |
|
|
|
|
((rgb & 0xF800) >> 6) + |
|
|
|
|
((rgb & 0xF80000) >> 9); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void rgb32tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void rgb32tobgr15_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
uint16_t *d = (uint16_t *)dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
const uint8_t *end = s + src_size; |
|
|
|
|
|
|
|
|
|
while (s < end) { |
|
|
|
|
register int rgb = *(const uint32_t*)s; s += 4; |
|
|
|
|
*d++ = ((rgb&0xF8)<<7) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>19); |
|
|
|
|
register int rgb = *(const uint32_t *)s; |
|
|
|
|
s += 4; |
|
|
|
|
*d++ = ((rgb & 0xF8) << 7) + |
|
|
|
|
((rgb & 0xF800) >> 6) + |
|
|
|
|
((rgb & 0xF80000) >> 19); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void rgb24tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void rgb24tobgr16_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
uint16_t *d = (uint16_t *)dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
const uint8_t *end = s + src_size; |
|
|
|
|
|
|
|
|
|
while (s < end) { |
|
|
|
@ -180,8 +197,8 @@ static inline void rgb24tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size |
|
|
|
|
|
|
|
|
|
static inline void rgb24to16_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
{ |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
uint16_t *d = (uint16_t *)dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
const uint8_t *end = s + src_size; |
|
|
|
|
|
|
|
|
|
while (s < end) { |
|
|
|
@ -192,10 +209,11 @@ static inline void rgb24to16_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void rgb24tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void rgb24tobgr15_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
uint16_t *d = (uint16_t *)dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
const uint8_t *end = s + src_size; |
|
|
|
|
|
|
|
|
|
while (s < end) { |
|
|
|
@ -208,8 +226,8 @@ static inline void rgb24tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size |
|
|
|
|
|
|
|
|
|
static inline void rgb24to15_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
{ |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
uint16_t *d = (uint16_t *)dst; |
|
|
|
|
const uint8_t *s = src; |
|
|
|
|
const uint8_t *end = s + src_size; |
|
|
|
|
|
|
|
|
|
while (s < end) { |
|
|
|
@ -221,27 +239,28 @@ static inline void rgb24to15_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
I use less accurate approximation here by simply left-shifting the input |
|
|
|
|
value and filling the low order bits with zeroes. This method improves PNG |
|
|
|
|
compression but this scheme cannot reproduce white exactly, since it does |
|
|
|
|
not generate an all-ones maximum value; the net effect is to darken the |
|
|
|
|
image slightly. |
|
|
|
|
|
|
|
|
|
The better method should be "left bit replication": |
|
|
|
|
|
|
|
|
|
4 3 2 1 0 |
|
|
|
|
--------- |
|
|
|
|
1 1 0 1 1 |
|
|
|
|
|
|
|
|
|
7 6 5 4 3 2 1 0 |
|
|
|
|
---------------- |
|
|
|
|
1 1 0 1 1 1 1 0 |
|
|
|
|
|=======| |===| |
|
|
|
|
| leftmost bits repeated to fill open bits |
|
|
|
|
| |
|
|
|
|
original bits |
|
|
|
|
* I use less accurate approximation here by simply left-shifting the input |
|
|
|
|
* value and filling the low order bits with zeroes. This method improves PNG |
|
|
|
|
* compression but this scheme cannot reproduce white exactly, since it does |
|
|
|
|
* not generate an all-ones maximum value; the net effect is to darken the |
|
|
|
|
* image slightly. |
|
|
|
|
* |
|
|
|
|
* The better method should be "left bit replication": |
|
|
|
|
* |
|
|
|
|
* 4 3 2 1 0 |
|
|
|
|
* --------- |
|
|
|
|
* 1 1 0 1 1 |
|
|
|
|
* |
|
|
|
|
* 7 6 5 4 3 2 1 0 |
|
|
|
|
* ---------------- |
|
|
|
|
* 1 1 0 1 1 1 1 0 |
|
|
|
|
* |=======| |===| |
|
|
|
|
* | leftmost bits repeated to fill open bits |
|
|
|
|
* | |
|
|
|
|
* original bits |
|
|
|
|
*/ |
|
|
|
|
static inline void rgb15tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void rgb15tobgr24_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
uint8_t *d = dst; |
|
|
|
|
const uint16_t *s = (const uint16_t *)src; |
|
|
|
@ -255,7 +274,8 @@ static inline void rgb15tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void rgb16tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void rgb16tobgr24_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
uint8_t *d = (uint8_t *)dst; |
|
|
|
|
const uint16_t *s = (const uint16_t *)src; |
|
|
|
@ -313,11 +333,13 @@ static inline void rgb16to32_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, |
|
|
|
|
int src_size) |
|
|
|
|
{ |
|
|
|
|
int idx = 15 - src_size; |
|
|
|
|
const uint8_t *s = src - idx; |
|
|
|
|
uint8_t *d = dst - idx; |
|
|
|
|
|
|
|
|
|
for (; idx < 15; idx += 4) { |
|
|
|
|
register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00; |
|
|
|
|
v &= 0xff00ff; |
|
|
|
@ -328,6 +350,7 @@ static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int sr |
|
|
|
|
static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size) |
|
|
|
|
{ |
|
|
|
|
unsigned i; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < src_size; i += 3) { |
|
|
|
|
register uint8_t x = src[i + 2]; |
|
|
|
|
dst[i + 1] = src[i + 1]; |
|
|
|
@ -344,6 +367,7 @@ static inline void yuvPlanartoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
{ |
|
|
|
|
int y, i; |
|
|
|
|
const int chromWidth = width >> 1; |
|
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) { |
|
|
|
|
#if HAVE_FAST_64BIT |
|
|
|
|
uint64_t *ldst = (uint64_t *)dst; |
|
|
|
@ -362,6 +386,7 @@ static inline void yuvPlanartoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
#else |
|
|
|
|
int *idst = (int32_t *)dst; |
|
|
|
|
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < chromWidth; i++) { |
|
|
|
|
#if HAVE_BIGENDIAN |
|
|
|
|
*idst++ = (yc[0] << 24) + (uc[0] << 16) + |
|
|
|
@ -390,9 +415,8 @@ static inline void yuvPlanartoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
*/ |
|
|
|
|
static inline void yv12toyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
const uint8_t *vsrc, uint8_t *dst, |
|
|
|
|
int width, int height, |
|
|
|
|
int lumStride, int chromStride, |
|
|
|
|
int dstStride) |
|
|
|
|
int width, int height, int lumStride, |
|
|
|
|
int chromStride, int dstStride) |
|
|
|
|
{ |
|
|
|
|
//FIXME interpolate chroma
|
|
|
|
|
yuvPlanartoyuy2_c(ysrc, usrc, vsrc, dst, width, height, lumStride, |
|
|
|
@ -407,6 +431,7 @@ static inline void yuvPlanartouyvy_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
{ |
|
|
|
|
int y, i; |
|
|
|
|
const int chromWidth = width >> 1; |
|
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) { |
|
|
|
|
#if HAVE_FAST_64BIT |
|
|
|
|
uint64_t *ldst = (uint64_t *)dst; |
|
|
|
@ -425,6 +450,7 @@ static inline void yuvPlanartouyvy_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
#else |
|
|
|
|
int *idst = (int32_t *)dst; |
|
|
|
|
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < chromWidth; i++) { |
|
|
|
|
#if HAVE_BIGENDIAN |
|
|
|
|
*idst++ = (uc[0] << 24) + (yc[0] << 16) + |
|
|
|
@ -453,9 +479,8 @@ static inline void yuvPlanartouyvy_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
*/ |
|
|
|
|
static inline void yv12touyvy_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
const uint8_t *vsrc, uint8_t *dst, |
|
|
|
|
int width, int height, |
|
|
|
|
int lumStride, int chromStride, |
|
|
|
|
int dstStride) |
|
|
|
|
int width, int height, int lumStride, |
|
|
|
|
int chromStride, int dstStride) |
|
|
|
|
{ |
|
|
|
|
//FIXME interpolate chroma
|
|
|
|
|
yuvPlanartouyvy_c(ysrc, usrc, vsrc, dst, width, height, lumStride, |
|
|
|
@ -467,9 +492,8 @@ static inline void yv12touyvy_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
*/ |
|
|
|
|
static inline void yuv422ptouyvy_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
const uint8_t *vsrc, uint8_t *dst, |
|
|
|
|
int width, int height, |
|
|
|
|
int lumStride, int chromStride, |
|
|
|
|
int dstStride) |
|
|
|
|
int width, int height, int lumStride, |
|
|
|
|
int chromStride, int dstStride) |
|
|
|
|
{ |
|
|
|
|
yuvPlanartouyvy_c(ysrc, usrc, vsrc, dst, width, height, lumStride, |
|
|
|
|
chromStride, dstStride, 1); |
|
|
|
@ -480,9 +504,8 @@ static inline void yuv422ptouyvy_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
*/ |
|
|
|
|
static inline void yuv422ptoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
const uint8_t *vsrc, uint8_t *dst, |
|
|
|
|
int width, int height, |
|
|
|
|
int lumStride, int chromStride, |
|
|
|
|
int dstStride) |
|
|
|
|
int width, int height, int lumStride, |
|
|
|
|
int chromStride, int dstStride) |
|
|
|
|
{ |
|
|
|
|
yuvPlanartoyuy2_c(ysrc, usrc, vsrc, dst, width, height, lumStride, |
|
|
|
|
chromStride, dstStride, 1); |
|
|
|
@ -494,12 +517,12 @@ static inline void yuv422ptoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, |
|
|
|
|
*/ |
|
|
|
|
static inline void yuy2toyv12_c(const uint8_t *src, uint8_t *ydst, |
|
|
|
|
uint8_t *udst, uint8_t *vdst, |
|
|
|
|
int width, int height, |
|
|
|
|
int lumStride, int chromStride, |
|
|
|
|
int srcStride) |
|
|
|
|
int width, int height, int lumStride, |
|
|
|
|
int chromStride, int srcStride) |
|
|
|
|
{ |
|
|
|
|
int y; |
|
|
|
|
const int chromWidth = width >> 1; |
|
|
|
|
|
|
|
|
|
for (y = 0; y < height; y += 2) { |
|
|
|
|
int i; |
|
|
|
|
for (i = 0; i < chromWidth; i++) { |
|
|
|
@ -541,16 +564,16 @@ static inline void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth, |
|
|
|
|
for (y = 1; y < srcHeight; y++) { |
|
|
|
|
const int mmxSize = 1; |
|
|
|
|
|
|
|
|
|
dst[0 ]= (3*src[0] + src[srcStride])>>2; |
|
|
|
|
dst[0] = (src[0] * 3 + src[srcStride]) >> 2; |
|
|
|
|
dst[dstStride] = (src[0] + 3 * src[srcStride]) >> 2; |
|
|
|
|
|
|
|
|
|
for (x = mmxSize - 1; x < srcWidth - 1; x++) { |
|
|
|
|
dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2; |
|
|
|
|
dst[2 * x + 1] = (src[x + 0] * 3 + src[x + srcStride + 1]) >> 2; |
|
|
|
|
dst[2 * x + dstStride + 2] = (src[x + 0] + 3 * src[x + srcStride + 1]) >> 2; |
|
|
|
|
dst[2 * x + dstStride + 1] = (src[x + 1] + 3 * src[x + srcStride]) >> 2; |
|
|
|
|
dst[2*x +2]= (3*src[x+1] + src[x+srcStride ])>>2; |
|
|
|
|
dst[2 * x + 2] = (src[x + 1] * 3 + src[x + srcStride]) >> 2; |
|
|
|
|
} |
|
|
|
|
dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2; |
|
|
|
|
dst[srcWidth * 2 - 1] = (src[srcWidth - 1] * 3 + src[srcWidth - 1 + srcStride]) >> 2; |
|
|
|
|
dst[srcWidth * 2 - 1 + dstStride] = (src[srcWidth - 1] + 3 * src[srcWidth - 1 + srcStride]) >> 2; |
|
|
|
|
|
|
|
|
|
dst += dstStride * 2; |
|
|
|
@ -561,7 +584,7 @@ static inline void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth, |
|
|
|
|
dst[0] = src[0]; |
|
|
|
|
|
|
|
|
|
for (x = 0; x < srcWidth - 1; x++) { |
|
|
|
|
dst[2*x+1]= (3*src[x] + src[x+1])>>2; |
|
|
|
|
dst[2 * x + 1] = (src[x] * 3 + src[x + 1]) >> 2; |
|
|
|
|
dst[2 * x + 2] = (src[x] + 3 * src[x + 1]) >> 2; |
|
|
|
|
} |
|
|
|
|
dst[2 * srcWidth - 1] = src[srcWidth - 1]; |
|
|
|
@ -575,12 +598,12 @@ static inline void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth, |
|
|
|
|
*/ |
|
|
|
|
static inline void uyvytoyv12_c(const uint8_t *src, uint8_t *ydst, |
|
|
|
|
uint8_t *udst, uint8_t *vdst, |
|
|
|
|
int width, int height, |
|
|
|
|
int lumStride, int chromStride, |
|
|
|
|
int srcStride) |
|
|
|
|
int width, int height, int lumStride, |
|
|
|
|
int chromStride, int srcStride) |
|
|
|
|
{ |
|
|
|
|
int y; |
|
|
|
|
const int chromWidth = width >> 1; |
|
|
|
|
|
|
|
|
|
for (y = 0; y < height; y += 2) { |
|
|
|
|
int i; |
|
|
|
|
for (i = 0; i < chromWidth; i++) { |
|
|
|
@ -666,9 +689,8 @@ void rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void interleaveBytes_c(const uint8_t *src1, const uint8_t *src2, |
|
|
|
|
uint8_t *dest, int width, |
|
|
|
|
int height, int src1Stride, |
|
|
|
|
int src2Stride, int dstStride) |
|
|
|
|
uint8_t *dest, int width, int height, |
|
|
|
|
int src1Stride, int src2Stride, int dstStride) |
|
|
|
|
{ |
|
|
|
|
int h; |
|
|
|
|
|
|
|
|
@ -740,9 +762,8 @@ static inline void yvu9_to_yuy2_c(const uint8_t *src1, const uint8_t *src2, |
|
|
|
|
static void extract_even_c(const uint8_t *src, uint8_t *dst, int count) |
|
|
|
|
{ |
|
|
|
|
dst += count; |
|
|
|
|
src += 2*count; |
|
|
|
|
src += count * 2; |
|
|
|
|
count = -count; |
|
|
|
|
|
|
|
|
|
while (count < 0) { |
|
|
|
|
dst[count] = src[2 * count]; |
|
|
|
|
count++; |
|
|
|
@ -754,7 +775,7 @@ static void extract_even2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, |
|
|
|
|
{ |
|
|
|
|
dst0 += count; |
|
|
|
|
dst1 += count; |
|
|
|
|
src += 4*count; |
|
|
|
|
src += count * 4; |
|
|
|
|
count = -count; |
|
|
|
|
while (count < 0) { |
|
|
|
|
dst0[count] = src[4 * count + 0]; |
|
|
|
@ -768,8 +789,8 @@ static void extract_even2avg_c(const uint8_t *src0, const uint8_t *src1, |
|
|
|
|
{ |
|
|
|
|
dst0 += count; |
|
|
|
|
dst1 += count; |
|
|
|
|
src0 += 4*count; |
|
|
|
|
src1 += 4*count; |
|
|
|
|
src0 += count * 4; |
|
|
|
|
src1 += count * 4; |
|
|
|
|
count = -count; |
|
|
|
|
while (count < 0) { |
|
|
|
|
dst0[count] = (src0[4 * count + 0] + src1[4 * count + 0]) >> 1; |
|
|
|
@ -783,7 +804,7 @@ static void extract_odd2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, |
|
|
|
|
{ |
|
|
|
|
dst0 += count; |
|
|
|
|
dst1 += count; |
|
|
|
|
src += 4*count; |
|
|
|
|
src += count * 4; |
|
|
|
|
count = -count; |
|
|
|
|
src++; |
|
|
|
|
while (count < 0) { |
|
|
|
@ -798,8 +819,8 @@ static void extract_odd2avg_c(const uint8_t *src0, const uint8_t *src1, |
|
|
|
|
{ |
|
|
|
|
dst0 += count; |
|
|
|
|
dst1 += count; |
|
|
|
|
src0 += 4*count; |
|
|
|
|
src1 += 4*count; |
|
|
|
|
src0 += count * 4; |
|
|
|
|
src1 += count * 4; |
|
|
|
|
count = -count; |
|
|
|
|
src0++; |
|
|
|
|
src1++; |
|
|
|
|