void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 2;
+ int i, num_pixels = src_size >> 2;
+
for (i=0; i<num_pixels; i++) {
#if HAVE_BIGENDIAN
/* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
#if HAVE_BIGENDIAN
*d++ = 255;
*d++ = (bgr&0x1F)<<3;
void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint16_t *d = (uint16_t *)dst;
const uint16_t *s = (const uint16_t *)src;
uint16_t rgb, r, g, b;
- end = s + src_size / 2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
rgb = *s++;
r = rgb & 0xF00;
void rgb16to24(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
*d++ = (bgr&0xF800)>>8;
*d++ = (bgr&0x7E0)>>3;
*d++ = (bgr&0x1F)<<3;
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
for (i=0; i<num_pixels; i++) {
unsigned rgb = ((const uint16_t*)src)[i];
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
for (i=0; i<num_pixels; i++) {
unsigned rgb = ((const uint16_t*)src)[i];
void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
#if HAVE_BIGENDIAN
*d++ = 255;
*d++ = (bgr&0x1F)<<3;
void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
*d++ = (bgr&0x7C00)>>7;
*d++ = (bgr&0x3E0)>>2;
*d++ = (bgr&0x1F)<<3;
void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
for (i=0; i<num_pixels; i++) {
unsigned rgb = ((const uint16_t*)src)[i];
void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
for (i=0; i<num_pixels; i++) {
- unsigned br;
unsigned rgb = ((const uint16_t*)src)[i];
- br = rgb&0x7c1F;
+ unsigned br = rgb & 0x7C1F;
((uint16_t*)dst)[i] = (br>>10) | (rgb&0x3E0) | (br<<10);
}
}
{
uint16_t *d = (uint16_t*)dst;
uint16_t *s = (uint16_t*)src;
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
for (i = 0; i < num_pixels; i++) {
unsigned rgb = s[i];
void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size;
+ int i, num_pixels = src_size;
+
for (i=0; i<num_pixels; i++) {
- unsigned b,g,r;
- register uint8_t rgb;
- rgb = src[i];
- r = (rgb&0x07);
- g = (rgb&0x38)>>3;
- b = (rgb&0xC0)>>6;
+ register uint8_t rgb = src[i];
+ unsigned r = (rgb & 0x07);
+ unsigned g = (rgb & 0x38) >> 3;
+ unsigned b = (rgb & 0xC0) >> 6;
dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6);
}
}
{
uint8_t *dest = dst;
const uint8_t *s = src;
- const uint8_t *end;
- end = s + src_size;
+ const uint8_t *end = s + src_size;
while (s < end) {
#if HAVE_BIGENDIAN
{
uint8_t *dest = dst;
const uint8_t *s = src;
- const uint8_t *end;
-
- end = s + src_size;
+ const uint8_t *end = s + src_size;
while (s < end) {
#if HAVE_BIGENDIAN
{
register const uint8_t* s=src;
register uint8_t* d=dst;
- register const uint8_t *end;
- const uint8_t *mm_end;
- end = s + src_size;
- mm_end = end - 3;
+ register const uint8_t *end = s + src_size;
+ const uint8_t *mm_end = end - 3;
+
while (s < mm_end) {
register unsigned x= *((const uint32_t *)s);
*((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0);
{
register const uint8_t* s=src;
register uint8_t* d=dst;
- register const uint8_t *end;
- const uint8_t *mm_end;
- end = s + src_size;
+ register const uint8_t *end = s + src_size;
+ const uint8_t *mm_end = end - 3;
- mm_end = end - 3;
while (s < mm_end) {
register uint32_t x= *((const uint32_t*)s);
*((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F);
static inline void rgb32to16_c(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
- const uint8_t *end;
uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ const uint8_t *end = s + src_size;
while (s < end) {
register int rgb = *(const uint32_t*)s; s += 4;
static inline void rgb32tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
- const uint8_t *end;
uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ 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);
static inline void rgb32to15_c(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
- const uint8_t *end;
uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ 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);
static inline void rgb32tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
- const uint8_t *end;
uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ 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);
static inline void rgb24tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
- const uint8_t *end;
uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
const int b = *s++;
const int g = *s++;
static inline void rgb24to16_c(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
- const uint8_t *end;
uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
const int r = *s++;
const int g = *s++;
static inline void rgb24tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
- const uint8_t *end;
uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
const int b = *s++;
const int g = *s++;
static inline void rgb24to15_c(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
- const uint8_t *end;
uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
const int r = *s++;
const int g = *s++;
*/
static inline void rgb15tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t*)src;
- end = s + src_size/2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
*d++ = (bgr&0x1F)<<3;
*d++ = (bgr&0x3E0)>>2;
*d++ = (bgr&0x7C00)>>7;
static inline void rgb16tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint8_t *d = (uint8_t *)dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
*d++ = (bgr&0x1F)<<3;
*d++ = (bgr&0x7E0)>>3;
*d++ = (bgr&0xF800)>>8;
static inline void rgb15to32_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
#if HAVE_BIGENDIAN
*d++ = 255;
*d++ = (bgr&0x7C00)>>7;
static inline void rgb16to32_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t*)src;
- end = s + src_size/2;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
#if HAVE_BIGENDIAN
*d++ = 255;
*d++ = (bgr&0xF800)>>8;
{
unsigned i;
for (i=0; i<src_size; i+=3) {
- register uint8_t x;
- x = src[i + 2];
+ register uint8_t x = src[i + 2];
dst[i + 1] = src[i + 1];
dst[i + 2] = src[i + 0];
dst[i + 0] = x;
int lumStride, int chromStride,
int dstStride, int vertLumPerChroma)
{
- int y;
+ int y, i;
const int chromWidth = width >> 1;
for (y=0; y<height; y++) {
#if HAVE_FAST_64BIT
- int i;
uint64_t *ldst = (uint64_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for (i = 0; i < chromWidth; i += 2) {
- uint64_t k, l;
- k = yc[0] + (uc[0] << 8) +
- (yc[1] << 16) + (vc[0] << 24);
- l = yc[2] + (uc[1] << 8) +
- (yc[3] << 16) + (vc[1] << 24);
+ uint64_t k = yc[0] + (uc[0] << 8) +
+ (yc[1] << 16) + (vc[0] << 24);
+ uint64_t l = yc[2] + (uc[1] << 8) +
+ (yc[3] << 16) + (vc[1] << 24);
*ldst++ = k + (l << 32);
yc += 4;
uc += 2;
}
#else
- int i, *idst = (int32_t *) dst;
+ int *idst = (int32_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for (i = 0; i < chromWidth; i++) {
#if HAVE_BIGENDIAN
int lumStride, int chromStride,
int dstStride, int vertLumPerChroma)
{
- int y;
+ int y, i;
const int chromWidth = width >> 1;
for (y=0; y<height; y++) {
#if HAVE_FAST_64BIT
- int i;
uint64_t *ldst = (uint64_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for (i = 0; i < chromWidth; i += 2) {
- uint64_t k, l;
- k = uc[0] + (yc[0] << 8) +
- (vc[0] << 16) + (yc[1] << 24);
- l = uc[1] + (yc[2] << 8) +
- (vc[1] << 16) + (yc[3] << 24);
+ uint64_t k = uc[0] + (yc[0] << 8) +
+ (vc[0] << 16) + (yc[1] << 24);
+ uint64_t l = uc[1] + (yc[2] << 8) +
+ (vc[1] << 16) + (yc[3] << 24);
*ldst++ = k + (l << 32);
yc += 4;
uc += 2;
}
#else
- int i, *idst = (int32_t *) dst;
+ int *idst = (int32_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for (i = 0; i < chromWidth; i++) {
#if HAVE_BIGENDIAN
{
int y;
const int chromWidth = width >> 1;
- y=0;
- for (; y<height; y+=2) {
+
+ for (y = 0; y < height; y += 2) {
int i;
for (i=0; i<chromWidth; i++) {
unsigned int b = src[6*i+0];
int srcStride1, int srcStride2,
int dstStride1, int dstStride2)
{
- int y;
- int x,w,h;
- w=width/2; h=height/2;
+ int x, y;
+ int w = width / 2;
+ int h = height / 2;
+
for (y=0;y<h;y++) {
const uint8_t* s1=src1+srcStride1*(y>>1);
uint8_t* d=dst1+dstStride1*y;
- x=0;
- for (;x<w;x++) d[2*x]=d[2*x+1]=s1[x];
+ for (x = 0; x < w; x++)
+ d[2 * x] = d[2 * x + 1] = s1[x];
}
for (y=0;y<h;y++) {
const uint8_t* s2=src2+srcStride2*(y>>1);
uint8_t* d=dst2+dstStride2*y;
- x=0;
- for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x];
+ for (x = 0; x < w; x++)
+ d[2 * x] = d[2 * x + 1] = s2[x];
}
}
int srcStride1, int srcStride2,
int srcStride3, int dstStride)
{
- int x;
- int y,w,h;
- w=width/2; h=height;
+ int x, y;
+ int w = width / 2;
+ int h = height;
+
for (y=0;y<h;y++) {
const uint8_t* yp=src1+srcStride1*y;
const uint8_t* up=src2+srcStride2*(y>>2);
const uint8_t* vp=src3+srcStride3*(y>>2);
uint8_t* d=dst+dstStride*y;
- x=0;
- for (; x<w; x++) {
+ for (x = 0; x < w; x++) {
const int x2 = x<<2;
d[8*x+0] = yp[x2];
d[8*x+1] = up[x];